Merge branch 'v3'

Conflicts:
	Gruntfile.coffee
	LICENSE
	builds/crx/script.js
This commit is contained in:
Zixaphir 2013-08-10 14:41:26 -07:00
commit 73ea806592
10 changed files with 165 additions and 67 deletions

View File

@ -73,9 +73,6 @@ module.exports = (grunt) ->
dest: 'builds/crx/' dest: 'builds/crx/'
expand: true expand: true
flatten: true flatten: true
nex:
files:
'builds/<%= pkg.name %>.nex': 'builds/<%= pkg.name %>.zip'
coffee: coffee:
script: script:
@ -188,7 +185,6 @@ module.exports = (grunt) ->
'shell:push' 'shell:push'
'build-crx' 'build-crx'
'compress:crx' 'compress:crx'
'copy:nex'
] ]
grunt.registerTask 'patch', [ grunt.registerTask 'patch', [
'bump' 'bump'

View File

@ -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. * Licensed under the MIT license.
* https://github.com/zixaphir/appchan-x/blob/master/LICENSE * https://github.com/zixaphir/appchan-x/blob/master/LICENSE

View File

@ -19,7 +19,7 @@
// @icon data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwAgMAAAAqbBEUAAAACVBMVEUAAGcAAABmzDNZt9VtAAAAAXRSTlMAQObYZgAAAHFJREFUKFOt0LENACEIBdBv4Qju4wgWanEj3D6OcIVMKaitYHEU/jwTCQj8W75kiVCSBvdQ5/AvfVHBin11BgdRq3ysBgfwBDRrj3MCIA+oAQaku/Q1cNctrAmyDl577tOThYt/Y1RBM4DgOHzM0HFTAyLukH/cmRnqAAAAAElFTkSuQmCC // @icon data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwAgMAAAAqbBEUAAAACVBMVEUAAGcAAABmzDNZt9VtAAAAAXRSTlMAQObYZgAAAHFJREFUKFOt0LENACEIBdBv4Qju4wgWanEj3D6OcIVMKaitYHEU/jwTCQj8W75kiVCSBvdQ5/AvfVHBin11BgdRq3ysBgfwBDRrj3MCIA+oAQaku/Q1cNctrAmyDl577tOThYt/Y1RBM4DgOHzM0HFTAyLukH/cmRnqAAAAAElFTkSuQmCC
// ==/UserScript== // ==/UserScript==
/* /*
* 4chan X - Version 1.2.25 - 2013-08-09 * 4chan X - Version 1.2.25 - 2013-08-10
* *
* Licensed under the MIT license. * Licensed under the MIT license.
* https://github.com/seaweedchan/4chan-x/blob/master/LICENSE * https://github.com/seaweedchan/4chan-x/blob/master/LICENSE
@ -4215,10 +4215,11 @@
_ref = this.nodes.quotelinks; _ref = this.nodes.quotelinks;
for (_i = 0, _len = _ref.length; _i < _len; _i++) { for (_i = 0, _len = _ref.length; _i < _len; _i++) {
quotelink = _ref[_i]; quotelink = _ref[_i];
if (QR.db.get(Get.postDataFromLink(quotelink))) { if (!(QR.db.get(Get.postDataFromLink(quotelink)))) {
$.add(quotelink, $.tn('\u00A0(You)')); continue;
$.addClass(this.nodes.root, 'quotesYou');
} }
$.add(quotelink, $.tn('\u00A0(You)'));
$.addClass(this.nodes.root, 'quotesYou');
} }
}, },
cb: { cb: {
@ -4297,13 +4298,17 @@
var a, boardID, m, post, postID, quote, quoteID, redirect, _ref; var a, boardID, m, post, postID, quote, quoteID, redirect, _ref;
if (deadlink.parentNode.className === 'prettyprint') { if (deadlink.parentNode.className === 'prettyprint') {
$.replace(deadlink, __slice.call(deadlink.childNodes)); Quotify.fixDeadlink(deadlink);
return; return;
} }
quote = deadlink.textContent; quote = deadlink.textContent;
if (!(postID = (_ref = quote.match(/\d+$/)) != null ? _ref[0] : void 0)) { if (!(postID = (_ref = quote.match(/\d+$/)) != null ? _ref[0] : void 0)) {
return; return;
} }
if (postID[0] === '0') {
Quotify.fixDeadlink(deadlink);
return;
}
boardID = (m = quote.match(/^>>>\/([a-z\d]+)/)) ? m[1] : this.board.ID; boardID = (m = quote.match(/^>>>\/([a-z\d]+)/)) ? m[1] : this.board.ID;
quoteID = "" + boardID + "." + postID; quoteID = "" + boardID + "." + postID;
if (post = g.posts[quoteID]) { if (post = g.posts[quoteID]) {
@ -4359,6 +4364,9 @@
if ($.hasClass(a, 'quotelink')) { if ($.hasClass(a, 'quotelink')) {
return this.nodes.quotelinks.push(a); return this.nodes.quotelinks.push(a);
} }
},
fixDeadlink: function(deadlink) {
return $.replace(deadlink, __slice.call(deadlink.childNodes));
} }
}; };
@ -4385,10 +4393,12 @@
if (this.isClone) { if (this.isClone) {
if (Conf['Embedding']) { if (Conf['Embedding']) {
i = 0; i = 0;
items = $$('.embedded', this.nodes.comment); items = $$('.embed', this.nodes.comment);
while (el = items[i++]) { while (el = items[i++]) {
$.on(el, "click", Linkify.cb.toggle); $.on(el, 'click', Linkify.cb.toggle);
Linkify.cb.toggle.call(el); if ($.hasClass(el, 'embedded')) {
Linkify.cb.toggle.call(el);
}
} }
} }
return; 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: { pastebin: {
regExp: /.*(?:pastebin.com\/(?!u\/))([^#\&\?]*).*/, regExp: /.*(?:pastebin.com\/(?!u\/))([^#\&\?]*).*/,
el: function(a) { el: function(a) {
@ -5893,7 +5912,7 @@
} }
}, },
dialog: function() { 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;', " <div class=move><label><input type=checkbox id=autohide title=Auto-hide>\n Quick Reply\n</label><a href=javascript:; class=close title=Close>×</a><select data-name=thread title='Create a new thread / Reply'><option value=new>New thread</option></select></div><form><div class=persona><input name=name data-name=name list=\"list-name\" placeholder=Name class=field size=1 tabindex=10><input name=email data-name=email list=\"list-email\" placeholder=E-mail class=field size=1 tabindex=20><input name=sub data-name=sub list=\"list-sub\" placeholder=Subject class=field size=1 tabindex=30></div><div class=textarea><textarea data-name=com placeholder=Comment class=field tabindex=40></textarea><span id=char-count></span></div><div id=dump-list-container><div id=dump-list></div><a id=add-post href=javascript:; title=\"Add a post\" tabindex=50>+</a></div><div id=file-n-submit><span id=qr-filename-container class=field tabindex=60><span id=qr-no-file>No selected file</span><span id=qr-filename></span><span id=qr-extras-container><a id=qr-filerm href=javascript:; title='Remove file'>×</a><a id=dump-button title='Dump list'>+</a></span></span><label id=qr-spoiler-label><input type=checkbox id=qr-file-spoiler title='Spoiler image' tabindex=70></label><input type=submit tabindex=80></div><input type=file multiple></form><datalist id=\"list-name\"></datalist><datalist id=\"list-email\"></datalist><datalist id=\"list-sub\"></datalist>"); dialog = UI.dialog('qr', 'top:0;right:0;', " <div class=move><label><input type=checkbox id=autohide title=Auto-hide>\n Quick Reply\n</label><a href=javascript:; class=close title=Close>×</a><select data-name=thread title='Create a new thread / Reply'><option value=new>New thread</option></select></div><form><div class=persona><input name=name data-name=name list=\"list-name\" placeholder=Name class=field size=1 tabindex=10><input name=email data-name=email list=\"list-email\" placeholder=E-mail class=field size=1 tabindex=20><input name=sub data-name=sub list=\"list-sub\" placeholder=Subject class=field size=1 tabindex=30></div><div class=textarea><textarea data-name=com placeholder=Comment class=field tabindex=40></textarea><span id=char-count></span></div><div id=dump-list-container><div id=dump-list></div><a id=add-post href=javascript:; title=\"Add a post\" tabindex=50>+</a></div><div id=file-n-submit><span id=qr-filename-container class=field tabindex=60><span id=qr-no-file>No selected file</span><span id=qr-filename></span><span id=qr-extras-container><a id=qr-filerm href=javascript:; title='Remove file'>×</a><a id=dump-button title='Dump list'>+</a></span></span><label id=qr-spoiler-label><input type=checkbox id=qr-file-spoiler title='Spoiler image' tabindex=70></label><input type=submit tabindex=80></div><input type=file multiple></form><datalist id=\"list-name\"></datalist><datalist id=\"list-email\"></datalist><datalist id=\"list-sub\"></datalist>");
QR.nodes = nodes = { QR.nodes = nodes = {
@ -5954,9 +5973,9 @@
})); }));
} }
$.on(nodes.filename.parentNode, 'click keyup', QR.openFileInput); $.on(nodes.filename.parentNode, 'click keyup', QR.openFileInput);
_ref = $$('*', QR.nodes.el); items = $$('*', QR.nodes.el);
for (_i = 0, _len = _ref.length; _i < _len; _i++) { i = 0;
elm = _ref[_i]; while (elm = items[i++]) {
$.on(elm, 'blur', QR.focusout); $.on(elm, 'blur', QR.focusout);
$.on(elm, 'focus', QR.focusin); $.on(elm, 'focus', QR.focusin);
} }
@ -5981,9 +6000,9 @@
return QR.selected.nodes.spoiler.click(); return QR.selected.nodes.spoiler.click();
}); });
$.on(nodes.fileInput, 'change', QR.fileInput); $.on(nodes.fileInput, 'change', QR.fileInput);
_ref1 = ['name', 'email', 'sub', 'com']; items = ['name', 'email', 'sub', 'com'];
for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) { i = 0;
name = _ref1[_j]; while (name = items[i++]) {
$.on(nodes[name], 'input', function() { $.on(nodes[name], 'input', function() {
return QR.selected.save(this); return QR.selected.save(this);
}); });
@ -7024,7 +7043,7 @@
a = $.el('a', { a = $.el('a', {
className: 'menu-button brackets-wrap', className: 'menu-button brackets-wrap',
innerHTML: '<span class=drop-marker></span>', innerHTML: '<i></i>',
href: 'javascript:;' href: 'javascript:;'
}); });
return { return {
@ -8525,7 +8544,7 @@
return; return;
} }
roll = $('b', this.nodes.comment).firstChild; 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));
} }
}; };

