Merge pull request #353 from MayhemYDG/preloading
Save 4chan, do not preload images automatically
This commit is contained in:
commit
7df4f07a40
@ -2775,15 +2775,43 @@
|
|||||||
};
|
};
|
||||||
imgPreloading = {
|
imgPreloading = {
|
||||||
init: function() {
|
init: function() {
|
||||||
return g.callbacks.push(function(root) {
|
var controls, form, label;
|
||||||
var el, src, thumb;
|
if (!(controls = $.id('imgControls'))) {
|
||||||
if (!(thumb = $('img[md5]', root))) {
|
controls = $.el('div', {
|
||||||
return;
|
id: 'imgControls'
|
||||||
}
|
|
||||||
src = thumb.parentNode.href;
|
|
||||||
return el = $.el('img', {
|
|
||||||
src: src
|
|
||||||
});
|
});
|
||||||
|
form = $('body > form');
|
||||||
|
$.prepend(form, controls);
|
||||||
|
}
|
||||||
|
label = $.el('label', {
|
||||||
|
innerHTML: 'Preload Images<input type=checkbox id=imagePreload>'
|
||||||
|
});
|
||||||
|
$.bind($('input', label), 'click', imgPreloading.click);
|
||||||
|
$.add(controls, label);
|
||||||
|
return g.callbacks.push(imgPreloading.node);
|
||||||
|
},
|
||||||
|
click: function() {
|
||||||
|
var thumb, _i, _len, _ref, _results;
|
||||||
|
if (imgPreloading.on = this.checked) {
|
||||||
|
_ref = $$('img[md5]:last-child');
|
||||||
|
_results = [];
|
||||||
|
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
||||||
|
thumb = _ref[_i];
|
||||||
|
_results.push(imgPreloading.preload(thumb));
|
||||||
|
}
|
||||||
|
return _results;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
node: function(root) {
|
||||||
|
var thumb;
|
||||||
|
if (!(imgPreloading.on && (thumb = $('img[md5]:last-child', root)))) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
return imgPreloading.preload(thumb);
|
||||||
|
},
|
||||||
|
preload: function(thumb) {
|
||||||
|
return $.el('img', {
|
||||||
|
src: thumb.parentNode.href
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -2916,7 +2944,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
dialog: function() {
|
dialog: function() {
|
||||||
var controls, delform, imageType, option, select, _i, _len, _ref;
|
var controls, form, imageType, option, select, _i, _len, _ref;
|
||||||
controls = $.el('div', {
|
controls = $.el('div', {
|
||||||
id: 'imgControls',
|
id: 'imgControls',
|
||||||
innerHTML: "<select id=imageType name=imageType><option>full</option><option>fit width</option><option>fit height</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 height</option><option>fit screen</option></select> <label>Expand Images<input type=checkbox id=imageExpand></label>"
|
||||||
@ -2935,8 +2963,8 @@
|
|||||||
$.bind(select, 'change', $.cb.value);
|
$.bind(select, 'change', $.cb.value);
|
||||||
$.bind(select, 'change', imgExpand.cb.typeChange);
|
$.bind(select, 'change', imgExpand.cb.typeChange);
|
||||||
$.bind($('input', controls), 'click', imgExpand.cb.all);
|
$.bind($('input', controls), 'click', imgExpand.cb.all);
|
||||||
delform = $('form[name=delform]');
|
form = $('body > form');
|
||||||
return $.prepend(delform, controls);
|
return $.prepend(form, controls);
|
||||||
},
|
},
|
||||||
resize: function(e) {
|
resize: function(e) {
|
||||||
return imgExpand.style.innerHTML = ".fitheight img[md5] + img {max-height:" + d.body.clientHeight + "px;}";
|
return imgExpand.style.innerHTML = ".fitheight img[md5] + img {max-height:" + d.body.clientHeight + "px;}";
|
||||||
|
|||||||
@ -1,11 +1,12 @@
|
|||||||
master
|
master
|
||||||
- mayhem
|
- mayhem
|
||||||
initiate 4chan X earlier
|
initiate 4chan X earlier
|
||||||
|
performance improvements
|
||||||
|
regular expressions based filter
|
||||||
|
do not preload images automatically
|
||||||
automatically reload expanded pictures on error
|
automatically reload expanded pictures on error
|
||||||
update archives redirections for /diy/, /pol/ and /sci/
|
update archives redirections for /diy/, /pol/ and /sci/
|
||||||
regular expressions based filter
|
|
||||||
handle bans with the thread updater
|
handle bans with the thread updater
|
||||||
performance improvements
|
|
||||||
- aeosynth
|
- aeosynth
|
||||||
quick reply redesign
|
quick reply redesign
|
||||||
|
|
||||||
|
|||||||
@ -2044,10 +2044,28 @@ imgHover =
|
|||||||
|
|
||||||
imgPreloading =
|
imgPreloading =
|
||||||
init: ->
|
init: ->
|
||||||
g.callbacks.push (root) ->
|
unless controls = $.id 'imgControls'
|
||||||
return unless thumb = $ 'img[md5]', root
|
controls = $.el 'div',
|
||||||
src = thumb.parentNode.href
|
id: 'imgControls'
|
||||||
el = $.el 'img', { src }
|
form = $ 'body > form'
|
||||||
|
$.prepend form, controls
|
||||||
|
|
||||||
|
label = $.el 'label',
|
||||||
|
innerHTML: 'Preload Images<input type=checkbox id=imagePreload>'
|
||||||
|
$.bind $('input', label), 'click', imgPreloading.click
|
||||||
|
$.add controls, label
|
||||||
|
|
||||||
|
g.callbacks.push imgPreloading.node
|
||||||
|
|
||||||
|
click: ->
|
||||||
|
if imgPreloading.on = @checked
|
||||||
|
for thumb in $$ 'img[md5]:last-child'
|
||||||
|
imgPreloading.preload thumb
|
||||||
|
node: (root) ->
|
||||||
|
return unless imgPreloading.on and thumb = $ 'img[md5]:last-child', root
|
||||||
|
imgPreloading.preload thumb
|
||||||
|
preload: (thumb) ->
|
||||||
|
$.el 'img', src: thumb.parentNode.href
|
||||||
|
|
||||||
imgGif =
|
imgGif =
|
||||||
init: ->
|
init: ->
|
||||||
@ -2147,8 +2165,8 @@ imgExpand =
|
|||||||
$.bind select, 'change', imgExpand.cb.typeChange
|
$.bind select, 'change', imgExpand.cb.typeChange
|
||||||
$.bind $('input', controls), 'click', imgExpand.cb.all
|
$.bind $('input', controls), 'click', imgExpand.cb.all
|
||||||
|
|
||||||
delform = $ 'form[name=delform]'
|
form = $ 'body > form'
|
||||||
$.prepend delform, controls
|
$.prepend form, controls
|
||||||
|
|
||||||
resize: (e) ->
|
resize: (e) ->
|
||||||
imgExpand.style.innerHTML = ".fitheight img[md5] + img {max-height:#{d.body.clientHeight}px;}"
|
imgExpand.style.innerHTML = ".fitheight img[md5] + img {max-height:#{d.body.clientHeight}px;}"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user