Add editors for CSS and JS

This commit is contained in:
calzoneman 2013-05-15 11:34:27 -04:00
parent b3cb87aab6
commit a8d8f346d4
11 changed files with 144 additions and 5 deletions

View file

@ -227,6 +227,29 @@ Callbacks = {
rebuildPlaylist();
},
channelCSSJS: function(data) {
console.log("recv cssjs", data);
$("#chancss").remove();
$("#chanjs").remove();
$("#csstext").val(data.css);
$("#jstext").val(data.js);
if(data.css) {
$("<style/>").attr("type", "text/css")
.attr("id", "chancss")
.text(data.css)
.appendTo($("head"));
}
if(data.js) {
$("<script/>").attr("type", "text/javascript")
.attr("id", "chanjs")
.text(data.js)
.appendTo($("body"));
}
},
banlist: function(data) {
var entries = data.entries;
var tbl = $("#banlist table");

View file

@ -413,6 +413,36 @@ $("#show_motdeditor").click(function() {
$("#motdeditor").show();
});
$("#show_csseditor").click(function() {
$("#modnav li").each(function() {
$(this).removeClass("active");
});
$(".modonly").hide();
$("#show_csseditor").parent().addClass("active");
$("#csseditor").show();
});
$("#updatecss").click(function() {
socket.emit("setChannelCSS", {
css: $("#csstext").val()
});
});
$("#show_jseditor").click(function() {
$("#modnav li").each(function() {
$(this).removeClass("active");
});
$(".modonly").hide();
$("#show_jseditor").parent().addClass("active");
$("#jseditor").show();
});
$("#updatejs").click(function() {
socket.emit("setChannelJS", {
js: $("#jstext").val()
});
});
$("#show_filtereditor").click(function() {
if(RANK >= Rank.Owner) {
$("#modnav li").each(function() {

View file

@ -654,6 +654,14 @@ function handleRankChange() {
$("#clearplaylist").css("display", "none");
$("#shuffleplaylist").css("display", "none");
}
if(RANK >= Rank.Owner) {
$("#show_jseditor").parent().css("display", "");
$("#show_csseditor").parent().css("display", "");
}
else {
$("#show_jseditor").parent().css("display", "none");
$("#show_csseditor").parent().css("display", "none");
}
if(RANK >= 10) {
$("#drop_channel").parent().css("display", "");
}

View file

@ -54,7 +54,6 @@ Media.prototype.nullPlayer = function() {
Media.prototype.initYouTube = function() {
this.removeOld();
console.log("init YouTube");
this.player = new YT.Player("ytapiplayer", {
height: VHEIGHT,
width: VWIDTH,