From 8bebd26989c28cc2519e043fa50d095d6274b86c Mon Sep 17 00:00:00 2001 From: Zixaphir Date: Sun, 11 Jan 2015 20:44:24 -0700 Subject: [PATCH] Revert "I don't like it." This reverts commit ef16eb960199b0a5bdd235cd6333c60efa118a82. --- Gruntfile.coffee | 2 +- builds/appchan-x.user.js | 84 ++++++++++++++++++++-------------------- builds/crx/script.js | 84 ++++++++++++++++++++-------------------- 3 files changed, 85 insertions(+), 85 deletions(-) diff --git a/Gruntfile.coffee b/Gruntfile.coffee index 9f7db3ee8..5a8bb3b7d 100755 --- a/Gruntfile.coffee +++ b/Gruntfile.coffee @@ -17,7 +17,7 @@ module.exports = (grunt) -> if /<[^>]*$/.test(checkText) and not (part is '$' and /\=['"][^"'<>]*$/.test checkText) throw new Error "Illegal insertion into HTML template: #{template}" parts2.push switch part - when '$' then "`#{parts[i+1]}`" + when '$' then "E(`#{parts[i+1]}`)" when '&' then "`#{parts[i+1]}`.innerHTML" when '@' then "`#{parts[i+1]}`.map((x) -> x.innerHTML).join('')" unless /^(<\w+( [\w-]+(='[^"'<>]*'|="[^"'<>]*")?)*>|<\/\w+>|[^"'<>]*)*$/.test checkText diff --git a/builds/appchan-x.user.js b/builds/appchan-x.user.js index 67922a03e..02423ad40 100644 --- a/builds/appchan-x.user.js +++ b/builds/appchan-x.user.js @@ -4794,7 +4794,7 @@ return; } el = $.el('span', { - innerHTML: g.NAME + " needs your permission to show desktop notifications. [FAQ]
or " + innerHTML: E(g.NAME) + " needs your permission to show desktop notifications. [FAQ]
or " }); _ref = $$('button', el), authorize = _ref[0], disable = _ref[1]; $.on(authorize, 'click', function() { @@ -6092,7 +6092,7 @@ innerHTML: " ## Admin" }; capcodeIcon = { - innerHTML: " \"Admin" + innerHTML: " \"Admin" }; break; case 'mod': @@ -6101,7 +6101,7 @@ innerHTML: " ## Mod" }; capcodeIcon = { - innerHTML: " \"Mod" + innerHTML: " \"Mod" }; break; case 'developer': @@ -6110,7 +6110,7 @@ innerHTML: " ## Developer" }; capcodeIcon = { - innerHTML: " \"Developer" + innerHTML: " \"Developer" }; break; default: @@ -6126,38 +6126,38 @@ } nameClass = capcode ? ' capcode' : ''; tripcodeField = tripcode ? { - innerHTML: " " + tripcode + "" + innerHTML: " " + E(tripcode) + "" } : { innerHTML: "" }; emailField = { - innerHTML: "" + name + "" + tripcodeField.innerHTML + capcodeStart.innerHTML + innerHTML: "" + E(name) + "" + tripcodeField.innerHTML + capcodeStart.innerHTML }; if (email) { emailProcessed = encodeURIComponent(email).replace(/%40/g, '@'); emailField = { - innerHTML: "" + emailField.innerHTML + "" + innerHTML: "" + emailField.innerHTML + "" }; } userID = !capcode && uniqueID ? { - innerHTML: " (ID: " + uniqueID + ")" + innerHTML: " (ID: " + E(uniqueID) + ")" } : { innerHTML: "" }; flag = !flagCode ? { innerHTML: "" } : false ? { - innerHTML: " \""" + innerHTML: " \""" } : { - innerHTML: " " + innerHTML: " " }; nameBlock = { - innerHTML: "" + emailField.innerHTML + capcodeIcon.innerHTML + userID.innerHTML + flag.innerHTML + " " + innerHTML: "" + emailField.innerHTML + capcodeIcon.innerHTML + userID.innerHTML + flag.innerHTML + " " }; /* Post Info */ subjectField = isOP || boardID === 'f' ? { - innerHTML: "" + subject + " " + innerHTML: "" + E(subject) + " " } : { innerHTML: "" }; @@ -6175,40 +6175,40 @@ } typeLC = type.toLowerCase(); _results.push({ - innerHTML: " \""" + innerHTML: " \""" }); } return _results; })(); replyLink = isOP && g.VIEW === 'index' ? { - innerHTML: "   [Reply]" + innerHTML: "   [Reply]" } : { innerHTML: "" }; postInfo = { - innerHTML: "
" + subjectField.innerHTML + nameBlock.innerHTML + "" + date + " No." + postID + "" + icons.map(function(x) { + innerHTML: "
" + subjectField.innerHTML + nameBlock.innerHTML + "" + E(date) + " No." + E(postID) + "" + icons.map(function(x) { return x.innerHTML; }).join('') + replyLink.innerHTML + "
" }; /* File Info */ fileCont = (file != null ? file.isDeleted : void 0) ? { - innerHTML: "\"File" + innerHTML: "\"File" } : file && boardID === 'f' ? { - innerHTML: "
File: " + file.name + "-(" + $.bytesToString(file.size) + ", " + file.width + "x" + file.height + ", " + file.tag + ")
" + innerHTML: "
File: " + E(file.name) + "-(" + E($.bytesToString(file.size)) + ", " + E(file.width) + "x" + E(file.height) + ", " + E(file.tag) + ")
" } : file ? (file.isSpoiler ? (shortFilename = 'Spoiler Image', (spoilerRange = Build.spoilerRange[boardID]) ? fileThumb = "//s.4cdn.org/image/spoiler-" + boardID + (Math.floor(1 + spoilerRange * Math.random())) + ".png" : fileThumb = '//s.4cdn.org/image/spoiler.png', file.twidth = file.theight = 100) : (shortFilename = Build.shortFilename(file.name, !isOP), fileThumb = file.turl), fileSize = $.bytesToString(file.size), fileDims = file.url.slice(-4) === '.pdf' ? 'PDF' : "" + file.width + "x" + file.height, fileLink = file.isSpoiler || file.name === shortFilename ? { - innerHTML: "" + shortFilename + "" + innerHTML: "" + E(shortFilename) + "" } : { - innerHTML: "" + shortFilename + "" + innerHTML: "" + E(shortFilename) + "" }, fileText = file.isSpoiler ? { - innerHTML: "
File: " + fileLink.innerHTML + " (" + fileSize + ", " + fileDims + ")
" + innerHTML: "
File: " + fileLink.innerHTML + " (" + E(fileSize) + ", " + E(fileDims) + ")
" } : { - innerHTML: "
File: " + fileLink.innerHTML + " (" + fileSize + ", " + fileDims + ")
" + innerHTML: "
File: " + fileLink.innerHTML + " (" + E(fileSize) + ", " + E(fileDims) + ")
" }, { - innerHTML: fileText.innerHTML + "\""" + innerHTML: fileText.innerHTML + "\""" }) : void 0; fileBlock = file ? { - innerHTML: "
" + fileCont.innerHTML + "
" + innerHTML: "
" + fileCont.innerHTML + "
" } : { innerHTML: "" }; @@ -6216,12 +6216,12 @@ /* Whole Post */ highlightPost = capcode === 'admin_highlight' ? ' highlightPost' : ''; message = { - innerHTML: "
" + comment.innerHTML + "
" + innerHTML: "
" + comment.innerHTML + "
" }; wholePost = isOP ? { - innerHTML: "
" + fileBlock.innerHTML + postInfo.innerHTML + message.innerHTML + "
" + innerHTML: "
" + fileBlock.innerHTML + postInfo.innerHTML + message.innerHTML + "
" } : { - innerHTML: "
>>
" + postInfo.innerHTML + fileBlock.innerHTML + message.innerHTML + "
" + innerHTML: "
>>
" + postInfo.innerHTML + fileBlock.innerHTML + message.innerHTML + "
" }; container = $.el('div', { className: "postContainer " + (isOP ? 'op' : 'reply') + "Container", @@ -6289,7 +6289,7 @@ fileCount = data.images + !!data.ext; pageCount = Math.floor(Index.liveThreadData.keys.indexOf("" + thread.ID) / Index.threadsNumPerPage) + 1; subject = thread.OP.info.subject ? { - innerHTML: "
" + thread.OP.nodes.subject.innerHTML + "
" + innerHTML: "
" + E(thread.OP.nodes.subject.innerHTML) + "
" } : ''; comment = thread.OP.nodes.comment.innerHTML.replace(/(
\s*){2,}/g, '
'); root = $.el('div', { @@ -6600,11 +6600,11 @@ text2 = _ref[j]; if (j % 2 === 1) { _results1.push({ - innerHTML: "" + text2 + "" + innerHTML: "" + E(text2) + "" }); } else { _results1.push({ - innerHTML: text2 + innerHTML: E(text2) }); } } @@ -9985,7 +9985,7 @@ QR.cooldown.auto = false; QR.status(); return QR.error($.el('span', { - innerHTML: "4chan X encountered an error while posting. [Banned?] [More info]" + innerHTML: "4chan X encountered an error while posting. [Banned?] [More info]" })); } }; @@ -12374,7 +12374,7 @@ responseType: 'json' })) { return $.extend(link, { - innerHTML: "[" + key + "] Title Link Blocked (are you using NoScript?)" + innerHTML: "[" + E(key) + "] Title Link Blocked (are you using NoScript?)" }); } } @@ -12407,7 +12407,7 @@ for (_i = 0, _len = queue.length; _i < _len; _i++) { data = queue[_i]; $.extend(data.link, { - innerHTML: "[" + data.key + "] Title Link Blocked (are you using NoScript?)" + innerHTML: "[" + E(data.key) + "] Title Link Blocked (are you using NoScript?)" }); } } @@ -12501,7 +12501,7 @@ el = $.el('iframe'); el.setAttribute('sandbox', 'allow-scripts'); content = { - innerHTML: "" + a.dataset.uid + "" + innerHTML: "" + E(a.dataset.uid) + "" }; el.src = "data:text/html;charset=utf-8," + (encodeURIComponent(content.innerHTML)); return el; @@ -12526,7 +12526,7 @@ style: '', el: function(a) { return $.el('div', { - innerHTML: "" + innerHTML: "" }); } }, { @@ -12613,13 +12613,13 @@ case 'image/gif': case 'image/jpeg': $.extend(el, { - innerHTML: "" + innerHTML: "" }); break; case 'audio/mpeg': case 'audio/ogg': $.extend(el, { - innerHTML: "" + innerHTML: "" }); break; default: @@ -13493,7 +13493,7 @@ Header.addShortcut(sc); } else { this.dialog = sc = UI.dialog('thread-stats', 'bottom: 0px; right: 0px;', { - innerHTML: "
" + statsHTML.innerHTML + "
" + innerHTML: "
" + statsHTML.innerHTML + "
" }); $.addClass(doc, 'float'); $.ready(function() { @@ -18831,7 +18831,7 @@ for (key in _ref) { obj = _ref[key]; fs = $.el('fieldset', { - innerHTML: "" + key + "" + innerHTML: "" + E(key) + "" }); containers = [fs]; for (key in obj) { @@ -19241,7 +19241,7 @@ for (key in _ref) { arr = _ref[key]; tr = $.el('tr', { - innerHTML: "" + arr[1] + "" + innerHTML: "" + E(arr[1]) + "" }); input = $('input', tr); input.name = key; @@ -19293,7 +19293,7 @@ if (type) { if (type === 'text') { $.extend(div, { - innerHTML: "
" + key + "
" + description + "
" + innerHTML: "
" + E(key) + "
" + E(description) + "
" }); input = $("input", div); } else { @@ -19516,7 +19516,7 @@ hidden: __indexOf.call(Conf["Hidden Categories"], name) >= 0 }); $.extend(categories[name], { - innerHTML: "

" + name + "

" + innerHTML: "

" + E(name) + "

" }); option = UI.checkbox(name, name, (__indexOf.call(Conf["Hidden Categories"], name) >= 0)); $.on($('input', option), 'change', cb.category); @@ -20108,7 +20108,7 @@ return; } div = $.el('div', { - innerHTML: errors.length + " errors occurred. [show]" + innerHTML: E(errors.length) + " errors occurred. [show]" }); $.on(div.lastElementChild, 'click', function() { var _ref; diff --git a/builds/crx/script.js b/builds/crx/script.js index 2a8f5f0e3..bccef7c1e 100644 --- a/builds/crx/script.js +++ b/builds/crx/script.js @@ -4823,7 +4823,7 @@ return; } el = $.el('span', { - innerHTML: g.NAME + " needs your permission to show desktop notifications. [FAQ]
or " + innerHTML: E(g.NAME) + " needs your permission to show desktop notifications. [FAQ]
or " }); _ref = $$('button', el), authorize = _ref[0], disable = _ref[1]; $.on(authorize, 'click', function() { @@ -6121,7 +6121,7 @@ innerHTML: " ## Admin" }; capcodeIcon = { - innerHTML: " \"Admin" + innerHTML: " \"Admin" }; break; case 'mod': @@ -6130,7 +6130,7 @@ innerHTML: " ## Mod" }; capcodeIcon = { - innerHTML: " \"Mod" + innerHTML: " \"Mod" }; break; case 'developer': @@ -6139,7 +6139,7 @@ innerHTML: " ## Developer" }; capcodeIcon = { - innerHTML: " \"Developer" + innerHTML: " \"Developer" }; break; default: @@ -6155,38 +6155,38 @@ } nameClass = capcode ? ' capcode' : ''; tripcodeField = tripcode ? { - innerHTML: " " + tripcode + "" + innerHTML: " " + E(tripcode) + "" } : { innerHTML: "" }; emailField = { - innerHTML: "" + name + "" + tripcodeField.innerHTML + capcodeStart.innerHTML + innerHTML: "" + E(name) + "" + tripcodeField.innerHTML + capcodeStart.innerHTML }; if (email) { emailProcessed = encodeURIComponent(email).replace(/%40/g, '@'); emailField = { - innerHTML: "" + emailField.innerHTML + "" + innerHTML: "" + emailField.innerHTML + "" }; } userID = !capcode && uniqueID ? { - innerHTML: " (ID: " + uniqueID + ")" + innerHTML: " (ID: " + E(uniqueID) + ")" } : { innerHTML: "" }; flag = !flagCode ? { innerHTML: "" } : false ? { - innerHTML: " \""" + innerHTML: " \""" } : { - innerHTML: " " + innerHTML: " " }; nameBlock = { - innerHTML: "" + emailField.innerHTML + capcodeIcon.innerHTML + userID.innerHTML + flag.innerHTML + " " + innerHTML: "" + emailField.innerHTML + capcodeIcon.innerHTML + userID.innerHTML + flag.innerHTML + " " }; /* Post Info */ subjectField = isOP || boardID === 'f' ? { - innerHTML: "" + subject + " " + innerHTML: "" + E(subject) + " " } : { innerHTML: "" }; @@ -6204,40 +6204,40 @@ } typeLC = type.toLowerCase(); _results.push({ - innerHTML: " \""" + innerHTML: " \""" }); } return _results; })(); replyLink = isOP && g.VIEW === 'index' ? { - innerHTML: "   [Reply]" + innerHTML: "   [Reply]" } : { innerHTML: "" }; postInfo = { - innerHTML: "
" + subjectField.innerHTML + nameBlock.innerHTML + "" + date + " No." + postID + "" + icons.map(function(x) { + innerHTML: "
" + subjectField.innerHTML + nameBlock.innerHTML + "" + E(date) + " No." + E(postID) + "" + icons.map(function(x) { return x.innerHTML; }).join('') + replyLink.innerHTML + "
" }; /* File Info */ fileCont = (file != null ? file.isDeleted : void 0) ? { - innerHTML: "\"File" + innerHTML: "\"File" } : file && boardID === 'f' ? { - innerHTML: "
File: " + file.name + "-(" + $.bytesToString(file.size) + ", " + file.width + "x" + file.height + ", " + file.tag + ")
" + innerHTML: "
File: " + E(file.name) + "-(" + E($.bytesToString(file.size)) + ", " + E(file.width) + "x" + E(file.height) + ", " + E(file.tag) + ")
" } : file ? (file.isSpoiler ? (shortFilename = 'Spoiler Image', (spoilerRange = Build.spoilerRange[boardID]) ? fileThumb = "//s.4cdn.org/image/spoiler-" + boardID + (Math.floor(1 + spoilerRange * Math.random())) + ".png" : fileThumb = '//s.4cdn.org/image/spoiler.png', file.twidth = file.theight = 100) : (shortFilename = Build.shortFilename(file.name, !isOP), fileThumb = file.turl), fileSize = $.bytesToString(file.size), fileDims = file.url.slice(-4) === '.pdf' ? 'PDF' : "" + file.width + "x" + file.height, fileLink = file.isSpoiler || file.name === shortFilename ? { - innerHTML: "" + shortFilename + "" + innerHTML: "" + E(shortFilename) + "" } : { - innerHTML: "" + shortFilename + "" + innerHTML: "" + E(shortFilename) + "" }, fileText = file.isSpoiler ? { - innerHTML: "
File: " + fileLink.innerHTML + " (" + fileSize + ", " + fileDims + ")
" + innerHTML: "
File: " + fileLink.innerHTML + " (" + E(fileSize) + ", " + E(fileDims) + ")
" } : { - innerHTML: "
File: " + fileLink.innerHTML + " (" + fileSize + ", " + fileDims + ")
" + innerHTML: "
File: " + fileLink.innerHTML + " (" + E(fileSize) + ", " + E(fileDims) + ")
" }, { - innerHTML: fileText.innerHTML + "\""" + innerHTML: fileText.innerHTML + "\""" }) : void 0; fileBlock = file ? { - innerHTML: "
" + fileCont.innerHTML + "
" + innerHTML: "
" + fileCont.innerHTML + "
" } : { innerHTML: "" }; @@ -6245,12 +6245,12 @@ /* Whole Post */ highlightPost = capcode === 'admin_highlight' ? ' highlightPost' : ''; message = { - innerHTML: "
" + comment.innerHTML + "
" + innerHTML: "
" + comment.innerHTML + "
" }; wholePost = isOP ? { - innerHTML: "
" + fileBlock.innerHTML + postInfo.innerHTML + message.innerHTML + "
" + innerHTML: "
" + fileBlock.innerHTML + postInfo.innerHTML + message.innerHTML + "
" } : { - innerHTML: "
>>
" + postInfo.innerHTML + fileBlock.innerHTML + message.innerHTML + "
" + innerHTML: "
>>
" + postInfo.innerHTML + fileBlock.innerHTML + message.innerHTML + "
" }; container = $.el('div', { className: "postContainer " + (isOP ? 'op' : 'reply') + "Container", @@ -6318,7 +6318,7 @@ fileCount = data.images + !!data.ext; pageCount = Math.floor(Index.liveThreadData.keys.indexOf("" + thread.ID) / Index.threadsNumPerPage) + 1; subject = thread.OP.info.subject ? { - innerHTML: "
" + thread.OP.nodes.subject.innerHTML + "
" + innerHTML: "
" + E(thread.OP.nodes.subject.innerHTML) + "
" } : ''; comment = thread.OP.nodes.comment.innerHTML.replace(/(
\s*){2,}/g, '
'); root = $.el('div', { @@ -6629,11 +6629,11 @@ text2 = _ref[j]; if (j % 2 === 1) { _results1.push({ - innerHTML: "" + text2 + "" + innerHTML: "" + E(text2) + "" }); } else { _results1.push({ - innerHTML: text2 + innerHTML: E(text2) }); } } @@ -10028,7 +10028,7 @@ QR.cooldown.auto = false; QR.status(); return QR.error($.el('span', { - innerHTML: "4chan X encountered an error while posting. [Banned?] [More info]" + innerHTML: "4chan X encountered an error while posting. [Banned?] [More info]" })); } }; @@ -12401,7 +12401,7 @@ responseType: 'json' })) { return $.extend(link, { - innerHTML: "[" + key + "] Title Link Blocked (are you using NoScript?)" + innerHTML: "[" + E(key) + "] Title Link Blocked (are you using NoScript?)" }); } } @@ -12434,7 +12434,7 @@ for (_i = 0, _len = queue.length; _i < _len; _i++) { data = queue[_i]; $.extend(data.link, { - innerHTML: "[" + data.key + "] Title Link Blocked (are you using NoScript?)" + innerHTML: "[" + E(data.key) + "] Title Link Blocked (are you using NoScript?)" }); } } @@ -12528,7 +12528,7 @@ el = $.el('iframe'); el.setAttribute('sandbox', 'allow-scripts'); content = { - innerHTML: "" + a.dataset.uid + "" + innerHTML: "" + E(a.dataset.uid) + "" }; el.src = "data:text/html;charset=utf-8," + (encodeURIComponent(content.innerHTML)); return el; @@ -12553,7 +12553,7 @@ style: '', el: function(a) { return $.el('div', { - innerHTML: "" + innerHTML: "" }); } }, { @@ -12640,13 +12640,13 @@ case 'image/gif': case 'image/jpeg': $.extend(el, { - innerHTML: "" + innerHTML: "" }); break; case 'audio/mpeg': case 'audio/ogg': $.extend(el, { - innerHTML: "" + innerHTML: "" }); break; default: @@ -13520,7 +13520,7 @@ Header.addShortcut(sc); } else { this.dialog = sc = UI.dialog('thread-stats', 'bottom: 0px; right: 0px;', { - innerHTML: "
" + statsHTML.innerHTML + "
" + innerHTML: "
" + statsHTML.innerHTML + "
" }); $.addClass(doc, 'float'); $.ready(function() { @@ -18868,7 +18868,7 @@ for (key in _ref) { obj = _ref[key]; fs = $.el('fieldset', { - innerHTML: "" + key + "" + innerHTML: "" + E(key) + "" }); containers = [fs]; for (key in obj) { @@ -19276,7 +19276,7 @@ for (key in _ref) { arr = _ref[key]; tr = $.el('tr', { - innerHTML: "" + arr[1] + "" + innerHTML: "" + E(arr[1]) + "" }); input = $('input', tr); input.name = key; @@ -19328,7 +19328,7 @@ if (type) { if (type === 'text') { $.extend(div, { - innerHTML: "
" + key + "
" + description + "
" + innerHTML: "
" + E(key) + "
" + E(description) + "
" }); input = $("input", div); } else { @@ -19551,7 +19551,7 @@ hidden: __indexOf.call(Conf["Hidden Categories"], name) >= 0 }); $.extend(categories[name], { - innerHTML: "

" + name + "

" + innerHTML: "

" + E(name) + "

" }); option = UI.checkbox(name, name, (__indexOf.call(Conf["Hidden Categories"], name) >= 0)); $.on($('input', option), 'change', cb.category); @@ -20125,7 +20125,7 @@ return; } div = $.el('div', { - innerHTML: errors.length + " errors occurred. [show]" + innerHTML: E(errors.length) + " errors occurred. [show]" }); $.on(div.lastElementChild, 'click', function() { var _ref;