Merge branch 'master' into getarchivedquotes
This commit is contained in:
commit
2ee04e6046
@ -1572,6 +1572,9 @@
|
|||||||
text = ">>" + id + "\n";
|
text = ">>" + id + "\n";
|
||||||
sel = window.getSelection();
|
sel = window.getSelection();
|
||||||
if ((s = sel.toString()) && id === ((_ref = $.x('ancestor-or-self::blockquote', sel.anchorNode)) != null ? _ref.id.match(/\d+$/)[0] : void 0)) {
|
if ((s = sel.toString()) && id === ((_ref = $.x('ancestor-or-self::blockquote', sel.anchorNode)) != null ? _ref.id.match(/\d+$/)[0] : void 0)) {
|
||||||
|
if ($.engine === 'presto') {
|
||||||
|
s = d.getSelection();
|
||||||
|
}
|
||||||
s = s.replace(/\n/g, '\n>');
|
s = s.replace(/\n/g, '\n>');
|
||||||
text += ">" + s + "\n";
|
text += ">" + s + "\n";
|
||||||
}
|
}
|
||||||
@ -1580,6 +1583,9 @@
|
|||||||
ta.value = ta.value.slice(0, caretPos) + text + ta.value.slice(ta.selectionEnd);
|
ta.value = ta.value.slice(0, caretPos) + text + ta.value.slice(ta.selectionEnd);
|
||||||
ta.focus();
|
ta.focus();
|
||||||
range = caretPos + text.length;
|
range = caretPos + text.length;
|
||||||
|
if ($.engine === 'presto') {
|
||||||
|
range += text.match(/\n/g).length;
|
||||||
|
}
|
||||||
ta.setSelectionRange(range, range);
|
ta.setSelectionRange(range, range);
|
||||||
e = d.createEvent('Event');
|
e = d.createEvent('Event');
|
||||||
e.initEvent('input', true, false);
|
e.initEvent('input', true, false);
|
||||||
@ -1640,7 +1646,27 @@
|
|||||||
return QR.resetFileInput();
|
return QR.resetFileInput();
|
||||||
},
|
},
|
||||||
resetFileInput: function() {
|
resetFileInput: function() {
|
||||||
return $('[type=file]', QR.el).value = null;
|
var clone, input;
|
||||||
|
input = $('[type=file]', QR.el);
|
||||||
|
input.value = null;
|
||||||
|
if ($.engine !== 'presto') {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
clone = $.el('input', {
|
||||||
|
type: 'file',
|
||||||
|
accept: input.accept,
|
||||||
|
max: input.max,
|
||||||
|
multiple: input.multiple,
|
||||||
|
size: input.size,
|
||||||
|
title: input.title
|
||||||
|
});
|
||||||
|
$.on(clone, 'change', QR.fileInput);
|
||||||
|
$.on(clone, 'click', function(e) {
|
||||||
|
if (e.shiftKey) {
|
||||||
|
return QR.selected.rmFile() || e.preventDefault();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return $.replace(input, clone);
|
||||||
},
|
},
|
||||||
replies: [],
|
replies: [],
|
||||||
reply: (function() {
|
reply: (function() {
|
||||||
@ -4484,7 +4510,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
preParse: function(node) {
|
preParse: function(node) {
|
||||||
var el, fileInfo, img, parentClass, post;
|
var el, img, parentClass, post;
|
||||||
parentClass = node.parentNode.className;
|
parentClass = node.parentNode.className;
|
||||||
el = $('.post', node);
|
el = $('.post', node);
|
||||||
post = {
|
post = {
|
||||||
@ -4502,12 +4528,9 @@
|
|||||||
fileInfo: false,
|
fileInfo: false,
|
||||||
img: false
|
img: false
|
||||||
};
|
};
|
||||||
if (fileInfo = $('.fileInfo', el)) {
|
if (img = $('img[data-md5]', el)) {
|
||||||
img = fileInfo.nextElementSibling.firstElementChild;
|
post.fileInfo = img.parentNode.previousElementSibling;
|
||||||
if (img.alt !== 'File deleted.') {
|
post.img = img;
|
||||||
post.fileInfo = fileInfo;
|
|
||||||
post.img = img;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
Main.prettify(post.blockquote);
|
Main.prettify(post.blockquote);
|
||||||
return post;
|
return post;
|
||||||
|
|||||||
@ -1,4 +1,7 @@
|
|||||||
master
|
master
|
||||||
|
- Mayhem
|
||||||
|
Opera fixes.
|
||||||
|
/f/ fixes.
|
||||||
|
|
||||||
2.32.1
|
2.32.1
|
||||||
- Mayhem
|
- Mayhem
|
||||||
|
|||||||
@ -1159,6 +1159,8 @@ QR =
|
|||||||
|
|
||||||
sel = window.getSelection()
|
sel = window.getSelection()
|
||||||
if (s = sel.toString()) and id is $.x('ancestor-or-self::blockquote', sel.anchorNode)?.id.match(/\d+$/)[0]
|
if (s = sel.toString()) and id is $.x('ancestor-or-self::blockquote', sel.anchorNode)?.id.match(/\d+$/)[0]
|
||||||
|
# XXX Opera needs d.getSelection() to retain linebreaks from the selected text
|
||||||
|
s = d.getSelection() if $.engine is 'presto'
|
||||||
s = s.replace /\n/g, '\n>'
|
s = s.replace /\n/g, '\n>'
|
||||||
text += ">#{s}\n"
|
text += ">#{s}\n"
|
||||||
|
|
||||||
@ -1169,6 +1171,8 @@ QR =
|
|||||||
ta.focus()
|
ta.focus()
|
||||||
# Move the caret to the end of the new quote.
|
# Move the caret to the end of the new quote.
|
||||||
range = caretPos + text.length
|
range = caretPos + text.length
|
||||||
|
# XXX Opera counts newlines as double
|
||||||
|
range += text.match(/\n/g).length if $.engine is 'presto'
|
||||||
ta.setSelectionRange range, range
|
ta.setSelectionRange range, range
|
||||||
|
|
||||||
# Fire the 'input' event
|
# Fire the 'input' event
|
||||||
@ -1221,7 +1225,20 @@ QR =
|
|||||||
$.addClass QR.el, 'dump'
|
$.addClass QR.el, 'dump'
|
||||||
QR.resetFileInput() # reset input
|
QR.resetFileInput() # reset input
|
||||||
resetFileInput: ->
|
resetFileInput: ->
|
||||||
$('[type=file]', QR.el).value = null
|
input = $ '[type=file]', QR.el
|
||||||
|
input.value = null
|
||||||
|
return unless $.engine is 'presto'
|
||||||
|
# XXX Opera needs extra care to reset its file input's value
|
||||||
|
clone = $.el 'input',
|
||||||
|
type: 'file'
|
||||||
|
accept: input.accept
|
||||||
|
max: input.max
|
||||||
|
multiple: input.multiple
|
||||||
|
size: input.size
|
||||||
|
title: input.title
|
||||||
|
$.on clone, 'change', QR.fileInput
|
||||||
|
$.on clone, 'click', (e) -> if e.shiftKey then QR.selected.rmFile() or e.preventDefault()
|
||||||
|
$.replace input, clone
|
||||||
|
|
||||||
replies: []
|
replies: []
|
||||||
reply: class
|
reply: class
|
||||||
@ -2148,7 +2165,7 @@ Sauce =
|
|||||||
@links = []
|
@links = []
|
||||||
for link in Conf['sauces'].split '\n'
|
for link in Conf['sauces'].split '\n'
|
||||||
continue if link[0] is '#'
|
continue if link[0] is '#'
|
||||||
# .trim() is there to fix Opera reading two different line breaks.
|
# XXX .trim() is there to fix Opera reading two different line breaks.
|
||||||
@links.push @createSauceLink link.trim()
|
@links.push @createSauceLink link.trim()
|
||||||
return unless @links.length
|
return unless @links.length
|
||||||
Main.callbacks.push @node
|
Main.callbacks.push @node
|
||||||
@ -3491,11 +3508,11 @@ Main =
|
|||||||
backlinks: el.getElementsByClassName 'backlink'
|
backlinks: el.getElementsByClassName 'backlink'
|
||||||
fileInfo: false
|
fileInfo: false
|
||||||
img: false
|
img: false
|
||||||
if fileInfo = $ '.fileInfo', el
|
if img = $ 'img[data-md5]', el
|
||||||
img = fileInfo.nextElementSibling.firstElementChild
|
# Make sure to not add deleted images,
|
||||||
if img.alt isnt 'File deleted.'
|
# those do not have a data-md5 attribute.
|
||||||
post.fileInfo = fileInfo
|
post.fileInfo = img.parentNode.previousElementSibling
|
||||||
post.img = img
|
post.img = img
|
||||||
Main.prettify post.blockquote
|
Main.prettify post.blockquote
|
||||||
post
|
post
|
||||||
node: (nodes, notify) ->
|
node: (nodes, notify) ->
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user