View File

@ -18,7 +18,7 @@
// ==/UserScript== // ==/UserScript==
/* /*
* appchan x - Version 2.2.2 - 2013-08-09 * appchan x - Version 2.2.2 - 2013-08-10
* *
* Licensed under the MIT license. * Licensed under the MIT license.
* https://github.com/zixaphir/appchan-x/blob/master/LICENSE * https://github.com/zixaphir/appchan-x/blob/master/LICENSE
@ -6514,10 +6514,11 @@
_ref = this.nodes.quotelinks; _ref = this.nodes.quotelinks;
for (_i = 0, _len = _ref.length; _i < _len; _i++) { for (_i = 0, _len = _ref.length; _i < _len; _i++) {
quotelink = _ref[_i]; quotelink = _ref[_i];
if (QR.db.get(Get.postDataFromLink(quotelink))) { if (!(QR.db.get(Get.postDataFromLink(quotelink)))) {
$.add(quotelink, $.tn('\u00A0(You)')); continue;
$.addClass(this.nodes.root, 'quotesYou');
} }
$.add(quotelink, $.tn('\u00A0(You)'));
$.addClass(this.nodes.root, 'quotesYou');
} }
}, },
cb: { cb: {
@ -6596,13 +6597,17 @@
var a, boardID, m, post, postID, quote, quoteID, redirect, _ref; var a, boardID, m, post, postID, quote, quoteID, redirect, _ref;
if (deadlink.parentNode.className === 'prettyprint') { if (deadlink.parentNode.className === 'prettyprint') {
$.replace(deadlink, __slice.call(deadlink.childNodes)); Quotify.fixDeadlink(deadlink);
return; return;
} }
quote = deadlink.textContent; quote = deadlink.textContent;
if (!(postID = (_ref = quote.match(/\d+$/)) != null ? _ref[0] : void 0)) { if (!(postID = (_ref = quote.match(/\d+$/)) != null ? _ref[0] : void 0)) {
return; return;
} }
if (postID[0] === '0') {
Quotify.fixDeadlink(deadlink);
return;
}
boardID = (m = quote.match(/^>>>\/([a-z\d]+)/)) ? m[1] : this.board.ID; boardID = (m = quote.match(/^>>>\/([a-z\d]+)/)) ? m[1] : this.board.ID;
quoteID = "" + boardID + "." + postID; quoteID = "" + boardID + "." + postID;
if (post = g.posts[quoteID]) { if (post = g.posts[quoteID]) {
@ -6658,6 +6663,9 @@
if ($.hasClass(a, 'quotelink')) { if ($.hasClass(a, 'quotelink')) {
return this.nodes.quotelinks.push(a); return this.nodes.quotelinks.push(a);
} }
},
fixDeadlink: function(deadlink) {
return $.replace(deadlink, __slice.call(deadlink.childNodes));
} }
}; };
@ -6684,10 +6692,12 @@
if (this.isClone) { if (this.isClone) {
if (Conf['Embedding']) { if (Conf['Embedding']) {
i = 0; i = 0;
items = $$('.embedded', this.nodes.comment); items = $$('.embed', this.nodes.comment);
while (el = items[i++]) { while (el = items[i++]) {
$.on(el, "click", Linkify.cb.toggle); $.on(el, 'click', Linkify.cb.toggle);
Linkify.cb.toggle.call(el); if ($.hasClass(el, 'embedded')) {
Linkify.cb.toggle.call(el);
}
} }
} }
return; 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: { pastebin: {
regExp: /.*(?:pastebin.com\/(?!u\/))([^#\&\?]*).*/, regExp: /.*(?:pastebin.com\/(?!u\/))([^#\&\?]*).*/,
el: function(a) { el: function(a) {
@ -8184,7 +8203,7 @@
} }
}, },
dialog: function() { 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 = { QR.nodes = nodes = {
el: dialog = UI.dialog('qr', 'top:0;right:0;', "<div id=qrtab class=move><input type=checkbox id=autohide title=Auto-hide><div id=qr-thread-select><select data-name=thread title='Create a new thread / Reply'><option value=new>New thread</option></select></div><a href=javascript:; class=close title=Close>✖</a></div><form><div class=persona><input name=name data-name=name list=\"list-name\" placeholder=Name class=field size=1 tabindex=10><input name=email data-name=email list=\"list-email\" placeholder=E-mail class=field size=1 tabindex=20><input name=sub data-name=sub list=\"list-sub\" placeholder=Subject class=field size=1 tabindex=30></div><div class=textarea><textarea data-name=com placeholder=Comment class=field tabindex=40></textarea><span id=char-count></span></div><div id=dump-list-container><div id=dump-list></div><a id=add-post href=javascript:; title=\"Add a post\" tabindex=50>+</a></div><div id=file-n-submit><span id=qr-filename-container class=field tabindex=60><span id=qr-no-file>No selected file</span><span id=qr-filename></span><span id=qr-extras-container><label id=qr-spoiler-label><input type=checkbox id=qr-file-spoiler title='Spoiler image' tabindex=70></label><span class=description>Spoiler</span><a id=dump-button title='Dump list'>+</a><span class=description>Dump</span><a id=qr-filerm href=javascript:; title='Remove file'>✖</a><span class=description>Remove File</span></span></span><input type=submit tabindex=80></div><input type=file multiple></form><datalist id=\"list-name\"></datalist><datalist id=\"list-email\"></datalist><datalist id=\"list-sub\"></datalist>") el: dialog = UI.dialog('qr', 'top:0;right:0;', "<div id=qrtab class=move><input type=checkbox id=autohide title=Auto-hide><div id=qr-thread-select><select data-name=thread title='Create a new thread / Reply'><option value=new>New thread</option></select></div><a href=javascript:; class=close title=Close>✖</a></div><form><div class=persona><input name=name data-name=name list=\"list-name\" placeholder=Name class=field size=1 tabindex=10><input name=email data-name=email list=\"list-email\" placeholder=E-mail class=field size=1 tabindex=20><input name=sub data-name=sub list=\"list-sub\" placeholder=Subject class=field size=1 tabindex=30></div><div class=textarea><textarea data-name=com placeholder=Comment class=field tabindex=40></textarea><span id=char-count></span></div><div id=dump-list-container><div id=dump-list></div><a id=add-post href=javascript:; title=\"Add a post\" tabindex=50>+</a></div><div id=file-n-submit><span id=qr-filename-container class=field tabindex=60><span id=qr-no-file>No selected file</span><span id=qr-filename></span><span id=qr-extras-container><label id=qr-spoiler-label><input type=checkbox id=qr-file-spoiler title='Spoiler image' tabindex=70></label><span class=description>Spoiler</span><a id=dump-button title='Dump list'>+</a><span class=description>Dump</span><a id=qr-filerm href=javascript:; title='Remove file'>✖</a><span class=description>Remove File</span></span></span><input type=submit tabindex=80></div><input type=file multiple></form><datalist id=\"list-name\"></datalist><datalist id=\"list-email\"></datalist><datalist id=\"list-sub\"></datalist>")
@ -8252,9 +8271,9 @@
})); }));
} }
$.on(nodes.filename.parentNode, 'click keyup', QR.openFileInput); $.on(nodes.filename.parentNode, 'click keyup', QR.openFileInput);
_ref1 = $$('*', QR.nodes.el); items = $$('*', QR.nodes.el);
for (_i = 0, _len = _ref1.length; _i < _len; _i++) { i = 0;
elm = _ref1[_i]; while (elm = items[i++]) {
$.on(elm, 'blur', QR.focusout); $.on(elm, 'blur', QR.focusout);
$.on(elm, 'focus', QR.focusin); $.on(elm, 'focus', QR.focusin);
} }
@ -8279,14 +8298,14 @@
return QR.selected.nodes.spoiler.click(); return QR.selected.nodes.spoiler.click();
}); });
$.on(nodes.fileInput, 'change', QR.fileInput); $.on(nodes.fileInput, 'change', QR.fileInput);
_ref2 = ['spoilerPar', 'dumpButton', 'fileRM']; items = ['spoilerPar', 'dumpButton', 'fileRM'];
for (_j = 0, _len1 = _ref2.length; _j < _len1; _j++) { i = 0;
name = _ref2[_j]; while (name = items[i++]) {
$.on(nodes[name], 'mouseover', QR.mouseover); $.on(nodes[name], 'mouseover', QR.mouseover);
} }
_ref3 = ['name', 'email', 'sub', 'com']; items = ['name', 'email', 'sub', 'com'];
for (_k = 0, _len2 = _ref3.length; _k < _len2; _k++) { i = 0;
name = _ref3[_k]; while (name = items[i++]) {
$.on(nodes[name], 'input', function() { $.on(nodes[name], 'input', function() {
return QR.selected.save(this); return QR.selected.save(this);
}); });
@ -12432,7 +12451,7 @@
return; return;
} }
roll = $('b', this.nodes.comment).firstChild; 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));
} }
}; };

