sbd-npm 1.4.62 → 1.4.63

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 (3) hide show
  1. package/package.json +1 -1
  2. package/status.js +19 -4
  3. package/util.js +1 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sbd-npm",
3
- "version": "1.4.62",
3
+ "version": "1.4.63",
4
4
  "description": "Stock Big Data",
5
5
  "author": "DHQ <dhq314@gmail.com>",
6
6
  "license": "ISC",
package/status.js CHANGED
@@ -545,7 +545,7 @@ $(function () {
545
545
  $("#task_add").click(function() {
546
546
  let task_content = $("#task_content").val();
547
547
  task_content = task_content.replace(/[^\w\u4e00-\u9fff-]/g, ''); // 去掉除字母、数字、下划线(_)、汉字、横杠(-)外的其他字符(䒚 /[^\w\u3400-\u9fff\u{20000}-\u{2EBEF}]/gu)
548
- if (task_content && task_content.length > 0) {
548
+ if (Status.check_task_content(task_content)) {
549
549
  $("#task_content").prop('disabled', true);
550
550
  $("#task_add").prop('disabled', true);
551
551
  Util.show_loading();
@@ -583,8 +583,6 @@ $(function () {
583
583
  }
584
584
  Util.hide_tips();
585
585
  });
586
- } else {
587
- $("#task_tips").html("<b class='text-danger'>任务内容不能为空!</b>");
588
586
  }
589
587
  return false;
590
588
  });
@@ -600,6 +598,23 @@ $(function () {
600
598
  Status.fetch_task_data(is_init);
601
599
  },
602
600
 
601
+ check_task_content: function(task_content) {
602
+ if (task_content && task_content.length > 0) {
603
+ let task_tips = $("#task_tips").text().trim();
604
+ if (task_tips.length > 0) {
605
+ let tips_match = task_tips.match(/^任务\s`(.+?)`\sDONE$/);
606
+ if (tips_match && tips_match[1] === task_content) {
607
+ Util.show_tips("任务 `" + tips_match[1] + "` 已经执行过", 3456, "alert-danger");
608
+ return false;
609
+ }
610
+ }
611
+ return true;
612
+ } else {
613
+ $("#task_tips").html("<b class='text-danger'>任务内容不能为空!</b>");
614
+ return false;
615
+ }
616
+ },
617
+
603
618
  fetch_task_data: function(is_init = 0) {
604
619
  let machine_id = $("#task_machines").val();
605
620
  Util.post(location.pathname, {active_div: localStorage[Status.tab_token], is_init: is_init, machine_id: machine_id}, function (j) {
@@ -1374,7 +1389,7 @@ $(function () {
1374
1389
  map_url: function (location, location_name = "") {
1375
1390
  location_name = location_name === "" ? location : location_name;
1376
1391
  let location_arr = location.split(' ');
1377
- if (location.indexOf("中国") > -1 || location.indexOf("省") > -1 || location.indexOf("市") > -1) {
1392
+ if (/中国|省|市/.test(location)) {
1378
1393
  let url = Util.map_url(location_arr[0]);
1379
1394
  return url.replace('>' + location_arr[0] + '</a>', '>' + location_name + '</a>');
1380
1395
  }
package/util.js CHANGED
@@ -416,7 +416,7 @@ const Util = {
416
416
  if (location_name === "") {
417
417
  location_name = location.length > 20 ? location.substring(0, 20) : location;
418
418
  }
419
- if (Util.is_has_chinese(location)) {
419
+ if (Util.is_has_chinese(location) && !/美国|加拿大|新加坡|日本|澳大利亚/.test(location)) {
420
420
  //return "<a target='_blank' class='link_cls map_link' rel='noopener noreferrer nofollow' href='https://map.baidu.com/m?fr=ps01000&word=" + location + "'>" + location_name + "</a>";
421
421
  return "<a target='_blank' class='link_cls map_link' rel='noopener noreferrer nofollow' href='https://www.amap.com/search?query=" + location + "'>" + location_name + "</a>";
422
422
  }