Greasy Fork is available in English.
愉快的和朋友在论坛斗图吧!
当前为
// ==UserScript==
// @name MCBBS Emoticon Add
// @namespace http://fang.blog.miri.site
// @version Beta 2.3.2
// @description 愉快的和朋友在论坛斗图吧!
// @author Mr_Fang
// @match https://*.mcbbs.net/*
// @grant none
// ==/UserScript==
(function() {
var storage = window.localStorage;
//阿方太菜了,开始重写了
if(jq('.user_info_menu_btn').length>0) {
jq('.user_info_menu_btn').append('<li><a id="mbea_setting">Emoticon Add 设置</a></li>');
document.getElementById('mbea_setting').addEventListener('click',function(){
showDialog('<style>.alert_right {background-image: none;padding-right: 0px;padding-left: 0px;}</style><div class=""><b>按规定格式添加即可</b> - 点击确定保存<hr><textarea id="input_setting" style="width: 340px;" rows="20">' + storage.getItem('mbea_setting') + '</textarea>保存后刷新即可生效</div>',
'right',
'<div style="line-height:30px;"><img src="https://s2.ax1x.com/2020/02/25/3twNzq.png" width="20px"> 设置 - MCBBS Emoticon Add</div>',
function() {
storage["mbea_setting"] = document.getElementById("input_setting").value;
}
);
})
}
var list = "";
var setting = "";
setting = "[" + storage.getItem('mbea_setting') + "]";
//阿方很菜的,不会批量替换,预计下个版本直接批量替换
//console.log(setting);
console.log(setting.split('\n').length);
for(var l=0;l<setting.split('\n').length;l++){
setting = setting.replace(';
setting = setting.replace(')\n',"'],\n");
//console.log(setting);
}
setting = setting.replace(')',"']");
var arrayList = eval("(" + setting + ")");
console.log(arrayList);
for(var i=0;i<arrayList.length;i++){
list = list + '<img src="' + arrayList[i][1] + '" height="42px"> <font color="gray" size="2">' + arrayList[i][0] + '</font> <button style="float: right;" class="pn pnc" onclick="setCopy(\'[img]' + arrayList[i][1] + '[/img]\');hideMenu(\'fwin_dialog\', \'dialog\')"><strong>复制</strong></button><br>';
};
document.onkeydown = function(e) {
var keyCode = e.keyCode;
var shiftKey = e.shiftKey;
var ctrlKey = e.ctrlKey;
if(ctrlKey && shiftKey && keyCode == 69) {
showDialog('<style>.alert_right {background-image: none;padding-right: 5px;padding-left: 5px;}</style><b>点击复制按钮即可复制BBCode</b> - 点击确定退出<hr><div class="" style="max-height: 350px;overflow-y: auto;">' + list + '</div>',
'right',
'<div style="line-height:30px;"><img src="https://s2.ax1x.com/2020/02/25/3twNzq.png" width="20px"> 插入表情 - MCBBS Emoticon Add</div>'
);
}
};
jq(".bar").append('<img style="border: 1px solid #fbf2db;" src="https://s2.ax1x.com/2020/02/25/3twNzq.png" height="90%" id="mbea_open" title="添加自定义表情" >');
document.getElementById('mbea_open').addEventListener('click',function(){
showDialog('<style>.alert_right {background-image: none;padding-right: 5px;padding-left: 5px;}</style><b>点击复制按钮即可复制BBCode</b> - 点击确定退出<hr><div class="" style="max-height: 350px;overflow-y: auto;">' + list + '</div>',
'right',
'<div style="line-height:30px;"><img src="https://s2.ax1x.com/2020/02/25/3twNzq.png" width="20px"> 插入表情 - MCBBS Emoticon Add</div>'
);
})
})();