@@ -201,9 +201,13 @@ function createScriptButton(script, isFavorite = false) {
201201 const button = document . createElement ( "button" ) ;
202202 button . className = "tooltip" ;
203203 if ( canClick ( script ) ) {
204- button . onclick = ( ) => runScript ( script ) ;
204+ button . onclick = ( ) => {
205+ if ( checkIsPreview ( script ) ) return ;
206+ runScript ( script ) ;
207+ } ;
205208 } else if ( canAutoRun ( script ) ) {
206209 button . onclick = ( ) => {
210+ if ( checkIsPreview ( script ) ) return ;
207211 openModal (
208212 t ( {
209213 vi : "Chức năng này Tự động chạy" ,
@@ -222,13 +226,15 @@ function createScriptButton(script, isFavorite = false) {
222226 ) ;
223227 } ;
224228 } else {
225- button . onclick = ( ) =>
229+ button . onclick = ( ) => {
230+ if ( checkIsPreview ( script ) ) return ;
226231 alert (
227232 t ( {
228233 vi : "Chức năng chưa hoàn thành " + script . id ,
229234 en : "Coming soon " + script . id ,
230235 } )
231236 ) ;
237+ } ;
232238 }
233239
234240 // script badges
@@ -282,6 +288,8 @@ function createScriptButton(script, isFavorite = false) {
282288 btn . setAttribute ( "data-tooltip" , title ) ;
283289 btn . setAttribute ( "data-flow" , "left" ) ;
284290 btn . onclick = ( e ) => {
291+ if ( checkIsPreview ( script ) ) return ;
292+
285293 // prevent to trigger other script's onClick funcs
286294 e . stopPropagation ( ) ;
287295 e . preventDefault ( ) ;
@@ -306,6 +314,7 @@ function createScriptButton(script, isFavorite = false) {
306314 viewSourceBtn . onclick = ( e ) => {
307315 e . stopPropagation ( ) ;
308316 e . preventDefault ( ) ;
317+ if ( checkIsPreview ( script ) ) return ;
309318
310319 trackEvent ( script . id + "-VIEW-SOURCE" ) ;
311320 viewScriptSource ( script ) ;
0 commit comments