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();
|
|
|
|
}
|
2020-04-01 18:51:36 +02:00
|
|
|
};
|
2020-02-20 15:11:05 +01:00
|
|
|
|
|
|
|
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) {
|
|
|
|
if (value) {
|
|
|
|
createCookie("radio-autoplay", "true", 31);
|
2020-02-20 17:28:30 +01:00
|
|
|
_paq.push(['trackGoal', 2]);
|
2020-02-20 15:11:05 +01:00
|
|
|
startMusic();
|
|
|
|
} else {
|
|
|
|
createCookie("radio-autoplay", "false", 31);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
};
|
|
|
|
|
|
|
|
var radio_autoplay = readCookie("radio-autoplay");
|
|
|
|
if (radio_autoplay == null) {
|
2020-02-20 15:12:42 +01:00
|
|
|
setTimeout(askForRadio, 8000);
|
2020-02-20 15:11:05 +01:00
|
|
|
} else if (radio_autoplay == 'true') {
|
|
|
|
var radio_player = document.getElementById("radio-player");
|
|
|
|
$("#radio-autoplay-button").prop("checked", true);
|
|
|
|
|
2020-02-20 15:27:24 +01:00
|
|
|
radio_player.autoplay = radio_autoplay;
|
2020-02-20 15:11:05 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
$("#radio-autoplay-button").on("change", function(e) {
|
|
|
|
eraseCookie("radio-autoplay");
|
|
|
|
createCookie("radio-autoplay", $(e.currentTarget).is(":checked"), 31);
|
|
|
|
});
|
2020-04-01 18:51:36 +02:00
|
|
|
|
|
|
|
$("#play-podcast").off();
|
|
|
|
$("#play-podcast").on("click", function(e) {
|
|
|
|
var link = $("#select-podcast").val();
|
|
|
|
|
2020-04-01 18:56:05 +02:00
|
|
|
$("#container-podcast").attr("src", link);
|
2020-04-01 18:51:36 +02:00
|
|
|
});
|
2019-08-14 16:22:22 +02:00
|
|
|
});
|