Advertisement
Guest User

Ruliweb Article Remover v0.0.2

a guest
Jun 29th, 2022
1,059
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.38 KB | None | 0 0
  1. // ==UserScript==
  2. // @name Ruliweb Article Remover
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.0.2
  5. // @description 루리웹 글 삭제기
  6. // @author nana111
  7. // @match *bbs.ruliweb.com/member/mypage/myarticle*
  8. // @grant none
  9. // ==/UserScript==
  10. (function() {
  11. 'use strict';
  12.  
  13. // Your code here...
  14. var ruliFunctions = window.ruliFunctions = {};
  15. var $commentTable = $("#myarticle").find("table");
  16. var delBtnHtml = "<div class=\"btn_light btn_delete\" style=\"\" onclick=\"ruliFunctions.delAllarticle();\">전체 삭제</div>";
  17. $commentTable.append(delBtnHtml);
  18.  
  19. ruliFunctions.delAllarticle = function() {
  20. var check = window.confirm("해당 페이지 내 글을 전부 삭제하시겠습니까?\n\n이 기능을 사용하여 생기는 문제는 전부 본인의 책임입니다.");
  21. if (check === true) {
  22. var articleData = [];
  23. for (var i = 0; i < $(".d_myarticle").length; i++) {
  24. let commentItem = $(".d_myarticle")[i];
  25. let currentItem = {};
  26. currentItem.articleId = $(commentItem).attr("article-id");
  27. currentItem.boardId = $(commentItem).attr("board-id");
  28. currentItem.isDeleted = false;
  29. articleData.push(currentItem);
  30. }
  31.  
  32. var t = 'https://api.ruliweb.com/';
  33. var deleteCounter = 0;
  34. var failedCounter = 0;
  35.  
  36. if (articleData.length > 0) {
  37. for (var j = 0; j < articleData.length; j++) {
  38. var d = {};
  39. d.article_id = articleData[j].articleId;
  40. d.board_id = articleData[j].boardId;
  41.  
  42. $.ajax({
  43. url: t + "procDeleteMyArticle",
  44. type: "POST",
  45. data: d,
  46. dataType: "json",
  47. xhrFields: {
  48. withCredentials: !0
  49. },
  50. success: function(e) {
  51. if (e.success) {
  52. deleteCounter++;
  53. } else {
  54. failedCounter++;
  55. window.alert("아래사유로 해당글의 삭제가 실패했습니다.\n\n사유: " + e.message + "\n게시판ID: " + d.board_id + "\n게시글ID: " + d.article_id);
  56. console.log("del Failed (" + e.message + ", " + d.board_id + ", " + d.article_id);
  57. }
  58. },
  59. error: function() {
  60. failedCounter++;
  61. window.alert("아래사유로 해당글의 삭제가 실패했습니다.\n\n사유: ajax failure\n게시판ID: " + d.board_id + "\n게시글ID: " + d.article_id);
  62. console.log("del Failed (ajax failure, " + d.board_id + ", " + d.article_id);
  63. }
  64. });
  65. }
  66. alert("처리완료.\n\n성공: " + deleteCounter + "\n실패:" + failedCounter);
  67. document.location.reload();
  68. } else {
  69. alert("처리할 게시물이 존재하지 않습니다.");
  70. document.location.reload();
  71. }
  72. }
  73. }
  74. })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement