Implement #673
This commit is contained in:
parent
6566b8bbf4
commit
e96354bc3e
@ -255,7 +255,8 @@
|
|||||||
gallery: {
|
gallery: {
|
||||||
'Hide Thumbnails': [false],
|
'Hide Thumbnails': [false],
|
||||||
'Fit Width': [true],
|
'Fit Width': [true],
|
||||||
'Fit Height': [true]
|
'Fit Height': [true],
|
||||||
|
'Scroll to Post': [true]
|
||||||
},
|
},
|
||||||
style: {
|
style: {
|
||||||
Interface: {
|
Interface: {
|
||||||
@ -10523,7 +10524,7 @@
|
|||||||
title: title
|
title: title
|
||||||
});
|
});
|
||||||
thumb.dataset.id = Gallery.images.length;
|
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) {
|
if (post.file.isVideo) {
|
||||||
thumb.dataset.isVideo = true;
|
thumb.dataset.isVideo = true;
|
||||||
}
|
}
|
||||||
@ -10562,7 +10563,7 @@
|
|||||||
return cb();
|
return cb();
|
||||||
},
|
},
|
||||||
open: function(e) {
|
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) {
|
if (e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
}
|
}
|
||||||
@ -10597,11 +10598,18 @@
|
|||||||
top = rect.top;
|
top = rect.top;
|
||||||
if (top > 0) {
|
if (top > 0) {
|
||||||
top += rect.height - doc.clientHeight;
|
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 $.on(file, 'error', function() {
|
||||||
return Gallery.cb.error(file, thumb);
|
return Gallery.cb.error(file, thumb);
|
||||||
});
|
});
|
||||||
|
|||||||
@ -230,7 +230,8 @@
|
|||||||
gallery: {
|
gallery: {
|
||||||
'Hide Thumbnails': [false],
|
'Hide Thumbnails': [false],
|
||||||
'Fit Width': [true],
|
'Fit Width': [true],
|
||||||
'Fit Height': [true]
|
'Fit Height': [true],
|
||||||
|
'Scroll to Post': [true]
|
||||||
},
|
},
|
||||||
style: {
|
style: {
|
||||||
Interface: {
|
Interface: {
|
||||||
@ -10556,7 +10557,7 @@
|
|||||||
title: title
|
title: title
|
||||||
});
|
});
|
||||||
thumb.dataset.id = Gallery.images.length;
|
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) {
|
if (post.file.isVideo) {
|
||||||
thumb.dataset.isVideo = true;
|
thumb.dataset.isVideo = true;
|
||||||
}
|
}
|
||||||
@ -10595,7 +10596,7 @@
|
|||||||
return cb();
|
return cb();
|
||||||
},
|
},
|
||||||
open: function(e) {
|
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) {
|
if (e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
}
|
}
|
||||||
@ -10630,11 +10631,18 @@
|
|||||||
top = rect.top;
|
top = rect.top;
|
||||||
if (top > 0) {
|
if (top > 0) {
|
||||||
top += rect.height - doc.clientHeight;
|
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 $.on(file, 'error', function() {
|
||||||
return Gallery.cb.error(file, thumb);
|
return Gallery.cb.error(file, thumb);
|
||||||
});
|
});
|
||||||
|
|||||||
@ -407,13 +407,15 @@ Config =
|
|||||||
'Hide Thumbnails': [
|
'Hide Thumbnails': [
|
||||||
false
|
false
|
||||||
]
|
]
|
||||||
# Fit Width =/= Fit width
|
'Fit Width': [ # 'Fit width' (lowercase W) belongs to Image Expansion. Engine limitations, heh.
|
||||||
'Fit Width': [
|
|
||||||
true
|
true
|
||||||
]
|
]
|
||||||
'Fit Height': [
|
'Fit Height': [
|
||||||
true
|
true
|
||||||
]
|
]
|
||||||
|
'Scroll to Post': [
|
||||||
|
true
|
||||||
|
]
|
||||||
|
|
||||||
style:
|
style:
|
||||||
|
|
||||||
|
|||||||
@ -110,7 +110,7 @@ Gallery =
|
|||||||
title: title
|
title: title
|
||||||
|
|
||||||
thumb.dataset.id = Gallery.images.length
|
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
|
thumb.dataset.isVideo = true if post.file.isVideo
|
||||||
|
|
||||||
thumbImg = post.file.thumb.cloneNode false
|
thumbImg = post.file.thumb.cloneNode false
|
||||||
@ -172,9 +172,15 @@ Gallery =
|
|||||||
{top} = rect
|
{top} = rect
|
||||||
if top > 0
|
if top > 0
|
||||||
top += rect.height - doc.clientHeight
|
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', ->
|
$.on file, 'error', ->
|
||||||
Gallery.cb.error file, thumb
|
Gallery.cb.error file, thumb
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user