diff --git a/app/assets/javascripts/side_bar_history.js b/app/assets/javascripts/side_bar_history.js index 64c82458..5ac212a8 100644 --- a/app/assets/javascripts/side_bar_history.js +++ b/app/assets/javascripts/side_bar_history.js @@ -1,26 +1,31 @@ -$(function () { +$(function () { $('#panel_sidebar a, #panel_main a.nav').live('click', function () { $.getScript(this.href); - history.pushState(null, document.title, this.href); - return false; + history.pushState(null, document.title, this.href); + history_edited = true; + return false; } ); - $('#panel_main a.reload').live('click', - function () { + $('#panel_main a.reload').live('click', + function () { $.getScript(this.href); - history.replaceState(null, document.title, this.href); - return false; - } + history.replaceState(null, document.title, this.href); + history_edited = true; + return false; + } ); $('.form').live('submit', function () { - $.post(this.action, $(this).serialize(), null, 'script'); - return false; + $.post(this.action, $(this).serialize(), null, 'script'); + history_edited = true; + return false; }); - $(window).bind("popstate", function () { - $.getScript(location.href); + $(window).bind("popstate", function () { + if (history_edited) { + $.getScript(location.href); + } }); }); \ No newline at end of file