ZF INVESTIŢI ÎN ROMÂNIA: Cum evoluază piaţa serviciilor de ride-hailing? Ce roluri mai poate juca Uber în mobilitatea din România?

.hide {
display: none!important;
}
#playerContainer {
display: inline-block;
margin: 20px auto!important;
background: #eee;
display: inline-block;
padding: 20px;
border-radius: 15px;
}
.logoContainer {
margin-bottom: 10px!important;
width: 200px;
}
.logoContainer img {
width: 100%;
}

(function() {

var answerContainer;
var playerContainer;
var logoContainer;
var panel;
var audioTag;
var audioSource;
var logo;
var stage;
var songIndex = 0;
var previewState = "";
var nextBtn;
var radio_playlist = [
'/playlist/track1.mp3',
'/playlist/track2.mp3',
'/playlist/track3.mp3',
'/playlist/track4.mp3',
'/playlist/track5.mp3'
];

//creez sursa playerului
audioSource = document.createElement("source");
audioSource.setAttribute("src", radio_playlist[songIndex]);
audioSource.setAttribute("type", "audio/mpeg");

//creez playerul si adaug sursa
audioTag = document.createElement("audio");
audioTag.controls = true;
// audioTag.autoplay = true;
audioTag.appendChild(audioSource);

//creez img cu logo
logo = document.createElement("img");
logo.setAttribute("src", "/images/logo_smart.png");

//creez un div in care pun img-ul cu logo
logoContainer = document.createElement("div");
logoContainer.setAttribute("class", "logoContainer");
logoContainer.appendChild(logo);

//creez containerul playerului si adaug logoul si playerul
playerContainer = document.createElement("div");
playerContainer.setAttribute("id", "playerContainer");
playerContainer.appendChild(logoContainer);
playerContainer.appendChild(audioTag);

var interv = setInterval(function () {

panel = document.getElementById("nvl-widget-container").querySelector('.nvl-panel');

if (panel) {

panel.insertBefore(playerContainer, panel.childNodes[2]);

stage = 1;
previewState = "quiz";
addEventButton();
clearInterval(interv);
}
}, 1000);

function addEventButton() {
var interv = setInterval(function () {
nextBtn = document.getElementById("nvl-next-button");
if (typeof(nextBtn) != 'undefined' && nextBtn != null) {
if (stage > 1) {
nextBtn.removeEventListener("click", handleClickNextButton);
}
nextBtn.addEventListener("click", handleClickNextButton);
clearInterval(interv);
}
}, 100);
}

function handleClickNextButton() {

var interv = setInterval(function () {

answerContainer = document.getElementById("nvl-widget-container").getElementsByClassName("nvl-answers-container")[0];

if (typeof(answerContainer) != 'undefined' && answerContainer != null && answerContainer.hasAttribute("type")) {

if ( answerContainer.getAttribute("type") === "results" && previewState === "quiz" ) {

stage++;
previewState = "results";
playerContainer.classList.add("hide");
audioTag.pause();
addEventButton();
clearInterval(interv);

} else if ( answerContainer.getAttribute("type") === "quiz" && previewState === "results" ) {

stage++;
previewState = "quiz";
playerContainer.classList.remove("hide");
nextSong();
addEventButton();
clearInterval(interv);

}
}
}, 100);
}

function nextSong() {
songIndex += 1;
audioSource.setAttribute("src", radio_playlist[songIndex]);
audioSource.setAttribute("type", "audio/mpeg");
audioTag.load();
}

function getCookie(name) {
var value = "; " + document.cookie;
var parts = value.split("; " + name + "=");
if (parts.length == 2) return parts.pop().split(";").shift();
}

function nextDay(x){
var now = new Date();
var daysLeft = (x+(7-now.getDay())) % 7;
if(daysLeft == 0) {
daysLeft = 7;
}
now.setDate(now.getDate() + daysLeft);
return now;
}

function cookieStatus() {
var quizCookie = "nvl_quiz_cookie";
var testCookie = "verify_quiz";
var dayLimit = 1; // ziua de luni - ziua in care trebuie sterse cookieurile quizului sa se poata afisa din nou
var oraStergere = 14; // ora la care se vor sterge cookieurile

var value = getCookie(testCookie);

if (!value) {
// console.log("Nu exista cookiul meu, deci stergem cookie-ul sondajului si scriu cookie-ul meu");
var date = nextDay(dayLimit);
date.setHours(oraStergere);
date.setMinutes(0);
date.setSeconds(0);

document.cookie = quizCookie + "=; expires=Thu, 01 Jan 1970 00:00:01 GMT; path=/";
document.cookie = testCookie + "=1; expires=" + date + "; path=/";
}
else {
// console.log("Exista cookiul meu, deci nu fac nimic");
}
}

// cookieStatus();

})();

Tweet

Print
Mail

Articole recomandate

...

Informatie preluata din publicatia Ziarul Financiar - citeste integral articolul - click aici

Alte articole

Ooni Koda
© Copyright 2023 InfoBursa

Web Design by Dow Media | Gazduire Web by SpeedHost.ro