2019-08-14 16:22:22 +02:00
|
|
|
$(document).ready(function() {
|
|
|
|
var sjs = SimpleJekyllSearch({
|
|
|
|
searchInput: document.getElementById('search-input'),
|
|
|
|
resultsContainer: document.getElementById('results-container'),
|
|
|
|
json: '/search.json',
|
|
|
|
searchResultTemplate: '<a class="dropdown-item" href="{url}">{title}</a>',
|
|
|
|
noResultsText: '<a class="dropdown-item" href="#">Nessun risultato</a>',
|
|
|
|
exclude: ["https://blog.unitoo.it", "https://blog.unitoo.pw"]
|
|
|
|
});
|
|
|
|
|
|
|
|
$(".morphext-bounce-in").Morphext({
|
|
|
|
animation: "bounceIn",
|
|
|
|
speed: 2500
|
|
|
|
});
|
|
|
|
|
|
|
|
$(".morphext-bounce-left").Morphext({
|
|
|
|
animation: "zoomInLeft",
|
|
|
|
speed: 4500
|
|
|
|
});
|
|
|
|
|
|
|
|
$(".morphext-bounce-up").Morphext({
|
|
|
|
animation: "bounceInUp",
|
|
|
|
speed: 6500
|
|
|
|
});
|
|
|
|
|
2020-02-20 15:11:05 +01:00
|
|
|
var startMusic = function() {
|
|
|
|
var radio_player = document.getElementById("radio-player");
|
|
|
|
|
|
|
|
if (radio_player.paused) {
|
|
|
|
radio_player.play();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
var askForRadio = function() {
|
|
|
|
$("body").overhang({
|
|
|
|
custom: true,
|
|
|
|
type: "confirm",
|
|
|
|
primary: "#f39200",
|
|
|
|
accent: "#ffc56e",
|
|
|
|
yesColor: "white",
|
|
|
|
yesMessage: "<i class='fas fa-heart text-danger'></i> Adoro!",
|
|
|
|
noMessage: "<i class='fas fa-times-circle'></i> Magari un'altra volta!",
|
|
|
|
noColor: "white",
|
|
|
|
message: "Ti piacerebbe ascoltare la radio mentre navighi sul sito?",
|
|
|
|
callback: function (value) {
|
|
|
|
console.log(value);
|
|
|
|
|
|
|
|
if (value) {
|
|
|
|
createCookie("radio-autoplay", "true", 31);
|
|
|
|
startMusic();
|
|
|
|
} else {
|
|
|
|
createCookie("radio-autoplay", "false", 31);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
};
|
|
|
|
|
|
|
|
var radio_autoplay = readCookie("radio-autoplay");
|
|
|
|
if (radio_autoplay == null) {
|
|
|
|
setTimeout(askForRadio, 2000);
|
|
|
|
} else if (radio_autoplay == 'true') {
|
|
|
|
var radio_player = document.getElementById("radio-player");
|
|
|
|
$("#radio-autoplay-button").prop("checked", true);
|
|
|
|
|
|
|
|
radio_player.oncanplay = startMusic;
|
|
|
|
radio_player.oncanplaythrough = startMusic;
|
|
|
|
}
|
|
|
|
|
|
|
|
$("#radio-autoplay-button").on("change", function(e) {
|
|
|
|
eraseCookie("radio-autoplay");
|
|
|
|
createCookie("radio-autoplay", $(e.currentTarget).is(":checked"), 31);
|
|
|
|
});
|
2019-08-14 16:22:22 +02:00
|
|
|
});
|