{"id":37,"date":"2023-09-28T15:23:10","date_gmt":"2023-09-28T07:23:10","guid":{"rendered":"https:\/\/www.weigot.com\/?p=37"},"modified":"2023-09-28T15:23:10","modified_gmt":"2023-09-28T07:23:10","slug":"%e5%85%b3%e4%ba%8e%e5%ae%a2%e6%9c%8d%e7%9a%84%e8%b0%83%e8%af%95","status":"publish","type":"post","link":"http:\/\/www.weigot.com\/index.php\/2023\/09\/28\/%e5%85%b3%e4%ba%8e%e5%ae%a2%e6%9c%8d%e7%9a%84%e8%b0%83%e8%af%95\/","title":{"rendered":"\u5173\u4e8e\u5ba2\u670d\u7684\u8c03\u8bd5"},"content":{"rendered":"\n<p>\u4ee5\u4e0b\u662f\u6839\u636e\u60a8\u7684\u8981\u6c42\u4fee\u6539\u540e\u7684\u4ee3\u7801\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;script>\n    let plugin_id = \"\";\n    let js_src = \"https:\/\/assets..com\/chat\/widget\/code\/install.js\";\n\n    const container = document.querySelector('.container');\n    const center = document.querySelector('#ss-chat-page');\n    const brand_logo = document.createElement('div');\n    const logo_text = document.createElement('span');\n    const logo = document.createElement('i');\n    logo_text.innerText = 'POWERED BY';\n    logo.classList.add('logo');\n\n    const standby_text = document.createElement('p');\n    standby_text.innerText = 'The current link has expired. Please contact customer service';\n\n    function handleClick() {\n        window.open('https:\/\/www..com\/?source=plugin_' + plugin_id);\n    }\n\n    function handlePluginHide() {\n        center.style.display = 'none';\n        container.appendChild(standby_text);\n    }\n\n    function sendMessage(iframe, message) {\n        iframe.contentWindow.postMessage(message, '*');\n    }\n\n    function addLogo() {\n        container.appendChild(brand_logo);\n        brand_logo.classList.add('brand_logo');\n        brand_logo.appendChild(logo_text);\n        brand_logo.appendChild(logo);\n        logo.addEventListener(\"click\", handleClick);\n    }\n\n    function handleShowMode(type) {\n        if (type === 'exclusiveLinkNoOpen') {\n            handlePluginHide();\n        }\n\n        if (type === 'normalShow') {\n            addLogo();\n        }\n    }\n\n    function checkMobile() {\n        const ua = window.navigator.userAgent.toLowerCase();\n        return window.outerWidth &lt; 980 &amp;&amp; \/mobile|android|iphone|ipad|phone\/i.test(ua);\n    }\n\n    if (checkMobile()) {\n        center.style.width = '100%';\n        center.style.height = '100%';\n    }\n\n    if (plugin_id) {\n        const scriptContent = `\n            (function(d, s, id, w, n) {\n                w.__ssc = w.__ssc || {};\n                w.__ssc.license = '${plugin_id}';\n                if (w.ssq) return false;\n                n = w.ssq = function() {n.callMethod?n.callMethod.apply(n,arguments):n.queue.push(arguments)};\n                n.push=n;n.loaded=!0;n.queue=&#91;];\n                var js, sjs = d.getElementsByTagName(s)&#91;0];\n                if (d.getElementById(id)) return;\n                js = d.createElement(s); js.id = id;\n                js.src ='${js_src}';\n                sjs.parentNode.insertBefore(js, sjs);\n            }(document, 'script', 'ss-chat', window));\n            window.__ssc.setting = {mode:'exclusiveLink', modeSelector: '#ss-chat-page', overTime: '',  isCustomized: 0};\n        `;\n        const $js = document.getElementById('insertJs');\n        if ($js) {\n            $js.innerHTML = scriptContent;\n        }\n\n        window.onload = function () {\n            const iframe = document.getElementById('s-chat-plugin');\n\n            window.addEventListener('message', function (event) {\r\n    if (event.source === iframe.contentWindow) {\r\n        const message = event.data;\r\n        handleShowMode(message.type);\r\n\r\n        \/\/ \u5728\u63a5\u6536\u5230\u5ba2\u6237\u7aef\u53d1\u9001\u7684\u4fe1\u606f\u540e\u663e\u793a\u5728\u9875\u9762\u9876\u90e8\r\n        const messagePlaceholder = document.createElement('div');\r\n        messagePlaceholder.innerText = JSON.stringify(message); \/\/ \u5c06\u6d88\u606f\u5bf9\u8c61\u8f6c\u6362\u4e3a\u5b57\u7b26\u4e32\r\n        document.body.insertBefore(messagePlaceholder, document.body.firstChild);\r\n    }\r\n});\n    } else {\n        handlePluginHide();\n    }\n&lt;\/script><\/code><\/pre>\n\n\n\n<p>\u5728\u4fee\u6539\u540e\u7684\u4ee3\u7801\u4e2d\uff0c\u6211\u6ce8\u91ca\u6389\u4e86\u539f\u6765\u7684\u6267\u884cAJAX\u8bf7\u6c42\u7684\u90e8\u5206\uff0c\u5e76\u6dfb\u52a0\u4e86\u4e00\u4e2a\u65b0\u7684\u5143\u7d20<code>messagePlaceholder<\/code>\uff0c\u7528\u4e8e\u5728\u9875\u9762\u9876\u90e8\u663e\u793a\u63a5\u6536\u5230\u7684\u4fe1\u606f\u5185\u5bb9\u3002\u60a8\u53ef\u4ee5\u6839\u636e\u9700\u8981\u5bf9<code>messagePlaceholder<\/code>\u5143\u7d20\u8fdb\u884c\u6837\u5f0f\u548c\u4f4d\u7f6e\u7684\u8c03\u6574\u3002<\/p>\n\n\n\n<p>\u5982\u679c\u60a8\u6709\u4efb\u4f55\u8fdb\u4e00\u6b65\u7684\u95ee\u9898\uff0c\u8bf7\u968f\u65f6\u63d0\u95ee\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4ee5\u4e0b\u662f\u6839\u636e\u60a8\u7684\u8981\u6c42\u4fee\u6539\u540e\u7684\u4ee3\u7801\uff1a \u5728\u4fee\u6539\u540e\u7684\u4ee3\u7801\u4e2d\uff0c\u6211\u6ce8\u91ca\u6389\u4e86\u539f\u6765\u7684\u6267\u884cAJAX\u8bf7\u6c42\u7684\u90e8\u5206\uff0c\u5e76\u6dfb\u52a0\u4e86\u4e00\u4e2a\u65b0\u7684\u5143 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-37","post","type-post","status-publish","format-standard","hentry","category-suibianjilu"],"_links":{"self":[{"href":"http:\/\/www.weigot.com\/index.php\/wp-json\/wp\/v2\/posts\/37","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.weigot.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.weigot.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.weigot.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.weigot.com\/index.php\/wp-json\/wp\/v2\/comments?post=37"}],"version-history":[{"count":1,"href":"http:\/\/www.weigot.com\/index.php\/wp-json\/wp\/v2\/posts\/37\/revisions"}],"predecessor-version":[{"id":38,"href":"http:\/\/www.weigot.com\/index.php\/wp-json\/wp\/v2\/posts\/37\/revisions\/38"}],"wp:attachment":[{"href":"http:\/\/www.weigot.com\/index.php\/wp-json\/wp\/v2\/media?parent=37"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.weigot.com\/index.php\/wp-json\/wp\/v2\/categories?post=37"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.weigot.com\/index.php\/wp-json\/wp\/v2\/tags?post=37"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}