Open modal always when small player/iframed, close after 5 seconds

This commit is contained in:
Kasper Rynning-Tønnesen
2018-09-23 21:37:19 +02:00
parent b121151240
commit ced5e52223

View File

@@ -207,13 +207,18 @@ var Channel = {
if(!client) { if(!client) {
if(!Helper.mobilecheck()) { if(!Helper.mobilecheck() && !small_player) {
var shareCodeUrl = window.location.protocol + "//client."+window.location.hostname+"/r/"+btoa(encodeURIComponent(chan.toLowerCase())); var shareCodeUrl = window.location.protocol + "//client."+window.location.hostname+"/r/"+btoa(encodeURIComponent(chan.toLowerCase()));
document.getElementById("share-join-qr").setAttribute("src", "https://chart.googleapis.com/chart?chs=221x221&cht=qr&choe=UTF-8&chld=L|1&chl="+shareCodeUrl); document.getElementById("share-join-qr").setAttribute("src", "https://chart.googleapis.com/chart?chs=221x221&cht=qr&choe=UTF-8&chld=L|1&chl="+shareCodeUrl);
Helper.setHtml("#channel-name-join", "client." + window.location.hostname + "/" + encodeURIComponent(chan.toLowerCase())); Helper.setHtml("#channel-name-join", "client." + window.location.hostname + "/" + encodeURIComponent(chan.toLowerCase()));
} else if(small_player) { } else if(small_player) {
document.querySelector("#channel-share-modal .modal-content").innerHTML = "<p>To listen to this channel, go to</p><p>https://zoff.me/" + encodeURIComponent(chan.toLowerCase()) + "</p><img src='/assets/images/favicon.png' height='100' width='100' alt='circle-logo-zoff'>"; document.querySelector("#channel-share-modal .modal-content").innerHTML = "<p>To listen to this channel, go to</p><p>https://zoff.me/" + encodeURIComponent(chan.toLowerCase()) + "</p><img src='/assets/images/favicon.png' height='100' width='100' alt='circle-logo-zoff'>";
M.Modal.getInstance(document.getElementById("channel-share-modal")).open(); M.Modal.getInstance(document.getElementById("channel-share-modal")).open();
if(!Helper.mobilecheck()) {
setTimeout(function() {
M.Modal.getInstance(document.getElementById("channel-share-modal")).close();
}, 10000);
}
} }
} else { } else {
Helper.removeElement(".video-container"); Helper.removeElement(".video-container");