Super Bawu

吧务拉黑封禁功能增强

当前为 2014-09-11 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name Super Bawu
  3. // @namespace http://tieba.baidu.com
  4. // @include http://tieba.baidu.com/bawu2/*
  5. // @exclude http://tieba.baidu.com/bawu2/platform/listBlackUser*
  6. // @exclude http://tieba.baidu.com/bawu2/platform/listBawuDel*
  7. // @version 1.3
  8. // @description 吧务拉黑封禁功能增强
  9. // @grant none
  10. // ==/UserScript==
  11.  
  12. ;(function($){
  13.  
  14. //会员列表封禁
  15. var block = {menber:0,blocked:0};
  16. var blockAjax = $.Deferred();
  17. $(".btn_group").each(function(){
  18. $(this).parent().prepend('<td><input type="checkbox"></td>');
  19. })
  20. .parents(".member_list_table")
  21. .append('<tfoot><td colspan="2">\
  22. <input id="check_all" type="checkbox" >全选</td>\
  23. <td class="right_cell" colspan="8">\
  24. <a id="block_all" class="ui_btn ui_btn_s" onclick="return false;"href="#">\
  25. <span><em>选中项加入黑名单</em></span></a></td></tfoot>')
  26. .find("th:first").before('<th></th>');
  27.  
  28. blockAjax.done(function(e){
  29. var d = $("#page_message").text(e);
  30. d.css("marginLeft", - (d.outerWidth() / 2));
  31. d.animate({
  32. top: 0
  33. }, 500).delay(3000).animate({
  34. top: -39
  35. }, 500)
  36. .done(location.reload());
  37. });
  38. function blockID(id){
  39. $.post("http://tieba.baidu.com/bawu2/platform/addBlack",{
  40. ie:"utf-8",
  41. tbs:unsafeWindow.PageData.user.tbs,
  42. user_id:id,
  43. word:$("#wd1").attr("value")
  44. })
  45. .done(function(){
  46. block.blocked += 1;
  47. if (block.menber === block.blocked){
  48. blockAjax.resolve('操作完成,本次共拉黑'+block.blocked+'人!');
  49. block.menber = 0;
  50. block.blocked = 0;
  51. }
  52. });
  53. }
  54. $("#check_all").click(function(){
  55. if(!$(this).data("all")){
  56. $("input[type='checkbox']").each(function() {
  57. $(this).prop("checked", true);
  58. })
  59. $(this).data("all",1);
  60. }
  61. else{
  62. $("input[type='checkbox']").each(function() {
  63. $(this).prop("checked", false);
  64. })
  65. $(this).data("all",0);
  66. }
  67. })
  68. $("#block_all").click(function(){
  69. $("tbody input[type='checkbox']").each( function(){
  70. if($(this).attr("checked") === "checked"){
  71. block.menber += 1;
  72. blockID($(this).parents("tr").children(".btn_group").attr("id"));
  73. }
  74. });
  75. });
  76. //用户封禁列表
  77. var bHTML = '<a id="block_check" class="ui_btn ui_btn_s"\
  78. onclick="return false;"href="#">\
  79. <span><em>选中项加入黑名单</em></span></a>\ ';
  80. $("#restoreChecked").before(bHTML);
  81. $("#block_check").click(function(){
  82. $("#dataTable tbody input[type='checkbox']").each(function(){
  83. if($(this).attr("checked") === "checked"){
  84. block.menber += 1;
  85. var userID = $(this).parent().parent().find(".ui_btn").data("user-id");
  86. blockID(userID);
  87. }
  88. });
  89. });
  90. })(unsafeWindow.$);