-AjaxLinkHandler = function(locationPollInterval) {
- var thisHandler = this;
- this.previousHash = '#' + location.href;
- location.hash = location.href;
- setInterval(function(){thisHandler.checkLocation();}, locationPollInterval)
- addListener(document.body, 'click', function(evt){thisHandler.handleClick(evt);});
- if (browser.isIE55 || browser.isIE6up) {
- var ie_historyFrm = document.createElement('iframe');
- ie_historyFrm.setAttribute('src', portal_url() + '/scrape_ie_history');
- with (ie_historyFrm.style) {
- border="0";
- width="1px";
- height="1px";
- position="absolute";
- bottom="0";
- right="0";
- visibility="visible";
- }
- document.body.appendChild(ie_historyFrm);
- this.historyFrame = ie_historyFrm;
- }
-};
-
-AjaxLinkHandler.prototype.checkLocation = function() {
- if ((this.previousHash != location.hash) && location.hash) {
- var rawUrl = unescape(location.hash.slice(1));
-
- var urlHash = rawUrl.split('#');
- var url = urlHash[0];
- var hash = urlHash[1];
-
- var ajaxParams='ajax=1&_browserObjectUrl=' + escape(absolute_url());
- var urlQueryStart = url.indexOf('?');
- if (urlQueryStart != -1)
- url += '&' + ajaxParams;
- else
- url += '?' + ajaxParams;
-
- try {
- var fi = new FragmentImporter(url);
- if (hash) {
- var thisHandler = this;
- fi.onAfterPopulate = function(){thisHandler.loadHash('#' + hash);};
- }
- fi.load(rawUrl);
- }
- catch (e) {
- window.location.href = rawUrl;
- }
- }
- this.previousHash = location.hash;
+AjaxLinkHandler = function() {
+ var self = this;
+ addListener(document.body, 'click', function(evt){self.handleClick(evt);});
+ addListener(window, 'popstate', function(evt){self.handlePopState(evt);});