标题: [精]网页插件整合:自动小尾巴/markdown/表情
时间: 2017-02-11发布,2023-02-23修改
怎么用?点击下方的“导入网页插件”按钮,输入yes再点确定即可。
导入网页插件:自动小尾巴/markdown/表情(当前用户:20,总安装次数:31)<script>
// 双引号内是自动添加在回复开头的内容
MY_REPLY_HEAD = "<!-- markdown -->\n";
// 双引号内是自动添加在回复结尾的内容
MY_REPLY_TAIL = "\n[span=color:#fff;font-size:10px;background:#33CC99;display:inline-block;padding:2px 5px;border-radius:3px;margin-left:5px;float:right]小米MIX2s(白)[/span]";
</script>
<script src="api.webplug-file.1_public_tail_markdown_face.js"></script>
自己修改代码里面的“小米MIX2s(白)”部分就能改变小尾巴的内容。
如果不想要小尾巴,就改成这样:
导入网页插件:自动markdown/表情(当前用户:14,总安装次数:16)<script src="api.webplug-file.1_public_markdown_face_webplug.js"></script>
如果只想要表情,就改成这样:
导入网页插件:表情插件(当前用户:8,总安装次数:8)<script src="api.webplug-file.1_public_face_webplug.js"></script>
如果只想要自动markdown,就改成这样:
导入网页插件:自动markdown插件(当前用户:7,总安装次数:8)<script src="api.webplug-file.1_public_markdown_webplug.js"></script>
[2018-05-10] 调用insertText
函数实现把表情插入到光标处。感谢@拒绝柳岩99次 (帖子)编写了这个函数。
[2019-07-03] 修复某些情况下会重复插入markdown标记的问题。
[2019-07-04] markdown和小尾巴发内信的时候也可以生效了。
[2019-10-04] 为markdown标记和小尾巴添加开关,方便版主修改其他人帖子的时候关掉。
[2021-02-03] 添加来自B站的狗头表情。
[2021-02-21] 添加了@我没K投递的回头看表情包
[2021-08-05] 添加了js外链版插件,方便复制使用。
<script>
function insertText(obj, str) {
if (document.selection) {
var sel = document.selection.createRange();
sel.text = str;
} else if (typeof obj.selectionStart === 'number' && typeof obj.selectionEnd === 'number') {
var startPos = obj.selectionStart,
endPos = obj.selectionEnd,
cursorPos = startPos,
tmpStr = obj.value;
obj.value = tmpStr.substring(0, startPos) + str + tmpStr.substring(endPos, tmpStr.length);
cursorPos += str.length;
obj.selectionStart = obj.selectionEnd = cursorPos;
} else {
obj.value += str;
}
}
$(function(){
var head = "<!-- markdown -->\n";
var tail = "\n[span=color:#fff;font-size:10px;background:#33CC99;display:inline-block;padding:2px 5px;border-radius:3px;margin-left:5px;float:right]小米MIX2s(白)[/span]";
$('#send_msg_button,#reply_topic_button,#quick_chat_button,#post_topic_button,#preview_button').click(function(){
var content = $('#content').val().replace(/\u00a0/g, ' ').replace(/\r\n/g, "\n").replace(/^(<!-- markdown -->|<!md>)\n/, '');
if (document.querySelector('#markdown').checked) content = head + content;
if (tail.length > 0 && content.lastIndexOf(tail) < 0 && document.querySelector('#signture').checked && ! /@(ChatGPT|罐子2号|chat)\b/i.test(content)) content += tail;
$('#content').val(content);
})
});
$(document).ready(function () {
$("#content").after('<div><input name="markdown" id="markdown" type="checkbox" checked /><label for="markdown">启用Markdown</label><input name="signture" id="signture" type="checkbox" checked /><label for="signture">小尾巴</label></div><p id="face"><img title="冷" src="/tpl/classic/img/face/e586b7.gif" /><img title="勉强" src="/tpl/classic/img/face/e58b89e5bcba.gif" /><img title="吐舌" src="/tpl/classic/img/face/e59090e8888c.gif" /><img title="吐" src="/tpl/classic/img/face/e59090.gif" /><img title="呵呵" src="/tpl/classic/img/face/e591b5e591b5.gif" /><img title="呼" src="/tpl/classic/img/face/e591bc.gif" /><img title="咦" src="/tpl/classic/img/face/e592a6.gif" /><img title="哈哈" src="/tpl/classic/img/face/e59388e59388.gif" /><img title="啊" src="/tpl/classic/img/face/e5958a.gif" /><img title="喷" src="/tpl/classic/img/face/e596b7.gif" /><img title="太开心" src="/tpl/classic/img/face/e5a4aae5bc80e5bf83.gif" /><img title="委屈" src="/tpl/classic/img/face/e5a794e5b188.gif" /><img title="开心" src="/tpl/classic/img/face/e5bc80e5bf83.gif" /><img title="怒" src="/tpl/classic/img/face/e68092.gif" /><img title="惊哭" src="/tpl/classic/img/face/e6838ae593ad.gif" /><img title="惊讶" src="/tpl/classic/img/face/e6838ae8aeb6.gif" /><img title="汗" src="/tpl/classic/img/face/e6b197.gif" /><img title="泪" src="/tpl/classic/img/face/e6b3aa.gif" /><img title="滑稽" src="/tpl/classic/img/face/e6bb91e7a8bd.gif" /><img title="狂汗" src="/tpl/classic/img/face/e78b82e6b197.gif" /><img title="疑问" src="/tpl/classic/img/face/e79691e997ae.gif" /><img title="真棒" src="/tpl/classic/img/face/e79c9fe6a392.gif" /><img title="睡觉" src="/tpl/classic/img/face/e79da1e8a789.gif" /><img title="笑眼" src="/tpl/classic/img/face/e7ac91e79cbc.gif" /><img title="花心" src="/tpl/classic/img/face/e88ab1e5bf83.gif" /><img title="鄙视" src="/tpl/classic/img/face/e98499e8a786.gif" /><img title="酷" src="/tpl/classic/img/face/e985b7.gif" /><img title="钱" src="/tpl/classic/img/face/e992b1.gif" /><img title="阴险" src="/tpl/classic/img/face/e998b4e999a9.gif" /><img title="黑线" src="/tpl/classic/img/face/e9bb91e7babf.gif" /><img title="不高兴" src="/tpl/classic/img/face/e4b88de9ab98e585b4.gif" /><img title="乖" src="/tpl/classic/img/face/e4b996.gif" /><img title="狗头" src="/tpl/classic/img/face/e78b97e5a4b4.gif" /><img title="回头看" src="/tpl/classic/img/face/e59b9ee5a4b4e79c8b.gif" /><img title="捂脸" src="/tpl/classic/img/face/e68d82e884b8.gif" /></p>');
$('#face img').click(function () {
var face = "{" + $(this).attr("title") + "}";
insertText(document.getElementById("content"), face);
});
});
</script>
红米Note4高配版(银色)
如果只需要表情,就是如下代码:
<script>
function insertText(obj, str) {
if (document.selection) {
var sel = document.selection.createRange();
sel.text = str;
} else if (typeof obj.selectionStart === 'number' && typeof obj.selectionEnd === 'number') {
var startPos = obj.selectionStart,
endPos = obj.selectionEnd,
cursorPos = startPos,
tmpStr = obj.value;
obj.value = tmpStr.substring(0, startPos) + str + tmpStr.substring(endPos, tmpStr.length);
cursorPos += str.length;
obj.selectionStart = obj.selectionEnd = cursorPos;
} else {
obj.value += str;
}
}
$(document).ready(function () {
$("#content").after('<p id="face"><img title="冷" src="/tpl/classic/img/face/e586b7.gif" /><img title="勉强" src="/tpl/classic/img/face/e58b89e5bcba.gif" /><img title="吐舌" src="/tpl/classic/img/face/e59090e8888c.gif" /><img title="吐" src="/tpl/classic/img/face/e59090.gif" /><img title="呵呵" src="/tpl/classic/img/face/e591b5e591b5.gif" /><img title="呼" src="/tpl/classic/img/face/e591bc.gif" /><img title="咦" src="/tpl/classic/img/face/e592a6.gif" /><img title="哈哈" src="/tpl/classic/img/face/e59388e59388.gif" /><img title="啊" src="/tpl/classic/img/face/e5958a.gif" /><img title="喷" src="/tpl/classic/img/face/e596b7.gif" /><img title="太开心" src="/tpl/classic/img/face/e5a4aae5bc80e5bf83.gif" /><img title="委屈" src="/tpl/classic/img/face/e5a794e5b188.gif" /><img title="开心" src="/tpl/classic/img/face/e5bc80e5bf83.gif" /><img title="怒" src="/tpl/classic/img/face/e68092.gif" /><img title="惊哭" src="/tpl/classic/img/face/e6838ae593ad.gif" /><img title="惊讶" src="/tpl/classic/img/face/e6838ae8aeb6.gif" /><img title="汗" src="/tpl/classic/img/face/e6b197.gif" /><img title="泪" src="/tpl/classic/img/face/e6b3aa.gif" /><img title="滑稽" src="/tpl/classic/img/face/e6bb91e7a8bd.gif" /><img title="狂汗" src="/tpl/classic/img/face/e78b82e6b197.gif" /><img title="疑问" src="/tpl/classic/img/face/e79691e997ae.gif" /><img title="真棒" src="/tpl/classic/img/face/e79c9fe6a392.gif" /><img title="睡觉" src="/tpl/classic/img/face/e79da1e8a789.gif" /><img title="笑眼" src="/tpl/classic/img/face/e7ac91e79cbc.gif" /><img title="花心" src="/tpl/classic/img/face/e88ab1e5bf83.gif" /><img title="鄙视" src="/tpl/classic/img/face/e98499e8a786.gif" /><img title="酷" src="/tpl/classic/img/face/e985b7.gif" /><img title="钱" src="/tpl/classic/img/face/e992b1.gif" /><img title="阴险" src="/tpl/classic/img/face/e998b4e999a9.gif" /><img title="黑线" src="/tpl/classic/img/face/e9bb91e7babf.gif" /><img title="不高兴" src="/tpl/classic/img/face/e4b88de9ab98e585b4.gif" /><img title="乖" src="/tpl/classic/img/face/e4b996.gif" /><img title="狗头" src="/tpl/classic/img/face/e78b97e5a4b4.gif" /><img title="回头看" src="/tpl/classic/img/face/e59b9ee5a4b4e79c8b.gif" /><img title="捂脸" src="/tpl/classic/img/face/e68d82e884b8.gif" /></p>');
$('#face img').click(function () {
var face = "{" + $(this).attr("title") + "}";
insertText(document.getElementById("content"), face);
});
});
</script>
『回复列表(69|隐藏机器人聊天)』