Changed cookie-toast and added a cookie-modal

This commit is contained in:
Kasper Rynning-Tønnesen
2018-08-28 19:19:59 +02:00
parent ce27b65991
commit f290812f6d
5 changed files with 28 additions and 6 deletions

View File

@@ -513,11 +513,6 @@ var Frontpage = {
M.Modal.getInstance(document.getElementById("donation")).open();
}
if(!localStorage.ok_cookie){
before_toast();
//M.toast({html: "We're using cookies to enhance your experience! <a class='waves-effect waves-light btn light-green' href='#' id='cookieok' style='cursor:pointer;pointer-events:all;margin-left:10px;'> ok</a>", displayLength: 10000});
}
//var pad = 0;
/*$(".zicon").on("click", function(e) {

View File

@@ -544,7 +544,7 @@ function loadChromecastVideo() {
} catch(event){
_seekTo = seekTo;
}
var mediaInfo = new chrome.cast.media.MediaInfo(video_id, videoSource);
var mediaInfo = new chrome.cast.media.MediaInfo(video_id, "video");
var image = {url:'https://img.youtube.com/vi/'+video_id+'/mqdefault.jpg', heigth: 180, width: 320};
if(Player.np.thumbnail) image.url = Player.np.thumbnail;
mediaInfo.metadata = new chrome.cast.media.GenericMediaMetadata();
@@ -557,6 +557,7 @@ function loadChromecastVideo() {
end: Player.np.end,
seekTo: _seekTo,
channel: chan.toLowerCase(),
source: videoSource,
thumbnail: Player.np.thumbnail != undefined ? Player.np.thumbnail : 'https://img.youtube.com/vi/'+video_id+'/mqdefault.jpg',
};
castSession.loadMedia(request).then(function() {

View File

@@ -209,6 +209,14 @@ window.addEventListener("DOMContentLoaded", function() {
else if(!fromChannel && window.location.pathname == "/"){
Frontpage.init();
}
if(!localStorage.ok_cookie){
before_toast();
M.toast({html: "This website uses cookies! <a class='waves-effect waves-light btn light-green' href='#' id='cookieok' style='cursor:pointer;pointer-events:all;margin-left:10px;'> ok</a><a class='waves-effect waves-light btn orange lighten' href='#cookies' id='cookieinfo' style='cursor:pointer;pointer-events:all;margin-left:10px;'> info</a>", displayLength: 10000000});
}
if(window.location.hash == "#cookies") {
M.Modal.init(document.getElementById("cookie"));
M.Modal.getInstance(document.getElementById("cookie")).open();
}
if(window.location.pathname == "/" && !client) {
if(document.querySelectorAll("script[src='https://www.youtube.com/iframe_api']").length == 1){
@@ -511,6 +519,12 @@ addListener("click", '#cookieok', function(e) {
localStorage.ok_cookie = true;
});
addListener("click", "#cookieinfo", function(e) {
this.preventDefault();
M.Modal.init(document.getElementById("cookie"));
M.Modal.getInstance(document.getElementById("cookie")).open();
});
addListener("click", ".connect_error", function(event){
this.preventDefault();
M.Toast.getInstance(this.parentElement).dismiss();