sbd-npm 1.4.27 → 1.4.29

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 (2) hide show
  1. package/package.json +1 -1
  2. package/status.js +111 -19
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sbd-npm",
3
- "version": "1.4.27",
3
+ "version": "1.4.29",
4
4
  "description": "Stock Big Data",
5
5
  "author": "DHQ <dhq314@gmail.com>",
6
6
  "license": "ISC",
package/status.js CHANGED
@@ -510,13 +510,13 @@ $(function () {
510
510
  if (!document.getElementById("task_result")) {
511
511
  $("#task_result_zone").html('<textarea rows="20" id="task_result" class="form-control"></textarea>');
512
512
  }
513
- let tr_obj = $("#task_result");
514
513
  if (j["result"]) {
514
+ let tr_obj = $("#task_result");
515
515
  tr_obj.val(j["result"]);
516
516
  tr_obj.scrollTop(tr_obj[0].scrollHeight);
517
517
  } else {
518
518
  if (j["code"] !== 4) {
519
- tr_obj.val("任务 `" + j["content"] + "` 处理中...");
519
+ $("#task_result").val("任务 `" + j["content"] + "` 处理中...");
520
520
  }
521
521
  }
522
522
  } else {
@@ -554,16 +554,18 @@ $(function () {
554
554
  Status.init_client_action_modal();
555
555
  Status.init_client_cookie_modal();
556
556
  $("#machine_refresh").click(function() {
557
- Util.show_loading();
558
- $("#machine_refresh").attr("disabled", true).html("正在处理中...");
559
- Util.post(location.pathname, {active_div: "machine_refresh"}, function (j) {
560
- setTimeout(function () {
561
- $('#machines').html('<option value="">暂无Machine</option>');
562
- $("#machine_refresh").html("刷新Machine").attr("disabled", false);
563
- Util.hide_tips();
564
- Util.show_tips("刷新成功", 3456, "alert-success");
565
- }, 2345);
566
- });
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
+ }
567
569
  return false;
568
570
  });
569
571
  }
@@ -642,7 +644,7 @@ $(function () {
642
644
  } else {
643
645
  word_html.push('<form class="form-inline">');
644
646
  }
645
- word_html.push('<a href="#" id="word_previous" class="btn btn-warning">前一天WORD</a>');
647
+ word_html.push('<a href="#" data-toggle="modal" data-target=".word_modal" id="word_random" class="btn btn-warning">RANDOM</a>');
646
648
  word_html.push('</form>');
647
649
  word_html.push('<div id="word_process_div"></div>');
648
650
  $("#word_div").html(word_html.join(""));
@@ -657,21 +659,38 @@ $(function () {
657
659
  {"name": "操作"},
658
660
  ]
659
661
  });
662
+ Status.init_word_modal();
660
663
  }
661
664
  Util.post(location.pathname, {active_div: localStorage[Status.tab_token]}, function (j) {
662
665
  let html = [], index = 0;
666
+ let is_mobile = Util.is_mobile();
663
667
  j["data"].forEach(function (item) {
664
668
  index++;
665
669
  html.push("<tr>");
666
670
  html.push("<td>", index, "</td>");
667
671
  html.push("<td>", Util.pack_html_link("https://cn.bing.com/dict/search?q=" + item["word"], item["word"]), "</td>");
668
- html.push("<td>", item["chinese"], "</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
+ }
669
677
  html.push("<td>", Util.seconds_to_format(item["date"]), "</td>");
670
- html.push("<td><a href='#'>修改</a> &nbsp; <a href='#'>删除</a></td>");
678
+ html.push("<td><a href='#' data-toggle='modal' data-target='.word_modal'>修改</a> &nbsp; <a class='word_del' href='#'>删除</a></td>");
671
679
  html.push("</tr>");
672
680
  });
673
681
  Util.render_table_html("word_process_div_body", html);
674
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
+ });
675
694
  Util.hide_tips();
676
695
  });
677
696
  },
