PageSourceSearch

https://radiolot.cat/wp-content/plugins/volcanic-functions-radio-olot/assets/js/vlc_scripts.js

js radiolot.cat collected 2026-10-02 12:47:31 UTC 8,984 bytes, 311 lines download raw bytes

1(function($) {
2  $(document).ready(function() {
3
4
5
6    $(".searchandfilter").submit(function() {
7        $("#data-inici-fake").remove();
8        $("#data-fi-fake").remove();
9    });
10    if($("#data-inici-fake").length) {
11      $("#data-inici-fake").datepicker({
12        dateFormat: "dd/mm/yy", //Establece el formato de fecha
13        altField: "#data-inici",
14        altFormat: "yy/mm/dd",
15        changeMonth: true, //Permite seleccionar el mes directamente
16        changeYear: true, //Permite seleccionar el año directamente
17        onClose: function (selectedDate){
18          $("#data-fi-fake").datepicker("option", "minDate", selectedDate);
19        }
20      });
21    };
22    if($("#data-fi-fake").length) {
23      $("#data-fi-fake").datepicker({
24        dateFormat: "dd/mm/yy",
25        altField: "#data-fi",
26        altFormat: "yy/mm/dd",
27        changeMonth: true,
28        changeYear: true,
29        onClose: function (selectedDate){
30          $("#data-inici-fake").datepicker("option", "maxDate", selectedDate);
31        }
32      });
33    };
34
35
36    $('.player-audio').initAudioPlayer();
37
38    $('.start-radio').click(function(){
39
40      var linkAudio   = $(this).attr('data-podcast'),
41      myPlayerPod = $('#player')[0],
42      nameEpisode = $(this).attr('data-episode');
43      var idAudio = $(this).attr('id');
44
45      $( ".playing" ).each(function() {
46        idPlaying = $(this).attr('id');
47        if(idAudio != idPlaying ) {
48          $( this ).removeClass('playing');
49        }
50      });
51
52      if(idAudio) {
53        if( $('#' + idAudio).hasClass("playing")){
54
55          myPlayerPod.pause();
56          $('#' + idAudio).removeClass('playing');
57          $('#play-btn').removeClass('pause');
58
59        } else {
60
61          $('.audio-player source').attr('src', linkAudio);
62          $('.audio-player source').removeClass().addClass(idAudio);
63          $('.player-controls p strong').text(nameEpisode);
64
65          myPlayerPod.load();
66          myPlayerPod.play();
67          $('#' + idAudio).addClass('playing');
68          $('.other-player').addClass('show');
69          $('#' + idAudio).addClass('pause');
70          $('#play-btn').addClass('pause');
71        }
72      } else {
73
74        if($(this).hasClass("playing")){
75
76          myPlayerPod.pause();
77          $('.start-radio').removeClass('playing');
78          $('#play-btn').removeClass('pause');
79        } else {
80          $('.audio-player source').attr('src', linkAudio);
81          $('.player-controls p strong').text(nameEpisode);
82
83          myPlayerPod.load();
84          myPlayerPod.play();
85          $('.start-radio').addClass('playing');
86          $('.other-player').addClass('show');
87          $('#play-btn').addClass('pause');
88        }
89      }
90
91
92
93    });
94  })
95})(jQuery);
96
97
98
99
100jQuery(document).ready(function() {
101
102
103function copyText($value) {
104            var el = document.createElement('textarea');
105            el.value = $value;
106            el.setAttribute('readonly', '');
107            el.style = {position: 'absolute', left: '-9999px'};
108            document.body.appendChild(el);
109            el.select();
110            document.execCommand('copy');
111            document.body.removeChild(el);
112            }
113    //get audios files and infos about the episode
114
115    /*   jQuery('.playing').click(function(){
116    //var linkAudio   = jQuery(this).attr('data-podcast'),
117   // myPlayerPod = jQuery('#player')[0];
118   // myPlayerPod.pause();
119    jQuery('.playing').addClass('start-radio');
120
121  });
122   */
123 // display and hide player after they are showing in screen
124 jQuery('.close-player').click(function() {
125
126 	jQuery('.other-player.show').addClass('hide');
127   	jQuery(this).addClass('hide');
128 	jQuery('.open-player').addClass('show');
129
130 });
131
132  jQuery('.open-player').click(function() {
133
134 	jQuery('.other-player.show').removeClass('hide');
135   	jQuery(this).removeClass('show');
136 	jQuery('.close-player').removeClass('hide');
137
138 });
139
140
141  //var audio = document.getElementsByTagName('audio')[0];
142  var audio = document.getElementById('player');
143
144  jQuery('.muted').click(function () {
145      audio.muted = !audio.muted;
146      return false;
147  });
148
149  //VOLUME BAR
150  //volume bar event
151  var volumeDrag = false;
152  jQuery('.volume').on('mousedown', function (e) {
153      volumeDrag = true;
154      audio.muted = false;
155      jQuery('.sound').removeClass('muted');
156      updateVolume(e.pageX);
157  });
158  jQuery(document).on('mouseup', function (e) {
159      if (volumeDrag) {
160          volumeDrag = false;
161          updateVolume(e.pageX);
162      }
163  });
164  jQuery(document).on('mousemove', function (e) {
165      if (volumeDrag) {
166          updateVolume(e.pageX);
167      }
168  });
169  var updateVolume = function (x, vol) {
170      var volume = $('.volume');
171      var percentage;
172      //if only volume have specificed
173      //then direct update volume
174      if (vol) {
175          percentage = vol * 100;
176      } else {
177          var position = x - volume.offset().left;
178          percentage = 100 * position / volume.width();
179      }
180
181      if (percentage > 100) {
182          percentage = 100;
183      }
184      if (percentage < 0) {
185          percentage = 0;
186      }
187
188      //update volume bar and video volume
189      jQuery('.volumeBar').css('width', percentage + '%');
190      audio.volume = percentage / 100;
191
192      //change sound icon based on volume
193      if (audio.volume == 0) {
194          jQuery('.sound').removeClass('sound2').addClass('muted');
195      } else if (audio.volume > 0.5) {
196          jQuery('.sound').removeClass('muted').addClass('sound2');
197      } else {
198          jQuery('.sound').removeClass('muted').removeClass('sound2');
199      }
200
201  };
202
203});
204
205function calculateTotalValue(length) {
206    var minutes = Math.floor(length / 60),
207      seconds_int = length - minutes * 60,
208      seconds_str = seconds_int.toString(),
209      seconds = seconds_str.substr(0, 2),
210      time = minutes + ':' + seconds
211
212    return time;
213  }
214
215  function calculateCurrentValue(currentTime) {
216    var current_hour = parseInt(currentTime / 3600) % 24,
217      current_minute = parseInt(currentTime / 60) % 60,
218      current_seconds_long = currentTime % 60,
219      current_seconds = current_seconds_long.toFixed(),
220      current_time = (current_minute < 10 ? "0" + current_minute : current_minute) + ":" + (current_seconds < 10 ? "0" + current_seconds : current_seconds);
221
222    return current_time;
223  }
224
225  function initProgressBar() {
226    var player = document.getElementById('player');
227    var length = player.duration
228    var current_time = player.currentTime;
229
230    if(player.duration == "Infinity") {
231      player.duration = "3000";
232    }
233
234    // calculate total length of value
235    var totalLength = calculateTotalValue(length)
236    jQuery(".end-time").html(totalLength);
237
238    // calculate current value time
239    var currentTime = calculateCurrentValue(current_time);
240    jQuery(".start-time").html(currentTime);
241
242    var progressbar = document.getElementById('seekObj');
243    if(!isNaN(player.duration)) {
244      progressbar.value = (player.currentTime / player.duration);
245      progressbar.addEventListener("click", seek);
246
247      if (player.currentTime == player.duration) {
248        $('#play-btn').removeClass('pause');
249      }
250    }
251    function seek(evt) {
252      var percent = evt.offsetX / this.offsetWidth;
253      player.currentTime = percent * player.duration;
254      progressbar.value = percent / 100;
255    }
256  };
257
258  function initPlayers(num) {
259    // pass num in if there are multiple audio players e.g 'player' + i
260
261    for (var i = 0; i < num; i++) {
262      (function() {
263
264        // Variables
265        // ----------------------------------------------------------
266        // audio embed object
267        var playerContainer = document.getElementById('player-container'),
268          player = document.getElementById('player'),
269          isPlaying = false,
270          playBtn = document.getElementById('play-btn');
271
272        // Controls Listeners
273        // ----------------------------------------------------------
274        if (playBtn != null) {
275          playBtn.addEventListener('click', function() {
276            togglePlay()
277          });
278        }
279
280        // Controls & Sounds Methods
281        // ----------------------------------------------------------
282        function togglePlay() {
283          if (player.paused === false) {
284            player.pause();
285            isPlaying = false;
286            $('#play-btn').removeClass('pause');
287            $('.start-radio').removeClass('playing');
288
289          } else {
290
291            var idAudio2 = $(this).attr('id');
292            player.play();
293            isPlaying = true;
294            $('#play-btn').addClass('pause');
295            var classSource = $('.audio-player source').attr('class');
296            $( ".start-radio" ).each(function() {
297              idPlaying = $(this).attr('id');
298              if(classSource == idPlaying ) {
299                $( this ).addClass('playing');
300                return false;
301              }
302            });
303
304
305          }
306        }
307      }());
308    }
309  }
310
311initPlayers(jQuery('#player-container').length);

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.