| 1 |
import {Lightbox} from "./Lightbox"; |
| 2 |
|
| 3 |
export class PhotonicStrip extends Lightbox { |
| 4 |
constructor($) { |
| 5 |
super(); |
| 6 |
this.$ = $; |
| 7 |
} |
| 8 |
|
| 9 |
changeVideoURL(element, regular, embed) { |
| 10 |
const $ = this.$; |
| 11 |
$(element).attr('href', regular); |
| 12 |
$(element).addClass('strip'); |
| 13 |
}; |
| 14 |
|
| 15 |
initialize = function(selector, group) { |
| 16 |
this.handleSolos(); |
| 17 |
const $ = this.$; |
| 18 |
$('.photonic-strip.strip').each((idx, a) => { |
| 19 |
const hash = $(a).data('photonicDeep'); |
| 20 |
let onShow, afterHide; |
| 21 |
if (hash !== undefined) { |
| 22 |
if (typeof(window.history.pushState) === 'function' && Photonic_JS.deep_linking === 'yes-history') { |
| 23 |
onShow = "onShow: function() { window.history.pushState({}, document.title, '#' + '" + hash + "');}"; |
| 24 |
} |
| 25 |
else if (typeof(window.history.replaceState) === 'function' && Photonic_JS.deep_linking === 'no-history') { |
| 26 |
onShow = "onShow: function() { window.history.replaceState({}, document.title, '#' + '" + hash + "');}"; |
| 27 |
} |
| 28 |
else { |
| 29 |
onShow = "onShow: function() { document.location.hash = '" + hash + "'; }"; |
| 30 |
} |
| 31 |
|
| 32 |
if (window.history && 'replaceState' in window.history) { |
| 33 |
afterHide = ", afterHide: function() { history.replaceState({}, document.title, location.href.substr(0, location.href.length-location.hash.length));} "; |
| 34 |
} |
| 35 |
else { |
| 36 |
afterHide = ", afterHide: function() {window.location.hash = '';}"; |
| 37 |
} |
| 38 |
$(a).attr('data-strip-options', onShow + afterHide); |
| 39 |
} |
| 40 |
}); |
| 41 |
}; |
| 42 |
} |