sbd-npm 1.4.26 → 1.4.28

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.
Files changed (3) hide show
  1. package/package.json +4 -3
  2. package/status.js +205 -82
  3. package/util.js +2 -4
package/package.json CHANGED
@@ -1,11 +1,12 @@
1
1
  {
2
2
  "name": "sbd-npm",
3
- "version": "1.4.26",
3
+ "version": "1.4.28",
4
4
  "description": "Stock Big Data",
5
+ "author": "DHQ <dhq314@gmail.com>",
6
+ "license": "ISC",
5
7
  "main": "index.js",
6
8
  "scripts": {
7
9
  "test": "echo \"Error: no test specified\" && exit 1"
8
10
  },
9
- "author": "dhq",
10
- "license": "ISC"
11
+ "keywords": ["large", "scale", "data"]
11
12
  }
package/status.js CHANGED
@@ -38,8 +38,11 @@ $(function () {
38
38
  case "task":
39
39
  Status.handle_task();
40
40
  break;
41
- case "worker":
42
- Status.handle_worker();
41
+ case "machine":
42
+ Status.handle_machine();
43
+ break;
44
+ case "word":
45
+ Status.handle_word();
43
46
  break;
44
47
  case "tool":
45
48
  Status.handle_tool();
@@ -507,13 +510,13 @@ $(function () {
507
510
  if (!document.getElementById("task_result")) {
508
511
  $("#task_result_zone").html('<textarea rows="20" id="task_result" class="form-control"></textarea>');
509
512
  }
510
- let tr_obj = $("#task_result");
511
513
  if (j["result"]) {
514
+ let tr_obj = $("#task_result");
512
515
  tr_obj.val(j["result"]);
513
516
  tr_obj.scrollTop(tr_obj[0].scrollHeight);
514
517
  } else {
515
518
  if (j["code"] !== 4) {
516
- tr_obj.val("任务 `" + j["content"] + "` 处理中...");
519
+ $("#task_result").val("任务 `" + j["content"] + "` 处理中...");
517
520
  }
518
521
  }
519
522
  } else {
@@ -526,73 +529,75 @@ $(function () {
526
529
  });
527
530
  },
528
531
 
529
- handle_worker: function () {
532
+ handle_machine: function () {
530
533
  let is_init = 0;
531
- if (!document.getElementById("workers")) {
534
+ if (!document.getElementById("machines")) {
532
535
  is_init = 1;
533
- let hw_html = [];
536
+ let machine_html = [];
534
537
  if (Util.is_mobile()) {
535
- hw_html.push('<form class="form-inline" style="margin-bottom: 5px;">');
538
+ machine_html.push('<form class="form-inline" style="margin-bottom: 5px;">');
536
539
  } else {
537
- hw_html.push('<form class="form-inline">');
540
+ machine_html.push('<form class="form-inline">');
538
541
  }
539
- hw_html.push('<div class="form-group">');
540
- hw_html.push('<select id="workers" class="form-control">');
541
- hw_html.push('<option value="">Loading...</option>');
542
- hw_html.push('</select>');
543
- hw_html.push('</div>');
544
- hw_html.push('&nbsp;&nbsp;<a href="#" data-toggle="modal" data-target=".client_action_modal" data-type="2" class="btn btn-warning">添加任务</a>');
545
- hw_html.push('<a href="#" data-toggle="modal" data-target=".client_cookie_modal" class="btn btn-warning">雪球Cookie</a>');
546
- hw_html.push('<a href="#" id="machine_refresh" class="btn btn-warning">刷新Machine</a>');
547
- hw_html.push('</form>');
548
- hw_html.push('<div id="worker_process_div"></div>');
549
- $("#worker_div").html(hw_html.join(""));
542
+ machine_html.push('<div class="form-group">');
543
+ machine_html.push('<select id="machines" class="form-control">');
544
+ machine_html.push('<option value="">Loading...</option>');
545
+ machine_html.push('</select>');
546
+ machine_html.push('</div>');
547
+ machine_html.push('&nbsp;&nbsp;<a href="#" data-toggle="modal" data-target=".client_action_modal" data-type="2" class="btn btn-warning">添加任务</a>');
548
+ machine_html.push('<a href="#" data-toggle="modal" data-target=".client_cookie_modal" class="btn btn-warning">雪球Cookie</a>');
549
+ machine_html.push('<a href="#" id="machine_refresh" class="btn btn-warning">刷新Machine</a>');
550
+ machine_html.push('</form>');
551
+ machine_html.push('<div id="machine_process_div"></div>');
552
+ $("#machine_div").html(machine_html.join(""));
550
553
  if (!document.getElementById("client_action_add")) {
551
554
  Status.init_client_action_modal();
552
555
  Status.init_client_cookie_modal();
553
556
  $("#machine_refresh").click(function() {
554
- Util.show_loading();
555
- $("#machine_refresh").attr("disabled", true).html("正在处理中...");
556
- Util.post(location.pathname, {active_div: "machine_refresh"}, function (j) {
557
- setTimeout(function () {
558
- $('#workers').html('<option value="">暂无Machine</option>');
559
- $("#machine_refresh").html("刷新Machine").attr("disabled", false);
560
- Util.hide_tips();
561
- Util.show_tips("刷新成功", 3456, "alert-success");
562
- }, 3456);
563
- });
557
+ if (confirm("是否确定要“ 刷新Machine ” ?")) {
558
+ Util.show_loading();
559
+ $("#machine_refresh").attr("disabled", true).html("正在处理中...");
560
+ Util.post(location.pathname, {active_div: "machine_refresh"}, function (j) {
561
+ setTimeout(function () {
562
+ $('#machines').html('<option value="">暂无Machine</option>');
563
+ $("#machine_refresh").html("刷新Machine").attr("disabled", false);
564
+ Util.hide_tips();
565
+ Util.show_tips("刷新成功", 3456, "alert-success");
566
+ }, 2345);
567
+ });
568
+ }
564
569
  return false;
565
570
  });
566
571
  }
567
572
  }
568
- Util.post(location.pathname, {active_div: localStorage[Status.tab_token], is_init: is_init, machine_id: $("#workers").val()}, function (j) {
569
- if (j["workers"]) {
573
+ Util.post(location.pathname, {active_div: localStorage[Status.tab_token], is_init: is_init, machine_id: $("#machines").val()}, function (j) {
574
+ if (j["machines"]) {
570
575
  let select_html = [];
571
- select_html.push("<option value=''>共 ", j["workers"].length, " 个Worker</option>");
572
- j["workers"].forEach(function (w) {
576
+ select_html.push("<option value=''>共 ", j["machines"].length, " 个Machine</option>");
577
+ j["machines"].forEach(function (w) {
573
578
  select_html.push("<option value='", w["machine_id"], "'>", w["ip"], "(", w["num"], ")</option>");
574
579
  });
575
- $("#workers").html(select_html.join(""));
576
- if (j["workers"].length > 0) {
577
- $("#workers").change(function() {
580
+ $("#machines").html(select_html.join(""));
581
+ if (j["machines"].length > 0) {
582
+ $("#machines").change(function() {
578
583
  let machine_id = $(this).val();
579
584
  if (machine_id) {
580
585
  Util.show_loading();
581
- Util.set_table_loading("worker_process_div_body");
582
- Status.handle_worker();
586
+ Util.set_table_loading("machine_process_div_body");
587
+ Status.handle_machine();
583
588
  }
584
589
  });
585
590
  }
586
591
  } else if (j["process"]) {
587
- if (!document.getElementById("worker_process_div_body")) {
592
+ if (!document.getElementById("machine_process_div_body")) {
588
593
  let prefix_caption = "";
589
594
  if (Util.is_mobile()) {
590
- prefix_caption = "<caption id='worker_process_tip'>&nbsp;&nbsp;&nbsp;";
595
+ prefix_caption = "<caption id='machine_process_tip'>&nbsp;&nbsp;&nbsp;";
591
596
  } else {
592
- prefix_caption = '<caption id="worker_process_tip" class="text-right">';
597
+ prefix_caption = '<caption id="machine_process_tip" class="text-right">';
593
598
  }
594
599
  Util.init_table_skeleton({
595
- "element_id": "worker_process_div",
600
+ "element_id": "machine_process_div",
596
601
  "caption": prefix_caption + '</caption>',
597
602
  "head_cols": [
598
603
  {"name": "进程ID", "table_sort": 1},
@@ -621,31 +626,90 @@ $(function () {
621
626
  html.push("<td>", Util.seconds_to_format(item["create_time"]), "</td>");
622
627
  html.push("</tr>");
623
628
  });
624
- Util.render_table_html("worker_process_div_body", html);
625
- $("#worker_process_tip").html('共 <span class="label label-info">' + process_num + '</span> 进程,最后更新时间:' + Util.seconds_to_format(j["date"]) + ',Revision:' + j["revision"] + ',MachineId:' + j["machine_id"]);
626
- $("#workers option[value='" + $("#workers").val() + "']").text(j["ip"] + "(" + process_num + ")");
629
+ Util.render_table_html("machine_process_div_body", html);
630
+ $("#machine_process_tip").html('共 <span class="label label-info">' + process_num + '</span> 进程,最后更新时间:' + Util.seconds_to_format(j["date"]) + ',Revision:' + j["revision"] + ',MachineId:' + j["machine_id"]);
631
+ $("#machines option[value='" + $("#machines").val() + "']").text(j["ip"] + "(" + process_num + ")");
627
632
  } else if (is_init === 1) {
628
- $('#workers').html('<option value="">暂无Machine</option>');
633
+ $('#machines').html('<option value="">暂无Machine</option>');
629
634
  }
630
635
  Util.hide_tips();
631
636
  });
632
637
  },
633
638
 
639
+ handle_word: function() {
640
+ if (!document.getElementById("word_process_div")) {
641
+ let word_html = [];
642
+ if (Util.is_mobile()) {
643
+ word_html.push('<form class="form-inline" style="margin-bottom: 5px;">');
644
+ } else {
645
+ word_html.push('<form class="form-inline">');
646
+ }
647
+ word_html.push('<a href="#" id="word_previous" class="btn btn-warning">前一天WORD</a>');
648
+ word_html.push('</form>');
649
+ word_html.push('<div id="word_process_div"></div>');
650
+ $("#word_div").html(word_html.join(""));
651
+ Util.init_table_skeleton({
652
+ "element_id": "word_process_div",
653
+ "caption": '<caption class="text-right" id="word_num"></caption>',
654
+ "head_cols": [
655
+ {"name": "序号", "table_sort": 1},
656
+ {"name": "单词", "table_sort": 1},
657
+ {"name": "中文"},
658
+ {"name": "时间", "table_sort": 1},
659
+ {"name": "操作"},
660
+ ]
661
+ });
662
+ Status.init_word_modal();
663
+ }
664
+ Util.post(location.pathname, {active_div: localStorage[Status.tab_token]}, function (j) {
665
+ let html = [], index = 0;
666
+ let is_mobile = Util.is_mobile();
667
+ j["data"].forEach(function (item) {
668
+ index++;
669
+ html.push("<tr>");
670
+ html.push("<td>", index, "</td>");
671
+ html.push("<td>", Util.pack_html_link("https://cn.bing.com/dict/search?q=" + item["word"], item["word"]), "</td>");
672
+ if (is_mobile) {
673
+ html.push("<td class='text-left'>", item["chinese"], "</td>");
674
+ } else {
675
+ html.push("<td>", item["chinese"], "</td>");
676
+ }
677
+ html.push("<td>", Util.seconds_to_format(item["date"]), "</td>");
678
+ html.push("<td><a href='#' data-toggle='modal' data-target='.word_modal'>修改</a> &nbsp; <a class='word_del' href='#'>删除</a></td>");
679
+ html.push("</tr>");
680
+ });
681
+ Util.render_table_html("word_process_div_body", html);
682
+ $("#word_num").html("共 <span class='label label-info'>" + index + "</span> 条");
683
+ $(".word_del").each(function () {
684
+ $(this).click(function () {
685
+ let tr_obj = $(this).parent().parent();
686
+ let word = $(tr_obj).children('td').eq(1).text();
687
+ if (confirm("是否确定要删除“ " + word + " ” ?")) {
688
+ Util.post(location.pathname, {"active_div": "word_del", "word": word}, function () {
689
+ $(tr_obj).remove();
690
+ });
691
+ }
692
+ });
693
+ });
694
+ Util.hide_tips();
695
+ });
696
+ },
697
+
634
698
  init_client_action_modal: function () {
635
699
  Util.init_modal_skeleton("client_action_modal");
636
700
  $("#client_action_modal_title").html("添加任务");
637
701
  let html = [];
638
702
  html.push('<form data-parsley-validate class="form-horizontal form-label-left">');
639
- html.push('<div class="form-group" id="action_worker_div">');
640
- html.push('<label class="control-label col-md-3 col-sm-3 col-xs-12" for="search_ip">Worker </label>');
703
+ html.push('<div class="form-group" id="action_machine_div">');
704
+ html.push('<label class="control-label col-md-3 col-sm-3 col-xs-12">Machine </label>');
641
705
  html.push('<div class="col-md-6 col-sm-6 col-xs-12">');
642
- html.push('<select id="client_action_worker" class="form-control col-md-7 col-xs-12">');
706
+ html.push('<select id="client_action_machine" class="form-control col-md-7 col-xs-12">');
643
707
  html.push('<option value="">Loading...</option>');
644
708
  html.push('</select>');
645
709
  html.push('</div>');
646
710
  html.push('</div>');
647
711
  html.push('<div class="form-group">');
648
- html.push('<label class="control-label col-md-3 col-sm-3 col-xs-12" for="search_ip">任务命令 </label>');
712
+ html.push('<label class="control-label col-md-3 col-sm-3 col-xs-12">任务命令 </label>');
649
713
  html.push('<div class="col-md-6 col-sm-6 col-xs-12">');
650
714
  html.push('<select id="client_action_content" class="form-control col-md-7 col-xs-12">');
651
715
  html.push('<option value="">任务命令</option>');
@@ -667,21 +731,21 @@ $(function () {
667
731
  Util.show_loading();
668
732
  let action_type = parseInt($(e.relatedTarget).attr("data-type"));
669
733
  if (action_type === 1) {
670
- $("#action_worker_div").css("display", "none");
734
+ $("#action_machine_div").css("display", "none");
671
735
  } else {
672
- $("#action_worker_div").css("display", "block");
736
+ $("#action_machine_div").css("display", "block");
673
737
  }
674
738
  Util.post(location.pathname, {active_div: "client_action", action_type: action_type}, function (j) {
675
- if (j["workers"]) {
676
- let worker_html = [];
677
- j["workers"].forEach(function (w) {
678
- worker_html.push("<option value='", w["machine_id"], "'>", w["ip"], "(", w["num"], ")</option>");
739
+ if (j["machines"]) {
740
+ let machine_html = [];
741
+ j["machines"].forEach(function (w) {
742
+ machine_html.push("<option value='", w["machine_id"], "'>", w["ip"], "(", w["num"], ")</option>");
679
743
  });
680
- let caw_obj = $("#client_action_worker");
681
- caw_obj.html(worker_html.join(""));
682
- let worker = $("#workers").val();
683
- if (worker) {
684
- caw_obj.find("option[value='" + worker + "']").attr("selected", true);
744
+ let caw_obj = $("#client_action_machine");
745
+ caw_obj.html(machine_html.join(""));
746
+ let machine = $("#machines").val();
747
+ if (machine) {
748
+ caw_obj.find("option[value='" + machine + "']").attr("selected", true);
685
749
  }
686
750
  }
687
751
  if (j["actions"]) {
@@ -700,9 +764,9 @@ $(function () {
700
764
  });
701
765
  $("#client_action_add").click(function() {
702
766
  let action_type = 1, machine_id = "1";
703
- if ($("#action_worker_div").css("display") === "block") {
767
+ if ($("#action_machine_div").css("display") === "block") {
704
768
  action_type = 2;
705
- machine_id = $("#client_action_worker").val();
769
+ machine_id = $("#client_action_machine").val();
706
770
  }
707
771
  if (machine_id) {
708
772
  let action_content = $("#client_action_content").val();
@@ -715,7 +779,7 @@ $(function () {
715
779
  if (j["code"] && j["code"] === 1) {
716
780
  $("#client_action_tips").html("<b class='text-success'>任务`" + action_content + "`添加成功!</b>");
717
781
  } else if (j["code"] && j["code"] === 2) {
718
- $("#client_action_tips").html("<b class='text-danger'>Worker 不存在!</b>");
782
+ $("#client_action_tips").html("<b class='text-danger'>Machine 不存在!</b>");
719
783
  } else if (j["code"] && j["code"] === 3) {
720
784
  $("#client_action_tips").html("<b class='text-danger'>任务内容异常!</b>");
721
785
  } else {
@@ -727,7 +791,7 @@ $(function () {
727
791
  $("#client_action_tips").html("<b class='text-danger'>任务内容不能为空!</b>");
728
792
  }
729
793
  } else {
730
- $("#client_action_tips").html("<b class='text-danger'>Worker 异常!</b>");
794
+ $("#client_action_tips").html("<b class='text-danger'>Machine 异常!</b>");
731
795
  }
732
796
  return false;
733
797
  });
@@ -738,16 +802,16 @@ $(function () {
738
802
  $("#client_cookie_modal_title").html("雪球Cookie");
739
803
  let html = [];
740
804
  html.push('<form data-parsley-validate class="form-horizontal form-label-left">');
741
- html.push('<div class="form-group" id="action_worker_div">');
742
- html.push('<label class="control-label col-md-3 col-sm-3 col-xs-12" for="search_ip">Worker </label>');
805
+ html.push('<div class="form-group" id="action_machine_div">');
806
+ html.push('<label class="control-label col-md-3 col-sm-3 col-xs-12">Machine </label>');
743
807
  html.push('<div class="col-md-6 col-sm-6 col-xs-12">');
744
- html.push('<select id="client_cookie_worker" class="form-control col-md-7 col-xs-12">');
808
+ html.push('<select id="client_cookie_machine" class="form-control col-md-7 col-xs-12">');
745
809
  html.push('<option value="">Loading...</option>');
746
810
  html.push('</select>');
747
811
  html.push('</div>');
748
812
  html.push('</div>');
749
813
  html.push('<div class="form-group">');
750
- html.push('<label class="control-label col-md-3 col-sm-3 col-xs-12" for="search_ip">Cookie </label>');
814
+ html.push('<label class="control-label col-md-3 col-sm-3 col-xs-12" for="client_cookie_content">Cookie </label>');
751
815
  html.push('<div class="col-md-6 col-sm-6 col-xs-12">');
752
816
  html.push('<textarea class="form-control" rows="10" id="client_cookie_content"></textarea>');
753
817
  html.push('</div>');
@@ -766,16 +830,16 @@ $(function () {
766
830
  ccm_obj.on('show.bs.modal', function (e) {
767
831
  Util.show_loading();
768
832
  Util.post(location.pathname, {active_div: "client_action", action_type: 2}, function (j) {
769
- if (j["workers"]) {
770
- let worker_html = [];
771
- j["workers"].forEach(function (w) {
772
- worker_html.push("<option value='", w["machine_id"], "'>", w["ip"], "(", w["num"], ")</option>");
833
+ if (j["machines"]) {
834
+ let machine_html = [];
835
+ j["machines"].forEach(function (w) {
836
+ machine_html.push("<option value='", w["machine_id"], "'>", w["ip"], "(", w["num"], ")</option>");
773
837
  });
774
- let caw_obj = $("#client_cookie_worker");
775
- caw_obj.html(worker_html.join(""));
776
- let worker = $("#workers").val();
777
- if (worker) {
778
- caw_obj.find("option[value='" + worker + "']").attr("selected", true);
838
+ let caw_obj = $("#client_cookie_machine");
839
+ caw_obj.html(machine_html.join(""));
840
+ let machine = $("#machines").val();
841
+ if (machine) {
842
+ caw_obj.find("option[value='" + machine + "']").attr("selected", true);
779
843
  }
780
844
  }
781
845
  Util.hide_tips();
@@ -787,7 +851,7 @@ $(function () {
787
851
  Util.hide_tips();
788
852
  });
789
853
  $("#client_cookie_add").click(function() {
790
- let machine_id = $("#client_cookie_worker").val();
854
+ let machine_id = $("#client_cookie_machine").val();
791
855
  if (machine_id) {
792
856
  let client_cookie = $("#client_cookie_content").val();
793
857
  if (client_cookie) {
@@ -799,7 +863,7 @@ $(function () {
799
863
  if (j["code"] && j["code"] === 1) {
800
864
  $("#client_cookie_tips").html("<b class='text-success'>Cookie添加成功!</b>");
801
865
  } else if (j["code"] && j["code"] === 2) {
802
- $("#client_cookie_tips").html("<b class='text-danger'>Worker 不存在!</b>");
866
+ $("#client_cookie_tips").html("<b class='text-danger'>Machine 不存在!</b>");
803
867
  } else if (j["code"] && j["code"] === 3) {
804
868
  $("#client_cookie_tips").html("<b class='text-danger'>Cookie异常!</b>");
805
869
  } else {
@@ -811,12 +875,71 @@ $(function () {
811
875
  $("#client_cookie_tips").html("<b class='text-danger'>Cookie不能为空!</b>");
812
876
  }
813
877
  } else {
814
- $("#client_cookie_tips").html("<b class='text-danger'>Worker 异常!</b>");
878
+ $("#client_cookie_tips").html("<b class='text-danger'>Machine 异常!</b>");
815
879
  }
816
880
  return false;
817
881
  });
818
882
  },
819
883
 
884
+ init_word_modal: function () {
885
+ Util.init_modal_skeleton("word_modal");
886
+ $("#word_modal_title").html("单词修改");
887
+ let html = [];
888
+ html.push('<form data-parsley-validate class="form-horizontal form-label-left">');
889
+ html.push('<div class="form-group">');
890
+ html.push('<label class="control-label col-md-3 col-sm-3 col-xs-12" for="word_value">单词 </label>');
891
+ html.push('<div class="col-md-6 col-sm-6 col-xs-12">');
892
+ html.push('<input type="text" id="word_value" class="form-control col-md-7 col-xs-12">');
893
+ html.push('</div>');
894
+ html.push('</div>');
895
+ html.push('<div class="form-group">');
896
+ html.push('<label class="control-label col-md-3 col-sm-3 col-xs-12" for="word_chinese">中文 </label>');
897
+ html.push('<div class="col-md-6 col-sm-6 col-xs-12">');
898
+ html.push('<input type="text" id="word_chinese" class="form-control col-md-7 col-xs-12">');
899
+ html.push('</div>');
900
+ html.push('</div>');
901
+ html.push('<div class="form-group">');
902
+ html.push('<div class="col-md-6 col-sm-6 col-xs-12 col-md-offset-3">');
903
+ html.push('<button id="word_modify" type="button" class="btn btn-success">修 改</button>');
904
+ html.push('<span id="word_tips"></span>');
905
+ html.push('</div>');
906
+ html.push('</div>');
907
+ html.push('</form>');
908
+ let wmb_obj = $("#word_modal_body");
909
+ wmb_obj.html(html.join(""));
910
+ wmb_obj.parent().parent().removeClass("modal-xlg");
911
+ let wm_obj = $('#word_modal');
912
+ wm_obj.on('show.bs.modal', function (e) {
913
+ let tr_obj = $(e.relatedTarget).parent().parent();
914
+ let word = $(tr_obj).children('td').eq(1).text();
915
+ $("#word_value").val(word).attr('readonly', true);
916
+ $("#word_chinese").val($(tr_obj).children('td').eq(2).text());
917
+ $("#word_modify").off("click").click(function () {
918
+ let chinese = $("#word_chinese").val();
919
+ if (chinese) {
920
+ Util.post(location.pathname, {"active_div": "word_modify", "word": word, "chinese": chinese}, function (j) {
921
+ if (j["code"] && j["code"] === 1) {
922
+ $("#word_chinese").val(j["chinese"]);
923
+ $(tr_obj).children('td').eq(2).html(j["chinese"]);
924
+ $("#word_tips").html("<b class='text-success'>修改成功!</b>");
925
+ } else if (j["code"] && j["code"] === 2) {
926
+ $("#word_tips").html("<b class='text-danger'>中文有误!</b>");
927
+ } else {
928
+ $("#word_tips").html("<b class='text-danger'>修改失败!</b>");
929
+ }
930
+ });
931
+ } else {
932
+ $("#word_tips").html("<b class='text-danger'>中文不能为空!</b>");
933
+ }
934
+ return false;
935
+ });
936
+ });
937
+ wm_obj.on('hidden.bs.modal', function () {
938
+ $("#word_tips").html("");
939
+ Util.hide_tips();
940
+ });
941
+ },
942
+
820
943
  handle_tool: function () {
821
944
  let t_obj = $("#timestamp");
822
945
  let t_val = t_obj.val();
package/util.js CHANGED
@@ -95,7 +95,7 @@ const Util = {
95
95
  Util.save_page_content_image(element);
96
96
  });
97
97
 
98
- $('#stock').keyup(function () {
98
+ $("#stock").on("focus keyup", function () {
99
99
  let key_word = $(this).val();
100
100
  if (key_word) {
101
101
  if (Util.is_has_chinese(key_word) || (Util.is_alpha(key_word) && key_word.length >= 2) || ($.isNumeric(key_word) && key_word.length >= 3)) {
@@ -173,9 +173,7 @@ const Util = {
173
173
  html.push('<a href="#" class="list-group-item disabled">无数据</a>');
174
174
  }
175
175
  html.push('</div>');
176
- let st_obj = $("#search-tips");
177
- st_obj.html(html.join(""));
178
- st_obj.css("display", "block");
176
+ $("#search-tips").html(html.join("")).css("display", "block");
179
177
  Util.hide_tips();
180
178
  } else {
181
179
  Util.hide_tips();