|
@ -35,22 +35,14 @@ const defaults = { |
|
|
class: "fancybox__button--prev", |
|
|
class: "fancybox__button--prev", |
|
|
label: "PREV", |
|
|
label: "PREV", |
|
|
html: '<svg viewBox="0 0 24 24"><path d="M15 4l-8 8 8 8"/></svg>', |
|
|
html: '<svg viewBox="0 0 24 24"><path d="M15 4l-8 8 8 8"/></svg>', |
|
|
click: function (event) { |
|
|
attr: { "data-fancybox-prev": "" }, |
|
|
event.preventDefault(); |
|
|
|
|
|
|
|
|
|
|
|
this.fancybox.prev(); |
|
|
|
|
|
}, |
|
|
|
|
|
}, |
|
|
}, |
|
|
next: { |
|
|
next: { |
|
|
type: "button", |
|
|
type: "button", |
|
|
class: "fancybox__button--next", |
|
|
class: "fancybox__button--next", |
|
|
label: "NEXT", |
|
|
label: "NEXT", |
|
|
html: '<svg viewBox="0 0 24 24"><path d="M8 4l8 8-8 8"/></svg>', |
|
|
html: '<svg viewBox="0 0 24 24"><path d="M8 4l8 8-8 8"/></svg>', |
|
|
click: function (event) { |
|
|
attr: { "data-fancybox-next": "" }, |
|
|
event.preventDefault(); |
|
|
|
|
|
|
|
|
|
|
|
this.fancybox.next(); |
|
|
|
|
|
}, |
|
|
|
|
|
}, |
|
|
}, |
|
|
fullscreen: { |
|
|
fullscreen: { |
|
|
type: "button", |
|
|
type: "button", |
|
@ -129,12 +121,7 @@ const defaults = { |
|
|
class: "fancybox__button--close", |
|
|
class: "fancybox__button--close", |
|
|
html: '<svg viewBox="0 0 24 24"><path d="M20 20L4 4m16 0L4 20"></path></svg>', |
|
|
html: '<svg viewBox="0 0 24 24"><path d="M20 20L4 4m16 0L4 20"></path></svg>', |
|
|
tabindex: 0, |
|
|
tabindex: 0, |
|
|
click: function (event) { |
|
|
attr: { "data-fancybox-close": "" }, |
|
|
event.stopPropagation(); |
|
|
|
|
|
event.preventDefault(); |
|
|
|
|
|
|
|
|
|
|
|
this.fancybox.close(); |
|
|
|
|
|
}, |
|
|
|
|
|
}, |
|
|
}, |
|
|
}, |
|
|
}, |
|
|
}; |
|
|
}; |
|
@ -211,6 +198,7 @@ export class Toolbar { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
onPrepare() { |
|
|
onPrepare() { |
|
|
|
|
|
const fancybox = this.fancybox; |
|
|
// Skip if disabled
|
|
|
// Skip if disabled
|
|
|
if (this.state !== "init") { |
|
|
if (this.state !== "init") { |
|
|
return; |
|
|
return; |
|
@ -220,16 +208,16 @@ export class Toolbar { |
|
|
|
|
|
|
|
|
this.update(); |
|
|
this.update(); |
|
|
|
|
|
|
|
|
this.Slideshow = new Slideshow(this.fancybox); |
|
|
this.Slideshow = new Slideshow(fancybox); |
|
|
|
|
|
|
|
|
if (!this.fancybox.Carousel.prevPage) { |
|
|
if (!fancybox.Carousel.prevPage) { |
|
|
if (this.fancybox.option("slideshow.autoStart")) { |
|
|
if (fancybox.option("slideshow.autoStart")) { |
|
|
this.Slideshow.activate(); |
|
|
this.Slideshow.activate(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if (this.fancybox.option("fullscreen.autoStart") && !Fullscreen.element()) { |
|
|
if (fancybox.option("fullscreen.autoStart") && !Fullscreen.element()) { |
|
|
try { |
|
|
try { |
|
|
Fullscreen.activate(this.fancybox.$container); |
|
|
Fullscreen.activate(fancybox.$container); |
|
|
} catch (error) {} |
|
|
} catch (error) {} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
@ -240,14 +228,14 @@ export class Toolbar { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
onSettle() { |
|
|
onSettle() { |
|
|
if (this.Slideshow && this.Slideshow.isActive()) { |
|
|
const fancybox = this.fancybox; |
|
|
if ( |
|
|
const slideshow = this.Slideshow; |
|
|
this.fancybox.getSlide().index === this.fancybox.Carousel.slides.length - 1 && |
|
|
|
|
|
!this.fancybox.option("infinite") |
|
|
if (slideshow && slideshow.isActive()) { |
|
|
) { |
|
|
if (fancybox.getSlide().index === fancybox.Carousel.slides.length - 1 && !fancybox.option("infinite")) { |
|
|
this.Slideshow.deactivate(); |
|
|
slideshow.deactivate(); |
|
|
} else if (this.fancybox.getSlide().state === "done") { |
|
|
} else if (fancybox.getSlide().state === "done") { |
|
|
this.Slideshow.setTimer(); |
|
|
slideshow.setTimer(); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
@ -261,14 +249,16 @@ export class Toolbar { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
onDone(fancybox, slide) { |
|
|
onDone(fancybox, slide) { |
|
|
|
|
|
const slideshow = this.Slideshow; |
|
|
|
|
|
|
|
|
if (slide.index === fancybox.getSlide().index) { |
|
|
if (slide.index === fancybox.getSlide().index) { |
|
|
this.update(); |
|
|
this.update(); |
|
|
|
|
|
|
|
|
if (this.Slideshow && this.Slideshow.isActive()) { |
|
|
if (slideshow && slideshow.isActive()) { |
|
|
if (!this.fancybox.option("infinite") && slide.index === this.fancybox.Carousel.slides.length - 1) { |
|
|
if (!fancybox.option("infinite") && slide.index === fancybox.Carousel.slides.length - 1) { |
|
|
this.Slideshow.deactivate(); |
|
|
slideshow.deactivate(); |
|
|
} else { |
|
|
} else { |
|
|
this.Slideshow.setTimer(); |
|
|
slideshow.setTimer(); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
@ -323,6 +313,10 @@ export class Toolbar { |
|
|
$el.classList.add(...obj.class.split(" ")); |
|
|
$el.classList.add(...obj.class.split(" ")); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
for (let prop in obj.attr) { |
|
|
|
|
|
$el.setAttribute(prop, obj[prop]); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
if (obj.label) { |
|
|
if (obj.label) { |
|
|
$el.setAttribute("title", this.fancybox.localize(`{{${obj.label}}}`)); |
|
|
$el.setAttribute("title", this.fancybox.localize(`{{${obj.label}}}`)); |
|
|
} |
|
|
} |
|
|