Merge Mayhem's QR fix

This commit is contained in:
Zixaphir 2014-02-20 12:57:24 -07:00
parent 6649e8519c
commit 87d3624442
4 changed files with 10 additions and 37 deletions

View File

@ -1,5 +1,5 @@
/*
* 4chan X - Version 1.3.7 - 2014-02-16
* 4chan X - Version 1.3.7 - 2014-02-20
*
* Licensed under the MIT license.
* https://github.com/Spittie/4chan-x/blob/master/LICENSE

View File

@ -24,7 +24,7 @@
// ==/UserScript==
/*
* 4chan X - Version 1.3.7 - 2014-02-16
* 4chan X - Version 1.3.7 - 2014-02-20
*
* Licensed under the MIT license.
* https://github.com/Spittie/4chan-x/blob/master/LICENSE
@ -5580,6 +5580,7 @@
};
QR = {
mimeTypes: ['image/jpeg', 'image/png', 'image/gif', 'application/pdf', 'application/x-shockwave-flash', ''],
init: function() {
var sc;
if (!Conf['Quick Reply']) {
@ -6047,7 +6048,7 @@
return list.value = g.VIEW === 'thread' ? g.THREADID : 'new';
},
dialog: function() {
var check, dialog, elm, event, i, items, key, mimeTypes, name, node, nodes, save, value, _ref;
var dialog, elm, event, i, items, key, name, node, nodes, save, value, _ref;
QR.nodes = nodes = {
el: dialog = UI.dialog('qr', 'top:0;right:0;', "<div class=move><label><input type=checkbox id=autohide title=Auto-hide>Quick Reply</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><input id=\"qr-filename\" data-name=\"filename\" spellcheck=\"false\"><span id=qr-extras-container><a id=qr-filerm href=javascript:; title='Remove file'><i class=\"fa fa-times-circle\"></i></a><a id=url-button title='Post from url'><i class=\"fa fa-link\"></i></a><a id=dump-button title='Dump list'><i class=\"fa fa-plus-square\"></i></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> ")
};
@ -6081,16 +6082,6 @@
value = _ref[key];
nodes[key] = $(value, dialog);
}
check = {
jpg: 'image/jpeg',
pdf: 'application/pdf',
swf: 'application/x-shockwave-flash'
};
mimeTypes = $('ul.rules > li').textContent.trim().match(/: (.+)/)[1].toLowerCase().replace(/\w+/g, function(type) {
return check[type] || ("image/" + type);
});
QR.mimeTypes = mimeTypes.split(', ');
QR.mimeTypes.push('');
nodes.fileInput.max = $('input[name=MAX_FILE_SIZE]').value;
QR.spoiler = !!$('input[name=spoiler]');
if (QR.spoiler) {

View File

@ -1,6 +1,6 @@
// Generated by CoffeeScript
/*
* 4chan X - Version 1.3.7 - 2014-02-16
* 4chan X - Version 1.3.7 - 2014-02-20
*
* Licensed under the MIT license.
* https://github.com/Spittie/4chan-x/blob/master/LICENSE
@ -5614,6 +5614,7 @@
};
QR = {
mimeTypes: ['image/jpeg', 'image/png', 'image/gif', 'application/pdf', 'application/x-shockwave-flash', ''],
init: function() {
var sc;
if (!Conf['Quick Reply']) {
@ -6077,7 +6078,7 @@
return list.value = g.VIEW === 'thread' ? g.THREADID : 'new';
},
dialog: function() {
var check, dialog, elm, event, i, items, key, mimeTypes, name, node, nodes, save, value, _ref;
var dialog, elm, event, i, items, key, name, node, nodes, save, value, _ref;
QR.nodes = nodes = {
el: dialog = UI.dialog('qr', 'top:0;right:0;', "<div class=move><label><input type=checkbox id=autohide title=Auto-hide>Quick Reply</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><input id=\"qr-filename\" data-name=\"filename\" spellcheck=\"false\"><span id=qr-extras-container><a id=qr-filerm href=javascript:; title='Remove file'><i class=\"fa fa-times-circle\"></i></a><a id=url-button title='Post from url'><i class=\"fa fa-link\"></i></a><a id=dump-button title='Dump list'><i class=\"fa fa-plus-square\"></i></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> ")
};
@ -6111,16 +6112,6 @@
value = _ref[key];
nodes[key] = $(value, dialog);
}
check = {
jpg: 'image/jpeg',
pdf: 'application/pdf',
swf: 'application/x-shockwave-flash'
};
mimeTypes = $('ul.rules > li').textContent.trim().match(/: (.+)/)[1].toLowerCase().replace(/\w+/g, function(type) {
return check[type] || ("image/" + type);
});
QR.mimeTypes = mimeTypes.split(', ');
QR.mimeTypes.push('');
nodes.fileInput.max = $('input[name=MAX_FILE_SIZE]').value;
QR.spoiler = !!$('input[name=spoiler]');
if (QR.spoiler) {

View File

@ -1,4 +1,7 @@
QR =
# Add empty mimeType to avoid errors with URLs selected in Window's file dialog.
mimeTypes: ['image/jpeg', 'image/png', 'image/gif', 'application/pdf', 'application/x-shockwave-flash', '']
init: ->
return if !Conf['Quick Reply']
@ -430,18 +433,6 @@ QR =
fileInput: '[type=file]'
}
check =
jpg: 'image/jpeg'
pdf: 'application/pdf'
swf: 'application/x-shockwave-flash'
# Allow only this board's supported files.
mimeTypes = $('ul.rules > li').textContent.trim().match(/: (.+)/)[1].toLowerCase().replace /\w+/g, (type) ->
check[type] or "image/#{type}"
QR.mimeTypes = mimeTypes.split ', '
# Add empty mimeType to avoid errors with URLs selected in Window's file dialog.
QR.mimeTypes.push ''
nodes.fileInput.max = $('input[name=MAX_FILE_SIZE]').value
QR.spoiler = !!$ 'input[name=spoiler]'