1
- var Flickity = require ( 'flickity' ) ;
1
+ const Flickity = require ( 'flickity' ) ;
2
2
require ( 'flickity-imagesloaded' ) ;
3
3
4
4
module . exports = ctx => {
5
- var carousel = document . querySelector ( '.carousel' ) ;
5
+ const carousel = document . querySelector ( '.carousel' ) ;
6
6
if ( carousel ) {
7
- var thumbnails = document . getElementsByClassName ( 'record-imgpanel__thumb' ) ;
8
- var captions = Array . prototype . slice . call (
7
+ const thumbnails = document . getElementsByClassName ( 'record-imgpanel__thumb' ) ;
8
+ const captions = Array . prototype . slice . call (
9
9
document . getElementsByClassName ( 'record-imgpanel__caption' )
10
10
) ;
11
- var rights = Array . prototype . slice . call (
11
+ const rights = Array . prototype . slice . call (
12
12
document . getElementsByClassName ( 'cite__menu__methods' )
13
13
) ;
14
- var zooms = Array . prototype . slice . call (
14
+ const zooms = Array . prototype . slice . call (
15
15
document . getElementsByClassName ( 'osd__toolbar-container' )
16
16
) ;
17
- var useImage = Array . prototype . slice . call (
17
+ const useImage = Array . prototype . slice . call (
18
18
document . getElementsByClassName ( 'cite__button' )
19
19
) ;
20
20
@@ -28,7 +28,7 @@ module.exports = ctx => {
28
28
'M 0,50 L 45.67,4.33 L 52.5,11.16 L 18.49,45.17 L 100,45.17 L 100,54.83 L 18.49,54.83 L 52.5,88.84 45.67,95.67 Z'
29
29
} ) ;
30
30
31
- var flkty = Flickity . data ( carousel ) ;
31
+ const flkty = Flickity . data ( carousel ) ;
32
32
ctx . carousel . on ( 'select' , function ( ) {
33
33
if ( navigator . platform && / i P a d | i P h o n e | i P o d / . test ( navigator . platform ) ) {
34
34
document . querySelector ( '#openseadragon' ) . style . width = '100%' ;
@@ -46,7 +46,7 @@ module.exports = ctx => {
46
46
useImage . forEach ( el => showHide ( 'cite__button' , flkty , el ) ) ;
47
47
}
48
48
49
- let carouselImage = document . querySelectorAll ( '.carousel__image.is-selected' ) ;
49
+ const carouselImage = document . querySelectorAll ( '.carousel__image.is-selected' ) ;
50
50
51
51
if ( carouselImage . length ) {
52
52
ctx . imgUrl = carouselImage [ 0 ] . dataset . osd ;
@@ -60,7 +60,7 @@ module.exports = ctx => {
60
60
) ;
61
61
}
62
62
63
- var citeButton = document . getElementsByClassName ( 'cite__button' ) ;
63
+ const citeButton = document . getElementsByClassName ( 'cite__button' ) ;
64
64
65
65
if ( citeButton ) {
66
66
Array . prototype . slice . call ( citeButton ) . forEach ( ( el , i ) =>
@@ -75,9 +75,9 @@ module.exports = ctx => {
75
75
) ;
76
76
}
77
77
78
- var homeCarousel = document . querySelector ( '.home-carousel__flickity' ) ;
78
+ const homeCarousel = document . querySelector ( '.home-carousel__flickity' ) ;
79
79
if ( homeCarousel ) {
80
- var homeCarouselFlkty = new Flickity ( homeCarousel , {
80
+ const homeCarouselFlkty = new Flickity ( homeCarousel , {
81
81
wrapAround : true ,
82
82
pageDots : false ,
83
83
imagesLoaded : true ,
@@ -92,10 +92,10 @@ module.exports = ctx => {
92
92
offsetContainer ( ) ;
93
93
this . select ( 0 ) ;
94
94
// move buttons to before the main carousel
95
- let buttons = homeCarousel . querySelectorAll (
95
+ const buttons = homeCarousel . querySelectorAll (
96
96
'.flickity-prev-next-button'
97
97
) ;
98
- let before = document . querySelector (
98
+ const before = document . querySelector (
99
99
'.home-carousel .flickity-buttonholder'
100
100
) ;
101
101
buttons . forEach ( b => {
@@ -110,9 +110,9 @@ module.exports = ctx => {
110
110
}
111
111
function offsetContainer ( ) {
112
112
// to mirror main site carousels, we want to bust out of column container on right side only.
113
- var windowWidth = document . body . offsetWidth ;
114
- var containerWidth = document . querySelector ( '.row' ) . offsetWidth ; // any row will do!
115
- var offsetWidth = ( windowWidth - containerWidth ) / 2 + 8 ;
113
+ const windowWidth = document . body . offsetWidth ;
114
+ const containerWidth = document . querySelector ( '.row' ) . offsetWidth ; // any row will do!
115
+ const offsetWidth = ( windowWidth - containerWidth ) / 2 + 8 ;
116
116
document . querySelector (
117
117
'.home-carousel__flickity .flickity-viewport'
118
118
) . style . marginLeft =
0 commit comments