File tree Expand file tree Collapse file tree 1 file changed +4
-15
lines changed Expand file tree Collapse file tree 1 file changed +4
-15
lines changed Original file line number Diff line number Diff line change 1- // 检测是否为 Edge 浏览器
2- const isEdge = navigator . userAgent . indexOf ( "Edg" ) !== - 1 ;
31
42// 设置更短的超时时间
5- const TIMEOUT_DURATION = isEdge ? 1000 : 3000 ;
3+ const TIMEOUT_DURATION = 500 ;
64
75function loadGithubStar ( ) {
86 const container = document . getElementById ( 'github-star-container' ) ;
97 if ( ! container ) return ;
108
11- // 如果是 Edge 浏览器且无法快速加载 ,直接显示静态按钮
9+ // 如果浏览器且无法快速加载 ,直接显示静态按钮
1210 const timeout = setTimeout ( ( ) => {
1311 container . innerHTML = `
1412 <a href="https://github.com/xiaohajiayou/Leetcode-Mastery-Scheduler"
@@ -38,14 +36,5 @@ function loadGithubStar() {
3836 container . appendChild ( iframe ) ;
3937}
4038
41- // Edge 浏览器使用更快的加载策略
42- if ( isEdge ) {
43- setTimeout ( loadGithubStar , 100 ) ;
44- } else {
45- // 其他浏览器使用 requestIdleCallback
46- if ( 'requestIdleCallback' in window ) {
47- requestIdleCallback ( loadGithubStar , { timeout : 1000 } ) ;
48- } else {
49- setTimeout ( loadGithubStar , 500 ) ;
50- }
51- }
39+
40+ setTimeout ( loadGithubStar , 100 ) ;
You can’t perform that action at this time.
0 commit comments