sbd-npm 1.4.55 → 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 -15
  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.55",
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,27 +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
- let match_ip_data = Util.regexp_match_ip(item["ip"]);
161
- html.push("<td><a href='#' class='block_ip' data-val='", ((match_ip_data && match_ip_data[0]) ? match_ip_data[0] : 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>");
162
161
  }
163
162
  html.push("</tr>");
164
163
  });
165
164
  Util.render_table_html("ip_daily_data", html);
166
165
  $("#ip_daily_data .block_ip").each(function() {
167
166
  $(this).click(function() {
168
- let ip = $(this).attr("data-val");
169
- if (confirm("是否确定要屏蔽IP " + ip + " ” ?")) {
170
- Util.show_loading();
171
- Util.post(location.pathname, {"active_div": "block_ip", "ip": ip}, function (j) {
172
- Util.hide_tips();
173
- if (j["code"] === 1) {
174
- Util.show_tips("IP " + ip + " ” 已加到屏蔽队列中", 4567, "alert-success");
175
- } else if (j["code"] === 2) {
176
- Util.show_tips("IP “ " + ip + " ” 已在屏蔽队列中", 4567, "alert-success");
177
- } else {
178
- Util.show_tips("屏蔽IP " + ip + " ” 失败", 4567, "alert-danger");
179
- }
180
- });
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
+ }
181
184
  }
182
185
  });
183
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) {