sbd-npm 1.5.31 → 1.5.32
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/custom.js +1 -1
- package/package.json +1 -1
- package/snowball_tweet.js +1 -1
- package/stock_basics.js +5 -5
- package/util.js +20 -20
package/custom.js
CHANGED
|
@@ -41,7 +41,7 @@ function init_sidebar() {
|
|
|
41
41
|
body_nav = "nav-sm";
|
|
42
42
|
}
|
|
43
43
|
let date = new Date();
|
|
44
|
-
date.setTime(date.getTime() + Math.pow(Util.
|
|
44
|
+
date.setTime(date.getTime() + Math.pow(Util.ONE_DAY_SECOND, 3));
|
|
45
45
|
document.cookie = "body_nav=" + body_nav + "; expires=" + date.toGMTString();
|
|
46
46
|
$BODY.toggleClass("nav-md nav-sm");
|
|
47
47
|
a();
|
package/package.json
CHANGED
package/snowball_tweet.js
CHANGED
|
@@ -326,7 +326,7 @@ $(function () {
|
|
|
326
326
|
let now = Util.now();
|
|
327
327
|
let date = new Date();
|
|
328
328
|
let hour = date.getHours();
|
|
329
|
-
let start_date = hour < 6 ? (now - Util.
|
|
329
|
+
let start_date = hour < 6 ? (now - Util.ONE_DAY_SECOND) : now;
|
|
330
330
|
$('#tweet_start_date').data('daterangepicker').setStartDate(Util.seconds_to_format(start_date, "%Y-%m-%d"));
|
|
331
331
|
$('#tweet_end_date').data('daterangepicker').setStartDate(Util.seconds_to_format(now, "%Y-%m-%d"));
|
|
332
332
|
}
|
package/stock_basics.js
CHANGED
|
@@ -172,7 +172,7 @@ let Stock = {
|
|
|
172
172
|
Util.init_profile_component("profile", item.intro);
|
|
173
173
|
if (item.latest_date && !Stock.hist_end_date) {
|
|
174
174
|
Stock.hist_end_date = Util.seconds_to_format(item.latest_date, "%Y-%m-%d");
|
|
175
|
-
Stock.hist_start_date = Util.seconds_to_format(item.latest_date - 60 * Util.
|
|
175
|
+
Stock.hist_start_date = Util.seconds_to_format(item.latest_date - 60 * Util.ONE_DAY_SECOND, "%Y-%m-%d");
|
|
176
176
|
}
|
|
177
177
|
item.price = (item.price && item.price > 0) ? item.price : parseFloat($("#price").html());
|
|
178
178
|
Stock.price = item.price;
|
|
@@ -834,7 +834,7 @@ let Stock = {
|
|
|
834
834
|
Util.post("/stock/" + Stock.code, {action: "holder_num"}, function (j) {
|
|
835
835
|
Stock["holder_chart"].hideLoading();
|
|
836
836
|
let html = [], date_data = [], holder_data = [], price_data = [];
|
|
837
|
-
let latest_date = 0, max_holder_num = 0, max_holder_num_date = 0, min_holder_num = Util.
|
|
837
|
+
let latest_date = 0, max_holder_num = 0, max_holder_num_date = 0, min_holder_num = Util.MAX_32BIT_INTEGER, min_holder_num_date = 0;
|
|
838
838
|
j.data.forEach(function (item) {
|
|
839
839
|
let date_format = Util.seconds_to_format(item.date, "%Y-%m-%d");
|
|
840
840
|
latest_date = Math.max(latest_date, item.date);
|
|
@@ -917,7 +917,7 @@ let Stock = {
|
|
|
917
917
|
Util.render_table_html("notice_table_body", html);
|
|
918
918
|
//年报数据
|
|
919
919
|
let now = Util.now();
|
|
920
|
-
let dist_time = Util.
|
|
920
|
+
let dist_time = Util.ONE_DAY_SECOND * 400;
|
|
921
921
|
if ((now - Stock.ttm_second) > dist_time) {
|
|
922
922
|
Util.post(Util.get_url("notice_report_annual"), {action: "report", code: Stock.code}, function (j) {
|
|
923
923
|
let html = [];
|
|
@@ -1016,9 +1016,9 @@ let Stock = {
|
|
|
1016
1016
|
let date = params["name"];
|
|
1017
1017
|
if (date_type === "week") {
|
|
1018
1018
|
date = Util.format_to_second(date);
|
|
1019
|
-
date = date - 4 * Util.
|
|
1019
|
+
date = date - 4 * Util.ONE_DAY_SECOND;
|
|
1020
1020
|
Stock.hist_start_date = Util.seconds_to_format(date, "%Y-%m-%d");
|
|
1021
|
-
Stock.hist_end_date = Util.seconds_to_format(date - 1 + 7 * Util.
|
|
1021
|
+
Stock.hist_end_date = Util.seconds_to_format(date - 1 + 7 * Util.ONE_DAY_SECOND, "%Y-%m-%d");
|
|
1022
1022
|
} else if (date_type === "month") {
|
|
1023
1023
|
Stock.hist_start_date = date;
|
|
1024
1024
|
let d_array = date.split("-");
|
package/util.js
CHANGED
|
@@ -31,15 +31,15 @@ const Util = {
|
|
|
31
31
|
is_init: 0,
|
|
32
32
|
is_load: false,
|
|
33
33
|
// 1年的天数
|
|
34
|
-
|
|
34
|
+
ONE_YEAR_DAY: 365,
|
|
35
35
|
// 一天的秒数
|
|
36
|
-
|
|
36
|
+
ONE_DAY_SECOND: 86400,
|
|
37
37
|
// 1周的秒数(7 * 86400)
|
|
38
|
-
|
|
38
|
+
ONE_WEEK_SECOND: 604800,
|
|
39
39
|
// 1年的秒数(365 * 86400)
|
|
40
|
-
|
|
40
|
+
ONE_YEAR_SECOND: 31536000,
|
|
41
41
|
// 32位最大数字(Number.MAX_SAFE_INTEGER:2^53 - 1,即 9007199254740991,Number.MAX_VALUE:1.7976931348623157e+308)
|
|
42
|
-
|
|
42
|
+
MAX_32BIT_INTEGER: 4294967295,
|
|
43
43
|
|
|
44
44
|
// https://omnipotent.net/jquery.sparkline/
|
|
45
45
|
SparkOptions: {
|
|
@@ -2424,7 +2424,7 @@ const Util = {
|
|
|
2424
2424
|
let month = date.getMonth() + 1;
|
|
2425
2425
|
let current_month_format = year + "-" + (month < 10 ? '0' + month : month) + "-01";
|
|
2426
2426
|
let midnight_second = Util.midnight_second();
|
|
2427
|
-
let week_second = midnight_second - (weekday - 1) * Util.
|
|
2427
|
+
let week_second = midnight_second - (weekday - 1) * Util.ONE_DAY_SECOND;
|
|
2428
2428
|
switch (select_val) {
|
|
2429
2429
|
case "0": // 原来的时间
|
|
2430
2430
|
sd_object.val(Obj.start_date);
|
|
@@ -2439,7 +2439,7 @@ const Util = {
|
|
|
2439
2439
|
ed_object.val(Util.seconds_to_format(midnight_second, "%Y-%m-%d"));
|
|
2440
2440
|
break;
|
|
2441
2441
|
case "3": // 上一周
|
|
2442
|
-
let start_date = week_second - 7 * Util.
|
|
2442
|
+
let start_date = week_second - 7 * Util.ONE_DAY_SECOND + 1;
|
|
2443
2443
|
sd_object.val(Util.seconds_to_format(start_date, "%Y-%m-%d"));
|
|
2444
2444
|
ed_object.val(Util.seconds_to_format(week_second - 1, "%Y-%m-%d"));
|
|
2445
2445
|
break;
|
|
@@ -2455,32 +2455,32 @@ const Util = {
|
|
|
2455
2455
|
ed_object.val(Util.seconds_to_format(midnight_second, "%Y-%m-%d"));
|
|
2456
2456
|
break;
|
|
2457
2457
|
case "6": // 最近7日
|
|
2458
|
-
let pre_7day_second = midnight_second - 7 * Util.
|
|
2458
|
+
let pre_7day_second = midnight_second - 7 * Util.ONE_DAY_SECOND;
|
|
2459
2459
|
sd_object.val(Util.seconds_to_format(pre_7day_second, "%Y-%m-%d"));
|
|
2460
2460
|
ed_object.val(Util.seconds_to_format(midnight_second, "%Y-%m-%d"));
|
|
2461
2461
|
break;
|
|
2462
2462
|
case "7": // 最近30日
|
|
2463
|
-
let pre_30day_second = midnight_second - 30 * Util.
|
|
2463
|
+
let pre_30day_second = midnight_second - 30 * Util.ONE_DAY_SECOND;
|
|
2464
2464
|
sd_object.val(Util.seconds_to_format(pre_30day_second, "%Y-%m-%d"));
|
|
2465
2465
|
ed_object.val(Util.seconds_to_format(midnight_second, "%Y-%m-%d"));
|
|
2466
2466
|
break;
|
|
2467
2467
|
case "8": // 最近60日
|
|
2468
|
-
let pre_60day_second = midnight_second - 60 * Util.
|
|
2468
|
+
let pre_60day_second = midnight_second - 60 * Util.ONE_DAY_SECOND;
|
|
2469
2469
|
sd_object.val(Util.seconds_to_format(pre_60day_second, "%Y-%m-%d"));
|
|
2470
2470
|
ed_object.val(Util.seconds_to_format(midnight_second, "%Y-%m-%d"));
|
|
2471
2471
|
break;
|
|
2472
2472
|
case "9": // 最近90日
|
|
2473
|
-
let pre_90day_second = midnight_second - 90 * Util.
|
|
2473
|
+
let pre_90day_second = midnight_second - 90 * Util.ONE_DAY_SECOND;
|
|
2474
2474
|
sd_object.val(Util.seconds_to_format(pre_90day_second, "%Y-%m-%d"));
|
|
2475
2475
|
ed_object.val(Util.seconds_to_format(midnight_second, "%Y-%m-%d"));
|
|
2476
2476
|
break;
|
|
2477
2477
|
case "10": // 最近半年
|
|
2478
|
-
let pre_half_year_second = midnight_second - (365 / 2) * Util.
|
|
2478
|
+
let pre_half_year_second = midnight_second - (365 / 2) * Util.ONE_DAY_SECOND;
|
|
2479
2479
|
sd_object.val(Util.seconds_to_format(pre_half_year_second, "%Y-%m-%d"));
|
|
2480
2480
|
ed_object.val(Util.seconds_to_format(midnight_second, "%Y-%m-%d"));
|
|
2481
2481
|
break;
|
|
2482
2482
|
case "11": // 最近一年
|
|
2483
|
-
let pre_one_year_second = midnight_second - 365 * Util.
|
|
2483
|
+
let pre_one_year_second = midnight_second - 365 * Util.ONE_DAY_SECOND;
|
|
2484
2484
|
sd_object.val(Util.seconds_to_format(pre_one_year_second, "%Y-%m-%d"));
|
|
2485
2485
|
ed_object.val(Util.seconds_to_format(midnight_second, "%Y-%m-%d"));
|
|
2486
2486
|
break;
|
|
@@ -3669,7 +3669,7 @@ const Util = {
|
|
|
3669
3669
|
if (!Util.regexp_date_yyyy_mm_dd(start_object.val())) {
|
|
3670
3670
|
let start_date = year + "-01-01";
|
|
3671
3671
|
if (nth_day > 0) {
|
|
3672
|
-
start_date = Util.now() - nth_day * Util.
|
|
3672
|
+
start_date = Util.now() - nth_day * Util.ONE_DAY_SECOND;
|
|
3673
3673
|
start_date = Util.seconds_to_format(start_date, "%Y-%m-%d");
|
|
3674
3674
|
} else {
|
|
3675
3675
|
if (month < 5) {
|
|
@@ -3895,13 +3895,13 @@ const Util = {
|
|
|
3895
3895
|
* 模拟事件触发 https://stackoverflow.com/questions/2705583/how-to-simulate-a-click-with-javascript
|
|
3896
3896
|
*/
|
|
3897
3897
|
eventFire: function (element_id, event_type) {
|
|
3898
|
-
let
|
|
3899
|
-
if (
|
|
3900
|
-
|
|
3898
|
+
let element_object = document.getElementById(element_id);
|
|
3899
|
+
if (element_object.fireEvent) {
|
|
3900
|
+
element_object.fireEvent('on' + event_type);
|
|
3901
3901
|
} else {
|
|
3902
|
-
let
|
|
3903
|
-
|
|
3904
|
-
|
|
3902
|
+
let event_object = document.createEvent('Events');
|
|
3903
|
+
event_object.initEvent(event_type, true, false);
|
|
3904
|
+
element_object.dispatchEvent(event_object);
|
|
3905
3905
|
}
|
|
3906
3906
|
},
|
|
3907
3907
|
|