summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--xinhua.js1
-rw-r--r--zdic.js47
-rw-r--r--去英.zipbin4455 -> 4694 bytes
3 files changed, 31 insertions, 17 deletions
diff --git a/xinhua.js b/xinhua.js
index d74a0a3..6963f3e 100644
--- a/xinhua.js
+++ b/xinhua.js
@@ -1 +1,2 @@
+//全文中所有「〖〗」中的外语词文。
document.body.innerHTML = document.body.innerHTML.replace(/〖[a-z].*?[a-z]〗/gi,"「去英」");
diff --git a/zdic.js b/zdic.js
index 5eaac32..15f97d3 100644
--- a/zdic.js
+++ b/zdic.js
@@ -1,20 +1,33 @@
-tabpages = document.getElementsByClassName("tab-page");
-for(i=0; i < tabpages.length; i++){
- e = tabpages[i];
- e.innerHTML = e.innerHTML.replace(/English.*[a-z].*/gi,"「去英」");
- e.innerHTML = e.innerHTML.replace(/\[.*[a-z].*\]/gi,"「去英」");
- e.innerHTML = e.innerHTML.replace(/\<span.*\>[a-z].*?[a-z]\<\/span\>/gi,"「去英」");
-}
-foreignSpans = document.getElementsByClassName("encs");
-for (i = 0; i < foreignSpans.length; i++) {
- s = foreignSpans[i];
- s.innerHTML = s.innerHTML.replace(/.*/,"「去英」");
+/***
+ 取出所有汉典用于外语词代有「encs」属性的跨标(span)元素。
+ 其此內文复改成「「去英」」。
+
+***/
+//取「encs」元素
+外标 = document.getElementsByClassName("encs");
+for (位= 0; 位 < 外标.length; 位++) {
+ //当前元素
+ 素 = 外标[位];
+ //用正则表达式选所有内文,替换为「「去英」」
+ 素.innerHTML = 素.innerHTML.replace(/.*/,"「去英」");
}
-paragraphs = document.getElementsByTagName("p");
-for(i=0; i < paragraphs.length; i++){
- p = paragraphs[i];
- p.innerHTML = p.innerHTML.replace(/\<span.*z_ts2.*\>德语\<\/span\>.*/,"「去英」");
- p.innerHTML = p.innerHTML.replace(/\<span.*z_ts2.*\>英语\<\/span\>.*/,"「去英」");
- p.innerHTML = p.innerHTML.replace(/\<span.*z_ts2.*\>法语\<\/span\>.*/,"「去英」");
+
+/***
+ 从全文中取所有段落(p)元素。
+ 其中找函「德语、英语、法语」内文的「z_ts2」属性跨标,
+ 后文替换成「「去英」」。
+***/
+//取所有段落元素
+段落 = document.getElementsByTagName("p");
+for(位=0; 位 < 段落.length; 位++){
+ //当前段落
+ 素 = 段落[位];
+ /***
+ 用正则选所有某种跨标元素与其后文,汉典用「z_ts2」属性定议标检,
+ 其中「英语」等标检后函有外语词文。
+ ***/
+ 素.innerHTML = 素.innerHTML.replace(/\<span.*z_ts2.*\>德语\<\/span\>.*/,"「去英」");
+ 素.innerHTML = 素.innerHTML.replace(/\<span.*z_ts2.*\>英语\<\/span\>.*/,"「去英」");
+ 素.innerHTML = 素.innerHTML.replace(/\<span.*z_ts2.*\>法语\<\/span\>.*/,"「去英」");
}
diff --git a/去英.zip b/去英.zip
index f15ac23..24f126e 100644
--- a/去英.zip
+++ b/去英.zip
Binary files differ