sbd-npm 1.5.9 → 1.5.11

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/constant.js CHANGED
@@ -165,8 +165,8 @@ const MenuList = [
165
165
  {'key': 'portfolio_stratagem', 'name': '上兵伐谋zgz', 'url': '/0x622a4a04d7a04e3b28c85a36500371ba28edea83'},
166
166
  {'key': 'portfolio_zeng', 'name': '老曾阿牛', 'url': '/0x2cf53b473b916e1d8b9998de00bb782171bb2630'},
167
167
  {'key': 'portfolio_dao', 'name': '钟达奇', 'url': '/0xf9d3664538c43bf7f886674abe7af9710aab82ec'},
168
+ {'key': 'portfolio_hk_mutual', 'name': '港股通新票', 'url': '/0xa496fad09b737531211cb588399cd5c9cac2f8b5'},
168
169
  {'key': 'portfolio_tianjin', 'name': '天津股侠', 'url': '/0xb8428e42237a7485a787e2ab1b5ae0f057258f18'},
169
- {'key': 'portfolio_junk', 'name': 'HK破烂王', 'url': '/0xfa43c30e5399feb566fb9a8181c175b0af0dff7f'},
170
170
  {'key': 'portfolio_star50', 'name': '科创50', 'url': '/0x378b2601d83c467f81f1d4e323c8bfbc72f6cc0d'},
171
171
  {'key': 'portfolio_bellwether', 'name': '龙头股', 'url': '/0x7cdfb14131c3693c439a90333790eeb5fce70a12'},
172
172
  {'key': 'portfolio_market_situation', 'name': '市值风云', 'url': '/0x3720c6de05378152ef0e758b56199bfcbc15274b'},
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sbd-npm",
3
- "version": "1.5.9",
3
+ "version": "1.5.11",
4
4
  "description": "Stock Big Data",
5
5
  "author": "DHQ <dhq314@gmail.com>",
6
6
  "license": "ISC",
package/status.js CHANGED
@@ -149,7 +149,7 @@ $(function () {
149
149
  if (referer_search && referer_replacement) {
150
150
  item.referer = item.referer.replace(referer_search, referer_replacement);
151
151
  }
152
- html.push("<td title='", item.referer, "'>", Util.pack_html_link("http://" + item.referer, Util.substring(item.referer, 50)), "</td>");
152
+ html.push("<td title='", item.referer, "'>", Util.pack_html_link("http://" + item.referer, Util.truncate(item.referer, 50)), "</td>");
153
153
  html.push("<td>", item.visit, "</td>");
154
154
  if (item.is_block === 1) {
155
155
  html.push("<td>", Util.seconds_to_format(item.time), "</td>");
@@ -314,7 +314,7 @@ $(function () {
314
314
  html.push("<td>", item.status, "</td>");
315
315
  html.push("<td data-val='", item.rss, "'>", Util.trans_byte_size(item.rss), "</td>");
316
316
  html.push("<td data-val='", item.vms, "'>", Util.trans_byte_size(item.vms), "</td>");
317
- html.push("<td title='", item.cmdline, "'>", Util.substring(item.cmdline, 60), "</td>");
317
+ html.push("<td title='", item.cmdline, "'>", Util.truncate(item.cmdline, 60), "</td>");
318
318
  html.push("<td>", Util.seconds_to_format(item.create_time), "</td>");
319
319
  html.push(Status.pack_screen_html(is_screen, item.pid, screen_pid, screen_pid_date, item.cmdline));
320
320
  html.push("</tr>");
@@ -853,7 +853,7 @@ $(function () {
853
853
  html.push("<td>", item.pid, "</td>");
854
854
  html.push("<td>", item.status, "</td>");
855
855
  html.push("<td data-val='", item.rss, "'>", Util.trans_byte_size(item.rss), "</td>");
856
- let cmdline = Util.substring(item.cmdline, 100);
856
+ let cmdline = Util.truncate(item.cmdline, 100);
857
857
  if (is_xmr === 1) {
858
858
  html.push("<td>", Util.pack_html_link("/xmr", cmdline), "</td>");
859
859
  } else {
package/stock_basics.js CHANGED
@@ -868,7 +868,7 @@ let Stock = {
868
868
  j.data.forEach(function (item, index) {
869
869
  html.push("<tr title='", item.title, "'>");
870
870
  html.push("<td>", (index + 1), "</td>");
871
- html.push("<td>", Util.pack_html_link(item.url, Util.substring(item.title, 70)), "</td>");
871
+ html.push("<td>", Util.pack_html_link(item.url, Util.truncate(item.title, 70)), "</td>");
872
872
  html.push("<td>", Util.seconds_to_format(item.date, "%Y-%m-%d"), "</td>");
873
873
  html.push("</tr>");
874
874
  });
@@ -916,7 +916,7 @@ let Stock = {
916
916
  j.data.forEach(function (item, i) {
917
917
  html.push("<tr title='", item.title, "'>");
918
918
  html.push("<td>", i + 1, "</td>");
919
- html.push("<td>", Util.pack_html_link("https://data.eastmoney.com/report/info/" + item.id + ".html", Util.substring(item.title, 70)), "</td>");
919
+ html.push("<td>", Util.pack_html_link("https://data.eastmoney.com/report/info/" + item.id + ".html", Util.truncate(item.title, 70)), "</td>");
920
920
  html.push("<td>", item.organization, "</td>");
921
921
  html.push("<td>", item.analysts, "</td>");
922
922
  html.push("<td>", Util.seconds_to_format(item.ctime, "%Y-%m-%d"), "</td>");
package/summary_daily.js CHANGED
@@ -629,7 +629,7 @@ $(function () {
629
629
  html.push("<tr title='", item.content, "'>");
630
630
  html.push('<td>' + Util.pack_html_link(item.url, item.title.replace(/\\/g, "")) + '</td>');
631
631
  html.push("<td>", Util.seconds_to_format(item.ctime), "</td>");
632
- html.push("<td>", Util.substring(item.content, 40), "</td>");
632
+ html.push("<td>", Util.truncate(item.content, 40), "</td>");
633
633
  html.push("</tr>");
634
634
  });
635
635
  Util.render_table_html("news_modal_body_body", html);
package/util.js CHANGED
@@ -392,7 +392,7 @@ const Util = {
392
392
  url = Util.get_url("query_list") + url
393
393
  }
394
394
  if (industry.length > 6) {
395
- return "<a title='" + industry + "' target='_blank' class='industry_link' href='" + url + "'>" + industry.substring(0, 6) + "</a>";
395
+ return "<a title='" + industry + "' target='_blank' class='industry_link' href='" + url + "'>" + industry.slice(0, 6) + "</a>";
396
396
  }
397
397
  return "<a target='_blank' class='industry_link' href='" + url + "'>" + industry + "</a>";
398
398
  }
@@ -424,7 +424,7 @@ const Util = {
424
424
  name = name.replace("公司", "").replace("•", "").replace("&#8226;", "");
425
425
  }
426
426
  }
427
- name = name.substring(0, 10);
427
+ name = name.slice(0, 10);
428
428
  }
429
429
  html.push("<td>", Util.snowball_url(symbol), "</td>");
430
430
  html.push("<td>", Util.stock_url(item.code, name), "</td>");
@@ -458,9 +458,9 @@ const Util = {
458
458
  return location;
459
459
  }
460
460
  if (location_name === "") {
461
- location_name = location.length > 20 ? location.substring(0, 20) : location;
461
+ location_name = location.length > 20 ? location.slice(0, 20) : location;
462
462
  }
463
- if (Util.is_has_chinese(location) && !/美国|德国|日本|印度|英国|法国|意大利|加拿大|巴西|俄罗斯|墨西哥|澳洲|西班牙|韩国|印尼|土耳其|沙特|荷兰|瑞士|波兰|比利时|阿根廷|瑞典|爱尔兰|新加坡|以色列|阿联酋|泰国|奥地利|挪威|越南|菲律宾|孟加拉|伊朗|丹麦|马来西亚|哥伦比亚|南非|埃及|罗马尼亚|巴基斯坦|捷克|智利|葡萄牙|芬兰|秘鲁|哈萨克|伊拉克|阿尔及利亚|新西兰|希腊|匈牙利|卡塔尔|乌克兰|尼日利亚|科威特|摩洛哥|斯洛伐克|波多黎各|肯尼亚|厄瓜多|多米尼加|乌兹别克斯坦|瓜地马拉|保加利亚|委内瑞拉|古巴|阿曼|斯里兰卡|哥斯达黎加|克罗地亚|卢森堡|安道尔|塞尔维亚|科特迪瓦|巴拿马|立陶宛|加纳|乌拉圭|安哥拉|坦桑尼亚|阿塞拜疆|缅甸|斯洛文尼亚|刚果|土库曼斯坦|乌干达|突尼斯|约旦|喀麦隆|玻利维亚|苏丹|巴林|利比亞|柬埔寨|拉脱维亚|巴拉圭|津巴布韦|尼泊尔|爱沙尼亚|洪都拉斯|塞浦路斯|萨尔瓦多|冰岛|巴布亚新几内亚|塞内加尔|波黑|赞比亚|特多|黎巴嫩|叙利亚|也门|马其顿|老挝|毛里求斯|塔吉克|赤道几内亚|中非/.test(location)) {
463
+ if (Util.is_has_chinese(location) && !/美国|德国|日本|印度|英国|法国|意大利|加拿大|巴西|俄罗斯|墨西哥|澳洲|西班牙|韩国|印尼|土耳其|沙特|荷兰|瑞士|波兰|比利时|阿根廷|瑞典|爱尔兰|新加坡|以色列|阿联酋|泰国|奥地利|挪威|越南|菲律宾|孟加拉|伊朗|丹麦|马来西亚|哥伦比亚|南非|埃及|罗马尼亚|巴基斯坦|捷克|智利|葡萄牙|芬兰|秘鲁|哈萨克|伊拉克|阿尔及利亚|新西兰|希腊|匈牙利|卡塔尔|乌克兰|尼日利亚|科威特|摩洛哥|斯洛伐克|波多黎各|肯尼亚|厄瓜多|多米尼加|乌兹别克斯坦|瓜地马拉|保加利亚|委内瑞拉|古巴|阿曼|斯里兰卡|哥斯达黎加|克罗地亚|卢森堡|安道尔|塞尔维亚|科特迪瓦|巴拿马|立陶宛|加纳|乌拉圭|安哥拉|坦桑尼亚|阿塞拜疆|缅甸|斯洛文尼亚|刚果|土库曼斯坦|乌干达|突尼斯|约旦|喀麦隆|玻利维亚|苏丹|巴林|利比亞|柬埔寨|拉脱维亚|巴拉圭|津巴布韦|尼泊尔|爱沙尼亚|洪都拉斯|塞浦路斯|萨尔瓦多|冰岛|巴布亚新几内亚|塞内加尔|波黑|赞比亚|特多|黎巴嫩|叙利亚|也门|马其顿|老挝|毛里求斯|塔吉克|几内亚|中非|开曼群岛|百慕大/.test(location)) {
464
464
  //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>";
465
465
  return "<a target='_blank' class='link_cls map_link' rel='noopener noreferrer nofollow' href='https://www.amap.com/search?query=" + location + "'>" + location_name + "</a>";
466
466
  }
@@ -481,7 +481,7 @@ const Util = {
481
481
  return location;
482
482
  }
483
483
  if (location_name === "") {
484
- location_name = location.length > 20 ? location.substring(0, 20) : location;
484
+ location_name = location.length > 20 ? location.slice(0, 20) : location;
485
485
  }
486
486
  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>";
487
487
  }
@@ -648,7 +648,7 @@ const Util = {
648
648
  */
649
649
  stock_us_html: function (html, item) {
650
650
  let code = item.code.toUpperCase();
651
- let name = item.cname ? item.cname : (item.name ? item.name.substring(0, 10) : code);
651
+ let name = item.cname ? item.cname : (item.name ? item.name.slice(0, 10) : code);
652
652
  html.push("<td>", Util.snowball_url(code), "</td>");
653
653
  html.push("<td>", Util.stock_url(item.code, name), "</td>");
654
654
  html.push("<td>", (item.sector ? item.sector : "--"), "</td>");
@@ -731,7 +731,7 @@ const Util = {
731
731
  * @returns {string}
732
732
  */
733
733
  code_to_fund_symbol: function(code) {
734
- let prefix = code.substring(0, 1) === "5" ? "SH": "SZ";
734
+ let prefix = code.slice(0, 1) === "5" ? "SH": "SZ";
735
735
  return prefix + code;
736
736
  },
737
737
 
@@ -772,8 +772,7 @@ const Util = {
772
772
  * @returns {boolean}
773
773
  */
774
774
  is_sh: function (code) {
775
- let prefix = code.substring(0, 1);
776
- return prefix === "6";
775
+ return code.slice(0, 1) === "6";
777
776
  },
778
777
 
779
778
  /**
@@ -2119,17 +2118,21 @@ const Util = {
2119
2118
  let modal_id = element_id + "_modal";
2120
2119
  Util.init_modal_skeleton(modal_id);
2121
2120
  $("#" + modal_id + "_title").html("简介");
2122
- let show_profile = Util.substring(profile, 250);
2121
+ let show_profile = Util.truncate(profile, 250);
2123
2122
  show_profile += "&nbsp;&nbsp;&nbsp;<a class='unfold text-info' data-toggle='modal' data-target='." + modal_id + "' href='#'>展开</a>";
2124
2123
  $("#" + element_id).html(show_profile);
2125
2124
  $('#' + modal_id).on('shown.bs.modal', function () {
2126
- let p_array = profile.split("。");
2127
2125
  let html = [];
2128
- p_array.forEach(function (p) {
2129
- if (p.length > 0) {
2130
- html.push("<p>", p.replace(/,/g, ","), "。</p>");
2131
- }
2132
- });
2126
+ if (profile.includes("。")) {
2127
+ let paragraph_array = profile.split("。");
2128
+ paragraph_array.forEach(function (p) {
2129
+ if (p.length > 0) {
2130
+ html.push("<p>", p.replace(/,/g, ","), "。</p>");
2131
+ }
2132
+ });
2133
+ } else {
2134
+ html.push("<p>", profile, "</p>");
2135
+ }
2133
2136
  Util.render_table_html(modal_id + "_body", html);
2134
2137
  });
2135
2138
  } else {
@@ -2895,7 +2898,7 @@ const Util = {
2895
2898
  // let url = location.search; //获取url中"?"符后的字串
2896
2899
  // let obj = {};
2897
2900
  // if (url.includes("?")) {
2898
- // let query_array = url.substring(1).split("&");
2901
+ // let query_array = url.slice(1).split("&");
2899
2902
  // for (let i = 0; i < query_array.length; i++) {
2900
2903
  // let query = query_array[i].split("=");
2901
2904
  // obj[query[0]] = query[1];
@@ -3508,7 +3511,7 @@ const Util = {
3508
3511
  let stock_name = item.name;
3509
3512
  if (price_market_type !== "cn") {
3510
3513
  stock_name = Util.strip_bracket_string(stock_name);
3511
- stock_name = stock_name.substring(0, 6);
3514
+ stock_name = stock_name.slice(0, 6);
3512
3515
  }
3513
3516
  html.push("<td>", Util.stock_url(item.code, stock_name), "</td>");
3514
3517
  html.push("<td>", (item.market_capital ? (item.market_capital + "亿") : "--"), "</td>");
@@ -3755,10 +3758,9 @@ const Util = {
3755
3758
  html.push('<option value="">', obj.children('option').eq(0).text(), '</option>');
3756
3759
  }
3757
3760
  for (const [val, val_num] of Object.entries(option_obj)) {
3758
- html.push('<option value="', val, '">', val.substring(0, 6), '(', val_num, ')</option>');
3761
+ html.push('<option value="', val, '">', val.slice(0, 6), '(', val_num, ')</option>');
3759
3762
  }
3760
- obj.html(html.join(""));
3761
- obj.change(function () {
3763
+ obj.html(html.join("")).change(function () {
3762
3764
  change_func();
3763
3765
  });
3764
3766
  },
@@ -3942,7 +3944,7 @@ const Util = {
3942
3944
  * @param len
3943
3945
  * @returns {*}
3944
3946
  */
3945
- substring: function (str, len) {
3947
+ truncate: function (str, len) {
3946
3948
  if (str.length > len) {
3947
3949
  str = str.slice(0, len) + "...";
3948
3950
  //str = str.substring(0, len) + "...";
@@ -3959,7 +3961,7 @@ const Util = {
3959
3961
  let fold_mark_id = fold_id + "_mark_fold";
3960
3962
  let fold_mark_obj = $("#" + fold_mark_id);
3961
3963
  if (fold_mark_obj.length === 0) {
3962
- let show_text = Util.substring(fold_text, 250);
3964
+ let show_text = Util.truncate(fold_text, 250);
3963
3965
  if (show_text.length < fold_text.length) {
3964
3966
  show_text += "&nbsp;&nbsp;&nbsp;<a id='" + fold_mark_id + "' class='unfold text-info' href='#'>展开</a>";
3965
3967
  $("#" + fold_id).html(show_text);
@@ -3972,7 +3974,7 @@ const Util = {
3972
3974
  let show_text = fold_text;
3973
3975
  let fold_mark = $(this).text();
3974
3976
  if (fold_mark === "收起") {
3975
- show_text = Util.substring(fold_text, 250);
3977
+ show_text = Util.truncate(fold_text, 250);
3976
3978
  }
3977
3979
  fold_mark = fold_mark === "收起" ? "展开" : "收起";
3978
3980
  show_text += "&nbsp;&nbsp;&nbsp;<a id='" + fold_mark_id + "' class='unfold text-info' href='#'>" + fold_mark + "</a>";