e.target -> this
This commit is contained in:
parent
80d6821dcd
commit
f25c5815b9
53
4chan_x.js
53
4chan_x.js
@ -182,7 +182,7 @@
|
|||||||
dragstart: function(e) {
|
dragstart: function(e) {
|
||||||
var d, el, rect;
|
var d, el, rect;
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
ui.el = el = e.target.parentNode;
|
ui.el = el = this.parentNode;
|
||||||
d = document;
|
d = document;
|
||||||
d.addEventListener('mousemove', ui.drag, true);
|
d.addEventListener('mousemove', ui.drag, true);
|
||||||
d.addEventListener('mouseup', ui.dragend, true);
|
d.addEventListener('mouseup', ui.dragend, true);
|
||||||
@ -464,7 +464,7 @@
|
|||||||
expand: function(e) {
|
expand: function(e) {
|
||||||
var a, href, replyID, threadID, _, _ref;
|
var a, href, replyID, threadID, _, _ref;
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
a = e.target;
|
a = this;
|
||||||
a.textContent = 'Loading...';
|
a.textContent = 'Loading...';
|
||||||
href = a.getAttribute('href');
|
href = a.getAttribute('href');
|
||||||
_ref = href.match(/(\d+)#(\d+)/), _ = _ref[0], threadID = _ref[1], replyID = _ref[2];
|
_ref = href.match(/(\d+)#(\d+)/), _ = _ref[0], threadID = _ref[1], replyID = _ref[2];
|
||||||
@ -512,7 +512,7 @@
|
|||||||
cb: {
|
cb: {
|
||||||
toggle: function(e) {
|
toggle: function(e) {
|
||||||
var thread;
|
var thread;
|
||||||
thread = e.target.parentNode;
|
thread = this.parentNode;
|
||||||
return expandThread.toggle(thread);
|
return expandThread.toggle(thread);
|
||||||
},
|
},
|
||||||
load: function(xhr, thread, a) {
|
load: function(xhr, thread, a) {
|
||||||
@ -584,7 +584,7 @@
|
|||||||
cb: {
|
cb: {
|
||||||
hide: function(e) {
|
hide: function(e) {
|
||||||
var reply;
|
var reply;
|
||||||
reply = e.target.parentNode.nextSibling;
|
reply = this.parentNode.nextSibling;
|
||||||
return replyHiding.hide(reply);
|
return replyHiding.hide(reply);
|
||||||
},
|
},
|
||||||
node: function(root) {
|
node: function(root) {
|
||||||
@ -606,7 +606,7 @@
|
|||||||
},
|
},
|
||||||
show: function(e) {
|
show: function(e) {
|
||||||
var div, table;
|
var div, table;
|
||||||
div = e.target.parentNode;
|
div = this.parentNode;
|
||||||
table = div.nextSibling;
|
table = div.nextSibling;
|
||||||
replyHiding.show(table);
|
replyHiding.show(table);
|
||||||
return $.remove(div);
|
return $.remove(div);
|
||||||
@ -1024,7 +1024,7 @@
|
|||||||
},
|
},
|
||||||
submit: function(e) {
|
submit: function(e) {
|
||||||
var form, id, isQR, op;
|
var form, id, isQR, op;
|
||||||
form = e.target;
|
form = this;
|
||||||
isQR = form.parentNode.id === 'qr';
|
isQR = form.parentNode.id === 'qr';
|
||||||
if ($.config('Auto Watch Reply') && $.config('Thread Watcher')) {
|
if ($.config('Auto Watch Reply') && $.config('Thread Watcher')) {
|
||||||
if (g.REPLY && $('img.favicon').src === Favicon.empty) {
|
if (g.REPLY && $('img.favicon').src === Favicon.empty) {
|
||||||
@ -1057,7 +1057,7 @@
|
|||||||
},
|
},
|
||||||
quote: function(e) {
|
quote: function(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
return qr.quote(e.target);
|
return qr.quote(this);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
quote: function(link) {
|
quote: function(link) {
|
||||||
@ -1258,12 +1258,12 @@
|
|||||||
cb: {
|
cb: {
|
||||||
hide: function(e) {
|
hide: function(e) {
|
||||||
var thread;
|
var thread;
|
||||||
thread = e.target.parentNode.parentNode;
|
thread = this.parentNode.parentNode;
|
||||||
return threadHiding.hide(thread);
|
return threadHiding.hide(thread);
|
||||||
},
|
},
|
||||||
show: function(e) {
|
show: function(e) {
|
||||||
var thread;
|
var thread;
|
||||||
thread = e.target.parentNode.parentNode;
|
thread = this.parentNode.parentNode;
|
||||||
return threadHiding.show(thread);
|
return threadHiding.show(thread);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -1520,11 +1520,11 @@
|
|||||||
},
|
},
|
||||||
cb: {
|
cb: {
|
||||||
toggle: function(e) {
|
toggle: function(e) {
|
||||||
return watcher.toggle(e.target.parentNode);
|
return watcher.toggle(this.parentNode);
|
||||||
},
|
},
|
||||||
x: function(e) {
|
x: function(e) {
|
||||||
var board, id, _, _ref;
|
var board, id, _, _ref;
|
||||||
_ref = e.target.nextElementSibling.getAttribute('href').substring(1).split('/'), board = _ref[0], _ = _ref[1], id = _ref[2];
|
_ref = this.nextElementSibling.getAttribute('href').substring(1).split('/'), board = _ref[0], _ = _ref[1], id = _ref[2];
|
||||||
return watcher.unwatch(board, id);
|
return watcher.unwatch(board, id);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -1689,9 +1689,8 @@
|
|||||||
return _results;
|
return _results;
|
||||||
},
|
},
|
||||||
mouseover: function(e) {
|
mouseover: function(e) {
|
||||||
var el, id, target;
|
var el, id;
|
||||||
target = e.target;
|
id = this.textContent.replace(">>", '');
|
||||||
id = target.textContent.replace(">>", '');
|
|
||||||
el = $('#qp');
|
el = $('#qp');
|
||||||
el.innerHTML = d.getElementById(id).innerHTML;
|
el.innerHTML = d.getElementById(id).innerHTML;
|
||||||
$.show(el);
|
$.show(el);
|
||||||
@ -1722,9 +1721,7 @@
|
|||||||
return _results;
|
return _results;
|
||||||
},
|
},
|
||||||
report: function(e) {
|
report: function(e) {
|
||||||
var target;
|
return quickReport.report(this);
|
||||||
target = e.target;
|
|
||||||
return quickReport.report(target);
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
report: function(target) {
|
report: function(target) {
|
||||||
@ -1867,19 +1864,18 @@
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
nodeInserted = function(e) {
|
nodeInserted = function(e) {
|
||||||
var callback, dialog, target, _i, _len, _ref2, _results;
|
var callback, dialog, _i, _len, _ref2, _results;
|
||||||
target = e.target;
|
if (this.nodeName === 'TABLE') {
|
||||||
if (target.nodeName === 'TABLE') {
|
|
||||||
_ref2 = g.callbacks;
|
_ref2 = g.callbacks;
|
||||||
_results = [];
|
_results = [];
|
||||||
for (_i = 0, _len = _ref2.length; _i < _len; _i++) {
|
for (_i = 0, _len = _ref2.length; _i < _len; _i++) {
|
||||||
callback = _ref2[_i];
|
callback = _ref2[_i];
|
||||||
_results.push(callback(target));
|
_results.push(callback(this));
|
||||||
}
|
}
|
||||||
return _results;
|
return _results;
|
||||||
} else if (target.id === 'recaptcha_challenge_field' && (dialog = $('#qr'))) {
|
} else if (this.id === 'recaptcha_challenge_field' && (dialog = $('#qr'))) {
|
||||||
$('#recaptcha_image img', dialog).src = "http://www.google.com/recaptcha/api/image?c=" + target.value;
|
$('#recaptcha_image img', dialog).src = "http://www.google.com/recaptcha/api/image?c=" + this.value;
|
||||||
return $('#recaptcha_challenge_field', dialog).value = target.value;
|
return $('#recaptcha_challenge_field', dialog).value = this.value;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
imageHover = {
|
imageHover = {
|
||||||
@ -1906,10 +1902,9 @@
|
|||||||
return _results;
|
return _results;
|
||||||
},
|
},
|
||||||
mouseover: function(e) {
|
mouseover: function(e) {
|
||||||
var el, target;
|
var el;
|
||||||
target = e.target;
|
|
||||||
el = $('#iHover');
|
el = $('#iHover');
|
||||||
el.src = target.parentNode.href;
|
el.src = this.parentNode.href;
|
||||||
$.show(el);
|
$.show(el);
|
||||||
ui.el = el;
|
ui.el = el;
|
||||||
ui.winHeight = d.body.clientHeight;
|
ui.winHeight = d.body.clientHeight;
|
||||||
@ -1977,12 +1972,12 @@
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
return imgExpand.toggle(e.target);
|
return imgExpand.toggle(this);
|
||||||
},
|
},
|
||||||
all: function(e) {
|
all: function(e) {
|
||||||
var thumb, thumbs, _i, _j, _len, _len2, _results, _results2;
|
var thumb, thumbs, _i, _j, _len, _len2, _results, _results2;
|
||||||
thumbs = $$('img[md5]');
|
thumbs = $$('img[md5]');
|
||||||
imgExpand.on = e.target.checked;
|
imgExpand.on = this.checked;
|
||||||
imgExpand.foo();
|
imgExpand.foo();
|
||||||
if (imgExpand.on) {
|
if (imgExpand.on) {
|
||||||
_results = [];
|
_results = [];
|
||||||
|
|||||||
@ -103,7 +103,7 @@ ui =
|
|||||||
dragstart: (e) ->
|
dragstart: (e) ->
|
||||||
#prevent text selection
|
#prevent text selection
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
ui.el = el = e.target.parentNode
|
ui.el = el = @parentNode
|
||||||
d = document
|
d = document
|
||||||
d.addEventListener 'mousemove', ui.drag, true
|
d.addEventListener 'mousemove', ui.drag, true
|
||||||
d.addEventListener 'mouseup', ui.dragend, true
|
d.addEventListener 'mouseup', ui.dragend, true
|
||||||
@ -325,7 +325,7 @@ expandComment =
|
|||||||
cb:
|
cb:
|
||||||
expand: (e) ->
|
expand: (e) ->
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
a = e.target
|
a = this
|
||||||
a.textContent = 'Loading...'
|
a.textContent = 'Loading...'
|
||||||
href = a.getAttribute 'href'
|
href = a.getAttribute 'href'
|
||||||
[_, threadID, replyID] = href.match /(\d+)#(\d+)/
|
[_, threadID, replyID] = href.match /(\d+)#(\d+)/
|
||||||
@ -357,7 +357,7 @@ expandThread =
|
|||||||
|
|
||||||
cb:
|
cb:
|
||||||
toggle: (e) ->
|
toggle: (e) ->
|
||||||
thread = e.target.parentNode
|
thread = @parentNode
|
||||||
expandThread.toggle thread
|
expandThread.toggle thread
|
||||||
|
|
||||||
load: (xhr, thread, a) ->
|
load: (xhr, thread, a) ->
|
||||||
@ -417,7 +417,7 @@ replyHiding =
|
|||||||
|
|
||||||
cb:
|
cb:
|
||||||
hide: (e) ->
|
hide: (e) ->
|
||||||
reply = e.target.parentNode.nextSibling
|
reply = @parentNode.nextSibling
|
||||||
replyHiding.hide reply
|
replyHiding.hide reply
|
||||||
|
|
||||||
node: (root) ->
|
node: (root) ->
|
||||||
@ -434,7 +434,7 @@ replyHiding =
|
|||||||
replyHiding.hide reply
|
replyHiding.hide reply
|
||||||
|
|
||||||
show: (e) ->
|
show: (e) ->
|
||||||
div = e.target.parentNode
|
div = @parentNode
|
||||||
table = div.nextSibling
|
table = div.nextSibling
|
||||||
replyHiding.show table
|
replyHiding.show table
|
||||||
|
|
||||||
@ -785,7 +785,7 @@ qr =
|
|||||||
$.bind quote, 'click', qr.cb.quote
|
$.bind quote, 'click', qr.cb.quote
|
||||||
|
|
||||||
submit: (e) ->
|
submit: (e) ->
|
||||||
form = e.target
|
form = this
|
||||||
isQR = form.parentNode.id == 'qr'
|
isQR = form.parentNode.id == 'qr'
|
||||||
|
|
||||||
if $.config('Auto Watch Reply') and $.config('Thread Watcher')
|
if $.config('Auto Watch Reply') and $.config('Thread Watcher')
|
||||||
@ -817,7 +817,7 @@ qr =
|
|||||||
|
|
||||||
quote: (e) ->
|
quote: (e) ->
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
qr.quote e.target
|
qr.quote this
|
||||||
|
|
||||||
quote: (link) ->
|
quote: (link) ->
|
||||||
if dialog = $ '#qr'
|
if dialog = $ '#qr'
|
||||||
@ -1014,10 +1014,10 @@ threadHiding =
|
|||||||
|
|
||||||
cb:
|
cb:
|
||||||
hide: (e) ->
|
hide: (e) ->
|
||||||
thread = e.target.parentNode.parentNode
|
thread = @parentNode.parentNode
|
||||||
threadHiding.hide thread
|
threadHiding.hide thread
|
||||||
show: (e) ->
|
show: (e) ->
|
||||||
thread = e.target.parentNode.parentNode
|
thread = @parentNode.parentNode
|
||||||
threadHiding.show thread
|
threadHiding.show thread
|
||||||
|
|
||||||
toggle: (thread) ->
|
toggle: (thread) ->
|
||||||
@ -1239,9 +1239,9 @@ watcher =
|
|||||||
|
|
||||||
cb:
|
cb:
|
||||||
toggle: (e) ->
|
toggle: (e) ->
|
||||||
watcher.toggle e.target.parentNode
|
watcher.toggle @parentNode
|
||||||
x: (e) ->
|
x: (e) ->
|
||||||
[board, _, id] = e.target.nextElementSibling
|
[board, _, id] = @nextElementSibling
|
||||||
.getAttribute('href').substring(1).split('/')
|
.getAttribute('href').substring(1).split('/')
|
||||||
watcher.unwatch board, id
|
watcher.unwatch board, id
|
||||||
|
|
||||||
@ -1347,8 +1347,7 @@ quotePreview =
|
|||||||
$.bind quote, 'mousemove', ui.hover
|
$.bind quote, 'mousemove', ui.hover
|
||||||
$.bind quote, 'mouseout', quotePreview.mouseout
|
$.bind quote, 'mouseout', quotePreview.mouseout
|
||||||
mouseover: (e) ->
|
mouseover: (e) ->
|
||||||
{target} = e
|
id = @textContent.replace ">>", ''
|
||||||
id = target.textContent.replace ">>", ''
|
|
||||||
el = $ '#qp'
|
el = $ '#qp'
|
||||||
el.innerHTML = d.getElementById(id).innerHTML
|
el.innerHTML = d.getElementById(id).innerHTML
|
||||||
$.show el
|
$.show el
|
||||||
@ -1369,8 +1368,7 @@ quickReport =
|
|||||||
$.after el, a
|
$.after el, a
|
||||||
$.after el, $.tn(' ')
|
$.after el, $.tn(' ')
|
||||||
report: (e) ->
|
report: (e) ->
|
||||||
{target} = e
|
quickReport.report this
|
||||||
quickReport.report target
|
|
||||||
report: (target) ->
|
report: (target) ->
|
||||||
input = $.x('preceding-sibling::input[1]', target)
|
input = $.x('preceding-sibling::input[1]', target)
|
||||||
input.click()
|
input.click()
|
||||||
@ -1461,13 +1459,12 @@ Recaptcha =
|
|||||||
window.location = 'javascript:Recaptcha.reload()'
|
window.location = 'javascript:Recaptcha.reload()'
|
||||||
|
|
||||||
nodeInserted = (e) ->
|
nodeInserted = (e) ->
|
||||||
{target} = e
|
if @nodeName is 'TABLE'
|
||||||
if target.nodeName is 'TABLE'
|
|
||||||
for callback in g.callbacks
|
for callback in g.callbacks
|
||||||
callback target
|
callback this
|
||||||
else if target.id is 'recaptcha_challenge_field' and dialog = $ '#qr'
|
else if @id is 'recaptcha_challenge_field' and dialog = $ '#qr'
|
||||||
$('#recaptcha_image img', dialog).src = "http://www.google.com/recaptcha/api/image?c=" + target.value
|
$('#recaptcha_image img', dialog).src = "http://www.google.com/recaptcha/api/image?c=" + @value
|
||||||
$('#recaptcha_challenge_field', dialog).value = target.value
|
$('#recaptcha_challenge_field', dialog).value = @value
|
||||||
|
|
||||||
imageHover =
|
imageHover =
|
||||||
init: ->
|
init: ->
|
||||||
@ -1482,9 +1479,8 @@ imageHover =
|
|||||||
$.bind thumb, 'mousemove', ui.hover
|
$.bind thumb, 'mousemove', ui.hover
|
||||||
$.bind thumb, 'mouseout', imageHover.cb.mouseout
|
$.bind thumb, 'mouseout', imageHover.cb.mouseout
|
||||||
mouseover: (e) ->
|
mouseover: (e) ->
|
||||||
{target} = e
|
|
||||||
el = $ '#iHover'
|
el = $ '#iHover'
|
||||||
el.src = target.parentNode.href
|
el.src = @parentNode.href
|
||||||
$.show el
|
$.show el
|
||||||
ui.el = el
|
ui.el = el
|
||||||
ui.winHeight = d.body.clientHeight
|
ui.winHeight = d.body.clientHeight
|
||||||
@ -1524,10 +1520,10 @@ imgExpand =
|
|||||||
toggle: (e) ->
|
toggle: (e) ->
|
||||||
return if e.shiftKey or e.altKey or e.ctrlKey or e.button isnt 0
|
return if e.shiftKey or e.altKey or e.ctrlKey or e.button isnt 0
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
imgExpand.toggle e.target
|
imgExpand.toggle this
|
||||||
all: (e) ->
|
all: (e) ->
|
||||||
thumbs = $$ 'img[md5]'
|
thumbs = $$ 'img[md5]'
|
||||||
imgExpand.on = e.target.checked
|
imgExpand.on = @checked
|
||||||
imgExpand.foo()
|
imgExpand.foo()
|
||||||
if imgExpand.on #expand
|
if imgExpand.on #expand
|
||||||
for thumb in thumbs
|
for thumb in thumbs
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user