if (window.addEventListener) { //for W3C DOM window.addEventListener("load", initializeZhpd, false); } else if (window.attachEvent) { //for IE window.attachEvent("onload", initializeZhpd); } else { window.onload = initOther; } function initializeZhpd() { if(!location.hash) return; var url = location.hash if(!url) return; var allowUrl = "#https://zexy.net/zhpd/"; if(url.indexOf(allowUrl) != 0) return; var iframeObjs = document.getElementsByTagName('iframe'); if(iframeObjs) { for(var i = 0; i < iframeObjs.length ; i++) { var attribute = iframeObjs[i].getAttribute('class'); if (attribute == null ){ attribute = iframeObjs[i].getAttribute('className'); } var iframeUrl = iframeObjs[i].src; if(attribute && attribute.indexOf('_zhpdAccessory_') > -1 && iframeUrl != null && !iframeUrl.match(/\/zap_[0-9]+\/?$/)) { iframeObjs[i].src = url.substr(1); } } } }