mirror of
https://github.com/vichan-devel/vichan.git
synced 2025-02-16 11:02:40 +01:00
multi-line quotes & init no longer uses jQuery
This commit is contained in:
parent
5acdf16f5e
commit
a8312b5196
@ -333,21 +333,23 @@ function citeReply(id, with_link) {
|
||||
// ???
|
||||
textarea.value += '>>' + id + '\n';
|
||||
}
|
||||
if (typeof $ != 'undefined') {
|
||||
// multiline quotes
|
||||
var select = sessionStorage.quoteClipboard;
|
||||
if (select) {
|
||||
select = select.split('\n');
|
||||
$(select).each(function () {
|
||||
if (this !== '')
|
||||
var str = '>'+ this +'\n';
|
||||
else
|
||||
var str = '\n';
|
||||
textarea.value += str;
|
||||
});
|
||||
delete sessionStorage.quoteClipboard;
|
||||
}
|
||||
|
||||
// multiline quotes
|
||||
var select = sessionStorage.quoteClipboard;
|
||||
if (select) {
|
||||
select = select.split('\n');
|
||||
select.forEach(function (str) {
|
||||
if (str !== '') {
|
||||
str = '>' + str + '\n';
|
||||
} else {
|
||||
str = '\n';
|
||||
}
|
||||
textarea.value += str;
|
||||
});
|
||||
delete sessionStorage.quoteClipboard;
|
||||
}
|
||||
|
||||
if (typeof $ != 'undefined') {
|
||||
$(window).trigger('cite', [id, with_link]);
|
||||
$(textarea).change();
|
||||
}
|
||||
@ -408,12 +410,10 @@ var script_settings = function(script_name) {
|
||||
function init() {
|
||||
init_stylechooser();
|
||||
|
||||
if (typeof $ != 'undefined') {
|
||||
// store highlighted text for citeReply()
|
||||
$('form[name="postcontrols"]').on('mouseup', function (e) {
|
||||
sessionStorage.quoteClipboard = window.getSelection().toString();
|
||||
});
|
||||
}
|
||||
// store highlighted text for citeReply()
|
||||
document.querySelector('form[name="postcontrols"]').addEventListener('mouseup', function (e) {
|
||||
sessionStorage.quoteClipboard = window.getSelection().toString();
|
||||
});
|
||||
|
||||
{% endraw %}
|
||||
{% if config.allow_delete %}
|
||||
|
Loading…
x
Reference in New Issue
Block a user