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(); 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; //var pad = 0;
/*$(".zicon").on("click", function(e) { /*$(".zicon").on("click", function(e) {

View File

@@ -544,7 +544,7 @@ function loadChromecastVideo() {
} catch(event){ } catch(event){
_seekTo = seekTo; _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}; 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; if(Player.np.thumbnail) image.url = Player.np.thumbnail;
mediaInfo.metadata = new chrome.cast.media.GenericMediaMetadata(); mediaInfo.metadata = new chrome.cast.media.GenericMediaMetadata();
@@ -557,6 +557,7 @@ function loadChromecastVideo() {
end: Player.np.end, end: Player.np.end,
seekTo: _seekTo, seekTo: _seekTo,
channel: chan.toLowerCase(), channel: chan.toLowerCase(),
source: videoSource,
thumbnail: Player.np.thumbnail != undefined ? Player.np.thumbnail : 'https://img.youtube.com/vi/'+video_id+'/mqdefault.jpg', thumbnail: Player.np.thumbnail != undefined ? Player.np.thumbnail : 'https://img.youtube.com/vi/'+video_id+'/mqdefault.jpg',
}; };
castSession.loadMedia(request).then(function() { castSession.loadMedia(request).then(function() {

View File

@@ -209,6 +209,14 @@ window.addEventListener("DOMContentLoaded", function() {
else if(!fromChannel && window.location.pathname == "/"){ else if(!fromChannel && window.location.pathname == "/"){
Frontpage.init(); 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(window.location.pathname == "/" && !client) {
if(document.querySelectorAll("script[src='https://www.youtube.com/iframe_api']").length == 1){ 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; 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){ addListener("click", ".connect_error", function(event){
this.preventDefault(); this.preventDefault();
M.Toast.getInstance(this.parentElement).dismiss(); M.Toast.getInstance(this.parentElement).dismiss();

View File

@@ -60,6 +60,7 @@
</div> </div>
</div> </div>
{{/unless}} {{/unless}}
{{> modal/cookie}}
{{> contact}} {{> contact}}
{{> donate}} {{> donate}}
{{> footer}} {{> footer}}

View File

@@ -0,0 +1,11 @@
<div id="cookie" class="modal">
<div class="modal-content">
<h4>Cookies</h4>
<p>We're using Google Analytics to track page-visits, and better understand how users navigate through the page. </p>
<p>We're also using cookies to store your sessions, to enable for a much more seamless interaction with the app, allowing for a more persistent chat- and authenticated-session.</p>
<p>By using this site, you're allowing us to both use the Google Analytics and our own cookies, and save them on your computer. None of these cookies can be used to identify, so don't worry.</p>
</div>
<div class="modal-footer">
<a href="#!" class=" modal-action modal-close waves-effect waves-green btn-flat">Close</a>
</div>
</div>