sbd-npm 1.4.62 → 1.4.64

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 +20 -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.64",
4
4
  "description": "Stock Big Data",
5
5
  "author": "DHQ <dhq314@gmail.com>",
6
6
  "license": "ISC",
package/status.js CHANGED
@@ -544,8 +544,9 @@ $(function () {
544
544
  $("#task_div").html(ht_html.join(""));
545
545
  $("#task_add").click(function() {
546
546
  let task_content = $("#task_content").val();
547
+ task_content = task_content.replace(/ü/g, 'u').replace(/ö/g, 'o'); // München、Köln
547
548
  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) {
549
+ if (Status.check_task_content(task_content)) {
549
550
  $("#task_content").prop('disabled', true);
550
551
  $("#task_add").prop('disabled', true);
551
552
  Util.show_loading();
@@ -583,8 +584,6 @@ $(function () {
583
584
  }
584
585
  Util.hide_tips();
585
586
  });
586
- } else {
587
- $("#task_tips").html("<b class='text-danger'>任务内容不能为空!</b>");
588
587
  }
589
588
  return false;
590
589
  });
@@ -600,6 +599,23 @@ $(function () {
600
599
  Status.fetch_task_data(is_init);
601
600
  },
602
601
 
602
+ check_task_content: function(task_content) {
603
+ if (task_content && task_content.length > 0) {
604
+ let task_tips = $("#task_tips").text().trim();
605
+ if (task_tips.length > 0) {
606
+ let tips_match = task_tips.match(/^任务\s*`(.+?)`\s*DONE$/);
607
+ if (tips_match && tips_match[1] === task_content) {
608
+ Util.show_tips("任务 `" + tips_match[1] + "` 已经执行过", 3456, "alert-danger");
609
+ return false;
610
+ }
611
+ }
612
+ return true;
613
+ } else {
614
+ $("#task_tips").html("<b class='text-danger'>任务内容不能为空!</b>");
615
+ return false;
616
+ }
617
+ },
618
+
603
619
  fetch_task_data: function(is_init = 0) {
604
620
  let machine_id = $("#task_machines").val();
605
621
  Util.post(location.pathname, {active_div: localStorage[Status.tab_token], is_init: is_init, machine_id: machine_id}, function (j) {
@@ -1374,7 +1390,7 @@ $(function () {
1374
1390
  map_url: function (location, location_name = "") {
1375
1391
  location_name = location_name === "" ? location : location_name;
1376
1392
  let location_arr = location.split(' ');
1377
- if (location.indexOf("中国") > -1 || location.indexOf("省") > -1 || location.indexOf("市") > -1) {
1393
+ if (/中国|省|市/.test(location)) {
1378
1394
  let url = Util.map_url(location_arr[0]);
1379
1395
  return url.replace('>' + location_arr[0] + '</a>', '>' + location_name + '</a>');
1380
1396
  }
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
  }