Implement #779
This commit is contained in:
parent
0bc866dbfa
commit
5b86fb3187
4 changed files with 89 additions and 41 deletions
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue