245 lines
22 KiB
JavaScript
245 lines
22 KiB
JavaScript
/******/ (() => { // webpackBootstrap
|
|
/******/ var __webpack_modules__ = ({
|
|
|
|
/***/ "./src/vCarousel.ts":
|
|
/*!**************************!*\
|
|
!*** ./src/vCarousel.ts ***!
|
|
\**************************/
|
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
|
|
"use strict";
|
|
__webpack_require__.r(__webpack_exports__);
|
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
/* harmony export */ "vCarousel": () => (/* binding */ vCarousel)
|
|
/* harmony export */ });
|
|
var errors = __webpack_require__(/*! ./errors.js */ "./src/errors.js");
|
|
var vCarousel = (function () {
|
|
function vCarousel() {
|
|
this._vContainers = [];
|
|
this._firstVideoId = undefined;
|
|
this._playFirstVideo = false;
|
|
this._playNextVideos = false;
|
|
this._noStop = false;
|
|
this.nbVContainers = 0;
|
|
this._currentVideo = undefined;
|
|
}
|
|
Object.defineProperty(vCarousel.prototype, "vContainers", {
|
|
set: function (vContainersIds) {
|
|
for (var _i = 0, vContainersIds_1 = vContainersIds; _i < vContainersIds_1.length; _i++) {
|
|
var containerId = vContainersIds_1[_i];
|
|
var checkContainerExist = document.getElementById(containerId);
|
|
if (checkContainerExist === null)
|
|
throw new Error(errors.elementNotFound + containerId);
|
|
else {
|
|
var checkVideoExist = document.querySelector("#" + containerId + " video");
|
|
if (checkVideoExist === null)
|
|
throw new Error(errors.videoNotFound + containerId);
|
|
else
|
|
this._vContainers.push({ id: containerId, containerElt: checkContainerExist, videoElt: checkVideoExist });
|
|
}
|
|
}
|
|
this.nbVContainers = this._vContainers.length;
|
|
if (this.nbVContainers < 2)
|
|
throw new Error(errors.need2Videos);
|
|
},
|
|
enumerable: false,
|
|
configurable: true
|
|
});
|
|
Object.defineProperty(vCarousel.prototype, "firstVideoId", {
|
|
get: function () {
|
|
return this._firstVideoId;
|
|
},
|
|
set: function (firstVideo) {
|
|
if ((firstVideo !== undefined && firstVideo !== "" && this._vContainers.findIndex(function (video) { return video.id === firstVideo; }) !== -1) || (firstVideo === ""))
|
|
this._firstVideoId = firstVideo;
|
|
},
|
|
enumerable: false,
|
|
configurable: true
|
|
});
|
|
Object.defineProperty(vCarousel.prototype, "playFirstVideo", {
|
|
set: function (playFirstVideo) {
|
|
this._playFirstVideo = playFirstVideo;
|
|
},
|
|
enumerable: false,
|
|
configurable: true
|
|
});
|
|
Object.defineProperty(vCarousel.prototype, "playNextVideos", {
|
|
set: function (playNextVideos) {
|
|
this._playNextVideos = playNextVideos;
|
|
},
|
|
enumerable: false,
|
|
configurable: true
|
|
});
|
|
Object.defineProperty(vCarousel.prototype, "noStop", {
|
|
set: function (noStop) {
|
|
this._noStop = noStop;
|
|
},
|
|
enumerable: false,
|
|
configurable: true
|
|
});
|
|
Object.defineProperty(vCarousel.prototype, "currentVideo", {
|
|
get: function () {
|
|
return this._currentVideo;
|
|
},
|
|
enumerable: false,
|
|
configurable: true
|
|
});
|
|
vCarousel.prototype.run = function () {
|
|
var vCarousel = this;
|
|
if (vCarousel.nbVContainers < 2)
|
|
throw new Error(errors.needVideosProvided);
|
|
var _loop_1 = function (i) {
|
|
var vContainer = vCarousel._vContainers[i].containerElt;
|
|
var video = vCarousel._vContainers[i].videoElt;
|
|
if ((vCarousel._firstVideoId !== undefined && vCarousel._vContainers[i].id !== vCarousel._firstVideoId) || (vCarousel._firstVideoId === undefined && i !== 0) || vCarousel._firstVideoId === "")
|
|
vContainer.style.display = "none";
|
|
else {
|
|
if (vCarousel._currentVideo !== undefined && !vCarousel._currentVideo.paused)
|
|
vCarousel._currentVideo.pause();
|
|
vContainer.style.display = "block";
|
|
vCarousel._currentVideo = video;
|
|
if (vCarousel._playFirstVideo === true)
|
|
video.play();
|
|
}
|
|
nbTurn = 0;
|
|
video.addEventListener("ended", function () {
|
|
if (nbTurn < (vCarousel.nbVContainers - 1) || vCarousel._noStop === true) {
|
|
vContainer.style.display = "none";
|
|
var nextVContainer = void 0, nextVideo = void 0, nextHash = void 0, nextOne = 0;
|
|
if (i < (vCarousel.nbVContainers - 1))
|
|
nextOne = i + 1;
|
|
nextVContainer = vCarousel._vContainers[nextOne].containerElt;
|
|
nextVideo = vCarousel._vContainers[nextOne].videoElt;
|
|
nextHash = vCarousel._vContainers[nextOne].id;
|
|
nextVContainer.style.display = "block";
|
|
vCarousel._currentVideo = nextVideo;
|
|
window.location.assign("#" + nextHash);
|
|
if (vCarousel._playNextVideos === true)
|
|
nextVideo.play();
|
|
nbTurn++;
|
|
}
|
|
});
|
|
};
|
|
var nbTurn;
|
|
for (var i = 0; i < vCarousel.nbVContainers; i++) {
|
|
_loop_1(i);
|
|
}
|
|
};
|
|
return vCarousel;
|
|
}());
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ "./src/errors.js":
|
|
/*!***********************!*\
|
|
!*** ./src/errors.js ***!
|
|
\***********************/
|
|
/***/ ((module) => {
|
|
|
|
module.exports =
|
|
{
|
|
elementNotFound : "Aucun élément HTML trouvé dans la page pour l'id : ",
|
|
videoNotFound: "Aucune balise vidéo trouvée dans l'élément HTML ayant comme id : ",
|
|
need2Videos: "Il vous faut fournir au moins deux conteneurs de vidéo valides pour pouvoir lancer le carrousel.",
|
|
needVideosProvided: "vCarousel ne peut être lancé sans avoir fourni les vidéos concernées."
|
|
};
|
|
|
|
/***/ })
|
|
|
|
/******/ });
|
|
/************************************************************************/
|
|
/******/ // The module cache
|
|
/******/ var __webpack_module_cache__ = {};
|
|
/******/
|
|
/******/ // The require function
|
|
/******/ function __webpack_require__(moduleId) {
|
|
/******/ // Check if module is in cache
|
|
/******/ var cachedModule = __webpack_module_cache__[moduleId];
|
|
/******/ if (cachedModule !== undefined) {
|
|
/******/ return cachedModule.exports;
|
|
/******/ }
|
|
/******/ // Create a new module (and put it into the cache)
|
|
/******/ var module = __webpack_module_cache__[moduleId] = {
|
|
/******/ // no module.id needed
|
|
/******/ // no module.loaded needed
|
|
/******/ exports: {}
|
|
/******/ };
|
|
/******/
|
|
/******/ // Execute the module function
|
|
/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
|
|
/******/
|
|
/******/ // Return the exports of the module
|
|
/******/ return module.exports;
|
|
/******/ }
|
|
/******/
|
|
/************************************************************************/
|
|
/******/ /* webpack/runtime/define property getters */
|
|
/******/ (() => {
|
|
/******/ // define getter functions for harmony exports
|
|
/******/ __webpack_require__.d = (exports, definition) => {
|
|
/******/ for(var key in definition) {
|
|
/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
|
|
/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
|
|
/******/ }
|
|
/******/ }
|
|
/******/ };
|
|
/******/ })();
|
|
/******/
|
|
/******/ /* webpack/runtime/hasOwnProperty shorthand */
|
|
/******/ (() => {
|
|
/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
|
|
/******/ })();
|
|
/******/
|
|
/******/ /* webpack/runtime/make namespace object */
|
|
/******/ (() => {
|
|
/******/ // define __esModule on exports
|
|
/******/ __webpack_require__.r = (exports) => {
|
|
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
|
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
/******/ }
|
|
/******/ Object.defineProperty(exports, '__esModule', { value: true });
|
|
/******/ };
|
|
/******/ })();
|
|
/******/
|
|
/************************************************************************/
|
|
var __webpack_exports__ = {};
|
|
// This entry need to be wrapped in an IIFE because it need to be in strict mode.
|
|
(() => {
|
|
"use strict";
|
|
/*!************************!*\
|
|
!*** ./src/example.ts ***!
|
|
\************************/
|
|
__webpack_require__.r(__webpack_exports__);
|
|
/* harmony import */ var _vCarousel__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./vCarousel */ "./src/vCarousel.ts");
|
|
|
|
try {
|
|
var videosContainers = ["vFunanbule", "vForgeron", "vCircuit"];
|
|
var testvCarousel_1 = new _vCarousel__WEBPACK_IMPORTED_MODULE_0__.vCarousel();
|
|
testvCarousel_1.vContainers = videosContainers;
|
|
if (window.location.hash !== undefined && window.location.hash !== "")
|
|
testvCarousel_1.firstVideoId = window.location.hash.replace("#", "");
|
|
testvCarousel_1.run();
|
|
var selectLinks = document.querySelectorAll(".selectVideo");
|
|
var _loop_1 = function (i) {
|
|
var link = selectLinks[i];
|
|
link.addEventListener("click", function (e) {
|
|
testvCarousel_1.firstVideoId = link.hash.replace("#", "");
|
|
testvCarousel_1.playFirstVideo = true;
|
|
testvCarousel_1.run();
|
|
});
|
|
};
|
|
for (var i = 0; i < selectLinks.length; i++) {
|
|
_loop_1(i);
|
|
}
|
|
}
|
|
catch (e) {
|
|
console.error(e);
|
|
}
|
|
|
|
})();
|
|
|
|
/******/ })()
|
|
;
|
|
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiLi9KUy9leGFtcGxlLmFwcC5qcyIsIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7Ozs7OztBQUFBLGFBQWEsbUJBQU8sQ0FBQyxvQ0FBYTtBQUNsQztBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQSxnRUFBZ0UsOEJBQThCO0FBQzlGO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBLGlEQUFpRCwrRUFBK0U7QUFDaEk7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBLFNBQVM7QUFDVDtBQUNBO0FBQ0EsS0FBSztBQUNMO0FBQ0E7QUFDQTtBQUNBLFNBQVM7QUFDVDtBQUNBLGlIQUFpSCxpQ0FBaUM7QUFDbEo7QUFDQSxTQUFTO0FBQ1Q7QUFDQTtBQUNBLEtBQUs7QUFDTDtBQUNBO0FBQ0E7QUFDQSxTQUFTO0FBQ1Q7QUFDQTtBQUNBLEtBQUs7QUFDTDt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gICAgdGhpcy5fY3VycmVudFZpZGVvID0gdW5kZWZpbmVkO1xuICAgIH1cbiAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkodkNhcm91c2VsLnByb3RvdHlwZSwgXCJ2Q29udGFpbmVyc1wiLCB7XG4gICAgICAgIHNldDogZnVuY3Rpb24gKHZDb250YWluZXJzSWRzKSB7XG4gICAgICAgICAgICBmb3IgKHZhciBfaSA9IDAsIHZDb250YWluZXJzSWRzXzEgPSB2Q29udGFpbmVyc0lkczsgX2kgPCB2Q29udGFpbmVyc0lkc18xLmxlbmd0aDsgX2krKykge1xuICAgICAgICAgICAgICAgIHZhciBjb250YWluZXJJZCA9IHZDb250YWluZXJzSWRzXzFbX2ldO1xuICAgICAgICAgICAgICAgIHZhciBjaGVja0NvbnRhaW5lckV4aXN0ID0gZG9jdW1lbnQuZ2V0RWxlbWVudEJ5SWQoY29udGFpbmVySWQpO1xuICAgICAgICAgICAgICAgIGlmIChjaGVja0NvbnRhaW5lckV4aXN0ID09PSBudWxsKVxuICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoZXJyb3JzLmVsZW1lbnROb3RGb3VuZCArIGNvbnRhaW5lcklkKTtcbiAgICAgICAgICAgICAgICBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgdmFyIGNoZWNrVmlkZW9FeGlzdCA9IGRvY3VtZW50LnF1ZXJ5U2VsZWN0b3IoXCIjXCIgKyBjb250YWluZXJJZCArIFwiIHZpZGVvXCIpO1xuICAgICAgICAgICAgICAgICAgICBpZiAoY2hlY2tWaWRlb0V4aXN0ID09PSBudWxsKVxuICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKGVycm9ycy52aWRlb05vdEZvdW5kICsgY29udGFpbmVySWQpO1xuICAgICAgICAgICAgICAgICAgICBlbHNlXG4gICAgICAgICAgICAgICAgICAgICAgICB0aGlzLl92Q29udGFpbmVycy5wdXNoKHsgaWQ6IGNvbnRhaW5lcklkLCBjb250YWluZXJFbHQ6IGNoZWNrQ29udGFpbmVyRXhpc3QsIHZpZGVvRWx0OiBjaGVja1ZpZGVvRXhpc3QgfSk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICAgICAgdGhpcy5uYlZDb250YWluZXJzID0gdGhpcy5fdkNvbnRhaW5lcnMubGVuZ3RoO1xuICAgICAgICAgICAgaWYgKHRoaXMubmJWQ29udGFpbmVycyA8IDIpXG4gICAgICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKGVycm9ycy5uZWVkMlZpZGVvcyk7XG4gICAgICAgIH0sXG4gICAgICAgIGVudW1lcmFibGU6IGZhbHNlLFxuICAgICAgICBjb25maWd1cmFibGU6IHRydWVcbiAgICB9KTtcbiAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkodkNhcm91c2VsLnByb3RvdHlwZSwgXCJmaXJzdFZpZGVvSWRcIiwge1xuICAgICAgICBnZXQ6IGZ1bmN0aW9uICgpIHtcbiAgICAgICAgICAgIHJldHVybiB0aGlzLl9maXJzdFZpZGVvSWQ7XG4gICAgICAgIH0sXG4gICAgICAgIHNldDogZnVuY3Rpb24gKGZpcnN0VmlkZW8pIHtcbiAgICAgICAgICAgIGlmICgoZmlyc3RWaWRlbyAhPT0gdW5kZWZpbmVkICYmIGZpcnN0VmlkZW8gIT09IFwiXCIgJiYgdGhpcy5fdkNvbnRhaW5lcnMuZmluZEluZGV4KGZ1bmN0aW9uICh2aWRlbykgeyByZXR1cm4gdmlkZW8uaWQgPT09IGZpcnN0VmlkZW87IH0pICE9PSAtMSkgfHwgKGZpcnN0VmlkZW8gPT09IFwiXCIpKVxuICAgICAgICAgICAgICAgIHRoaXMuX2ZpcnN0VmlkZW9JZCA9IGZpcnN0VmlkZW87XG4gICAgICAgIH0sXG4gICAgICAgIGVudW1lcmFibGU6IGZhbHNlLFxuICAgICAgICBjb25maWd1cmFibGU6IHRydWVcbiAgICB9KTtcbiAgICBPYmplY3QuZGVmaW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uICAgICAgICAgICAgICAgIHZDb250YWluZXIuc3R5bGUuZGlzcGxheSA9IFwiYmxvY2tcIjtcbiAgICAgICAgICAgICAgICB2Q2Fyb3VzZWwuX2N1cnJlbnRWaWRlbyA9IHZpZGVvO1xuICAgICAgICAgICAgICAgIGlmICh2Q2Fyb3VzZWwuX3BsYXlGaXJzdFZpZGVvID09PSB0cnVlKVxuICAgICAgICAgICAgICAgICAgICB2aWRlby5wbGF5KCk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBuYlR1cm4gPSAwO1xuICAgICAgICAgICAgdmlkZW8uYWRkRXZlbnRMaXN0ZW5lcihcImVuZGVkXCIsIGZ1bmN0aW9uICgpIHtcbiAgICAgICAgICAgICAgICBpZiAobmJUdXJuIDwgKHZDYXJvdXNlbC5uYlZDb250YWluZXJzIC0gMSkgfHwgdkNhcm91c2VsLl9ub1N0b3AgPT09IHRydWUpIHtcbiAgICAgICAgICAgICAgICAgICAgdkNvbnRhaW5lci5zdHlsZS5kaXNwbGF5ID0gXCJub25lXCI7XG4gICAgICAgICAgICAgICAgICAgIHZhciBuZXh0VkNvbnRhaW5lciA9IHZvaWQgMCwgbmV4dFZpZGVvID0gdm9pZCAwLCBuZXh0SGFzaCA9IHZvaWQgMCwgbmV4dE9uZSA9IDA7XG4gICAgICAgICAgICAgICAgICAgIGlmIChpIDwgKHZDYXJvdXNlbC5uYlZDb250YWluZXJzIC0gMSkpXG4gICAgICAgICAgICAgICAgICAgICAgICBuZXh0T25lID0gaSArIDE7XG4gICAgICAgICAgICAgICAgICAgIG5leHRWQ29udGFpbmVyID0gdkNhcm91c2VsLl92Q29udGFpbmVyc1tuZXh0T25lXS5jb250YWluZXJFbHQ7XG4gICAgICAgICAgICAgICAgICAgIG5leHRWaWRlbyA9IHZDYXJvdXNlbC5fdkNvbnRhaW5lcnNbbmV4dE9uZV0udmlkZW9FbHQ7XG4gICAgICAgICAgICAgICAgICAgIG5leHRIYXNoID0gdkNhcm91c2VsLl92Q29udG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