sbd-npm 1.4.51 → 1.4.53

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 +8 -5
  3. package/util.js +17 -25
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sbd-npm",
3
- "version": "1.4.51",
3
+ "version": "1.4.53",
4
4
  "description": "Stock Big Data",
5
5
  "author": "DHQ <dhq314@gmail.com>",
6
6
  "license": "ISC",
package/status.js CHANGED
@@ -363,6 +363,9 @@ $(function () {
363
363
  html.push("<td>", database_variable_num, "</td>");
364
364
  html.push("<td class='text-right'>", item["key"], "</td>");
365
365
  }
366
+ if (item["key"] === "innodb_buffer_pool_size") {
367
+ item["val"] += " (" + Util.trans_byte_size(item["val"]) + ")";
368
+ }
366
369
  html.push("<td class='text-left' style='word-break: break-all'>", item["val"], "</td>");
367
370
  html.push("</tr>");
368
371
  });
@@ -503,7 +506,7 @@ $(function () {
503
506
  $("#task_div").html(ht_html.join(""));
504
507
  $("#task_add").click(function() {
505
508
  let task_content = $("#task_content").val();
506
- task_content = task_content.replace(/[^\w\u4e00-\u9fff]/g, ''); // 去掉除字母、数字、下划线(_)、汉字外的其他字符(䒚 /[^\w\u3400-\u9fff\u{20000}-\u{2EBEF}]/gu)
509
+ task_content = task_content.replace(/[^\w\u4e00-\u9fff-]/g, ''); // 去掉除字母、数字、下划线(_)、汉字、横杠(-)外的其他字符(䒚 /[^\w\u3400-\u9fff\u{20000}-\u{2EBEF}]/gu)
507
510
  if (task_content && task_content.length > 0) {
508
511
  $("#task_content").prop('disabled', true);
509
512
  $("#task_add").prop('disabled', true);
@@ -522,7 +525,7 @@ $(function () {
522
525
  }
523
526
  $("#task_result").val(task_result);
524
527
  if ($("#is_refresh_task").prop("checked")) {
525
- Status.task_timer_id = setTimeout(function () {
528
+ Status.task_timer_id = setTimeout(() => {
526
529
  Status.fetch_task_data(0);
527
530
  }, 5678);
528
531
  }
@@ -594,7 +597,7 @@ $(function () {
594
597
  ta_obj.html('任务处理中...').prop('disabled', true).removeClass("btn-default").addClass("btn-warning");
595
598
  tc_obj.prop('disabled', true);
596
599
  if ($("#is_refresh_task").prop("checked")) {
597
- Status.task_timer_id = setTimeout(function () {
600
+ Status.task_timer_id = setTimeout(() => {
598
601
  Status.fetch_task_data(0);
599
602
  }, 3456);
600
603
  }
@@ -657,7 +660,7 @@ $(function () {
657
660
  Util.show_loading();
658
661
  $("#machine_refresh").attr("disabled", true).html("正在处理中...");
659
662
  Util.post(location.pathname, {active_div: "machine_refresh"}, function (j) {
660
- setTimeout(function () {
663
+ setTimeout(() => {
661
664
  $('#machine_process_div').html('');
662
665
  $('#machines').html('<option value="">暂无Machine</option>');
663
666
  $("#machine_refresh").html("刷新Machine").attr("disabled", false);
@@ -1361,7 +1364,7 @@ $(function () {
1361
1364
  localStorage[Status.tab_token] = request_arguments["tab"];
1362
1365
  if (request_arguments["tab"] === "tool" && request_arguments["phone"]) {
1363
1366
  $("#phone").val(request_arguments["phone"]);
1364
- setTimeout(function () {
1367
+ setTimeout(() => {
1365
1368
  Status.phone_query();
1366
1369
  Enterprise.fetch_enterprise_detail(j["unified_code"]);
1367
1370
  }, 1234);
package/util.js CHANGED
@@ -127,9 +127,9 @@ const Util = {
127
127
  Util.table_sort();
128
128
 
129
129
  let page_title = Util.get_page_title();
130
- if (page_title && page_title.length > 0) {
130
+ if (page_title.length > 0) {
131
131
  let d_title = document.title;
132
- if (d_title.indexOf(page_title) === -1) {
132
+ if (!d_title.includes(page_title)) {
133
133
  document.title = page_title + " - " + d_title;
134
134
  }
135
135
  }
@@ -481,7 +481,7 @@ const Util = {
481
481
  });
482
482
  if (interval > 0 && Util.is_trade_time()) {
483
483
  interval = parseInt(interval > 4321 ? interval : 4321);
484
- setTimeout(function () {
484
+ setTimeout(() => {
485
485
  Util.refresh_price(element_id, interval);
486
486
  }, interval);
487
487
  }
@@ -2478,9 +2478,8 @@ const Util = {
2478
2478
  return Util.to_float(mega_byte, 2) + " MB";
2479
2479
  } else if (kilo_byte > 0) {
2480
2480
  return Util.to_float(kilo_byte, 2) + " KB";
2481
- } else {
2482
- return byte + " B";
2483
2481
  }
2482
+ return byte + " B";
2484
2483
  },
2485
2484
 
2486
2485
  /**
@@ -2633,8 +2632,7 @@ const Util = {
2633
2632
  * @param obj_token
2634
2633
  */
2635
2634
  parse_value_trend: function (obj_token) {
2636
- let data_arr = [];
2637
- let unit = "";
2635
+ let data_arr = [], unit = "";
2638
2636
  $("." + obj_token).each(function () {
2639
2637
  let val = $(this).text();
2640
2638
  if (unit === "") {
@@ -2643,9 +2641,7 @@ const Util = {
2643
2641
  unit = match_arr[0];
2644
2642
  }
2645
2643
  }
2646
- let digit = Util.filter_chinese(val);
2647
- let d = {"obj": $(this), "digit": digit};
2648
- data_arr.push(d);
2644
+ data_arr.push({"obj": $(this), "digit": Util.filter_chinese(val)});
2649
2645
  });
2650
2646
  let data_arr_len = data_arr.length;
2651
2647
  if (data_arr_len > 0) {
@@ -2905,7 +2901,7 @@ const Util = {
2905
2901
  loading = loading < 5 ? (loading + 1) : 1;
2906
2902
  let load_str = ".".repeat(loading);
2907
2903
  tips_obj.innerHTML = origin_msg + load_str;
2908
- setTimeout(function () {
2904
+ setTimeout(() => {
2909
2905
  Util.show_tips(msg, interval, cls, loading);
2910
2906
  }, 300);
2911
2907
  }
@@ -2925,9 +2921,9 @@ const Util = {
2925
2921
  }
2926
2922
  if (msg.indexOf(".") > -1 && msg.endsWith('.')) {
2927
2923
  loading = msg.replace(/[^.]/g, '').length;
2928
- setTimeout(function () {
2924
+ setTimeout(() => {
2929
2925
  Util.show_tips(msg, interval, cls, loading);
2930
- }, 200)
2926
+ }, 200);
2931
2927
  }
2932
2928
  }
2933
2929
  }
@@ -3141,7 +3137,7 @@ const Util = {
3141
3137
  countdown_refresh_index_price: function (interval, element_id, index_list, is_us, is_refresh) {
3142
3138
  if (interval > 0) {
3143
3139
  $("#" + element_id + "_tips").html("交易中, " + interval + " 秒后刷新");
3144
- Util.countdown_timer_id = setTimeout(function () {
3140
+ Util.countdown_timer_id = setTimeout(() => {
3145
3141
  Util.countdown_refresh_index_price(interval - 1, element_id, index_list, is_us, is_refresh);
3146
3142
  }, 1000);
3147
3143
  } else {
@@ -3153,7 +3149,7 @@ const Util = {
3153
3149
  countdown_func: function (interval, tips_id, callback_func) {
3154
3150
  if (interval > 0) {
3155
3151
  $("#" + tips_id).html("交易中, " + interval + " 秒后刷新");
3156
- Util.countdown_timer_id = setTimeout(function () {
3152
+ Util.countdown_timer_id = setTimeout(() => {
3157
3153
  Util.countdown_func(interval - 1, tips_id, callback_func);
3158
3154
  }, 1000);
3159
3155
  } else {
@@ -3167,17 +3163,13 @@ const Util = {
3167
3163
  * @returns {string}
3168
3164
  */
3169
3165
  get_page_title: function () {
3170
- let page_title = "";
3171
- if (location.pathname) {
3172
- let current_url = location.pathname;
3173
- $('.side-menu li a').each(function () {
3174
- let url = $(this).attr("href");
3175
- if (url && url === current_url) {
3176
- page_title = $(this).text();
3177
- }
3178
- });
3166
+ let current_url = location.pathname;
3167
+ if (current_url) {
3168
+ let arrayObject = document.querySelectorAll('.side-menu li a');
3169
+ let match = Array.from(arrayObject).find(a => a.getAttribute("href") === current_url);
3170
+ return match ? match.textContent : "";
3179
3171
  }
3180
- return page_title;
3172
+ return "";
3181
3173
  },
3182
3174
 
3183
3175
  /**