sbd-npm 1.5.39 → 1.5.40

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/constant.js CHANGED
@@ -215,8 +215,8 @@ const MenuList = [
215
215
  {'key': 'us_buffett', 'name': '巴菲特持仓', 'url': '/0xe51dc830e90a6ca5bbae5d867ebd69d57aa85208'},
216
216
  {'key': 'us_biotechnology', 'name': '生物科技', 'url': '/0x88bee1b829887f7c2fbfeea7a3c60c330d477f62'},
217
217
  {'key': 'us_dollar_index', 'name': '美元指数', 'url': '/0x99533982f67f489dce7c0738c2e2a94239e35cde'},
218
- {'key': 'us_bond_yield', 'name': '美十年国债收益率', 'url': '/0xdf01c6a366340dce84867ca34e7dd6fc6ed5e631'},
219
- {'key': 'us_usd_cnh', 'name': '美元离岸人民币汇率', 'url': '/0x6010e54df39e6e00b255d6271d9972fb8c9faf11'},
218
+ {'key': 'us_bond_yield', 'name': '美十年国债收益', 'url': '/0xdf01c6a366340dce84867ca34e7dd6fc6ed5e631'},
219
+ {'key': 'us_usd_cnh', 'name': '美元人民币汇率', 'url': '/0x6010e54df39e6e00b255d6271d9972fb8c9faf11'},
220
220
  {'key': 'us_vix', 'name': 'VIX恐慌指数', 'url': '/0xc767b343d8a06290ca1593da8e20c14584ccd45b'},
221
221
  {'key': 'us_pe', 'name': '标普500历史PE', 'url': '/0x65702c301edb87adb7a5e99a02d4bd5500bd7c8e'},
222
222
  {'key': 'us_short_rank', 'name': '做空排行', 'url': '/0x2421be33e4e06950b6ff117fdf2e3b6822806f7a'}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sbd-npm",
3
- "version": "1.5.39",
3
+ "version": "1.5.40",
4
4
  "description": "Stock Big Data",
5
5
  "author": "DHQ <dhq314@gmail.com>",
6
6
  "license": "ISC",
package/snowball_tweet.js CHANGED
@@ -99,7 +99,8 @@ $(function () {
99
99
  html.push('<div class="form-group text-left">');
100
100
  j.data.forEach(function (item) {
101
101
  total_num += item.num;
102
- html.push('<a class="btn btn-default" data-val="', item.uid, '" style="margin-bottom: 10px;" href="#">', item.name, '(', item.num, ')</a>');
102
+ let item_num = (item.stock_num && item.stock_num > 0) ? item.stock_num : item.num;
103
+ html.push('<a class="btn btn-default" data-val="', item.uid, '" style="margin-bottom: 10px;" href="#">', item.name, '(', item_num, ')</a>');
103
104
  });
104
105
  html.push('</div>');
105
106
  html.push('<div class="form-group" style="margin: 10px 0;">');
@@ -333,8 +334,7 @@ $(function () {
333
334
 
334
335
  set_today_date: function() {
335
336
  let now = Util.now();
336
- let date = new Date();
337
- let hour = date.getHours();
337
+ let hour = new Date().getHours();
338
338
  let start_date = hour < 6 ? (now - Util.ONE_DAY_SECOND) : now;
339
339
  $('#tweet_start_date').data('daterangepicker').setStartDate(Util.seconds_to_format(start_date, "%Y-%m-%d"));
340
340
  $('#tweet_end_date').data('daterangepicker').setStartDate(Util.seconds_to_format(now, "%Y-%m-%d"));
package/status.js CHANGED
@@ -849,7 +849,7 @@ $(function () {
849
849
  {"name": "物理内存", "table_sort": 1, "title": "Resident Set Size(常驻内存,进程实际占用的物理内存)"},
850
850
  {"name": "启动命令"},
851
851
  {"name": "创建时间", "class": "info", "table_sort": 1},
852
- {"name": "操作"}
852
+ {"name": "操作", "id": "machine_action", "link": "#"}
853
853
  ]
854
854
  });
855
855
  }
@@ -1307,7 +1307,7 @@ $(function () {
1307
1307
  machines.forEach(function (m) {
1308
1308
  html.push("<option value='", m["machine_id"], "'>", m["ip"], "(", m["num"], ")</option>");
1309
1309
  });
1310
- $("#" + element_id).html(html.join(""));
1310
+ document.getElementById(element_id).innerHTML = html.join("");
1311
1311
  },
1312
1312
 
1313
1313
  init_word_modal: function () {
@@ -1333,9 +1333,7 @@ $(function () {
1333
1333
  html.push('</div>');
1334
1334
  html.push('</div>');
1335
1335
  html.push('</form>');
1336
- let wmb_object = $("#word_modal_body");
1337
- wmb_object.html(html.join(""));
1338
- wmb_object.parent().parent().removeClass("modal-xlg");
1336
+ $("#word_modal_body").html(html.join("")).parent().parent().removeClass("modal-xlg");
1339
1337
  let wm_object = $('#word_modal');
1340
1338
  wm_object.on('show.bs.modal', function (e) {
1341
1339
  if ($(e.relatedTarget).attr("id") === "word_random") {
@@ -1352,18 +1350,18 @@ $(function () {
1352
1350
  });
1353
1351
  } else {
1354
1352
  let tr_object = $(e.relatedTarget).parent().parent();
1355
- let word = $(tr_object).children('td').eq(1).text();
1353
+ let word = tr_object.children('td').eq(1).text();
1356
1354
  $("#word_modal_title").html(Util.pack_html_link("https://cn.bing.com/dict/search?q=" + word, "单词修改"));
1357
1355
  $('#word_modify').css('display', 'inline');
1358
1356
  $("#word_value").val(word).attr('readonly', true);
1359
- $("#word_chinese").val($(tr_object).children('td').eq(2).text()).attr('readonly', false);
1357
+ $("#word_chinese").val(tr_object.children('td').eq(2).text()).attr('readonly', false);
1360
1358
  $("#word_modify").off("click").click(function () {
1361
1359
  let chinese = $("#word_chinese").val();
1362
1360
  if (chinese) {
1363
1361
  Util.post(location.pathname, {"action": "word_modify", "word": word, "chinese": chinese}, function (j) {
1364
1362
  if (j.code === 1) {
1365
1363
  $("#word_chinese").val(j.chinese);
1366
- $(tr_object).children('td').eq(2).html(j.chinese);
1364
+ tr_object.children('td').eq(2).html(j.chinese);
1367
1365
  $("#word_tips").html("<b class='text-success'>修改成功!</b>");
1368
1366
  } else if (j.code === 2) {
1369
1367
  $("#word_tips").html("<b class='text-danger'>中文有误!</b>");
package/summary_daily.js CHANGED
@@ -598,8 +598,8 @@ $(function () {
598
598
 
599
599
  render_stock_rate_html: function() {
600
600
  let html = [], index = 0;
601
- let industry = $("#p_change_industry").val();
602
601
  let area = $("#p_change_area").val();
602
+ let industry = $("#p_change_industry").val();
603
603
  Modal["p_change_data"].forEach(function (item) {
604
604
  if (Util.is_industry_area(item, industry, area)) {
605
605
  index++;
package/util.js CHANGED
@@ -1052,9 +1052,9 @@ const Util = {
1052
1052
  if (html.length > 0) {
1053
1053
  document.getElementById(element_id).innerHTML = html.join("");
1054
1054
  } else {
1055
- let element_object = $("#" + element_id);
1056
- let td_num = element_object.parent().find('thead td').length;
1057
- element_object.html('<tr><td colspan="' + td_num + '">暂无数据</td></tr>');
1055
+ let element_object = document.getElementById(element_id);
1056
+ let td_num = element_object.closest('table').querySelectorAll('thead td').length;
1057
+ element_object.innerHTML = '<tr><td colspan="' + td_num + '">暂无数据</td></tr>';
1058
1058
  }
1059
1059
  },
1060
1060
 
@@ -1070,7 +1070,7 @@ const Util = {
1070
1070
  html.push('<option value="', i["id"], '">', i["industry"], '(', i["num"], ')</option>');
1071
1071
  });
1072
1072
  }
1073
- $("#" + element_id).html(html.join(""));
1073
+ document.getElementById(element_id).innerHTML = html.join("");
1074
1074
  },
1075
1075
 
1076
1076
  /**
@@ -1085,7 +1085,7 @@ const Util = {
1085
1085
  html.push('<option value="', a["area"], '">', a["area"], '(', a["num"], ')</option>');
1086
1086
  });
1087
1087
  }
1088
- $("#" + element_id).html(html.join(""));
1088
+ document.getElementById(element_id).innerHTML = html.join("");
1089
1089
  },
1090
1090
 
1091
1091
  /**
@@ -1094,10 +1094,12 @@ const Util = {
1094
1094
  * @param load_text
1095
1095
  */
1096
1096
  set_table_loading: function (element_id, load_text = "") {
1097
- let element_object = $("#" + element_id);
1098
- let td_num = element_object.parent().find('thead td').length;
1099
- load_text = load_text.length > 0 ? load_text : "Loading...";
1100
- element_object.html('<tr><td colspan="' + td_num + '">' + load_text + '</td></tr>');
1097
+ let element_object = document.getElementById(element_id);
1098
+ if (element_object) {
1099
+ let td_num = element_object.closest('table').querySelectorAll('thead td').length;
1100
+ load_text = load_text.length > 0 ? load_text : "Loading...";
1101
+ element_object.innerHTML = '<tr><td colspan="' + td_num + '">' + load_text + '</td></tr>';
1102
+ }
1101
1103
  },
1102
1104
 
1103
1105
  /**
@@ -1754,13 +1756,13 @@ const Util = {
1754
1756
  $("#word_process_div_body .word_del").each(function () {
1755
1757
  $(this).click(function () {
1756
1758
  let tr_object = $(this).parent().parent();
1757
- let word = $(tr_object).children('td').eq(1).text();
1758
- let word_chinese = $(tr_object).children('td').eq(2).text();
1759
+ let word = tr_object.children('td').eq(1).text();
1760
+ let word_chinese = tr_object.children('td').eq(2).text();
1759
1761
  word_chinese = "“ " + word + "「" + word_chinese + "」”";
1760
1762
  if (confirm("是否确定要删除 " + word_chinese + " ?")) {
1761
1763
  Util.show_loading();
1762
- Util.post(location.pathname, {"active_div": "word_del", "word": word}, function () {
1763
- $(tr_object).remove();
1764
+ Util.post(location.pathname, {"action": "word_del", "word": word}, function () {
1765
+ tr_object.remove();
1764
1766
  Util.hide_tips();
1765
1767
  Util.show_tips("删除 " + word_chinese + " 成功", 4567, "alert-success");
1766
1768
  });
@@ -2272,8 +2274,7 @@ const Util = {
2272
2274
  * @returns {*|number}
2273
2275
  */
2274
2276
  get_weekday: function () {
2275
- let date = new Date();
2276
- let weekday = date.getDay();
2277
+ let weekday = new Date().getDay();
2277
2278
  weekday = weekday > 0 ? weekday : 7; // 星期天是0
2278
2279
  return weekday;
2279
2280
  },
@@ -3572,43 +3573,6 @@ const Util = {
3572
3573
  Util.render_table_html("index_table_body", html);
3573
3574
  },
3574
3575
 
3575
- /**
3576
- * 设置 option 的第 nth 项为默认项
3577
- * @param obj
3578
- * @param nth
3579
- */
3580
- set_option_selected: function (obj, nth) {
3581
- let option_val = "";
3582
- obj.find("option").each(function () {
3583
- if (option_val === "" || nth >= 0) {
3584
- option_val = $(this).attr("value");
3585
- }
3586
- nth -= 1;
3587
- });
3588
- obj.val(option_val);
3589
- },
3590
-
3591
- /**
3592
- * 设置当年的第一个项为默认项
3593
- * @param obj
3594
- */
3595
- set_year_option_selected: function (obj) {
3596
- let date = new Date();
3597
- let year = date.getFullYear();
3598
- let option_val = "";
3599
- obj.find("option").each(function () {
3600
- let o_val = $(this).attr("value");
3601
- if (year === parseInt(o_val.split('-')[0])) {
3602
- option_val = o_val
3603
- }
3604
- });
3605
- if (option_val !== "") {
3606
- obj.val(option_val);
3607
- } else {
3608
- Util.set_option_selected(obj, 100);
3609
- }
3610
- },
3611
-
3612
3576
  /**
3613
3577
  * 初始日期范围选择器
3614
3578
  * @param element_id
@@ -3651,7 +3615,7 @@ const Util = {
3651
3615
  html.push('<span class="fa fa-calendar-o form-control-feedback left" aria-hidden="true"></span>');
3652
3616
  html.push('</div>');
3653
3617
  html.push('</div>');
3654
- $("#" + element_id).html(html.join(""));
3618
+ document.getElementById(element_id).innerHTML = html.join("");
3655
3619
  Util.init_range_picker_date(start_id, end_id, nth_day);
3656
3620
  Util.init_time_select_range(Obj, select_id, start_id, end_id, callback_func);
3657
3621
  },