View File

@ -1,6 +1,6 @@
// Generated by CoffeeScript // 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. * Licensed under the MIT license.
* https://github.com/zixaphir/appchan-x/blob/master/LICENSE * https://github.com/zixaphir/appchan-x/blob/master/LICENSE
@ -6521,10 +6521,11 @@
_ref = this.nodes.quotelinks; _ref = this.nodes.quotelinks;
for (_i = 0, _len = _ref.length; _i < _len; _i++) { for (_i = 0, _len = _ref.length; _i < _len; _i++) {
quotelink = _ref[_i]; quotelink = _ref[_i];
if (QR.db.get(Get.postDataFromLink(quotelink))) { if (!(QR.db.get(Get.postDataFromLink(quotelink)))) {
$.add(quotelink, $.tn('\u00A0(You)')); continue;
$.addClass(this.nodes.root, 'quotesYou');
} }
$.add(quotelink, $.tn('\u00A0(You)'));
$.addClass(this.nodes.root, 'quotesYou');
} }
}, },
cb: { cb: {
@ -6603,13 +6604,17 @@
var a, boardID, m, post, postID, quote, quoteID, redirect, _ref; var a, boardID, m, post, postID, quote, quoteID, redirect, _ref;
if (deadlink.parentNode.className === 'prettyprint') { if (deadlink.parentNode.className === 'prettyprint') {
$.replace(deadlink, __slice.call(deadlink.childNodes)); Quotify.fixDeadlink(deadlink);
return; return;
} }
quote = deadlink.textContent; quote = deadlink.textContent;
if (!(postID = (_ref = quote.match(/\d+$/)) != null ? _ref[0] : void 0)) { if (!(postID = (_ref = quote.match(/\d+$/)) != null ? _ref[0] : void 0)) {
return; return;
} }
if (postID[0] === '0') {
Quotify.fixDeadlink(deadlink);
return;
}
boardID = (m = quote.match(/^>>>\/([a-z\d]+)/)) ? m[1] : this.board.ID; boardID = (m = quote.match(/^>>>\/([a-z\d]+)/)) ? m[1] : this.board.ID;
quoteID = "" + boardID + "." + postID; quoteID = "" + boardID + "." + postID;
if (post = g.posts[quoteID]) { if (post = g.posts[quoteID]) {
@ -6665,6 +6670,9 @@
if ($.hasClass(a, 'quotelink')) { if ($.hasClass(a, 'quotelink')) {
return this.nodes.quotelinks.push(a); return this.nodes.quotelinks.push(a);
} }
},
fixDeadlink: function(deadlink) {
return $.replace(deadlink, __slice.call(deadlink.childNodes));
} }
}; };
@ -6691,10 +6699,12 @@
if (this.isClone) { if (this.isClone) {
if (Conf['Embedding']) { if (Conf['Embedding']) {
i = 0; i = 0;
items = $$('.embedded', this.nodes.comment); items = $$('.embed', this.nodes.comment);
while (el = items[i++]) { while (el = items[i++]) {
$.on(el, "click", Linkify.cb.toggle); $.on(el, 'click', Linkify.cb.toggle);
Linkify.cb.toggle.call(el); if ($.hasClass(el, 'embedded')) {
Linkify.cb.toggle.call(el);
}
} }
} }
return; 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: { pastebin: {
regExp: /.*(?:pastebin.com\/(?!u\/))([^#\&\?]*).*/, regExp: /.*(?:pastebin.com\/(?!u\/))([^#\&\?]*).*/,
el: function(a) { el: function(a) {
@ -8184,7 +8203,7 @@
} }
}, },
dialog: function() { 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 = { QR.nodes = nodes = {
el: dialog = UI.dialog('qr', 'top:0;right:0;', "<div id=qrtab class=move><input type=checkbox id=autohide title=Auto-hide><div id=qr-thread-select><select data-name=thread title='Create a new thread / Reply'><option value=new>New thread</option></select></div><a href=javascript:; class=close title=Close>✖</a></div><form><div class=persona><input name=name data-name=name list=\"list-name\" placeholder=Name class=field size=1 tabindex=10><input name=email data-name=email list=\"list-email\" placeholder=E-mail class=field size=1 tabindex=20><input name=sub data-name=sub list=\"list-sub\" placeholder=Subject class=field size=1 tabindex=30></div><div class=textarea><textarea data-name=com placeholder=Comment class=field tabindex=40></textarea><span id=char-count></span></div><div id=dump-list-container><div id=dump-list></div><a id=add-post href=javascript:; title=\"Add a post\" tabindex=50>+</a></div><div id=file-n-submit><span id=qr-filename-container class=field tabindex=60><span id=qr-no-file>No selected file</span><span id=qr-filename></span><span id=qr-extras-container><label id=qr-spoiler-label><input type=checkbox id=qr-file-spoiler title='Spoiler image' tabindex=70></label><span class=description>Spoiler</span><a id=dump-button title='Dump list'>+</a><span class=description>Dump</span><a id=qr-filerm href=javascript:; title='Remove file'>✖</a><span class=description>Remove File</span></span></span><input type=submit tabindex=80></div><input type=file multiple></form><datalist id=\"list-name\"></datalist><datalist id=\"list-email\"></datalist><datalist id=\"list-sub\"></datalist>") el: dialog = UI.dialog('qr', 'top:0;right:0;', "<div id=qrtab class=move><input type=checkbox id=autohide title=Auto-hide><div id=qr-thread-select><select data-name=thread title='Create a new thread / Reply'><option value=new>New thread</option></select></div><a href=javascript:; class=close title=Close>✖</a></div><form><div class=persona><input name=name data-name=name list=\"list-name\" placeholder=Name class=field size=1 tabindex=10><input name=email data-name=email list=\"list-email\" placeholder=E-mail class=field size=1 tabindex=20><input name=sub data-name=sub list=\"list-sub\" placeholder=Subject class=field size=1 tabindex=30></div><div class=textarea><textarea data-name=com placeholder=Comment class=field tabindex=40></textarea><span id=char-count></span></div><div id=dump-list-container><div id=dump-list></div><a id=add-post href=javascript:; title=\"Add a post\" tabindex=50>+</a></div><div id=file-n-submit><span id=qr-filename-container class=field tabindex=60><span id=qr-no-file>No selected file</span><span id=qr-filename></span><span id=qr-extras-container><label id=qr-spoiler-label><input type=checkbox id=qr-file-spoiler title='Spoiler image' tabindex=70></label><span class=description>Spoiler</span><a id=dump-button title='Dump list'>+</a><span class=description>Dump</span><a id=qr-filerm href=javascript:; title='Remove file'>✖</a><span class=description>Remove File</span></span></span><input type=submit tabindex=80></div><input type=file multiple></form><datalist id=\"list-name\"></datalist><datalist id=\"list-email\"></datalist><datalist id=\"list-sub\"></datalist>")
@ -8273,14 +8292,14 @@
return QR.selected.nodes.spoiler.click(); return QR.selected.nodes.spoiler.click();
}); });
$.on(nodes.fileInput, 'change', QR.fileInput); $.on(nodes.fileInput, 'change', QR.fileInput);
_ref1 = ['spoilerPar', 'dumpButton', 'fileRM']; items = ['spoilerPar', 'dumpButton', 'fileRM'];
for (_i = 0, _len = _ref1.length; _i < _len; _i++) { i = 0;
name = _ref1[_i]; while (name = items[i++]) {
$.on(nodes[name], 'mouseover', QR.mouseover); $.on(nodes[name], 'mouseover', QR.mouseover);
} }
_ref2 = ['name', 'email', 'sub', 'com']; items = ['name', 'email', 'sub', 'com'];
for (_j = 0, _len1 = _ref2.length; _j < _len1; _j++) { i = 0;
name = _ref2[_j]; while (name = items[i++]) {
$.on(nodes[name], 'input', function() { $.on(nodes[name], 'input', function() {
return QR.selected.save(this); return QR.selected.save(this);
}); });
@ -12420,7 +12439,7 @@
return; return;
} }
roll = $('b', this.nodes.comment).firstChild; 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));
} }
}; };

