refactor n into n + m
This commit is contained in:
parent
162988ace5
commit
975fb0ebff
@ -155,14 +155,16 @@ inAfter = (root, el) ->
|
|||||||
root.parentNode.insertBefore el, root.nextSibling
|
root.parentNode.insertBefore el, root.nextSibling
|
||||||
inBefore = (root, el) ->
|
inBefore = (root, el) ->
|
||||||
root.parentNode.insertBefore el, root
|
root.parentNode.insertBefore el, root
|
||||||
|
m = (el, props) -> #mod
|
||||||
|
if l = props.listener
|
||||||
|
delete props.listener
|
||||||
|
[event, funk] = l
|
||||||
|
el.addEventListener event, funk, true
|
||||||
|
(el[key] = val) for key, val of props
|
||||||
|
el
|
||||||
n = (tag, props) -> #new
|
n = (tag, props) -> #new
|
||||||
el = d.createElement tag
|
el = d.createElement tag
|
||||||
if props
|
if props then m el, props
|
||||||
if l = props.listener
|
|
||||||
delete props.listener
|
|
||||||
[event, funk] = l
|
|
||||||
el.addEventListener event, funk, true
|
|
||||||
(el[key] = val) for key, val of props
|
|
||||||
el
|
el
|
||||||
remove = (el) ->
|
remove = (el) ->
|
||||||
el.parentNode.removeChild(el)
|
el.parentNode.removeChild(el)
|
||||||
|
|||||||
35
4chan_x.js
35
4chan_x.js
@ -1,5 +1,5 @@
|
|||||||
(function() {
|
(function() {
|
||||||
var $, $$, AEOS, BOARD, DAY, PAGENUM, REPLY, THREAD_ID, _, _i, _len, _ref, a, addTo, arr, as, autoWatch, autohide, b, board, callback, callbacks, clearHidden, close, config, cooldown, cutoff, d, defaultSaucePrefix, delform, down, editSauce, el, expandComment, expandThread, favEmpty, favNormal, favicon, getConfig, getTime, head, hiddenReplies, hiddenThreads, hide, hideReply, hideThread, href, html, i, i1, id, iframe, iframeLoad, iframeLoop, inAfter, inBefore, inputs, l, l1, lastChecked, magic, n, navbotr, navtopr, nodeInserted, now, omitted, onloadComment, onloadThread, options, optionsClose, parseResponse, pathname, quickReply, r, recaptcha, recaptchaListener, recaptchaReload, redirect, remove, replace, replyNav, report, show, showReply, showThread, slice, span, stopPropagation, submit, text, textContent, thread, threadF, threads, tn, up, watch, watchX, watched, watcher, watcherUpdate, x, xhrs;
|
var $, $$, AEOS, BOARD, DAY, PAGENUM, REPLY, THREAD_ID, _, _i, _len, _ref, a, addTo, arr, as, autoWatch, autohide, b, board, callback, callbacks, clearHidden, close, config, cooldown, cutoff, d, defaultSaucePrefix, delform, down, editSauce, el, expandComment, expandThread, favEmpty, favNormal, favicon, getConfig, getTime, head, hiddenReplies, hiddenThreads, hide, hideReply, hideThread, href, html, i, i1, id, iframe, iframeLoad, iframeLoop, inAfter, inBefore, inputs, l, l1, lastChecked, m, magic, n, navbotr, navtopr, nodeInserted, now, omitted, onloadComment, onloadThread, options, optionsClose, parseResponse, pathname, quickReply, r, recaptcha, recaptchaListener, recaptchaReload, redirect, remove, replace, replyNav, report, show, showReply, showThread, slice, span, stopPropagation, submit, text, textContent, thread, threadF, threads, tn, up, watch, watchX, watched, watcher, watcherUpdate, x, xhrs;
|
||||||
var __slice = Array.prototype.slice, __hasProp = Object.prototype.hasOwnProperty;
|
var __slice = Array.prototype.slice, __hasProp = Object.prototype.hasOwnProperty;
|
||||||
config = {
|
config = {
|
||||||
'Thread Hiding': [true, 'Hide entire threads'],
|
'Thread Hiding': [true, 'Hide entire threads'],
|
||||||
@ -185,23 +185,28 @@
|
|||||||
inBefore = function(root, el) {
|
inBefore = function(root, el) {
|
||||||
return root.parentNode.insertBefore(el, root);
|
return root.parentNode.insertBefore(el, root);
|
||||||
};
|
};
|
||||||
|
m = function(el, props) {
|
||||||
|
var _ref, event, funk, key, l, val;
|
||||||
|
if (l = props.listener) {
|
||||||
|
delete props.listener;
|
||||||
|
_ref = l;
|
||||||
|
event = _ref[0];
|
||||||
|
funk = _ref[1];
|
||||||
|
el.addEventListener(event, funk, true);
|
||||||
|
}
|
||||||
|
_ref = props;
|
||||||
|
for (key in _ref) {
|
||||||
|
if (!__hasProp.call(_ref, key)) continue;
|
||||||
|
val = _ref[key];
|
||||||
|
(el[key] = val);
|
||||||
|
}
|
||||||
|
return el;
|
||||||
|
};
|
||||||
n = function(tag, props) {
|
n = function(tag, props) {
|
||||||
var _ref, el, event, funk, key, l, val;
|
var el;
|
||||||
el = d.createElement(tag);
|
el = d.createElement(tag);
|
||||||
if (props) {
|
if (props) {
|
||||||
if (l = props.listener) {
|
m(el, props);
|
||||||
delete props.listener;
|
|
||||||
_ref = l;
|
|
||||||
event = _ref[0];
|
|
||||||
funk = _ref[1];
|
|
||||||
el.addEventListener(event, funk, true);
|
|
||||||
}
|
|
||||||
_ref = props;
|
|
||||||
for (key in _ref) {
|
|
||||||
if (!__hasProp.call(_ref, key)) continue;
|
|
||||||
val = _ref[key];
|
|
||||||
(el[key] = val);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return el;
|
return el;
|
||||||
};
|
};
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user