Replies: 28 comments 49 replies
-
Beta Was this translation helpful? Give feedback.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment has been hidden.
This comment has been hidden.
-
不会js什么的,但是我有补充的信息 var times = document.getElementsByTagName('relative-time');
for (var i = 0; i < times.length; i++) {
times[i].update()
//console.log(i)
} 加了这段后运行时机在何时都无所谓了,但是似乎从库进入commit的时候会重新设置lang,并且此时也不会重新运行脚本,然后我问gpt要了个观察者什么的,阻止了这种改变。 我认为使用这种方法的好处是可以避免替换带来的某些错误,坏处是更依赖于GitHub本身的表现。 |
Beta Was this translation helpful? Give feedback.
-
目前 测试其实并不充分 |
Beta Was this translation helpful? Give feedback.
This comment has been hidden.
This comment has been hidden.
-
@wuyuncheng-26 @TC999 @cosing 大家方便测试一下 Test_zh-CN_LangEnvSet 分支下的 main.user.js 么😊
请大家进行广泛测试, 发现和修补 bug, 等待稳定后再合并到主分支 |
Beta Was this translation helpful? Give feedback.
This comment has been hidden.
This comment has been hidden.
-
等下,BUG出现了,在GitHub 操作页面,这次录到了影片 2024-06-09.224012.mp4 |
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
This comment has been hidden.
This comment has been hidden.
This comment has been hidden.
This comment has been hidden.
-
建议:把
这样可以点击链接直接装 |
Beta Was this translation helpful? Give feedback.
This comment has been hidden.
This comment has been hidden.
This comment has been hidden.
This comment has been hidden.
-
@wuyuncheng-26 @TC999 测试分支已更新,并更新脚本名称,便于脚本管理器中同时安装2种版本便于调试 |
Beta Was this translation helpful? Give feedback.
-
主分支 1.9.3 已发布, 等公测没大问题就推送 |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Tip
测试脚本地址:
zh-CN_LangEnvTest 分支下的 main.user.js
document-start
脚本载入机制, 导致存在一些 bug, 打算使用window.addEventListener('DOMContentLoaded', init);
延迟init
的载入 (灵感来自 Update main.user.js buiawpkgew1/github-chinese#98)window.addEventListener('DOMContentLoaded', ...)
document.addEventListener('turbo:load', ...)
代替setTimeout
更新page
更新逻辑使用Turbo
原生的before-fetch-request
事件及detail.url
对象 最快获取新页面的url
. 目前,发现对于需要class
筛选的效果不好监视document.body
的class
属性变化即可githubstatus.com
与skills.github.com
getPage
函数traverseNode
函数transElement
函数watchUpdate
函数:mutations.flatMap
过程:节点增加
突变,后期迭代翻译的对象调整为addedNodes
中记录的新增节点(大幅减少重复迭代的问题),其他突变处理不变ignoreSelector
和reIgnoreClass
等规则);字符数据
的突变进一步探讨MutationObserver.takeRecords()
(灵感来自 Update main.user.js buiawpkgew1/github-chinese#98)监测 HTML lang 值
和Turbo 事件监听器
剥离出来,使watchUpdate
函数专注于监视页面的 DOM 变化Beta Was this translation helpful? Give feedback.
All reactions