sbd-npm 1.1.62 → 1.1.66
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/menu.js +1 -0
- package/package.json +1 -1
- package/util.js +70 -41
package/.npmignore
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
sbd-npm.md
|
package/menu.js
CHANGED
@@ -50,6 +50,7 @@ const MenuList = [
|
|
50
50
|
{'key': 'trend_doji', 'name': '十字星', 'url': '/718eac2cccaef1c7968f2d121b5f3070'},
|
51
51
|
{'key': 'trend_ma510', 'name': '突破5、10日均线', 'url': '/4d6d7ee173c87b1f939fa454093a63c7'},
|
52
52
|
{'key': 'trend_holder_minimum', 'name': '股东数历史最少', 'url': '/a9e45d918bc565afd76047cafea25824'},
|
53
|
+
{'key': 'trend_fund_hold', 'name': '基金持股变化', 'url': '/067740976f85ec14ddae02b51829ce35'},
|
53
54
|
{'key': 'trend_week_minimum', 'name': '周成交低点', 'url': '/722d94429b8e689fe78dca1cf67a4c67'},
|
54
55
|
{'key': 'trend_margin', 'name': '融资融券余额涨幅', 'url': '/1964a6bc56dc3ce6825b23667c7fb588'},
|
55
56
|
{'key': 'trend_price', 'name': '股价升跌幅度', 'url': '/43ef6aeb36475f8f8f44d477b1990390'},
|
package/package.json
CHANGED
package/util.js
CHANGED
@@ -364,11 +364,6 @@ const Util = {
|
|
364
364
|
$(this).html(Util.year_price_rate(item["price"], item["high_52week"]));
|
365
365
|
});
|
366
366
|
}
|
367
|
-
if (item["holder_num"] && item["holder_num"] > 0 && item["pre_holder_num"]) {
|
368
|
-
$(".holder_" + code).each(function () {
|
369
|
-
$(this).html(Util.pack_holder_num(item));
|
370
|
-
});
|
371
|
-
}
|
372
367
|
}
|
373
368
|
if (item["high"]) {
|
374
369
|
let high_price = Util.digit_compare_trend(item["high"], item["previous_price"]);
|
@@ -1175,7 +1170,7 @@ const Util = {
|
|
1175
1170
|
* 一周的哪一天(1-7,星期一:1,星期二:2,...星期日:7)
|
1176
1171
|
* @returns {*|number}
|
1177
1172
|
*/
|
1178
|
-
get_weekday: function() {
|
1173
|
+
get_weekday: function () {
|
1179
1174
|
let date = new Date();
|
1180
1175
|
let weekday = date.getDay();
|
1181
1176
|
weekday = weekday > 0 ? weekday : 7; // 星期天是0
|
@@ -1842,7 +1837,14 @@ const Util = {
|
|
1842
1837
|
obj.tooltip();
|
1843
1838
|
},
|
1844
1839
|
|
1845
|
-
|
1840
|
+
/**
|
1841
|
+
* 初始一些数据
|
1842
|
+
* @param element_id
|
1843
|
+
* @param index_list
|
1844
|
+
* @param is_us
|
1845
|
+
* @param is_refresh 开市时是否定时刷新,1是0否
|
1846
|
+
*/
|
1847
|
+
init_stock_stuff: function (element_id, index_list, is_us = 0, is_refresh = 1) {
|
1846
1848
|
let code_list = Util.get_code_list(element_id);
|
1847
1849
|
if (code_list.length > 0) {
|
1848
1850
|
Util.show_tips("Loading...");
|
@@ -1850,6 +1852,11 @@ const Util = {
|
|
1850
1852
|
Util.post("/action", {action: "code_detail", code_list: code_list.join("-")}, function (j) {
|
1851
1853
|
$.each(j, function (code, item) {
|
1852
1854
|
Util.render_price(item);
|
1855
|
+
if (item["holder_num"] && item["holder_num"] > 0) {
|
1856
|
+
$(".holder_" + code).each(function () {
|
1857
|
+
$(this).html(Util.pack_holder_num(item));
|
1858
|
+
});
|
1859
|
+
}
|
1853
1860
|
if ($("#remark_" + code).length) {
|
1854
1861
|
let remark = "";
|
1855
1862
|
if (parseInt(item["down_day"]) > 0) {
|
@@ -1877,37 +1884,24 @@ const Util = {
|
|
1877
1884
|
$("#remark_" + code).html(remark);
|
1878
1885
|
}
|
1879
1886
|
});
|
1880
|
-
|
1887
|
+
if (is_refresh === 1) {
|
1888
|
+
Util.refresh_index_price(element_id, index_list.join("-"), is_us);
|
1889
|
+
} else {
|
1890
|
+
Util.refresh_index_price(element_id, index_list.join("-"), is_us, 0);
|
1891
|
+
}
|
1881
1892
|
Util.hide_tips();
|
1882
1893
|
});
|
1883
1894
|
}
|
1884
1895
|
},
|
1885
1896
|
|
1886
|
-
|
1887
|
-
|
1888
|
-
|
1889
|
-
|
1890
|
-
|
1891
|
-
|
1892
|
-
|
1893
|
-
|
1894
|
-
callback_func();
|
1895
|
-
}
|
1896
|
-
},
|
1897
|
-
|
1898
|
-
countdown_refresh_index_price: function (interval, element_id, index_list, is_us, us_market_status) {
|
1899
|
-
if (interval > 0) {
|
1900
|
-
$("#" + element_id + "_tips").html("交易中, " + interval + " 秒后刷新");
|
1901
|
-
setTimeout(function () {
|
1902
|
-
Util.countdown_refresh_index_price(interval - 1, element_id, index_list, is_us, us_market_status);
|
1903
|
-
}, 1000);
|
1904
|
-
} else {
|
1905
|
-
$("#" + element_id + "_tips").html("刷新中...");
|
1906
|
-
Util.refresh_index_price(element_id, index_list, is_us, us_market_status);
|
1907
|
-
}
|
1908
|
-
},
|
1909
|
-
|
1910
|
-
refresh_index_price: function (element_id, index_list, is_us = 0, us_market_status = -1) {
|
1897
|
+
/**
|
1898
|
+
* 刷新指数和价格数据
|
1899
|
+
* @param element_id
|
1900
|
+
* @param index_list
|
1901
|
+
* @param is_us
|
1902
|
+
* @param is_refresh 1刷新,0不刷新,-1美股开市则刷新
|
1903
|
+
*/
|
1904
|
+
refresh_index_price: function (element_id, index_list, is_us = 0, is_refresh = -1) {
|
1911
1905
|
let code_list = Util.get_code_list(element_id);
|
1912
1906
|
if (code_list.length > 0) {
|
1913
1907
|
let payload = {action: "index_price", index_list: index_list, code_list: code_list.join("-")};
|
@@ -1931,9 +1925,9 @@ const Util = {
|
|
1931
1925
|
}
|
1932
1926
|
});
|
1933
1927
|
if (is_us === 1) {
|
1934
|
-
if (
|
1935
|
-
Util.countdown_refresh_index_price(5, element_id, index_list, is_us,
|
1936
|
-
} else if (
|
1928
|
+
if (is_refresh === 1) {
|
1929
|
+
Util.countdown_refresh_index_price(5, element_id, index_list, is_us, is_refresh);
|
1930
|
+
} else if (is_refresh === -1) { // 美股开市则刷新
|
1937
1931
|
Util.post("/action", {action: "us_market_status"}, function (ums) {
|
1938
1932
|
if (ums === "1") {
|
1939
1933
|
Util.countdown_refresh_index_price(5, element_id, index_list, is_us, 1);
|
@@ -1941,14 +1935,48 @@ const Util = {
|
|
1941
1935
|
}, "text");
|
1942
1936
|
}
|
1943
1937
|
} else {
|
1944
|
-
if (j["is_holiday"] === 0
|
1945
|
-
Util.
|
1938
|
+
if (is_refresh !== 0 && j["is_holiday"] === 0) {
|
1939
|
+
if (Util.is_trade_time()) {
|
1940
|
+
Util.countdown_refresh_index_price(5, element_id, index_list, is_us, is_refresh);
|
1941
|
+
}
|
1946
1942
|
}
|
1947
1943
|
}
|
1948
1944
|
});
|
1949
1945
|
}
|
1950
1946
|
},
|
1951
1947
|
|
1948
|
+
/**
|
1949
|
+
* 指数和价格数据刷新的倒计时
|
1950
|
+
* @param interval
|
1951
|
+
* @param element_id
|
1952
|
+
* @param index_list
|
1953
|
+
* @param is_us
|
1954
|
+
* @param is_refresh
|
1955
|
+
*/
|
1956
|
+
countdown_refresh_index_price: function (interval, element_id, index_list, is_us, is_refresh) {
|
1957
|
+
if (interval > 0) {
|
1958
|
+
$("#" + element_id + "_tips").html("交易中, " + interval + " 秒后刷新");
|
1959
|
+
setTimeout(function () {
|
1960
|
+
Util.countdown_refresh_index_price(interval - 1, element_id, index_list, is_us, is_refresh);
|
1961
|
+
}, 1000);
|
1962
|
+
} else {
|
1963
|
+
$("#" + element_id + "_tips").html("刷新中...");
|
1964
|
+
Util.refresh_index_price(element_id, index_list, is_us, is_refresh);
|
1965
|
+
}
|
1966
|
+
},
|
1967
|
+
|
1968
|
+
countdown_func: function (interval, tips_id, callback_func) {
|
1969
|
+
if (interval > 0) {
|
1970
|
+
$("#" + tips_id).html("交易中, " + interval + " 秒后刷新");
|
1971
|
+
setTimeout(function () {
|
1972
|
+
Util.countdown_func(interval - 1, tips_id, callback_func);
|
1973
|
+
}, 1000);
|
1974
|
+
} else {
|
1975
|
+
$("#" + tips_id).html("刷新中...");
|
1976
|
+
callback_func();
|
1977
|
+
}
|
1978
|
+
},
|
1979
|
+
|
1952
1980
|
/**
|
1953
1981
|
* 获取页面标题
|
1954
1982
|
* @returns {string}
|
@@ -2081,10 +2109,11 @@ const Util = {
|
|
2081
2109
|
* @param item
|
2082
2110
|
* @returns {string}
|
2083
2111
|
*/
|
2084
|
-
pack_holder_num: function(item) {
|
2085
|
-
if (item["holder_num"] && item["holder_num"] > 0
|
2112
|
+
pack_holder_num: function (item) {
|
2113
|
+
if (item["holder_num"] && item["holder_num"] > 0) {
|
2086
2114
|
let url = Util.get_url("holder_num") + "?code=" + item["code"];
|
2087
|
-
|
2115
|
+
let pre_holder_num = item["pre_holder_num"] ? item["pre_holder_num"] : 0;
|
2116
|
+
return Util.pack_html_link(url, Util.digit_compare_trend(item["holder_num"], pre_holder_num));
|
2088
2117
|
}
|
2089
2118
|
return "--";
|
2090
2119
|
},
|