This commit is contained in:
Calvin Montgomery 2018-10-21 22:12:49 -07:00
parent 0bc866dbfa
commit 5b86fb3187
4 changed files with 89 additions and 41 deletions

View file

@ -296,42 +296,54 @@ Callbacks = {
},
channelCSSJS: function(data) {
$("#chancss").remove();
CHANNEL.css = data.css;
$("#cs-csstext").val(data.css);
if(data.css && !USEROPTS.ignore_channelcss) {
$("<style/>").attr("type", "text/css")
.attr("id", "chancss")
.text(data.css)
.appendTo($("head"));
if (CyTube.channelCustomizations.cssHash !== data.cssHash) {
$("#chancss").remove();
CHANNEL.css = data.css;
$("#cs-csstext").val(data.css);
if(data.css && !USEROPTS.ignore_channelcss) {
$("<style/>").attr("type", "text/css")
.attr("id", "chancss")
.text(data.css)
.appendTo($("head"));
}
if (data.cssHash) {
CyTube.channelCustomizations.cssHash = data.cssHash;
}
}
$("#chanjs").remove();
CHANNEL.js = data.js;
$("#cs-jstext").val(data.js);
if (CyTube.channelCustomizations.jsHash !== data.jsHash) {
$("#chanjs").remove();
CHANNEL.js = data.js;
$("#cs-jstext").val(data.js);
if(data.js && !USEROPTS.ignore_channeljs) {
var viewSource = document.createElement("button");
viewSource.className = "btn btn-danger";
viewSource.textContent = "View inline script source";
viewSource.onclick = function () {
var content = document.createElement("pre");
content.textContent = data.js;
modalAlert({
title: "Inline JS",
htmlContent: content.outerHTML,
dismissText: "Close"
if(data.js && !USEROPTS.ignore_channeljs) {
var viewSource = document.createElement("button");
viewSource.className = "btn btn-danger";
viewSource.textContent = "View inline script source";
viewSource.onclick = function () {
var content = document.createElement("pre");
content.textContent = data.js;
modalAlert({
title: "Inline JS",
htmlContent: content.outerHTML,
dismissText: "Close"
});
};
checkScriptAccess(viewSource, "embedded", function (pref) {
if (pref === "ALLOW") {
$("<script/>").attr("type", "text/javascript")
.attr("id", "chanjs")
.text(data.js)
.appendTo($("body"));
}
});
};
}
checkScriptAccess(viewSource, "embedded", function (pref) {
if (pref === "ALLOW") {
$("<script/>").attr("type", "text/javascript")
.attr("id", "chanjs")
.text(data.js)
.appendTo($("body"));
}
});
if (data.jsHash) {
CyTube.channelCustomizations.jsHash = data.jsHash;
}
}
},

View file

@ -76,6 +76,10 @@ CyTube.ui = {
CyTube.featureFlag = {
efficientEmotes: true
};
CyTube.channelCustomizations = {
cssHash: null,
jsHash: null
};
CyTube._internal_do_not_use_or_you_will_be_banned = {};
function getOpt(k) {