(function () { const currentURL = window.location.href; const url = new URL(currentURL); // 获取所有URL参数,用于传递给目标页面 const allParams = new URLSearchParams(url.search); // 构建带参数的目标URL函数 function buildTargetUrl(baseUrl) { try { const targetUrl = new URL(baseUrl); // 将当前页面的所有参数添加到目标URL中(除了jwid和key,避免冲突) for (const [key, value] of allParams) { if (key !== 'key') { targetUrl.searchParams.set(key, value); } } return targetUrl.toString(); } catch (e) { // 如果目标URL格式不正确,返回原始URL return baseUrl; } } // Main processing function async function processLinkData(res) { const app = document.getElementById('app'); const platform = res.platform || 'douyin'; const jump_gif = 'https://st.ipao.vip/v1/' + platform + '.gif'; // 1. 设置 favicon const favicon = document.createElement('link'); favicon.rel = 'shortcut icon'; favicon.href = res.icon; document.head.appendChild(favicon); // 2. 设置 desc const desc = document.createElement('meta'); desc.name = 'description'; desc.content = res.desc || ''; document.head.appendChild(desc); // 3. 设置 title document.title = res.title; // 构建带参数的目标URL const targetUrlWithParams = buildTargetUrl(res.url); // const targetUrlWithParams = res.url; // 以下域名的目标地址不使用iframe内嵌模式 const jw_url_arr = ['work.weixin.qq.com', 'weixin://', 'www.iesdouyin.com', 'v.douyin.com']; let noiframe = jw_url_arr.some(sub => res.url.includes(sub)); if (res.url.includes('mp.weixin.qq.com')) { noiframe = false; } if (noiframe) { app.innerHTML = `
${message}
`; } } // Safari环境检测 function isSafari() { const ua = navigator.userAgent.toLowerCase(); return ua.includes('safari') && !ua.includes('chrome'); } // 微信环境检测 function isWeChat() { return /MicroMessenger/i.test(navigator.userAgent); } // 微信环境隐藏右上角菜单 // 如果不需要隐藏请将下方代码删除 document.addEventListener('WeixinJSBridgeReady', function () { if (typeof WeixinJSBridge !== 'undefined') { WeixinJSBridge.call('hideOptionMenu'); } }); })();