mirror of
https://github.com/KevinMidboe/zoff.git
synced 2025-12-08 20:48:48 +00:00
Added option to preview embedded element
This commit is contained in:
@@ -130,7 +130,11 @@ var Channel = {
|
||||
});
|
||||
|
||||
if(!client) {
|
||||
M.Modal.init(document.getElementById("embed"));
|
||||
M.Modal.init(document.getElementById("embed"), {
|
||||
onCloseStart: function() {
|
||||
document.querySelector(".embed-preview").innerHTML = "";
|
||||
}
|
||||
});
|
||||
} else {
|
||||
Helper.removeElement("#embed");
|
||||
Helper.removeElement(".embed-button-footer");
|
||||
|
||||
@@ -40,13 +40,13 @@ function resizeFunction() {
|
||||
if(chan && !Helper.mobilecheck()){
|
||||
if(document.querySelector("#wrapper") == null) return;
|
||||
if(!client && !embed) document.querySelector("#hide-playlist").style.left = (document.querySelector("#video-container").offsetWidth - document.querySelector("#hide-playlist").offsetWidth) + "px";
|
||||
if(window.innerWidth > 600 && document.querySelector("#wrapper").style.height != "") {
|
||||
if(((window.innerWidth > 600 && !embed) || (window.innerWidth > 500 && !embed)) && document.querySelector("#wrapper").style.height != "") {
|
||||
document.querySelector("#wrapper").style.height = "";
|
||||
document.querySelector("#chat-bar").style.height = "";
|
||||
document.querySelector("#channelchat").style.height = "";
|
||||
document.querySelector("#all_chat").style.height = "";
|
||||
document.querySelector("#chat-container").style.height = "";
|
||||
} else if(window.innerWidth < 601) {
|
||||
} else if(((window.innerWidth < 601 && !embed) || (window.innerWidth < 501 && !embed))) {
|
||||
if(!client && !embed) {
|
||||
var scPlaying = false;
|
||||
var ytPlaying = false;
|
||||
|
||||
@@ -88,7 +88,7 @@ var access_token_data = {};
|
||||
var spotify_authenticated = false;
|
||||
var not_import_html = "";
|
||||
var not_export_html = "";
|
||||
var embed_height = 300;
|
||||
var embed_height = 400;
|
||||
var embed_width = 600;
|
||||
var embed_videoonly = "&videoonly=false";
|
||||
var embed_localmode = "&localmode=false";
|
||||
@@ -430,6 +430,15 @@ initializeCastApi = function() {
|
||||
};
|
||||
|
||||
function addDynamicListeners() {
|
||||
addListener("click", ".preview-embed", function(event) {
|
||||
this.preventDefault();
|
||||
if(document.querySelector(".embed-preview").innerHTML == "") {
|
||||
document.querySelector(".embed-preview").innerHTML = embed_code(embed_autoplay, embed_width, embed_height, color, embed_videoonly, embed_localmode);
|
||||
} else {
|
||||
document.querySelector(".embed-preview").innerHTML = "";
|
||||
}
|
||||
});
|
||||
|
||||
addListener("click", "#player_overlay", function(event) {
|
||||
if(chromecastAvailable) {
|
||||
Player.playPauseVideo();
|
||||
@@ -1236,7 +1245,11 @@ function addDynamicListeners() {
|
||||
|
||||
addListener("click", "#embed-button", function() {
|
||||
this.preventDefault();
|
||||
M.Modal.init(document.getElementById("embed"));
|
||||
M.Modal.init(document.getElementById("embed"), {
|
||||
onCloseStart: function() {
|
||||
document.querySelector(".embed-preview").innerHTML = "";
|
||||
}
|
||||
});
|
||||
ga('send', 'event', "button-click", "embed-channel", "channel-name", chan.toLowerCase());
|
||||
M.Modal.getInstance(document.getElementById("embed")).open();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user