sbd-npm 1.1.95 → 1.1.98

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/util.js CHANGED
@@ -262,7 +262,7 @@ const Util = {
262
262
  return location;
263
263
  }
264
264
  if (location_name === "") {
265
- location_name = location.length > 10 ? location.substr(0, 10) : location;
265
+ location_name = location.length > 20 ? location.substr(0, 20) : location;
266
266
  }
267
267
  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>";
268
268
  }
@@ -281,7 +281,7 @@ const Util = {
281
281
  return location;
282
282
  }
283
283
  if (location_name === "") {
284
- location_name = location.length > 10 ? location.substr(0, 10) : location;
284
+ location_name = location.length > 20 ? location.substr(0, 20) : location;
285
285
  }
286
286
  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>";
287
287
  }
@@ -1358,6 +1358,7 @@ const Util = {
1358
1358
  sd_obj.attr("disabled", false);
1359
1359
  ed_obj.attr("disabled", false);
1360
1360
  let weekday = Util.get_weekday();
1361
+ let date = new Date();
1361
1362
  let year = date.getFullYear();
1362
1363
  let month = date.getMonth() + 1;
1363
1364
  let current_month_format = year + "-" + (month < 10 ? '0' + month : month) + "-01";
@@ -1917,6 +1918,7 @@ const Util = {
1917
1918
  let valid_code_list = [];
1918
1919
  let total_change_percent = 0;
1919
1920
  let total_year_change_percent = 0;
1921
+ let total_d5_change_percent = 0;
1920
1922
  $.each(j, function (code, item) {
1921
1923
  if (item["price"] && item["previous_price"] && item["price"] > 0 && item["previous_price"] > 0) {
1922
1924
  valid_code_list.push(item["code"]);
@@ -1924,6 +1926,9 @@ const Util = {
1924
1926
  if (item["year_price"] && item["year_price"] > 0) {
1925
1927
  total_year_change_percent += ((item["price"] - item["year_price"]) / item["year_price"]);
1926
1928
  }
1929
+ if (item["d5_price"] && item["d5_price"] > 0) {
1930
+ total_d5_change_percent += ((item["price"] - item["d5_price"]) / item["d5_price"]);
1931
+ }
1927
1932
  }
1928
1933
  Util.render_price(item);
1929
1934
  if (item["holder_num"] && item["holder_num"] > 0) {
@@ -1968,29 +1973,8 @@ const Util = {
1968
1973
  if ($("#" + element_id + "_tips").length) {
1969
1974
  let average_change_percent = Math.round((total_change_percent / total_num) * 10000) / 100;
1970
1975
  let average_year_change_percent = Math.round((total_year_change_percent / total_num) * 10000) / 100;
1971
- let week_tips_id = element_id + "week_tips";
1972
- $("#" + element_id + "_tips").html('共 <span class="label label-info">' + total_num + '</span> 家 平均涨跌: ' + Util.parse_ratio(average_change_percent) + "<span id='" + week_tips_id + "'></span> 年初至今: " + Util.parse_ratio(average_year_change_percent));
1973
- let code_price_dict = {};
1974
- valid_code_list.forEach(function (code) {
1975
- code_price_dict[code] = j[code]["price"];
1976
- });
1977
- Util.post("/action", {action: "code_d5_price", code_list: code_list.join("-")}, function (j) {
1978
- let total_num = 0;
1979
- let total_week_change_percent = 0;
1980
- $.each(j, function (code, d5_price) {
1981
- if (d5_price > 0 && code_price_dict[code]) {
1982
- total_num += 1;
1983
- total_week_change_percent += ((code_price_dict[code] - d5_price) / d5_price);
1984
- $(".d5_price_" + code).each(function () {
1985
- $(this).html(Util.year_price_rate(code_price_dict[code], d5_price));
1986
- });
1987
- }
1988
- });
1989
- if (total_num > 0) {
1990
- let average_week_change_percent = Math.round((total_week_change_percent / total_num) * 10000) / 100;
1991
- $("#" + week_tips_id).html(" 最近5日: " + Util.parse_ratio(average_week_change_percent));
1992
- }
1993
- });
1976
+ let average_d5_change_percent = Math.round((total_d5_change_percent / total_num) * 10000) / 100;
1977
+ $("#" + element_id + "_tips").html('共 <span class="label label-info">' + total_num + '</span> 家 平均涨跌: ' + Util.parse_ratio(average_change_percent) + " 最近5日: " + Util.parse_ratio(average_d5_change_percent) + " 年初至今: " + Util.parse_ratio(average_year_change_percent));
1994
1978
  }
1995
1979
  }
1996
1980
  Util.hide_tips();
package/.npmignore DELETED
@@ -1 +0,0 @@
1
- sbd-npm.md