sbd-npm 1.4.15 → 1.4.17

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.15",
3
+ "version": "1.4.17",
4
4
  "description": "Stock Big Data",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/status.js CHANGED
@@ -142,7 +142,7 @@ $(function () {
142
142
  if (referer_search && referer_replacement) {
143
143
  item["referer"] = item["referer"].replace(referer_search, referer_replacement);
144
144
  }
145
- _html.push("<td title='", item["referer"], "'>", Util.pack_html_link("http://" + item["referer"], Util.sub_str(item["referer"], 50)), "</td>");
145
+ _html.push("<td title='", item["referer"], "'>", Util.pack_html_link("http://" + item["referer"], Util.substring(item["referer"], 50)), "</td>");
146
146
  _html.push("<td>", item["visit"], "</td>");
147
147
  _html.push("<td>", Util.seconds_to_format(item["time"]), "</td>");
148
148
  _html.push("</tr>");
@@ -205,7 +205,7 @@ $(function () {
205
205
  html.push("<td>", item["status"], "</td>");
206
206
  html.push("<td data-val='", item["rss"], "'>", Util.trans_byte_size(item["rss"]), "</td>");
207
207
  html.push("<td data-val='", item["vms"], "'>", Util.trans_byte_size(item["vms"]), "</td>");
208
- html.push("<td title='", item["cmdline"], "'>", Util.sub_str(item["cmdline"], 60), "</td>");
208
+ html.push("<td title='", item["cmdline"], "'>", Util.substring(item["cmdline"], 60), "</td>");
209
209
  html.push("<td>", Util.seconds_to_format(item["create_time"]), "</td>");
210
210
  html.push("</tr>");
211
211
  });
@@ -581,10 +581,19 @@ $(function () {
581
581
  let html = [], process_num = 0;
582
582
  j["process"].forEach(function (item) {
583
583
  process_num++;
584
- html.push("<tr>");
584
+ if (item["cmdline"].includes("zotonic")) {
585
+ html.push("<tr class='info'>");
586
+ } else {
587
+ html.push("<tr>");
588
+ }
585
589
  html.push("<td>", item["pid"], "</td>");
586
590
  html.push("<td>", item["status"], "</td>");
587
- html.push("<td title='", item["cmdline"], "'>", Util.sub_str(item["cmdline"], 100), "</td>");
591
+ let cmdline = Util.substring(item["cmdline"], 100);
592
+ if (item["cmdline"].includes("zotonic")) {
593
+ html.push("<td>", Util.pack_html_link("/xmr", cmdline), "</td>");
594
+ } else {
595
+ html.push("<td title='", item["cmdline"], "'>", cmdline, "</td>");
596
+ }
588
597
  html.push("<td>", Util.seconds_to_format(item["create_time"]), "</td>");
589
598
  html.push("</tr>");
590
599
  });
package/stock_basics.js CHANGED
@@ -854,7 +854,7 @@ let Stock = {
854
854
  j["data"].forEach(function (item, index) {
855
855
  _html.push("<tr title='", item["title"], "'>");
856
856
  _html.push("<td>", (index + 1), "</td>");
857
- _html.push("<td>", Util.pack_html_link(item["url"], Util.sub_str(item["title"], 70)), "</td>");
857
+ _html.push("<td>", Util.pack_html_link(item["url"], Util.substring(item["title"], 70)), "</td>");
858
858
  _html.push("<td>", Util.seconds_to_format(item["date"], "%Y-%m-%d"), "</td>");
859
859
  _html.push("</tr>");
860
860
  });
@@ -902,7 +902,7 @@ let Stock = {
902
902
  j["data"].forEach(function (item, i) {
903
903
  _html.push("<tr title='", item["title"], "'>");
904
904
  _html.push("<td>", i + 1, "</td>");
905
- _html.push("<td>", Util.pack_html_link("https://data.eastmoney.com/report/info/" + item["id"] + ".html", Util.sub_str(item["title"], 70)), "</td>");
905
+ _html.push("<td>", Util.pack_html_link("https://data.eastmoney.com/report/info/" + item["id"] + ".html", Util.substring(item["title"], 70)), "</td>");
906
906
  _html.push("<td>", item["organization"], "</td>");
907
907
  _html.push("<td>", item["analysts"], "</td>");
908
908
  _html.push("<td>", Util.seconds_to_format(item["ctime"], "%Y-%m-%d"), "</td>");
package/summary_daily.js CHANGED
@@ -652,7 +652,7 @@ $(function () {
652
652
  _html.push("<tr title='", item["content"], "'>");
653
653
  _html.push('<td>' + Util.pack_html_link(item["url"], item["title"].replace(/\\/g, "")) + '</td>');
654
654
  _html.push("<td>", Util.seconds_to_format(item["ctime"]), "</td>");
655
- _html.push("<td>", Util.sub_str(item["content"], 40), "</td>");
655
+ _html.push("<td>", Util.substring(item["content"], 40), "</td>");
656
656
  _html.push("</tr>");
657
657
  });
658
658
  Util.render_table_html("news_modal_body_body", _html);
package/util.js CHANGED
@@ -344,7 +344,7 @@ const Util = {
344
344
  url = Util.get_url("query_list") + url
345
345
  }
346
346
  if (industry.length > 6) {
347
- return "<a title='" + industry + "' target='_blank' class='industry_link' href='" + url + "'>" + industry.substr(0, 6) + "</a>";
347
+ return "<a title='" + industry + "' target='_blank' class='industry_link' href='" + url + "'>" + industry.substring(0, 6) + "</a>";
348
348
  }
349
349
  return "<a target='_blank' class='industry_link' href='" + url + "'>" + industry + "</a>";
350
350
  }
@@ -376,7 +376,7 @@ const Util = {
376
376
  name = name.replace("公司", "").replace("•", "").replace("&#8226;", "");
377
377
  }
378
378
  }
379
- name = name.substr(0, 10);
379
+ name = name.substring(0, 10);
380
380
  }
381
381
  html.push("<td>", Util.snowball_url(symbol), "</td>");
382
382
  html.push("<td>", Util.stock_url(item["code"], name), "</td>");
@@ -410,7 +410,7 @@ const Util = {
410
410
  return location;
411
411
  }
412
412
  if (location_name === "") {
413
- location_name = location.length > 20 ? location.substr(0, 20) : location;
413
+ location_name = location.length > 20 ? location.substring(0, 20) : location;
414
414
  }
415
415
  //return "<a target='_blank' class='link_cls map_link' rel='noopener noreferrer nofollow' href='https://map.baidu.com/m?fr=ps01000&word=" + location + "'>" + location_name + "</a>";
416
416
  return "<a target='_blank' class='link_cls map_link' rel='noopener noreferrer nofollow' href='https://www.amap.com/search?query=" + location + "'>" + location_name + "</a>";
@@ -430,7 +430,7 @@ const Util = {
430
430
  return location;
431
431
  }
432
432
  if (location_name === "") {
433
- location_name = location.length > 20 ? location.substr(0, 20) : location;
433
+ location_name = location.length > 20 ? location.substring(0, 20) : location;
434
434
  }
435
435
  return "<a target='_blank' class='link_cls map_link' rel='noopener noreferrer nofollow' href='https://www.google.com/maps?&hl=zh-Hans&q=" + location + "'>" + location_name + "</a>";
436
436
  }
@@ -597,7 +597,7 @@ const Util = {
597
597
  */
598
598
  stock_us_html: function (html, item) {
599
599
  let code = item["code"].toUpperCase();
600
- let name = item["cname"] ? item["cname"] : (item["name"] ? item["name"].substr(0, 10) : code);
600
+ let name = item["cname"] ? item["cname"] : (item["name"] ? item["name"].substring(0, 10) : code);
601
601
  html.push("<td>", Util.snowball_url(code), "</td>");
602
602
  html.push("<td>", Util.stock_url(item["code"], name), "</td>");
603
603
  html.push("<td>", (item["sector"] ? item["sector"] : "--"), "</td>");
@@ -684,7 +684,7 @@ const Util = {
684
684
  * @returns {string}
685
685
  */
686
686
  code_to_fund_symbol: function(code) {
687
- let prefix = code.substr(0, 1) === "5" ? "SH": "SZ";
687
+ let prefix = code.substring(0, 1) === "5" ? "SH": "SZ";
688
688
  return prefix + code;
689
689
  },
690
690
 
@@ -725,7 +725,7 @@ const Util = {
725
725
  * @returns {boolean}
726
726
  */
727
727
  is_sh: function (code) {
728
- let prefix = code.substr(0, 1);
728
+ let prefix = code.substring(0, 1);
729
729
  return prefix === "6";
730
730
  },
731
731
 
@@ -1950,7 +1950,7 @@ const Util = {
1950
1950
  let modal_id = element_id + "_modal";
1951
1951
  Util.init_modal_skeleton(modal_id);
1952
1952
  $("#" + modal_id + "_title").html("简介");
1953
- let show_profile = Util.sub_str(profile, 250);
1953
+ let show_profile = Util.substring(profile, 250);
1954
1954
  show_profile += "&nbsp;&nbsp;&nbsp;<a class='unfold text-info' data-toggle='modal' data-target='." + modal_id + "' href='#'>展开</a>";
1955
1955
  $("#" + element_id).html(show_profile);
1956
1956
  $('#' + modal_id).on('shown.bs.modal', function () {
@@ -2754,7 +2754,7 @@ const Util = {
2754
2754
  let url = location.search; //获取url中"?"符后的字串
2755
2755
  let obj = {};
2756
2756
  if (url.indexOf("?") !== -1) {
2757
- let query_arr = url.substr(1).split("&");
2757
+ let query_arr = url.substring(1).split("&");
2758
2758
  for (let i = 0; i < query_arr.length; i++) {
2759
2759
  let query = query_arr[i].split("=");
2760
2760
  obj[query[0]] = query[1];
@@ -3199,7 +3199,7 @@ const Util = {
3199
3199
  */
3200
3200
  pack_html_link: function (url, title) {
3201
3201
  if (url) {
3202
- if (!url.startsWith("http")) {
3202
+ if (!url.startsWith("http") && !url.startsWith("/")) {
3203
3203
  url = "http://" + url;
3204
3204
  }
3205
3205
  return "<a target='_blank' class='link_cls' rel='noopener noreferrer nofollow' href='" + url + "'>" + title + "</a>";
@@ -3370,7 +3370,7 @@ const Util = {
3370
3370
  let stock_name = item["name"];
3371
3371
  if (price_market_type !== "cn") {
3372
3372
  stock_name = Util.strip_bracket_string(stock_name);
3373
- stock_name = stock_name.substr(0, 6);
3373
+ stock_name = stock_name.substring(0, 6);
3374
3374
  }
3375
3375
  _html.push("<td>", Util.stock_url(item["code"], stock_name), "</td>");
3376
3376
  _html.push("<td>", (item["market_capital"] ? (item["market_capital"] + "亿") : "--"), "</td>");
@@ -3600,7 +3600,7 @@ const Util = {
3600
3600
  html.push('<option value="">', obj.children('option').eq(0).text(), '</option>');
3601
3601
  }
3602
3602
  $.each(option_data, function (val, val_num) {
3603
- html.push('<option value="', val, '">', val.substr(0, 6), '(', val_num, ')</option>');
3603
+ html.push('<option value="', val, '">', val.substring(0, 6), '(', val_num, ')</option>');
3604
3604
  });
3605
3605
  obj.html(html.join(""));
3606
3606
  obj.change(function () {
@@ -3795,14 +3795,15 @@ const Util = {
3795
3795
  },
3796
3796
 
3797
3797
  /**
3798
- * 字符串按长度截断
3798
+ * 字符串按长度截断( substr 方法已被标记为过时(deprecated),建议使用 substring() 或者字符串切片语法(str.slice())来代替)
3799
3799
  * @param str
3800
3800
  * @param len
3801
3801
  * @returns {*}
3802
3802
  */
3803
- sub_str: function (str, len) {
3803
+ substring: function (str, len) {
3804
3804
  if (str.length > len) {
3805
- str = str.substr(0, len) + "...";
3805
+ //str = str.slice(0, len) + "...";
3806
+ str = str.substring(0, len) + "...";
3806
3807
  }
3807
3808
  return str
3808
3809
  },
@@ -3816,7 +3817,7 @@ const Util = {
3816
3817
  let fold_mark_id = fold_id + "_mark_fold";
3817
3818
  let fold_mark_obj = $("#" + fold_mark_id);
3818
3819
  if (fold_mark_obj.length === 0) {
3819
- let show_text = Util.sub_str(fold_text, 250);
3820
+ let show_text = Util.substring(fold_text, 250);
3820
3821
  if (show_text.length < fold_text.length) {
3821
3822
  show_text += "&nbsp;&nbsp;&nbsp;<a id='" + fold_mark_id + "' class='unfold text-info' href='#'>展开</a>";
3822
3823
  $("#" + fold_id).html(show_text);
@@ -3829,7 +3830,7 @@ const Util = {
3829
3830
  let show_text = fold_text;
3830
3831
  let fold_mark = $(this).text();
3831
3832
  if (fold_mark === "收起") {
3832
- show_text = Util.sub_str(fold_text, 250);
3833
+ show_text = Util.substring(fold_text, 250);
3833
3834
  }
3834
3835
  fold_mark = fold_mark === "收起" ? "展开" : "收起";
3835
3836
  show_text += "&nbsp;&nbsp;&nbsp;<a id='" + fold_mark_id + "' class='unfold text-info' href='#'>" + fold_mark + "</a>";