sbd-npm 1.4.44 → 1.4.46
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 +29 -2
- package/util.js +7 -4
package/package.json
CHANGED
package/status.js
CHANGED
@@ -235,7 +235,7 @@ $(function () {
|
|
235
235
|
}
|
236
236
|
Util.post(location.pathname, {active_div: localStorage[Status.tab_token]}, function (j) {
|
237
237
|
let html = [], ip_num = j["num"];
|
238
|
-
$("#ip_num").html("共 <span class='label label-info'>" + j["num"] + "</span> 条");
|
238
|
+
$("#ip_num").html("共 <span class='label label-info'>" + j["num"] + "</span> 条(" + j["total_ip_num"] + ")");
|
239
239
|
j["data"].forEach(function (item) {
|
240
240
|
html.push("<tr>");
|
241
241
|
html.push("<td>", ip_num, "</td>");
|
@@ -746,7 +746,7 @@ $(function () {
|
|
746
746
|
{"name": "时间", "table_sort": 1},
|
747
747
|
];
|
748
748
|
if ('speechSynthesis' in window) {
|
749
|
-
head_cols.push({"name": "朗读"});
|
749
|
+
head_cols.push({"name": "朗读", "id": "word_recite", "link": "#"});
|
750
750
|
}
|
751
751
|
head_cols.push({"name": "操作"});
|
752
752
|
Util.init_table_skeleton({
|
@@ -754,11 +754,38 @@ $(function () {
|
|
754
754
|
"caption": '<caption class="' + (is_mobile ? "text-left" : "text-right") + '" id="word_num"></caption>',
|
755
755
|
"head_cols": head_cols
|
756
756
|
});
|
757
|
+
$("#word_recite").click(function() {
|
758
|
+
if (!Util.is_load) {
|
759
|
+
Util.is_load = true;
|
760
|
+
let voices = window.speechSynthesis.getVoices();
|
761
|
+
if (voices.length > 0) {
|
762
|
+
Status.show_speech_voices(voices);
|
763
|
+
} else {
|
764
|
+
window.speechSynthesis.onvoiceschanged = () => {
|
765
|
+
let voices = window.speechSynthesis.getVoices();
|
766
|
+
Status.show_speech_voices(voices);
|
767
|
+
};
|
768
|
+
}
|
769
|
+
}
|
770
|
+
});
|
757
771
|
Status.init_word_modal();
|
758
772
|
}
|
759
773
|
Util.fetch_word_data(is_init, "", "");
|
760
774
|
},
|
761
775
|
|
776
|
+
show_speech_voices: function(voices) {
|
777
|
+
if (voices.length > 0) {
|
778
|
+
let data = [];
|
779
|
+
voices.forEach(voice => {
|
780
|
+
data.push(`Name: ${voice.name}, Lang: ${voice.lang}, Default: ${voice.default}`);
|
781
|
+
});
|
782
|
+
alert(data.join("\n"));
|
783
|
+
} else {
|
784
|
+
alert("空列表: []");
|
785
|
+
}
|
786
|
+
Util.is_load = false;
|
787
|
+
},
|
788
|
+
|
762
789
|
init_machine_action_modal: function () {
|
763
790
|
Util.init_modal_skeleton("machine_action_modal");
|
764
791
|
$("#machine_action_modal_title").html("添加任务");
|
package/util.js
CHANGED
@@ -1658,7 +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 =
|
1661
|
+
let is_speech_synthesis = $("#word_recite").length > 0 ? 1 : 0;
|
1662
1662
|
j["data"].forEach(function (item) {
|
1663
1663
|
index++;
|
1664
1664
|
html.push("<tr>");
|
@@ -1695,7 +1695,7 @@ const Util = {
|
|
1695
1695
|
$("#word_process_div_body .word_utterance").each(function () {
|
1696
1696
|
$(this).click(function () {
|
1697
1697
|
let word = $(this).parent().children('td').eq(1).text();
|
1698
|
-
if (word) {
|
1698
|
+
if (/^[A-Za-z]+$/.test(word)) {
|
1699
1699
|
window.speechSynthesis.cancel(); // 清除队列
|
1700
1700
|
let utterance = new SpeechSynthesisUtterance(word);
|
1701
1701
|
utterance.lang = 'en-US'; // 设置语言为英语(美式英语)
|
@@ -3287,9 +3287,9 @@ const Util = {
|
|
3287
3287
|
pack_index_data: function (index, change) {
|
3288
3288
|
let index_html = Util.to_float(index, 2);
|
3289
3289
|
if (change > 0) {
|
3290
|
-
|
3290
|
+
return "<b class='text-danger'>" + index_html + "(+" + change + "%)</b>";
|
3291
3291
|
} else if (change < 0) {
|
3292
|
-
|
3292
|
+
return "<b class='text-success'>" + index_html + "(" + change + "%)</b>";
|
3293
3293
|
}
|
3294
3294
|
return index_html;
|
3295
3295
|
},
|
@@ -3302,6 +3302,9 @@ const Util = {
|
|
3302
3302
|
*/
|
3303
3303
|
pack_html_link: function (url, title) {
|
3304
3304
|
if (url) {
|
3305
|
+
if (url === "#") {
|
3306
|
+
return "<a class='link_cls' href='#'>" + title + "</a>";
|
3307
|
+
}
|
3305
3308
|
if (!url.startsWith("http") && !url.startsWith("/")) {
|
3306
3309
|
url = "http://" + url;
|
3307
3310
|
}
|