PageSourceSearch

https://www.radiovitosha.com/resources/assets/scripts/radio.js?v=2

js radiovitosha.com collected 2026-10-02 06:36:29 UTC 3,569 bytes, 120 lines download raw bytes

1var  hls=false;
2var audio=false
3function play() {
4    audio = document.getElementById('radioplayer');
5     console.log('init player');
6    audio.src = audiosrc;
7    hls = new Hls();
8
9    audio.muted = false;
10
11
12    $('#radio_volume').on("input change", function () {
13        // audio.volume = $(this).val() / 100;
14        radioVolume()
15        $(this).css('--value', $(this).val());
16
17        if ($(this).val() === 0) {
18            audio.muted = true;
19        } else {
20            audio.muted = false;
21        }
22    });
23
24// Play, Pause icon add event listener
25    $('.player-play').click(function () {
26        $('.player-play').toggleClass('playing');
27    })
28
29    const mediaQuery1 = window.matchMedia('(max-width: 1919px)');
30// Event Listener for open sound bar
31    if (mediaQuery1.matches) {
32        $('.player-button.sound .icon, .player-button.sound .player-button-name').click(function () {
33            $('.player-sound-bar').slideToggle("slow", function () {
34                $('.player-sound-bar').toggleClass('active');
35            });
36        });
37    } else {
38        $('.player-button.sound .icon').on("click", function () {
39            if ($(this).hasClass('unmute')) {
40                audio.muted = true;
41                audio.volume = 0;
42                // $('.player-sound-bar input[type="range"]').css({'--value':'0'});
43
44            } else if ($(this).hasClass('mute')) {
45                audio.muted = false;
46                audio.volume = 0.5;
47                // $('.player-sound-bar input[type="range"]').css({'--value':'50'});
48            }
49
50            $('.unmute, .mute').toggleClass('d-none');
51        })
52    }
53
54// Open search bar on tablet and desktop
55    $('.search-bar-actions').click(function () {
56        $('.player-right .search-bar-actions .search, .player-right .search-bar-actions .close, .player-right .search-bar').toggle('slow');
57    })
58
59    for (let e of document.querySelectorAll('input[type="range"]')) {
60        e.style.setProperty('--value', e.value);
61        e.style.setProperty('--min', e.min == '' ? '0' : e.min);
62        e.style.setProperty('--max', e.max == '' ? '100' : e.max);
63
64        e.addEventListener('input', () => {
65            if (e.value === '0') {
66                $('.unmute, .mute').toggleClass('d-none');
67            } else {
68                $('.unmute').removeClass('d-none');
69                $('.mute').addClass('d-none');
70            }
71            e.style.setProperty('--value', e.value)
72        });
73    }
74
75// Event listener for resize of player data
76    let resizeObserver = new ResizeObserver(() => {
77        AnimatePlayerData()
78    });
79
80    var elem = $('.singer-name')[0];
81    resizeObserver.observe(elem);
82}
83
84function AnimatePlayerData() {
85
86    AnimatePlayerEl('player-artist');
87    AnimatePlayerEl('player-song');
88
89    function AnimatePlayerEl(el) {
90        var el = $(`.${el}`);
91        if (el.width() > $('.player-data').width()) {
92            el.parent().addClass('animated');
93        } else if (el.parent().hasClass('animated')) {
94            el.parent().removeClass('animated')
95        }
96    }
97}
98function clickRadioPlay() {
99
100    // if (Hls.isSupported()) {
101    //     hls.loadSource(audiosrc);
102    //     hls.attachMedia(audio);
103    // } else if (audio.canPlayType('application/vnd.apple.mpegurl')) {
104    //     audio.src = audiosrc;
105    // }
106     audio.volume = $('#radio_volume').val() / 100;
107    // audio.volume=0.5;
108    audio.play();
109
110};
111
112function  clickRadioPause() {
113
114    audio.pause();
115    hls.detachMedia(audio);
116};
117function radioVolume()
118{
119    audio.volume = $('#radio_volume').val() / 100;
120}

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.