소스 검색

load custom title and remove delay

TheBaum123 2 년 전
부모
커밋
90f5e7e381
1개의 변경된 파일16개의 추가작업 그리고 15개의 파일을 삭제
  1. 16 15
      scripts/getPreferences.js

+ 16 - 15
scripts/getPreferences.js

@@ -13,6 +13,8 @@ let customLightTextColor = localStorage.getItem("text-startpage:custom-light-tex
 let customHighlighterColor = localStorage.getItem("text-startpage:custom-highlighter")
 let customHighlighterColor = localStorage.getItem("text-startpage:custom-highlighter")
 
 
 //custom page title
 //custom page title
+let enableCustomTitle = localStorage.getItem("text-startpage:enableCustomTitle")
+let customTitle = localStorage.getItem("text-startpage:customTitle")
 
 
 //greeting
 //greeting
 let enableGreeting = "" 
 let enableGreeting = "" 
@@ -48,18 +50,17 @@ if(!bookmarks) {
     }
     }
 }
 }
 
 
-setTimeout(() => {
-    if(localStorage.getItem("text-startpage:theme") == "custom") {
-        const colorsToInject = document.createElement("style")
-        colorsToInject.innerText = `
-            .custom {
-                --background-color: ${customBackgroundColor};
-                --light-background-color: ${customLightBackgroundColor};
-                --text-color: ${customTextColor};
-                --light-text-color: ${customLightTextColor};
-                --highlighter: ${customHighlighterColor};
-            }
-        `
-        document.head.appendChild(colorsToInject)
-    }
-}, 10);
+//set the theme
+if(localStorage.getItem("text-startpage:theme") == "custom") {
+    const colorsToInject = document.createElement("style")
+    colorsToInject.innerText = `
+        .custom {
+            --background-color: ${customBackgroundColor};
+            --light-background-color: ${customLightBackgroundColor};
+            --text-color: ${customTextColor};
+            --light-text-color: ${customLightTextColor};
+            --highlighter: ${customHighlighterColor};
+        }
+    `
+    document.head.appendChild(colorsToInject)
+}