sbd-npm 1.4.29 → 1.4.31

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 +30 -6
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sbd-npm",
3
- "version": "1.4.29",
3
+ "version": "1.4.31",
4
4
  "description": "Stock Big Data",
5
5
  "author": "DHQ <dhq314@gmail.com>",
6
6
  "license": "ISC",
package/status.js CHANGED
@@ -637,14 +637,19 @@ $(function () {
637
637
  },
638
638
 
639
639
  handle_word: function() {
640
+ let is_init = 0;
640
641
  if (!document.getElementById("word_process_div")) {
642
+ is_init = 1;
641
643
  let word_html = [];
642
644
  if (Util.is_mobile()) {
643
645
  word_html.push('<form class="form-inline" style="margin-bottom: 5px;">');
644
646
  } else {
645
647
  word_html.push('<form class="form-inline">');
646
648
  }
647
- word_html.push('<a href="#" data-toggle="modal" data-target=".word_modal" id="word_random" class="btn btn-warning">RANDOM</a>');
649
+ word_html.push('<div class="form-group">');
650
+ word_html.push('<select id="word_day_num" class="form-control"><option value="">Loading...</option></select>');
651
+ word_html.push('</div>');
652
+ word_html.push('&nbsp;<a href="#" data-toggle="modal" data-target=".word_modal" id="word_random" class="btn btn-warning">RANDOM</a>');
648
653
  word_html.push('</form>');
649
654
  word_html.push('<div id="word_process_div"></div>');
650
655
  $("#word_div").html(word_html.join(""));
@@ -661,7 +666,12 @@ $(function () {
661
666
  });
662
667
  Status.init_word_modal();
663
668
  }
664
- Util.post(location.pathname, {active_div: localStorage[Status.tab_token]}, function (j) {
669
+ Status.fetch_word_data(is_init, "");
670
+ },
671
+
672
+ fetch_word_data: function(is_init, day) {
673
+ Util.show_loading();
674
+ Util.post(location.pathname, {active_div: localStorage[Status.tab_token], is_init: is_init, day: day}, function (j) {
665
675
  let html = [], index = 0;
666
676
  let is_mobile = Util.is_mobile();
667
677
  j["data"].forEach(function (item) {
@@ -680,6 +690,19 @@ $(function () {
680
690
  });
681
691
  Util.render_table_html("word_process_div_body", html);
682
692
  $("#word_num").html("共 <span class='label label-info'>" + index + "</span> 条");
693
+ if (j["day_num"]) {
694
+ let day_num_html = [];
695
+ day_num_html.push('<option value="">全部</option>');
696
+ j["day_num"].forEach(function (item) {
697
+ day_num_html.push('<option value="', item["day"], '">', item["day"], '(', item["num"], ')</option>');
698
+ });
699
+ let wdn_obj = $("#word_day_num");
700
+ wdn_obj.html(day_num_html.join(""));
701
+ wdn_obj.change(function() {
702
+ let day = $("#word_day_num").val();
703
+ Status.fetch_word_data(0, day);
704
+ });
705
+ }
683
706
  $(".word_del").each(function () {
684
707
  $(this).click(function () {
685
708
  let tr_obj = $(this).parent().parent();
@@ -913,20 +936,21 @@ $(function () {
913
936
  $("#word_modal_title").html("随机单词");
914
937
  $('#word_modify').css('display', 'none');
915
938
  $("#word_value").val("Loading...").attr('readonly', true);
916
- $("#word_chinese").val("Loading...");
939
+ $("#word_chinese").val("Loading...").attr('readonly', true);
917
940
  Util.post(location.pathname, {"active_div": "word_random"}, function (j) {
918
941
  if (j["word"]) {
919
942
  $("#word_value").val(j["word"]);
920
943
  $("#word_chinese").val(j["chinese"]);
944
+ $("#word_modal_title").html(Util.pack_html_link("https://cn.bing.com/dict/search?q=" + j["word"], "随机单词"));
921
945
  }
922
946
  });
923
947
  } else {
924
- $("#word_modal_title").html("单词修改");
925
- $('#word_modify').css('display', 'inline');
926
948
  let tr_obj = $(e.relatedTarget).parent().parent();
927
949
  let word = $(tr_obj).children('td').eq(1).text();
950
+ $("#word_modal_title").html(Util.pack_html_link("https://cn.bing.com/dict/search?q=" + word, "单词修改"));
951
+ $('#word_modify').css('display', 'inline');
928
952
  $("#word_value").val(word).attr('readonly', true);
929
- $("#word_chinese").val($(tr_obj).children('td').eq(2).text());
953
+ $("#word_chinese").val($(tr_obj).children('td').eq(2).text()).attr('readonly', false);
930
954
  $("#word_modify").off("click").click(function () {
931
955
  let chinese = $("#word_chinese").val();
932
956
  if (chinese) {