PageSourceSearch

https://www.radiogazetaonline.com.br/wp-content/themes/template/scripts/utils/general.js?v=2026081803

js radiogazetaonline.com.br collected 2026-10-10 01:06:58 UTC 8,673 bytes, 271 lines download raw bytes

1// Style toggler
2$(function() {
3	// Call stylesheet init so that all stylesheet changing functions
4	// will work.
5	jQuery.stylesheetInit();
6
7	// This code loops through the stylesheets when you click the link with
8	// an ID of "toggler" below.
9	jQuery('#toggler').bind(
10		'click',
11		function(e) {
12			jQuery.stylesheetToggle();
13			return false;
14		}
15	);
16
17	// When one of the styleswitch links is clicked then switch the stylesheet to
18	// the one matching the value of that links rel attribute.
19	jQuery('.styleswitch').bind(
20		'click',
21		function(e) {
22				jQuery.stylesheetSwitch(this.getAttribute('rel'));
23				return false;
24			}
25		);
26	}
27);
28
29document.onkeyup = KeyCheck;
30
31function KeyCheck(e) {
32	var KeyID = (window.event) ? event.keyCode : e.keyCode;
33	switch(KeyID) {
34		case 49: jQuery.stylesheetToggle();
35				return false;
36				break;
37	}
38}
39
40/* Font sizer
41jQuery(document).ready(function(){
42	jQuery('#fontsizer').jfontsizer({
43		applyTo: '#content, p',
44		changesmall: '1',
45		changelarge: '3',
46		expire: 30
47	});
48}); */
49
50// Media player
51jQuery(document).ready(function() {
52	jQuery('video, audio').mediaelementplayer({
53		alwaysShowControls: true,
54		alwaysShowHours: true,
55		features: ['playpause','progress','current','duration','tracks','volume','fullscreen'],
56		audioVolume: 'horizontal',
57		enableKeyboard: true,
58		pauseOtherPlayers: true,
59		generateFlash: true,
60		translations:['pt','en','es','zh-cn'],
61		translationSelector: true,
62		startLanguage: 'pt'
63	});
64	//jQuery('.aovivo-menu a').attr('href','javascript:abrir("http://static.gazetaam.com/");');
65
66
67		
68});
69jQuery(function ($) {
70  // URL do JSON que contém as URLs de stream.
71  // Assim é possível trocar o stream mexendo apenas no JSON, sem alterar o site.
72  const STREAM_JSON_URL = "https://s3.us-east-1.amazonaws.com/static.casperlibero.edu.br/gazeta-online/stream.json";
73  let streamUrl = null;
74  const playImageUrl = "https://s3.radiogazetaonline.com.br/uploads/2025/09/play.webp";
75  const pauseImageUrl = "https://s3.radiogazetaonline.com.br/uploads/2025/09/pause.webp";
76
77  const $btnWatch = $('#btn-watch');
78  const $btnListen = $('#btn-listen');
79  const $videoWrap = $('#dailymotion-player');
80  const $audioWrap = $('#radio-player');
81
82  const $audio = $('#media')[0]; // usa o <audio> existente
83  const $playLink = $('#play-cross');
84  const $playImg = $playLink.find('img').first();
85  const $timeOutput = $('#time');
86  const $volIcon = $('.icon-volume');
87  const $volumeHolder = $('#volume');
88
89  let elapsedInterval = null;
90  let playStartTs = null;
91
92  // ===== Helpers tempo =====
93  function startElapsed() {
94    stopElapsed();
95    playStartTs = Date.now();
96    elapsedInterval = setInterval(() => {
97      const sec = Math.floor((Date.now() - playStartTs) / 1000);
98      const m = Math.floor(sec / 60);
99      const s = sec % 60;
100      $timeOutput.text(`${m}:${String(s).padStart(2,'0')}`);
101    }, 1000);
102  }
103  function stopElapsed() {
104    clearInterval(elapsedInterval);
105    elapsedInterval = null;
106    playStartTs = null;
107  }
108  function setPlayingUI() {
109    $playImg.attr('src', pauseImageUrl);
110    $audioWrap.addClass('playing').removeClass('buffering');
111  }
112  function setPausedUI() {
113    $playImg.attr('src', playImageUrl);
114    $audioWrap.removeClass('playing buffering');
115  }
116
117  // ===== Inicializa player de áudio =====
118  function initAudio() {
119    if (!$audio) return;
120
121    $audio.addEventListener('playing', () => { setPlayingUI(); if (!playStartTs) startElapsed(); });
122    $audio.addEventListener('pause', () => { setPausedUI(); stopElapsed(); });
123    $audio.addEventListener('waiting', () => { $audioWrap.addClass('buffering'); $timeOutput.text('Carregando...'); });
124    $audio.addEventListener('canplay', () => { $audioWrap.removeClass('buffering'); if (!$audio.paused && !playStartTs) startElapsed(); });
125    $audio.addEventListener('error', () => { $timeOutput.text('Erro no stream'); setPausedUI(); stopElapsed(); });
126
127    // botão play/pause
128    $playLink.off().on('click', e => {
129      e.preventDefault();
130      if ($audio.paused) {
131        // Sem URL de stream (JSON ainda não carregou ou indisponível) não há o que tocar
132        if (!streamUrl) { $timeOutput.text('Stream indisponível'); return; }
133        if (!$audio.getAttribute('src')) $audio.src = streamUrl;
134        $audio.play();
135      } else {
136        $audio.pause();
137      }
138    });
139
140    // mute
141    $volIcon.off().on('click', () => {
142      $audio.muted = !$audio.muted;
143      $volIcon.toggleClass('muted', $audio.muted);
144    });
145
146    // volume via jQuery UI Slider
147    $volumeHolder.slider({
148      value: $audio.volume * 100,
149      min: 0,
150      max: 100,
151      range: "min",
152      slide: function (event, ui) {
153        $audio.volume = ui.value / 100;
154      }
155    });
156  }
157
158  // ===== Vídeo =====
159  // O embed sem player id (geo.dailymotion.com/player.html?video=...) passou a responder
160  // 403 "Forbidden", o que derrubou o "Assistir" na Web (RGO-11). O card tambem
161  // reporta falha no iOS e funcionamento no Android; os apps nao estao neste repositorio.
162  // O formato com player id carrega. x1il6o e o mesmo player que o aplicativo Android
163  // usa: autostart desligado e sem autonext, que e o comportamento que o site espera
164  // ao passar autoplay=false.
165  // O mesmo embed e entregue por custom/layouts/homepage.php: manter os dois iguais.
166  const DAILYMOTION_PLAYER_ID = 'x1il6o';
167  const DAILYMOTION_VIDEO_ID = 'x9pmgz0';
168
169  function mountVideo() {
170    if ($videoWrap.find('iframe').length) return;
171    $videoWrap.html(`
172      <div style="position:relative;padding-bottom:56.25%;height:0;overflow:hidden;">
173        <iframe src="https://geo.dailymotion.com/player/${DAILYMOTION_PLAYER_ID}.html?video=${DAILYMOTION_VIDEO_ID}&autoplay=false&mute=false"
174          style="width:100%; height:100%; position:absolute; left:0; top:0; border:none;"
175          allowfullscreen allow="web-share"></iframe>
176      </div>
177    `);
178  }
179  function unmountVideo() {
180    $videoWrap.empty();
181  }
182
183  // ===== Botões =====
184  $btnWatch.on('click', e => {
185    e.preventDefault();
186    $btnWatch.addClass('active');
187    $btnListen.removeClass('active');
188
189    $audioWrap.hide();
190    if ($audio) $audio.pause();
191
192    mountVideo();
193    $videoWrap.show();
194  });
195
196  $btnListen.on('click', e => {
197    e.preventDefault();
198    $btnListen.addClass('active');
199    $btnWatch.removeClass('active');
200
201    unmountVideo();
202    $videoWrap.hide();
203
204    $audioWrap.show();
205    
206  });
207
208  // inicia com vídeo
209  mountVideo();
210  $videoWrap.show();
211  $audioWrap.hide();
212
213  // Busca a URL do stream no JSON e aplica ao player de áudio.
214  fetch(STREAM_JSON_URL, { cache: 'no-store' })
215    .then(res => res.ok ? res.json() : Promise.reject('HTTP ' + res.status))
216    .then(data => {
217      if (data && data.site_url_v2) {
218        streamUrl = data.site_url_v2;
219        if ($audio) $audio.src = streamUrl;
220      } else {
221        console.warn('site_url_v2 não encontrado no stream.json');
222      }
223    })
224    .catch(err => {
225      console.warn('stream.json indisponível.', err);
226      $timeOutput.text('Stream indisponível');
227    });
228
229  // prepara o áudio
230  initAudio();
231});
232
233document.addEventListener("DOMContentLoaded", function() {
234  // 1. URLs das lojas
235  const playStoreUrl = "https://play.google.com/store/apps/details?id=br.com.fcl.gazetaam&hl=pt_BR";
236  const appStoreUrl = "https://apps.apple.com/br/app/gazeta-online/id982235680";
237
238  // 2. Seleciona o seu botão pela classe
239  const botaoApp = document.querySelector(".baixar-app");
240
241  // Verifica se o botão existe antes de continuar
242  if (botaoApp) {
243    
244    // 3. Detecta o sistema operacional
245    const userAgent = navigator.userAgent || navigator.vendor || window.opera;
246
247    let urlDestino = ""; // Variável para guardar a URL
248
249    if (/android/i.test(userAgent)) {
250      // É Android
251      urlDestino = playStoreUrl;
252    } else if (/iPad|iPhone|iPod/.test(userAgent) && !window.MSStream) {
253      // É iOS (iPhone, iPad, iPod)
254      urlDestino = appStoreUrl;
255    } else {  
256      // para Desktops, direciona para o Google Play  (Verificar essa regra)   
257      urlDestino = playStoreUrl; 
258    }
259
260    // 4. Aplica os atributos ao botão
261    if (urlDestino) {
262      botaoApp.href = urlDestino;
263      botaoApp.target = "_blank";
264      botaoApp.rel = "noopener noreferrer";     
265    }
266
267  } else {
268    // Aviso caso o script não encontre o botão
269    console.warn("Elemento com a classe '.baixar-app' não foi encontrado.");
270  }
271});

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.