sbd-npm 1.4.98 → 1.4.99

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sbd-npm",
3
- "version": "1.4.98",
3
+ "version": "1.4.99",
4
4
  "description": "Stock Big Data",
5
5
  "author": "DHQ <dhq314@gmail.com>",
6
6
  "license": "ISC",
package/status.js CHANGED
@@ -69,7 +69,7 @@ $(function () {
69
69
  Status.handle_site_map();
70
70
  break;
71
71
  }
72
- Status["data"][active_div] = 1;
72
+ Status.data[active_div] = 1;
73
73
  },
74
74
 
75
75
  handle_status: function () {
@@ -777,12 +777,12 @@ $(function () {
777
777
  $("#machine_refresh").click(function() {
778
778
  if (confirm("是否确定要“ 刷新Machine ” ?")) {
779
779
  Util.show_loading();
780
- $("#machine_refresh").attr("disabled", true).html("正在处理中...");
780
+ $("#machine_refresh").prop("disabled", true).html("正在处理中...");
781
781
  Util.post(location.pathname, {active_div: "machine_refresh"}, function (j) {
782
782
  setTimeout(() => {
783
783
  $('#machine_process_div').html('');
784
784
  $('#machines').html('<option value="">暂无Machine</option>');
785
- $("#machine_refresh").html("刷新Machine").attr("disabled", false);
785
+ $("#machine_refresh").html("刷新Machine").prop("disabled", false);
786
786
  Util.hide_tips();
787
787
  Util.show_tips("刷新成功", 3456, "alert-success");
788
788
  }, 2345);
@@ -1137,6 +1137,7 @@ $(function () {
1137
1137
  });
1138
1138
  cam_obj.on('hidden.bs.modal', function () {
1139
1139
  $("#machine_instruction_tips").html("");
1140
+ $("#machine_instruction_add").prop("disabled", false);
1140
1141
  Util.hide_tips();
1141
1142
  });
1142
1143
  $("#machine_instruction_add").click(function() {
@@ -1150,9 +1151,9 @@ $(function () {
1150
1151
  if (instruction) {
1151
1152
  Util.show_loading();
1152
1153
  $("#machine_instruction_tips").html("");
1153
- $("#machine_instruction_add").attr("disabled", true);
1154
+ $("#machine_instruction_add").prop("disabled", true);
1154
1155
  Util.post(location.pathname, {active_div: "machine_instruction_add", "machine_id": machine_id, "instruction": instruction, action_type: action_type}, function (j) {
1155
- $("#machine_instruction_add").attr("disabled", false);
1156
+ $("#machine_instruction_add").prop("disabled", false);
1156
1157
  if (j.code === 1) {
1157
1158
  $("#machine_instruction_tips").html("<b class='text-success'>任务`" + instruction + "`添加成功!</b>");
1158
1159
  $("#machine_instruction_modal_title_tips").html("&nbsp;(" + instruction + ")");
@@ -1221,6 +1222,7 @@ $(function () {
1221
1222
  ccm_obj.on('hidden.bs.modal', function () {
1222
1223
  $("#machine_cookie_content").val("");
1223
1224
  $("#machine_cookie_tips").html("");
1225
+ $("#machine_cookie_add").prop("disabled", false);
1224
1226
  Util.hide_tips();
1225
1227
  });
1226
1228
  $("#machine_cookie_add").click(function() {
@@ -1230,9 +1232,9 @@ $(function () {
1230
1232
  if (machine_cookie) {
1231
1233
  Util.show_loading();
1232
1234
  $("#machine_cookie_tips").html("");
1233
- $("#machine_cookie_add").attr("disabled", true);
1235
+ $("#machine_cookie_add").prop("disabled", true);
1234
1236
  Util.post(location.pathname, {active_div: "machine_cookie_add", "machine_id": machine_id, "cookie": machine_cookie}, function (j) {
1235
- $("#machine_cookie_add").attr("disabled", false);
1237
+ $("#machine_cookie_add").prop("disabled", false);
1236
1238
  if (j.code === 1) {
1237
1239
  $("#machine_cookie_tips").html("<b class='text-success'>Cookie添加成功!</b>");
1238
1240
  } else if (j.code === 2) {
@@ -1377,10 +1379,10 @@ $(function () {
1377
1379
  Util.show_loading();
1378
1380
  ip = match_ip_data[0];
1379
1381
  $("#ip").prop('disabled', true);
1380
- $("#ip_query").attr("disabled", true);
1382
+ $("#ip_query").prop("disabled", true);
1381
1383
  Util.post("/action", {action: "ip_query", ip: ip}, function (j) {
1382
1384
  $("#ip").prop('disabled', false);
1383
- $("#ip_query").attr("disabled", false);
1385
+ $("#ip_query").prop("disabled", false);
1384
1386
  if (j.ip) {
1385
1387
  if (j.domain) {
1386
1388
  let domain = $("#ip").val().trim();
@@ -1421,10 +1423,10 @@ $(function () {
1421
1423
  if (md5) {
1422
1424
  Util.show_loading();
1423
1425
  $("#md5").prop('disabled', true);
1424
- $("#md5_encrypt").attr("disabled", true);
1426
+ $("#md5_encrypt").prop("disabled", true);
1425
1427
  Util.post("/action", {action: "md5", md5: md5}, function (md5_result) {
1426
1428
  $("#md5").prop('disabled', false);
1427
- $("#md5_encrypt").attr("disabled", false);
1429
+ $("#md5_encrypt").prop("disabled", false);
1428
1430
  $("#md5_result").html("<b class='text-success'>" + md5_result + "</b>");
1429
1431
  Util.hide_tips();
1430
1432
  }, "text");
@@ -1544,10 +1546,10 @@ $(function () {
1544
1546
  if (phone && Util.is_phone(phone)) {
1545
1547
  Util.show_loading();
1546
1548
  $("#phone").prop('disabled', true);
1547
- $("#phone_query").attr("disabled", true);
1549
+ $("#phone_query").prop("disabled", true);
1548
1550
  Util.post("/action", {action: "phone_query", phone: phone}, function (j) {
1549
1551
  $("#phone").prop('disabled', false);
1550
- $("#phone_query").attr("disabled", false);
1552
+ $("#phone_query").prop("disabled", false);
1551
1553
  if (j.belong) {
1552
1554
  let phone_url = Util.pack_html_link("https://www.ip138.com/mobile.asp?mobile=" + phone + "&action=mobile", "<i class='glyphicon glyphicon-link'></i> ");
1553
1555
  $("#phone_result").html(Status.convert_phone(j) + "&nbsp;&nbsp;" + phone_url);
@@ -1695,10 +1697,10 @@ $(function () {
1695
1697
  });
1696
1698
 
1697
1699
  let request_arguments = Util.request_arguments();
1698
- if (request_arguments["tab"]) {
1699
- localStorage[Status.tab_token] = request_arguments["tab"];
1700
- if (request_arguments["tab"] === "tool" && request_arguments["phone"]) {
1701
- $("#phone").val(request_arguments["phone"]);
1700
+ if (request_arguments.tab) {
1701
+ localStorage[Status.tab_token] = request_arguments.tab;
1702
+ if (request_arguments.tab === "tool" && request_arguments.phone) {
1703
+ $("#phone").val(request_arguments.phone);
1702
1704
  setTimeout(() => {
1703
1705
  Status.phone_query();
1704
1706
  }, 1234);
package/stock_basics.js CHANGED
@@ -135,7 +135,7 @@ let Stock = {
135
135
  Stock.fetch_hist_data();
136
136
  break;
137
137
  }
138
- Stock["data"][active_div] = 1;
138
+ Stock.data[active_div] = 1;
139
139
  },
140
140
 
141
141
  fetch_base: function () {
@@ -227,8 +227,8 @@ let Stock = {
227
227
  }
228
228
  remark_html += "&nbsp;&nbsp;<b>行业板块:</b> ";
229
229
  item.industry_data.forEach(function (i_d) {
230
- let url = Util.get_url("summary_industry") + "?code=" + i_d["code"] + "&industry_type=" + i_d["industry_type"];
231
- remark_html += " <a href='" + url + "' class='btn btn-xs btn-warning'>" + i_d["name"] + "</a>";
230
+ let url = Util.get_url("summary_industry") + "?code=" + i_d.code + "&industry_type=" + i_d.industry_type;
231
+ remark_html += " <a href='" + url + "' class='btn btn-xs btn-warning'>" + i_d.name + "</a>";
232
232
  });
233
233
  }
234
234
  if (item.is_sh50) {
@@ -382,7 +382,7 @@ let Stock = {
382
382
  },
383
383
 
384
384
  fetch_big_deal: function () {
385
- if ($("#big_deal_table_body").length <= 0) {
385
+ if (!document.getElementById("big_deal_table_body")) {
386
386
  Util.show_loading();
387
387
  let money_inflow_url = Util.get_url("trend_money_inflow");
388
388
  Util.init_table_skeleton({
@@ -1145,7 +1145,7 @@ let Stock = {
1145
1145
  }
1146
1146
  });
1147
1147
  Stock["margin_month_flow_chart"] = Util.chart_basic_bar(Stock["margin_month_flow_chart"], "margin_month_flow_bar_chart", date_data, flow_data, "增幅(单位:万)", color_data);
1148
- if ($("#margin_modal_body").length === 0) {
1148
+ if (!document.getElementById("margin_modal_body")) {
1149
1149
  Stock.fetch_margin_modal();
1150
1150
  }
1151
1151
  Util.hide_tips();
@@ -1265,7 +1265,7 @@ let Stock = {
1265
1265
  color_data.push(item.value > 0 ? "#E74C3C" : "#1ABB9C");
1266
1266
  });
1267
1267
  Stock["hkex_holding_month_flow_chart"] = Util.chart_basic_bar(Stock["hkex_holding_month_flow_chart"], "hkex_holding_month_flow_chart", date_data, flow_data, "增幅", color_data);
1268
- if ($("#hkex_holding_modal_body").length === 0) {
1268
+ if (!document.getElementById("hkex_holding_modal_body")) {
1269
1269
  Stock.fetch_hkex_holding_modal();
1270
1270
  }
1271
1271
  Util.hide_tips();
@@ -1343,7 +1343,7 @@ let Stock = {
1343
1343
  Util.init_public_fund_component("public_fund_modal");
1344
1344
 
1345
1345
  let request_arguments = Util.request_arguments();
1346
- localStorage[Stock.tab_token] = request_arguments["tab"] ? request_arguments["tab"] : "base";
1346
+ localStorage[Stock.tab_token] = request_arguments.tab ? request_arguments.tab : "base";
1347
1347
  Util.tab_switch(Stock.tab_token, Stock.fetch_data);
1348
1348
  Stock.fetch_data();
1349
1349
 
package/summary_daily.js CHANGED
@@ -678,7 +678,7 @@ $(function () {
678
678
  let mam_obj = $('#index_hist_modal');
679
679
  mam_obj.on('shown.bs.modal', function (e) {
680
680
  Util.set_table_loading("index_hist_modal_body_body");
681
- if ($("#index_hist_modal_start_date").length <= 0) {
681
+ if (!document.getElementById("index_hist_modal_start_date")) {
682
682
  Util.init_date_range_picker("index_hist_modal_start_end_date", DailySummary, "render_index_hist_modal");
683
683
  }
684
684
  $("#index_hist_modal_query").click(function () {
package/util.js CHANGED
@@ -294,10 +294,10 @@ const Util = {
294
294
  * jsonpCallback:设置 JSONP 回调函数的名称
295
295
  * @param url
296
296
  * @param payload
297
- * @param callback 回调函数
297
+ * @param callback_func 回调函数
298
298
  * @param data_type json | text
299
299
  */
300
- post: function (url, payload, callback, data_type = "json") {
300
+ post: function (url, payload, callback_func, data_type = "json") {
301
301
  Util.is_load = true;
302
302
  $.ajax({
303
303
  url: url,
@@ -311,7 +311,7 @@ const Util = {
311
311
  dataType: data_type,
312
312
  data: payload,
313
313
  success: function(data) {
314
- callback(data);
314
+ callback_func(data);
315
315
  Util.is_init = 1;
316
316
  Util.is_load = false;
317
317
  },
@@ -663,9 +663,9 @@ const Util = {
663
663
  */
664
664
  rand_stock: function (rand_btn_id, stock_type) {
665
665
  $("#" + rand_btn_id).click(function () {
666
- $(this).attr("disabled", true);
666
+ $(this).prop("disabled", true);
667
667
  Util.post("/action", {action: "rand_stock", stock_type: stock_type}, function (j) {
668
- $("#" + rand_btn_id).attr("disabled", false);
668
+ $("#" + rand_btn_id).prop("disabled", false);
669
669
  if (j.code) {
670
670
  window.open("/stock/" + j.code, "_blank");
671
671
  }
@@ -1094,11 +1094,8 @@ const Util = {
1094
1094
  let html = [];
1095
1095
  html.push('<option value="0">板块</option>');
1096
1096
  classify_data.forEach(function (d) {
1097
- let num = "";
1098
- if (d["num"] > 0) {
1099
- num = "(" + d["num"] + ")";
1100
- }
1101
- html.push('<option value="', d["name"], '">', d["name"], num, '</option>');
1097
+ let num = d.num > 0 ? ("(" + d.num + ")") : "";
1098
+ html.push('<option value="', d.name, '">', d.name, num, '</option>');
1102
1099
  });
1103
1100
  let classify_obj = $("#" + classify_id);
1104
1101
  classify_obj.html(html.join(""));
@@ -1135,7 +1132,7 @@ const Util = {
1135
1132
  */
1136
1133
  fetch_rps_data: function (code, zone_id) {
1137
1134
  Util.show_loading();
1138
- if ($("#rps_table").length <= 0) {
1135
+ if (!document.getElementById("rps_table")) {
1139
1136
  let rps_html = [];
1140
1137
  rps_html.push('<div class="x_panel">');
1141
1138
  rps_html.push('<div class="x_title">');
@@ -1214,7 +1211,7 @@ const Util = {
1214
1211
  }
1215
1212
  });
1216
1213
  }
1217
- if ($("#public_fund_date").length === 0) {
1214
+ if (!document.getElementById("public_fund_date")) {
1218
1215
  let fund_len = j.data ? j.data.length : 0;
1219
1216
  let payload = {
1220
1217
  action: "public_fund_date",
@@ -1343,7 +1340,7 @@ const Util = {
1343
1340
  */
1344
1341
  fetch_public_fund_change: function (code) {
1345
1342
  Util["pfc_stock_chart"] = Util.show_chart_loading(Util["pfc_stock_chart"], "pfc_stock_line_canvas");
1346
- if ($("#pfc_fund_table_body").length === 0) {
1343
+ if (!document.getElementById("pfc_fund_table_body")) {
1347
1344
  Util.init_table_skeleton({
1348
1345
  "element_id": "pfc_fund_table",
1349
1346
  "head_columns": [
@@ -1355,7 +1352,7 @@ const Util = {
1355
1352
  {"name": "持仓市值", "table_sort": 1, "title": "当时股价 * 持股总数"},
1356
1353
  ]
1357
1354
  });
1358
- if ($("#is_fund10_num").length > 0) {
1355
+ if (document.getElementById("is_fund10_num")) {
1359
1356
  $("#is_fund10_num").click(function() {
1360
1357
  Util.fetch_public_fund_change(code);
1361
1358
  });
@@ -1364,7 +1361,7 @@ const Util = {
1364
1361
  Util.post("/stock/" + code, {action: "public_fund_change"}, function (j) {
1365
1362
  Util["pfc_stock_chart"].hideLoading();
1366
1363
  let date_data = [], fund_num_data = [], stock_num_data = [], value_data = [], price_data = [], html = [], is_fund10_num = 0;
1367
- if ($("#is_fund10_num").length > 0) {
1364
+ if (document.getElementById("is_fund10_num")) {
1368
1365
  is_fund10_num = $("#is_fund10_num").prop("checked") ? 1 : 0;
1369
1366
  }
1370
1367
  j.data.forEach(function (item) {
@@ -1491,7 +1488,7 @@ const Util = {
1491
1488
  render_portfolio_html: function () {
1492
1489
  if (Util["portfolio_table_id"]) {
1493
1490
  let html = [], total_num = 0;
1494
- let is_us = $("#portfolio_remark_title").length === 0 ? 1 : 0;
1491
+ let is_us = document.getElementById("portfolio_remark_title") ? 0 : 1;
1495
1492
  if (Util["portfolio_data"]) {
1496
1493
  let industry = $("#portfolio_industry").val();
1497
1494
  let area = $("#portfolio_area").val();
@@ -1550,8 +1547,8 @@ const Util = {
1550
1547
  Util.fetch_public_fund_detail(localStorage["modal_public_fund_code"], component_id);
1551
1548
  } else {
1552
1549
  let request_arguments = Util.request_arguments();
1553
- if (request_arguments["fund_code"]) {
1554
- Util.fetch_public_fund_detail(request_arguments["fund_code"], component_id);
1550
+ if (request_arguments.fund_code) {
1551
+ Util.fetch_public_fund_detail(request_arguments.fund_code, component_id);
1555
1552
  }
1556
1553
  }
1557
1554
  }
@@ -1709,7 +1706,7 @@ const Util = {
1709
1706
  Util.post(location.pathname, {active_div: "word", is_init: is_init, specify_day: specify_day, search_key: search_key}, function (j) {
1710
1707
  let html = [], index = 0;
1711
1708
  let is_mobile = Util.is_mobile();
1712
- let is_speech_synthesis = $("#word_recite").length > 0 ? 1 : 0;
1709
+ let is_speech_synthesis = document.getElementById("word_recite") ? 1 : 0;
1713
1710
  j.data.forEach(function (item) {
1714
1711
  index++;
1715
1712
  html.push("<tr>");
@@ -1869,7 +1866,7 @@ const Util = {
1869
1866
  component_obj.on('shown.bs.modal', function (e) { // 此事件在模态框已经显示出来触发
1870
1867
  let currency = $(e.relatedTarget).attr("data-code");
1871
1868
  Util.set_table_loading(component_id + "_body_body");
1872
- if ($("#currency_modal_start_date").length <= 0) {
1869
+ if (!document.getElementById("currency_modal_start_date")) {
1873
1870
  Util.init_date_range_picker("currency_modal_start_end_date", Util, "render_currency_modal", 60);
1874
1871
  }
1875
1872
  let title_obj = $("#currency_modal_title");
@@ -1961,7 +1958,7 @@ const Util = {
1961
1958
  component_obj.on('shown.bs.modal', function (e) { // 此事件在模态框已经显示出来触发
1962
1959
  Util.set_table_loading(component_id + "_body_body");
1963
1960
  let coin = $(e.relatedTarget).attr("data-coin");
1964
- if ($("#" + component_id + "_start_date").length <= 0) {
1961
+ if (!document.getElementById(component_id + "_start_date")) {
1965
1962
  Util.init_date_range_picker(component_id + "_start_end_date", Util, "render_btc_modal", 60);
1966
1963
  }
1967
1964
  let title_obj = $("#" + component_id + "_title");
@@ -2422,8 +2419,8 @@ const Util = {
2422
2419
  let select_val = $("#" + select_id).val();
2423
2420
  let sd_obj = $('#' + start_id);
2424
2421
  let ed_obj = $('#' + end_id);
2425
- sd_obj.attr("disabled", false);
2426
- ed_obj.attr("disabled", false);
2422
+ sd_obj.prop("disabled", false);
2423
+ ed_obj.prop("disabled", false);
2427
2424
  let weekday = Util.get_weekday();
2428
2425
  let date = new Date();
2429
2426
  let year = date.getFullYear();
@@ -2491,8 +2488,8 @@ const Util = {
2491
2488
  ed_obj.val(Util.seconds_to_format(midnight_second, "%Y-%m-%d"));
2492
2489
  break;
2493
2490
  case "99":
2494
- sd_obj.attr("disabled", true);
2495
- ed_obj.attr("disabled", true);
2491
+ sd_obj.prop("disabled", true);
2492
+ ed_obj.prop("disabled", true);
2496
2493
  break;
2497
2494
  case "100": // 还原
2498
2495
  sd_obj.val(Obj.start_date);
@@ -2910,16 +2907,17 @@ const Util = {
2910
2907
  * @returns {{}}
2911
2908
  */
2912
2909
  request_arguments: function () {
2913
- let url = location.search; //获取url中"?"符后的字串
2914
- let obj = {};
2915
- if (url.includes("?")) {
2916
- let query_array = url.substring(1).split("&");
2917
- for (let i = 0; i < query_array.length; i++) {
2918
- let query = query_array[i].split("=");
2919
- obj[query[0]] = query[1];
2920
- }
2921
- }
2922
- return obj;
2910
+ // let url = location.search; //获取url中"?"符后的字串
2911
+ // let obj = {};
2912
+ // if (url.includes("?")) {
2913
+ // let query_array = url.substring(1).split("&");
2914
+ // for (let i = 0; i < query_array.length; i++) {
2915
+ // let query = query_array[i].split("=");
2916
+ // obj[query[0]] = query[1];
2917
+ // }
2918
+ // }
2919
+ // return obj;
2920
+ return Object.fromEntries(new URLSearchParams(location.search));
2923
2921
  },
2924
2922
 
2925
2923
  sleep: function (ms) {
@@ -3008,7 +3006,7 @@ const Util = {
3008
3006
  * @returns {boolean}
3009
3007
  */
3010
3008
  is_loading: function () {
3011
- return $("#" + Util.load_token).length > 0;
3009
+ return document.getElementById(Util.load_token) !== null;
3012
3010
  },
3013
3011
 
3014
3012
  tooltip: function (element_id, tip) {
@@ -4023,7 +4021,7 @@ const Util = {
4023
4021
 
4024
4022
  init_metrics_statistics: function (metrics, title, callback_func) {
4025
4023
  let metrics_drop_down_id = metrics + "_time_drop_down";
4026
- if ($("#" + metrics_drop_down_id).length === 0) {
4024
+ if (!document.getElementById(metrics_drop_down_id)) {
4027
4025
  let html = [];
4028
4026
  html.push('<div class="x_panel">');
4029
4027
  html.push('<div class="x_title"><div class="form-inline">');
@@ -4237,7 +4235,7 @@ const Util = {
4237
4235
  chart_instance.clear();
4238
4236
  let series_data = [];
4239
4237
  line_data.forEach(function (line) {
4240
- let color = line["color"] ? line["color"] : "#4DC9F6";
4238
+ let color = line.color ? line.color : "#4DC9F6";
4241
4239
  let series = {
4242
4240
  "type": "line",
4243
4241
  "showSymbol": false,
@@ -4250,10 +4248,10 @@ const Util = {
4250
4248
  "color": color
4251
4249
  },
4252
4250
  "markPoint": Util.chart_mark_point,
4253
- "data": line["data"]
4251
+ "data": line.data
4254
4252
  };
4255
- if (line["label"]) {
4256
- series["name"] = line["label"];
4253
+ if (line.label) {
4254
+ series["name"] = line.label;
4257
4255
  }
4258
4256
  series_data.push(series);
4259
4257
  });