sbd-npm 1.4.54 → 1.4.56

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.
Files changed (3) hide show
  1. package/package.json +1 -1
  2. package/status.js +18 -14
  3. package/util.js +1 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sbd-npm",
3
- "version": "1.4.54",
3
+ "version": "1.4.56",
4
4
  "description": "Stock Big Data",
5
5
  "author": "DHQ <dhq314@gmail.com>",
6
6
  "license": "ISC",
package/status.js CHANGED
@@ -157,26 +157,30 @@ $(function () {
157
157
  if (item["is_block"] === 1) {
158
158
  html.push("<td>", Util.seconds_to_format(item["time"]), "</td>");
159
159
  } else {
160
- html.push("<td><a href='#' class='block_ip' data-val='", item["ip"], "'>", Util.seconds_to_format(item["time"]), "</a></td>");
160
+ html.push("<td><a href='#' class='block_ip'>", Util.seconds_to_format(item["time"]), "</a></td>");
161
161
  }
162
162
  html.push("</tr>");
163
163
  });
164
164
  Util.render_table_html("ip_daily_data", html);
165
165
  $("#ip_daily_data .block_ip").each(function() {
166
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
- });
167
+ let ip = $(this).parent().parent().children('td').eq(0).text();
168
+ let match_ip_data = Util.regexp_match_ip(ip);
169
+ if (match_ip_data && match_ip_data[0]) {
170
+ ip = match_ip_data[0];
171
+ if (confirm("是否确定要屏蔽IP “ " + ip + " ” ?")) {
172
+ Util.show_loading();
173
+ Util.post(location.pathname, {"active_div": "block_ip", "ip": ip}, function (j) {
174
+ Util.hide_tips();
175
+ if (j["code"] === 1) {
176
+ Util.show_tips("IP " + ip + " ” 已加到屏蔽队列中", 4567, "alert-success");
177
+ } else if (j["code"] === 2) {
178
+ Util.show_tips("IP “ " + ip + " ” 已在屏蔽队列中", 4567, "alert-success");
179
+ } else {
180
+ Util.show_tips("屏蔽IP “ " + ip + " ” 失败", 4567, "alert-danger");
181
+ }
182
+ });
183
+ }
180
184
  }
181
185
  });
182
186
  });
package/util.js CHANGED
@@ -77,7 +77,7 @@ const Util = {
77
77
  return false;
78
78
  });
79
79
 
80
- document.getElementById("random_walk").addEventListener("click", () => {
80
+ $("#random_walk").click(function() {
81
81
  let nodeObject = document.querySelectorAll(".side-menu li a");
82
82
  let url_array = Array.from(nodeObject).map(a => a.getAttribute("href")).filter(Boolean);
83
83
  if (url_array.length > 0) {