diff --git a/lib/system/lib/system.js b/lib/system/lib/system.js index 62e7a7f..3e4338f 100644 --- a/lib/system/lib/system.js +++ b/lib/system/lib/system.js @@ -51,7 +51,7 @@ SYSTEM.prototype.hashchange = function () { system.go_state(system.start_state); //user callback if(system.hash_change){ - system.hash_change(system.cur_state().split(';')[0].split('(')[0]);} + system.hash_change(system.cur_state());} }; SYSTEM.prototype.handle_call_pages_page = function (html,entry,id,forced,cached,callback) { var url = entry['url']+(window.location.search.substr(1) ? '&'+window.location.search.substr(1) : '' ); @@ -132,41 +132,15 @@ SYSTEM.prototype.handle_call_pages_page = function (html,entry,id,forced,cached, SYSTEM.prototype.handle_call_pages_entry = function (entry,id,forced,cached, callback) { var url = entry['url']+(window.location.search.substr(1) ? '&'+window.location.search.substr(1) : '' ); //check loaded state of div - reload only if required - if(forced || this.state[entry['div']] !== url || !$(entry['div']).length || $(entry['div']).html() === ''){ + if(forced || system.state[entry['div']] !== url || !$(entry['div']).length || $(entry['div']).html() === ''){ //load page - this.call_url(url,function(data){system.handle_call_pages_page(data,entry,id,forced,cached,callback);},{},'html',true); + system.call_url(url,function(data){system.handle_call_pages_page(data,entry,id,forced,cached,callback);},{},'html',true); } else { - this.log_info('load page: '+id+entry['div']+' '+url+' - cached'); + system.log_info('load page: '+id+entry['div']+' '+url+' - cached'); callback(); } } -/** - * Process an array of data synchronously. - * - * @param data An array of data. - * @param processData A function that processes an item of data. - * Signature: function(item, i, callback), where {@code item} is the i'th item, - * {@code i} is the loop index value and {@code calback} is the - * parameterless function to call on completion of processing an item. - */ -function doSynchronousLoop(data, processData, done) { - if (data.length > 0) { - var loop = function(data, i, processData, done) { - processData(data[i], i, function() { - if (++i < data.length) { - loop(data, i, processData, done); - } else { - done(); - } - }); - }; - loop(data, 0, processData, done); - } else { - done(); - } -} - //internal function to handle pagestate results SYSTEM.prototype.handle_call_pages = function (data,id,forced,cached) { var hash = null; diff --git a/sai/page/js/sai.js b/sai/page/js/sai.js index 7408d2f..a73beda 100644 --- a/sai/page/js/sai.js +++ b/sai/page/js/sai.js @@ -9,6 +9,8 @@ $(document).ready(function() { }); function sys_hashchange(state){ + console.log(state); + state = state ? state.split(';')[0].split('(')[0] : state; $('.nav li,#sai_navbar li, #project_navbar li').each(function(){ $(this).removeClass('active');}); if($('#menu_'+state).parent().length){