View File

@ -36,10 +36,10 @@ Linkify =
if @isClone if @isClone
if Conf['Embedding'] if Conf['Embedding']
i = 0 i = 0
items = $$ '.embedded', @nodes.comment items = $$ '.embed', @nodes.comment
while el = items[i++] while el = items[i++]
$.on el, "click", Linkify.cb.toggle $.on el, 'click', Linkify.cb.toggle
Linkify.cb.toggle.call el Linkify.cb.toggle.call el if $.hasClass el, 'embedded'
return return
@ -279,6 +279,36 @@ Linkify =
$.el 'object', $.el 'object',
innerHTML: "<embed src='http://www.liveleak.com/e/#{a.dataset.uid}?autostart=true' wmode='opaque' width='640' height='390' pluginspage='http://get.adobe.com/flashplayer/' type='application/x-shockwave-flash'></embed>" innerHTML: "<embed src='http://www.liveleak.com/e/#{a.dataset.uid}?autostart=true' wmode='opaque' width='640' height='390' pluginspage='http://get.adobe.com/flashplayer/' type='application/x-shockwave-flash'></embed>"
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'
# """
#<video autoplay loop>
# <source src="https://mediacru.sh/#{a.dataset.uid}.mp4" type="video/mp4;">
# <source src="https://mediacru.sh/#{a.dataset.uid}.ogv" type="video/ogg; codecs='theora, vorbis'">
#</video>"""
# when 'image/png', 'image/gif', 'image/jpeg'
# "<a target=_blank href='#{a.dataset.href}'><img src='https://mediacru.sh/#{file.file}'></a>"
# when 'image/svg', 'image/svg+xml'
# "<embed src='https://mediacru.sh/#{file.file}' type='image/svg+xml' />"
# when 'audio/mpeg'
# "<audio controls><source src='https://mediacru.sh/#{file.file}'></audio>"
# el
pastebin: pastebin:
regExp: /.*(?:pastebin.com\/(?!u\/))([^#\&\?]*).*/ regExp: /.*(?:pastebin.com\/(?!u\/))([^#\&\?]*).*/
el: (a) -> el: (a) ->

View File

@ -8,4 +8,4 @@ Dice =
return if @isClone or not dicestats = @info.email?.match /dice[+\s](\d+)d(\d+)/ return if @isClone or not dicestats = @info.email?.match /dice[+\s](\d+)d(\d+)/
# Use the text node directly, as the <b> has two <br>. # Use the text node directly, as the <b> has two <br>.
roll = $('b', @nodes.comment).firstChild roll = $('b', @nodes.comment).firstChild
roll.data = "Rolled #{dicestats[1]}d#{dicestats[2]} and got #{roll.data.slice 7}" roll.data = "Rolled #{dicestats[1]}d#{dicestats[2]}: #{roll.data.slice 7}"

View File

@ -941,10 +941,13 @@ QR =
<% if (type === 'userscript') { %> <% if (type === 'userscript') { %>
# XXX Firefox lacks focusin/focusout support. # XXX Firefox lacks focusin/focusout support.
for elm in $$ '*', QR.nodes.el items = $$ '*', QR.nodes.el
i = 0
while elm = items[i++]
$.on elm, 'blur', QR.focusout $.on elm, 'blur', QR.focusout
$.on elm, 'focus', QR.focusin $.on elm, 'focus', QR.focusin
<% } %> <% } %>
$.on dialog, 'focusin', QR.focusin $.on dialog, 'focusin', QR.focusin
$.on dialog, 'focusout', QR.focusout $.on dialog, 'focusout', QR.focusout
$.on nodes.autohide, 'change', QR.toggleHide $.on nodes.autohide, 'change', QR.toggleHide
@ -956,11 +959,17 @@ QR =
$.on nodes.fileExtras, 'click', (e) -> e.stopPropagation() $.on nodes.fileExtras, 'click', (e) -> e.stopPropagation()
$.on nodes.spoiler, 'change', -> QR.selected.nodes.spoiler.click() $.on nodes.spoiler, 'change', -> QR.selected.nodes.spoiler.click()
$.on nodes.fileInput, 'change', QR.fileInput $.on nodes.fileInput, 'change', QR.fileInput
# mouseover descriptions # mouseover descriptions
for name in ['spoilerPar', 'dumpButton', 'fileRM'] items = ['spoilerPar', 'dumpButton', 'fileRM']
i = 0
while name = items[i++]
$.on nodes[name], 'mouseover', QR.mouseover $.on nodes[name], 'mouseover', QR.mouseover
# save selected post's data # save selected post's data
for name in ['name', 'email', 'sub', 'com'] items = ['name', 'email', 'sub', 'com']
i = 0
while name = items[i++]
$.on nodes[name], 'input', -> QR.selected.save @ $.on nodes[name], 'input', -> QR.selected.save @
$.on nodes['name'], 'blur', QR.tripcodeHider $.on nodes['name'], 'blur', QR.tripcodeHider
$.on nodes.thread, 'change', -> QR.selected.save @ $.on nodes.thread, 'change', -> QR.selected.save @

View File

@ -25,8 +25,7 @@ QuoteYou =
# Stop there if there's no quotes in that post. # Stop there if there's no quotes in that post.
return unless @quotes.length return unless @quotes.length
for quotelink in @nodes.quotelinks for quotelink in @nodes.quotelinks when QR.db.get Get.postDataFromLink quotelink
if QR.db.get Get.postDataFromLink quotelink
$.add quotelink, $.tn '\u00A0(You)' $.add quotelink, $.tn '\u00A0(You)'
$.addClass @nodes.root, 'quotesYou' $.addClass @nodes.root, 'quotesYou'
return return

View File

@ -24,11 +24,15 @@ Quotify =
# This won't be necessary once 4chan # This won't be necessary once 4chan
# stops quotifying inside code tags: # stops quotifying inside code tags:
# https://github.com/4chan/4chan-JS/issues/77 # https://github.com/4chan/4chan-JS/issues/77
$.replace deadlink, [deadlink.childNodes...] Quotify.fixDeadlink deadlink
return return
quote = deadlink.textContent quote = deadlink.textContent
return unless postID = quote.match(/\d+$/)?[0] return unless postID = quote.match(/\d+$/)?[0]
if postID[0] is '0'
# Fix quotelinks that start with a `0`.
Quotify.fixDeadlink deadlink
return
boardID = if m = quote.match /^>>>\/([a-z\d]+)/ boardID = if m = quote.match /^>>>\/([a-z\d]+)/
m[1] m[1]
else else
@ -75,3 +79,6 @@ Quotify =
$.replace deadlink, a $.replace deadlink, a
if $.hasClass a, 'quotelink' if $.hasClass a, 'quotelink'
@nodes.quotelinks.push a @nodes.quotelinks.push a
fixDeadlink: (deadlink) ->
$.replace deadlink, [deadlink.childNodes...]