Skip to content

Commit

Permalink
尝试删除“多余”的watchTimeElement 函数及引用
Browse files Browse the repository at this point in the history
  • Loading branch information
maboloshi committed Feb 14, 2025
1 parent 5eb9d4e commit 7d46bbf
Showing 1 changed file with 0 additions and 13 deletions.
13 changes: 0 additions & 13 deletions main.user.js
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,6 @@
switch (node.tagName) {
case "RELATIVE-TIME": // 翻译时间元素
transTimeElement(node.shadowRoot);
watchTimeElement(node.shadowRoot);
return;

case "INPUT":
Expand Down Expand Up @@ -374,18 +373,6 @@
}
}

/**
* watchTimeElement 函数:监视时间元素变化, 触发和调用时间元素翻译
* @param {Element} el - 需要监视的元素。
*/
function watchTimeElement(el) {
new MutationObserver(mutations => {
transTimeElement(mutations[0].addedNodes[0]);
}).observe(el, {
childList: true
});
}

/**
* transElement 函数:翻译指定元素的文本内容或属性。
* @param {Element|DOMStringMap} el - 需要翻译的元素或元素的数据集 (node.dataset)。
Expand Down

0 comments on commit 7d46bbf

Please sign in to comment.