imgPreloading
This commit is contained in:
parent
2985529016
commit
38b71787af
33
4chan_x.js
33
4chan_x.js
@ -59,7 +59,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
(function() {
|
(function() {
|
||||||
var $, $$, NAMESPACE, anonymize, autoWatch, callback, config, d, delform, el, expand, expandComment, expandThread, g, imageClick, imageExpand, imageExpandClick, imageHover, imageResize, imageThumb, imageToggle, imageType, imageTypeChange, keybinds, localize, log, nav, navtopr, nodeInserted, option, options, pathname, qr, quickReport, recaptcha, recaptchaListener, recaptchaReload, redirect, replyHiding, sauce, scroll, temp, threadHiding, titlePost, tzOffset, ui, updateFavicon, updateTitle, updater, watcher, _config, _i, _j, _k, _len, _len2, _len3, _ref, _ref2, _ref3, _ref4;
|
var $, $$, NAMESPACE, anonymize, autoWatch, callback, config, d, delform, el, expand, expandComment, expandThread, g, imageClick, imageExpand, imageExpandClick, imageHover, imageResize, imageThumb, imageToggle, imageType, imageTypeChange, imgPreloading, keybinds, localize, log, nav, navtopr, nodeInserted, option, options, pathname, qr, quickReport, recaptcha, recaptchaListener, recaptchaReload, redirect, replyHiding, sauce, scroll, temp, threadHiding, titlePost, tzOffset, ui, updateFavicon, updateTitle, updater, watcher, _config, _i, _j, _k, _len, _len2, _len3, _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;
|
||||||
@ -1654,6 +1654,23 @@
|
|||||||
return d.title = "/" + g.BOARD + "/ - " + el.textContent;
|
return d.title = "/" + g.BOARD + "/ - " + el.textContent;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
imgPreloading = {
|
||||||
|
init: function() {
|
||||||
|
return g.callbacks.push(function(root) {
|
||||||
|
var el, parent, thumb, thumbs, _i, _len, _results;
|
||||||
|
thumbs = $$('img[md5]', root);
|
||||||
|
_results = [];
|
||||||
|
for (_i = 0, _len = thumbs.length; _i < _len; _i++) {
|
||||||
|
thumb = thumbs[_i];
|
||||||
|
parent = thumb.parentNode;
|
||||||
|
_results.push(el = $.el('img', {
|
||||||
|
src: parent.href
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
return _results;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
imageClick = function(e) {
|
imageClick = function(e) {
|
||||||
if (e.shiftKey || e.altKey || e.ctrlKey) {
|
if (e.shiftKey || e.altKey || e.ctrlKey) {
|
||||||
return;
|
return;
|
||||||
@ -2137,19 +2154,7 @@
|
|||||||
updater.init();
|
updater.init();
|
||||||
}
|
}
|
||||||
if ($.config('Image Preloading')) {
|
if ($.config('Image Preloading')) {
|
||||||
g.callbacks.push(function(root) {
|
imgPreloading.init();
|
||||||
var parent, thumb, thumbs, _i, _len, _results;
|
|
||||||
thumbs = $$('img[md5]', root);
|
|
||||||
_results = [];
|
|
||||||
for (_i = 0, _len = thumbs.length; _i < _len; _i++) {
|
|
||||||
thumb = thumbs[_i];
|
|
||||||
parent = thumb.parentNode;
|
|
||||||
_results.push(el = $.el('img', {
|
|
||||||
src: parent.href
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
return _results;
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
if ($.config('Quick Reply') && $.config('Persistent QR')) {
|
if ($.config('Quick Reply') && $.config('Persistent QR')) {
|
||||||
qr.persist();
|
qr.persist();
|
||||||
|
|||||||
@ -1295,6 +1295,14 @@ titlePost =
|
|||||||
el = $('span.filetitle') or $('blockquote')
|
el = $('span.filetitle') or $('blockquote')
|
||||||
d.title = "/#{g.BOARD}/ - #{el.textContent}"
|
d.title = "/#{g.BOARD}/ - #{el.textContent}"
|
||||||
|
|
||||||
|
imgPreloading =
|
||||||
|
init: ->
|
||||||
|
g.callbacks.push (root) ->
|
||||||
|
thumbs = $$ 'img[md5]', root
|
||||||
|
for thumb in thumbs
|
||||||
|
parent = thumb.parentNode
|
||||||
|
el = $.el 'img', src: parent.href
|
||||||
|
|
||||||
# TODO rewrite these **************************************************************************
|
# TODO rewrite these **************************************************************************
|
||||||
|
|
||||||
imageClick = (e) ->
|
imageClick = (e) ->
|
||||||
@ -1690,11 +1698,7 @@ if g.REPLY
|
|||||||
updater.init()
|
updater.init()
|
||||||
|
|
||||||
if $.config 'Image Preloading'
|
if $.config 'Image Preloading'
|
||||||
g.callbacks.push (root) ->
|
imgPreloading.init()
|
||||||
thumbs = $$ 'img[md5]', root
|
|
||||||
for thumb in thumbs
|
|
||||||
parent = thumb.parentNode
|
|
||||||
el = $.el 'img', src: parent.href
|
|
||||||
if $.config('Quick Reply') and $.config 'Persistent QR'
|
if $.config('Quick Reply') and $.config 'Persistent QR'
|
||||||
qr.persist()
|
qr.persist()
|
||||||
if $.config 'Post in Title'
|
if $.config 'Post in Title'
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user