Skip to content

Instantly share code, notes, and snippets.

@edvakf
Created October 22, 2009 10:12
Show Gist options
  • Save edvakf/215875 to your computer and use it in GitHub Desktop.
Save edvakf/215875 to your computer and use it in GitHub Desktop.
--- oAutoPagerize.js.original 2009-10-05 04:58:11.000000000 -0400
+++ oAutoPagerize.js 2009-10-24 03:13:10.000000000 -0400
@@ -46,7 +46,7 @@
Set.DISABLE_SITE = Set.DISABLE_SITE || [];
if (window.AutoPagerizeWedataSiteinfo) {
var SITEINFO = window.AutoPagerizeWedataSiteinfo;
- } else if (!this.chrome || !this.unsafeWindow) {
+ } else if (window.name != 'oAutoPagerizeRequest' && (!this.chrome || !this.unsafeWindow)) {
insertSITEINFO(function(siteinfo){
window.AutoPagerizeWedataSiteinfo = siteinfo;
oAutoPagerize(window, true);
@@ -859,16 +859,26 @@
}
};
function insertSITEINFO(callback,thisObject){
- var src = 'http://ss-o.net/json/wedataAutoPagerizeSITEINFO.js';
+ if (Set.DISABLE_IFRAME && window.parent !== window) return;
+ var src = (Set.SITEINFO_SERVER) ? Set.SITEINFO_SERVER.replace('%url',encodeURIComponent(location.href)) : 'http://ss-o.net/json/wedataAutoPagerizeSITEINFO.js';
var sc = document.createElementNS(HTML_NAMESPACE, 'script');
sc.type = 'text/javascript';
window.AutoPagerizeCallbackSiteinfo = function(res){
callback.call(thisObject,res);
window.AutoPagerizeCallbackSiteinfo = null;
+ sc.parentNode.removeChild(sc);
+ var ev = document.createEvent('Event');
+ ev.initEvent('AutoPagerize_SiteinfoLoaded', true, false);
+ document.dispatchEvent(ev);
};
sc.src = src;
- document.body.appendChild(sc);
+ function insert(){(document.body || document.documentElement).appendChild(sc);}
+ if (window.opera && document.readyState == 'interactive') document.addEventListener('DOMContentLoaded',insert,false);
+ else insert();
}
- if (window.opera && document.readyState == 'interactive') document.addEventListener('DOMContentLoaded',autopager,false);
- else autopager();
+
+ if (window.opera && document.readyState == 'interactive') {
+ document.addEventListener('AutoPagerize_SiteinfoLoaded',autopager,false);
+ document.addEventListener('DOMContentLoaded',autopager,false);
+ } else autopager();
})(window);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment