diff --git a/public/javascripts/aspect-filters.js b/public/javascripts/aspect-filters.js index 2c1ff1388..c8fb30de3 100644 --- a/public/javascripts/aspect-filters.js +++ b/public/javascripts/aspect-filters.js @@ -7,19 +7,10 @@ $(document).ready(function(){ var selectedGUIDS = [], requests = 0; - $("#aspect_nav li").each(function(){ - var button = $(this), - guid = button.attr('data-guid'); - - if(guid && location.href.search("a_ids..="+guid+"(&|$)") != -1){ - button.addClass('selected'); - selectedGUIDS.push(guid); - } - }); - // popstate $(window).bind("popstate", function(){ $.getScript(location.href); + setGUIDS(); return false; }); @@ -156,6 +147,7 @@ $(document).ready(function(){ // some browsers (Firefox for example) don't support pushState if (typeof(history.pushState) == 'function') { history.pushState(null, document.title, newURL); + setGUIDS(); } $.ajax({ @@ -198,4 +190,17 @@ $(document).ready(function(){ } + function setGUIDS(){ + selectedGUIDS = []; + $("li", "#aspect_nav").each(function(){ + var button = $(this), + guid = button.attr('data-guid'); + if(guid && location.href.search("a_ids..="+guid+"(&|$)") != -1){ + button.addClass('selected'); + selectedGUIDS.push(guid); + } + }); + console.log(selectedGUIDS); + } + });