@@ -682,7 +701,7 @@ $(function () {
682
701
  let html = [];
683
702
  html.push('<form data-parsley-validate class="form-horizontal form-label-left">');
684
703
  html.push('<div class="form-group" id="action_machine_div">');
685
- html.push('<label class="control-label col-md-3 col-sm-3 col-xs-12" for="search_ip">Machine </label>');
704
+ html.push('<label class="control-label col-md-3 col-sm-3 col-xs-12">Machine </label>');
686
705
  html.push('<div class="col-md-6 col-sm-6 col-xs-12">');
687
706
  html.push('<select id="client_action_machine" class="form-control col-md-7 col-xs-12">');
688
707
  html.push('<option value="">Loading...</option>');
@@ -690,7 +709,7 @@ $(function () {
690
709
  html.push('</div>');
691
710
  html.push('</div>');
692
711
  html.push('<div class="form-group">');
693
- 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>');
694
713
  html.push('<div class="col-md-6 col-sm-6 col-xs-12">');
695
714
  html.push('<select id="client_action_content" class="form-control col-md-7 col-xs-12">');
696
715
  html.push('<option value="">任务命令</option>');
@@ -784,7 +803,7 @@ $(function () {
784
803
  let html = [];
785
804
  html.push('<form data-parsley-validate class="form-horizontal form-label-left">');
786
805
  html.push('<div class="form-group" id="action_machine_div">');
787
- html.push('<label class="control-label col-md-3 col-sm-3 col-xs-12" for="search_ip">Machine </label>');
806
+ html.push('<label class="control-label col-md-3 col-sm-3 col-xs-12">Machine </label>');
788
807
  html.push('<div class="col-md-6 col-sm-6 col-xs-12">');
789
808
  html.push('<select id="client_cookie_machine" class="form-control col-md-7 col-xs-12">');
790
809
  html.push('<option value="">Loading...</option>');
@@ -792,7 +811,7 @@ $(function () {
792
811
  html.push('</div>');
793
812
  html.push('</div>');
794
813
  html.push('<div class="form-group">');
795
- 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>');
796
815
  html.push('<div class="col-md-6 col-sm-6 col-xs-12">');
797
816
  html.push('<textarea class="form-control" rows="10" id="client_cookie_content"></textarea>');
798
817
  html.push('</div>');
@@ -862,6 +881,79 @@ $(function () {
862
881
  });
863
882
  },
864
883
 
884
+ init_word_modal: function () {
885
+ Util.init_modal_skeleton("word_modal");
886
+ let html = [];
887
+ html.push('<form data-parsley-validate class="form-horizontal form-label-left">');
888
+ html.push('<div class="form-group">');
889
+ html.push('<label class="control-label col-md-3 col-sm-3 col-xs-12" for="word_value">单词 </label>');
890
+ html.push('<div class="col-md-6 col-sm-6 col-xs-12">');
891
+ html.push('<input type="text" id="word_value" class="form-control col-md-7 col-xs-12">');
892
+ html.push('</div>');
893
+ html.push('</div>');
894
+ html.push('<div class="form-group">');
895
+ html.push('<label class="control-label col-md-3 col-sm-3 col-xs-12" for="word_chinese">中文 </label>');
896
+ html.push('<div class="col-md-6 col-sm-6 col-xs-12">');
897
+ html.push('<input type="text" id="word_chinese" class="form-control col-md-7 col-xs-12">');
898
+ html.push('</div>');
899
+ html.push('</div>');
900
+ html.push('<div class="form-group">');
901
+ html.push('<div class="col-md-6 col-sm-6 col-xs-12 col-md-offset-3">');
902
+ html.push('<button id="word_modify" type="button" class="btn btn-success">修 改</button>');
903
+ html.push('<span id="word_tips"></span>');
904
+ html.push('</div>');
905
+ html.push('</div>');
906
+ html.push('</form>');
907
+ let wmb_obj = $("#word_modal_body");
908
+ wmb_obj.html(html.join(""));
909
+ wmb_obj.parent().parent().removeClass("modal-xlg");
910
+ let wm_obj = $('#word_modal');
911
+ wm_obj.on('show.bs.modal', function (e) {
912
+ if ($(e.relatedTarget).attr("id") === "word_random") {
913
+ $("#word_modal_title").html("随机单词");
914
+ $('#word_modify').css('display', 'none');
915
+ $("#word_value").val("Loading...").attr('readonly', true);
916
+ $("#word_chinese").val("Loading...");
917
+ Util.post(location.pathname, {"active_div": "word_random"}, function (j) {
918
+ if (j["word"]) {
919
+ $("#word_value").val(j["word"]);
920
+ $("#word_chinese").val(j["chinese"]);
921
+ }
922
+ });
923
+ } else {
924
+ $("#word_modal_title").html("单词修改");
925
+ $('#word_modify').css('display', 'inline');
926
+ let tr_obj = $(e.relatedTarget).parent().parent();
927
+ let word = $(tr_obj).children('td').eq(1).text();
928
+ $("#word_value").val(word).attr('readonly', true);
929
+ $("#word_chinese").val($(tr_obj).children('td').eq(2).text());
930
+ $("#word_modify").off("click").click(function () {
931
+ let chinese = $("#word_chinese").val();
932
+ if (chinese) {
933
+ Util.post(location.pathname, {"active_div": "word_modify", "word": word, "chinese": chinese}, function (j) {
934
+ if (j["code"] && j["code"] === 1) {
935
+ $("#word_chinese").val(j["chinese"]);
936
+ $(tr_obj).children('td').eq(2).html(j["chinese"]);
937
+ $("#word_tips").html("<b class='text-success'>修改成功!</b>");
938
+ } else if (j["code"] && j["code"] === 2) {
939
+ $("#word_tips").html("<b class='text-danger'>中文有误!</b>");
940
+ } else {
941
+ $("#word_tips").html("<b class='text-danger'>修改失败!</b>");
942
+ }
943
+ });
944
+ } else {
945
+ $("#word_tips").html("<b class='text-danger'>中文不能为空!</b>");
946
+ }
947
+ return false;
948
+ });
949
+ }
950
+ });
951
+ wm_obj.on('hidden.bs.modal', function () {
952
+ $("#word_tips").html("");
953
+ Util.hide_tips();
954
+ });
955
+ },
956
+
865
957
  handle_tool: function () {
866
958
  let t_obj = $("#timestamp");
867
959
  let t_val = t_obj.val();