Commit 47e7ddc1 by 赵增煜

修改

parent 6ad5dbf9
...@@ -6,6 +6,24 @@ function replace_logo(){ ...@@ -6,6 +6,24 @@ function replace_logo(){
console.log("Replace logo"); console.log("Replace logo");
} }
function replaceKeywords(keyword, replacement) {
// 获取整个文档的body元素
var body = document.body;
// 创建一个空白的Range对象
var range = document.createRange();
// 选择body作为范围
range.selectNodeContents(body);
// 将range内的内容转换为DocumentFragment
var fragment = range.extractContents();
// 遍历fragment的所有子节点
replaceText(fragment, keyword, replacement);
// 将修改后的fragment重新插入到body中
body.appendChild(fragment);
}
window.onload = function() {
replaceKeywords('新橙科技', '同知堂科技');
replaceKeywords('粤ICP备15024370号-7', '苏ICP备2023017636号-1');
};
replace_keywords(); // replace_keywords();
replace_logo(); // replace_logo();
\ No newline at end of file \ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment