sbd-npm 1.1.1 → 1.1.5
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 +1 -1
- package/util.js +23 -9
package/package.json
CHANGED
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
|
-
|
214
|
-
|
215
|
-
|
216
|
-
if (location_name
|
217
|
-
|
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
|
},
|
@@ -284,6 +283,21 @@ let Util = {
|
|
284
283
|
}
|
285
284
|
$(this).html(price);
|
286
285
|
});
|
286
|
+
$(".year_price_" + code).each(function () {
|
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
|
+
}
|
294
|
+
}
|
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
|
+
}
|
287
301
|
}
|
288
302
|
if (item["high"]) {
|
289
303
|
let high_price = Util.digit_compare_trend(item["high"], item["previous_price"]);
|
@@ -903,7 +917,7 @@ let Util = {
|
|
903
917
|
array_rand: function(arr, default_val = "") {
|
904
918
|
if (arr.length > 0) {
|
905
919
|
let rand_index = Math.floor((Math.random() * arr.length));
|
906
|
-
return
|
920
|
+
return arr[rand_index];
|
907
921
|
}
|
908
922
|
return default_val;
|
909
923
|
},
|