diff --git a/Gruntfile.coffee b/Gruntfile.coffee index f400d89a6..aa55e9825 100644 --- a/Gruntfile.coffee +++ b/Gruntfile.coffee @@ -73,9 +73,6 @@ module.exports = (grunt) -> dest: 'builds/crx/' expand: true flatten: true - nex: - files: - 'builds/<%= pkg.name %>.nex': 'builds/<%= pkg.name %>.zip' coffee: script: @@ -188,7 +185,6 @@ module.exports = (grunt) -> 'shell:push' 'build-crx' 'compress:crx' - 'copy:nex' ] grunt.registerTask 'patch', [ 'bump' diff --git a/LICENSE b/LICENSE index e27bc20e2..7c925c6cc 100644 --- a/LICENSE +++ b/LICENSE @@ -1,5 +1,5 @@ /* -* appchan x - Version 2.2.2 - 2013-08-09 +* appchan x - Version 2.2.2 - 2013-08-10 * * Licensed under the MIT license. * https://github.com/zixaphir/appchan-x/blob/master/LICENSE diff --git a/builds/4chan-X.user.js b/builds/4chan-X.user.js index eccc4fea7..9f95c99b1 100644 --- a/builds/4chan-X.user.js +++ b/builds/4chan-X.user.js @@ -19,7 +19,7 @@ // @icon data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwAgMAAAAqbBEUAAAACVBMVEUAAGcAAABmzDNZt9VtAAAAAXRSTlMAQObYZgAAAHFJREFUKFOt0LENACEIBdBv4Qju4wgWanEj3D6OcIVMKaitYHEU/jwTCQj8W75kiVCSBvdQ5/AvfVHBin11BgdRq3ysBgfwBDRrj3MCIA+oAQaku/Q1cNctrAmyDl577tOThYt/Y1RBM4DgOHzM0HFTAyLukH/cmRnqAAAAAElFTkSuQmCC // ==/UserScript== /* -* 4chan X - Version 1.2.25 - 2013-08-09 +* 4chan X - Version 1.2.25 - 2013-08-10 * * Licensed under the MIT license. * https://github.com/seaweedchan/4chan-x/blob/master/LICENSE @@ -4215,10 +4215,11 @@ _ref = this.nodes.quotelinks; for (_i = 0, _len = _ref.length; _i < _len; _i++) { quotelink = _ref[_i]; - if (QR.db.get(Get.postDataFromLink(quotelink))) { - $.add(quotelink, $.tn('\u00A0(You)')); - $.addClass(this.nodes.root, 'quotesYou'); + if (!(QR.db.get(Get.postDataFromLink(quotelink)))) { + continue; } + $.add(quotelink, $.tn('\u00A0(You)')); + $.addClass(this.nodes.root, 'quotesYou'); } }, cb: { @@ -4297,13 +4298,17 @@ var a, boardID, m, post, postID, quote, quoteID, redirect, _ref; if (deadlink.parentNode.className === 'prettyprint') { - $.replace(deadlink, __slice.call(deadlink.childNodes)); + Quotify.fixDeadlink(deadlink); return; } quote = deadlink.textContent; if (!(postID = (_ref = quote.match(/\d+$/)) != null ? _ref[0] : void 0)) { return; } + if (postID[0] === '0') { + Quotify.fixDeadlink(deadlink); + return; + } boardID = (m = quote.match(/^>>>\/([a-z\d]+)/)) ? m[1] : this.board.ID; quoteID = "" + boardID + "." + postID; if (post = g.posts[quoteID]) { @@ -4359,6 +4364,9 @@ if ($.hasClass(a, 'quotelink')) { return this.nodes.quotelinks.push(a); } + }, + fixDeadlink: function(deadlink) { + return $.replace(deadlink, __slice.call(deadlink.childNodes)); } }; @@ -4385,10 +4393,12 @@ if (this.isClone) { if (Conf['Embedding']) { i = 0; - items = $$('.embedded', this.nodes.comment); + items = $$('.embed', this.nodes.comment); while (el = items[i++]) { - $.on(el, "click", Linkify.cb.toggle); - Linkify.cb.toggle.call(el); + $.on(el, 'click', Linkify.cb.toggle); + if ($.hasClass(el, 'embedded')) { + Linkify.cb.toggle.call(el); + } } } return; @@ -4676,6 +4686,15 @@ }); } }, + MediaCrush: { + regExp: /.*(?:mediacru.sh\/)([0-9a-z_]+)/i, + style: 'border: 0; width: 640px; height: 480px; resize: both;', + el: function(a) { + return $.el('iframe', { + src: "https://mediacru.sh/" + a.dataset.uid + }); + } + }, pastebin: { regExp: /.*(?:pastebin.com\/(?!u\/))([^#\&\?]*).*/, el: function(a) { @@ -5893,7 +5912,7 @@ } }, dialog: function() { - var dialog, elm, mimeTypes, name, nodes, thread, _i, _j, _len, _len1, _ref, _ref1; + var dialog, elm, i, items, mimeTypes, name, nodes, thread; dialog = UI.dialog('qr', 'top:0;right:0;', "
"); QR.nodes = nodes = { @@ -5954,9 +5973,9 @@ })); } $.on(nodes.filename.parentNode, 'click keyup', QR.openFileInput); - _ref = $$('*', QR.nodes.el); - for (_i = 0, _len = _ref.length; _i < _len; _i++) { - elm = _ref[_i]; + items = $$('*', QR.nodes.el); + i = 0; + while (elm = items[i++]) { $.on(elm, 'blur', QR.focusout); $.on(elm, 'focus', QR.focusin); } @@ -5981,9 +6000,9 @@ return QR.selected.nodes.spoiler.click(); }); $.on(nodes.fileInput, 'change', QR.fileInput); - _ref1 = ['name', 'email', 'sub', 'com']; - for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) { - name = _ref1[_j]; + items = ['name', 'email', 'sub', 'com']; + i = 0; + while (name = items[i++]) { $.on(nodes[name], 'input', function() { return QR.selected.save(this); }); @@ -7024,7 +7043,7 @@ a = $.el('a', { className: 'menu-button brackets-wrap', - innerHTML: '', + innerHTML: '', href: 'javascript:;' }); return { @@ -8525,7 +8544,7 @@ return; } roll = $('b', this.nodes.comment).firstChild; - return roll.data = "Rolled " + dicestats[1] + "d" + dicestats[2] + " and got " + (roll.data.slice(7)); + return roll.data = "Rolled " + dicestats[1] + "d" + dicestats[2] + ": " + (roll.data.slice(7)); } }; diff --git a/builds/appchan-x.user.js b/builds/appchan-x.user.js index 993ab2648..d947625ae 100644 --- a/builds/appchan-x.user.js +++ b/builds/appchan-x.user.js @@ -18,7 +18,7 @@ // ==/UserScript== /* -* appchan x - Version 2.2.2 - 2013-08-09 +* appchan x - Version 2.2.2 - 2013-08-10 * * Licensed under the MIT license. * https://github.com/zixaphir/appchan-x/blob/master/LICENSE @@ -6514,10 +6514,11 @@ _ref = this.nodes.quotelinks; for (_i = 0, _len = _ref.length; _i < _len; _i++) { quotelink = _ref[_i]; - if (QR.db.get(Get.postDataFromLink(quotelink))) { - $.add(quotelink, $.tn('\u00A0(You)')); - $.addClass(this.nodes.root, 'quotesYou'); + if (!(QR.db.get(Get.postDataFromLink(quotelink)))) { + continue; } + $.add(quotelink, $.tn('\u00A0(You)')); + $.addClass(this.nodes.root, 'quotesYou'); } }, cb: { @@ -6596,13 +6597,17 @@ var a, boardID, m, post, postID, quote, quoteID, redirect, _ref; if (deadlink.parentNode.className === 'prettyprint') { - $.replace(deadlink, __slice.call(deadlink.childNodes)); + Quotify.fixDeadlink(deadlink); return; } quote = deadlink.textContent; if (!(postID = (_ref = quote.match(/\d+$/)) != null ? _ref[0] : void 0)) { return; } + if (postID[0] === '0') { + Quotify.fixDeadlink(deadlink); + return; + } boardID = (m = quote.match(/^>>>\/([a-z\d]+)/)) ? m[1] : this.board.ID; quoteID = "" + boardID + "." + postID; if (post = g.posts[quoteID]) { @@ -6658,6 +6663,9 @@ if ($.hasClass(a, 'quotelink')) { return this.nodes.quotelinks.push(a); } + }, + fixDeadlink: function(deadlink) { + return $.replace(deadlink, __slice.call(deadlink.childNodes)); } }; @@ -6684,10 +6692,12 @@ if (this.isClone) { if (Conf['Embedding']) { i = 0; - items = $$('.embedded', this.nodes.comment); + items = $$('.embed', this.nodes.comment); while (el = items[i++]) { - $.on(el, "click", Linkify.cb.toggle); - Linkify.cb.toggle.call(el); + $.on(el, 'click', Linkify.cb.toggle); + if ($.hasClass(el, 'embedded')) { + Linkify.cb.toggle.call(el); + } } } return; @@ -6975,6 +6985,15 @@ }); } }, + MediaCrush: { + regExp: /.*(?:mediacru.sh\/)([0-9a-z_]+)/i, + style: 'border: 0; width: 640px; height: 480px; resize: both;', + el: function(a) { + return $.el('iframe', { + src: "https://mediacru.sh/" + a.dataset.uid + }); + } + }, pastebin: { regExp: /.*(?:pastebin.com\/(?!u\/))([^#\&\?]*).*/, el: function(a) { @@ -8184,7 +8203,7 @@ } }, dialog: function() { - var check, dialog, elm, key, mimeTypes, name, nodes, thread, value, _i, _j, _k, _len, _len1, _len2, _ref, _ref1, _ref2, _ref3; + var check, dialog, elm, i, items, key, mimeTypes, name, nodes, thread, value, _ref; QR.nodes = nodes = { el: dialog = UI.dialog('qr', 'top:0;right:0;', "") @@ -8252,9 +8271,9 @@ })); } $.on(nodes.filename.parentNode, 'click keyup', QR.openFileInput); - _ref1 = $$('*', QR.nodes.el); - for (_i = 0, _len = _ref1.length; _i < _len; _i++) { - elm = _ref1[_i]; + items = $$('*', QR.nodes.el); + i = 0; + while (elm = items[i++]) { $.on(elm, 'blur', QR.focusout); $.on(elm, 'focus', QR.focusin); } @@ -8279,14 +8298,14 @@ return QR.selected.nodes.spoiler.click(); }); $.on(nodes.fileInput, 'change', QR.fileInput); - _ref2 = ['spoilerPar', 'dumpButton', 'fileRM']; - for (_j = 0, _len1 = _ref2.length; _j < _len1; _j++) { - name = _ref2[_j]; + items = ['spoilerPar', 'dumpButton', 'fileRM']; + i = 0; + while (name = items[i++]) { $.on(nodes[name], 'mouseover', QR.mouseover); } - _ref3 = ['name', 'email', 'sub', 'com']; - for (_k = 0, _len2 = _ref3.length; _k < _len2; _k++) { - name = _ref3[_k]; + items = ['name', 'email', 'sub', 'com']; + i = 0; + while (name = items[i++]) { $.on(nodes[name], 'input', function() { return QR.selected.save(this); }); @@ -12432,7 +12451,7 @@ return; } roll = $('b', this.nodes.comment).firstChild; - return roll.data = "Rolled " + dicestats[1] + "d" + dicestats[2] + " and got " + (roll.data.slice(7)); + return roll.data = "Rolled " + dicestats[1] + "d" + dicestats[2] + ": " + (roll.data.slice(7)); } }; diff --git a/builds/crx/script.js b/builds/crx/script.js index 367b86cd5..9c97dd6bb 100644 --- a/builds/crx/script.js +++ b/builds/crx/script.js @@ -1,6 +1,6 @@ // Generated by CoffeeScript /* -* appchan x - Version 2.2.2 - 2013-08-09 +* appchan x - Version 2.2.2 - 2013-08-10 * * Licensed under the MIT license. * https://github.com/zixaphir/appchan-x/blob/master/LICENSE @@ -6521,10 +6521,11 @@ _ref = this.nodes.quotelinks; for (_i = 0, _len = _ref.length; _i < _len; _i++) { quotelink = _ref[_i]; - if (QR.db.get(Get.postDataFromLink(quotelink))) { - $.add(quotelink, $.tn('\u00A0(You)')); - $.addClass(this.nodes.root, 'quotesYou'); + if (!(QR.db.get(Get.postDataFromLink(quotelink)))) { + continue; } + $.add(quotelink, $.tn('\u00A0(You)')); + $.addClass(this.nodes.root, 'quotesYou'); } }, cb: { @@ -6603,13 +6604,17 @@ var a, boardID, m, post, postID, quote, quoteID, redirect, _ref; if (deadlink.parentNode.className === 'prettyprint') { - $.replace(deadlink, __slice.call(deadlink.childNodes)); + Quotify.fixDeadlink(deadlink); return; } quote = deadlink.textContent; if (!(postID = (_ref = quote.match(/\d+$/)) != null ? _ref[0] : void 0)) { return; } + if (postID[0] === '0') { + Quotify.fixDeadlink(deadlink); + return; + } boardID = (m = quote.match(/^>>>\/([a-z\d]+)/)) ? m[1] : this.board.ID; quoteID = "" + boardID + "." + postID; if (post = g.posts[quoteID]) { @@ -6665,6 +6670,9 @@ if ($.hasClass(a, 'quotelink')) { return this.nodes.quotelinks.push(a); } + }, + fixDeadlink: function(deadlink) { + return $.replace(deadlink, __slice.call(deadlink.childNodes)); } }; @@ -6691,10 +6699,12 @@ if (this.isClone) { if (Conf['Embedding']) { i = 0; - items = $$('.embedded', this.nodes.comment); + items = $$('.embed', this.nodes.comment); while (el = items[i++]) { - $.on(el, "click", Linkify.cb.toggle); - Linkify.cb.toggle.call(el); + $.on(el, 'click', Linkify.cb.toggle); + if ($.hasClass(el, 'embedded')) { + Linkify.cb.toggle.call(el); + } } } return; @@ -6982,6 +6992,15 @@ }); } }, + MediaCrush: { + regExp: /.*(?:mediacru.sh\/)([0-9a-z_]+)/i, + style: 'border: 0; width: 640px; height: 480px; resize: both;', + el: function(a) { + return $.el('iframe', { + src: "https://mediacru.sh/" + a.dataset.uid + }); + } + }, pastebin: { regExp: /.*(?:pastebin.com\/(?!u\/))([^#\&\?]*).*/, el: function(a) { @@ -8184,7 +8203,7 @@ } }, dialog: function() { - var check, dialog, key, mimeTypes, name, nodes, thread, value, _i, _j, _len, _len1, _ref, _ref1, _ref2; + var check, dialog, i, items, key, mimeTypes, name, nodes, thread, value, _ref; QR.nodes = nodes = { el: dialog = UI.dialog('qr', 'top:0;right:0;', "") @@ -8273,14 +8292,14 @@ return QR.selected.nodes.spoiler.click(); }); $.on(nodes.fileInput, 'change', QR.fileInput); - _ref1 = ['spoilerPar', 'dumpButton', 'fileRM']; - for (_i = 0, _len = _ref1.length; _i < _len; _i++) { - name = _ref1[_i]; + items = ['spoilerPar', 'dumpButton', 'fileRM']; + i = 0; + while (name = items[i++]) { $.on(nodes[name], 'mouseover', QR.mouseover); } - _ref2 = ['name', 'email', 'sub', 'com']; - for (_j = 0, _len1 = _ref2.length; _j < _len1; _j++) { - name = _ref2[_j]; + items = ['name', 'email', 'sub', 'com']; + i = 0; + while (name = items[i++]) { $.on(nodes[name], 'input', function() { return QR.selected.save(this); }); @@ -12420,7 +12439,7 @@ return; } roll = $('b', this.nodes.comment).firstChild; - return roll.data = "Rolled " + dicestats[1] + "d" + dicestats[2] + " and got " + (roll.data.slice(7)); + return roll.data = "Rolled " + dicestats[1] + "d" + dicestats[2] + ": " + (roll.data.slice(7)); } }; diff --git a/src/Linkification/Linkify.coffee b/src/Linkification/Linkify.coffee index b2151e945..b935fba66 100644 --- a/src/Linkification/Linkify.coffee +++ b/src/Linkification/Linkify.coffee @@ -36,10 +36,10 @@ Linkify = if @isClone if Conf['Embedding'] i = 0 - items = $$ '.embedded', @nodes.comment + items = $$ '.embed', @nodes.comment while el = items[i++] - $.on el, "click", Linkify.cb.toggle - Linkify.cb.toggle.call el + $.on el, 'click', Linkify.cb.toggle + Linkify.cb.toggle.call el if $.hasClass el, 'embedded' return @@ -279,6 +279,36 @@ Linkify = $.el 'object', innerHTML: "" + MediaCrush: + regExp: /.*(?:mediacru.sh\/)([0-9a-z_]+)/i + style: 'border: 0; width: 640px; height: 480px; resize: both;' + el: (a) -> + $.el 'iframe', + src: "https://mediacru.sh/#{a.dataset.uid}" +# MediaCrush CORS When? +# +# el = $.el 'div' +# $.cache "https://mediacru.sh/#{a.dataset.uid}.json", -> +# {status} = @ +# return unless [200, 304].contains status +# {files} = JSON.parse req.response +# file = file for file of files when files.hasOwnProperty file +# el.innerHTML = switch file.type +# when 'video/mp4', 'video/ogv' +# """ +#""" +# when 'image/png', 'image/gif', 'image/jpeg' +# "