The Swiss portal for the historical sciences

Oleg Lavrovky

Interview mit Oleg Lavrovky, Opendata.ch

Interviewee: 
Lavrovky Oleg
Interviewer: 
Natale, Enrico
Date: 
1. July 2016
Place: 
Basel
Language: 
e
Multimedia tags: 

"use strict";
if ((document.querySelector("iframe")) || (document.querySelector("video"))) {
const invisiblePlayButton = document.createElement("div");
invisiblePlayButton.innerHTML = ""
invisiblePlayButton.classList.add("invisiblePlayButton");
console.log(document.querySelector(".field-name-field-image"));
document.querySelector(".field-name-field-image").prepend(invisiblePlayButton);
console.log(invisiblePlayButton);
const wrapbutton = document.createElement("div");
wrapbutton.classList.add("wrapbutton");

const buttonpresentation = document.createElement("a");
console.log(buttonpresentation);
buttonpresentation.classList.add("buttonpresentation");
buttonpresentation.setAttribute('title', 'Präsentationsmodus');
const presentationiconwrap = document.createElement("span");
const presentationicon = document.createElement("i");
presentationicon.classList.add("fa", "fa-arrows-alt");

presentationiconwrap.appendChild(presentationicon);
buttonpresentation.appendChild(presentationiconwrap);

const buttonout = document.createElement("a");
buttonout.classList.add("buttonout", "stop", "stopvideorecording");
const stopiconwrap = document.createElement("span");
const stopicon = document.createElement("i");
stopicon.classList.add("fa", "fa-square");

stopiconwrap.appendChild(stopicon);
buttonout.appendChild(stopiconwrap);

wrapbutton.appendChild(buttonout);
wrapbutton.appendChild(buttonpresentation);
console.log(buttonpresentation);

document.querySelector(".field-name-field-vimeo-iframe").appendChild(wrapbutton);
console.log(wrapbutton);
}

document.querySelector(".buttonpresentation").addEventListener('click', (button) => {
button.target.closest(".wrapbutton").querySelector(".buttonpresentation").classList.toggle("presentationactive");
const currentVideo = button.target.closest(".field-name-field-vimeo-iframe").querySelector("iframe");
presentationMode(currentVideo);
});

document.querySelector(".buttonout").addEventListener('click', (vid) => {
const currentVideo = vid.target.closest(".field-name-field-vimeo-iframe").querySelector("iframe");
hideStopVideoclip(currentVideo);
});

const hideStopVideoclip = (iframe) => {
var stopplayer = new Vimeo.Player(iframe);
stopplayer.unload();
document.querySelector(".field-name-field-vimeo-iframe").classList.add("hidden");
document.querySelector(".field-name-field-image").classList.remove("hidden");
}

const showPlayVideoclip = (playButton) => {
console.log("Play Video")
console.log(playButton)
const groupwrapper = playButton.closest(".group-wrapper");
console.log(groupwrapper);
const iframe = document.querySelector("iframe") ? playButton.closest(".group-wrapper").querySelector("iframe") : playButton.closest(".group-wrapper").querySelector("video");
console.log(iframe);
//var player = new Vimeo.Player(iframe);
const player = document.querySelector("iframe") ? new Vimeo.Player(iframe) : iframe;
player.play();
if (document.querySelector("iframe")) {
player.on('ended', () => {
hideStopVideoclip(iframe);
stopPresentationMode(iframe);
});
} else if (document.querySelector("video")) {
player.onended = () => {
hideStopVideoclip(iframe)
stopPresentationMode(iframe);
};
}
document.querySelector(".field-name-field-vimeo-iframe").style.display = "block";
document.querySelector(".field-name-field-image").classList.add("hidden");
groupwrapper.querySelector(".field-name-field-vimeo-iframe").classList.remove("hidden");
}

document.querySelector(".invisiblePlayButton").addEventListener('click', (playButton) => {
showPlayVideoclip(playButton.target);
});

const startPresentationMode = currentVideo => {
console.log("startPresentationMode");
const buttonpresentation = currentVideo.closest(".group-wrapper").querySelector(".buttonpresentation");
currentVideo.closest(".group-wrapper").parentElement.classList.add("col-sm-12");
currentVideo.closest(".group-wrapper").parentElement.classList.remove("col-sm-8");
buttonpresentation.title = "Präsentationsmodus verlassen";
}

const stopPresentationMode = currentVideo => {
console.log("stopPresentationMode");
const buttonpresentation = currentVideo.closest(".group-wrapper").querySelector(".buttonpresentation");
currentVideo.closest(".group-wrapper").parentElement.classList.add("col-sm-8");
currentVideo.closest(".group-wrapper").parentElement.classList.remove("col-sm-12");
buttonpresentation.title = "Präsentationsmodus";
}

const presentationMode = currentVideo => {
console.log(currentVideo);
const buttonpresentation = currentVideo.closest(".group-wrapper").querySelector(".buttonpresentation");
if (buttonpresentation.classList.contains("presentationactive")) {
startPresentationMode(currentVideo);
} else {
stopPresentationMode(currentVideo);
}
}