@unlk/keymaster 1.2.5 → 1.2.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +10 -0
- package/dist/css/keymaster.css +382 -17
- package/dist/css/keymaster.css.map +1 -1
- package/dist/css/keymaster.min.css +1 -1
- package/dist/css/keymaster.min.css.map +1 -1
- package/dist/js/keymaster.js +16 -43
- package/dist/js/keymaster.js.map +1 -1
- package/dist/js/keymaster.min.js +6 -6
- package/dist/js/keymaster.min.js.map +1 -1
- package/js/video-modal.js +20 -41
- package/package.json +1 -1
- package/scss/theme/_buttons.scss +74 -3
- package/scss/theme/mixins/_buttons.scss +66 -0
package/dist/js/keymaster.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Unlock Keymaster [object Object] v1.2.
|
|
2
|
+
* Unlock Keymaster [object Object] v1.2.7 (https://unlock-com.github.io/keymaster)
|
|
3
3
|
* Copyright 2022-2025 Unlk Developers
|
|
4
4
|
*/
|
|
5
5
|
(function (global, factory) {
|
|
@@ -7660,7 +7660,7 @@
|
|
|
7660
7660
|
defineJQueryPlugin(CarouselCaption);
|
|
7661
7661
|
|
|
7662
7662
|
const NAME = 'videoModal';
|
|
7663
|
-
const
|
|
7663
|
+
const EVENT_SHOW = 'show.bs.modal';
|
|
7664
7664
|
const EVENT_HIDDEN = 'hidden.bs.modal';
|
|
7665
7665
|
const SELECTOR_DIALOG = '.modal-dialog-media';
|
|
7666
7666
|
const SELECTOR_RATIO = '.ratio';
|
|
@@ -7700,58 +7700,36 @@
|
|
|
7700
7700
|
this._vimeoUrl = this._container.getAttribute('data-vimeo-url');
|
|
7701
7701
|
this._youtubePlayer = null;
|
|
7702
7702
|
this._vimeoPlayer = null;
|
|
7703
|
-
EventHandler.on(this._element,
|
|
7703
|
+
EventHandler.on(this._element, EVENT_SHOW, () => this._onShow());
|
|
7704
7704
|
EventHandler.on(this._element, EVENT_HIDDEN, () => this._onHide());
|
|
7705
7705
|
}
|
|
7706
7706
|
dispose() {
|
|
7707
7707
|
this._onHide();
|
|
7708
7708
|
super.dispose();
|
|
7709
7709
|
}
|
|
7710
|
-
async
|
|
7711
|
-
|
|
7712
|
-
|
|
7710
|
+
async _onShow() {
|
|
7711
|
+
const {
|
|
7712
|
+
id
|
|
7713
|
+
} = this._element;
|
|
7714
|
+
const playerID = `video-${id}-youtube-player`;
|
|
7713
7715
|
if (this._vimeoUrl) {
|
|
7714
7716
|
await vimeoAPIInitPromise;
|
|
7715
7717
|
const vimeoId = this._getVimeoId(this._vimeoUrl);
|
|
7716
|
-
if (!vimeoId) return;
|
|
7717
7718
|
this._vimeoPlayer = new window.Vimeo.Player(this._container, {
|
|
7718
7719
|
id: vimeoId,
|
|
7719
|
-
autoplay: true
|
|
7720
|
-
muted: true,
|
|
7721
|
-
playsinline: true,
|
|
7722
|
-
dnt: true
|
|
7720
|
+
autoplay: true
|
|
7723
7721
|
});
|
|
7724
|
-
|
|
7722
|
+
return;
|
|
7725
7723
|
}
|
|
7726
7724
|
if (this._youtubeSrc) {
|
|
7727
7725
|
await youTubeAPIInitPromise;
|
|
7728
7726
|
const youtubeId = this._getYouTubeId(this._youtubeSrc);
|
|
7729
|
-
|
|
7730
|
-
console.warn('[VideoModal] No YouTube ID parsed from', this._youtubeSrc);
|
|
7731
|
-
return;
|
|
7732
|
-
}
|
|
7733
|
-
const playerDiv = document.createElement('div');
|
|
7734
|
-
playerDiv.className = 'w-100 h-100';
|
|
7735
|
-
this._container.appendChild(playerDiv);
|
|
7727
|
+
const playerDiv = this._container.querySelector(`#${playerID}`);
|
|
7736
7728
|
this._youtubePlayer = new window.YT.Player(playerDiv, {
|
|
7737
7729
|
videoId: youtubeId,
|
|
7738
|
-
host: 'https://www.youtube-nocookie.com',
|
|
7739
7730
|
playerVars: {
|
|
7740
7731
|
autoplay: 1,
|
|
7741
|
-
rel: 0
|
|
7742
|
-
playsinline: 1,
|
|
7743
|
-
origin: window.location.origin
|
|
7744
|
-
},
|
|
7745
|
-
events: {
|
|
7746
|
-
onReady: e => {
|
|
7747
|
-
try {
|
|
7748
|
-
e.target.mute();
|
|
7749
|
-
} catch {}
|
|
7750
|
-
try {
|
|
7751
|
-
e.target.playVideo();
|
|
7752
|
-
} catch {}
|
|
7753
|
-
},
|
|
7754
|
-
onError: e => console.warn('[VideoModal] YT error', e?.data)
|
|
7732
|
+
rel: 0
|
|
7755
7733
|
}
|
|
7756
7734
|
});
|
|
7757
7735
|
}
|
|
@@ -7762,21 +7740,16 @@
|
|
|
7762
7740
|
this._vimeoPlayer = null;
|
|
7763
7741
|
}
|
|
7764
7742
|
if (this._youtubePlayer) {
|
|
7765
|
-
|
|
7766
|
-
this._youtubePlayer.destroy();
|
|
7767
|
-
} catch {}
|
|
7743
|
+
this._youtubePlayer.destroy();
|
|
7768
7744
|
this._youtubePlayer = null;
|
|
7769
7745
|
}
|
|
7770
|
-
this._container.innerHTML = '';
|
|
7771
7746
|
}
|
|
7772
7747
|
_getYouTubeId(url) {
|
|
7773
|
-
|
|
7774
|
-
|
|
7775
|
-
const m = String(url).match(/(?:v=|youtu\.be\/|embed\/|shorts\/)([\w-]{11})/);
|
|
7776
|
-
return m ? m[1] : '';
|
|
7748
|
+
const match = url.match(/(?:youtube\.com\/(?:watch\?v=|embed\/|v\/)|youtu\.be\/)([\w-]{11})/);
|
|
7749
|
+
return match ? match[1] : '';
|
|
7777
7750
|
}
|
|
7778
7751
|
_getVimeoId(url) {
|
|
7779
|
-
const match =
|
|
7752
|
+
const match = url.match(/vimeo\.com\/(\d+)/);
|
|
7780
7753
|
return match ? match[1] : '';
|
|
7781
7754
|
}
|
|
7782
7755
|
static get NAME() {
|