@@ -33,10 +33,10 @@ const flagImg = document.querySelector("img#flag");
3333const searchInput = document . querySelector ( ".search input" ) ;
3434const searchFound = document . querySelector ( ".search .searchFound" ) ;
3535
36- async function initLanguage ( ) {
36+ function initLanguage ( ) {
3737 flagImg . setAttribute ( "src" , getFlag ( ) ) ;
3838
39- flagImg . onclick = async ( ) => {
39+ flagImg . onclick = ( ) => {
4040 toggleLang ( ) ;
4141 flagImg . setAttribute ( "src" , getFlag ( ) ) ;
4242
@@ -46,9 +46,9 @@ async function initLanguage() {
4646 } ;
4747}
4848
49- async function createTabs ( ) {
49+ function createTabs ( ) {
5050 // prepare tabs
51- await refreshSpecialTabs ( ) ;
51+ refreshSpecialTabs ( ) ;
5252
5353 // clear UI
5454 tabDiv . innerHTML = "" ;
@@ -85,7 +85,7 @@ async function createTabs() {
8585 }
8686
8787 // open tab
88- let activeTabId = await activeTabIdSaver . get ( ) ;
88+ let activeTabId = activeTabIdSaver . get ( ) ;
8989 activeTabId && openTab ( allTabs . find ( ( tab ) => tab . id === activeTabId ) ) ;
9090}
9191
@@ -126,7 +126,7 @@ async function createTabContent(tab) {
126126 } ) ;
127127 contentContainer . appendChild ( emptyText ) ;
128128 } else {
129- const favoriteScriptIds = await favoriteScriptsSaver . getIds ( ) ;
129+ const favoriteScriptIds = favoriteScriptsSaver . getIds ( ) ;
130130 tab . scripts . forEach ( ( script ) => {
131131 let isFavorite = favoriteScriptIds . find ( ( id ) => script . id === id ) ;
132132 contentContainer . appendChild ( createScriptButton ( script , isFavorite ) ) ;
@@ -157,7 +157,7 @@ function createScriptButton(script, isFavorite = false) {
157157 const checkmark = document . createElement ( "button" ) ;
158158 checkmark . className = "checkmark tooltip" ;
159159 checkmark . onclick = async ( e ) => {
160- let newValue = await toggleActiveScript ( script . id ) ;
160+ let newValue = toggleActiveScript ( script . id ) ;
161161 updateButtonChecker ( script , buttonContainer , newValue ) ;
162162 } ;
163163
@@ -279,7 +279,7 @@ function createScriptButton(script, isFavorite = false) {
279279async function updateButtonChecker ( script , button , val ) {
280280 let checkmark = button . querySelector ( ".checkmark" ) ;
281281 if ( ! checkmark ) return ;
282- if ( val ?? ( await isActiveScript ( script . id ) ) ) {
282+ if ( val ?? isActiveScript ( script . id ) ) {
283283 checkmark . classList . add ( "active" ) ;
284284 checkmark . title = t ( {
285285 vi : "Tắt tự động chạy" ,
@@ -366,7 +366,7 @@ function initSearch() {
366366( async function ( ) {
367367 // initOpenInNewTabBtn();
368368 initSearch ( ) ;
369- await initLanguage ( ) ;
370- await createTabs ( ) ;
369+ initLanguage ( ) ;
370+ createTabs ( ) ;
371371 await checkForUpdate ( ) ;
372372} ) ( ) ;
0 commit comments