sbd-npm 1.2.10 → 1.2.13

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/.npmignore ADDED
@@ -0,0 +1 @@
1
+ sbd-npm.md
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sbd-npm",
3
- "version": "1.2.10",
3
+ "version": "1.2.13",
4
4
  "description": "Stock Big Data",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/sbd.css CHANGED
@@ -61,4 +61,75 @@ table a:hover, a.btn {
61
61
  .modal-xlg {
62
62
  width: 90%;
63
63
  }
64
- }
64
+ }
65
+
66
+ #loading_div {
67
+ position: absolute;
68
+ top: 0;
69
+ left: 0;
70
+ right: 0;
71
+ bottom: 0;
72
+ height: 100px;
73
+ text-align: center;
74
+ margin-top: 300px;
75
+ }
76
+
77
+ #loading_div .circle {
78
+ margin: 20px;
79
+ height: 50px;
80
+ width: 50px;
81
+ border-radius: 50%;
82
+ display: inline-block;
83
+ background-color: #4695B8;
84
+ transform: scale(0);
85
+ animation: bulge 2s infinite ease-in-out;
86
+ }
87
+
88
+ #loading_div .circle::after {
89
+ position: absolute;
90
+ display: inline-block;
91
+ content: '';
92
+ height: 100%;
93
+ width: 100%;
94
+ border-radius: 50%;
95
+ background-color: inherit;
96
+ top: 0;
97
+ left: 0;
98
+ z-index: -1;
99
+ transform: scale(1);
100
+ animation: blow 2s infinite ease-in-out;
101
+ }
102
+
103
+ #loading_div .circle:nth-child(1) {
104
+ animation-delay: 0s;
105
+ }
106
+
107
+ #loading_div .circle:nth-child(2) {
108
+ animation-delay: .25s;
109
+ }
110
+
111
+ #loading_div .circle:nth-child(3) {
112
+ animation-delay: .50s;
113
+ }
114
+
115
+ @keyframes bulge {
116
+ 50% {
117
+ transform: scale(1);
118
+ }
119
+ }
120
+
121
+ @keyframes blow {
122
+ 25% {
123
+ opacity: 0.5;
124
+ }
125
+ 50% {
126
+ opacity: 0.5;
127
+ }
128
+ 90% {
129
+ opacity: 0;
130
+ }
131
+ 100% {
132
+ transform: scale(2);
133
+ opacity: 0;
134
+ }
135
+ }
package/stock_basics.js CHANGED
@@ -35,7 +35,7 @@ let Stock = {
35
35
  if (Stock.data.hasOwnProperty(active_div)) {
36
36
  return false;
37
37
  }
38
- Util.show_tips("Loading...");
38
+ Util.show_loading();
39
39
  switch (active_div) {
40
40
  case "base":
41
41
  Stock.fetch_base();
@@ -274,7 +274,7 @@ let Stock = {
274
274
  },
275
275
 
276
276
  fetch_hist_data: function () {
277
- Util.show_tips("Loading...");
277
+ Util.show_loading();
278
278
  let hist_type = $("#hist_type").val();
279
279
  let payload = {
280
280
  sort_type: Stock.sort_type,
@@ -344,7 +344,7 @@ let Stock = {
344
344
 
345
345
  fetch_big_deal: function () {
346
346
  if ($("#big_deal_table_body").length <= 0) {
347
- Util.show_tips("Loading...");
347
+ Util.show_loading();
348
348
  Util.init_table_skeleton({
349
349
  "element_id": "big_deal_summary_table",
350
350
  "head_cols": [
@@ -429,7 +429,7 @@ let Stock = {
429
429
  },
430
430
 
431
431
  fetch_rps_data: function () {
432
- Util.show_tips("Loading...");
432
+ Util.show_loading();
433
433
  Util.post("/stock/" + Stock.code, {action: "rps"}, function (j) {
434
434
  let _html = [];
435
435
  j["data"].forEach(function (item) {
@@ -460,7 +460,7 @@ let Stock = {
460
460
  },
461
461
 
462
462
  fetch_holder_top: function () {
463
- Util.show_tips("Loading...");
463
+ Util.show_loading();
464
464
  Util.init_table_skeleton({
465
465
  "element_id": "circulation_holder_table",
466
466
  "head_cols": [
@@ -571,7 +571,7 @@ let Stock = {
571
571
  },
572
572
 
573
573
  fetch_finance: function () {
574
- Util.show_tips("Loading...");
574
+ Util.show_loading();
575
575
  Util.init_table_skeleton({
576
576
  "element_id": "cash_flow_table",
577
577
  "head_cols": [
@@ -812,7 +812,7 @@ let Stock = {
812
812
  },
813
813
 
814
814
  fetch_notice: function () {
815
- Util.show_tips("Loading...");
815
+ Util.show_loading();
816
816
  Util.init_table_skeleton({
817
817
  "element_id": "notice_table",
818
818
  "head_cols": [
@@ -859,7 +859,7 @@ let Stock = {
859
859
 
860
860
  // 机构研究报告数据
861
861
  fetch_report_organization: function () {
862
- Util.show_tips("Loading...");
862
+ Util.show_loading();
863
863
  Util.init_table_skeleton({
864
864
  "element_id": "report_organization_table",
865
865
  "head_cols": [
@@ -890,7 +890,7 @@ let Stock = {
890
890
 
891
891
  // 公募持股
892
892
  fetch_public_fund: function () {
893
- Util.show_tips("Loading...");
893
+ Util.show_loading();
894
894
  Util.init_table_skeleton({
895
895
  "element_id": "public_fund_table",
896
896
  "head_cols": [
@@ -1120,7 +1120,7 @@ let Stock = {
1120
1120
  },
1121
1121
 
1122
1122
  fetch_bias_data: function () {
1123
- Util.show_tips("Loading...");
1123
+ Util.show_loading();
1124
1124
  Util.post("/stock/" + Stock["code"], {action: "bias"}, function (j) {
1125
1125
  let date_data = [];
1126
1126
  let bias20_data = [];
@@ -1248,6 +1248,8 @@ let Stock = {
1248
1248
  volume_data.push(item["volume"]);
1249
1249
  price_data.push(item["price"]);
1250
1250
  });
1251
+ let hhs_obj = $("#hkex_holding_summary");
1252
+ let hkex_holding_summary = "[" + Util.pack_html_link(j["url"], hhs_obj.text()) + "]";
1251
1253
  if (!Stock.hkex_holding_chart && j["latest"].length > 0) {
1252
1254
  let circulation_stock = $("#circulation_stock").attr("data-val");
1253
1255
  let latest_html = "";
@@ -1269,14 +1271,10 @@ let Stock = {
1269
1271
  let holding_rate = Math.round((holding_num / circulation_stock) * 10000) / 100;
1270
1272
  latest_html = "最新(" + Util.seconds_to_format(d1["date"], "%Y-%m-%d") + "): " + holding_num + "亿股" + dist_tips + ", 占 <b>" + holding_rate + "%</b> 流通股, ";
1271
1273
  }
1272
- let hhs_obj = $("#hkex_holding_summary");
1273
- let hkex_holding_summary = hhs_obj.text();
1274
- hkex_holding_summary = '[<a target="_blank" rel="noopener noreferrer nofollow" class="link_cls" href="' + j["url"] + '">' +
1275
- hkex_holding_summary + "</a>]" + latest_html + ' 最高: ' + Util.to_unit(j["high"]["volume"]) +
1276
- '股(' + Util.seconds_to_format(j["high"]["date"], "%Y-%m-%d") +
1277
- ') 最低: ' + Util.to_unit(j["low"]["volume"]) + '股(' + Util.seconds_to_format(j["low"]["date"], "%Y-%m-%d") + ')';
1278
- hhs_obj.html(hkex_holding_summary);
1274
+ hkex_holding_summary += (latest_html + ' 最高: ' + Util.to_unit(j["high"]["volume"]) + '股(' + Util.seconds_to_format(j["high"]["date"], "%Y-%m-%d") +
1275
+ ') 最低: ' + Util.to_unit(j["low"]["volume"]) + '股(' + Util.seconds_to_format(j["low"]["date"], "%Y-%m-%d") + ')');
1279
1276
  }
1277
+ hhs_obj.html(hkex_holding_summary);
1280
1278
  Stock["hkex_holding_chart"] = Util.multi_axis_line(Stock["hkex_holding_chart"], "hkex_holding_line_canvas", date_data, '持股数', volume_data, '股价', price_data);
1281
1279
  let flow_data = [];
1282
1280
  date_data = [];
package/summary_daily.js CHANGED
@@ -74,7 +74,7 @@ $(document).ready(function () {
74
74
  return false;
75
75
  }
76
76
  DailySummary.is_load = true;
77
- Util.show_tips("Loading...");
77
+ Util.show_loading();
78
78
  Util.post(location.pathname, {date: $("#trade_date").val(), action: "market_overview"}, function (j) {
79
79
  DailySummary.pack_market_overview(j["market_overview"]);
80
80
  DailySummary.fetch_statistics_daily();
@@ -400,7 +400,7 @@ $(document).ready(function () {
400
400
  * 沪深港股通每日十大成交活跃股数据
401
401
  */
402
402
  fetch_hsgt_ten: function (hsgt_type) {
403
- Util.show_tips("Loading...");
403
+ Util.show_loading();
404
404
  let date = $("#trade_date").val();
405
405
  Util.post(location.pathname, {date: date, action: "hsgt_stock", "hsgt_type": hsgt_type}, function (j) {
406
406
  DailySummary.pack_hsgt_ten(j["data"], "hgt", j["url"]);
@@ -488,7 +488,7 @@ $(document).ready(function () {
488
488
  if (Modal.mo_end_time === 0) {
489
489
  Modal.init_market_overview_time(obj);
490
490
  } else {
491
- Util.show_tips("Loading...");
491
+ Util.show_loading();
492
492
  let data_type = $(obj).attr("id");
493
493
  let payload = {
494
494
  date: $("#trade_date").val(),
@@ -531,7 +531,7 @@ $(document).ready(function () {
531
531
  },
532
532
 
533
533
  render_stock_rate_modal: function (obj) {
534
- Util.show_tips("Loading...");
534
+ Util.show_loading();
535
535
  let cp = $(obj).attr("data-cp");
536
536
  let payload = {date: $("#trade_date").val(), action: "p_change", p_change_type: $("#p_change_type").val()};
537
537
  if (cp) {
@@ -579,7 +579,7 @@ $(document).ready(function () {
579
579
  },
580
580
 
581
581
  render_news_modal: function () {
582
- Util.show_tips("Loading...");
582
+ Util.show_loading();
583
583
  Util.post(location.pathname, {action: "pbc_news"}, function (j) {
584
584
  let _html = [];
585
585
  let index = 0;
@@ -671,7 +671,7 @@ $(document).ready(function () {
671
671
  });
672
672
 
673
673
  $("#news_type").change(function () {
674
- Util.show_tips("Loading...");
674
+ Util.show_loading();
675
675
  let news_type = parseInt($("#news_type").val());
676
676
  let payload = {action: "news", limit_num: DailySummary.limit_num(), news_type: news_type};
677
677
  Util.post(location.pathname, payload, function (j) {
package/util.js CHANGED
@@ -22,6 +22,7 @@
22
22
  const Util = {
23
23
 
24
24
  tips_token: "util-tips-div",
25
+ load_token: "loading_div",
25
26
  interval_timer: null,
26
27
  stock_timer_id: 0,
27
28
  // 1年的天数
@@ -46,7 +47,7 @@ const Util = {
46
47
  },
47
48
 
48
49
  sbd_init: function () {
49
- Util.show_tips("Loading...");
50
+ Util.show_loading();
50
51
 
51
52
  Util.init_menu();
52
53
 
@@ -88,7 +89,7 @@ const Util = {
88
89
  clearTimeout(Util.stock_timer_id);
89
90
  st_obj.css("display", "none");
90
91
  Util.stock_timer_id = setTimeout(function () {
91
- Util.show_tips("Loading...");
92
+ Util.show_loading();
92
93
  Util.post("/action", {action: "search", key_word: key_word}, function (j) {
93
94
  let key_word = $("#stock").val();
94
95
  if (key_word) {
@@ -252,7 +253,7 @@ const Util = {
252
253
  let name = item["cname"] ? item["cname"] : (item["name"] ? item["name"].substr(0, 10) : symbol);
253
254
  html.push("<td>", Util.snowball_url(symbol), "</td>");
254
255
  html.push("<td>", Util.stock_url(item["code"], name), "</td>");
255
- html.push("<td>", (item["pe_ttm"] ? item["pe_ttm"] : item["pe"]), "</td>");
256
+ html.push("<td>", Util.to_float((item["pe_ttm"] ? item["pe_ttm"] : item["pe"]), 2), "</td>");
256
257
  html.push("<td>", (item["market_capital"] ? (Util.to_float(item["market_capital"], 2) + "亿") : "--"), "</td>");
257
258
  html.push("<td>", Util.industry_url(item["code"], item["industry"]), "</td>");
258
259
  html.push("<td>", Util.map_url((item["province_city"] && item["province_city"] !== "None") ? item["province_city"] : item["area"]), "</td>");
@@ -444,7 +445,7 @@ const Util = {
444
445
  html.push("<td>", Util.stock_url(item["code"], name), "</td>");
445
446
  html.push("<td class='hk_industry'>", item["industry"], "</td>");
446
447
  html.push("<td>", Util.map_url(item["province_city"]), "</td>");
447
- html.push("<td>", item["pe"], "</td>");
448
+ html.push("<td>", Util.to_float((item["pe_ttm"] ? item["pe_ttm"] : item["pe"]), 2), "</td>");
448
449
  html.push("<td>", Util.to_float(item["total_shares"], 2), "亿</td>");
449
450
  html.push("<td>", market_capital_hkd, "亿(", market_capital_cny, "亿)</td>");
450
451
  html.push("<td>", item["chairman"], "</td>");
@@ -469,7 +470,7 @@ const Util = {
469
470
  html.push("<td>", (item["sector"] ? item["sector"] : "--"), "</td>");
470
471
  html.push("<td>", Util.industry_url(item["code"], item["industry"]), "</td>");
471
472
  html.push("<td>", Util.map_url(item["registered"]), "</td>");
472
- html.push("<td>", item["pe"], "</td>");
473
+ html.push("<td>", Util.to_float((item["pe_ttm"] ? item["pe_ttm"] : item["pe"]), 2), "</td>");
473
474
  html.push("<td>", Util.to_float(item["total_shares"], 2), "亿</td>");
474
475
  html.push("<td>", Util.to_float(item["market_capital"], 3), "亿</td>");
475
476
  html.push("<td class='price_", item["code"].toLowerCase(), "'>", item["price"], "</td>");
@@ -837,7 +838,7 @@ const Util = {
837
838
  * @param alert_tips
838
839
  */
839
840
  init_stock_category_data: function (stock_category, table_id, alert_tips = "") {
840
- Util.show_tips("Loading...");
841
+ Util.show_loading();
841
842
  let head_cols = [
842
843
  {"name": "代码"},
843
844
  {"name": "名称"},
@@ -1008,7 +1009,7 @@ const Util = {
1008
1009
  * @param component_id
1009
1010
  */
1010
1011
  fetch_public_fund_stock: function (fund_code, date, component_id) {
1011
- Util.show_tips("Loading...");
1012
+ Util.show_loading();
1012
1013
  let component_tr = component_id + "_tr";
1013
1014
  $("." + component_tr).each(function () {
1014
1015
  $(this).remove();
@@ -1110,7 +1111,7 @@ const Util = {
1110
1111
  if (!currency) {
1111
1112
  return false;
1112
1113
  }
1113
- Util.show_tips("Loading...");
1114
+ Util.show_loading();
1114
1115
  let payload = {
1115
1116
  currency: currency,
1116
1117
  start_date: $("#currency_modal_start_date").val(),
@@ -1212,7 +1213,7 @@ const Util = {
1212
1213
  * @param element_id
1213
1214
  * @param profile
1214
1215
  */
1215
- init_profile_component: function(element_id, profile) {
1216
+ init_profile_component: function (element_id, profile) {
1216
1217
  if (profile && profile.length > 0) {
1217
1218
  let modal_id = element_id + "_modal";
1218
1219
  Util.init_modal_skeleton(modal_id);
@@ -1932,9 +1933,23 @@ const Util = {
1932
1933
  },
1933
1934
 
1934
1935
  hide_tips: function () {
1935
- let obj = $('#' + Util.tips_token);
1936
- if (obj.length) {
1937
- obj.remove();
1936
+ let tips_obj = $('#' + Util.tips_token);
1937
+ if (tips_obj.length) {
1938
+ tips_obj.remove();
1939
+ }
1940
+ let load_obj = $('#' + Util.load_token);
1941
+ if (load_obj.length) {
1942
+ load_obj.remove();
1943
+ }
1944
+ },
1945
+
1946
+ show_loading: function () {
1947
+ let load_obj = document.getElementById(Util.load_token);
1948
+ if (!load_obj) {
1949
+ let load_obj = document.createElement('div');
1950
+ load_obj.id = Util.load_token;
1951
+ load_obj.innerHTML = '<div class="circle"></div><div class="circle"></div><div class="circle"></div>';
1952
+ document.getElementsByTagName('body')[0].appendChild(load_obj);
1938
1953
  }
1939
1954
  },
1940
1955
 
@@ -1943,7 +1958,7 @@ const Util = {
1943
1958
  * @returns {boolean}
1944
1959
  */
1945
1960
  is_loading: function () {
1946
- return $("#" + Util.tips_token).length > 0;
1961
+ return $("#" + Util.load_token).length > 0;
1947
1962
  },
1948
1963
 
1949
1964
  tooltip: function (element_id, tip) {
@@ -1971,7 +1986,7 @@ const Util = {
1971
1986
  init_stock_stuff: function (element_id, index_list, is_us = 0, is_refresh = 1) {
1972
1987
  let code_list = Util.get_code_list(element_id);
1973
1988
  if (code_list.length > 0) {
1974
- Util.show_tips("Loading...");
1989
+ Util.show_loading();
1975
1990
  //获取股票详情数据
1976
1991
  Util.post("/action", {action: "code_detail", code_list: code_list.join("-")}, function (j) {
1977
1992
  let valid_code_list = [];
@@ -2285,7 +2300,7 @@ const Util = {
2285
2300
  * @param item
2286
2301
  * @returns {string}
2287
2302
  */
2288
- pack_snowball_follower: function(item) {
2303
+ pack_snowball_follower: function (item) {
2289
2304
  if (item["snowball_follower"] && item["snowball_follower"] > 0) {
2290
2305
  let snowball_follower_rank = Util.to_unit(item["snowball_follower"]) + "(" + item["snowball_follower_rank"] + ")";
2291
2306
  let market_type = Util.is_hk(item["code"]) ? "hk" : "cn";
@@ -2839,7 +2854,7 @@ const Util = {
2839
2854
  * @returns {*|jQuery|void}
2840
2855
  */
2841
2856
  show_chart_loading: function (chart_instance, element_id) {
2842
- Util.show_tips("Loading...");
2857
+ Util.show_loading();
2843
2858
  if (!chart_instance) {
2844
2859
  chart_instance = Util.init_chart_instance(element_id);
2845
2860
  }
@@ -3422,4 +3437,3 @@ Object.size = function (obj) {
3422
3437
  console.log(Notification.permission);
3423
3438
  break;
3424
3439
  }*/
3425
-