n -> $.el + $.bind
This commit is contained in:
parent
7cd3075dfa
commit
68c2a38f3a
127
4chan_x.js
127
4chan_x.js
@ -56,7 +56,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
(function() {
|
(function() {
|
||||||
var $, $$, DAY, a, arr, as, autoWatch, callback, changeCheckbox, changeValue, clearHidden, closeQR, config, cooldown, cutoff, d, delform, down, editSauce, el, expand, expandComment, expandThread, g, getConfig, getThread, getTime, hide, hideReply, hideThread, href, html, i, id, imageClick, imageExpand, imageExpandClick, imageHover, imageResize, imageThumb, imageToggle, imageType, imageTypeChange, img, inAfter, inBefore, input, inputs, keyModeInsert, keyModeNormal, keydown, keypress, l1, lastChecked, log, m, mv, n, navbotr, navtopr, nodeInserted, now, omitted, onloadComment, onloadThread, option, options, parseResponse, pathname, qr, recaptcha, recaptchaListener, recaptchaReload, redirect, replace, replyNav, report, request, rm, scroll, scrollThread, show, showReply, showThread, slice, span, src, start, stopPropagation, temp, text, textContent, threadF, threads, tn, tzOffset, ui, up, updateAuto, updateCallback, updateFavicon, updateInterval, updateNow, updateTime, updateTitle, updateVerbose, updaterMake, watch, watchX, watcher, watcherUpdate, x, zeroPad, _i, _j, _k, _l, _len, _len2, _len3, _len4, _len5, _len6, _len7, _m, _n, _ref, _ref2, _ref3, _ref4;
|
var $, $$, DAY, a, arr, as, autoWatch, callback, changeCheckbox, changeValue, clearHidden, closeQR, config, cooldown, cutoff, d, delform, down, editSauce, el, expand, expandComment, expandThread, g, getConfig, getThread, getTime, hide, hideReply, hideThread, href, html, i, id, imageClick, imageExpand, imageExpandClick, imageHover, imageResize, imageThumb, imageToggle, imageType, imageTypeChange, img, inAfter, inBefore, input, inputs, keyModeInsert, keyModeNormal, keydown, keypress, l1, lastChecked, log, mv, navbotr, navtopr, nodeInserted, now, omitted, onloadComment, onloadThread, option, options, parseResponse, pathname, qr, recaptcha, recaptchaListener, recaptchaReload, redirect, replace, replyNav, report, request, rm, scroll, scrollThread, show, showReply, showThread, slice, span, src, start, stopPropagation, temp, text, textContent, threadF, threads, tn, tzOffset, ui, up, updateAuto, updateCallback, updateFavicon, updateInterval, updateNow, updateTime, updateTitle, updateVerbose, updaterMake, watch, watchX, watcher, watcherUpdate, x, zeroPad, _i, _j, _k, _l, _len, _len2, _len3, _len4, _len5, _len6, _len7, _m, _n, _ref, _ref2, _ref3, _ref4;
|
||||||
var __slice = Array.prototype.slice;
|
var __slice = Array.prototype.slice;
|
||||||
if (typeof console != "undefined" && console !== null) {
|
if (typeof console != "undefined" && console !== null) {
|
||||||
log = console.log;
|
log = console.log;
|
||||||
@ -351,27 +351,6 @@
|
|||||||
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 event, funk, key, l, val;
|
|
||||||
if (l = props.listener) {
|
|
||||||
delete props.listener;
|
|
||||||
event = l[0], funk = l[1];
|
|
||||||
el.addEventListener(event, funk, true);
|
|
||||||
}
|
|
||||||
for (key in props) {
|
|
||||||
val = props[key];
|
|
||||||
el[key] = val;
|
|
||||||
}
|
|
||||||
return el;
|
|
||||||
};
|
|
||||||
n = function(tag, props) {
|
|
||||||
var el;
|
|
||||||
el = d.createElement(tag);
|
|
||||||
if (props) {
|
|
||||||
m(el, props);
|
|
||||||
}
|
|
||||||
return el;
|
|
||||||
};
|
|
||||||
rm = function(el) {
|
rm = function(el) {
|
||||||
return el.parentNode.removeChild(el);
|
return el.parentNode.removeChild(el);
|
||||||
};
|
};
|
||||||
@ -528,12 +507,12 @@
|
|||||||
table = x('ancestor::table', reply);
|
table = x('ancestor::table', reply);
|
||||||
hide(table);
|
hide(table);
|
||||||
if (getConfig('Show Stubs')) {
|
if (getConfig('Show Stubs')) {
|
||||||
a = n('a', {
|
a = $.el('a', {
|
||||||
textContent: "[ + ] " + name + " " + trip,
|
textContent: "[ + ] " + name + " " + trip,
|
||||||
className: 'pointer',
|
className: 'pointer'
|
||||||
listener: ['click', showReply]
|
|
||||||
});
|
});
|
||||||
div = n('div');
|
$.bind(a, 'click', showReply);
|
||||||
|
div = $.el('div');
|
||||||
mv(a, div);
|
mv(a, div);
|
||||||
return inBefore(table, div);
|
return inBefore(table, div);
|
||||||
}
|
}
|
||||||
@ -559,18 +538,18 @@
|
|||||||
text = num === 1 ? "1 reply" : "" + num + " replies";
|
text = num === 1 ? "1 reply" : "" + num + " replies";
|
||||||
name = $('span.postername', div).textContent;
|
name = $('span.postername', div).textContent;
|
||||||
trip = ((_ref = $('span.postername + span.postertrip', div)) != null ? _ref.textContent : void 0) || '';
|
trip = ((_ref = $('span.postername + span.postertrip', div)) != null ? _ref.textContent : void 0) || '';
|
||||||
a = n('a', {
|
a = $.el('a', {
|
||||||
textContent: "[ + ] " + name + trip + " (" + text + ")",
|
textContent: "[ + ] " + name + trip + " (" + text + ")",
|
||||||
className: 'pointer',
|
className: 'pointer'
|
||||||
listener: ['click', showThread]
|
|
||||||
});
|
});
|
||||||
|
$.bind(a, 'click', showThread);
|
||||||
return inBefore(div, a);
|
return inBefore(div, a);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
imageHover = {
|
imageHover = {
|
||||||
init: function() {
|
init: function() {
|
||||||
var img;
|
var img;
|
||||||
img = n('img', {
|
img = $.el('img', {
|
||||||
id: 'iHover'
|
id: 'iHover'
|
||||||
});
|
});
|
||||||
hide(img);
|
hide(img);
|
||||||
@ -684,7 +663,7 @@
|
|||||||
var image, link;
|
var image, link;
|
||||||
thumb.className = 'hide';
|
thumb.className = 'hide';
|
||||||
link = thumb.parentNode;
|
link = thumb.parentNode;
|
||||||
image = n('img', {
|
image = $.el('img', {
|
||||||
src: link.href
|
src: link.href
|
||||||
});
|
});
|
||||||
link.appendChild(image);
|
link.appendChild(image);
|
||||||
@ -982,7 +961,7 @@
|
|||||||
};
|
};
|
||||||
parseResponse = function(responseText) {
|
parseResponse = function(responseText) {
|
||||||
var body, opbq, replies;
|
var body, opbq, replies;
|
||||||
body = n('body', {
|
body = $.el('body', {
|
||||||
innerHTML: responseText
|
innerHTML: responseText
|
||||||
});
|
});
|
||||||
replies = $$('td.reply', body);
|
replies = $$('td.reply', body);
|
||||||
@ -1299,14 +1278,14 @@
|
|||||||
};
|
};
|
||||||
threadF = function(current) {
|
threadF = function(current) {
|
||||||
var a, div, hidden, id, _i, _len, _ref;
|
var a, div, hidden, id, _i, _len, _ref;
|
||||||
div = n('div', {
|
div = $.el('div', {
|
||||||
className: 'thread'
|
className: 'thread'
|
||||||
});
|
});
|
||||||
a = n('a', {
|
a = $.el('a', {
|
||||||
textContent: '[ - ]',
|
textContent: '[ - ]',
|
||||||
className: 'pointer',
|
className: 'pointer'
|
||||||
listener: ['click', hideThread]
|
|
||||||
});
|
});
|
||||||
|
$.bind(a, 'click', hideThread);
|
||||||
mv(a, div);
|
mv(a, div);
|
||||||
inBefore(current, div);
|
inBefore(current, div);
|
||||||
while (!current.clear) {
|
while (!current.clear) {
|
||||||
@ -1362,7 +1341,7 @@
|
|||||||
updateFavicon();
|
updateFavicon();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
body = n('body', {
|
body = $.el('body', {
|
||||||
innerHTML: this.responseText
|
innerHTML: this.responseText
|
||||||
});
|
});
|
||||||
replies = $$('td.reply', body);
|
replies = $$('td.reply', body);
|
||||||
@ -1532,21 +1511,21 @@
|
|||||||
};
|
};
|
||||||
watcherUpdate = function() {
|
watcherUpdate = function() {
|
||||||
var a, board, div, link, old, thread, _i, _len, _ref;
|
var a, board, div, link, old, thread, _i, _len, _ref;
|
||||||
div = n('div');
|
div = $.el('div');
|
||||||
for (board in g.watched) {
|
for (board in g.watched) {
|
||||||
_ref = g.watched[board];
|
_ref = g.watched[board];
|
||||||
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
||||||
thread = _ref[_i];
|
thread = _ref[_i];
|
||||||
a = n('a', {
|
a = $.el('a', {
|
||||||
textContent: 'X',
|
textContent: 'X',
|
||||||
className: 'pointer',
|
className: 'pointer'
|
||||||
listener: ['click', watchX]
|
|
||||||
});
|
});
|
||||||
link = n('a', {
|
$.bind(a, 'click', watchX);
|
||||||
|
link = $.el('a', {
|
||||||
textContent: thread.text,
|
textContent: thread.text,
|
||||||
href: "/" + board + "/res/" + thread.id
|
href: "/" + board + "/res/" + thread.id
|
||||||
});
|
});
|
||||||
mv(a, tn(' '), link, n('br'), div);
|
mv(a, tn(' '), link, $.el('br'), div);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
old = $('#watcher div:last-child');
|
old = $('#watcher div:last-child');
|
||||||
@ -1697,18 +1676,18 @@
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (navtopr = $('#navtopr a')) {
|
if (navtopr = $('#navtopr a')) {
|
||||||
a = n('a', {
|
a = $.el('a', {
|
||||||
textContent: '4chan X',
|
textContent: '4chan X',
|
||||||
className: 'pointer',
|
className: 'pointer'
|
||||||
listener: ['click', options]
|
|
||||||
});
|
});
|
||||||
|
$.bind(a, 'click', options);
|
||||||
replace(navtopr, a);
|
replace(navtopr, a);
|
||||||
navbotr = $('#navbotr a');
|
navbotr = $('#navbotr a');
|
||||||
a = n('a', {
|
a = $.el('a', {
|
||||||
textContent: '4chan X',
|
textContent: '4chan X',
|
||||||
className: 'pointer',
|
className: 'pointer'
|
||||||
listener: ['click', options]
|
|
||||||
});
|
});
|
||||||
|
$.bind(a, 'click', options);
|
||||||
replace(navbotr, a);
|
replace(navbotr, a);
|
||||||
} else if (getConfig('404 Redirect') && d.title === '4chan - 404') {
|
} else if (getConfig('404 Redirect') && d.title === '4chan - 404') {
|
||||||
redirect();
|
redirect();
|
||||||
@ -1741,7 +1720,7 @@
|
|||||||
};
|
};
|
||||||
if (getConfig('Image Expansion')) {
|
if (getConfig('Image Expansion')) {
|
||||||
delform = $('form[name=delform]');
|
delform = $('form[name=delform]');
|
||||||
expand = n('div', {
|
expand = $.el('div', {
|
||||||
innerHTML: "<select id=imageType name=imageType><option>full</option><option>fit width</option><option>fit screen</option></select> <label>Expand Images<input type=checkbox id=imageExpand></label>"
|
innerHTML: "<select id=imageType name=imageType><option>full</option><option>fit width</option><option>fit screen</option></select> <label>Expand Images<input type=checkbox id=imageExpand></label>"
|
||||||
});
|
});
|
||||||
imageType = GM_getValue('imageType', 'full');
|
imageType = GM_getValue('imageType', 'full');
|
||||||
@ -1832,7 +1811,7 @@
|
|||||||
var _results;
|
var _results;
|
||||||
_results = [];
|
_results = [];
|
||||||
while (i < l) {
|
while (i < l) {
|
||||||
link = n('a', {
|
link = $.el('a', {
|
||||||
textContent: names[i],
|
textContent: names[i],
|
||||||
href: prefixes[i] + suffix
|
href: prefixes[i] + suffix
|
||||||
});
|
});
|
||||||
@ -1852,11 +1831,11 @@
|
|||||||
_results = [];
|
_results = [];
|
||||||
for (_i = 0, _len = tds.length; _i < _len; _i++) {
|
for (_i = 0, _len = tds.length; _i < _len; _i++) {
|
||||||
td = tds[_i];
|
td = tds[_i];
|
||||||
a = n('a', {
|
a = $.el('a', {
|
||||||
textContent: '[ - ]',
|
textContent: '[ - ]',
|
||||||
className: 'pointer',
|
className: 'pointer'
|
||||||
listener: ['click', hideReply]
|
|
||||||
});
|
});
|
||||||
|
$.bind(a, 'click', hideReply);
|
||||||
replace(td.firstChild, a);
|
replace(td.firstChild, a);
|
||||||
next = td.nextSibling;
|
next = td.nextSibling;
|
||||||
id = next.id;
|
id = next.id;
|
||||||
@ -1884,11 +1863,11 @@
|
|||||||
_results = [];
|
_results = [];
|
||||||
for (_i = 0, _len = arr.length; _i < _len; _i++) {
|
for (_i = 0, _len = arr.length; _i < _len; _i++) {
|
||||||
el = arr[_i];
|
el = arr[_i];
|
||||||
a = n('a', {
|
a = $.el('a', {
|
||||||
textContent: '[ ! ]',
|
textContent: '[ ! ]',
|
||||||
className: 'pointer',
|
className: 'pointer'
|
||||||
listener: ['click', report]
|
|
||||||
});
|
});
|
||||||
|
$.bind(a, 'click', report);
|
||||||
inAfter(el, a);
|
inAfter(el, a);
|
||||||
_results.push(inAfter(el, tn(' ')));
|
_results.push(inAfter(el, tn(' ')));
|
||||||
}
|
}
|
||||||
@ -1918,11 +1897,11 @@
|
|||||||
}
|
}
|
||||||
return g.favEmpty;
|
return g.favEmpty;
|
||||||
})();
|
})();
|
||||||
img = n('img', {
|
img = $.el('img', {
|
||||||
src: src,
|
src: src,
|
||||||
className: 'pointer',
|
className: 'pointer'
|
||||||
listener: ['click', watch]
|
|
||||||
});
|
});
|
||||||
|
$.bind(img, 'click', watch);
|
||||||
inBefore(input, img);
|
inBefore(input, img);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1950,17 +1929,17 @@
|
|||||||
_results = [];
|
_results = [];
|
||||||
for (_i = 0, _len = arr.length; _i < _len; _i++) {
|
for (_i = 0, _len = arr.length; _i < _len; _i++) {
|
||||||
el = arr[_i];
|
el = arr[_i];
|
||||||
span = n('span');
|
span = $.el('span');
|
||||||
up = n('a', {
|
up = $.el('a', {
|
||||||
textContent: '▲',
|
textContent: '▲',
|
||||||
className: 'pointer',
|
className: 'pointer'
|
||||||
listener: ['click', replyNav]
|
|
||||||
});
|
});
|
||||||
down = n('a', {
|
$.bind(up, 'click', replyNav);
|
||||||
|
down = $.el('a', {
|
||||||
textContent: '▼',
|
textContent: '▼',
|
||||||
className: 'pointer',
|
className: 'pointer'
|
||||||
listener: ['click', replyNav]
|
|
||||||
});
|
});
|
||||||
|
$.bind(down, 'click', replyNav);
|
||||||
mv(tn(' '), up, tn(' '), down, span);
|
mv(tn(' '), up, tn(' '), down, span);
|
||||||
_results.push(inAfter(el, span));
|
_results.push(inAfter(el, span));
|
||||||
}
|
}
|
||||||
@ -1980,7 +1959,7 @@
|
|||||||
for (_i = 0, _len = thumbs.length; _i < _len; _i++) {
|
for (_i = 0, _len = thumbs.length; _i < _len; _i++) {
|
||||||
thumb = thumbs[_i];
|
thumb = thumbs[_i];
|
||||||
parent = thumb.parentNode;
|
parent = thumb.parentNode;
|
||||||
_results.push(el = n('img', {
|
_results.push(el = $.el('img', {
|
||||||
src: parent.href
|
src: parent.href
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
@ -2029,7 +2008,7 @@
|
|||||||
l1 = arr.length - 1;
|
l1 = arr.length - 1;
|
||||||
for (i = 0, _len4 = arr.length; i < _len4; i++) {
|
for (i = 0, _len4 = arr.length; i < _len4; i++) {
|
||||||
el = arr[i];
|
el = arr[i];
|
||||||
span = n('span', {
|
span = $.el('span', {
|
||||||
className: 'navlinks',
|
className: 'navlinks',
|
||||||
id: 'p' + i
|
id: 'p' + i
|
||||||
});
|
});
|
||||||
@ -2043,7 +2022,7 @@
|
|||||||
textContent = '▲';
|
textContent = '▲';
|
||||||
href = "#navtop";
|
href = "#navtop";
|
||||||
}
|
}
|
||||||
up = n('a', {
|
up = $.el('a', {
|
||||||
className: 'pointer',
|
className: 'pointer',
|
||||||
textContent: textContent,
|
textContent: textContent,
|
||||||
href: href
|
href: href
|
||||||
@ -2055,7 +2034,7 @@
|
|||||||
textContent = '▶';
|
textContent = '▶';
|
||||||
href = "" + (g.PAGENUM + 1) + "#p0";
|
href = "" + (g.PAGENUM + 1) + "#p0";
|
||||||
}
|
}
|
||||||
down = n('a', {
|
down = $.el('a', {
|
||||||
className: 'pointer',
|
className: 'pointer',
|
||||||
textContent: textContent,
|
textContent: textContent,
|
||||||
href: href
|
href: href
|
||||||
@ -2071,11 +2050,11 @@
|
|||||||
omitted = $$('span.omittedposts');
|
omitted = $$('span.omittedposts');
|
||||||
for (_l = 0, _len5 = omitted.length; _l < _len5; _l++) {
|
for (_l = 0, _len5 = omitted.length; _l < _len5; _l++) {
|
||||||
span = omitted[_l];
|
span = omitted[_l];
|
||||||
a = n('a', {
|
a = $.el('a', {
|
||||||
className: 'pointer omittedposts',
|
className: 'pointer omittedposts',
|
||||||
textContent: "+ " + span.textContent,
|
textContent: "+ " + span.textContent
|
||||||
listener: ['click', expandThread]
|
|
||||||
});
|
});
|
||||||
|
$.bind(a, 'click', expandThread);
|
||||||
replace(span, a);
|
replace(span, a);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -228,17 +228,6 @@ 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
|
|
||||||
el = d.createElement tag
|
|
||||||
if props then m el, props
|
|
||||||
el
|
|
||||||
rm = (el) ->
|
rm = (el) ->
|
||||||
el.parentNode.removeChild el
|
el.parentNode.removeChild el
|
||||||
replace = (root, el) ->
|
replace = (root, el) ->
|
||||||
@ -365,11 +354,11 @@ hideReply = (reply) ->
|
|||||||
table = x 'ancestor::table', reply
|
table = x 'ancestor::table', reply
|
||||||
hide table
|
hide table
|
||||||
if getConfig 'Show Stubs'
|
if getConfig 'Show Stubs'
|
||||||
a = n 'a',
|
a = $.el 'a',
|
||||||
textContent: "[ + ] #{name} #{trip}"
|
textContent: "[ + ] #{name} #{trip}"
|
||||||
className: 'pointer'
|
className: 'pointer'
|
||||||
listener: ['click', showReply]
|
$.bind a, 'click', showReply
|
||||||
div = n 'div'
|
div = $.el 'div'
|
||||||
mv a, div
|
mv a, div
|
||||||
inBefore table, div
|
inBefore table, div
|
||||||
|
|
||||||
@ -391,15 +380,15 @@ hideThread = (div) ->
|
|||||||
text = if num is 1 then "1 reply" else "#{num} replies"
|
text = if num is 1 then "1 reply" else "#{num} replies"
|
||||||
name = $('span.postername', div).textContent
|
name = $('span.postername', div).textContent
|
||||||
trip = $('span.postername + span.postertrip', div)?.textContent || ''
|
trip = $('span.postername + span.postertrip', div)?.textContent || ''
|
||||||
a = n 'a',
|
a = $.el 'a',
|
||||||
textContent: "[ + ] #{name}#{trip} (#{text})"
|
textContent: "[ + ] #{name}#{trip} (#{text})"
|
||||||
className: 'pointer'
|
className: 'pointer'
|
||||||
listener: ['click', showThread]
|
$.bind a, 'click', showThread
|
||||||
inBefore div, a
|
inBefore div, a
|
||||||
|
|
||||||
imageHover =
|
imageHover =
|
||||||
init: ->
|
init: ->
|
||||||
img = n 'img', id: 'iHover'
|
img = $.el 'img', id: 'iHover'
|
||||||
hide img
|
hide img
|
||||||
d.body.appendChild img
|
d.body.appendChild img
|
||||||
g.callbacks.push imageHover.cb.node
|
g.callbacks.push imageHover.cb.node
|
||||||
@ -489,7 +478,7 @@ imageExpandClick = ->
|
|||||||
imageExpand = (thumb, cw, ch, imageType) ->
|
imageExpand = (thumb, cw, ch, imageType) ->
|
||||||
thumb.className = 'hide'
|
thumb.className = 'hide'
|
||||||
link = thumb.parentNode
|
link = thumb.parentNode
|
||||||
image = n 'img',
|
image = $.el 'img',
|
||||||
src: link.href
|
src: link.href
|
||||||
link.appendChild image
|
link.appendChild image
|
||||||
|
|
||||||
@ -721,7 +710,7 @@ options = ->
|
|||||||
mv div, d.body
|
mv div, d.body
|
||||||
|
|
||||||
parseResponse = (responseText) ->
|
parseResponse = (responseText) ->
|
||||||
body = n 'body',
|
body = $.el 'body',
|
||||||
innerHTML: responseText
|
innerHTML: responseText
|
||||||
replies = $$ 'td.reply', body
|
replies = $$ 'td.reply', body
|
||||||
opbq = $ 'blockquote', body
|
opbq = $ 'blockquote', body
|
||||||
@ -964,12 +953,12 @@ stopPropagation = (e) ->
|
|||||||
e.stopPropagation()
|
e.stopPropagation()
|
||||||
|
|
||||||
threadF = (current) ->
|
threadF = (current) ->
|
||||||
div = n 'div',
|
div = $.el 'div',
|
||||||
className: 'thread'
|
className: 'thread'
|
||||||
a = n 'a',
|
a = $.el 'a',
|
||||||
textContent: '[ - ]'
|
textContent: '[ - ]'
|
||||||
className: 'pointer'
|
className: 'pointer'
|
||||||
listener: ['click', hideThread]
|
$.bind a, 'click', hideThread
|
||||||
mv a, div
|
mv a, div
|
||||||
inBefore current, div
|
inBefore current, div
|
||||||
while (!current.clear)#<br clear>
|
while (!current.clear)#<br clear>
|
||||||
@ -1012,7 +1001,7 @@ updateCallback = ->
|
|||||||
g.dead = true
|
g.dead = true
|
||||||
updateFavicon()
|
updateFavicon()
|
||||||
return
|
return
|
||||||
body = n 'body', innerHTML: @responseText
|
body = $.el 'body', innerHTML: @responseText
|
||||||
replies = $$ 'td.reply', body
|
replies = $$ 'td.reply', body
|
||||||
|
|
||||||
root = $('br[clear]')
|
root = $('br[clear]')
|
||||||
@ -1161,17 +1150,17 @@ watch = ->
|
|||||||
watcherUpdate()
|
watcherUpdate()
|
||||||
|
|
||||||
watcherUpdate = ->
|
watcherUpdate = ->
|
||||||
div = n 'div'
|
div = $.el 'div'
|
||||||
for board of g.watched
|
for board of g.watched
|
||||||
for thread in g.watched[board]
|
for thread in g.watched[board]
|
||||||
a = n 'a',
|
a = $.el 'a',
|
||||||
textContent: 'X'
|
textContent: 'X'
|
||||||
className: 'pointer'
|
className: 'pointer'
|
||||||
listener: ['click', watchX]
|
$.bind a, 'click', watchX
|
||||||
link = n 'a',
|
link = $.el 'a',
|
||||||
textContent: thread.text
|
textContent: thread.text
|
||||||
href: "/#{board}/res/#{thread.id}"
|
href: "/#{board}/res/#{thread.id}"
|
||||||
mv a, tn(' '), link, n('br'), div
|
mv a, tn(' '), link, $.el('br'), div
|
||||||
old = $('#watcher div:last-child')
|
old = $('#watcher div:last-child')
|
||||||
replace(old, div)
|
replace(old, div)
|
||||||
|
|
||||||
@ -1322,16 +1311,16 @@ if location.hostname is 'sys.4chan.org'
|
|||||||
qr.sys()
|
qr.sys()
|
||||||
return
|
return
|
||||||
if navtopr = $ '#navtopr a'
|
if navtopr = $ '#navtopr a'
|
||||||
a = n 'a',
|
a = $.el 'a',
|
||||||
textContent: '4chan X'
|
textContent: '4chan X'
|
||||||
className: 'pointer'
|
className: 'pointer'
|
||||||
listener: ['click', options]
|
$.bind a, 'click', options
|
||||||
replace navtopr, a
|
replace navtopr, a
|
||||||
navbotr = $ '#navbotr a'
|
navbotr = $ '#navbotr a'
|
||||||
a = n 'a',
|
a = $.el 'a',
|
||||||
textContent: '4chan X'
|
textContent: '4chan X'
|
||||||
className: 'pointer'
|
className: 'pointer'
|
||||||
listener: ['click', options]
|
$.bind a, 'click', options
|
||||||
replace navbotr, a
|
replace navbotr, a
|
||||||
else if getConfig('404 Redirect') and d.title is '4chan - 404'
|
else if getConfig('404 Redirect') and d.title is '4chan - 404'
|
||||||
redirect()
|
redirect()
|
||||||
@ -1357,7 +1346,7 @@ scroll = ->
|
|||||||
#major features
|
#major features
|
||||||
if getConfig 'Image Expansion'
|
if getConfig 'Image Expansion'
|
||||||
delform = $ 'form[name=delform]'
|
delform = $ 'form[name=delform]'
|
||||||
expand = n 'div',
|
expand = $.el 'div',
|
||||||
innerHTML:
|
innerHTML:
|
||||||
"<select id=imageType name=imageType><option>full</option><option>fit width</option><option>fit screen</option></select>
|
"<select id=imageType name=imageType><option>full</option><option>fit width</option><option>fit screen</option></select>
|
||||||
<label>Expand Images<input type=checkbox id=imageExpand></label>"
|
<label>Expand Images<input type=checkbox id=imageExpand></label>"
|
||||||
@ -1423,7 +1412,7 @@ if getConfig 'Sauce'
|
|||||||
suffix = $('a', span).href
|
suffix = $('a', span).href
|
||||||
i = 0; l = names.length
|
i = 0; l = names.length
|
||||||
while i < l
|
while i < l
|
||||||
link = n 'a',
|
link = $.el 'a',
|
||||||
textContent: names[i]
|
textContent: names[i]
|
||||||
href: prefixes[i] + suffix
|
href: prefixes[i] + suffix
|
||||||
mv tn(' '), link, span
|
mv tn(' '), link, span
|
||||||
@ -1433,10 +1422,10 @@ if getConfig 'Reply Hiding'
|
|||||||
g.callbacks.push (root) ->
|
g.callbacks.push (root) ->
|
||||||
tds = $$('td.doubledash', root)
|
tds = $$('td.doubledash', root)
|
||||||
for td in tds
|
for td in tds
|
||||||
a = n 'a',
|
a = $.el 'a',
|
||||||
textContent: '[ - ]'
|
textContent: '[ - ]'
|
||||||
className: 'pointer'
|
className: 'pointer'
|
||||||
listener: ['click', hideReply]
|
$.bind a, 'click', hideReply
|
||||||
replace(td.firstChild, a)
|
replace(td.firstChild, a)
|
||||||
|
|
||||||
next = td.nextSibling
|
next = td.nextSibling
|
||||||
@ -1452,10 +1441,10 @@ if getConfig 'Quick Report'
|
|||||||
g.callbacks.push (root) ->
|
g.callbacks.push (root) ->
|
||||||
arr = $$('span[id^=no]', root)
|
arr = $$('span[id^=no]', root)
|
||||||
for el in arr
|
for el in arr
|
||||||
a = n 'a',
|
a = $.el 'a',
|
||||||
textContent: '[ ! ]'
|
textContent: '[ ! ]'
|
||||||
className: 'pointer'
|
className: 'pointer'
|
||||||
listener: ['click', report]
|
$.bind a, 'click', report
|
||||||
inAfter el, a
|
inAfter el, a
|
||||||
inAfter el, tn(' ')
|
inAfter el, tn(' ')
|
||||||
|
|
||||||
@ -1478,10 +1467,10 @@ if getConfig 'Thread Watcher'
|
|||||||
return g.favDefault
|
return g.favDefault
|
||||||
g.favEmpty
|
g.favEmpty
|
||||||
)()
|
)()
|
||||||
img = n 'img',
|
img = $.el 'img',
|
||||||
src: src
|
src: src
|
||||||
className: 'pointer'
|
className: 'pointer'
|
||||||
listener: ['click', watch]
|
$.bind img, 'click', watch
|
||||||
inBefore input, img
|
inBefore input, img
|
||||||
|
|
||||||
if getConfig 'Anonymize'
|
if getConfig 'Anonymize'
|
||||||
@ -1500,15 +1489,15 @@ if getConfig 'Reply Navigation'
|
|||||||
g.callbacks.push (root) ->
|
g.callbacks.push (root) ->
|
||||||
arr = $$('span[id^=norep]', root)
|
arr = $$('span[id^=norep]', root)
|
||||||
for el in arr
|
for el in arr
|
||||||
span = n 'span'
|
span = $.el 'span'
|
||||||
up = n 'a',
|
up = $.el 'a',
|
||||||
textContent: '▲'
|
textContent: '▲'
|
||||||
className: 'pointer'
|
className: 'pointer'
|
||||||
listener: ['click', replyNav]
|
$.bind up, 'click', replyNav
|
||||||
down = n 'a',
|
down = $.el 'a',
|
||||||
textContent: '▼'
|
textContent: '▼'
|
||||||
className: 'pointer'
|
className: 'pointer'
|
||||||
listener: ['click', replyNav]
|
$.bind down, 'click', replyNav
|
||||||
mv tn(' '), up, tn(' '), down, span
|
mv tn(' '), up, tn(' '), down, span
|
||||||
inAfter el, span
|
inAfter el, span
|
||||||
|
|
||||||
@ -1522,7 +1511,7 @@ if g.REPLY
|
|||||||
thumbs = $$ 'img[md5]', root
|
thumbs = $$ 'img[md5]', root
|
||||||
for thumb in thumbs
|
for thumb in thumbs
|
||||||
parent = thumb.parentNode
|
parent = thumb.parentNode
|
||||||
el = n 'img', src: parent.href
|
el = $.el 'img', src: parent.href
|
||||||
if getConfig 'Thread Updater'
|
if getConfig 'Thread Updater'
|
||||||
updaterMake()
|
updaterMake()
|
||||||
if getConfig('Quick Reply') and getConfig 'Persistent QR'
|
if getConfig('Quick Reply') and getConfig 'Persistent QR'
|
||||||
@ -1557,7 +1546,7 @@ else #not reply
|
|||||||
arr = $$ 'div > span.filesize, form > span.filesize'
|
arr = $$ 'div > span.filesize, form > span.filesize'
|
||||||
l1 = arr.length - 1
|
l1 = arr.length - 1
|
||||||
for el, i in arr
|
for el, i in arr
|
||||||
span = n 'span',
|
span = $.el 'span',
|
||||||
className: 'navlinks'
|
className: 'navlinks'
|
||||||
id: 'p' + i
|
id: 'p' + i
|
||||||
if i
|
if i
|
||||||
@ -1569,7 +1558,7 @@ else #not reply
|
|||||||
else
|
else
|
||||||
textContent = '▲'
|
textContent = '▲'
|
||||||
href = "#navtop"
|
href = "#navtop"
|
||||||
up = n 'a',
|
up = $.el 'a',
|
||||||
className: 'pointer'
|
className: 'pointer'
|
||||||
textContent: textContent
|
textContent: textContent
|
||||||
href: href
|
href: href
|
||||||
@ -1579,7 +1568,7 @@ else #not reply
|
|||||||
else
|
else
|
||||||
textContent = '▶'
|
textContent = '▶'
|
||||||
href = "#{g.PAGENUM + 1}#p0"
|
href = "#{g.PAGENUM + 1}#p0"
|
||||||
down = n 'a',
|
down = $.el 'a',
|
||||||
className: 'pointer'
|
className: 'pointer'
|
||||||
textContent: textContent
|
textContent: textContent
|
||||||
href: href
|
href: href
|
||||||
@ -1591,10 +1580,10 @@ else #not reply
|
|||||||
if getConfig 'Thread Expansion'
|
if getConfig 'Thread Expansion'
|
||||||
omitted = $$('span.omittedposts')
|
omitted = $$('span.omittedposts')
|
||||||
for span in omitted
|
for span in omitted
|
||||||
a = n 'a',
|
a = $.el 'a',
|
||||||
className: 'pointer omittedposts'
|
className: 'pointer omittedposts'
|
||||||
textContent: "+ #{span.textContent}"
|
textContent: "+ #{span.textContent}"
|
||||||
listener: ['click', expandThread]
|
$.bind a, 'click', expandThread
|
||||||
replace(span, a)
|
replace(span, a)
|
||||||
|
|
||||||
if getConfig 'Comment Expansion'
|
if getConfig 'Comment Expansion'
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user