百度贴吧 一键@全部吧务

想找吧务?一键呼唤全部吧务过来!

  1. // ==UserScript==
  2. // @name 百度贴吧 一键@全部吧务
  3. // @namespace https://zfdev.com/
  4. // @version 0.2
  5. // @description 想找吧务?一键呼唤全部吧务过来!
  6. // @author ZFDev
  7. // @match *://tieba.baidu.com/*
  8. // @grant none
  9. // @run-at document-idle
  10. // ==/UserScript==
  11.  
  12. (function() {
  13. 'use strict';
  14.  
  15. let bawu_list = !1, forum_name = !1;
  16.  
  17. function get_forum_name() {
  18. return "/f" === location.pathname ? PageData.forum.name : "/p/" === location.pathname.substring(0, 3) && PageData.forum.forum_name;
  19. }
  20.  
  21. function getbawu() {
  22. return new Promise(function(t) {
  23. if (bawu_list) {
  24. return void t(bawu_list);
  25. }
  26. let n = "", e = get_forum_name();
  27. if (!e) {
  28. return;
  29. }
  30. try {
  31. n = "/bawu2/platform/listBawuTeamInfo?word=" + encodeURIComponent(e) + "&ie=utf-8";
  32. } catch (t) {
  33. return;
  34. }
  35. $.get(n).then(function(n) {
  36. let e = [], a = new RegExp().compile(/\"user_name\" title\=\"([\S\d]+)\"/gi), o = n.match(a);
  37. if (o) {
  38. a.compile(/\"user_name\" title\=\"([\S\d]+)\"/i);
  39. for (let t = 0; t < o.length; t++) {
  40. let n = o[t].match(a);
  41. n && e.push(n[1]);
  42. }
  43. }
  44. bawu_list = e, t(e);
  45. });
  46. });
  47. }
  48.  
  49. function postAt(t) {
  50. let n = "<p>";
  51. t.forEach(t => {
  52. n += '<span class="at">@' + t + "</span>&nbsp; &nbsp;";
  53. }), n += "</p><p></p>", $("#ueditor_replace").append(n);
  54. }
  55.  
  56. let lzlAt = function(t) {
  57. let n = $("#j_editor_for_container").html(), e = n.substring(0, n.length - 4);
  58. t.forEach(t => {
  59. e += '<span class="at">@' + t + "</span>&nbsp; ";
  60. }), e += "</p>", $("#j_editor_for_container").html(e);
  61. }, 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>';
  62.  
  63. function homeBtn() {
  64. if ($("#at-bawu").length > 0) {
  65. return;
  66. }
  67. let t = $(".edui-toolbar .edui-btn-toolbar");
  68. t.length > 0 && (t.append(btnHTML), $("#at-bawu").click(function() {
  69. getbawu().then(t => {
  70. postAt(t);
  71. });
  72. }));
  73. }
  74.  
  75. let lzlBtnEvent = function() {
  76. getbawu().then(t => {
  77. lzlAt(t);
  78. });
  79. };
  80.  
  81. "/f" === location.pathname ? homeBtn() : "/p/" === location.pathname.substring(0, 3) && (document.addEventListener("DOMNodeInserted", function(t) {
  82. if ("edui_at_box" === t.target.className) {
  83. homeBtn();
  84. try {
  85. $(t.target.parentNode.parentNode.parentNode.parentNode).find(".lzl_panel_btn:not(:has(.at-bawu))").prepend(lzlHTML);
  86. } catch (t) {}
  87. }
  88. }), $("body").on("click", ".at-bawu", lzlBtnEvent));
  89. })();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址