Fix Gallery.node
This commit is contained in:
parent
fa44526c54
commit
943ec4d2f4
@ -8838,10 +8838,12 @@
|
|||||||
node: function() {
|
node: function() {
|
||||||
var _ref;
|
var _ref;
|
||||||
|
|
||||||
if (!(Gallery.el && ((_ref = this.file) != null ? _ref.isImage : void 0))) {
|
if (!((_ref = this.file) != null ? _ref.isImage : void 0)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Gallery.generateThumb($('.file', this.nodes.root));
|
if (Gallery.el) {
|
||||||
|
Gallery.generateThumb($('.file', this.nodes.root));
|
||||||
|
}
|
||||||
if (!Conf['Image Expansion']) {
|
if (!Conf['Image Expansion']) {
|
||||||
return $.on(this.file.thumb.parentNode, 'click', Gallery.cb.image);
|
return $.on(this.file.thumb.parentNode, 'click', Gallery.cb.image);
|
||||||
}
|
}
|
||||||
@ -8872,7 +8874,7 @@
|
|||||||
$.add(d.body, dialog);
|
$.add(d.body, dialog);
|
||||||
Gallery.thumbs.scrollTop = 0;
|
Gallery.thumbs.scrollTop = 0;
|
||||||
Gallery.current.parentElement.scrollTop = 0;
|
Gallery.current.parentElement.scrollTop = 0;
|
||||||
Gallery.cb.open.call(image ? $("[href=" + image.href + "]", Gallery.thumbs) : Gallery.images[0]);
|
Gallery.cb.open.call(image ? $("[href='" + (image.href.replace(/https?:/, '')) + "']", Gallery.thumbs) : Gallery.images[0]);
|
||||||
return d.body.style.overflow = 'hidden';
|
return d.body.style.overflow = 'hidden';
|
||||||
},
|
},
|
||||||
generateThumb: function(file) {
|
generateThumb: function(file) {
|
||||||
@ -8938,20 +8940,19 @@
|
|||||||
Gallery.frame.scrollTop = 0;
|
Gallery.frame.scrollTop = 0;
|
||||||
return Gallery.url.focus();
|
return Gallery.url.focus();
|
||||||
},
|
},
|
||||||
|
image: function(e) {
|
||||||
|
e.preventDefault();
|
||||||
|
e.stopPropagation();
|
||||||
|
return Gallery.build(this);
|
||||||
|
},
|
||||||
prev: function() {
|
prev: function() {
|
||||||
return Gallery.cb.open.call(Gallery.images[+Gallery.current.dataset.id - 1]);
|
return Gallery.cb.open.call(Gallery.images[+Gallery.current.dataset.id - 1]);
|
||||||
},
|
},
|
||||||
next: function() {
|
next: function() {
|
||||||
return Gallery.cb.open.call(Gallery.images[+Gallery.current.dataset.id + 1]);
|
return Gallery.cb.open.call(Gallery.images[+Gallery.current.dataset.id + 1]);
|
||||||
},
|
},
|
||||||
image: function() {
|
|
||||||
return Gallery.build(this);
|
|
||||||
},
|
|
||||||
toggle: function() {
|
toggle: function() {
|
||||||
if (Gallery.el) {
|
return (Gallery.el ? Gallery.cb.close : Gallery.build)();
|
||||||
return Gallery.cb.close();
|
|
||||||
}
|
|
||||||
return Gallery.build();
|
|
||||||
},
|
},
|
||||||
close: function() {
|
close: function() {
|
||||||
$.rm(Gallery.el);
|
$.rm(Gallery.el);
|
||||||
|
|||||||
@ -8826,10 +8826,12 @@
|
|||||||
node: function() {
|
node: function() {
|
||||||
var _ref;
|
var _ref;
|
||||||
|
|
||||||
if (!(Gallery.el && ((_ref = this.file) != null ? _ref.isImage : void 0))) {
|
if (!((_ref = this.file) != null ? _ref.isImage : void 0)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Gallery.generateThumb($('.file', this.nodes.root));
|
if (Gallery.el) {
|
||||||
|
Gallery.generateThumb($('.file', this.nodes.root));
|
||||||
|
}
|
||||||
if (!Conf['Image Expansion']) {
|
if (!Conf['Image Expansion']) {
|
||||||
return $.on(this.file.thumb.parentNode, 'click', Gallery.cb.image);
|
return $.on(this.file.thumb.parentNode, 'click', Gallery.cb.image);
|
||||||
}
|
}
|
||||||
@ -8860,7 +8862,7 @@
|
|||||||
$.add(d.body, dialog);
|
$.add(d.body, dialog);
|
||||||
Gallery.thumbs.scrollTop = 0;
|
Gallery.thumbs.scrollTop = 0;
|
||||||
Gallery.current.parentElement.scrollTop = 0;
|
Gallery.current.parentElement.scrollTop = 0;
|
||||||
Gallery.cb.open.call(image ? $("[href=" + image.href + "]", Gallery.thumbs) : Gallery.images[0]);
|
Gallery.cb.open.call(image ? $("[href='" + (image.href.replace(/https?:/, '')) + "']", Gallery.thumbs) : Gallery.images[0]);
|
||||||
return d.body.style.overflow = 'hidden';
|
return d.body.style.overflow = 'hidden';
|
||||||
},
|
},
|
||||||
generateThumb: function(file) {
|
generateThumb: function(file) {
|
||||||
@ -8926,20 +8928,19 @@
|
|||||||
Gallery.frame.scrollTop = 0;
|
Gallery.frame.scrollTop = 0;
|
||||||
return Gallery.url.focus();
|
return Gallery.url.focus();
|
||||||
},
|
},
|
||||||
|
image: function(e) {
|
||||||
|
e.preventDefault();
|
||||||
|
e.stopPropagation();
|
||||||
|
return Gallery.build(this);
|
||||||
|
},
|
||||||
prev: function() {
|
prev: function() {
|
||||||
return Gallery.cb.open.call(Gallery.images[+Gallery.current.dataset.id - 1]);
|
return Gallery.cb.open.call(Gallery.images[+Gallery.current.dataset.id - 1]);
|
||||||
},
|
},
|
||||||
next: function() {
|
next: function() {
|
||||||
return Gallery.cb.open.call(Gallery.images[+Gallery.current.dataset.id + 1]);
|
return Gallery.cb.open.call(Gallery.images[+Gallery.current.dataset.id + 1]);
|
||||||
},
|
},
|
||||||
image: function() {
|
|
||||||
return Gallery.build(this);
|
|
||||||
},
|
|
||||||
toggle: function() {
|
toggle: function() {
|
||||||
if (Gallery.el) {
|
return (Gallery.el ? Gallery.cb.close : Gallery.build)();
|
||||||
return Gallery.cb.close();
|
|
||||||
}
|
|
||||||
return Gallery.build();
|
|
||||||
},
|
},
|
||||||
close: function() {
|
close: function() {
|
||||||
$.rm(Gallery.el);
|
$.rm(Gallery.el);
|
||||||
|
|||||||
@ -18,8 +18,9 @@ Gallery =
|
|||||||
cb: @node
|
cb: @node
|
||||||
|
|
||||||
node: ->
|
node: ->
|
||||||
return unless Gallery.el and @file?.isImage
|
return unless @file?.isImage
|
||||||
Gallery.generateThumb $ '.file', @nodes.root
|
|
||||||
|
Gallery.generateThumb $ '.file', @nodes.root if Gallery.el
|
||||||
|
|
||||||
unless Conf['Image Expansion']
|
unless Conf['Image Expansion']
|
||||||
$.on @file.thumb.parentNode, 'click', Gallery.cb.image
|
$.on @file.thumb.parentNode, 'click', Gallery.cb.image
|
||||||
@ -63,7 +64,7 @@ Gallery =
|
|||||||
Gallery.current.parentElement.scrollTop = 0
|
Gallery.current.parentElement.scrollTop = 0
|
||||||
|
|
||||||
Gallery.cb.open.call if image
|
Gallery.cb.open.call if image
|
||||||
$ "[href=#{image.href}]", Gallery.thumbs
|
$ "[href='#{image.href.replace /https?:/, ''}']", Gallery.thumbs
|
||||||
else
|
else
|
||||||
Gallery.images[0]
|
Gallery.images[0]
|
||||||
|
|
||||||
@ -88,6 +89,7 @@ Gallery =
|
|||||||
cb:
|
cb:
|
||||||
keybinds: (e) ->
|
keybinds: (e) ->
|
||||||
return unless key = Keybinds.keyCode e
|
return unless key = Keybinds.keyCode e
|
||||||
|
|
||||||
cb = switch key
|
cb = switch key
|
||||||
when 'Esc', Conf['Open Gallery']
|
when 'Esc', Conf['Open Gallery']
|
||||||
Gallery.cb.close
|
Gallery.cb.close
|
||||||
@ -102,9 +104,8 @@ Gallery =
|
|||||||
cb()
|
cb()
|
||||||
|
|
||||||
open: (e) ->
|
open: (e) ->
|
||||||
if e
|
e.preventDefault() if e
|
||||||
e.preventDefault()
|
|
||||||
|
|
||||||
$.rmClass el, 'gal-highlight' if el = $ '.gal-highlight', Gallery.thumbs
|
$.rmClass el, 'gal-highlight' if el = $ '.gal-highlight', Gallery.thumbs
|
||||||
$.addClass @, 'gal-highlight'
|
$.addClass @, 'gal-highlight'
|
||||||
|
|
||||||
@ -117,16 +118,16 @@ Gallery =
|
|||||||
Gallery.current = img
|
Gallery.current = img
|
||||||
Gallery.frame.scrollTop = 0
|
Gallery.frame.scrollTop = 0
|
||||||
Gallery.url.focus()
|
Gallery.url.focus()
|
||||||
prev: ->
|
|
||||||
Gallery.cb.open.call Gallery.images[+Gallery.current.dataset.id - 1]
|
image: (e) ->
|
||||||
next: ->
|
e.preventDefault()
|
||||||
Gallery.cb.open.call Gallery.images[+Gallery.current.dataset.id + 1]
|
e.stopPropagation()
|
||||||
image: ->
|
|
||||||
Gallery.build @
|
Gallery.build @
|
||||||
toggle: ->
|
|
||||||
if Gallery.el
|
prev: -> Gallery.cb.open.call Gallery.images[+Gallery.current.dataset.id - 1]
|
||||||
return Gallery.cb.close()
|
next: -> Gallery.cb.open.call Gallery.images[+Gallery.current.dataset.id + 1]
|
||||||
Gallery.build()
|
toggle: -> (if Gallery.el then Gallery.cb.close else Gallery.build)()
|
||||||
|
|
||||||
close: ->
|
close: ->
|
||||||
$.rm Gallery.el
|
$.rm Gallery.el
|
||||||
delete Gallery.el
|
delete Gallery.el
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user