sbd-npm 1.1.3 → 1.1.7

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.1.3",
3
+ "version": "1.1.7",
4
4
  "description": "Stock Big Data",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/summary_daily.js CHANGED
@@ -105,7 +105,10 @@ $(document).ready(function () {
105
105
  * @param pr
106
106
  */
107
107
  pack_change_percent: function (pr) {
108
- let total_rate = pr["r10_7"] + pr["r7_5"] + pr["r5_3"] + pr["r3_0"] + pr["r0_3"] + pr["r3_5"] + pr["r5_7"] + pr["r7_10"];
108
+ let pr_array = [pr["r10_7"], pr["r7_5"], pr["r5_3"], pr["r3_0"], pr["r0_3"], pr["r3_5"], pr["r5_7"], pr["r7_10"]];
109
+ pr_array.sort(function(pr1, pr2){return pr2 - pr1});
110
+ //pr_array = pr_array.slice(0, 3);
111
+ let total_rate = pr_array[0] + pr_array[1];
109
112
  let _pack_stock_rate = function (rate_range, rate, bg_color) {
110
113
  let rate_width = Math.round((rate / total_rate) * 100);
111
114
  rate_width = rate_width > 0 ? rate_width : 1;
@@ -131,7 +134,9 @@ $(document).ready(function () {
131
134
  stock_rate_html.push(_pack_stock_rate("-7% ~ -5%", pr["r7_5"], "bg-green"));
132
135
  stock_rate_html.push(_pack_stock_rate("-10% ~ -7%", pr["r10_7"], "bg-green"));
133
136
  $("#stock_rate_bar").html(stock_rate_html.join(""));
137
+ $("#rate_up").html(pr["r0_3"] + pr["r3_5"] + pr["r5_7"] + pr["r7_10"]);
134
138
  $("#rate_up_limit").html(pr["r10"]);
139
+ $("#rate_down").html(pr["r10_7"] + pr["r7_5"] + pr["r5_3"] + pr["r3_0"]);
135
140
  $("#rate_down_limit").html(pr["r_10"]);
136
141
  },
137
142
 
package/util.js CHANGED
@@ -209,15 +209,14 @@ let Util = {
209
209
  * @returns {string}
210
210
  */
211
211
  map_url: function (location, location_name = "") {
212
- if (location === "--") {
213
- return location;
214
- } else if (location) {
215
- location_name = location_name === "" ? location : location_name;
216
- if (location_name.length > 8) {
217
- return "<a title='" + location + "' target='_blank' class='link_cls map_link' rel='noopener noreferrer nofollow' href='https://map.baidu.com/m?fr=ps01000&word=" + location + "'>" + location_name.substr(0, 8) + "</a>";
218
- } else {
219
- 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>";
212
+ if (location) {
213
+ if (location === "--") {
214
+ return location;
215
+ }
216
+ if (location_name === "") {
217
+ location_name = location.length > 8 ? location.substr(0, 8) : location;
220
218
  }
219
+ 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>";
221
220
  }
222
221
  return "--";
223
222
  },
@@ -285,11 +284,20 @@ let Util = {
285
284
  $(this).html(price);
286
285
  });
287
286
  $(".year_price_" + code).each(function () {
288
- let year_price = $(this).attr("data-val");
289
- if (year_price) {
290
- $(this).html(Util.year_price_rate(item["price"], Util.to_float(year_price)));
287
+ if (item["year_price"]) {
288
+ $(this).html(Util.year_price_rate(item["price"], item["year_price"]));
289
+ } else {
290
+ let year_price = $(this).attr("data-val");
291
+ if (year_price) {
292
+ $(this).html(Util.year_price_rate(item["price"], Util.to_float(year_price)));
293
+ }
291
294
  }
292
295
  });
296
+ if (item["high_52week"]) {
297
+ $(".high_52week_" + code).each(function () {
298
+ $(this).html(Util.year_price_rate(item["price"], item["high_52week"]));
299
+ });
300
+ }
293
301
  }
294
302
  if (item["high"]) {
295
303
  let high_price = Util.digit_compare_trend(item["high"], item["previous_price"]);