Updating preview-element on refresh of variables, and updated preview-button

This commit is contained in:
Kasper Rynning-Tønnesen
2018-10-25 10:36:23 +02:00
parent 1a7ff97e7e
commit 0aa6910f25
2 changed files with 13 additions and 0 deletions

View File

@@ -2762,6 +2762,10 @@ nav ul li:hover, nav ul li.active {
height: 27px; height: 27px;
} }
.embed-preview iframe {
border: none;
}
.hide .hide
{ {
display:none !important; display:none !important;

View File

@@ -15,6 +15,7 @@ try {
var SC_widget; var SC_widget;
var scUsingWidget = false; var scUsingWidget = false;
var SC_player; var SC_player;
var previewing = false;
var sc_initialized = false; var sc_initialized = false;
var soundcloud_enabled = true; var soundcloud_enabled = true;
var local_new_channel = false; var local_new_channel = false;
@@ -433,8 +434,12 @@ function addDynamicListeners() {
addListener("click", ".preview-embed", function(event) { addListener("click", ".preview-embed", function(event) {
this.preventDefault(); this.preventDefault();
if(document.querySelector(".embed-preview").innerHTML == "") { if(document.querySelector(".embed-preview").innerHTML == "") {
document.querySelector(".preview-embed").innerText = "Stop";
previewing = true;
document.querySelector(".embed-preview").innerHTML = embed_code(embed_autoplay, embed_width, embed_height, color, embed_videoonly, embed_localmode); document.querySelector(".embed-preview").innerHTML = embed_code(embed_autoplay, embed_width, embed_height, color, embed_videoonly, embed_localmode);
} else { } else {
previewing = true;
document.querySelector(".preview-embed").innerText = "Preview";
document.querySelector(".embed-preview").innerHTML = ""; document.querySelector(".embed-preview").innerHTML = "";
} }
}); });
@@ -712,12 +717,14 @@ function addDynamicListeners() {
addListener("change", "#width_embed", function(event) { addListener("change", "#width_embed", function(event) {
var that = this.target; var that = this.target;
embed_width = that.value; embed_width = that.value;
if(previewing) document.querySelector(".embed-preview").innerHTML = embed_code(embed_autoplay, embed_width, embed_height, color, embed_videoonly, embed_localmode);
document.getElementById("embed-area").value = embed_code(embed_autoplay, embed_width, embed_height, color, embed_videoonly, embed_localmode); document.getElementById("embed-area").value = embed_code(embed_autoplay, embed_width, embed_height, color, embed_videoonly, embed_localmode);
}); });
addListener("change", "#height_embed", function(event) { addListener("change", "#height_embed", function(event) {
var that = this.target; var that = this.target;
embed_height = that.value; embed_height = that.value;
if(previewing) document.querySelector(".embed-preview").innerHTML = embed_code(embed_autoplay, embed_width, embed_height, color, embed_videoonly, embed_localmode);
document.getElementById("embed-area").value = embed_code(embed_autoplay, embed_width, embed_height, color, embed_videoonly, embed_localmode); document.getElementById("embed-area").value = embed_code(embed_autoplay, embed_width, embed_height, color, embed_videoonly, embed_localmode);
}); });
@@ -1159,12 +1166,14 @@ function addDynamicListeners() {
addListener("change", "#videoonly", function(e) { addListener("change", "#videoonly", function(e) {
if(e.checked) embed_videoonly = "&videoonly=true"; if(e.checked) embed_videoonly = "&videoonly=true";
else embed_videoonly = "&videoonly=false"; else embed_videoonly = "&videoonly=false";
if(previewing) document.querySelector(".embed-preview").innerHTML = embed_code(embed_autoplay, embed_width, embed_height, color, embed_videoonly, embed_localmode);
document.getElementById("embed-area").value = embed_code(embed_autoplay, embed_width, embed_height, color, embed_videoonly, embed_localmode); document.getElementById("embed-area").value = embed_code(embed_autoplay, embed_width, embed_height, color, embed_videoonly, embed_localmode);
}); });
addListener("change", "#localmode", function(e) { addListener("change", "#localmode", function(e) {
if(e.checked) embed_localmode = "&localmode=true"; if(e.checked) embed_localmode = "&localmode=true";
else embed_localmode = "&localmode=false"; else embed_localmode = "&localmode=false";
if(previewing) document.querySelector(".embed-preview").innerHTML = embed_code(embed_autoplay, embed_width, embed_height, color, embed_videoonly, embed_localmode);
document.getElementById("embed-area").value = embed_code(embed_autoplay, embed_width, embed_height, color, embed_videoonly, embed_localmode); document.getElementById("embed-area").value = embed_code(embed_autoplay, embed_width, embed_height, color, embed_videoonly, embed_localmode);
}); });