feat: 优化脚本稳定性并增加中文注释 #7
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
1、解决了 await 语法错误
2、将整个脚本包裹在 (function() { 'use strict'; ... })(); 结构中,启用严格模式并避免污染全局作用域。
3、在与 Cloudflare Turnstile 交互的部分,当 MutationObserver 监听到令牌生成并成功点击提交后,会调用 observer.disconnect() 来停止监听,避免不必要的资源消耗。
4、增加了对页面元素(如 jQuery 的 $)是否存在的检查,使脚本在不同加载情况下更加稳定。
5、为脚本的每个核心功能模块(登录、检查到期、续期、验证码处理)添加了详细的中文注释。
6、在脚本头部增加了清晰的 “使用说明” 和 “工作流程”,方便新用户快速理解和上手。
7、在 UserScript 元数据中添加了 @name:zh-CN 和 @description:zh-CN 字段,优化了脚本在中文环境下的显示。