sbd-npm 1.4.52 → 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 +5 -5
  3. package/util.js +14 -18
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sbd-npm",
3
- "version": "1.4.52",
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
@@ -506,7 +506,7 @@ $(function () {
506
506
  $("#task_div").html(ht_html.join(""));
507
507
  $("#task_add").click(function() {
508
508
  let task_content = $("#task_content").val();
509
- 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)
510
510
  if (task_content && task_content.length > 0) {
511
511
  $("#task_content").prop('disabled', true);
512
512
  $("#task_add").prop('disabled', true);
@@ -525,7 +525,7 @@ $(function () {
525
525
  }
526
526
  $("#task_result").val(task_result);
527
527
  if ($("#is_refresh_task").prop("checked")) {
528
- Status.task_timer_id = setTimeout(function () {
528
+ Status.task_timer_id = setTimeout(() => {
529
529
  Status.fetch_task_data(0);
530
530
  }, 5678);
531
531
  }
@@ -597,7 +597,7 @@ $(function () {
597
597
  ta_obj.html('任务处理中...').prop('disabled', true).removeClass("btn-default").addClass("btn-warning");
598
598
  tc_obj.prop('disabled', true);
599
599
  if ($("#is_refresh_task").prop("checked")) {
600
- Status.task_timer_id = setTimeout(function () {
600
+ Status.task_timer_id = setTimeout(() => {
601
601
  Status.fetch_task_data(0);
602
602
  }, 3456);
603
603
  }
@@ -660,7 +660,7 @@ $(function () {
660
660
  Util.show_loading();
661
661
  $("#machine_refresh").attr("disabled", true).html("正在处理中...");
662
662
  Util.post(location.pathname, {active_div: "machine_refresh"}, function (j) {
663
- setTimeout(function () {
663
+ setTimeout(() => {
664
664
  $('#machine_process_div').html('');
665
665
  $('#machines').html('<option value="">暂无Machine</option>');
666
666
  $("#machine_refresh").html("刷新Machine").attr("disabled", false);
@@ -1364,7 +1364,7 @@ $(function () {
1364
1364
  localStorage[Status.tab_token] = request_arguments["tab"];
1365
1365
  if (request_arguments["tab"] === "tool" && request_arguments["phone"]) {
1366
1366
  $("#phone").val(request_arguments["phone"]);
1367
- setTimeout(function () {
1367
+ setTimeout(() => {
1368
1368
  Status.phone_query();
1369
1369
  Enterprise.fetch_enterprise_detail(j["unified_code"]);
1370
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
  }
@@ -2901,7 +2901,7 @@ const Util = {
2901
2901
  loading = loading < 5 ? (loading + 1) : 1;
2902
2902
  let load_str = ".".repeat(loading);
2903
2903
  tips_obj.innerHTML = origin_msg + load_str;
2904
- setTimeout(function () {
2904
+ setTimeout(() => {
2905
2905
  Util.show_tips(msg, interval, cls, loading);
2906
2906
  }, 300);
2907
2907
  }
@@ -2921,9 +2921,9 @@ const Util = {
2921
2921
  }
2922
2922
  if (msg.indexOf(".") > -1 && msg.endsWith('.')) {
2923
2923
  loading = msg.replace(/[^.]/g, '').length;
2924
- setTimeout(function () {
2924
+ setTimeout(() => {
2925
2925
  Util.show_tips(msg, interval, cls, loading);
2926
- }, 200)
2926
+ }, 200);
2927
2927
  }
2928
2928
  }
2929
2929
  }
@@ -3137,7 +3137,7 @@ const Util = {
3137
3137
  countdown_refresh_index_price: function (interval, element_id, index_list, is_us, is_refresh) {
3138
3138
  if (interval > 0) {
3139
3139
  $("#" + element_id + "_tips").html("交易中, " + interval + " 秒后刷新");
3140
- Util.countdown_timer_id = setTimeout(function () {
3140
+ Util.countdown_timer_id = setTimeout(() => {
3141
3141
  Util.countdown_refresh_index_price(interval - 1, element_id, index_list, is_us, is_refresh);
3142
3142
  }, 1000);
3143
3143
  } else {
@@ -3149,7 +3149,7 @@ const Util = {
3149
3149
  countdown_func: function (interval, tips_id, callback_func) {
3150
3150
  if (interval > 0) {
3151
3151
  $("#" + tips_id).html("交易中, " + interval + " 秒后刷新");
3152
- Util.countdown_timer_id = setTimeout(function () {
3152
+ Util.countdown_timer_id = setTimeout(() => {
3153
3153
  Util.countdown_func(interval - 1, tips_id, callback_func);
3154
3154
  }, 1000);
3155
3155
  } else {
@@ -3163,17 +3163,13 @@ const Util = {
3163
3163
  * @returns {string}
3164
3164
  */
3165
3165
  get_page_title: function () {
3166
- let page_title = "";
3167
- if (location.pathname) {
3168
- let current_url = location.pathname;
3169
- $('.side-menu li a').each(function () {
3170
- let url = $(this).attr("href");
3171
- if (url && url === current_url) {
3172
- page_title = $(this).text();
3173
- }
3174
- });
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 : "";
3175
3171
  }
3176
- return page_title;
3172
+ return "";
3177
3173
  },
3178
3174
 
3179
3175
  /**