From 2380416b080fe3ccfd8d8ee25c0864d7a07c6d94 Mon Sep 17 00:00:00 2001 From: henriyli Date: Thu, 2 Oct 2014 13:29:59 +0300 Subject: [PATCH] the language links direct to the correct page after ajax loads --- resource/js/docready.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/resource/js/docready.js b/resource/js/docready.js index 27e388014..a46b2367f 100644 --- a/resource/js/docready.js +++ b/resource/js/docready.js @@ -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; @@ -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;