Skip to content

Instantly share code, notes, and snippets.

@vace

vace/editor.js

Last active Sep 9, 2019
Embed
What would you like to do?
微信排版编辑器小脚本
/**
* 支持:135,96,365,小蚂蚁编辑器
*/
;(function () {
var host = location.host
var isDomain = function (t) {
return host.indexOf(t) !== -1
}
var showOk = function (t) {
return alert('平台:' + t + ' 插件加载成功')
}
if (isDomain('96weixin')) {
$('ul').on('click', 'li[data-id]', function () {
$(this).data('vip', 0).data('free', 0)
})
$('#user_vip').data('vip', 3)
showOk('96weixin !')
} else if (isDomain('135editor')) {
$('body').on('click', '.vip-style', function () {
$(this).removeClass('vip-style')
})
showOk('135editor')
} else if (isDomain('365editor')) {
if (typeof vm === 'undefined') {
return alert('365editor FAILED')
}
vm.userInfo.IsVip = topnavInfo.userInfo.IsVip = 1
vm.userInfo.VipType = topnavInfo.userInfo.VipType = 3
showOk('365editor')
} else if (isDomain('xiumi')) {
return alert('暂不支持秀米')
} else if (isDomain('xmyeditor')) {
var usertext = localStorage.getItem('userinfo')
if (!usertext) return
var user = JSON.parse(usertext)
user.group_id = 3
user.expire_time = (Date.now() / 1000) + 30 * 24 * 3600
localStorage.setItem('userinfo', JSON.stringify(user))
var ajax = $.ajax
var findHtml = function (id, callback) {
$.get('/home/Oftenstyle/searchs?cateid=0&order=default&page=1&keyword=' + id, function (text) {
var html = $(text).find('.left_RightBottomD1').data('html')
if (!html) {
return alert('数据获取错误')
}
callback({code: 200, demo_code: html})
})
}
$.ajax = function (a, b, c, d) {
if (a && a.url) {
if (a.url === '/home/Oftenstyle/collectOrUse' || a.url === '/home/template/collectOrUse') {
return findHtml(a.data.id, function (data) {
return a.success(data)
})
} else if (a.url.indexOf('getStyleInfo') !== -1) {
return findHtml(a.data.id, function (data) {
return a.success(data)
})
}
}
return ajax(a, b, c, d)
}
return showOk('小蚂蚁')
} else {
return alert('暂不支持这个平台')
}
})();
!function(){var e=location.host,t=function(t){return-1!==e.indexOf(t)},r=function(e){return alert("平台:"+e+" 插件加载成功")}
if(t("96weixin"))$("ul").on("click","li[data-id]",function(){$(this).data("vip",0).data("free",0)}),$("#user_vip").data("vip",3),r("96weixin !")
else if(t("135editor"))$("body").on("click",".vip-style",function(){$(this).removeClass("vip-style")}),r("135editor")
else{if(!t("365editor")){if(t("xiumi"))return alert("暂不支持秀米")
if(t("xmyeditor")){var i=localStorage.getItem("userinfo")
if(!i)return
var n=JSON.parse(i)
n.group_id=3,n.expire_time=Date.now()/1e3+2592e3,localStorage.setItem("userinfo",JSON.stringify(n))
var o=$.ajax,a=function(e,t){$.get("/home/Oftenstyle/searchs?cateid=0&order=default&page=1&keyword="+e,function(e){var r=$(e).find(".left_RightBottomD1").data("html")
return r?void t({code:200,demo_code:r}):alert("数据获取错误")})}
return $.ajax=function(e,t,r,i){if(e&&e.url){if("/home/Oftenstyle/collectOrUse"===e.url||"/home/template/collectOrUse"===e.url)return a(e.data.id,function(t){return e.success(t)})
if(-1!==e.url.indexOf("getStyleInfo"))return a(e.data.id,function(t){return e.success(t)})}return o(e,t,r,i)},r("小蚂蚁")}return alert("暂不支持这个平台")}if("undefined"==typeof vm)return alert("365editor FAILED")
vm.userInfo.IsVip=topnavInfo.userInfo.IsVip=1,vm.userInfo.VipType=topnavInfo.userInfo.VipType=3,r("365editor")}}()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment