More proofreading. Fixes, improvements.
This commit is contained in:
parent
00246611fa
commit
2541205e43
@ -1380,11 +1380,11 @@
|
|||||||
if (!qr.replies[qr.replies.length - 1].file) {
|
if (!qr.replies[qr.replies.length - 1].file) {
|
||||||
qr.replies[qr.replies.length - 1].setFile(file);
|
qr.replies[qr.replies.length - 1].setFile(file);
|
||||||
} else {
|
} else {
|
||||||
new qr.reply(file);
|
new qr.reply().setFile(file);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$.addClass(qr.el, 'dump');
|
$.addClass(qr.el, 'dump');
|
||||||
if (this.multiple) return qr.resetFileInput();
|
return qr.resetFileInput();
|
||||||
},
|
},
|
||||||
resetFileInput: function() {
|
resetFileInput: function() {
|
||||||
return $('[type=file]', qr.el).value = null;
|
return $('[type=file]', qr.el).value = null;
|
||||||
@ -1392,15 +1392,15 @@
|
|||||||
replies: [],
|
replies: [],
|
||||||
reply: (function() {
|
reply: (function() {
|
||||||
|
|
||||||
function _Class(file) {
|
function _Class() {
|
||||||
var persona, previous,
|
var persona, prev,
|
||||||
_this = this;
|
_this = this;
|
||||||
previous = qr.replies[qr.replies.length - 1];
|
prev = qr.replies[qr.replies.length - 1];
|
||||||
persona = $.get('qr.persona', {});
|
persona = $.get('qr.persona', {});
|
||||||
this.name = previous ? previous.name : persona.name || null;
|
this.name = prev ? prev.name : persona.name || null;
|
||||||
this.email = previous && !/^sage$/.test(previous.email) ? previous.email : persona.email || null;
|
this.email = prev && !/^sage$/.test(prev.email) ? prev.email : persona.email || null;
|
||||||
this.sub = previous && conf['Remember Subject'] ? previous.sub : conf['Remember Subject'] ? persona.sub : null;
|
this.sub = prev && conf['Remember Subject'] ? prev.sub : conf['Remember Subject'] ? persona.sub : null;
|
||||||
this.spoiler = previous && conf['Remember Spoiler'] ? previous.spoiler : false;
|
this.spoiler = prev && conf['Remember Spoiler'] ? prev.spoiler : false;
|
||||||
this.com = null;
|
this.com = null;
|
||||||
this.el = $.el('a', {
|
this.el = $.el('a', {
|
||||||
className: 'preview',
|
className: 'preview',
|
||||||
@ -1424,7 +1424,6 @@
|
|||||||
return $.id('spoiler').checked = _this.spoiler;
|
return $.id('spoiler').checked = _this.spoiler;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
if (file) this.setFile(file);
|
|
||||||
$.before($('#addReply', qr.el), this.el);
|
$.before($('#addReply', qr.el), this.el);
|
||||||
qr.replies.push(this);
|
qr.replies.push(this);
|
||||||
}
|
}
|
||||||
@ -1461,7 +1460,7 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
_Class.prototype.rm = function() {
|
_Class.prototype.rm = function() {
|
||||||
var index, url;
|
var index;
|
||||||
qr.resetFileInput();
|
qr.resetFileInput();
|
||||||
$.rm(this.el);
|
$.rm(this.el);
|
||||||
index = qr.replies.indexOf(this);
|
index = qr.replies.indexOf(this);
|
||||||
@ -1471,8 +1470,7 @@
|
|||||||
(qr.replies[index - 1] || qr.replies[index + 1]).select();
|
(qr.replies[index - 1] || qr.replies[index + 1]).select();
|
||||||
}
|
}
|
||||||
qr.replies.splice(index, 1);
|
qr.replies.splice(index, 1);
|
||||||
url = window.URL || window.webkitURL;
|
(window.URL || window.webkitURL).revokeObjectURL(this.url);
|
||||||
url.revokeObjectURL(this.url);
|
|
||||||
return delete this;
|
return delete this;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -1514,7 +1512,7 @@
|
|||||||
},
|
},
|
||||||
load: function() {
|
load: function() {
|
||||||
var challenge;
|
var challenge;
|
||||||
this.timeout = Date.now() + 25 * MINUTE;
|
this.timeout = Date.now() + 26 * MINUTE;
|
||||||
challenge = this.challenge.firstChild.value;
|
challenge = this.challenge.firstChild.value;
|
||||||
this.img.alt = challenge;
|
this.img.alt = challenge;
|
||||||
this.img.src = "http://www.google.com/recaptcha/api/image?c=" + challenge;
|
this.img.src = "http://www.google.com/recaptcha/api/image?c=" + challenge;
|
||||||
@ -1525,9 +1523,9 @@
|
|||||||
s = count === 1 ? '' : 's';
|
s = count === 1 ? '' : 's';
|
||||||
return this.input.placeholder = "Verification (" + count + " cached captcha" + s + ")";
|
return this.input.placeholder = "Verification (" + count + " cached captcha" + s + ")";
|
||||||
},
|
},
|
||||||
reload: function() {
|
reload: function(focus) {
|
||||||
window.location = 'javascript:Recaptcha.reload()';
|
window.location = 'javascript:Recaptcha.reload()';
|
||||||
return qr.captcha.input.focus();
|
if (focus) return qr.captcha.input.focus();
|
||||||
},
|
},
|
||||||
keydown: function(e) {
|
keydown: function(e) {
|
||||||
var c;
|
var c;
|
||||||
@ -3648,11 +3646,11 @@ textarea.field {\
|
|||||||
width: 100%;\
|
width: 100%;\
|
||||||
}\
|
}\
|
||||||
#qr [type=file] {\
|
#qr [type=file] {\
|
||||||
width: 75%;\
|
width: 70%;\
|
||||||
}\
|
}\
|
||||||
#qr [type=submit] {\
|
#qr [type=submit] {\
|
||||||
padding: 0 -moz-calc(1px); /* Gecko does not respect box-sizing: border-box */\
|
padding: 0 -moz-calc(1px); /* Gecko does not respect box-sizing: border-box */\
|
||||||
width: 25%;\
|
width: 30%;\
|
||||||
}\
|
}\
|
||||||
\
|
\
|
||||||
.new {\
|
.new {\
|
||||||
|
|||||||
@ -973,13 +973,13 @@ qr =
|
|||||||
|
|
||||||
ta = $ 'textarea', qr.el
|
ta = $ 'textarea', qr.el
|
||||||
caretPos = ta.selectionStart
|
caretPos = ta.selectionStart
|
||||||
#replace selection for text
|
# Replace selection for text.
|
||||||
ta.value = ta.value[0...caretPos] + text + ta.value[ta.selectionEnd...ta.value.length]
|
ta.value = ta.value[0...caretPos] + text + ta.value[ta.selectionEnd...ta.value.length]
|
||||||
ta.focus()
|
ta.focus()
|
||||||
#move the caret to the end of the new quote
|
# Move the caret to the end of the new quote.
|
||||||
ta.selectionEnd = ta.selectionStart = caretPos + text.length
|
ta.selectionEnd = ta.selectionStart = caretPos + text.length
|
||||||
|
|
||||||
# onchange event isn't triggered, save value
|
# onchange event isn't triggered, save value.
|
||||||
qr.selected.com = ta.value
|
qr.selected.com = ta.value
|
||||||
qr.selected.el.lastChild.textContent = ta.value
|
qr.selected.el.lastChild.textContent = ta.value
|
||||||
|
|
||||||
@ -995,6 +995,7 @@ qr =
|
|||||||
$.addClass qr.el, 'dump'
|
$.addClass qr.el, 'dump'
|
||||||
fileInput: ->
|
fileInput: ->
|
||||||
qr.cleanError()
|
qr.cleanError()
|
||||||
|
# Set or change current reply's file.
|
||||||
if @files.length is 1
|
if @files.length is 1
|
||||||
file = @files[0]
|
file = @files[0]
|
||||||
if file.size > @max
|
if file.size > @max
|
||||||
@ -1006,6 +1007,7 @@ qr =
|
|||||||
else
|
else
|
||||||
qr.selected.setFile file
|
qr.selected.setFile file
|
||||||
return
|
return
|
||||||
|
# Create new replies with these files.
|
||||||
for file in @files
|
for file in @files
|
||||||
if file.size > @max
|
if file.size > @max
|
||||||
qr.error "File #{file.name} is too large."
|
qr.error "File #{file.name} is too large."
|
||||||
@ -1017,22 +1019,22 @@ qr =
|
|||||||
# set last reply's file
|
# set last reply's file
|
||||||
qr.replies[qr.replies.length - 1].setFile file
|
qr.replies[qr.replies.length - 1].setFile file
|
||||||
else
|
else
|
||||||
new qr.reply file
|
new qr.reply().setFile file
|
||||||
$.addClass qr.el, 'dump'
|
$.addClass qr.el, 'dump'
|
||||||
qr.resetFileInput() if @multiple # reset input
|
qr.resetFileInput() # reset input
|
||||||
resetFileInput: ->
|
resetFileInput: ->
|
||||||
$('[type=file]', qr.el).value = null
|
$('[type=file]', qr.el).value = null
|
||||||
|
|
||||||
replies: []
|
replies: []
|
||||||
reply: class
|
reply: class
|
||||||
constructor: (file) ->
|
constructor: ->
|
||||||
# set values, or null, to avoid 'undefined' values in inputs
|
# set values, or null, to avoid 'undefined' values in inputs
|
||||||
previous = qr.replies[qr.replies.length-1]
|
prev = qr.replies[qr.replies.length-1]
|
||||||
persona = $.get 'qr.persona', {}
|
persona = $.get 'qr.persona', {}
|
||||||
@name = if previous then previous.name else persona.name or null
|
@name = if prev then prev.name else persona.name or null
|
||||||
@email = if previous and !/^sage$/.test previous.email then previous.email else persona.email or null
|
@email = if prev and !/^sage$/.test prev.email then prev.email else persona.email or null
|
||||||
@sub = if previous and conf['Remember Subject'] then previous.sub else if conf['Remember Subject'] then persona.sub else null
|
@sub = if prev and conf['Remember Subject'] then prev.sub else if conf['Remember Subject'] then persona.sub else null
|
||||||
@spoiler = if previous and conf['Remember Spoiler'] then previous.spoiler else false
|
@spoiler = if prev and conf['Remember Spoiler'] then prev.spoiler else false
|
||||||
@com = null
|
@com = null
|
||||||
|
|
||||||
@el = $.el 'a',
|
@el = $.el 'a',
|
||||||
@ -1048,7 +1050,6 @@ qr =
|
|||||||
$.on $('input', @el), 'change', (e) =>
|
$.on $('input', @el), 'change', (e) =>
|
||||||
@spoiler = e.target.checked
|
@spoiler = e.target.checked
|
||||||
$.id('spoiler').checked = @spoiler if @el.id is 'selected'
|
$.id('spoiler').checked = @spoiler if @el.id is 'selected'
|
||||||
@setFile file if file
|
|
||||||
$.before $('#addReply', qr.el), @el
|
$.before $('#addReply', qr.el), @el
|
||||||
|
|
||||||
qr.replies.push @
|
qr.replies.push @
|
||||||
@ -1070,6 +1071,7 @@ qr =
|
|||||||
rectEl = @el.getBoundingClientRect()
|
rectEl = @el.getBoundingClientRect()
|
||||||
rectList = @el.parentNode.getBoundingClientRect()
|
rectList = @el.parentNode.getBoundingClientRect()
|
||||||
@el.parentNode.scrollLeft += rectEl.left + rectEl.width/2 - rectList.left - rectList.width/2
|
@el.parentNode.scrollLeft += rectEl.left + rectEl.width/2 - rectList.left - rectList.width/2
|
||||||
|
# Load this reply's values.
|
||||||
for data in ['name', 'email', 'sub', 'com']
|
for data in ['name', 'email', 'sub', 'com']
|
||||||
$("[name=#{data}]", qr.el).value = @[data]
|
$("[name=#{data}]", qr.el).value = @[data]
|
||||||
$('#spoiler', qr.el).checked = @spoiler
|
$('#spoiler', qr.el).checked = @spoiler
|
||||||
@ -1082,8 +1084,7 @@ qr =
|
|||||||
else if @el.id is 'selected'
|
else if @el.id is 'selected'
|
||||||
(qr.replies[index-1] or qr.replies[index+1]).select()
|
(qr.replies[index-1] or qr.replies[index+1]).select()
|
||||||
qr.replies.splice index, 1
|
qr.replies.splice index, 1
|
||||||
url = window.URL or window.webkitURL
|
(window.URL or window.webkitURL).revokeObjectURL @url
|
||||||
url.revokeObjectURL @url
|
|
||||||
delete @
|
delete @
|
||||||
|
|
||||||
captcha:
|
captcha:
|
||||||
@ -1100,7 +1101,7 @@ qr =
|
|||||||
save: ->
|
save: ->
|
||||||
return unless response = @input.value
|
return unless response = @input.value
|
||||||
captchas = $.get 'captchas', []
|
captchas = $.get 'captchas', []
|
||||||
# remove old captchas
|
# Remove old captchas.
|
||||||
while (captcha = captchas[0]) and captcha.time < Date.now()
|
while (captcha = captchas[0]) and captcha.time < Date.now()
|
||||||
captchas.shift()
|
captchas.shift()
|
||||||
captchas.push
|
captchas.push
|
||||||
@ -1111,17 +1112,19 @@ qr =
|
|||||||
@count captchas.length
|
@count captchas.length
|
||||||
@reload()
|
@reload()
|
||||||
load: ->
|
load: ->
|
||||||
@timeout = Date.now() + 25*MINUTE
|
# Timeout is available at RecaptchaState.timeout in seconds.
|
||||||
|
@timeout = Date.now() + 26*MINUTE
|
||||||
challenge = @challenge.firstChild.value
|
challenge = @challenge.firstChild.value
|
||||||
@img.alt = challenge
|
@img.alt = challenge
|
||||||
@img.src = "http://www.google.com/recaptcha/api/image?c=#{challenge}"
|
@img.src = "http://www.google.com/recaptcha/api/image?c=#{challenge}"
|
||||||
@input.value = null
|
@input.value = null
|
||||||
count: (count) ->
|
count: (count) ->
|
||||||
s = if count is 1 then '' else 's'
|
s = if count is 1 then '' else 's'
|
||||||
@input.placeholder = "Verification (#{count} cached captcha#{s})"
|
@input.placeholder = "Verification (#{count} cached captcha#{s})"
|
||||||
reload: ->
|
reload: (focus) ->
|
||||||
window.location = 'javascript:Recaptcha.reload()'
|
window.location = 'javascript:Recaptcha.reload()'
|
||||||
qr.captcha.input.focus()
|
# Focus if we meant to.
|
||||||
|
qr.captcha.input.focus() if focus
|
||||||
keydown: (e) ->
|
keydown: (e) ->
|
||||||
c = qr.captcha
|
c = qr.captcha
|
||||||
if e.keyCode is 8 and not c.input.value
|
if e.keyCode is 8 and not c.input.value
|
||||||
@ -2897,11 +2900,11 @@ textarea.field {
|
|||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
#qr [type=file] {
|
#qr [type=file] {
|
||||||
width: 75%;
|
width: 70%;
|
||||||
}
|
}
|
||||||
#qr [type=submit] {
|
#qr [type=submit] {
|
||||||
padding: 0 -moz-calc(1px); /* Gecko does not respect box-sizing: border-box */
|
padding: 0 -moz-calc(1px); /* Gecko does not respect box-sizing: border-box */
|
||||||
width: 25%;
|
width: 30%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.new {
|
.new {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user