您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
想找吧务?一键呼唤全部吧务过来!
// ==UserScript== // @name 百度贴吧 一键@全部吧务 // @namespace https://zfdev.com/ // @version 0.2 // @description 想找吧务?一键呼唤全部吧务过来! // @author ZFDev // @match *://tieba.baidu.com/* // @grant none // @run-at document-idle // ==/UserScript== (function() { 'use strict'; let bawu_list = !1, forum_name = !1; function get_forum_name() { return "/f" === location.pathname ? PageData.forum.name : "/p/" === location.pathname.substring(0, 3) && PageData.forum.forum_name; } function getbawu() { return new Promise(function(t) { if (bawu_list) { return void t(bawu_list); } let n = "", e = get_forum_name(); if (!e) { return; } try { n = "/bawu2/platform/listBawuTeamInfo?word=" + encodeURIComponent(e) + "&ie=utf-8"; } catch (t) { return; } $.get(n).then(function(n) { let e = [], a = new RegExp().compile(/\"user_name\" title\=\"([\S\d]+)\"/gi), o = n.match(a); if (o) { a.compile(/\"user_name\" title\=\"([\S\d]+)\"/i); for (let t = 0; t < o.length; t++) { let n = o[t].match(a); n && e.push(n[1]); } } bawu_list = e, t(e); }); }); } function postAt(t) { let n = "<p>"; t.forEach(t => { n += '<span class="at">@' + t + "</span> "; }), n += "</p><p></p>", $("#ueditor_replace").append(n); } let lzlAt = function(t) { let n = $("#j_editor_for_container").html(), e = n.substring(0, n.length - 4); t.forEach(t => { e += '<span class="at">@' + t + "</span> "; }), e += "</p>", $("#j_editor_for_container").html(e); }, btnHTML = `<div class="edui-btn edui-btn-name-list edui-last-btn" unselectable="on" onmousedown="return false" data-original-title="@全部吧务" id="at-bawu"><div unselectable="on" class=" edui-icon" style="\nbackground: none;\nwidth: auto;\ndisplay: inline-flex;\ncolor: #4270bc;\n">@全部吧务</div></div>\n`, lzlHTML = '<span class="at-bawu" alog-action="lzlpostor" style="color: #4270bc;cursor: pointer;">@</span>'; function homeBtn() { if ($("#at-bawu").length > 0) { return; } let t = $(".edui-toolbar .edui-btn-toolbar"); t.length > 0 && (t.append(btnHTML), $("#at-bawu").click(function() { getbawu().then(t => { postAt(t); }); })); } let lzlBtnEvent = function() { getbawu().then(t => { lzlAt(t); }); }; "/f" === location.pathname ? homeBtn() : "/p/" === location.pathname.substring(0, 3) && (document.addEventListener("DOMNodeInserted", function(t) { if ("edui_at_box" === t.target.className) { homeBtn(); try { $(t.target.parentNode.parentNode.parentNode.parentNode).find(".lzl_panel_btn:not(:has(.at-bawu))").prepend(lzlHTML); } catch (t) {} } }), $("body").on("click", ".at-bawu", lzlBtnEvent)); })();