Skip to content

Commit

Permalink
the language links direct to the correct page after ajax loads
Browse files Browse the repository at this point in the history
  • Loading branch information
henriyli authored and osma committed Oct 2, 2014
1 parent 6f355d8 commit 2380416
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions resource/js/docready.js
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,12 @@ $(function() { // DOCUMENT READY
if (window.history.pushState)
window.history.pushState({url: targetUrl}, '', targetUrl);
$content.append(response);
$.each($('#language > a'), function(index, val) {
var btn_lang = $(val).attr('id');
btn_lang = (btn_lang.substr(btn_lang.indexOf('-')+1));
var url = targetUrl.replace('/' + lang + '/', '/' + btn_lang +'/');
$(val).attr('href', url);
});
}
});
return false;
Expand Down Expand Up @@ -310,6 +316,12 @@ $(function() { // DOCUMENT READY
if (!$('#hierarchy').length)
$('#alpha').after(hierButton);
$('#hier-trigger').attr('href', event.target.href);
$.each($('#language > a'), function(index, val) {
var btn_lang = $(val).attr('id');
btn_lang = (btn_lang.substr(btn_lang.indexOf('-')+1));
var url = encodeURI(event.target.href).replace('/' + lang + '/', '/' + btn_lang +'/');
$(val).attr('href', url);
});
}
});
return false;
Expand Down

0 comments on commit 2380416

Please sign in to comment.