sbd-npm 1.4.52 → 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 +40 -18
- package/util.js +29 -35
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>");
|
@@ -506,14 +528,14 @@ $(function () {
|
|
506
528
|
$("#task_div").html(ht_html.join(""));
|
507
529
|
$("#task_add").click(function() {
|
508
530
|
let task_content = $("#task_content").val();
|
509
|
-
task_content = task_content.replace(/[^\w\u4e00-\u9fff]/g, ''); // 去掉除字母、数字、下划线(_)
|
531
|
+
task_content = task_content.replace(/[^\w\u4e00-\u9fff-]/g, ''); // 去掉除字母、数字、下划线(_)、汉字、横杠(-)外的其他字符(䒚 /[^\w\u3400-\u9fff\u{20000}-\u{2EBEF}]/gu)
|
510
532
|
if (task_content && task_content.length > 0) {
|
511
533
|
$("#task_content").prop('disabled', true);
|
512
534
|
$("#task_add").prop('disabled', true);
|
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")) {
|
@@ -525,16 +547,16 @@ $(function () {
|
|
525
547
|
}
|
526
548
|
$("#task_result").val(task_result);
|
527
549
|
if ($("#is_refresh_task").prop("checked")) {
|
528
|
-
Status.task_timer_id = setTimeout(
|
550
|
+
Status.task_timer_id = setTimeout(() => {
|
529
551
|
Status.fetch_task_data(0);
|
530
552
|
}, 5678);
|
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 {
|
@@ -597,7 +619,7 @@ $(function () {
|
|
597
619
|
ta_obj.html('任务处理中...').prop('disabled', true).removeClass("btn-default").addClass("btn-warning");
|
598
620
|
tc_obj.prop('disabled', true);
|
599
621
|
if ($("#is_refresh_task").prop("checked")) {
|
600
|
-
Status.task_timer_id = setTimeout(
|
622
|
+
Status.task_timer_id = setTimeout(() => {
|
601
623
|
Status.fetch_task_data(0);
|
602
624
|
}, 3456);
|
603
625
|
}
|
@@ -660,7 +682,7 @@ $(function () {
|
|
660
682
|
Util.show_loading();
|
661
683
|
$("#machine_refresh").attr("disabled", true).html("正在处理中...");
|
662
684
|
Util.post(location.pathname, {active_div: "machine_refresh"}, function (j) {
|
663
|
-
setTimeout(
|
685
|
+
setTimeout(() => {
|
664
686
|
$('#machine_process_div').html('');
|
665
687
|
$('#machines').html('<option value="">暂无Machine</option>');
|
666
688
|
$("#machine_refresh").html("刷新Machine").attr("disabled", false);
|
@@ -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>");
|
@@ -1364,7 +1386,7 @@ $(function () {
|
|
1364
1386
|
localStorage[Status.tab_token] = request_arguments["tab"];
|
1365
1387
|
if (request_arguments["tab"] === "tool" && request_arguments["phone"]) {
|
1366
1388
|
$("#phone").val(request_arguments["phone"]);
|
1367
|
-
setTimeout(
|
1389
|
+
setTimeout(() => {
|
1368
1390
|
Status.phone_query();
|
1369
1391
|
Enterprise.fetch_enterprise_detail(j["unified_code"]);
|
1370
1392
|
}, 1234);
|
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,21 +111,21 @@ 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
|
|
127
123
|
Util.table_sort();
|
128
124
|
|
129
125
|
let page_title = Util.get_page_title();
|
130
|
-
if (page_title
|
126
|
+
if (page_title.length > 0) {
|
131
127
|
let d_title = document.title;
|
132
|
-
if (d_title.
|
128
|
+
if (!d_title.includes(page_title)) {
|
133
129
|
document.title = page_title + " - " + d_title;
|
134
130
|
}
|
135
131
|
}
|
@@ -481,7 +477,7 @@ const Util = {
|
|
481
477
|
});
|
482
478
|
if (interval > 0 && Util.is_trade_time()) {
|
483
479
|
interval = parseInt(interval > 4321 ? interval : 4321);
|
484
|
-
setTimeout(
|
480
|
+
setTimeout(() => {
|
485
481
|
Util.refresh_price(element_id, interval);
|
486
482
|
}, interval);
|
487
483
|
}
|
@@ -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
|
});
|
@@ -2901,7 +2899,7 @@ const Util = {
|
|
2901
2899
|
loading = loading < 5 ? (loading + 1) : 1;
|
2902
2900
|
let load_str = ".".repeat(loading);
|
2903
2901
|
tips_obj.innerHTML = origin_msg + load_str;
|
2904
|
-
setTimeout(
|
2902
|
+
setTimeout(() => {
|
2905
2903
|
Util.show_tips(msg, interval, cls, loading);
|
2906
2904
|
}, 300);
|
2907
2905
|
}
|
@@ -2921,9 +2919,9 @@ const Util = {
|
|
2921
2919
|
}
|
2922
2920
|
if (msg.indexOf(".") > -1 && msg.endsWith('.')) {
|
2923
2921
|
loading = msg.replace(/[^.]/g, '').length;
|
2924
|
-
setTimeout(
|
2922
|
+
setTimeout(() => {
|
2925
2923
|
Util.show_tips(msg, interval, cls, loading);
|
2926
|
-
}, 200)
|
2924
|
+
}, 200);
|
2927
2925
|
}
|
2928
2926
|
}
|
2929
2927
|
}
|
@@ -3137,7 +3135,7 @@ const Util = {
|
|
3137
3135
|
countdown_refresh_index_price: function (interval, element_id, index_list, is_us, is_refresh) {
|
3138
3136
|
if (interval > 0) {
|
3139
3137
|
$("#" + element_id + "_tips").html("交易中, " + interval + " 秒后刷新");
|
3140
|
-
Util.countdown_timer_id = setTimeout(
|
3138
|
+
Util.countdown_timer_id = setTimeout(() => {
|
3141
3139
|
Util.countdown_refresh_index_price(interval - 1, element_id, index_list, is_us, is_refresh);
|
3142
3140
|
}, 1000);
|
3143
3141
|
} else {
|
@@ -3149,7 +3147,7 @@ const Util = {
|
|
3149
3147
|
countdown_func: function (interval, tips_id, callback_func) {
|
3150
3148
|
if (interval > 0) {
|
3151
3149
|
$("#" + tips_id).html("交易中, " + interval + " 秒后刷新");
|
3152
|
-
Util.countdown_timer_id = setTimeout(
|
3150
|
+
Util.countdown_timer_id = setTimeout(() => {
|
3153
3151
|
Util.countdown_func(interval - 1, tips_id, callback_func);
|
3154
3152
|
}, 1000);
|
3155
3153
|
} else {
|
@@ -3163,17 +3161,13 @@ const Util = {
|
|
3163
3161
|
* @returns {string}
|
3164
3162
|
*/
|
3165
3163
|
get_page_title: function () {
|
3166
|
-
let
|
3167
|
-
if (
|
3168
|
-
let
|
3169
|
-
|
3170
|
-
|
3171
|
-
if (url && url === current_url) {
|
3172
|
-
page_title = $(this).text();
|
3173
|
-
}
|
3174
|
-
});
|
3164
|
+
let current_url = location.pathname;
|
3165
|
+
if (current_url) {
|
3166
|
+
let nodeObject = document.querySelectorAll('.side-menu li a');
|
3167
|
+
let match = Array.from(nodeObject).find(a => a.getAttribute("href") === current_url);
|
3168
|
+
return match ? match.textContent : "";
|
3175
3169
|
}
|
3176
|
-
return
|
3170
|
+
return "";
|
3177
3171
|
},
|
3178
3172
|
|
3179
3173
|
/**
|