sbd-npm 1.4.16 → 1.4.18

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.16",
3
+ "version": "1.4.18",
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
 
@@ -1135,19 +1135,28 @@ const Util = {
1135
1135
  {"name": ""},
1136
1136
  ]
1137
1137
  });
1138
- Util.post("/stock/" + code, {action: "public_fund", public_fund_date: $("#public_fund_date").val()}, function (j) {
1138
+ let payload = {
1139
+ action: "public_fund",
1140
+ public_fund_date: $("#public_fund_date").val(),
1141
+ is_fund_rank10: $("#is_fund_rank10").prop("checked") ? 1 : 0
1142
+ };
1143
+ Util.post("/stock/" + code, payload, function (j) {
1139
1144
  Util.render_public_fund(j);
1140
1145
  if (j["date"] && j["date"] > 0) {
1141
1146
  $("#public_fund_title").find("a").each(function() {
1142
1147
  let t_text = $(this).text();
1143
- if (t_text.indexOf("持股详细查询") > -1) {
1148
+ if (t_text.indexOf("基金明细") > -1) {
1144
1149
  $(this).attr("href", "https://data.eastmoney.com/zlsj/detail/" + Util.seconds_to_format(j["date"], "%Y-%m-%d") + "-1-" + code + ".html");
1145
1150
  }
1146
1151
  });
1147
1152
  }
1148
1153
  if ($("#public_fund_date").length === 0) {
1149
1154
  let fund_len = j["data"] ? j["data"].length : 0;
1150
- Util.post("/stock/" + code, {action: "public_fund_date"}, function (j) {
1155
+ let payload = {
1156
+ action: "public_fund_date",
1157
+ is_fund_rank10: $("#is_fund_rank10").prop("checked") ? 1 : 0
1158
+ };
1159
+ Util.post("/stock/" + code, payload, function (j) {
1151
1160
  let html = [], date_len = 0;
1152
1161
  html.push('<select id="public_fund_date">');
1153
1162
  j["data"].forEach(function (item) {
@@ -1160,6 +1169,12 @@ const Util = {
1160
1169
  $("#public_fund_date").change(function () {
1161
1170
  Util.fetch_public_fund(code);
1162
1171
  });
1172
+ $("[data-toggle='tooltip']").tooltip();
1173
+ $("#is_fund_rank10").click(function () {
1174
+ $("#public_fund_date").remove();
1175
+ $("#public_fund_tips").html("Loading...");
1176
+ Util.fetch_public_fund(code);
1177
+ });
1163
1178
  if (fund_len === 0 && date_len > 0) {
1164
1179
  Util.fetch_public_fund(code);
1165
1180
  }
@@ -1950,7 +1965,7 @@ const Util = {
1950
1965
  let modal_id = element_id + "_modal";
1951
1966
  Util.init_modal_skeleton(modal_id);
1952
1967
  $("#" + modal_id + "_title").html("简介");
1953
- let show_profile = Util.sub_str(profile, 250);
1968
+ let show_profile = Util.substring(profile, 250);
1954
1969
  show_profile += "&nbsp;&nbsp;&nbsp;<a class='unfold text-info' data-toggle='modal' data-target='." + modal_id + "' href='#'>展开</a>";
1955
1970
  $("#" + element_id).html(show_profile);
1956
1971
  $('#' + modal_id).on('shown.bs.modal', function () {
@@ -2754,7 +2769,7 @@ const Util = {
2754
2769
  let url = location.search; //获取url中"?"符后的字串
2755
2770
  let obj = {};
2756
2771
  if (url.indexOf("?") !== -1) {
2757
- let query_arr = url.substr(1).split("&");
2772
+ let query_arr = url.substring(1).split("&");
2758
2773
  for (let i = 0; i < query_arr.length; i++) {
2759
2774
  let query = query_arr[i].split("=");
2760
2775
  obj[query[0]] = query[1];
@@ -3370,7 +3385,7 @@ const Util = {
3370
3385
  let stock_name = item["name"];
3371
3386
  if (price_market_type !== "cn") {
3372
3387
  stock_name = Util.strip_bracket_string(stock_name);
3373
- stock_name = stock_name.substr(0, 6);
3388
+ stock_name = stock_name.substring(0, 6);
3374
3389
  }
3375
3390
  _html.push("<td>", Util.stock_url(item["code"], stock_name), "</td>");
3376
3391
  _html.push("<td>", (item["market_capital"] ? (item["market_capital"] + "亿") : "--"), "</td>");
@@ -3600,7 +3615,7 @@ const Util = {
3600
3615
  html.push('<option value="">', obj.children('option').eq(0).text(), '</option>');
3601
3616
  }
3602
3617
  $.each(option_data, function (val, val_num) {
3603
- html.push('<option value="', val, '">', val.substr(0, 6), '(', val_num, ')</option>');
3618
+ html.push('<option value="', val, '">', val.substring(0, 6), '(', val_num, ')</option>');
3604
3619
  });
3605
3620
  obj.html(html.join(""));
3606
3621
  obj.change(function () {
@@ -3795,14 +3810,17 @@ const Util = {
3795
3810
  },
3796
3811
 
3797
3812
  /**
3798
- * 字符串按长度截断
3813
+ * 字符串按长度截断( substr 方法已被标记为过时(deprecated),建议使用 substring() 或者字符串切片语法(str.slice())来代替)
3814
+ * substring(start, end) 接受两个参数,分别是起始位置和结束位置;substring() 方法会将负数参数视为 0。
3815
+ * slice(start, end) 也接受两个参数,但是同样是起始位置和结束位置,其中结束位置可以为负数,表示从末尾开始计算;slice() 方法会将负数参数视为从末尾开始的索引。
3799
3816
  * @param str
3800
3817
  * @param len
3801
3818
  * @returns {*}
3802
3819
  */
3803
- sub_str: function (str, len) {
3820
+ substring: function (str, len) {
3804
3821
  if (str.length > len) {
3805
- str = str.substr(0, len) + "...";
3822
+ str = str.slice(0, len) + "...";
3823
+ //str = str.substring(0, len) + "...";
3806
3824
  }
3807
3825
  return str
3808
3826
  },
@@ -3816,7 +3834,7 @@ const Util = {
3816
3834
  let fold_mark_id = fold_id + "_mark_fold";
3817
3835
  let fold_mark_obj = $("#" + fold_mark_id);
3818
3836
  if (fold_mark_obj.length === 0) {
3819
- let show_text = Util.sub_str(fold_text, 250);
3837
+ let show_text = Util.substring(fold_text, 250);
3820
3838
  if (show_text.length < fold_text.length) {
3821
3839
  show_text += "&nbsp;&nbsp;&nbsp;<a id='" + fold_mark_id + "' class='unfold text-info' href='#'>展开</a>";
3822
3840
  $("#" + fold_id).html(show_text);
@@ -3829,7 +3847,7 @@ const Util = {
3829
3847
  let show_text = fold_text;
3830
3848
  let fold_mark = $(this).text();
3831
3849
  if (fold_mark === "收起") {
3832
- show_text = Util.sub_str(fold_text, 250);
3850
+ show_text = Util.substring(fold_text, 250);
3833
3851
  }
3834
3852
  fold_mark = fold_mark === "收起" ? "展开" : "收起";
3835
3853
  show_text += "&nbsp;&nbsp;&nbsp;<a id='" + fold_mark_id + "' class='unfold text-info' href='#'>" + fold_mark + "</a>";