sbd-npm 1.0.98 → 1.1.3
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 +1 -0
- package/package.json +1 -1
- package/util.js +36 -0
package/.npmignore
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
sbd-npm.md
|
package/package.json
CHANGED
package/util.js
CHANGED
@@ -49,6 +49,19 @@ let Util = {
|
|
49
49
|
return false;
|
50
50
|
});
|
51
51
|
|
52
|
+
$("#random_walk").click(function() {
|
53
|
+
let url_arr = [];
|
54
|
+
$('.side-menu li a').each(function () {
|
55
|
+
let url = $(this).attr("href");
|
56
|
+
if (url) {
|
57
|
+
url_arr.push(url);
|
58
|
+
}
|
59
|
+
});
|
60
|
+
if (url_arr.length > 0) {
|
61
|
+
window.open(Util.array_rand(url_arr), "_blank");
|
62
|
+
}
|
63
|
+
});
|
64
|
+
|
52
65
|
$('#stock').keyup(function () {
|
53
66
|
let st_obj = $("#search-tips");
|
54
67
|
let key_word = $(this).val();
|
@@ -271,6 +284,12 @@ let Util = {
|
|
271
284
|
}
|
272
285
|
$(this).html(price);
|
273
286
|
});
|
287
|
+
$(".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)));
|
291
|
+
}
|
292
|
+
});
|
274
293
|
}
|
275
294
|
if (item["high"]) {
|
276
295
|
let high_price = Util.digit_compare_trend(item["high"], item["previous_price"]);
|
@@ -547,6 +566,9 @@ let Util = {
|
|
547
566
|
if (col["title"]) {
|
548
567
|
td_attr += ' title="' + col["title"] + '"';
|
549
568
|
}
|
569
|
+
if (col["style"]) {
|
570
|
+
td_attr += ' style="' + col["style"] + '"';
|
571
|
+
}
|
550
572
|
if (col["class"]) {
|
551
573
|
td_class.push(col["class"]);
|
552
574
|
}
|
@@ -878,6 +900,20 @@ let Util = {
|
|
878
900
|
}
|
879
901
|
},
|
880
902
|
|
903
|
+
/**
|
904
|
+
* 数组里随机取出一个值
|
905
|
+
* @param arr
|
906
|
+
* @param default_val
|
907
|
+
* @returns {string}
|
908
|
+
*/
|
909
|
+
array_rand: function(arr, default_val = "") {
|
910
|
+
if (arr.length > 0) {
|
911
|
+
let rand_index = Math.floor((Math.random() * arr.length));
|
912
|
+
return arr[rand_index];
|
913
|
+
}
|
914
|
+
return default_val;
|
915
|
+
},
|
916
|
+
|
881
917
|
// [为什么要用 setTimeout 模拟 setInterval ?](https://segmentfault.com/a/1190000038829248)
|
882
918
|
set_interval: function (func, timeout) {
|
883
919
|
let handler = function () {
|