This commit is contained in:
Zixaphir 2014-07-17 19:19:48 -07:00
parent 6566b8bbf4
commit e96354bc3e
4 changed files with 43 additions and 19 deletions

View File

@ -255,7 +255,8 @@
gallery: {
'Hide Thumbnails': [false],
'Fit Width': [true],
'Fit Height': [true]
'Fit Height': [true],
'Scroll to Post': [true]
},
style: {
Interface: {
@ -10523,7 +10524,7 @@
title: title
});
thumb.dataset.id = Gallery.images.length;
thumb.dataset.post = $('a[title="Link to this post"]', post.nodes.info).href;
thumb.dataset.post = post.fullID;
if (post.file.isVideo) {
thumb.dataset.isVideo = true;
}
@ -10562,7 +10563,7 @@
return cb();
},
open: function(e) {
var el, elType, file, name, nodes, rect, top, _base;
var el, elType, err, file, name, nodes, post, rect, top, _base, _ref;
if (e) {
e.preventDefault();
}
@ -10597,11 +10598,18 @@
top = rect.top;
if (top > 0) {
top += rect.height - doc.clientHeight;
if (top < 0) {
return;
}
}
nodes.thumbs.scrollTop += top;
if (top > 0) {
nodes.thumbs.scrollTop += top;
}
try {
if (Conf['Scroll to Post'] && (post = (_ref = (post = g.posts[file.dataset.post])) != null ? _ref.nodes.root : void 0)) {
Header.scrollTo(post);
}
} catch (_error) {
err = _error;
console.log(err);
}
return $.on(file, 'error', function() {
return Gallery.cb.error(file, thumb);
});

View File

@ -230,7 +230,8 @@
gallery: {
'Hide Thumbnails': [false],
'Fit Width': [true],
'Fit Height': [true]
'Fit Height': [true],
'Scroll to Post': [true]
},
style: {
Interface: {
@ -10556,7 +10557,7 @@
title: title
});
thumb.dataset.id = Gallery.images.length;
thumb.dataset.post = $('a[title="Link to this post"]', post.nodes.info).href;
thumb.dataset.post = post.fullID;
if (post.file.isVideo) {
thumb.dataset.isVideo = true;
}
@ -10595,7 +10596,7 @@
return cb();
},
open: function(e) {
var el, elType, file, name, nodes, rect, top, _base;
var el, elType, err, file, name, nodes, post, rect, top, _base, _ref;
if (e) {
e.preventDefault();
}
@ -10630,11 +10631,18 @@
top = rect.top;
if (top > 0) {
top += rect.height - doc.clientHeight;
if (top < 0) {
return;
}
}
nodes.thumbs.scrollTop += top;
if (top > 0) {
nodes.thumbs.scrollTop += top;
}
try {
if (Conf['Scroll to Post'] && (post = (_ref = (post = g.posts[file.dataset.post])) != null ? _ref.nodes.root : void 0)) {
Header.scrollTo(post);
}
} catch (_error) {
err = _error;
console.log(err);
}
return $.on(file, 'error', function() {
return Gallery.cb.error(file, thumb);
});

View File

@ -407,13 +407,15 @@ Config =
'Hide Thumbnails': [
false
]
# Fit Width =/= Fit width
'Fit Width': [
'Fit Width': [ # 'Fit width' (lowercase W) belongs to Image Expansion. Engine limitations, heh.
true
]
'Fit Height': [
true
]
'Scroll to Post': [
true
]
style:

View File

@ -110,7 +110,7 @@ Gallery =
title: title
thumb.dataset.id = Gallery.images.length
thumb.dataset.post = $('a[title="Link to this post"]', post.nodes.info).href
thumb.dataset.post = post.fullID
thumb.dataset.isVideo = true if post.file.isVideo
thumbImg = post.file.thumb.cloneNode false
@ -172,9 +172,15 @@ Gallery =
{top} = rect
if top > 0
top += rect.height - doc.clientHeight
return if top < 0
nodes.thumbs.scrollTop += top
nodes.thumbs.scrollTop += top if top > 0
# Scroll to post
try
if Conf['Scroll to Post'] and post = (post = g.posts[file.dataset.post])?.nodes.root
Header.scrollTo post
catch err
console.log err
$.on file, 'error', ->
Gallery.cb.error file, thumb