此方案价值220美金
新建2个 snippets
spdn.liquid
<script>var _listeners=[];EventTarget.prototype.addEventListenerBase=EventTarget.prototype.addEventListener,EventTarget.prototype.addEventListener=function(e,t,p){_listeners.push({target:this,type:e,listener:t}),this.addEventListenerBase(e,t,p)},EventTarget.prototype.removeEventListeners=function(e){for(var t=0;t!=_listeners.length;t++){var r=_listeners[t],n=r.target,s=r.type,i=r.listener;n==this&&s==e&&this.removeEventListener(s,i)}};</script><script type="text/worker" id="spdnworker">onmessage=function(e){var t=new Request("https://api.speedien.com/optimize/bb4e29db6b1db4478e6f3a48369e5370",{redirect:"follow"});fetch(t).then(e=>e.text()).then(e=>{postMessage(e)})};</script>
<script type="text/javascript">var spdnx=new Worker("data:text/javascript;base64,"+btoa(document.getElementById("spdnworker").textContent));spdnx.onmessage=function(t){var e=document.createElement("script");e.type="text/javascript",e.textContent=t.data,document.head.appendChild(e)};</script>
<script type="text/javascript" data-spdn="1">
const observer=new MutationObserver(mutations=>{mutations.forEach(({addedNodes})=>{addedNodes.forEach(node=>{
if(node.tagName==='SCRIPT'&&node.innerHTML.includes('asyncLoad')){node.type='text/spdnscript'}
if(node.nodeType===1&&node.tagName==='SCRIPT'&&node.innerHTML.includes('hotjar')){node.type='text/spdnscript'}
if(node.nodeType===1&&node.tagName==='SCRIPT'&&node.innerHTML.includes('xklaviyo')){node.type='text/spdnscript'}
if(node.nodeType===1&&node.tagName==='SCRIPT'&&node.innerHTML.includes('recaptcha')){node.type='text/spdnscript'}
if(node.nodeType===1&&node.tagName==='SCRIPT'&&node.src.includes('klaviyo')){node.type='text/spdnscript'}
if(node.nodeType===1&&node.tagName==='SCRIPT'&&node.innerHTML.includes('gorgias')){node.type='text/spdnscript'}
if(node.nodeType===1&&node.tagName==='SCRIPT'&&node.innerHTML.includes('facebook.net')){node.type='text/spdnscript'}
if(node.nodeType===1&&node.tagName==='SCRIPT'&&node.src.includes('gorgias')){node.type='text/spdnscript'}
if(node.nodeType===1&&node.tagName==='SCRIPT'&&node.src.includes('stripe')){node.type='text/spdnscript'}
if(node.nodeType===1&&node.tagName==='SCRIPT'&&node.src.includes('mem')){node.type='text/spdnscript'}
if(node.nodeType===1&&node.tagName==='SCRIPT'&&node.src.includes('privy')){node.type='text/spdnscript'}
if(node.nodeType===1&&node.tagName==='SCRIPT'&&node.src.includes('incart')){node.type='text/spdnscript'}
if(node.nodeType===1&&node.tagName==='SCRIPT'&&node.src.includes('webui')){node.type='text/spdnscript'}
if(node.nodeType===1&&node.tagName==='SCRIPT'&&node.innerHTML.includes('gtag')){node.type='text/spdnscript'}
if(node.nodeType===1&&node.tagName==='SCRIPT'&&node.innerHTML.includes('tagmanager')){node.type='text/spdnscript'}
if(node.nodeType===1&&node.tagName==='SCRIPT'&&node.innerHTML.includes('gtm')){node.type='text/spdnscript'}
if(node.nodeType===1&&node.tagName==='SCRIPT'&&node.src.includes('googlet')){node.type='text/spdnscript'}
if(node.tagName==='SCRIPT'&&node.className=='analytics'){node.type='text/spdnscript'} if(node.tagName==='IMG'){node.loading='lazy'}
if(node.tagName==='IFRAME'){node.loading='lazy'} if(node.tagName==='SCRIPT'&&node.src!==""&&node.type!=='text/spdnscript'){node.type='text/2spdnscript'}
if(node.tagName==='SCRIPT'&&!node.type.includes('json')&&!node.type.includes('template')&&node.src===""&&node.type!=='text/spdnscript'&&!node.innerHTML.includes('spdnscript')){node.type='text/2spdnscript'}})})})
var ua = navigator.userAgent.toLowerCase();if ((ua.indexOf('chrome') > -1 || ua.indexOf('firefox') > -1) && window.location.href.indexOf("no-optimization") === -1) {observer.observe(document.documentElement,{childList:true,subtree:true})}</script>
spdn2.liquid
<script>var ua = navigator.userAgent.toLowerCase(); function rk_seq(t,e,n){void 0===n&&(n=0),t[n](function(){++n===t.length?e():rk_seq(t,e,n)})}function rk_u(){var t=document.createEvent("Event");t.initEvent("DOMContentLoaded",!0,!0),window.dispatchEvent(t),document.dispatchEvent(t);var e=document.createEvent("Event");e.initEvent("readystatechange",!0,!0),window.dispatchEvent(e),document.dispatchEvent(e);var n=document.createEvent("Event");n.initEvent("load",!0,!0),window.dispatchEvent(n),document.dispatchEvent(n);var d=document.createEvent("Event");d.initEvent("show",!0,!0),window.dispatchEvent(d),document.dispatchEvent(d);var i=window.document.createEvent("UIEvents");i.initUIEvent("resize",!0,!0,window,0),window.dispatchEvent(i),document.dispatchEvent(i),spdnx.postMessage("init")}function rk_spdni(t,e){var n=document.createElement("script");n.type="text/javascript",t.src?(n.onload=e,n.onerror=e,n.src=t.src,n.id=t.id,n.async=false,Object.assign(n.dataset,t.dataset)):(n.textContent=t.innerText,n.id=t.id,n.async=false,Object.assign(n.dataset,t.dataset)),t.parentNode.removeChild(t),document.body.appendChild(n),t.src||e()}function rk_spdn2(){void 0!==document.removeEventListeners&&(console.log("ev=1"),document.removeEventListeners("DOMContentLoaded"),document.removeEventListeners("load"));var t=document.querySelectorAll("script"),e=[];[].forEach.call(t,function(t){"text/2spdnscript"==t.getAttribute("type")&&e.push(function(e){rk_spdni(t,e)})}),rk_seq(e,rk_u)}observer.disconnect(),rk_spdn2();</script>
在 theme.liquid里面
在<head>后面 加
{% render ‘spdn’ %}
在</body> 前面加
{% render ‘spdn2’ %}