sbd-npm 1.4.42 → 1.4.44

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sbd-npm",
3
- "version": "1.4.42",
3
+ "version": "1.4.44",
4
4
  "description": "Stock Big Data",
5
5
  "author": "DHQ <dhq314@gmail.com>",
6
6
  "license": "ISC",
package/status.js CHANGED
@@ -634,20 +634,21 @@ $(function () {
634
634
  machine_html.push('</select>');
635
635
  machine_html.push('</div>');
636
636
  machine_html.push('&nbsp;&nbsp;<a href="#" data-toggle="modal" data-target=".machine_action_modal" data-type="2" class="btn btn-warning">添加任务</a>');
637
- machine_html.push('<a href="#" data-toggle="modal" data-target=".client_cookie_modal" class="btn btn-warning">雪球Cookie</a>');
637
+ machine_html.push('<a href="#" data-toggle="modal" data-target=".machine_cookie_modal" class="btn btn-warning">雪球Cookie</a>');
638
638
  machine_html.push('<a href="#" id="machine_refresh" class="btn btn-warning">刷新Machine</a>');
639
639
  machine_html.push('</form>');
640
640
  machine_html.push('<div id="machine_process_div"></div>');
641
641
  $("#machine_div").html(machine_html.join(""));
642
642
  if (!document.getElementById("machine_action_add")) {
643
643
  Status.init_machine_action_modal();
644
- Status.init_client_cookie_modal();
644
+ Status.init_machine_cookie_modal();
645
645
  $("#machine_refresh").click(function() {
646
646
  if (confirm("是否确定要“ 刷新Machine ” ?")) {
647
647
  Util.show_loading();
648
648
  $("#machine_refresh").attr("disabled", true).html("正在处理中...");
649
649
  Util.post(location.pathname, {active_div: "machine_refresh"}, function (j) {
650
650
  setTimeout(function () {
651
+ $('#machine_process_div').html('');
651
652
  $('#machines').html('<option value="">暂无Machine</option>');
652
653
  $("#machine_refresh").html("刷新Machine").attr("disabled", false);
653
654
  Util.hide_tips();
@@ -738,16 +739,20 @@ $(function () {
738
739
  html.push('</form>');
739
740
  html.push('<div id="word_process_div"></div>');
740
741
  $("#word_div").html(html.join(""));
742
+ let head_cols = [
743
+ {"name": "序号", "table_sort": 1},
744
+ {"name": "单词", "table_sort": 1},
745
+ {"name": "中文"},
746
+ {"name": "时间", "table_sort": 1},
747
+ ];
748
+ if ('speechSynthesis' in window) {
749
+ head_cols.push({"name": "朗读"});
750
+ }
751
+ head_cols.push({"name": "操作"});
741
752
  Util.init_table_skeleton({
742
753
  "element_id": "word_process_div",
743
754
  "caption": '<caption class="' + (is_mobile ? "text-left" : "text-right") + '" id="word_num"></caption>',
744
- "head_cols": [
745
- {"name": "序号", "table_sort": 1},
746
- {"name": "单词", "table_sort": 1},
747
- {"name": "中文"},
748
- {"name": "时间", "table_sort": 1},
749
- {"name": "操作"},
750
- ]
755
+ "head_cols": head_cols
751
756
  });
752
757
  Status.init_word_modal();
753
758
  }
@@ -851,78 +856,78 @@ $(function () {
851
856
  });
852
857
  },
853
858
 
854
- init_client_cookie_modal: function () {
855
- Util.init_modal_skeleton("client_cookie_modal");
856
- $("#client_cookie_modal_title").html("雪球Cookie");
859
+ init_machine_cookie_modal: function () {
860
+ Util.init_modal_skeleton("machine_cookie_modal");
861
+ $("#machine_cookie_modal_title").html("雪球Cookie");
857
862
  let html = [];
858
863
  html.push('<form data-parsley-validate class="form-horizontal form-label-left">');
859
864
  html.push('<div class="form-group" id="action_machine_div">');
860
865
  html.push('<label class="control-label col-md-3 col-sm-3 col-xs-12">Machine </label>');
861
866
  html.push('<div class="col-md-6 col-sm-6 col-xs-12">');
862
- html.push('<select id="client_cookie_machine" class="form-control col-md-7 col-xs-12">');
867
+ html.push('<select id="machine_cookie_machine" class="form-control col-md-7 col-xs-12">');
863
868
  html.push('<option value="">Loading...</option>');
864
869
  html.push('</select>');
865
870
  html.push('</div>');
866
871
  html.push('</div>');
867
872
  html.push('<div class="form-group">');
868
- html.push('<label class="control-label col-md-3 col-sm-3 col-xs-12" for="client_cookie_content">Cookie </label>');
873
+ html.push('<label class="control-label col-md-3 col-sm-3 col-xs-12" for="machine_cookie_content">Cookie </label>');
869
874
  html.push('<div class="col-md-6 col-sm-6 col-xs-12">');
870
- html.push('<textarea class="form-control" rows="10" id="client_cookie_content"></textarea>');
875
+ html.push('<textarea class="form-control" rows="10" id="machine_cookie_content"></textarea>');
871
876
  html.push('</div>');
872
877
  html.push('</div>');
873
878
  html.push('<div class="form-group">');
874
879
  html.push('<div class="col-md-6 col-sm-6 col-xs-12 col-md-offset-3">');
875
- html.push('<button id="client_cookie_add" type="button" class="btn btn-success">添 加</button>');
876
- html.push('<span id="client_cookie_tips"></span>');
880
+ html.push('<button id="machine_cookie_add" type="button" class="btn btn-success">添 加</button>');
881
+ html.push('<span id="machine_cookie_tips"></span>');
877
882
  html.push('</div>');
878
883
  html.push('</div>');
879
884
  html.push('</form>');
880
- let ccmb_obj = $("#client_cookie_modal_body");
885
+ let ccmb_obj = $("#machine_cookie_modal_body");
881
886
  ccmb_obj.html(html.join(""));
882
887
  ccmb_obj.parent().parent().removeClass("modal-xlg");
883
- let ccm_obj = $('#client_cookie_modal');
888
+ let ccm_obj = $('#machine_cookie_modal');
884
889
  ccm_obj.on('show.bs.modal', function (e) {
885
890
  Util.show_loading();
886
891
  Util.post(location.pathname, {active_div: "machine_action", action_type: 2}, function (j) {
887
892
  if (j["machines"]) {
888
- Status.pack_machine_component("client_cookie_machine", j["machines"]);
893
+ Status.pack_machine_component("machine_cookie_machine", j["machines"]);
889
894
  let machine = $("#machines").val();
890
895
  if (machine) {
891
- $("#client_cookie_machine").find("option[value='" + machine + "']").attr("selected", true);
896
+ $("#machine_cookie_machine").find("option[value='" + machine + "']").attr("selected", true);
892
897
  }
893
898
  }
894
899
  Util.hide_tips();
895
900
  });
896
901
  });
897
902
  ccm_obj.on('hidden.bs.modal', function () {
898
- $("#client_cookie_content").val("");
899
- $("#client_cookie_tips").html("");
903
+ $("#machine_cookie_content").val("");
904
+ $("#machine_cookie_tips").html("");
900
905
  Util.hide_tips();
901
906
  });
902
- $("#client_cookie_add").click(function() {
903
- let machine_id = $("#client_cookie_machine").val();
907
+ $("#machine_cookie_add").click(function() {
908
+ let machine_id = $("#machine_cookie_machine").val();
904
909
  if (machine_id) {
905
- let client_cookie = $("#client_cookie_content").val();
906
- if (client_cookie) {
910
+ let machine_cookie = $("#machine_cookie_content").val();
911
+ if (machine_cookie) {
907
912
  Util.show_loading();
908
- $("#client_cookie_tips").html("");
909
- $("#client_cookie_add").attr("disabled", true);
910
- Util.post(location.pathname, {active_div: "client_cookie_add", "machine_id": machine_id, "cookie": client_cookie}, function (j) {
911
- $("#client_cookie_add").attr("disabled", false);
913
+ $("#machine_cookie_tips").html("");
914
+ $("#machine_cookie_add").attr("disabled", true);
915
+ Util.post(location.pathname, {active_div: "machine_cookie_add", "machine_id": machine_id, "cookie": machine_cookie}, function (j) {
916
+ $("#machine_cookie_add").attr("disabled", false);
912
917
  if (j["code"] && j["code"] === 1) {
913
- $("#client_cookie_tips").html("<b class='text-success'>Cookie添加成功!</b>");
918
+ $("#machine_cookie_tips").html("<b class='text-success'>Cookie添加成功!</b>");
914
919
  } else if (j["code"] && j["code"] === 2) {
915
- $("#client_cookie_tips").html("<b class='text-danger'>Machine 不存在!</b>");
920
+ $("#machine_cookie_tips").html("<b class='text-danger'>Machine 不存在!</b>");
916
921
  } else {
917
- $("#client_cookie_tips").html("<b class='text-danger'>Cookie异常!</b>");
922
+ $("#machine_cookie_tips").html("<b class='text-danger'>Cookie异常!</b>");
918
923
  }
919
924
  Util.hide_tips();
920
925
  });
921
926
  } else {
922
- $("#client_cookie_tips").html("<b class='text-danger'>Cookie不能为空!</b>");
927
+ $("#machine_cookie_tips").html("<b class='text-danger'>Cookie不能为空!</b>");
923
928
  }
924
929
  } else {
925
- $("#client_cookie_tips").html("<b class='text-danger'>Machine 异常!</b>");
930
+ $("#machine_cookie_tips").html("<b class='text-danger'>Machine 异常!</b>");
926
931
  }
927
932
  return false;
928
933
  });
@@ -1051,19 +1056,26 @@ $(function () {
1051
1056
  }
1052
1057
  if (match_ip_data) {
1053
1058
  Util.show_loading();
1059
+ ip = match_ip_data[0];
1054
1060
  $("#ip").prop('disabled', true);
1055
1061
  $("#ip_query").attr("disabled", true);
1056
- ip = match_ip_data[0];
1057
- $("#ip").val(ip);
1058
1062
  Util.post("/action", {action: "ip_query", ip: ip}, function (j) {
1059
1063
  $("#ip").prop('disabled', false);
1060
1064
  $("#ip_query").attr("disabled", false);
1061
1065
  if (j["ip"]) {
1066
+ if (j["domain"]) {
1067
+ let domain = $("#ip").val().trim();
1068
+ j["domain"] = domain ? domain : j["domain"];
1069
+ }
1062
1070
  $("#ip").val(j["ip"]);
1063
1071
  let ip_address = Status.convert_ip_address(j);
1064
1072
  if (ip_address.length > 0) {
1065
1073
  let map_url = Status.map_url(ip_address, "<i class='glyphicon glyphicon-map-marker'></i>");
1066
- $("#ip_result").html(Util.pack_html_link(Status.ip_url(j["ip"]), "<b class='text-success'>" + ip_address + "</b>") + "&nbsp;&nbsp;" + map_url);
1074
+ let ip_result = Util.pack_html_link(Status.ip_url(j["ip"]), "<b class='text-success'>" + ip_address + "</b>") + "&nbsp;&nbsp;" + map_url;
1075
+ if (j["domain"]) {
1076
+ ip_result += "<br><br>" + Util.pack_html_link(j["domain"], "<b>" + j["domain"] + "</b>");
1077
+ }
1078
+ $("#ip_result").html(ip_result);
1067
1079
  } else {
1068
1080
  $("#ip_result").html(Util.pack_html_link(Status.ip_url(ip), "<b class='text-danger'>找不到结果!</b>"));
1069
1081
  }
@@ -1083,7 +1095,7 @@ $(function () {
1083
1095
  Status.phone_query();
1084
1096
  });
1085
1097
  $("#md5_encrypt").click(function () {
1086
- let md5 = $("#md5").val();
1098
+ let md5 = $("#md5").val().trim();
1087
1099
  if (md5) {
1088
1100
  Util.show_loading();
1089
1101
  $("#md5").prop('disabled', true);
@@ -1099,7 +1111,7 @@ $(function () {
1099
1111
  }
1100
1112
  });
1101
1113
  $("#base64_action").click(function () {
1102
- let base64 = $("#base64").val();
1114
+ let base64 = $("#base64").val().trim();
1103
1115
  if (base64) {
1104
1116
  if ($(this).text() === "编 码") {
1105
1117
  $("#base64_result").html("<b class='text-success'>" + Util.base64_encode(base64) + "</b>");
@@ -1114,7 +1126,7 @@ $(function () {
1114
1126
  $("#base64_action").text($(this).text());
1115
1127
  });
1116
1128
  $("#unicode_convert").click(function () {
1117
- let unicode_str = $("#unicode").val();
1129
+ let unicode_str = $("#unicode").val().trim();
1118
1130
  if (unicode_str) {
1119
1131
  try {
1120
1132
  let obj = JSON.parse('{"data": "' + unicode_str + '"}');
@@ -1127,7 +1139,7 @@ $(function () {
1127
1139
  }
1128
1140
  });
1129
1141
  $("#segment_parse").click(function () {
1130
- let segment_str = $("#segment").val();
1142
+ let segment_str = $("#segment").val().trim();
1131
1143
  if (segment_str) {
1132
1144
  try {
1133
1145
  let segmenter = new Intl.Segmenter("zh-CN", {granularity: "word"});
package/summary_daily.js CHANGED
@@ -534,7 +534,7 @@ $(function () {
534
534
  },
535
535
 
536
536
  render_market_overview_modal: function (obj) {
537
- let title = $.trim($(obj).text());
537
+ let title = $(obj).text().trim();
538
538
  $("#at_title").html("[" + title + "]数据");
539
539
  Util.set_table_loading("market_overview_load_status");
540
540
  if (Modal.mo_end_time === 0) {
package/util.js CHANGED
@@ -60,7 +60,7 @@ const Util = {
60
60
  $("[data-toggle='tooltip']").tooltip();
61
61
 
62
62
  $("#search-stock").click(function () {
63
- let code = $("#stock").val();
63
+ let code = $("#stock").val().trim();
64
64
  if (code) {
65
65
  if (window.location.pathname === "/status" && $("#word").hasClass('active') && (Util.is_alphabet(code) || Util.is_chinese(code))) {
66
66
  Util.fetch_word_data(0, "", code);
@@ -1658,6 +1658,7 @@ const Util = {
1658
1658
  Util.post(location.pathname, {active_div: "word", is_init: is_init, specify_day: specify_day, search_key: search_key}, function (j) {
1659
1659
  let html = [], index = 0;
1660
1660
  let is_mobile = Util.is_mobile();
1661
+ let is_speech_synthesis = 'speechSynthesis' in window ? 1 : 0;
1661
1662
  j["data"].forEach(function (item) {
1662
1663
  index++;
1663
1664
  html.push("<tr>");
@@ -1669,6 +1670,9 @@ const Util = {
1669
1670
  html.push("<td>", item["chinese"], "</td>");
1670
1671
  }
1671
1672
  html.push("<td>", Util.seconds_to_format(item["date"]), "</td>");
1673
+ if (is_speech_synthesis === 1) {
1674
+ html.push("<td class='word_utterance' style='cursor: pointer;'><i class='glyphicon glyphicon-volume-up'></i></td>");
1675
+ }
1672
1676
  html.push("<td><a href='#' data-toggle='modal' data-target='.word_modal'>修改</a> &nbsp; <a class='word_del' href='#'>删除</a></td>");
1673
1677
  html.push("</tr>");
1674
1678
  });
@@ -1687,7 +1691,23 @@ const Util = {
1687
1691
  Util.fetch_word_data(0, appoint_day, "");
1688
1692
  });
1689
1693
  }
1690
- $(".word_del").each(function () {
1694
+ if (is_speech_synthesis === 1) {
1695
+ $("#word_process_div_body .word_utterance").each(function () {
1696
+ $(this).click(function () {
1697
+ let word = $(this).parent().children('td').eq(1).text();
1698
+ if (word) {
1699
+ window.speechSynthesis.cancel(); // 清除队列
1700
+ let utterance = new SpeechSynthesisUtterance(word);
1701
+ utterance.lang = 'en-US'; // 设置语言为英语(美式英语)
1702
+ utterance.rate = 1; // 语速(0.1 到 10)
1703
+ utterance.volume = 1; // 音量(0 到 1)
1704
+ utterance.pitch = 1; // 音调(0 到 2)
1705
+ window.speechSynthesis.speak(utterance);
1706
+ }
1707
+ });
1708
+ });
1709
+ }
1710
+ $("#word_process_div_body .word_del").each(function () {
1691
1711
  $(this).click(function () {
1692
1712
  let tr_obj = $(this).parent().parent();
1693
1713
  let word = $(tr_obj).children('td').eq(1).text();
@@ -2947,11 +2967,7 @@ const Util = {
2947
2967
  if (!obj.hasClass("glyphicon-info-sign")) {
2948
2968
  obj.addClass("glyphicon-info-sign");
2949
2969
  }
2950
- obj.attr("data-original-title", tip);
2951
- obj.attr("data-toggle", "tooltip");
2952
- obj.attr("data-placement", "bottom");
2953
- obj.attr("data-container", "body");
2954
- obj.tooltip();
2970
+ obj.attr("data-original-title", tip).attr("data-toggle", "tooltip").attr("data-placement", "bottom").attr("data-container", "body").tooltip();
2955
2971
  },
2956
2972
 
2957
2973
  /**