1
0
mirror of https://github.com/exane/not-gwent-online synced 2024-10-31 10:36:53 +00:00
not-gwent-online/assets/js/temp.js
2015-07-05 14:33:54 +02:00

47 lines
1.1 KiB
JavaScript

// Start music.
$(".video-self").tubeplayer({
width: 0.001,
height: 0.001,
initialVideo: "UE9fPWy1_o4",
autoPlay: true,
onPlayerEnded: function(){
$(".video-self").tubeplayer('play');
}
});
if(localStorage.getItem('volume') == 'off') {
$('.music-icon').removeClass('active');
}
if(localStorage.getItem('volumeValue') != null) {
$('.video-self').tubeplayer('volume', localStorage.getItem('volumeValue'));
$('.volume').val(localStorage.getItem('volumeValue'));
} else {
$('.volume').val('75');
$('.video-self').tubeplayer('volume', 75);
}
// Set volume.
$('.volume').on('blur', function() {
var val = $(this).val();
if(val > 100) val = 100;
if(val < 0) val = 0;
if( ! val) val = 75;
$('.video-self').tubeplayer('volume', val);
localStorage.setItem('volumeValue', val);
});
// Music options.
$('.music-icon').on('click', function() {
if($(this).hasClass('active')) {
localStorage.setItem('volume', 'off');
$(this).removeClass('active');
$(".video-self").tubeplayer('mute');
} else {
localStorage.setItem('volume', 'on');
$(this).addClass('active');
$(".video-self").tubeplayer('unmute');
}
});