Release 4chan X v1.11.0.0.

This commit is contained in:
ccd0 2015-06-14 01:24:04 -07:00
parent 81712c5cd9
commit 5f8267748d
13 changed files with 186 additions and 210 deletions

View File

@ -2,6 +2,15 @@ Sometimes the changelog has notes (not comprehensive) acknowledging people's wor
The links to individual versions below are to copies of the script with the update URL removed. If you want automatic updates, install the script from the links on the [main page](https://github.com/ccd0/4chan-x). The links to individual versions below are to copies of the script with the update URL removed. If you want automatic updates, install the script from the links on the [main page](https://github.com/ccd0/4chan-x).
## v1.11.0
**v1.11.0.0** *(2015-06-14)* - [[Firefox](https://raw.githubusercontent.com/ccd0/4chan-x/1.11.0.0/builds/4chan-X-noupdate.user.js "Firefox version")] [[Chromium](https://raw.githubusercontent.com/ccd0/4chan-x/1.11.0.0/builds/4chan-X-noupdate.crx "Chromium version")]
- Based on v1.10.14.2.
- Gallery now preloads the next image in sequence.
- `Stretch to Fit` option added to gallery.
- Various bug fixes.
- Drop workarounds for old versions of Chromium (< v34).
### v1.10.14 ### v1.10.14
**v1.10.14.2** *(2015-06-11)* - [[Firefox](https://raw.githubusercontent.com/ccd0/4chan-x/1.10.14.2/builds/4chan-X-noupdate.user.js "Firefox version")] [[Chromium](https://raw.githubusercontent.com/ccd0/4chan-x/1.10.14.2/builds/4chan-X-noupdate.crx "Chromium version")] **v1.10.14.2** *(2015-06-11)* - [[Firefox](https://raw.githubusercontent.com/ccd0/4chan-x/1.10.14.2/builds/4chan-X-noupdate.user.js "Firefox version")] [[Chromium](https://raw.githubusercontent.com/ccd0/4chan-x/1.10.14.2/builds/4chan-X-noupdate.crx "Chromium version")]

Binary file not shown.

View File

@ -1,6 +1,6 @@
// ==UserScript== // ==UserScript==
// @name 4chan X beta // @name 4chan X beta
// @version 1.10.14.2 // @version 1.11.0.0
// @minGMVer 1.14 // @minGMVer 1.14
// @minFFVer 26 // @minFFVer 26
// @namespace 4chan-X // @namespace 4chan-X

View File

@ -1,7 +1,7 @@
// Generated by CoffeeScript // Generated by CoffeeScript
// ==UserScript== // ==UserScript==
// @name 4chan X beta // @name 4chan X beta
// @version 1.10.14.2 // @version 1.11.0.0
// @minGMVer 1.14 // @minGMVer 1.14
// @minFFVer 26 // @minFFVer 26
// @namespace 4chan-X // @namespace 4chan-X
@ -267,6 +267,7 @@
'Hide Thumbnails': [false], 'Hide Thumbnails': [false],
'Fit Width': [true], 'Fit Width': [true],
'Fit Height': [true], 'Fit Height': [true],
'Stretch to Fit': [false],
'Scroll to Post': [true], 'Scroll to Post': [true],
'Slide Delay': [6.0] 'Slide Delay': [6.0]
}, },
@ -396,7 +397,7 @@
doc = d.documentElement; doc = d.documentElement;
g = { g = {
VERSION: '1.10.14.2', VERSION: '1.11.0.0',
NAMESPACE: '4chan X.', NAMESPACE: '4chan X.',
boards: {} boards: {}
}; };
@ -2365,26 +2366,7 @@
Polyfill = { Polyfill = {
init: function() { init: function() {
this.notificationPermission(); return this.toBlob();
this.toBlob();
return this.visibility();
},
notificationPermission: function() {
if (!window.Notification || 'permission' in Notification || !window.webkitNotifications) {
return;
}
return Object.defineProperty(Notification, 'permission', {
get: function() {
switch (webkitNotifications.checkPermission()) {
case 0:
return 'granted';
case 1:
return 'default';
case 2:
return 'denied';
}
}
});
}, },
toBlob: function() { toBlob: function() {
var base1; var base1;
@ -2400,26 +2382,6 @@
type: 'image/png' type: 'image/png'
})); }));
}); });
},
visibility: function() {
if ('visibilityState' in d) {
return;
}
Object.defineProperties(HTMLDocument.prototype, {
visibilityState: {
get: function() {
return this.webkitVisibilityState;
}
},
hidden: {
get: function() {
return this.webkitHidden;
}
}
});
return $.on(d, 'webkitvisibilitychange', function() {
return $.event('visibilitychange');
});
} }
}; };
@ -7369,7 +7331,7 @@
event = node.nodeName === 'SELECT' ? 'change' : 'input'; event = node.nodeName === 'SELECT' ? 'change' : 'input';
$.on(nodes[name], event, save); $.on(nodes[name], event, save);
} }
if (Conf['Remember QR Size']) { if ((typeof chrome === "undefined" || chrome === null) && Conf['Remember QR Size']) {
$.get('QR Size', '', function(item) { $.get('QR Size', '', function(item) {
return nodes.com.style.cssText = item['QR Size']; return nodes.com.style.cssText = item['QR Size'];
}); });
@ -9359,29 +9321,43 @@
Gallery.images.push(thumb); Gallery.images.push(thumb);
return $.add(Gallery.nodes.thumbs, thumb); return $.add(Gallery.nodes.thumbs, thumb);
}, },
load: function(thumb, errorCB) {
var elType, ext, file;
ext = thumb.href.match(/\w*$/);
elType = {
'webm': 'video',
'pdf': 'iframe'
}[ext] || 'img';
file = $.el(elType, {
title: thumb.title
});
$.extend(file.dataset, thumb.dataset);
$.on(file, 'error', errorCB);
file.src = thumb.href;
return file;
},
open: function(thumb) { open: function(thumb) {
var el, elType, file, name, newID, nodes, oldID, post, slideshow; var el, file, newID, nodes, oldID, post, ref;
nodes = Gallery.nodes; nodes = Gallery.nodes;
name = nodes.name;
oldID = +nodes.current.dataset.id; oldID = +nodes.current.dataset.id;
newID = +thumb.dataset.id; newID = +thumb.dataset.id;
slideshow = Gallery.slideshow && (newID > oldID || (oldID === Gallery.images.length - 1 && newID === 0)); if (el = Gallery.images[oldID]) {
if (el = $('.gal-highlight', nodes.thumbs)) {
$.rmClass(el, 'gal-highlight'); $.rmClass(el, 'gal-highlight');
} }
$.addClass(thumb, 'gal-highlight'); $.addClass(thumb, 'gal-highlight');
elType = /\.webm$/.test(thumb.href) ? 'video' : /\.pdf$/.test(thumb.href) ? 'iframe' : 'img'; nodes.thumbs.scrollTop = thumb.offsetTop + thumb.offsetHeight / 2 - nodes.thumbs.clientHeight / 2;
$[elType === 'iframe' ? 'addClass' : 'rmClass'](doc, 'gal-pdf'); if (((ref = Gallery.cache) != null ? ref.dataset.id : void 0) === '' + newID) {
file = $.el(elType, { file = Gallery.cache;
title: name.download = name.textContent = thumb.title $.off(file, 'error', Gallery.cacheError);
}); $.on(file, 'error', Gallery.error);
$.extend(file.dataset, thumb.dataset); } else {
$.on(file, 'error', Gallery.error); file = Gallery.load(thumb, Gallery.error);
file.src = name.href = thumb.href; }
$.off(nodes.current, 'error', Gallery.error); $.off(nodes.current, 'error', Gallery.error);
ImageCommon.pause(nodes.current); ImageCommon.pause(nodes.current);
$.replace(nodes.current, file); $.replace(nodes.current, file);
if (elType === 'video') { nodes.current = file;
if (file.nodeName === 'VIDEO') {
file.loop = true; file.loop = true;
Volume.setup(file); Volume.setup(file);
if (Conf['Autoplay']) { if (Conf['Autoplay']) {
@ -9391,11 +9367,14 @@
ImageCommon.addControls(file); ImageCommon.addControls(file);
} }
} }
doc.classList.toggle('gal-pdf', file.nodeName === 'IFRAME');
Gallery.cb.setHeight();
nodes.count.textContent = +thumb.dataset.id + 1; nodes.count.textContent = +thumb.dataset.id + 1;
nodes.current = file; nodes.name.download = nodes.name.textContent = thumb.title;
nodes.name.href = thumb.href;
nodes.frame.scrollTop = 0; nodes.frame.scrollTop = 0;
nodes.next.focus(); nodes.next.focus();
if (slideshow) { if (Gallery.slideshow && (newID > oldID || (oldID === Gallery.images.length - 1 && newID === 0))) {
Gallery.setupTimer(); Gallery.setupTimer();
} else { } else {
Gallery.cb.stop(); Gallery.cb.stop();
@ -9403,7 +9382,7 @@
if (Conf['Scroll to Post'] && (post = g.posts[file.dataset.post])) { if (Conf['Scroll to Post'] && (post = g.posts[file.dataset.post])) {
Header.scrollTo(post.nodes.root); Header.scrollTo(post.nodes.root);
} }
return nodes.thumbs.scrollTop = thumb.offsetTop + thumb.offsetHeight / 2 - nodes.thumbs.clientHeight / 2; return Gallery.cache = Gallery.load(Gallery.images[(newID + 1) % Gallery.images.length], Gallery.cacheError);
}, },
error: function() { error: function() {
var ref; var ref;
@ -9425,6 +9404,9 @@
}; };
})(this)); })(this));
}, },
cacheError: function() {
return delete Gallery.cache;
},
cleanupTimer: function() { cleanupTimer: function() {
var current; var current;
clearTimeout(Gallery.timeoutID); clearTimeout(Gallery.timeoutID);
@ -9586,6 +9568,11 @@
setFitness: function() { setFitness: function() {
return (this.checked ? $.addClass : $.rmClass)(doc, "gal-" + (this.name.toLowerCase().replace(/\s+/g, '-'))); return (this.checked ? $.addClass : $.rmClass)(doc, "gal-" + (this.name.toLowerCase().replace(/\s+/g, '-')));
}, },
setHeight: function() {
var current, dim, frame, height, ref, ref1, ref2, width;
ref = Gallery.nodes, current = ref.current, frame = ref.frame;
return current.style.minHeight = Conf['Stretch to Fit'] && (dim = (ref1 = g.posts[current.dataset.post]) != null ? ref1.file.dimensions : void 0) ? ((ref2 = dim.split('x'), width = ref2[0], height = ref2[1], ref2), Math.min(doc.clientHeight - 25, height / width * frame.clientWidth) + 'px') : null;
},
setDelay: function() { setDelay: function() {
return Gallery.delay = +this.value; return Gallery.delay = +this.value;
} }
@ -9610,11 +9597,14 @@
var input, label; var input, label;
label = UI.checkbox(name, name); label = UI.checkbox(name, name);
input = label.firstElementChild; input = label.firstElementChild;
if (name === 'Fit Width' || name === 'Fit Height' || name === 'Hide Thumbnails') { if (name === 'Hide Thumbnails' || name === 'Fit Width' || name === 'Fit Height') {
$.on(input, 'change', Gallery.cb.setFitness); $.on(input, 'change', Gallery.cb.setFitness);
} }
$.event('change', null, input); $.event('change', null, input);
$.on(input, 'change', $.cb.checked); $.on(input, 'change', $.cb.checked);
if (name === 'Hide Thumbnails' || name === 'Fit Width' || name === 'Fit Height' || name === 'Stretch to Fit') {
$.on(input, 'change', Gallery.cb.setHeight);
}
return { return {
el: label el: label
}; };
@ -9623,7 +9613,7 @@
var delayInput, delayLabel, item, subEntries; var delayInput, delayLabel, item, subEntries;
subEntries = (function() { subEntries = (function() {
var k, len1, ref, results; var k, len1, ref, results;
ref = ['Hide Thumbnails', 'Fit Width', 'Fit Height', 'Scroll to Post']; ref = ['Hide Thumbnails', 'Fit Width', 'Fit Height', 'Stretch to Fit', 'Scroll to Post'];
results = []; results = [];
for (k = 0, len1 = ref.length; k < len1; k++) { for (k = 0, len1 = ref.length; k < len1; k++) {
item = ref[k]; item = ref[k];
@ -10798,6 +10788,9 @@
}, },
wheel: function(e) { wheel: function(e) {
var el, volume; var el, volume;
if (e.shiftKey || e.altKey || e.ctrlKey || e.metaKey) {
return;
}
if (!(el = $('video:not([data-md5])', this))) { if (!(el = $('video:not([data-md5])', this))) {
return; return;
} }
@ -15769,6 +15762,9 @@
div = $.el('div', { div = $.el('div', {
innerHTML: "<label><input type=\"checkbox\" name=\"" + E(key) + "\">" + E(key) + "</label><span class=\"description\">: " + E(description) + "</span>" innerHTML: "<label><input type=\"checkbox\" name=\"" + E(key) + "\">" + E(key) + "</label><span class=\"description\">: " + E(description) + "</span>"
}); });
if ((typeof chrome !== "undefined" && chrome !== null) && key === 'Remember QR Size') {
div.hidden = true;
}
input = $('input', div); input = $('input', div);
$.on(input, 'change', function() { $.on(input, 'change', function() {
this.parentNode.parentNode.dataset.checked = this.checked; this.parentNode.parentNode.dataset.checked = this.checked;
@ -19074,13 +19070,6 @@
"}\n" + "}\n" +
".gal-fit-height .gal-image img,\n" + ".gal-fit-height .gal-image img,\n" +
".gal-fit-height .gal-image video {\n" + ".gal-fit-height .gal-image video {\n" +
" /*\n" +
" Chrome doesn't support viewpoint units in calc()\n" +
" http://bugs.chromium.org/168840\n" +
" \"It looks like the original author of viewport units in WebKit is not coming back to fix this stuff.\"\n" +
" Well, fuck.\n" +
" */\n" +
" max-height: 95vh;\n" +
" max-height: calc(100vh - 25px);\n" + " max-height: calc(100vh - 25px);\n" +
"}\n" + "}\n" +
".gal-image iframe {\n" + ".gal-image iframe {\n" +

Binary file not shown.

View File

@ -1,7 +1,7 @@
// Generated by CoffeeScript // Generated by CoffeeScript
// ==UserScript== // ==UserScript==
// @name 4chan X // @name 4chan X
// @version 1.10.14.2 // @version 1.11.0.0
// @minGMVer 1.14 // @minGMVer 1.14
// @minFFVer 26 // @minFFVer 26
// @namespace 4chan-X // @namespace 4chan-X
@ -266,6 +266,7 @@
'Hide Thumbnails': [false], 'Hide Thumbnails': [false],
'Fit Width': [true], 'Fit Width': [true],
'Fit Height': [true], 'Fit Height': [true],
'Stretch to Fit': [false],
'Scroll to Post': [true], 'Scroll to Post': [true],
'Slide Delay': [6.0] 'Slide Delay': [6.0]
}, },
@ -395,7 +396,7 @@
doc = d.documentElement; doc = d.documentElement;
g = { g = {
VERSION: '1.10.14.2', VERSION: '1.11.0.0',
NAMESPACE: '4chan X.', NAMESPACE: '4chan X.',
boards: {} boards: {}
}; };
@ -2364,26 +2365,7 @@
Polyfill = { Polyfill = {
init: function() { init: function() {
this.notificationPermission(); return this.toBlob();
this.toBlob();
return this.visibility();
},
notificationPermission: function() {
if (!window.Notification || 'permission' in Notification || !window.webkitNotifications) {
return;
}
return Object.defineProperty(Notification, 'permission', {
get: function() {
switch (webkitNotifications.checkPermission()) {
case 0:
return 'granted';
case 1:
return 'default';
case 2:
return 'denied';
}
}
});
}, },
toBlob: function() { toBlob: function() {
var base1; var base1;
@ -2399,26 +2381,6 @@
type: 'image/png' type: 'image/png'
})); }));
}); });
},
visibility: function() {
if ('visibilityState' in d) {
return;
}
Object.defineProperties(HTMLDocument.prototype, {
visibilityState: {
get: function() {
return this.webkitVisibilityState;
}
},
hidden: {
get: function() {
return this.webkitHidden;
}
}
});
return $.on(d, 'webkitvisibilitychange', function() {
return $.event('visibilitychange');
});
} }
}; };
@ -7368,7 +7330,7 @@
event = node.nodeName === 'SELECT' ? 'change' : 'input'; event = node.nodeName === 'SELECT' ? 'change' : 'input';
$.on(nodes[name], event, save); $.on(nodes[name], event, save);
} }
if (Conf['Remember QR Size']) { if ((typeof chrome === "undefined" || chrome === null) && Conf['Remember QR Size']) {
$.get('QR Size', '', function(item) { $.get('QR Size', '', function(item) {
return nodes.com.style.cssText = item['QR Size']; return nodes.com.style.cssText = item['QR Size'];
}); });
@ -9358,29 +9320,43 @@
Gallery.images.push(thumb); Gallery.images.push(thumb);
return $.add(Gallery.nodes.thumbs, thumb); return $.add(Gallery.nodes.thumbs, thumb);
}, },
load: function(thumb, errorCB) {
var elType, ext, file;
ext = thumb.href.match(/\w*$/);
elType = {
'webm': 'video',
'pdf': 'iframe'
}[ext] || 'img';
file = $.el(elType, {
title: thumb.title
});
$.extend(file.dataset, thumb.dataset);
$.on(file, 'error', errorCB);
file.src = thumb.href;
return file;
},
open: function(thumb) { open: function(thumb) {
var el, elType, file, name, newID, nodes, oldID, post, slideshow; var el, file, newID, nodes, oldID, post, ref;
nodes = Gallery.nodes; nodes = Gallery.nodes;
name = nodes.name;
oldID = +nodes.current.dataset.id; oldID = +nodes.current.dataset.id;
newID = +thumb.dataset.id; newID = +thumb.dataset.id;
slideshow = Gallery.slideshow && (newID > oldID || (oldID === Gallery.images.length - 1 && newID === 0)); if (el = Gallery.images[oldID]) {
if (el = $('.gal-highlight', nodes.thumbs)) {
$.rmClass(el, 'gal-highlight'); $.rmClass(el, 'gal-highlight');
} }
$.addClass(thumb, 'gal-highlight'); $.addClass(thumb, 'gal-highlight');
elType = /\.webm$/.test(thumb.href) ? 'video' : /\.pdf$/.test(thumb.href) ? 'iframe' : 'img'; nodes.thumbs.scrollTop = thumb.offsetTop + thumb.offsetHeight / 2 - nodes.thumbs.clientHeight / 2;
$[elType === 'iframe' ? 'addClass' : 'rmClass'](doc, 'gal-pdf'); if (((ref = Gallery.cache) != null ? ref.dataset.id : void 0) === '' + newID) {
file = $.el(elType, { file = Gallery.cache;
title: name.download = name.textContent = thumb.title $.off(file, 'error', Gallery.cacheError);
}); $.on(file, 'error', Gallery.error);
$.extend(file.dataset, thumb.dataset); } else {
$.on(file, 'error', Gallery.error); file = Gallery.load(thumb, Gallery.error);
file.src = name.href = thumb.href; }
$.off(nodes.current, 'error', Gallery.error); $.off(nodes.current, 'error', Gallery.error);
ImageCommon.pause(nodes.current); ImageCommon.pause(nodes.current);
$.replace(nodes.current, file); $.replace(nodes.current, file);
if (elType === 'video') { nodes.current = file;
if (file.nodeName === 'VIDEO') {
file.loop = true; file.loop = true;
Volume.setup(file); Volume.setup(file);
if (Conf['Autoplay']) { if (Conf['Autoplay']) {
@ -9390,11 +9366,14 @@
ImageCommon.addControls(file); ImageCommon.addControls(file);
} }
} }
doc.classList.toggle('gal-pdf', file.nodeName === 'IFRAME');
Gallery.cb.setHeight();
nodes.count.textContent = +thumb.dataset.id + 1; nodes.count.textContent = +thumb.dataset.id + 1;
nodes.current = file; nodes.name.download = nodes.name.textContent = thumb.title;
nodes.name.href = thumb.href;
nodes.frame.scrollTop = 0; nodes.frame.scrollTop = 0;
nodes.next.focus(); nodes.next.focus();
if (slideshow) { if (Gallery.slideshow && (newID > oldID || (oldID === Gallery.images.length - 1 && newID === 0))) {
Gallery.setupTimer(); Gallery.setupTimer();
} else { } else {
Gallery.cb.stop(); Gallery.cb.stop();
@ -9402,7 +9381,7 @@
if (Conf['Scroll to Post'] && (post = g.posts[file.dataset.post])) { if (Conf['Scroll to Post'] && (post = g.posts[file.dataset.post])) {
Header.scrollTo(post.nodes.root); Header.scrollTo(post.nodes.root);
} }
return nodes.thumbs.scrollTop = thumb.offsetTop + thumb.offsetHeight / 2 - nodes.thumbs.clientHeight / 2; return Gallery.cache = Gallery.load(Gallery.images[(newID + 1) % Gallery.images.length], Gallery.cacheError);
}, },
error: function() { error: function() {
var ref; var ref;
@ -9424,6 +9403,9 @@
}; };
})(this)); })(this));
}, },
cacheError: function() {
return delete Gallery.cache;
},
cleanupTimer: function() { cleanupTimer: function() {
var current; var current;
clearTimeout(Gallery.timeoutID); clearTimeout(Gallery.timeoutID);
@ -9585,6 +9567,11 @@
setFitness: function() { setFitness: function() {
return (this.checked ? $.addClass : $.rmClass)(doc, "gal-" + (this.name.toLowerCase().replace(/\s+/g, '-'))); return (this.checked ? $.addClass : $.rmClass)(doc, "gal-" + (this.name.toLowerCase().replace(/\s+/g, '-')));
}, },
setHeight: function() {
var current, dim, frame, height, ref, ref1, ref2, width;
ref = Gallery.nodes, current = ref.current, frame = ref.frame;
return current.style.minHeight = Conf['Stretch to Fit'] && (dim = (ref1 = g.posts[current.dataset.post]) != null ? ref1.file.dimensions : void 0) ? ((ref2 = dim.split('x'), width = ref2[0], height = ref2[1], ref2), Math.min(doc.clientHeight - 25, height / width * frame.clientWidth) + 'px') : null;
},
setDelay: function() { setDelay: function() {
return Gallery.delay = +this.value; return Gallery.delay = +this.value;
} }
@ -9609,11 +9596,14 @@
var input, label; var input, label;
label = UI.checkbox(name, name); label = UI.checkbox(name, name);
input = label.firstElementChild; input = label.firstElementChild;
if (name === 'Fit Width' || name === 'Fit Height' || name === 'Hide Thumbnails') { if (name === 'Hide Thumbnails' || name === 'Fit Width' || name === 'Fit Height') {
$.on(input, 'change', Gallery.cb.setFitness); $.on(input, 'change', Gallery.cb.setFitness);
} }
$.event('change', null, input); $.event('change', null, input);
$.on(input, 'change', $.cb.checked); $.on(input, 'change', $.cb.checked);
if (name === 'Hide Thumbnails' || name === 'Fit Width' || name === 'Fit Height' || name === 'Stretch to Fit') {
$.on(input, 'change', Gallery.cb.setHeight);
}
return { return {
el: label el: label
}; };
@ -9622,7 +9612,7 @@
var delayInput, delayLabel, item, subEntries; var delayInput, delayLabel, item, subEntries;
subEntries = (function() { subEntries = (function() {
var k, len1, ref, results; var k, len1, ref, results;
ref = ['Hide Thumbnails', 'Fit Width', 'Fit Height', 'Scroll to Post']; ref = ['Hide Thumbnails', 'Fit Width', 'Fit Height', 'Stretch to Fit', 'Scroll to Post'];
results = []; results = [];
for (k = 0, len1 = ref.length; k < len1; k++) { for (k = 0, len1 = ref.length; k < len1; k++) {
item = ref[k]; item = ref[k];
@ -10797,6 +10787,9 @@
}, },
wheel: function(e) { wheel: function(e) {
var el, volume; var el, volume;
if (e.shiftKey || e.altKey || e.ctrlKey || e.metaKey) {
return;
}
if (!(el = $('video:not([data-md5])', this))) { if (!(el = $('video:not([data-md5])', this))) {
return; return;
} }
@ -15768,6 +15761,9 @@
div = $.el('div', { div = $.el('div', {
innerHTML: "<label><input type=\"checkbox\" name=\"" + E(key) + "\">" + E(key) + "</label><span class=\"description\">: " + E(description) + "</span>" innerHTML: "<label><input type=\"checkbox\" name=\"" + E(key) + "\">" + E(key) + "</label><span class=\"description\">: " + E(description) + "</span>"
}); });
if ((typeof chrome !== "undefined" && chrome !== null) && key === 'Remember QR Size') {
div.hidden = true;
}
input = $('input', div); input = $('input', div);
$.on(input, 'change', function() { $.on(input, 'change', function() {
this.parentNode.parentNode.dataset.checked = this.checked; this.parentNode.parentNode.dataset.checked = this.checked;
@ -19073,13 +19069,6 @@
"}\n" + "}\n" +
".gal-fit-height .gal-image img,\n" + ".gal-fit-height .gal-image img,\n" +
".gal-fit-height .gal-image video {\n" + ".gal-fit-height .gal-image video {\n" +
" /*\n" +
" Chrome doesn't support viewpoint units in calc()\n" +
" http://bugs.chromium.org/168840\n" +
" \"It looks like the original author of viewport units in WebKit is not coming back to fix this stuff.\"\n" +
" Well, fuck.\n" +
" */\n" +
" max-height: 95vh;\n" +
" max-height: calc(100vh - 25px);\n" + " max-height: calc(100vh - 25px);\n" +
"}\n" + "}\n" +
".gal-image iframe {\n" + ".gal-image iframe {\n" +

Binary file not shown.

View File

@ -1,6 +1,6 @@
// ==UserScript== // ==UserScript==
// @name 4chan X // @name 4chan X
// @version 1.10.14.2 // @version 1.11.0.0
// @minGMVer 1.14 // @minGMVer 1.14
// @minFFVer 26 // @minFFVer 26
// @namespace 4chan-X // @namespace 4chan-X

View File

@ -1,7 +1,7 @@
// Generated by CoffeeScript // Generated by CoffeeScript
// ==UserScript== // ==UserScript==
// @name 4chan X // @name 4chan X
// @version 1.10.14.2 // @version 1.11.0.0
// @minGMVer 1.14 // @minGMVer 1.14
// @minFFVer 26 // @minFFVer 26
// @namespace 4chan-X // @namespace 4chan-X
@ -267,6 +267,7 @@
'Hide Thumbnails': [false], 'Hide Thumbnails': [false],
'Fit Width': [true], 'Fit Width': [true],
'Fit Height': [true], 'Fit Height': [true],
'Stretch to Fit': [false],
'Scroll to Post': [true], 'Scroll to Post': [true],
'Slide Delay': [6.0] 'Slide Delay': [6.0]
}, },
@ -396,7 +397,7 @@
doc = d.documentElement; doc = d.documentElement;
g = { g = {
VERSION: '1.10.14.2', VERSION: '1.11.0.0',
NAMESPACE: '4chan X.', NAMESPACE: '4chan X.',
boards: {} boards: {}
}; };
@ -2365,26 +2366,7 @@
Polyfill = { Polyfill = {
init: function() { init: function() {
this.notificationPermission(); return this.toBlob();
this.toBlob();
return this.visibility();
},
notificationPermission: function() {
if (!window.Notification || 'permission' in Notification || !window.webkitNotifications) {
return;
}
return Object.defineProperty(Notification, 'permission', {
get: function() {
switch (webkitNotifications.checkPermission()) {
case 0:
return 'granted';
case 1:
return 'default';
case 2:
return 'denied';
}
}
});
}, },
toBlob: function() { toBlob: function() {
var base1; var base1;
@ -2400,26 +2382,6 @@
type: 'image/png' type: 'image/png'
})); }));
}); });
},
visibility: function() {
if ('visibilityState' in d) {
return;
}
Object.defineProperties(HTMLDocument.prototype, {
visibilityState: {
get: function() {
return this.webkitVisibilityState;
}
},
hidden: {
get: function() {
return this.webkitHidden;
}
}
});
return $.on(d, 'webkitvisibilitychange', function() {
return $.event('visibilitychange');
});
} }
}; };
@ -7369,7 +7331,7 @@
event = node.nodeName === 'SELECT' ? 'change' : 'input'; event = node.nodeName === 'SELECT' ? 'change' : 'input';
$.on(nodes[name], event, save); $.on(nodes[name], event, save);
} }
if (Conf['Remember QR Size']) { if ((typeof chrome === "undefined" || chrome === null) && Conf['Remember QR Size']) {
$.get('QR Size', '', function(item) { $.get('QR Size', '', function(item) {
return nodes.com.style.cssText = item['QR Size']; return nodes.com.style.cssText = item['QR Size'];
}); });
@ -9359,29 +9321,43 @@
Gallery.images.push(thumb); Gallery.images.push(thumb);
return $.add(Gallery.nodes.thumbs, thumb); return $.add(Gallery.nodes.thumbs, thumb);
}, },
load: function(thumb, errorCB) {
var elType, ext, file;
ext = thumb.href.match(/\w*$/);
elType = {
'webm': 'video',
'pdf': 'iframe'
}[ext] || 'img';
file = $.el(elType, {
title: thumb.title
});
$.extend(file.dataset, thumb.dataset);
$.on(file, 'error', errorCB);
file.src = thumb.href;
return file;
},
open: function(thumb) { open: function(thumb) {
var el, elType, file, name, newID, nodes, oldID, post, slideshow; var el, file, newID, nodes, oldID, post, ref;
nodes = Gallery.nodes; nodes = Gallery.nodes;
name = nodes.name;
oldID = +nodes.current.dataset.id; oldID = +nodes.current.dataset.id;
newID = +thumb.dataset.id; newID = +thumb.dataset.id;
slideshow = Gallery.slideshow && (newID > oldID || (oldID === Gallery.images.length - 1 && newID === 0)); if (el = Gallery.images[oldID]) {
if (el = $('.gal-highlight', nodes.thumbs)) {
$.rmClass(el, 'gal-highlight'); $.rmClass(el, 'gal-highlight');
} }
$.addClass(thumb, 'gal-highlight'); $.addClass(thumb, 'gal-highlight');
elType = /\.webm$/.test(thumb.href) ? 'video' : /\.pdf$/.test(thumb.href) ? 'iframe' : 'img'; nodes.thumbs.scrollTop = thumb.offsetTop + thumb.offsetHeight / 2 - nodes.thumbs.clientHeight / 2;
$[elType === 'iframe' ? 'addClass' : 'rmClass'](doc, 'gal-pdf'); if (((ref = Gallery.cache) != null ? ref.dataset.id : void 0) === '' + newID) {
file = $.el(elType, { file = Gallery.cache;
title: name.download = name.textContent = thumb.title $.off(file, 'error', Gallery.cacheError);
}); $.on(file, 'error', Gallery.error);
$.extend(file.dataset, thumb.dataset); } else {
$.on(file, 'error', Gallery.error); file = Gallery.load(thumb, Gallery.error);
file.src = name.href = thumb.href; }
$.off(nodes.current, 'error', Gallery.error); $.off(nodes.current, 'error', Gallery.error);
ImageCommon.pause(nodes.current); ImageCommon.pause(nodes.current);
$.replace(nodes.current, file); $.replace(nodes.current, file);
if (elType === 'video') { nodes.current = file;
if (file.nodeName === 'VIDEO') {
file.loop = true; file.loop = true;
Volume.setup(file); Volume.setup(file);
if (Conf['Autoplay']) { if (Conf['Autoplay']) {
@ -9391,11 +9367,14 @@
ImageCommon.addControls(file); ImageCommon.addControls(file);
} }
} }
doc.classList.toggle('gal-pdf', file.nodeName === 'IFRAME');
Gallery.cb.setHeight();
nodes.count.textContent = +thumb.dataset.id + 1; nodes.count.textContent = +thumb.dataset.id + 1;
nodes.current = file; nodes.name.download = nodes.name.textContent = thumb.title;
nodes.name.href = thumb.href;
nodes.frame.scrollTop = 0; nodes.frame.scrollTop = 0;
nodes.next.focus(); nodes.next.focus();
if (slideshow) { if (Gallery.slideshow && (newID > oldID || (oldID === Gallery.images.length - 1 && newID === 0))) {
Gallery.setupTimer(); Gallery.setupTimer();
} else { } else {
Gallery.cb.stop(); Gallery.cb.stop();
@ -9403,7 +9382,7 @@
if (Conf['Scroll to Post'] && (post = g.posts[file.dataset.post])) { if (Conf['Scroll to Post'] && (post = g.posts[file.dataset.post])) {
Header.scrollTo(post.nodes.root); Header.scrollTo(post.nodes.root);
} }
return nodes.thumbs.scrollTop = thumb.offsetTop + thumb.offsetHeight / 2 - nodes.thumbs.clientHeight / 2; return Gallery.cache = Gallery.load(Gallery.images[(newID + 1) % Gallery.images.length], Gallery.cacheError);
}, },
error: function() { error: function() {
var ref; var ref;
@ -9425,6 +9404,9 @@
}; };
})(this)); })(this));
}, },
cacheError: function() {
return delete Gallery.cache;
},
cleanupTimer: function() { cleanupTimer: function() {
var current; var current;
clearTimeout(Gallery.timeoutID); clearTimeout(Gallery.timeoutID);
@ -9586,6 +9568,11 @@
setFitness: function() { setFitness: function() {
return (this.checked ? $.addClass : $.rmClass)(doc, "gal-" + (this.name.toLowerCase().replace(/\s+/g, '-'))); return (this.checked ? $.addClass : $.rmClass)(doc, "gal-" + (this.name.toLowerCase().replace(/\s+/g, '-')));
}, },
setHeight: function() {
var current, dim, frame, height, ref, ref1, ref2, width;
ref = Gallery.nodes, current = ref.current, frame = ref.frame;
return current.style.minHeight = Conf['Stretch to Fit'] && (dim = (ref1 = g.posts[current.dataset.post]) != null ? ref1.file.dimensions : void 0) ? ((ref2 = dim.split('x'), width = ref2[0], height = ref2[1], ref2), Math.min(doc.clientHeight - 25, height / width * frame.clientWidth) + 'px') : null;
},
setDelay: function() { setDelay: function() {
return Gallery.delay = +this.value; return Gallery.delay = +this.value;
} }
@ -9610,11 +9597,14 @@
var input, label; var input, label;
label = UI.checkbox(name, name); label = UI.checkbox(name, name);
input = label.firstElementChild; input = label.firstElementChild;
if (name === 'Fit Width' || name === 'Fit Height' || name === 'Hide Thumbnails') { if (name === 'Hide Thumbnails' || name === 'Fit Width' || name === 'Fit Height') {
$.on(input, 'change', Gallery.cb.setFitness); $.on(input, 'change', Gallery.cb.setFitness);
} }
$.event('change', null, input); $.event('change', null, input);
$.on(input, 'change', $.cb.checked); $.on(input, 'change', $.cb.checked);
if (name === 'Hide Thumbnails' || name === 'Fit Width' || name === 'Fit Height' || name === 'Stretch to Fit') {
$.on(input, 'change', Gallery.cb.setHeight);
}
return { return {
el: label el: label
}; };
@ -9623,7 +9613,7 @@
var delayInput, delayLabel, item, subEntries; var delayInput, delayLabel, item, subEntries;
subEntries = (function() { subEntries = (function() {
var k, len1, ref, results; var k, len1, ref, results;
ref = ['Hide Thumbnails', 'Fit Width', 'Fit Height', 'Scroll to Post']; ref = ['Hide Thumbnails', 'Fit Width', 'Fit Height', 'Stretch to Fit', 'Scroll to Post'];
results = []; results = [];
for (k = 0, len1 = ref.length; k < len1; k++) { for (k = 0, len1 = ref.length; k < len1; k++) {
item = ref[k]; item = ref[k];
@ -10798,6 +10788,9 @@
}, },
wheel: function(e) { wheel: function(e) {
var el, volume; var el, volume;
if (e.shiftKey || e.altKey || e.ctrlKey || e.metaKey) {
return;
}
if (!(el = $('video:not([data-md5])', this))) { if (!(el = $('video:not([data-md5])', this))) {
return; return;
} }
@ -15769,6 +15762,9 @@
div = $.el('div', { div = $.el('div', {
innerHTML: "<label><input type=\"checkbox\" name=\"" + E(key) + "\">" + E(key) + "</label><span class=\"description\">: " + E(description) + "</span>" innerHTML: "<label><input type=\"checkbox\" name=\"" + E(key) + "\">" + E(key) + "</label><span class=\"description\">: " + E(description) + "</span>"
}); });
if ((typeof chrome !== "undefined" && chrome !== null) && key === 'Remember QR Size') {
div.hidden = true;
}
input = $('input', div); input = $('input', div);
$.on(input, 'change', function() { $.on(input, 'change', function() {
this.parentNode.parentNode.dataset.checked = this.checked; this.parentNode.parentNode.dataset.checked = this.checked;
@ -19074,13 +19070,6 @@
"}\n" + "}\n" +
".gal-fit-height .gal-image img,\n" + ".gal-fit-height .gal-image img,\n" +
".gal-fit-height .gal-image video {\n" + ".gal-fit-height .gal-image video {\n" +
" /*\n" +
" Chrome doesn't support viewpoint units in calc()\n" +
" http://bugs.chromium.org/168840\n" +
" \"It looks like the original author of viewport units in WebKit is not coming back to fix this stuff.\"\n" +
" Well, fuck.\n" +
" */\n" +
" max-height: 95vh;\n" +
" max-height: calc(100vh - 25px);\n" + " max-height: calc(100vh - 25px);\n" +
"}\n" + "}\n" +
".gal-image iframe {\n" + ".gal-image iframe {\n" +

Binary file not shown.

View File

@ -1,7 +1,7 @@
<?xml version='1.0' encoding='UTF-8'?> <?xml version='1.0' encoding='UTF-8'?>
<gupdate xmlns='http://www.google.com/update2/response' protocol='2.0'> <gupdate xmlns='http://www.google.com/update2/response' protocol='2.0'>
<app appid='lacclbnghgdicfifcamcmcnilckjamag'> <app appid='lacclbnghgdicfifcamcmcnilckjamag'>
<updatecheck codebase='https://ccd0.github.io/4chan-x/builds/4chan-X-beta.crx' version='1.10.14.2' /> <updatecheck codebase='https://ccd0.github.io/4chan-x/builds/4chan-X-beta.crx' version='1.11.0.0' />
</app> </app>
</gupdate> </gupdate>

View File

@ -1,7 +1,7 @@
<?xml version='1.0' encoding='UTF-8'?> <?xml version='1.0' encoding='UTF-8'?>
<gupdate xmlns='http://www.google.com/update2/response' protocol='2.0'> <gupdate xmlns='http://www.google.com/update2/response' protocol='2.0'>
<app appid='lacclbnghgdicfifcamcmcnilckjamag'> <app appid='lacclbnghgdicfifcamcmcnilckjamag'>
<updatecheck codebase='https://ccd0.github.io/4chan-x/builds/4chan-X.crx' version='1.10.14.2' /> <updatecheck codebase='https://ccd0.github.io/4chan-x/builds/4chan-X.crx' version='1.11.0.0' />
</app> </app>
</gupdate> </gupdate>

View File

@ -3,8 +3,8 @@
"description": "Cross-browser userscript for maximum lurking on 4chan.", "description": "Cross-browser userscript for maximum lurking on 4chan.",
"meta": { "meta": {
"name": "4chan X", "name": "4chan X",
"version": "1.10.14.2", "version": "1.11.0.0",
"date": "2015-06-12T03:09:08.773Z", "date": "2015-06-14T08:23:24.605Z",
"repo": "https://github.com/ccd0/4chan-x/", "repo": "https://github.com/ccd0/4chan-x/",
"page": "https://github.com/ccd0/4chan-x", "page": "https://github.com/ccd0/4chan-x",
"downloads": "https://ccd0.github.io/4chan-x/builds/", "downloads": "https://ccd0.github.io/4chan-x/builds/",