网上找的一段最新JS去除畅言广告的代码,分享给大家。精准像素没实际测试,但是是在人家网站上拔下来的,别人网站是真实去除了广告。
(function() { //畅言滤重 if (window.changyan !== undefined || window.cyan !== undefined) { return; } var createNs = function() { if (window.changyan !== undefined) { return; } else { window.changyan = {}; window.changyan.api = {}; window.changyan.api.config = function(conf) { window.changyan.api.tmpIsvPageConfig = conf; }; window.changyan.api.ready = function(fn) { window.changyan.api.tmpHandles = window.changyan.api.tmpHandles || []; window.changyan.api.tmpHandles.push(fn); }; window.changyan.ready = function(fn) { if (window.changyan.rendered) { fn && fn(); } else { window.changyan.tmpHandles = window.changyan.tmpHandles || []; window.changyan.tmpHandles.push(fn); } } } }; var createMobileNs = function() { if (window.cyan) { return; } window.cyan = {}; window.cyan.api = {}; window.cyan.api.ready = function(fn) { window.cyan.api.tmpHandles = window.cyan.api.tmpHandles || []; window.cyan.api.tmpHandles.push(fn); }; }; var loadVersionJs = function() { var loadJs = function(src, fun) { var head = document.getElementsByTagName('head')[0] || document.head || document.documentElement; var script = document.createElement('script'); script.setAttribute('type', 'text/javascript'); script.setAttribute('charset', 'UTF-8'); script.setAttribute('src', src); if (typeof fun === 'function') { if (window.attachEvent) { script.onreadystatechange = function() { var r = script.readyState; if (r === 'loaded' || r === 'complete') { script.onreadystatechange = null; fun(); } }; } else { script.onload = fun; } } head.appendChild(script); }; var ver = + new Date() + window.Math.random().toFixed(16); var url = 'https://changyan.itc.cn/upload/version-v3.js?' + ver; loadJs(url); }; createNs(); createMobileNs(); loadVersionJs(); }());
保持到代码本地,调用畅言的时候用这个本地JS文件就可以了。
本文转载自:精准像素:11px.cn ,感谢作者分享实用知识