-
Notifications
You must be signed in to change notification settings - Fork 1
/
postdelete.js
65 lines (60 loc) · 1.95 KB
/
postdelete.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
// ==UserScript==
// @name Ruliweb Comment Remover
// @namespace http://tampermonkey.net/
// @version 0.1.1
// @description 루리웹 댓삭기
// @author hdd1013
// @match *bbs.ruliweb.com/member/mypage/mycomment*
// @grant none
// ==/UserScript==
(function () {
'use strict';
// Your code here...
var ruliFunctions = window.ruliFunctions = {};
var $commentTable = $("#mycomment").find(".text_over_table");
var delBtnHtml = "<div class=\"btn_light btn_delete\" style=\"\" onclick=\"ruliFunctions.delAllComments();\">전체 삭제</div>";
$commentTable.append(delBtnHtml);
ruliFunctions.delAllComments = function () {
var commentData = [];
for (var i = 0; i < $(".d_mycomment").length; i++) {
let commentItem = $(".d_mycomment")[i];
let currentComment = {};
currentComment.commentId = $(commentItem).attr("comment-id");
currentComment.articleId = $(commentItem).attr("article-id");
currentComment.boardId = $(commentItem).attr("board-id");
currentComment.isDeleted = false;
commentData.push(currentComment);
}
var t = 'https://api.ruliweb.com/';
var deleteCounter = 0;
for (var j = 0; j < commentData.length; j++) {
var d = {};
d.comment_id = commentData[j].commentId;
d.article_id = commentData[j].articleId;
d.board_id = commentData[j].boardId;
$.ajax({
url: t + "procDeleteMyComment",
type: "POST",
data: d,
dataType: "json",
xhrFields: {
withCredentials: !0
},
success: function (e) {
if (e.success) {
deleteCounter++;
if (deleteCounter == commentData.length) {
alert("삭제완료");
document.location.reload();
}
} else {
console.log("success: ", e.commend_id)
}
},
error: function () {
alert("ajax failure")
}
})
}
}
})();