sbd-npm 1.4.20 → 1.4.21
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/status.js +94 -5
- package/util.js +11 -6
package/package.json
CHANGED
package/status.js
CHANGED
@@ -190,7 +190,7 @@ $(function () {
|
|
190
190
|
Status.handle_process();
|
191
191
|
});
|
192
192
|
if (!document.getElementById("client_action_add")) {
|
193
|
-
Status.
|
193
|
+
Status.init_client_action_modal();
|
194
194
|
}
|
195
195
|
}
|
196
196
|
let is_py_process = $("#is_py_process").prop("checked") ? "1" : "0";
|
@@ -527,18 +527,24 @@ $(function () {
|
|
527
527
|
if (!document.getElementById("workers")) {
|
528
528
|
is_init = 1;
|
529
529
|
let hw_html = [];
|
530
|
-
|
530
|
+
if (Util.is_mobile()) {
|
531
|
+
hw_html.push('<form class="form-inline" style="margin-bottom: 5px;">');
|
532
|
+
} else {
|
533
|
+
hw_html.push('<form class="form-inline">');
|
534
|
+
}
|
531
535
|
hw_html.push('<div class="form-group">');
|
532
536
|
hw_html.push('<select id="workers" class="form-control">');
|
533
537
|
hw_html.push('<option value="">Loading...</option>');
|
534
538
|
hw_html.push('</select>');
|
535
539
|
hw_html.push('</div>');
|
536
540
|
hw_html.push(' <a href="#" data-toggle="modal" data-target=".client_action_modal" data-type="2" class="btn btn-warning">添加任务</a>');
|
541
|
+
hw_html.push('<a href="#" data-toggle="modal" data-target=".client_cookie_modal" class="btn btn-warning">雪球Cookie</a>');
|
537
542
|
hw_html.push('</form>');
|
538
543
|
hw_html.push('<div id="worker_process_div"></div>');
|
539
544
|
$("#worker_div").html(hw_html.join(""));
|
540
545
|
if (!document.getElementById("client_action_add")) {
|
541
|
-
Status.
|
546
|
+
Status.init_client_action_modal();
|
547
|
+
Status.init_client_cookie_modal();
|
542
548
|
}
|
543
549
|
}
|
544
550
|
Util.post(location.pathname, {active_div: localStorage[Status.tab_token], is_init: is_init, key: $("#workers").val()}, function (j) {
|
@@ -605,7 +611,7 @@ $(function () {
|
|
605
611
|
});
|
606
612
|
},
|
607
613
|
|
608
|
-
|
614
|
+
init_client_action_modal: function () {
|
609
615
|
Util.init_modal_skeleton("client_action_modal");
|
610
616
|
$("#client_action_modal_title").html("添加任务");
|
611
617
|
let html = [];
|
@@ -669,7 +675,6 @@ $(function () {
|
|
669
675
|
});
|
670
676
|
});
|
671
677
|
cam_obj.on('hidden.bs.modal', function () {
|
672
|
-
$("#client_action_content").val("");
|
673
678
|
$("#client_action_tips").html("");
|
674
679
|
Util.hide_tips();
|
675
680
|
});
|
@@ -708,6 +713,90 @@ $(function () {
|
|
708
713
|
});
|
709
714
|
},
|
710
715
|
|
716
|
+
init_client_cookie_modal: function () {
|
717
|
+
Util.init_modal_skeleton("client_cookie_modal");
|
718
|
+
$("#client_cookie_modal_title").html("雪球Cookie");
|
719
|
+
let html = [];
|
720
|
+
html.push('<form data-parsley-validate class="form-horizontal form-label-left">');
|
721
|
+
html.push('<div class="form-group" id="action_worker_div">');
|
722
|
+
html.push('<label class="control-label col-md-3 col-sm-3 col-xs-12" for="search_ip">Worker </label>');
|
723
|
+
html.push('<div class="col-md-6 col-sm-6 col-xs-12">');
|
724
|
+
html.push('<select id="client_cookie_worker" class="form-control col-md-7 col-xs-12">');
|
725
|
+
html.push('<option value="">Loading...</option>');
|
726
|
+
html.push('</select>');
|
727
|
+
html.push('</div>');
|
728
|
+
html.push('</div>');
|
729
|
+
html.push('<div class="form-group">');
|
730
|
+
html.push('<label class="control-label col-md-3 col-sm-3 col-xs-12" for="search_ip">Cookie </label>');
|
731
|
+
html.push('<div class="col-md-6 col-sm-6 col-xs-12">');
|
732
|
+
html.push('<textarea class="form-control" rows="10" id="client_cookie_content"></textarea>');
|
733
|
+
html.push('</div>');
|
734
|
+
html.push('</div>');
|
735
|
+
html.push('<div class="form-group">');
|
736
|
+
html.push('<div class="col-md-6 col-sm-6 col-xs-12 col-md-offset-3">');
|
737
|
+
html.push('<button id="client_cookie_add" type="button" class="btn btn-success">添 加</button>');
|
738
|
+
html.push('<span id="client_cookie_tips"></span>');
|
739
|
+
html.push('</div>');
|
740
|
+
html.push('</div>');
|
741
|
+
html.push('</form>');
|
742
|
+
let ccmb_obj = $("#client_cookie_modal_body");
|
743
|
+
ccmb_obj.html(html.join(""));
|
744
|
+
ccmb_obj.parent().parent().removeClass("modal-xlg");
|
745
|
+
let ccm_obj = $('#client_cookie_modal');
|
746
|
+
ccm_obj.on('show.bs.modal', function (e) {
|
747
|
+
Util.show_loading();
|
748
|
+
Util.post(location.pathname, {active_div: "client_action", action_type: 2}, function (j) {
|
749
|
+
if (j["workers"]) {
|
750
|
+
let worker_html = [];
|
751
|
+
j["workers"].forEach(function (w) {
|
752
|
+
worker_html.push("<option value='", w["key"], "'>", w["ip"], "(", w["num"], ")</option>");
|
753
|
+
});
|
754
|
+
let caw_obj = $("#client_cookie_worker");
|
755
|
+
caw_obj.html(worker_html.join(""));
|
756
|
+
let worker = $("#workers").val();
|
757
|
+
if (worker) {
|
758
|
+
caw_obj.find("option[value='" + worker + "']").attr("selected", true);
|
759
|
+
}
|
760
|
+
}
|
761
|
+
Util.hide_tips();
|
762
|
+
});
|
763
|
+
});
|
764
|
+
ccm_obj.on('hidden.bs.modal', function () {
|
765
|
+
$("#client_cookie_content").val("");
|
766
|
+
$("#client_cookie_tips").html("");
|
767
|
+
Util.hide_tips();
|
768
|
+
});
|
769
|
+
$("#client_cookie_add").click(function() {
|
770
|
+
let worker_key = $("#client_cookie_worker").val();
|
771
|
+
if (worker_key) {
|
772
|
+
let client_cookie = $("#client_cookie_content").val();
|
773
|
+
if (client_cookie) {
|
774
|
+
Util.show_loading();
|
775
|
+
$("#client_cookie_tips").html("");
|
776
|
+
$("#client_cookie_add").attr("disabled", true);
|
777
|
+
Util.post(location.pathname, {active_div: "client_cookie_add", "key": worker_key, "cookie": client_cookie}, function (j) {
|
778
|
+
$("#client_cookie_add").attr("disabled", false);
|
779
|
+
if (j["code"] && j["code"] === 1) {
|
780
|
+
$("#client_cookie_tips").html("<b class='text-success'>Cookie添加成功!</b>");
|
781
|
+
} else if (j["code"] && j["code"] === 2) {
|
782
|
+
$("#client_cookie_tips").html("<b class='text-danger'>Worker 不存在!</b>");
|
783
|
+
} else if (j["code"] && j["code"] === 3) {
|
784
|
+
$("#client_cookie_tips").html("<b class='text-danger'>Cookie异常!</b>");
|
785
|
+
} else {
|
786
|
+
$("#client_cookie_tips").html("<b class='text-danger'>Cookie不能为空!</b>");
|
787
|
+
}
|
788
|
+
Util.hide_tips();
|
789
|
+
});
|
790
|
+
} else {
|
791
|
+
$("#client_cookie_tips").html("<b class='text-danger'>Cookie不能为空!</b>");
|
792
|
+
}
|
793
|
+
} else {
|
794
|
+
$("#client_cookie_tips").html("<b class='text-danger'>Worker 异常!</b>");
|
795
|
+
}
|
796
|
+
return false;
|
797
|
+
});
|
798
|
+
},
|
799
|
+
|
711
800
|
handle_tool: function () {
|
712
801
|
let t_obj = $("#timestamp");
|
713
802
|
let t_val = t_obj.val();
|
package/util.js
CHANGED
@@ -650,11 +650,7 @@ const Util = {
|
|
650
650
|
* @returns {string}
|
651
651
|
*/
|
652
652
|
code_to_symbol: function (code) {
|
653
|
-
|
654
|
-
if (!Util.is_us(code)) {
|
655
|
-
market = Util.code_to_market(code);
|
656
|
-
}
|
657
|
-
return market + code;
|
653
|
+
return Util.is_us(code) ? code : (Util.code_to_market(code) + code);
|
658
654
|
},
|
659
655
|
|
660
656
|
/**
|
@@ -753,6 +749,15 @@ const Util = {
|
|
753
749
|
* @returns {boolean}
|
754
750
|
*/
|
755
751
|
is_hk: function (code) {
|
752
|
+
if (/^[Hh][a-zA-Z0-9]+$/.test(code)) {
|
753
|
+
code = code.toLowerCase();
|
754
|
+
if (code.slice(0, 2) === "hk") {
|
755
|
+
code = code.slice(2);
|
756
|
+
}
|
757
|
+
if (["hsi", "hsci", "hstech", "hshkbio", "hscei"].includes(code)) {
|
758
|
+
return true;
|
759
|
+
}
|
760
|
+
}
|
756
761
|
return /^\d{5}$/.test(code);
|
757
762
|
},
|
758
763
|
|
@@ -1883,7 +1888,7 @@ const Util = {
|
|
1883
1888
|
_html.push("</tr>");
|
1884
1889
|
});
|
1885
1890
|
Util.render_table_html("btc_modal_body_body", _html);
|
1886
|
-
let btc_title = j["cn_name"] + "(" + Util.pack_html_link('https://www.binance.com/zh-CN/trade/' + j["short_name"] + '_USDT?theme=dark', j["short_name"]) + ", " + Util.pack_html_link("https://www.
|
1891
|
+
let btc_title = j["cn_name"] + "(" + Util.pack_html_link('https://www.binance.com/zh-CN/trade/' + j["short_name"] + '_USDT?theme=dark', j["short_name"]) + ", " + Util.pack_html_link("https://www.feixiaohao.com/currencies/" + j["coin"], j["coin"]) + ")";
|
1887
1892
|
btc_title += " <small>历史最低:<span class='label label-success'>" + j["hist_low"] + "</span> 历史最高:<span class='label label-danger'>" + j["hist_high"] +
|
1888
1893
|
"</span> 年初至今:" + Util.digit_compare_trend1(j["price"], j["year_price"]) +
|
1889
1894
|
" 52周最高:" + Util.digit_compare_trend1(j["price"], j["week52high"]) +
|