// ==UserScript== // @name 微信公众号编辑器插件去隐藏广告 // @namespace http://tampermonkey.net/ // @version 0.4 // @description try to take over the world! // @author You // @match https://mp.weixin.qq.com/cgi-bin/appmsg?t=media/appmsg_edit* // @grant none // @downloadURL none // ==/UserScript== (function() { setTimeout(function(){ var toolbar = $('#js_toolbar_1') toolbar.append('
清除
') var blackClassList = ['xmt-style-block','sougou','KolEditor','yead_editor','_135editor'] var blackAttrList = ['data-tools','powered-by','data-author'] $('#removeAd').click(function(){ var dom = $('#ueditor_0').contents().find('*') dom.each(function(){ let _this = this blackClassList.forEach(function(e){ $(_this).removeClass(e) }) blackAttrList.forEach(function(e){ $(_this).removeAttr(e) }) if($(this).attr('label')==='Powered by 135editor.com'){$(this).removeAttr('label')} }) }) $('#js_submit').hide() $('#js_preview').after('') $('#js_submit2').click(function(){ var html = $('#ueditor_0').contents() let haveAd = html.find(blackClassList.map(e=>'.'+e).join(',')).length>0 || html.find(blackAttrList.map(e=>'['+e+']').join(',')).length>0 || html.find('[attr="Powered by 135editor.com"]').length>0 if(haveAd){ alert('请先去除广告再保存') }else{ $('#js_submit').click() } }) },2000) })();