@@ -300,157 +300,63 @@ <h2 class="step-title">Tá pronto! Agora é só usar! 🚀</h2>
300300
301301</ div > <!-- /container -->
302302
303- < script >
304- function getDevice ( ) {
305- const w = window . innerWidth ;
306- if ( w < 600 ) return 'mobile' ;
307- if ( w < 1024 ) return 'tablet' ;
308- return 'desktop' ;
309- }
310-
311- function setupPage ( ) {
312- const device = getDevice ( ) ;
313- const video = document . getElementById ( 'tutorialVideo' ) ;
314- const badge = document . getElementById ( 'deviceBadge' ) ;
315- const caption = document . getElementById ( 'videoCaption' ) ;
316- const vc = document . getElementById ( 'videoContainer' ) ;
317-
318- const config = {
319- mobile : { label : '📱 Tutorial para Celular' , cap : 'Vídeo com instruções para celular' , ratio : '9/16' } ,
320- tablet : { label : '📱 Tutorial para Tablet' , cap : 'Vídeo com instruções para tablet' , ratio : '4/3' } ,
321- desktop : { label : '🖥️ Tutorial para Computador' , cap : 'Vídeo com instruções para computador' , ratio : '16/9' }
322- } ;
323-
324- const c = config [ device ] ;
325- badge . textContent = c . label ;
326-
327- const source = document . createElement ( 'source' ) ;
328- source . src = c . src ;
329- source . type = 'video/mp4' ;
330- }
331-
332- function showToast ( ) {
333- const toast = document . getElementById ( 'toast' ) ;
334- toast . classList . add ( 'show' ) ;
335- setTimeout ( ( ) => toast . classList . remove ( 'show' ) , 3000 ) ;
336- }
337-
338- function copyFunc ( ) {
339- const text = document . getElementById ( 'scriptCode' ) . innerText ;
340- if ( navigator . clipboard && navigator . clipboard . writeText ) {
341- navigator . clipboard . writeText ( text ) . then ( showToast ) . catch ( fallbackCopy ) ;
342- } else {
343- fallbackCopy ( ) ;
344- }
345- function fallbackCopy ( ) {
346- const el = document . createElement ( 'textarea' ) ;
347- el . value = text ;
348- el . style . position = 'fixed' ;
349- el . style . opacity = '0' ;
350- document . body . appendChild ( el ) ;
351- el . focus ( ) ;
352- el . select ( ) ;
353- document . execCommand ( 'copy' ) ;
354- document . body . removeChild ( el ) ;
355- showToast ( ) ;
356- }
357- }
358-
359- setupPage ( ) ;
360- </ script >
361303 < script >
362- if ( window . location . hostname === 'localhost' || window . location . hostname === '127.0.0.1' )
363- {
364- const devModeAlert = document . createElement ( 'div' ) ;
365-
366- devModeAlert . style . position = 'fixed' ;
367- devModeAlert . style . left = '92%' ;
368- devModeAlert . style . top = '10%' ;
369- devModeAlert . style . transform = 'translate(-50%, -50%)' ;
370- devModeAlert . style . zIndex = '10000' ;
371-
372- devModeAlert . style . width = '150px' ;
373- devModeAlert . style . height = '45px' ;
374- devModeAlert . style . boxSizing = 'border-box' ;
375-
376- devModeAlert . style . backgroundColor = 'black' ;
377- devModeAlert . style . borderRadius = '25px' ;
378- devModeAlert . style . border = '2px solid rgb(0,215,0)' ;
379-
380- devModeAlert . textContent = 'DEV MODE' ;
381- devModeAlert . style . fontFamily = 'monospace' ;
382- devModeAlert . style . fontSize = '24px' ;
383- devModeAlert . style . fontWeight = 'bold' ;
384- devModeAlert . style . color = 'rgb(0,215,0)' ;
385-
386- devModeAlert . style . display = 'flex' ;
387- devModeAlert . style . alignItems = 'center' ;
388- devModeAlert . style . justifyContent = 'center' ;
389-
390- document . body . appendChild ( devModeAlert ) ;
304+ function getDevice ( ) {
305+ const w = window . innerWidth ;
306+ if ( w < 600 ) return 'mobile' ;
307+ if ( w < 1024 ) return 'tablet' ;
308+ return 'desktop' ;
391309 }
392- else
393- {
394- const socialBarScript = document . createElement ( 'script' )
395- socialBarScript . src = "https://socialbar.greenscriptshub.workers.dev/69/48/71/694871912c33e6042fa1c2eb0b8d6988.js"
396310
397- document . body . appendChild ( socialBarScript ) ;
311+ function setupPage ( ) {
312+ const device = getDevice ( ) ;
313+ const video = document . getElementById ( 'tutorialVideo' ) ;
314+ const badge = document . getElementById ( 'deviceBadge' ) ;
315+ const caption = document . getElementById ( 'videoCaption' ) ;
316+ const vc = document . getElementById ( 'videoContainer' ) ;
317+
318+ const config = {
319+ mobile : { label : '📱 Tutorial para Celular' , cap : 'Vídeo com instruções para celular' , ratio : '9/16' } ,
320+ tablet : { label : '📱 Tutorial para Tablet' , cap : 'Vídeo com instruções para tablet' , ratio : '4/3' } ,
321+ desktop : { label : '🖥️ Tutorial para Computador' , cap : 'Vídeo com instruções para computador' , ratio : '16/9' }
322+ } ;
323+
324+ const c = config [ device ] ;
325+ badge . textContent = c . label ;
326+
327+ const source = document . createElement ( 'source' ) ;
328+ source . src = c . src ;
329+ source . type = 'video/mp4' ;
398330 }
399- </ script >
400-
401-
402- < script type ="module ">
403- import { createClient } from 'https://esm.sh/@supabase/supabase-js@2'
404-
405- const supabase = createClient ( 'https://btdbraicotnkhfkexwyh.supabase.co' , "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6ImJ0ZGJyYWljb3Rua2hma2V4d3loIiwicm9sZSI6ImFub24iLCJpYXQiOjE3Nzc1MDY2MjcsImV4cCI6MjA5MzA4MjYyN30.ftV4X0vN3NRHJhsIyI_z4D0rm8sGPxVtwzhOux1jykA" )
406- const canal = supabase . channel ( 'analytics' )
407-
408- const join_in = new Date ( ) . toISOString ( )
409- const page = "RedPR"
410- const admCookie = document . cookie . match ( '(^|;)\\s*admin\\s*=\\s*([^;]+)' ) ?. [ 2 ] || null ;
411- const URL = 'https://btdbraicotnkhfkexwyh.supabase.co/functions/v1/PageTime'
412- const anomKey = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6ImJ0ZGJyYWljb3Rua2hma2V4d3loIiwicm9sZSI6ImFub24iLCJpYXQiOjE3Nzc1MDY2MjcsImV4cCI6MjA5MzA4MjYyN30.ftV4X0vN3NRHJhsIyI_z4D0rm8sGPxVtwzhOux1jykA'
413331
414- let enviado = false
415-
416- function enviarDados ( arrive_in , leave_in , session_time_sec ) {
417- if ( enviado ) return
418- enviado = true
419-
420- fetch ( URL , {
421- method : 'POST' ,
422- headers : {
423- 'Authorization' : `Bearer ${ anomKey } ` ,
424- 'Content-Type' : 'application/json'
425- } ,
426- body : JSON . stringify ( { page, arrive_in, leave_in, session_time_sec, admCookie } ) ,
427- keepalive : true
428- } )
429- }
430-
431- canal . on ( 'presence' , { event : 'sync' } , ( ) => { } )
432- . subscribe ( async ( status ) => {
433- if ( status === 'SUBSCRIBED' ) {
434- await canal . track ( { page, join_in } )
435- }
436- } )
437-
438- window . addEventListener ( 'beforeunload' , ( ) => {
439- const leave_in = new Date ( ) . toISOString ( )
440- const session_time_sec = Math . floor (
441- ( new Date ( leave_in ) - new Date ( join_in ) ) / 1000
442- )
443- if ( admCookie === null )
444- {
445- enviarDados ( join_in , leave_in , session_time_sec )
332+ function showToast ( ) {
333+ const toast = document . getElementById ( 'toast' ) ;
334+ toast . classList . add ( 'show' ) ;
335+ setTimeout ( ( ) => toast . classList . remove ( 'show' ) , 3000 ) ;
446336 }
447- else
448- {
449- console . log ( "nao me hackeia por favor 😭)" )
450- }
451- } )
452- </ script >
453337
338+ function copyFunc ( ) {
339+ const text = document . getElementById ( 'scriptCode' ) . innerText ;
340+ if ( navigator . clipboard && navigator . clipboard . writeText ) {
341+ navigator . clipboard . writeText ( text ) . then ( showToast ) . catch ( fallbackCopy ) ;
342+ } else {
343+ fallbackCopy ( ) ;
344+ }
345+ function fallbackCopy ( ) {
346+ const el = document . createElement ( 'textarea' ) ;
347+ el . value = text ;
348+ el . style . position = 'fixed' ;
349+ el . style . opacity = '0' ;
350+ document . body . appendChild ( el ) ;
351+ el . focus ( ) ;
352+ el . select ( ) ;
353+ document . execCommand ( 'copy' ) ;
354+ document . body . removeChild ( el ) ;
355+ showToast ( ) ;
356+ }
357+ }
454358
359+ setupPage ( ) ;
360+ </ script >
455361</ body >
456362</ html >
0 commit comments