sbd-npm 1.4.43 → 1.4.44
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/package.json +1 -1
- package/status.js +25 -14
- package/util.js +22 -6
package/package.json
CHANGED
package/status.js
CHANGED
@@ -739,16 +739,20 @@ $(function () {
|
|
739
739
|
html.push('</form>');
|
740
740
|
html.push('<div id="word_process_div"></div>');
|
741
741
|
$("#word_div").html(html.join(""));
|
742
|
+
let head_cols = [
|
743
|
+
{"name": "序号", "table_sort": 1},
|
744
|
+
{"name": "单词", "table_sort": 1},
|
745
|
+
{"name": "中文"},
|
746
|
+
{"name": "时间", "table_sort": 1},
|
747
|
+
];
|
748
|
+
if ('speechSynthesis' in window) {
|
749
|
+
head_cols.push({"name": "朗读"});
|
750
|
+
}
|
751
|
+
head_cols.push({"name": "操作"});
|
742
752
|
Util.init_table_skeleton({
|
743
753
|
"element_id": "word_process_div",
|
744
754
|
"caption": '<caption class="' + (is_mobile ? "text-left" : "text-right") + '" id="word_num"></caption>',
|
745
|
-
"head_cols":
|
746
|
-
{"name": "序号", "table_sort": 1},
|
747
|
-
{"name": "单词", "table_sort": 1},
|
748
|
-
{"name": "中文"},
|
749
|
-
{"name": "时间", "table_sort": 1},
|
750
|
-
{"name": "操作"},
|
751
|
-
]
|
755
|
+
"head_cols": head_cols
|
752
756
|
});
|
753
757
|
Status.init_word_modal();
|
754
758
|
}
|
@@ -1052,19 +1056,26 @@ $(function () {
|
|
1052
1056
|
}
|
1053
1057
|
if (match_ip_data) {
|
1054
1058
|
Util.show_loading();
|
1059
|
+
ip = match_ip_data[0];
|
1055
1060
|
$("#ip").prop('disabled', true);
|
1056
1061
|
$("#ip_query").attr("disabled", true);
|
1057
|
-
ip = match_ip_data[0];
|
1058
|
-
$("#ip").val(ip);
|
1059
1062
|
Util.post("/action", {action: "ip_query", ip: ip}, function (j) {
|
1060
1063
|
$("#ip").prop('disabled', false);
|
1061
1064
|
$("#ip_query").attr("disabled", false);
|
1062
1065
|
if (j["ip"]) {
|
1066
|
+
if (j["domain"]) {
|
1067
|
+
let domain = $("#ip").val().trim();
|
1068
|
+
j["domain"] = domain ? domain : j["domain"];
|
1069
|
+
}
|
1063
1070
|
$("#ip").val(j["ip"]);
|
1064
1071
|
let ip_address = Status.convert_ip_address(j);
|
1065
1072
|
if (ip_address.length > 0) {
|
1066
1073
|
let map_url = Status.map_url(ip_address, "<i class='glyphicon glyphicon-map-marker'></i>");
|
1067
|
-
|
1074
|
+
let ip_result = Util.pack_html_link(Status.ip_url(j["ip"]), "<b class='text-success'>" + ip_address + "</b>") + " " + map_url;
|
1075
|
+
if (j["domain"]) {
|
1076
|
+
ip_result += "<br><br>" + Util.pack_html_link(j["domain"], "<b>" + j["domain"] + "</b>");
|
1077
|
+
}
|
1078
|
+
$("#ip_result").html(ip_result);
|
1068
1079
|
} else {
|
1069
1080
|
$("#ip_result").html(Util.pack_html_link(Status.ip_url(ip), "<b class='text-danger'>找不到结果!</b>"));
|
1070
1081
|
}
|
@@ -1084,7 +1095,7 @@ $(function () {
|
|
1084
1095
|
Status.phone_query();
|
1085
1096
|
});
|
1086
1097
|
$("#md5_encrypt").click(function () {
|
1087
|
-
let md5 = $("#md5").val();
|
1098
|
+
let md5 = $("#md5").val().trim();
|
1088
1099
|
if (md5) {
|
1089
1100
|
Util.show_loading();
|
1090
1101
|
$("#md5").prop('disabled', true);
|
@@ -1100,7 +1111,7 @@ $(function () {
|
|
1100
1111
|
}
|
1101
1112
|
});
|
1102
1113
|
$("#base64_action").click(function () {
|
1103
|
-
let base64 = $("#base64").val();
|
1114
|
+
let base64 = $("#base64").val().trim();
|
1104
1115
|
if (base64) {
|
1105
1116
|
if ($(this).text() === "编 码") {
|
1106
1117
|
$("#base64_result").html("<b class='text-success'>" + Util.base64_encode(base64) + "</b>");
|
@@ -1115,7 +1126,7 @@ $(function () {
|
|
1115
1126
|
$("#base64_action").text($(this).text());
|
1116
1127
|
});
|
1117
1128
|
$("#unicode_convert").click(function () {
|
1118
|
-
let unicode_str = $("#unicode").val();
|
1129
|
+
let unicode_str = $("#unicode").val().trim();
|
1119
1130
|
if (unicode_str) {
|
1120
1131
|
try {
|
1121
1132
|
let obj = JSON.parse('{"data": "' + unicode_str + '"}');
|
@@ -1128,7 +1139,7 @@ $(function () {
|
|
1128
1139
|
}
|
1129
1140
|
});
|
1130
1141
|
$("#segment_parse").click(function () {
|
1131
|
-
let segment_str = $("#segment").val();
|
1142
|
+
let segment_str = $("#segment").val().trim();
|
1132
1143
|
if (segment_str) {
|
1133
1144
|
try {
|
1134
1145
|
let segmenter = new Intl.Segmenter("zh-CN", {granularity: "word"});
|
package/util.js
CHANGED
@@ -1658,6 +1658,7 @@ const Util = {
|
|
1658
1658
|
Util.post(location.pathname, {active_div: "word", is_init: is_init, specify_day: specify_day, search_key: search_key}, function (j) {
|
1659
1659
|
let html = [], index = 0;
|
1660
1660
|
let is_mobile = Util.is_mobile();
|
1661
|
+
let is_speech_synthesis = 'speechSynthesis' in window ? 1 : 0;
|
1661
1662
|
j["data"].forEach(function (item) {
|
1662
1663
|
index++;
|
1663
1664
|
html.push("<tr>");
|
@@ -1669,6 +1670,9 @@ const Util = {
|
|
1669
1670
|
html.push("<td>", item["chinese"], "</td>");
|
1670
1671
|
}
|
1671
1672
|
html.push("<td>", Util.seconds_to_format(item["date"]), "</td>");
|
1673
|
+
if (is_speech_synthesis === 1) {
|
1674
|
+
html.push("<td class='word_utterance' style='cursor: pointer;'><i class='glyphicon glyphicon-volume-up'></i></td>");
|
1675
|
+
}
|
1672
1676
|
html.push("<td><a href='#' data-toggle='modal' data-target='.word_modal'>修改</a> <a class='word_del' href='#'>删除</a></td>");
|
1673
1677
|
html.push("</tr>");
|
1674
1678
|
});
|
@@ -1687,7 +1691,23 @@ const Util = {
|
|
1687
1691
|
Util.fetch_word_data(0, appoint_day, "");
|
1688
1692
|
});
|
1689
1693
|
}
|
1690
|
-
|
1694
|
+
if (is_speech_synthesis === 1) {
|
1695
|
+
$("#word_process_div_body .word_utterance").each(function () {
|
1696
|
+
$(this).click(function () {
|
1697
|
+
let word = $(this).parent().children('td').eq(1).text();
|
1698
|
+
if (word) {
|
1699
|
+
window.speechSynthesis.cancel(); // 清除队列
|
1700
|
+
let utterance = new SpeechSynthesisUtterance(word);
|
1701
|
+
utterance.lang = 'en-US'; // 设置语言为英语(美式英语)
|
1702
|
+
utterance.rate = 1; // 语速(0.1 到 10)
|
1703
|
+
utterance.volume = 1; // 音量(0 到 1)
|
1704
|
+
utterance.pitch = 1; // 音调(0 到 2)
|
1705
|
+
window.speechSynthesis.speak(utterance);
|
1706
|
+
}
|
1707
|
+
});
|
1708
|
+
});
|
1709
|
+
}
|
1710
|
+
$("#word_process_div_body .word_del").each(function () {
|
1691
1711
|
$(this).click(function () {
|
1692
1712
|
let tr_obj = $(this).parent().parent();
|
1693
1713
|
let word = $(tr_obj).children('td').eq(1).text();
|
@@ -2947,11 +2967,7 @@ const Util = {
|
|
2947
2967
|
if (!obj.hasClass("glyphicon-info-sign")) {
|
2948
2968
|
obj.addClass("glyphicon-info-sign");
|
2949
2969
|
}
|
2950
|
-
obj.attr("data-original-title", tip);
|
2951
|
-
obj.attr("data-toggle", "tooltip");
|
2952
|
-
obj.attr("data-placement", "bottom");
|
2953
|
-
obj.attr("data-container", "body");
|
2954
|
-
obj.tooltip();
|
2970
|
+
obj.attr("data-original-title", tip).attr("data-toggle", "tooltip").attr("data-placement", "bottom").attr("data-container", "body").tooltip();
|
2955
2971
|
},
|
2956
2972
|
|
2957
2973
|
/**
|