function makeAlert(title, text, klass, textOnly) { if(!klass) { klass = "alert-info"; } var wrap = $("
").addClass("col-md-12"); var al = $("
").addClass("alert") .addClass(klass) .appendTo(wrap); textOnly ? al.text(text) : al.html(text) ; $("
").prependTo(al); $("").text(title).prependTo(al); $("" + "" + "
"); form.append("
"); var dialog = chatDialog(div); close.click(function () { dialog.remove(); /* Implicit denial of script access */ cb("DENY"); }); $("#chanjs-allow").click(function () { var save = $("#chanjs-save-pref").is(":checked"); dialog.remove(); if (save) { JSPREF[CHANNEL.name.toLowerCase() + "_" + type] = "ALLOW"; setOpt("channel_js_pref", JSPREF); } cb("ALLOW"); }); $("#chanjs-deny").click(function () { var save = $("#chanjs-save-pref").is(":checked"); dialog.remove(); if (save) { JSPREF[CHANNEL.name.toLowerCase() + "_" + type] = "DENY"; setOpt("channel_js_pref", JSPREF); } cb("DENY"); }); } } function formatScriptAccessPrefs() { var tbl = $("#us-scriptcontrol table"); tbl.find("tbody").remove(); var channels = Object.keys(JSPREF).sort(); channels.forEach(function (channel) { var idx = String(channel).lastIndexOf("_"); if (idx < 0) { // Invalid console.error("Channel JS pref: invalid key '" + channel + "', deleting it"); delete JSPREF[channel]; setOpt("channel_js_pref", JSPREF); return; } var channelName = channel.substring(0, idx); var prefType = channel.substring(idx + 1); console.log(channelName, prefType); if (prefType !== "external" && prefType !== "embedded") { // Invalid console.error("Channel JS pref: invalid key '" + channel + "', deleting it"); delete JSPREF[channel]; setOpt("channel_js_pref", JSPREF); return; } var pref = JSPREF[channel]; var tr = $("").appendTo(tbl); $("").text(channelName).appendTo(tr); $("").text(prefType).appendTo(tr); var pref_td = $("").appendTo(tr); var allow_label = $("