// ==UserScript==
// @name 微信公众号编辑器插件去隐藏广告
// @namespace http://tampermonkey.net/
// @version 0.5
// @description try to take over the world!
// @author You
// @match https://mp.weixin.qq.com/cgi-bin/appmsg?t=media/appmsg_edit*
// @include https://www.135editor.com/*
// @grant none
// @downloadURL none
// ==/UserScript==
(function() {
if(location.host==="mp.weixin.qq.com"){
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)
}else if(location.host==="www.135editor.com"){
publishController.open_html_dialog = function(){}
$('body').on('click','.editor-template-list>li',function(){
console.log(1)
if($(this).hasClass('vip-style')){
let template = $(this).find('>section').html()
console.log(template)
insertHtml(template)
}
})
}
})();