sbd-npm 1.4.28 → 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 +39 -25
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sbd-npm",
3
- "version": "1.4.28",
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
@@ -644,7 +644,7 @@ $(function () {
644
644
  } else {
645
645
  word_html.push('<form class="form-inline">');
646
646
  }
647
- 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>');
648
648
  word_html.push('</form>');
649
649
  word_html.push('<div id="word_process_div"></div>');
650
650
  $("#word_div").html(word_html.join(""));
@@ -883,7 +883,6 @@ $(function () {
883
883
 
884
884
  init_word_modal: function () {
885
885
  Util.init_modal_skeleton("word_modal");
886
- $("#word_modal_title").html("单词修改");
887
886
  let html = [];
888
887
  html.push('<form data-parsley-validate class="form-horizontal form-label-left">');
889
888
  html.push('<div class="form-group">');
@@ -910,29 +909,44 @@ $(function () {
910
909
  wmb_obj.parent().parent().removeClass("modal-xlg");
911
910
  let wm_obj = $('#word_modal');
912
911
  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
- });
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
+ }
936
950
  });
937
951
  wm_obj.on('hidden.bs.modal', function () {
938
952
  $("#word_tips").html("");