sbd-npm 1.4.53 → 1.4.54
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/status.js +35 -13
- package/util.js +17 -19
package/package.json
CHANGED
package/status.js
CHANGED
@@ -154,10 +154,32 @@ $(function () {
|
|
154
154
|
}
|
155
155
|
html.push("<td title='", item["referer"], "'>", Util.pack_html_link("http://" + item["referer"], Util.substring(item["referer"], 50)), "</td>");
|
156
156
|
html.push("<td>", item["visit"], "</td>");
|
157
|
-
|
157
|
+
if (item["is_block"] === 1) {
|
158
|
+
html.push("<td>", Util.seconds_to_format(item["time"]), "</td>");
|
159
|
+
} else {
|
160
|
+
html.push("<td><a href='#' class='block_ip' data-val='", item["ip"], "'>", Util.seconds_to_format(item["time"]), "</a></td>");
|
161
|
+
}
|
158
162
|
html.push("</tr>");
|
159
163
|
});
|
160
164
|
Util.render_table_html("ip_daily_data", html);
|
165
|
+
$("#ip_daily_data .block_ip").each(function() {
|
166
|
+
$(this).click(function() {
|
167
|
+
let ip = $(this).attr("data-val");
|
168
|
+
if (confirm("是否确定要屏蔽IP “ " + ip + " ” ?")) {
|
169
|
+
Util.show_loading();
|
170
|
+
Util.post(location.pathname, {"active_div": "block_ip", "ip": ip}, function (j) {
|
171
|
+
Util.hide_tips();
|
172
|
+
if (j["code"] === 1) {
|
173
|
+
Util.show_tips("IP “ " + ip + " ” 已加到屏蔽队列中", 4567, "alert-success");
|
174
|
+
} else if (j["code"] === 2) {
|
175
|
+
Util.show_tips("IP “ " + ip + " ” 已在屏蔽队列中", 4567, "alert-success");
|
176
|
+
} else {
|
177
|
+
Util.show_tips("屏蔽IP “ " + ip + " ” 失败", 4567, "alert-danger");
|
178
|
+
}
|
179
|
+
});
|
180
|
+
}
|
181
|
+
});
|
182
|
+
});
|
161
183
|
},
|
162
184
|
|
163
185
|
pack_ip_link: function(ip) {
|
@@ -237,9 +259,9 @@ $(function () {
|
|
237
259
|
]
|
238
260
|
});
|
239
261
|
}
|
240
|
-
Util.post(location.pathname, {active_div:
|
262
|
+
Util.post(location.pathname, {active_div: "get_block_ip"}, function (j) {
|
241
263
|
let html = [], ip_num = j["num"];
|
242
|
-
$("#ip_num").html("共 <span class='label label-info'>" +
|
264
|
+
$("#ip_num").html("共 <span class='label label-info'>" + ip_num + "</span> 条(" + j["total_ip_num"] + ") ");
|
243
265
|
j["data"].forEach(function (item) {
|
244
266
|
html.push("<tr>");
|
245
267
|
html.push("<td>", ip_num, "</td>");
|
@@ -513,7 +535,7 @@ $(function () {
|
|
513
535
|
Util.show_loading();
|
514
536
|
$("#task_tips").html("");
|
515
537
|
Util.post(location.pathname, {active_div: "task_add", "task_content": task_content, machine_id: $("#task_machines").val()}, function (j) {
|
516
|
-
if (j["code"]
|
538
|
+
if (j["code"] === 1) {
|
517
539
|
Status.task_status = 1;
|
518
540
|
$("#task_add").html('任务处理中...').removeClass("btn-default").addClass("btn-warning");
|
519
541
|
if (!document.getElementById("task_result")) {
|
@@ -531,10 +553,10 @@ $(function () {
|
|
531
553
|
}
|
532
554
|
} else {
|
533
555
|
Status.task_status = 0;
|
534
|
-
if (j["code"]
|
556
|
+
if (j["code"] === 2) {
|
535
557
|
let do_content = j["do_content"] ? ("(" + j["do_content"] + ")") : "";
|
536
558
|
$("#task_tips").html("<b class='text-danger'>已添加新任务" + do_content + "在处理中!</b>");
|
537
|
-
} else if (j["code"]
|
559
|
+
} else if (j["code"] === 3) {
|
538
560
|
let doing_content = j["doing_content"] ? ("(" + j["doing_content"] + ")") : "";
|
539
561
|
$("#task_tips").html("<b class='text-danger'>有任务" + doing_content + "在执行中!</b>");
|
540
562
|
} else {
|
@@ -875,11 +897,11 @@ $(function () {
|
|
875
897
|
$("#machine_action_add").attr("disabled", true);
|
876
898
|
Util.post(location.pathname, {active_div: "machine_action_add", "machine_id": machine_id, "content": action_content, action_type: action_type}, function (j) {
|
877
899
|
$("#machine_action_add").attr("disabled", false);
|
878
|
-
if (j["code"]
|
900
|
+
if (j["code"] === 1) {
|
879
901
|
$("#machine_action_tips").html("<b class='text-success'>任务`" + action_content + "`添加成功!</b>");
|
880
|
-
} else if (j["code"]
|
902
|
+
} else if (j["code"] === 2) {
|
881
903
|
$("#machine_action_tips").html("<b class='text-danger'>Machine 不存在!</b>");
|
882
|
-
} else if (j["code"]
|
904
|
+
} else if (j["code"] === 3) {
|
883
905
|
$("#machine_action_tips").html("<b class='text-danger'>任务内容异常!</b>");
|
884
906
|
} else {
|
885
907
|
$("#machine_action_tips").html("<b class='text-danger'>任务内容不能为空!</b>");
|
@@ -954,9 +976,9 @@ $(function () {
|
|
954
976
|
$("#machine_cookie_add").attr("disabled", true);
|
955
977
|
Util.post(location.pathname, {active_div: "machine_cookie_add", "machine_id": machine_id, "cookie": machine_cookie}, function (j) {
|
956
978
|
$("#machine_cookie_add").attr("disabled", false);
|
957
|
-
if (j["code"]
|
979
|
+
if (j["code"] === 1) {
|
958
980
|
$("#machine_cookie_tips").html("<b class='text-success'>Cookie添加成功!</b>");
|
959
|
-
} else if (j["code"]
|
981
|
+
} else if (j["code"] === 2) {
|
960
982
|
$("#machine_cookie_tips").html("<b class='text-danger'>Machine 不存在!</b>");
|
961
983
|
} else {
|
962
984
|
$("#machine_cookie_tips").html("<b class='text-danger'>Cookie异常!</b>");
|
@@ -1033,11 +1055,11 @@ $(function () {
|
|
1033
1055
|
let chinese = $("#word_chinese").val();
|
1034
1056
|
if (chinese) {
|
1035
1057
|
Util.post(location.pathname, {"active_div": "word_modify", "word": word, "chinese": chinese}, function (j) {
|
1036
|
-
if (j["code"]
|
1058
|
+
if (j["code"] === 1) {
|
1037
1059
|
$("#word_chinese").val(j["chinese"]);
|
1038
1060
|
$(tr_obj).children('td').eq(2).html(j["chinese"]);
|
1039
1061
|
$("#word_tips").html("<b class='text-success'>修改成功!</b>");
|
1040
|
-
} else if (j["code"]
|
1062
|
+
} else if (j["code"] === 2) {
|
1041
1063
|
$("#word_tips").html("<b class='text-danger'>中文有误!</b>");
|
1042
1064
|
} else {
|
1043
1065
|
$("#word_tips").html("<b class='text-danger'>修改失败!</b>");
|
package/util.js
CHANGED
@@ -77,18 +77,14 @@ const Util = {
|
|
77
77
|
return false;
|
78
78
|
});
|
79
79
|
|
80
|
-
|
81
|
-
let
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
url_arr.push(url);
|
86
|
-
}
|
87
|
-
});
|
88
|
-
if (url_arr.length > 0) {
|
89
|
-
window.open(Util.array_rand(url_arr), "_blank");
|
80
|
+
document.getElementById("random_walk").addEventListener("click", () => {
|
81
|
+
let nodeObject = document.querySelectorAll(".side-menu li a");
|
82
|
+
let url_array = Array.from(nodeObject).map(a => a.getAttribute("href")).filter(Boolean);
|
83
|
+
if (url_array.length > 0) {
|
84
|
+
window.open(Util.array_rand(url_array), "_blank");
|
90
85
|
}
|
91
86
|
});
|
87
|
+
|
92
88
|
$("#save_page_content").click(function() {
|
93
89
|
let element;
|
94
90
|
if (document.getElementsByClassName("save_page_div").length > 0) {
|
@@ -115,12 +111,12 @@ const Util = {
|
|
115
111
|
$("#search-tips").css("display", "none");
|
116
112
|
}
|
117
113
|
});
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
114
|
+
document.addEventListener("click", function(event) {
|
115
|
+
if (event.target.id !== "stock") {
|
116
|
+
let st_object = document.getElementById("search-tips");
|
117
|
+
if (st_object) {
|
118
|
+
st_object.style.display = "none";
|
119
|
+
}
|
124
120
|
}
|
125
121
|
});
|
126
122
|
|
@@ -1716,9 +1712,11 @@ const Util = {
|
|
1716
1712
|
let word = $(tr_obj).children('td').eq(1).text();
|
1717
1713
|
let chinese = $(tr_obj).children('td').eq(2).text();
|
1718
1714
|
if (confirm("是否确定要删除“ " + word + "「" + chinese + "」 ” ?")) {
|
1715
|
+
Util.show_loading();
|
1719
1716
|
Util.post(location.pathname, {"active_div": "word_del", "word": word}, function () {
|
1720
1717
|
$(tr_obj).remove();
|
1721
|
-
Util.
|
1718
|
+
Util.hide_tips();
|
1719
|
+
Util.show_tips("删除 “ " + word + " ” 成功", 4567, "alert-success");
|
1722
1720
|
});
|
1723
1721
|
}
|
1724
1722
|
});
|
@@ -3165,8 +3163,8 @@ const Util = {
|
|
3165
3163
|
get_page_title: function () {
|
3166
3164
|
let current_url = location.pathname;
|
3167
3165
|
if (current_url) {
|
3168
|
-
let
|
3169
|
-
let match = Array.from(
|
3166
|
+
let nodeObject = document.querySelectorAll('.side-menu li a');
|
3167
|
+
let match = Array.from(nodeObject).find(a => a.getAttribute("href") === current_url);
|
3170
3168
|
return match ? match.textContent : "";
|
3171
3169
|
}
|
3172
3170
|
return "";
|