History Manager

History Manager on Facebook It's only used for study. :)

by Songhun

JavaScript

var HistoryManager = window.HistoryManager || {_IFRAME_BASE_URI: 'http://static.ak.facebook.com/common/history_manager.php',history: null,current: 0,fragment: null,_setIframeSrcFragment: function(b) {
       b = b.toString();
       var a = HistoryManager.history.length - 1;
       HistoryManager.iframe.src = HistoryManager._IFRAME_BASE_URI + '?|index=' + a + '#' + encodeURIComponent(b);
       return HistoryManager;
   },getIframeSrcFragment: function() {
       return decodeURIComponent(URI(HistoryManager.iframe.contentWindow.document.location.href).getFragment());
   },nextframe: function(a, b) {
       if (b) {
           HistoryManager._setIframeSrcFragment(a);
           return;
       }
       if (a !== undefined) {
           HistoryManager.iframeQueue.push(a);
       } else {
           HistoryManager.iframeQueue.splice(0, 1);
           HistoryManager.iframeTimeout = null;
           HistoryManager.checkURI();
       }
       if (HistoryManager.iframeQueue.length && !HistoryManager.iframeTimeout) {
           var c = HistoryManager.iframeQueue[0];
           HistoryManager.iframeTimeout = setTimeout(function() {
               HistoryManager._setIframeSrcFragment(c);
           }, 100, false);
       }
   },isInitialized: function() {
       return !!HistoryManager._initialized;
   },init: function() {
       if (!env_get('ALLOW_TRANSITION_IN_IFRAME') && window != window.top)
           return;
       if (HistoryManager._initialized)
           return HistoryManager;
       var b = URI();
       var a = b.getFragment() || '';
       if (a.charAt(0) === '!') {
           a = a.substr(1);
           b.setFragment(a);
       }
       if (URI.getRequestURI(false).getProtocol().toLowerCase() == 'https')
           HistoryManager._IFRAME_BASE_URI = 'https://s-static.ak.facebook.com/common/history_manager.php';
       copy_properties(HistoryManager, {_initialized: true,fragment: a,orig_fragment: a,history: [b],callbacks: [],lastChanged: new...