Closed hunmer closed 3 years ago
Name 定时换装 Description 仅默认模型有效 Code
module.exports = () => {
let timer = setInterval(() => {
ppet.webContents.send('switch-tool-message', true);
ppet.webContents.executeJavaScript(`document.querySelector('span[data-name="clothes"]').click()`);
ppet.webContents.send('switch-tool-message', false);
}, 1000 * 60 * 10); // 10分钟
return () => {
timer && clearInterval(timer);
};
};
Name 飘动效果 Description 动态更改css实现飘动效果 Code
module.exports = () => {
const plugin_enable = () => {
ppet.webContents.executeJavaScript(`
var switchd = false;
window.timer_pd = setInterval(function(){
document.querySelector('#waifu').style.bottom = (switchd ? 25 : -25) + 'px';
switchd = !switchd;
}, 3000);
`);
}
const plugin_stop = () => {
ppet.webContents.executeJavaScript(`clearInterval(window.timer_pd); document.querySelector('#waifu').style.bottom = '0px';`);
};
const handleWindowFocus = () => {
plugin_stop();
};
const handleWindowBlur = () => {
plugin_enable();
};
ppet.on('blur', handleWindowBlur);
ppet.on('focus', handleWindowFocus);
return () => {
ppet.removeListener('focus', handleWindowFocus);
ppet.removeListener('blur', handleWindowBlur);
plugin_stop();
};
plugin_enable();
};
如果有模型超出去建议缩小或者更改画布大小 自定义模型显示不全的..需要修改*.model.json下的layout属性 如图: 修改后需要再一次导入模型才生效
Name 记住看板娘位置 Description plugin description Code
module.exports = () => {
let newPosition, bounds, oldPosition;
ppet.webContents.executeJavaScript(`localStorage.getItem('live2d_pos', '')`).then((res) => {
oldPosition = res;
let pos = res.split('-');
if (pos.length == 2) {
global.mainWindow.setPosition(parseInt(pos[0]), parseInt(pos[1]));
}
});
let timer = setInterval(() => {
bounds = global.mainWindow.getBounds();
newPosition = bounds.x + '-' + bounds.y;
if (newPosition != oldPosition) {
oldPosition = newPosition;
ppet.webContents.executeJavaScript(`localStorage.setItem('live2d_pos', '` + newPosition + `')`);
}
}, 3000);
return () => {
timer & clearInterval(timer);
};
};
created: Wed, 27 Jan 2021 05:03:45 GMT updated:Wed, 27 Jan 2021 07:03:25 GMT
Name 替换默认消息 Description 好rz的方法...勉强能用 Code
module.exports = () => {
ppet.webContents.executeJavaScript(`
document.styleSheets[0].addRule('#waifu-tips', 'display: none');
var retip = document.createElement('div');
retip.id = 'waifu-tips1';
retip.style.cssText = 'animation: shake 50s ease-in-out 5s infinite;background-color: rgb(109 109 109 / 50%);border: 1px solid rgb(66 65 64 / 62%);border-radius: 12px;box-shadow: 0 3px 15px 2px rgb(191 183 183);font-size: 14px;line-height: 24px;margin: -30px 20px;min-height: 70px;opacity: 1;overflow: hidden;padding: 5px 10px;position: absolute;text-overflow: ellipsis;transition: opacity 1s;width: 250px;word-break: break-all;display: none;color: white';
var waifu = document.querySelector('#waifu');
waifu.insertBefore(retip, waifu.childNodes[0]);
var lastMsg;
window.msgChecktimer = setInterval(function(){
let tip = document.querySelector('#waifu-tips');
if(tip != undefined){
if(tip.innerHTML == lastMsg) return;
var texts = [];
if(tip.innerHTML == "" || tip.innerHTML == ""){
alert(tip.innerHTML);
}
switch(tip.innerHTML){
// 移动到 看板娘
case "干嘛呢你,快把手拿开~~":
case "鼠…鼠标放错地方了!":
case "你要干嘛呀?":
case "喵喵喵?":
case "怕怕(ノ≧∇≦)ノ":
case "非礼呀!救命!":
case "这样的话,只能使用武力了!":
case "我要生气了哦":
case "不要动手动脚的!":
case "真…真的是不知羞耻!":
case "嗯~啊~嗯~~":
case "Hentai!":
return; // 不显示
// 点击
case "是…是不小心碰到了吧…":
case "萝莉控是什么呀?":
case "你看到我的小熊了吗?":
case "再摸的话我可要报警了!⌇●﹏●⌇":
case "再摸的话我可要报警了!?●﹏●?":
case "110 吗,这里有个变态一直在摸我(ó﹏ò。)":
case "110 吗,这里有个变态一直在摸我(ó﹏ò?)":
case "不要摸我了,我会告诉老婆来打你的!":
case "干嘛动我呀!小心我咬你!":
case "别摸我,有什么好摸的!":
texts = ["抓?", "呜...", "嘤!"];
break;
// 移动到 换装按钮
case "喜欢换装 PLAY 吗?":
case "这次要扮演什么呢?":
case "变装!":
case "让我们看看接下来会发生什么!":
break;
// 换装操作
case "我还没有其他衣服呢!":
case "我的新衣服好看嘛?":
break;
// 移动到 拍照按钮
case "你要给我拍照呀?一二三~茄子~":
case "要不,我们来合影吧!":
case "保持微笑就好了~":
break;
case "照好了嘛,是不是很可爱呢?":
break;
// 假日
case "<span>元旦</span>了呢,新的一年又开始了,今年是{year}年~":
tip.innerHTML = "元旦啦!~~";
break;
case "又是一年<span>情人节</span>,{year}年找到对象了嘛~":
tip.innerHTML = "情人节啦!~~";
break;
case "今天是<span>国际妇女节</span>!":
break;
case "今天是<span>植树节</span>,要保护环境呀!":
break;
case "悄悄告诉你一个秘密~<span>今天是愚人节,不要被骗了哦~</span>":
break;
case "今天是<span>五一劳动节</span>,计划好假期去哪里了吗~":
break;
case "<span>儿童节</span>了呢,快活的时光总是短暂,要是永远长不大该多好啊…":
break;
case "<span>中国人民抗日战争胜利纪念日</span>,铭记历史、缅怀先烈、珍爱和平、开创未来。":
break;
case "<span>教师节</span>,在学校要给老师问声好呀~":
break;
case "<span>国庆节</span>到了,为祖国母亲庆生!":
break;
case "今年的<span>双十一</span>是和谁一起过的呢~":
break;
case "这几天是<span>圣诞节</span>,主人肯定又去剁手买买买了~":
break;
// 移动到 切换看板娘按钮
case "你是不是不爱人家了呀,呜呜呜~":
case "要见见我的姐姐嘛?":
case "想要看我妹妹嘛?":
case "要切换看板娘吗?":
break;
// 欢迎消息
case "好久不见,日子过得好快呢……":
case "大坏蛋!你都多久没理人家了呀,嘤嘤嘤~":
case "嗨~快来逗我玩吧!":
case "拿小拳拳锤你胸口!":
texts = ["今天也是元气满满的一天呢"];
break;
// 时间提示
case "早上好!一日之计在于晨,美好的一天就要开始了。":
tip.innerHTML = "哦哈哟!~~";
break;
case "上午好!工作顺利嘛,不要久坐,多起来走动走动哦!":
break;
case "中午了,工作了一个上午,现在是午餐时间!":
break;
case "午后很容易犯困呢,今天的运动目标完成了吗?":
break;
case "傍晚了!窗外夕阳的景色很美丽呢,最美不过夕阳红~":
break;
case "晚上好,今天过得怎么样?":
break;
case "深夜时要爱护眼睛呀!":
break;
case "你是夜猫子呀?这么晚还不睡觉,明天起的来嘛?":
tip.innerHTML = "哦呀斯密!~~";
break;
}
if(texts.length > 0){
tip.innerHTML = texts[Math.floor(Math.random() * texts.length)];
}
retip.innerHTML = tip.innerHTML;
retip.style.display = 'unset';
lastMsg = tip.innerHTML;
}else{
retip.style.display = 'none';
}
}, 200);
`);
return () => {
ppet.webContents.executeJavaScript(`
document.styleSheets[0].addRule('#waifu-tips', 'display: unset');
clearInterval(window.msgChecktimer);
delete window.msgChecktimer;
document.querySelector('#waifu-tips1').remove();
`);
};
};
created: Wed, 27 Jan 2021 06:14:39 GMT updated:Thu, 28 Jan 2021 08:18:05 GMT
Name 推送我的B站追番 Description plugin description Code
module.exports = () => {
var timer;
ppet.webContents.executeJavaScript(`localStorage.getItem('plugin_bangumi')`).then((res) => {
ppet.webContents.executeJavaScript(`
function hideCard(){
document.querySelector('#card').classList.add('slide-out-top');
}
function openPopup(url){
var popup=window.open(url, "_blank", "height=800, width=1200, resizable=yes");
if(popup != undefined){
popup.eval("document.body.style.backgroundColor='#e6e6e6';var btn = document.createElement('button');btn.style.cssText = 'position: fixed;z-index:99999;right: 0;top: 0; width: 50px; height: 50px;cursor: pointer;background-color: rgba(0, 0, 0, .5);color: white;font-size: 30px;';btn.innerHTML = 'x';btn.onclick = function(){window.close()};document.body.appendChild(btn);")
}
hideCard();
}
(function(){
var head = document.getElementsByTagName("head")[0];
var style = document.createElement("style");
var rules = document.createTextNode('#card{opacity:0;z-index:999;position:fixed;width:300px;height:120px;display:grid;grid-template-columns:repeat(5,1fr);grid-template-rows:repeat(3,1fr);grid-column-gap:0px;grid-row-gap:0px;background-color:rgba(0,0,0,.8);text-align:center;padding:10px;}.myButton{box-shadow:0px 10px 14px -7px #276873;background:linear-gradient(to bottom,#599bb3 5%,#408c99 100%);background-color:#599bb3;border-radius:8px;display:inline-block;cursor:pointer;color:#ffffff;font-family:Arial;font-size:12px;font-weight:bold;padding:10px 32px;text-decoration:none;text-shadow:0px 1px 0px #3d768a;}.myButton:hover{background:linear-gradient(to bottom,#408c99 5%,#599bb3 100%);background-color:#408c99;}.myButton:active{position:relative;top:1px;}.slide-in-elliptic-top-fwd{animation:slide-in-elliptic-top-fwd .7s cubic-bezier(.25,.46,.45,.94) both}@keyframes slide-in-elliptic-top-fwd{0%{transform:translateY(-600px) rotateX(-30deg) scale(0);transform-origin:50% 100%;opacity:0}100%{transform:translateY(0) rotateX(0) scale(1);transform-origin:50% 1400px;opacity:1}}.slide-out-top{animation:slide-out-top .5s cubic-bezier(.55,.085,.68,.53) both}@keyframes slide-out-top{0%{transform:translateY(0);opacity:1}100%{transform:translateY(-1000px);opacity:0}}');
style.type = "text/css";
if (style.styleSheet) {
style.styleSheet.cssText = rules.nodeValue;
} else {
style.appendChild(rules);
}
head.appendChild(style);
window.plugin_bangumi_css = style;
var card = document.createElement('div');
card.id = 'card';
card.innerHTML = '<div class="cover"style="grid-area: 1 / 1 / 3 / 2;"><img src="{cover}"width="60px"height="60px"></div><div class="bottom"style="grid-area: 3 / 1 / 4 / 6;text-align: right"><a class="myButton"href="{url}">前往观看</a><a class="myButton"href="javascript: hideCard();"style="margin-left: 10px;box-shadow: 0px 10px 14px -7px #6d6366;background: linear-gradient(to bottom, #ce4c78 5%, #af2a58 100%);background-color: #ff4483;">稍后观看</a></div><div class="title"style="line-height: 40px;padding-left: 10px;grid-area: 1 / 2 / 2 / 6;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;color: #fff;"><span>{title}</span></div><div class="subTitle"style="grid-area: 2 / 2 / 3 / 6;color: #e91e63;"><span>{subTitle}</span></div>'
document.body.appendChild(card);
}());
`);
var database = res == null ? {} : JSON.parse(res);
var uid = 55424152; // 你的b站UID 如:https://space.bilibili.com/55424152 且设置里的隐私设置里的[追番追剧]要选择[公开]
timer = setInterval(() => {
fetch('https://api.catbk.cn/list?vmid='+uid)
.then(response => response.json())
.then(res => {
if(res.code == 0){
var count = 0;
for(var i=0;i<res.data.total;i++){
var detail = res.data.list[i];
var sid = "_" + detail.season_id;
if(database[sid] == undefined || detail.new_ep.id != database[sid]){
database[sid] = detail.new_ep.id;
count++;
if((new Date().getTime() - new Date(detail.new_ep.pub_time).getTime()) / 1000 <= 3600){ // 最近一小时内上传
ppet.webContents.executeJavaScript(`
localStorage.setItem('plugin_bangumi', '` + JSON.stringify(database) + `');
var card = document.querySelector('#card');
card.querySelector('.cover img').src = '`+detail.square_cover+`';
card.querySelector('.title span').innerHTML = '`+detail.title+`';
card.querySelector('.subTitle span').innerHTML = '`+detail.new_ep.title+` - `+detail.new_ep.long_title+`';
card.querySelector('a').href = 'javascript: openPopup("https://www.bilibili.com/bangumi/play/ep`+detail.new_ep.id+`");'
card.classList.remove('slide-out-top')
card.classList.add('slide-in-elliptic-top-fwd');
`);
return; // 一次只显示一个
}
}
}
if(count > 0) ppet.webContents.executeJavaScript(`localStorage.setItem('plugin_bangumi', '` + JSON.stringify(database) + `')`);
}
});
}, 1000 * 30); // 30秒
});
return () => {
timer && clearInterval(timer);
ppet.webContents.executeJavaScript(`document.querySelector('#card').remove();`);
};
};
created: Thu, 28 Jan 2021 20:23:41 GMT updated:Thu, 28 Jan 2021 20:28:08 GMT
Name 歌单播放器 Description 支持netease, tencent, kugou, xiami, baidu Code
module.exports = () => {
ppet.webContents.executeJavaScript(`
function insertPlayer() {
// 插入播放器
var div = document.createElement('div');
div.id = 'musicPlayer';
var html = '<meting-js ';
for (var key in window.plugin_musicPlayer.config) {
html = html + key + '=' + window.plugin_musicPlayer.config[key] + ' ';
}
html = html + '></meting-js>';
div.innerHTML = html;
div.oncontextmenu = function(ev) {
var meting = document.querySelector('meting-js');
meting.aplayer.setMode(meting.aplayer.mode == 'mini' ? 'normal' : 'mini');
ev.preventDefault();
}
div.onclick = function() {
if (document.querySelector('#musicPlayer_btns') == null) {
var btns = document.createElement('ol');
btns.id = 'musicPlayer_btns';
btns.style.cssText = 'color: white;padding: 5px;background-color: rgba(0, 0, 0, .5);font-size: 15px;list-style: none;position: absolute;right: -18px;top: 0px; cursor: pointer;';
var li = document.createElement('li');
li.innerHTML = '+';
li.onclick = function() {
var prompt = document.createElement('div');
prompt.id = 'prompt';
prompt.style = 'position: fixed;z-index: 999;left: 5%;top: 30%;width: 300px;background-color: rgba(0, 0, 0, .7);padding: 5px;';
prompt.innerHTML = '<span style="color: white;">输入歌单链接</span><input type="text" id="inpu_url" value="http://music.163.com/playlist?id=2666688507&userid=381754034"><div style="text-align: center;"><button onclick="_submit();">确定</button><button onclick="_hideDialog();">取消</button></div>';
document.body.appendChild(prompt);
}
btns.appendChild(li);
li = document.createElement('li');
li.innerHTML = 'v';
li.onclick = function() {
document.querySelector(".aplayer-icon-menu").click();
}
btns.appendChild(li);
document.querySelector('.aplayer').appendChild(btns);
}
}
document.body.appendChild(div);
}
function _hideDialog() {
document.querySelector('#prompt').remove();
}
function _submit() {
var s_server, s_id;
var s_url = document.querySelector('#inpu_url').value;
if (s_url != '') {
if (s_url.indexOf('music.163.com') != -1) {
s_server = 'netease';
s_id = cutString(s_url + '&', 'playlist?id=', '&');
} else
if (s_url.indexOf('y.qq.com') != -1) { // https://y.qq.com/n/yqq/playsquare/7455077979.html#stat=y_new.playlist.pic_click
s_server = 'tencent';
s_id = cutString(s_url + '&', 'playsquare/', '.html');
} else
if (s_url.indexOf('kugou.com') != -1) { // https://www.kugou.com/yy/special/single/3383423.html
s_server = 'kugou';
s_id = cutString(s_url + '&', 'single/', '.html');
} else
if (s_url.indexOf('music.taihe.com') != -1) { // https://music.taihe.com/songlist/272570
s_server = 'baidu';
s_id = cutString(s_url + '&', 'songlist/', '&');
} else
if (s_url.indexOf('xiami.com') != -1) { //
https: //www.xiami.com/collect/1314878731?spm=a2oj1.12028025.collect.2.54776ee1kBiFXg
s_server = 'xiami';
s_id = cutString(s_url + '?', '/collect/', '?');
}
else {
alert('不支持的播放列表');
return;
}
if (s_id != '') {
window.plugin_musicPlayer.config.server = s_server;
window.plugin_musicPlayer.config.id = s_id;
localStorage.setItem('plugin_musicPlayer', JSON.stringify(window.plugin_musicPlayer.config));
alert('设置成功,按ctrl+r刷新');
//location.reload();
} else {
alert('没有在链接中找到歌单ID')
}
_hideDialog();
}
function cutString(str, s, e) {
var i_start = str.indexOf(s);
if (i_start != -1) {
i_start += s.length;
var i_end = str.indexOf(e, i_start);
if (i_end != -1) {
return str.substr(i_start, i_end - i_start);
}
}
return '';
}
}
//window.onload = function() {
(function() {
window.plugin_musicPlayer = {
res: [],
config: JSON.parse(localStorage.getItem('plugin_musicPlayer'))
};
if (window.plugin_musicPlayer.config == null) {
window.plugin_musicPlayer.config = {
width: "300px",
height: "100px",
server: "xiami",
type: "playlist",
id: "1314878731",
mini: true,
fixed: true
};
localStorage.setItem('plugin_musicPlayer', JSON.stringify(window.plugin_musicPlayer.config));
}
function loadRes(files, callback) {
var i = 0;
for (var file of files) {
if (file.type == "js") {
var fileref = document.createElement('script');
fileref.setAttribute("type", "text/javascript");
fileref.setAttribute("src", file.url)
} else if (file.type == "css" || file.type == "cssText") {
var fileref = document.createElement("link");
fileref.setAttribute("rel", "stylesheet");
fileref.setAttribute("type", "text/css");
fileref.setAttribute("href", file.url)
}
document.getElementsByTagName("head")[0].appendChild(fileref).onload = function() {
window.plugin_musicPlayer.res.push(fileref);
if (++i == files.length) {
if (typeof callback == 'function') callback();
}
}
}
}
loadRes([
{ url: "https://cdn.jsdelivr.net/npm/aplayer/dist/APlayer.min.css", type: "css" },
{ url: "https://cdn.jsdelivr.net/npm/aplayer/dist/APlayer.min.js", type: "js" },
{ url: "https://cdn.jsdelivr.net/npm/meting@2/dist/Meting.min.js", type: "js" },
], () => {
// 自定义CSS
var style = document.createElement("style");
var rules = document.createTextNode('.aplayer .aplayer-lrc p{font-size: 14px;color: #fff} .aplayer.aplayer-fixed .aplayer-lrc {width: 418px;text-shadow: unset;background-color: rgba(0, 0, 0, .5);z-index: 999;bottom: 0px;} .aplayer.aplayer-fixed .aplayer-body{bottom: 30px;}');
style.type = "text/css";
if (style.styleSheet) {
style.styleSheet.cssText = rules.nodeValue;
} else {
style.appendChild(rules);
}
document.getElementsByTagName("head")[0].appendChild(style);
insertPlayer();
})
})();
//}
`);
const handleWindowBlur = () => {
ppet.webContents.executeJavaScript(`document.querySelector('meting-js').aplayer.list.hide()`);
};
ppet.on('blur', handleWindowBlur);
return () => {
ppet.removeListener('blur', handleWindowBlur);
ppet.webContents.executeJavaScript(`document.querySelector('#musicPlayer').remove();for(var res of window.plugin_musicPlayer.res) res.remove();`);
};
};
created: Fri, 29 Jan 2021 12:17:55 GMT updated:Fri, 29 Jan 2021 15:38:35 GMT
Name 自定义背景 Description 透明樱花素材下载: https://sozai-good.com/illust/nature/flower/sakura/petal/ Code
module.exports = () => {
var css, type = 0; // 0固定背景 1跟人物动
var size = 'cover'; // 填充
// 背景图地址
var url = 'https://sozai-good.com/download?id=83137&type=2&subnumber=0&extention=png';
//type = 1; url = 'https://sozai-good.com/download?id=83598&type=2&subnumber=0&extention=png'; size = '100% 100%';
ppet.webContents.insertCSS(`
` + (type == 0 ? 'body' : '#waifu') + ` {
background-image: url(` + url+ `);
background-repeat: no-repeat;
background-size: ` + size + `;
}
`).then((key) => {
css = key;
});
return () => {
css && ppet.webContents.removeInsertedCSS(css);
}
}
created: Sat, 30 Jan 2021 09:52:20 GMT updated:Sat, 30 Jan 2021 10:07:51 GMT
Name 简易定时提示 Description 支持正计时与倒计时与多方案,使用方法:右键模型打开配置 Code
Name
简易定时提示
Description
支持正计时与倒计时与多方案,使用方法:右键模型打开配置
Code
module.exports = () => {
ppet.webContents.executeJavaScript(`
var _p = {
init: () => {
_p.index = -1;
_p.datas = JSON.parse(localStorage.getItem('plugin_simpleTips'));
if(!_p.datas){
_p.reset();
}
_p.setPlaying(_p.datas.config.selected);
},
exit: () => {
if(_p.con) _p.con.remove();
},
addRightMenu: (doms) => {
_p.rm = doms;
},
destory: () => {
_p.rm.forEach((d) => {d.remove()})
if(_p.con) _p.con.remove();
if(_p.timer) clearInterval(_p.timer);
let div = document.querySelector('#waifu-tips');
if(div.innerHTML == _p.lastShow){
div.remove()
}
delete _p;
},
setPlaying: (group) => {
_p.texts = _p.datas.texts[_p.datas.config.selected];
_p.initTimer();
},
initTimer: () => {
if(_p.texts){
if(_p.timer) clearInterval(_p.timer);
_p.timer = setInterval(() => {
_p.next();
}, parseInt(_p.datas.config.time) * 1000);
}
},
ui: () => {
let div = document.createElement('div');
div.id = 'plugin_simpleTips';
div.style.cssText = 'z-index: 999999;position: absolute;width: 300px;padding: 10px;background-color: rgba(0, 0, 0, 0.7)';
let html = '<select title="选择方案" style="width: 50%;" onchange="_p.selectGroup(this.selectedIndex)">';
for(let name in _p.datas.texts){
html += '<option>' + name + '</option>';
}
html += '</select><button onclick="_p.newGroup()">新增</button><button id="btn_del" onclick="_p.delete();">删除</button><button onclick="_p.reset();">重置</button><textarea rows="5" style="width:100%"></textarea><hr><input id="input_name" title="更改名字" type="text" style="width: 100px;"><input id="input_time" title="设置提示周期(秒)" type="text" style="width: 50px;" value="' + _p.datas.config.time + '"><button onclick="_p.apply();" style="margin-left: 10px;">应用</button><button onclick="_p.exit();">退出</button>';
div.innerHTML = html;
document.body.appendChild(div);
_p.con = div;
_p.selectGroup(-1);
},
newGroup: () => {
name = 'untitled';
_p.datas.texts[name] = [];
let option = document.createElement('option');
option.selected = true;
option.innerHTML = name;
let select = _p.con.querySelector('select');
select.appendChild(option);
_p.selectGroup(select.options.length - 1);
},
selectGroup: (index) => {
let name;
let keys = Object.keys(_p.datas.texts);
if(index == -1){
name = _p.datas.config.selected;
}else{
name = keys[index];
}
index = keys.indexOf(name);
_p.con.querySelector('#input_name').value = name;
_p.con.querySelector('textarea').value = _p.datas.texts[name].join("\\n");
_p.con.querySelector('#btn_del').disabled = index == 0
_p.con.querySelector('#input_name').disabled = index == 0
},
delete: () => {
if(_p.con.querySelector('select').selectedIndex == 0) return alert('不能删除默认');
var option = _p.con.querySelector('select option:checked');
if(option){
option.remove();
delete _p.datas.texts[option.value];
localStorage.setItem('plugin_simpleTips', JSON.stringify(_p.datas));
setTimeout(() => {_p.con.querySelector('select').selectedIndex = 0}, 500);
}
},
reset: () => {
_p.datas = {
texts: {
default: ["离开学只剩下{倒计时,2021/3/1,d天}", "离23点还有{倒计时,23:00,h小时m分}", "今天是你的第{正计时,2021/1/5,d天}假期", "你还好吗?"]
},
config: {
selected: "default",
time: 600,
showTime: 10
}
};
localStorage.setItem('plugin_simpleTips', JSON.stringify(_p.datas));
_p.exit();
},
apply: () => {
let option = _p.con.querySelector('select option:checked');
let s_oldName = option.value;
let s_newName = _p.con.querySelector('#input_name').value;
if(s_oldName != s_newName){
option.value = s_newName;
option.innerHTML = s_newName;
delete _p.datas.texts[s_oldName];
}
_p.texts = document.querySelector('#plugin_simpleTips textarea').value.split("\\n").filter((d) => {return d != ''});
_p.datas.texts[s_newName] = _p.texts;
_p.datas.config.time = parseInt(_p.con.querySelector('#input_time').value);
localStorage.setItem('plugin_simpleTips', JSON.stringify(_p.datas));
_p.initTimer();
_p.exit();
},
next: () => {
_p.loadIndex(_p.index >= _p.texts.length - 1 ? 0 : _p.index + 1);
},
loadIndex: (i) => {
_p.index = i;
let d = new Date();
let start = d.getTime() / 1000;
var text = _p.texts[_p.index];
for (let param of getStringToArray(text, '{', '}')) {
var p = param.split(',');
var s = -1;
switch (p[0]) {
case '正计时':
case '倒计时':
if (p[1].indexOf('/') == -1) {
// 23:00
p[1] = d.getFullYear() + '/' + (d.getMonth() + 1) + '/' + d.getDay() + ' ' + p[1]; // 取今天
}
s = new Date(p[1]).getTime() / 1000 - start;
if (p[0] == '正计时') s = Math.abs(s);
break;
}
if (s > 0) {
//var s = 3600;
//var t = 'dd天hh小时mm分ss秒';
var t = p[2];
var o = {};
o["d+"] = parseInt(s / 86400);
if (!new RegExp('h|m|s').test(t)) { // 只显示天数
o["d+"]++; // 加一天
}
s %= 86400;
o["h+"] = parseInt(s / 3600);
s %= 3600;
o["m+"] = parseInt(s / 60);
s %= 60;
o["s+"] = parseInt(s);
for (var k in o) {
if (new RegExp("(" + k + ")").test(t)) {
t = t.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
};
}
text = text.replace('{' + param + '}', t);
}else{
return _p.next();
}
}
if(text != ''){
_p.lastShow = text;
let div = document.querySelector('#waifu-tips');
if(div == null){
div = document.createElement('div');
div.id = 'waifu-tips';
div.innerHTML = text;
}
if(document.querySelector('#waifu').appendChild(div)){
setTimeout(() => {
if(document.querySelector('#waifu-tips').innerHTML == text){
div.remove();
}
}, _p.datas.config.showTime * 1000);
}
}
function getStringToArray(str, s, e) {
var i_start, i_end;
var a_res = [];
while (typeof(str) == 'string') {
i_start = str.indexOf(s, i_end);
if (i_start == -1) break;
i_start += s.length;
i_end = str.indexOf(e, i_start);
if (i_end != -1) {
a_res.push(str.substr(i_start, i_end - i_start));
i_end += e.length;
} else {
i_end = i_start;
}
}
return a_res;
}
}
}
//window.onload = () => {
if(!document.querySelector('#rightMenu')){
document.body.oncontextmenu = (ev) => {
var rm = document.querySelector('#rightMenu');
if(rm.childNodes.length == 0) return;
rm.style.left = ev.clientX + 3 + 'px';
rm.style.top = ev.clientY + 3 + 'px';
rm.style.display = rm.style.display == 'none' ? 'unset' : 'none';
ev.preventDefault();
}
function addToRightMenu(text, callback) {
var rm = document.querySelector('#rightMenu');
if (rm == null) {
rm = document.createElement('div');
rm.id = 'rightMenu';
rm.style.cssText = 'position: fixed; width: 100px;background-color: rgba(0, 0, 0, .7);color: white;z-index: 99999999;display: none';
rm.innerHTML = "<ol style='list-style: none;;padding: 0;margin: 0;'></ol>";
document.body.appendChild(rm);
}
var li = document.createElement('li');
li.innerHTML = text;
li.onclick = () => {
rm.style.display = 'none';
callback();
};
li.style.cssText = 'cursor: pointer;text-align: center;height: 30px;padding-top: 10px;';
return rm.querySelector('ol').appendChild(li);
}
}
_p.addRightMenu([addToRightMenu('简易定时提示', () => { if(document.querySelector('#plugin_simpleTips') == null){_p.ui()}else{_p.exit()} })]);
_p.init();
//_p.ui();
//}
`);
return () => {
ppet.webContents.executeJavaScript(`_p.destory();`);
}
}
created: Mon, 01 Feb 2021 15:43:28 GMT updated:Mon, 01 Feb 2021 16:16:17 GMT
Name 多功能自定义背景 Description 支持同时展示多个图片/gif,右键配置 Code
module.exports = () => {
ppet.webContents.executeJavaScript(`
var ci_m = {
destory: () => {
document.body.style.cssText = ci_m.bodyCSS;
document.querySelector('#waifu').style.cssText = ci_m.waifuCSS;
ci_m.rm.forEach((d) => {d.remove()})
document.querySelectorAll('.ci_imgs').forEach((d) => {d.remove()})
delete ci_m;
document.querySelector('#plugin_customImage').remove();
},
exit: () => {
if(ci_m.g_select_img){
ci_m.g_select_img.style.border = '';
if(ci_m.select.selectedIndex == -1) ci_m.g_select_img.remove();
}
document.querySelector('#plugin_customImage').remove();
},
init: () => {
ci_m.bodyCSS = document.body.style.cssText;
ci_m.waifuCSS = document.querySelector('#waifu').style.cssText;
ci_m.g_data = JSON.parse(localStorage.getItem('plugin_customImage'));
ci_m.g_default = [{
name: '总背景图',
url: './1.png',
//url: 'https://sozai-good.com/download?id=83137&type=2&subnumber=0&extention=png',
css: '',
width: 0,
height: 0,
left: 0,
top: 0
},
{
name: '人物背景图',
url: './2.png',
//url: 'https://sozai-good.com/download?id=83598&type=2&subnumber=0&extention=png',
css: '',
width: 0,
height: 0,
left: 0,
top: 0
},
];
if (!ci_m.g_data) ci_m.g_data = ci_m.g_default;
for(var i=0; i<ci_m.g_data.length;i++){
ci_m.g_index = i;
ci_m.preloadImage(i);
}
},
ui: () => {
var div = document.querySelector('#plugin_customImage');
if (div != null) div.remove();
div = document.createElement('div');
div.id = 'plugin_customImage';
div.style.cssText = 'font-family: initial;width: 60px;z-index: 99999;position: absolute; left: 0px; top: 0px;background-color: rgba(0, 0, 0, .8);color: white;font-size:13px;';
var html = "<button onclick='ci_m.con.style.right=null;ci_m.con.style.left=0;' style='top: 0;padding: 0px;height: 30px;width: 13px;left: 0px;position: absolute'><</button><img src='' alt='展示图' width='30px' height='30px' style='display: block; margin:0px auto;border: 1px solid black;margin-bottom: 5px;'><button onclick='ci_m.con.style.left=null;ci_m.con.style.right=0;' style='top: 0;padding: 0px;height: 30px;width: 13px;right: 0px;position: absolute'>></button><select autofocus id='select_list' style='width: 100%' onchange='ci_m.loadIndex(this.selectedIndex)'>";
for (var detail of ci_m.g_data) {
html = html + '<option>' + (detail.name == '' ? 'untiiled' : detail.name) + '</option>';
}
html += '</select><button onclick="ci_m.new();"id="btn_new"title="新建">新</button><button onclick="ci_m.clear();"title="清空">清</button><hr><input type="text"id="input_name"title="名字"style="width:100%"><input type="text"id="input_url"onkeyup="ci_m.loadImage(this.value);"title="图像URL"style="width:100%"><input id="input_updload"type="file"accept="image/*"style="width:1px;height:1px;cursor:pointer;font-size:30px;outline:medium none;position: absolute;filter:alpha(opacity=0);-moz-opacity:0;opacity:0; left:-10px;top: -10px;"onchange=ci_m.uploadImg(this.files[0])><button onclick="ci_m.download();"title="下载图像">下</button><button title="打开本地图片"onclick=document.querySelector("#input_updload").click()>读</button><select id="select_parent"title="相对于:"onchange="ci_m.selectParent(this.selectedIndex)"style="width:100%"disabled><option value="body">整体</option><option value="#waifu"selected>人物</option></select>宽<input style="width:70%" type="text"id="input_w"style="width: 50px;"onmousewheel="ci_m.mouseWheelHandle()"onkeyup="ci_m.updatePosition()"value=0>高<input type="text"style="width:70%"id="input_h"style="width: 50px;"onmousewheel="ci_m.mouseWheelHandle()"onkeyup="ci_m.updatePosition()"value=0>左<input type="text"style="width:70%"id="input_x"style="width: 50px;"onmousewheel="ci_m.mouseWheelHandle(ci_m.input_r)"onkeyup="ci_m.updatePosition(ci_m.input_r);"value=0>右<input type="text"style="width:70%"id="input_r"style="width: 50px;"onmousewheel="ci_m.mouseWheelHandle(ci_m.input_x)"onkeyup="ci_m.updatePosition(ci_m.input_x);"value=0>顶<input type="text"style="width:70%"id="input_y"style="width: 50px;"onmousewheel="ci_m.mouseWheelHandle(ci_m.input_b)"onkeyup="ci_m.updatePosition(ci_m.input_b);"value=0>底<input type="text"style="width:70%"id="input_b"style="width: 50px;"onmousewheel="ci_m.mouseWheelHandle(ci_m.input_y)"onkeyup="ci_m.updatePosition(ci_m.input_y);"value=0><hr><textarea rows="5"id="input_css"title="CSS"style="width: 100%;display:none;"onkeyup="ci_m.applyCSS(this.value)"></textarea><button id="btn_del"onclick="ci_m.delete();"title="删除">删</button><button onclick="ci_m.save();"title="保存">存</button><button title="自定义CSS" onclick=ci_m.switchCSSInput()>自</button><button onclick="ci_m.exit();"title="退出">退</button>';
div.innerHTML = html;
document.body.appendChild(div);
ci_m.con = div;
ci_m.g_select_img = null;
ci_m.input_x = document.querySelector('#input_x');
ci_m.input_y = document.querySelector('#input_y');
ci_m.input_w = document.querySelector('#input_w');
ci_m.input_h = document.querySelector('#input_h');
ci_m.input_r = document.querySelector('#input_r');
ci_m.input_b = document.querySelector('#input_b');
ci_m.select = document.querySelector('#select_list');
ci_m.g_img = null;
ci_m.g_index = -1;
ci_m.time = 0;
ci_m.loadIndex(0);
},
switchCSSInput: () => {
var d=document.querySelector("#input_css");if(d.style.display=="none"){d.style.display="unset";}else{d.style.display="none"}
},
uploadImg: (file) => {
var reader = new FileReader();
reader.readAsDataURL(file);
reader.onload = (e) => {document.querySelector('#plugin_customImage img').src = e.currentTarget.result; document.querySelector('#input_url').value = '';}
},
selectParent: (index) => {
if(ci_m.g_select_img.offsetParent == document.body){
if(index == 1){
ci_m.g_select_img.style.zIndex = 1;
document.querySelector('#waifu').appendChild(ci_m.g_select_img);
}
}else{
if(index == 0){
document.body.appendChild(ci_m.g_select_img);
ci_m.g_select_img.style.zIndex = -1; // 放在底层
}
}
},
loadImage: (url, callback) => {
ci_m.g_img = new Image();
ci_m.g_img.src = url;
ci_m.g_img.onload = (e) => {
var ui = ci_m.input_x != undefined;
var index = ci_m.g_index;
if(index == 0){
parent = 'body';
}else
if(index == 1){
parent = '#waifu';
}else{
parent = ui ? document.querySelector('#select_parent option:checked').value : ci_m.g_data[index].parent;
}
var dom = document.querySelector(parent);
var mw = dom == null ? window.innerWidth : dom.offsetWidth;
var mh = dom == null ? window.innerHeight : dom.offsetHeight;
if(ui){
if(parseInt(ci_m.input_w.value) <= 0) ci_m.input_w.value = ci_m.g_img.width > mw ? mw : ci_m.g_img.width;
if(parseInt(ci_m.input_h.value) <= 0) ci_m.input_h.value = ci_m.g_img.height > mh ? mh : ci_m.g_img.height;
document.querySelector('#plugin_customImage img').src = ci_m.g_img.src;
ci_m.updatePosition();
}
if (typeof callback == 'function') callback();
};
ci_m.g_img.onabort = (e) => {
alert('加载图片失败');
};
},
removeSelectedImage: () => {
var index = ci_m.select.selectedIndex;
if (index != 0 && index != 1 && ci_m.g_select_img) ci_m.g_select_img.remove(); ci_m.g_select_img = null;
},
applyCSS: (css) => {
if(ci_m.g_select_img != null){
var w = ci_m.input_w.value;
var h = ci_m.input_h.value;
var index = ci_m.select.selectedIndex;
if (index == 0 || index == 1){
css = ci_m.g_select_img.defaultCSS + css;
}else{
var l = ci_m.input_x.value;
var t = ci_m.input_y.value;
css += 'border: 1px solid red;position: absolute;width:' + ci_m.input_w.value + ';height:' + ci_m.input_h.value + ';';
if(!isNaN(l)){
css += 'left: ' + l + ';';
}else{
css += 'right: ' + ci_m.input_r.value + ';';
}
if(!isNaN(t)){
css += 'top: ' + t + ';';
}else{
css += 'bottom: ' + ci_m.input_b.value + ';';
}
}
ci_m.g_select_img.style.cssText = css;
}
},
loadIndex: (index) => {
ci_m.select.selectedIndex = index;
if(ci_m.g_select_img != null) ci_m.g_select_img.style.border = '';
//ci_m.removeSelectedImage();
var b = index == 0 || index == 1;
input_r.disabled = b;
input_b.disabled = b;
document.querySelector('#btn_new').disabled = false;
document.querySelector('#select_list').disabled = false;
document.querySelector('#input_name').value = ci_m.g_data[index].name;
document.querySelector('#input_name').disabled = b;
document.querySelector('#plugin_customImage textarea').value = ci_m.g_data[index].css;
document.querySelector('#input_url').value = ci_m.g_data[index].url;
document.querySelector('#plugin_customImage img').src = ci_m.g_data[index].url;
ci_m.preloadImage(index);
},
preloadImage: (index) => {
var l = '0', t = '0', w = '0', h = '0', r = '0', b = '0', url, css, s_parent = 'body';
var ui = ci_m.input_x != undefined;
if(ui) document.querySelector('#select_parent').disabled = index == 0 || index == 1;
if(index == -1){
l = ci_m.input_x.value;
t = ci_m.input_y.value;
w = ci_m.input_w.value;
h = ci_m.input_h.value;
r = ci_m.input_r.value;
b = ci_m.input_b.value;
s_parent = document.querySelector('#select_parent option:checked').value;
url = document.querySelector('#input_url').value;
if(url == '') url = document.querySelector('#plugin_customImage img').src;
css = document.querySelector('#plugin_customImage textarea').value;
}else{
w = parseInt(ci_m.g_data[index].width);
h = parseInt(ci_m.g_data[index].height);
l = parseInt(ci_m.g_data[index].left);
t = parseInt(ci_m.g_data[index].top);
if(index == 0){
s_parent = 'body';
}else
if(index == 1){
s_parent = '#waifu';
}else{
s_parent = ci_m.g_data[index].parent
r = parseInt(ci_m.g_data[index].right);
b = parseInt(ci_m.g_data[index].bottom);
}
url = ci_m.g_data[index].url;
css = ci_m.g_data[index].css;
if(ui){
ci_m.input_w.value = w;
ci_m.input_h.value = h;
ci_m.input_x.value = l;
ci_m.input_y.value = t;
ci_m.input_r.value = r;
ci_m.input_b.value = b;
ci_m.g_data[index].right = ci_m.input_r.value;
ci_m.g_data[index].bottom = ci_m.input_b.value;
}
}
if(ui) document.querySelector('#select_parent option[value="'+s_parent+'"]').selected = true;
ci_m.g_select_img = document.querySelector('#img_show_' + index);
if(ci_m.g_select_img != null){ // 已经加载过
ci_m.g_select_img.style.border = '1px solid red';
return;
}
if (index == 0 || index == 1) {
return ci_m.loadImage(url, () => {
ci_m.g_select_img = document.querySelector(s_parent);
console.log(s_parent);
ci_m.g_select_img.style.cssText += 'background-image: url(' + url + '); background-size: ' + (w <= 0 && h <= 0 ? 'cover' : w + 'px ' + h + 'px') + ';background-repeat: no-repeat;';
ci_m.g_select_img.defaultCSS = ci_m.g_select_img.style.cssText.replace(css, ''); // 替换到配置的css样式
ci_m.g_select_img.style.cssText += css;
});
}
return ci_m.loadImage(url, () => {
css += (ui ? 'border: 1px solid red;' : '') + 'position: absolute;width:' + (ui ? ci_m.input_w.value : ci_m.g_data[index].width) + 'px;height:' + (ui ? ci_m.input_h.value : ci_m.g_data[index].height) + 'px;';
css += 'left: ' + getPX(ui ? ci_m.input_l.value : ci_m.g_data[index].left) + ';';
css += 'right: ' + getPX(ui ? ci_m.input_r.value : ci_m.g_data[index].right) + ';';
css += 'top: ' + getPX(ui ? ci_m.input_t.value : ci_m.g_data[index].top) + ';';
css += 'bottom: ' + getPX(ui ? ci_m.input_b.value : ci_m.g_data[index].bottom) + ';';
ci_m.g_select_img = ci_m.appendImg(index, url, css, s_parent);
if(ui){
ci_m.updatePosition();
ci_m.selectParent(document.querySelector('#select_parent').selectedIndex);
}
function getPX(px){
return px == '' ? 'unset' : px + 'px';
}
});
},
delete: () => {
ci_m.resetForm();
var index = ci_m.select.selectedIndex;
if(index == 0 || index == 1){
ci_m.g_data[index] = ci_m.g_default[index];
ci_m.g_data[index].url = '';
ci_m.g_select_img.style.backgroundImage = 'unset';
localStorage.setItem('plugin_customImage', JSON.stringify(ci_m.g_data));
}else
if(index != -1){
ci_m.select.querySelector('option:checked').remove();
ci_m.g_data.splice(index, 1);
localStorage.setItem('plugin_customImage', JSON.stringify(ci_m.g_data));
}
alert('删除成功,删除后无需保存');
ci_m.loadIndex(0);
},
new: () => {
ci_m.resetForm();
ci_m.select.selectedIndex = -1;
document.querySelector('#plugin_customImage img').src = '';
document.querySelector('#select_list').disabled = true;
document.querySelector('#btn_new').disabled = true;
input_r.disabled = false;
input_b.disabled = false;
},
clear: () => {
var now = new Date().getTime() / 1000;
if (now - ci_m.time >= 5) {
alert('如确认删除,请在五秒内再次点击!');
} else {
document.querySelectorAll('.ci_imgs').forEach((d) => {d.remove()})
localStorage.setItem('plugin_customImage', JSON.stringify(ci_m.g_default));
ci_m.resetForm();
ci_m.init();
ci_m.ui();
}
ci_m.time = now;
},
save: () => {
var url = document.querySelector('#input_url').value;
if(url == '') url = document.querySelector('#plugin_customImage img').src;
if (url == '') {
alert('请输入图片地址');
return;
}
var name = document.querySelector('#input_name').value;
var index = ci_m.select.selectedIndex;
var isNew = index == -1;
if (isNew) { // 新建
index = ci_m.select.options.length;
}
ci_m.g_data[index] = {
name: name,
url: document.querySelector('#plugin_customImage img').src,
left: ci_m.input_x.value,
top: ci_m.input_y.value,
width: ci_m.input_w.value,
height: ci_m.input_h.value,
css: document.querySelector('#plugin_customImage textarea').value,
};
if (index > 1) {
ci_m.g_data[index].parent = document.querySelector('#select_parent option:checked').value;
ci_m.g_data[index].right = ci_m.input_r.value;
ci_m.g_data[index].bottom = ci_m.input_b.value;
}
localStorage.setItem('plugin_customImage', JSON.stringify(ci_m.g_data));
//ci_m.init();
alert('保存成功');
if (isNew) {
var option = document.createElement('option');
option.innerHTML = name == '' ? 'untitled' : name;
ci_m.select.appendChild(option);
ci_m.loadIndex(index);
}
},
download: () => {
ci_m.removeSelectedImage();
var index = ci_m.select.selectedIndex;
if(index != -1){
var url = document.querySelector('#input_url').value;
if(url == '') url = document.querySelector('#plugin_customImage img').src;
ci_m.g_data[index].url = url;
}
ci_m.preloadImage(index);
},
appendImg: (index, url, css, parent) => {
var img = document.createElement('img');
img.id = 'img_show_' + index;
img.className = 'ci_imgs';
img.src = url;
img.style.cssText = css;
if(document.querySelector(parent).appendChild(img)){
return document.querySelector('#'+img.id);
}
},
resetForm: () => {
ci_m.removeSelectedImage();
var div = document.querySelector('#plugin_customImage');
div.querySelector('img').src = '';;
div.querySelector('input[type=file]').value = '';
div.querySelector('#input_name').value = '';
div.querySelector('#input_url').value = '';
div.querySelector('#select_parent').selectedIndex = 1;
div.querySelector('#select_parent').disabled = false;
div.querySelector('#input_name').disabled = false;
div.querySelector('#btn_new').disabled = false;
document.querySelector('#select_list').disabled = false;
div.querySelector('textarea').value = '';
ci_m.input_x.value = 0;
ci_m.input_y.value = 0;
ci_m.input_w.value = 0;
ci_m.input_h.value = 0;
},
mouseWheelHandle: (input) => {
if(input != undefined){
input.value = '';
}
var ev = window.event || arguments.callee.caller.arguments[0],
et = ev.srcElement || ev.target;
var base = parseInt(et.value);
if(isNaN(base)) base = 0;
et.value = base + parseInt(ev.deltaY < 0 ? (ev.shiftKey ? 10 : 1) : (ev.shiftKey ? -10 : -1));
ci_m.updatePosition();
},
updatePosition: (input) => {
if(input != undefined) input.value = '';
if (ci_m.g_select_img != null) {
var index = ci_m.select.selectedIndex;
if(index == 0 || index == 1){
ci_m.g_select_img.style.backgroundPosition = ci_m.input_x.value + 'px ' + ci_m.input_y.value + 'px';
ci_m.g_select_img.style.backgroundSize = ci_m.input_w.value + 'px ' + ci_m.input_h.value + 'px';
}else{
ci_m.g_select_img.style.left = getPX(ci_m.input_x.value)
ci_m.g_select_img.style.top = getPX(ci_m.input_y.value);
ci_m.g_select_img.style.width = getPX(ci_m.input_w.value);
ci_m.g_select_img.style.height = getPX(ci_m.input_h.value);
ci_m.g_select_img.style.right = getPX(ci_m.input_r.value);
ci_m.g_select_img.style.bottom = getPX(ci_m.input_b.value);
}
}
function getPX(px){
return px == '' ? 'unset' : px + 'px';
}
},
addRightMenu: (doms) => {
ci_m.rm = doms;
}
}
ci_m.init();
//ci_m.ui();
//window.onload = () => {
document.body.oncontextmenu = (ev) => {
var rm = document.querySelector('#rightMenu');
if(rm.childNodes.length == 0) return;
rm.style.left = ev.clientX + 3 + 'px';
rm.style.top = ev.clientY + 3 + 'px';
rm.style.display = rm.style.display == 'none' ? 'unset' : 'none';
ev.preventDefault();
}
function addToRightMenu(text, callback) {
var rm = document.querySelector('#rightMenu');
if (rm == null) {
rm = document.createElement('div');
rm.id = 'rightMenu';
rm.style.cssText = 'position: fixed; width: 100px;background-color: rgba(0, 0, 0, .7);color: white;z-index: 99999999;display: none';
rm.innerHTML = "<ol style='list-style: none;;padding: 0;margin: 0;'></ol>";
document.body.appendChild(rm);
}
var li = document.createElement('li');
li.innerHTML = text;
li.onclick = () => {
rm.style.display = 'none';
callback();
};
li.style.cssText = 'cursor: pointer;text-align: center;height: 30px;padding-top: 10px;';
return rm.querySelector('ol').appendChild(li);
}
function removeFromMenu(text){
}
ci_m.addRightMenu([addToRightMenu('自定义背景', () => { if(document.querySelector('#plugin_customImage') == null){ci_m.ui()}else{ci_m.exit()} })]);
//ci_m.ui()
//};
`);
return () => {
ppet.webContents.executeJavaScript(`ci_m.destory();`);
}
}
created: Sun, 31 Jan 2021 14:47:45 GMT updated:Tue, 02 Feb 2021 03:57:27 GMT
都是很不错的插件呀(~ ̄▽ ̄)~ 可以加到 PPet/plugins/ 目录下然后提一个PR嘛~(不过我不是这个repo的维护者就是了……)
描述
自用....
下载地址 密码:h07r