2021-03-31 18:14:03 +02:00
|
|
|
/******/ (function(modules) { // webpackBootstrap
|
|
|
|
/******/ // The module cache
|
|
|
|
/******/ var installedModules = {};
|
|
|
|
/******/
|
|
|
|
/******/ // The require function
|
|
|
|
/******/ function __webpack_require__(moduleId) {
|
|
|
|
/******/
|
|
|
|
/******/ // Check if module is in cache
|
|
|
|
/******/ if(installedModules[moduleId]) {
|
|
|
|
/******/ return installedModules[moduleId].exports;
|
|
|
|
/******/ }
|
|
|
|
/******/ // Create a new module (and put it into the cache)
|
|
|
|
/******/ var module = installedModules[moduleId] = {
|
|
|
|
/******/ i: moduleId,
|
|
|
|
/******/ l: false,
|
|
|
|
/******/ exports: {}
|
|
|
|
/******/ };
|
|
|
|
/******/
|
|
|
|
/******/ // Execute the module function
|
|
|
|
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
|
|
|
/******/
|
|
|
|
/******/ // Flag the module as loaded
|
|
|
|
/******/ module.l = true;
|
|
|
|
/******/
|
|
|
|
/******/ // Return the exports of the module
|
|
|
|
/******/ return module.exports;
|
|
|
|
/******/ }
|
|
|
|
/******/
|
|
|
|
/******/
|
|
|
|
/******/ // expose the modules object (__webpack_modules__)
|
|
|
|
/******/ __webpack_require__.m = modules;
|
|
|
|
/******/
|
|
|
|
/******/ // expose the module cache
|
|
|
|
/******/ __webpack_require__.c = installedModules;
|
|
|
|
/******/
|
|
|
|
/******/ // define getter function for harmony exports
|
|
|
|
/******/ __webpack_require__.d = function(exports, name, getter) {
|
|
|
|
/******/ if(!__webpack_require__.o(exports, name)) {
|
|
|
|
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
|
|
|
|
/******/ }
|
|
|
|
/******/ };
|
|
|
|
/******/
|
|
|
|
/******/ // define __esModule on exports
|
|
|
|
/******/ __webpack_require__.r = function(exports) {
|
|
|
|
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
|
|
|
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
|
/******/ }
|
|
|
|
/******/ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
|
/******/ };
|
|
|
|
/******/
|
|
|
|
/******/ // create a fake namespace object
|
|
|
|
/******/ // mode & 1: value is a module id, require it
|
|
|
|
/******/ // mode & 2: merge all properties of value into the ns
|
|
|
|
/******/ // mode & 4: return value when already ns object
|
|
|
|
/******/ // mode & 8|1: behave like require
|
|
|
|
/******/ __webpack_require__.t = function(value, mode) {
|
|
|
|
/******/ if(mode & 1) value = __webpack_require__(value);
|
|
|
|
/******/ if(mode & 8) return value;
|
|
|
|
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
|
|
|
|
/******/ var ns = Object.create(null);
|
|
|
|
/******/ __webpack_require__.r(ns);
|
|
|
|
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
|
|
|
|
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
|
|
|
|
/******/ return ns;
|
|
|
|
/******/ };
|
|
|
|
/******/
|
|
|
|
/******/ // getDefaultExport function for compatibility with non-harmony modules
|
|
|
|
/******/ __webpack_require__.n = function(module) {
|
|
|
|
/******/ var getter = module && module.__esModule ?
|
|
|
|
/******/ function getDefault() { return module['default']; } :
|
|
|
|
/******/ function getModuleExports() { return module; };
|
|
|
|
/******/ __webpack_require__.d(getter, 'a', getter);
|
|
|
|
/******/ return getter;
|
|
|
|
/******/ };
|
|
|
|
/******/
|
|
|
|
/******/ // Object.prototype.hasOwnProperty.call
|
|
|
|
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
|
|
|
|
/******/
|
|
|
|
/******/ // __webpack_public_path__
|
|
|
|
/******/ __webpack_require__.p = "";
|
|
|
|
/******/
|
|
|
|
/******/
|
|
|
|
/******/ // Load entry module and return exports
|
|
|
|
/******/ return __webpack_require__(__webpack_require__.s = "./src/example.ts");
|
|
|
|
/******/ })
|
|
|
|
/************************************************************************/
|
|
|
|
/******/ ({
|
|
|
|
|
|
|
|
/***/ "./src/example.ts":
|
|
|
|
/*!************************!*\
|
|
|
|
!*** ./src/example.ts ***!
|
|
|
|
\************************/
|
|
|
|
/*! no exports provided */
|
|
|
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
|
|
|
|
|
|
"use strict";
|
|
|
|
__webpack_require__.r(__webpack_exports__);
|
|
|
|
/* harmony import */ var _vCarousel_ts__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./vCarousel.ts */ "./src/vCarousel.ts");
|
|
|
|
/// Exemple d'utilisation de vCarousel avec 3 vidéos
|
|
|
|
|
|
|
|
try {
|
2021-04-01 12:58:47 +02:00
|
|
|
// Liste des id des contenants des vidéos à afficher :
|
|
|
|
var videosContainers_1 = ["vFunanbule", "vForgeron", "vCircuit"];
|
|
|
|
// Si un id est fourni par l'url, on affiche cette vidéo en premier :
|
|
|
|
var wantedVideo_1 = "";
|
|
|
|
if (window.location.hash !== undefined)
|
|
|
|
wantedVideo_1 = window.location.hash.replace("#", "");
|
|
|
|
Object(_vCarousel_ts__WEBPACK_IMPORTED_MODULE_0__["vCarousel"])(videosContainers_1, wantedVideo_1);
|
|
|
|
// Dans le cas où l'utilisateur clique pour sélectionner une vidéo à afficher, on actualise l'affichage :
|
|
|
|
var selectLinks = document.querySelectorAll(".selectVideo");
|
|
|
|
var _loop_1 = function (i) {
|
|
|
|
var link = selectLinks[i];
|
|
|
|
link.addEventListener("click", function (e) {
|
|
|
|
wantedVideo_1 = link.hash.replace("#", "");
|
|
|
|
Object(_vCarousel_ts__WEBPACK_IMPORTED_MODULE_0__["vCarousel"])(videosContainers_1, wantedVideo_1);
|
|
|
|
});
|
|
|
|
};
|
|
|
|
for (var i = 0; i < selectLinks.length; i++) {
|
|
|
|
_loop_1(i);
|
|
|
|
}
|
2021-03-31 18:14:03 +02:00
|
|
|
}
|
|
|
|
catch (e) {
|
|
|
|
console.error(e);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
/***/ "./src/vCarousel.ts":
|
|
|
|
/*!**************************!*\
|
|
|
|
!*** ./src/vCarousel.ts ***!
|
|
|
|
\**************************/
|
|
|
|
/*! exports provided: vCarousel */
|
|
|
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
|
|
|
|
|
|
"use strict";
|
|
|
|
__webpack_require__.r(__webpack_exports__);
|
|
|
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "vCarousel", function() { return vCarousel; });
|
2021-04-01 12:58:47 +02:00
|
|
|
/// La fonction vCarousel reçoit un tableau d'ids des conteneurs HTML des vidéos à afficher successivement.
|
|
|
|
/// Le tableau n'est pas dédoublonné, pour reste libre d'afficher plusieurs fois la même vidéo durant un tour du carrousel
|
|
|
|
/// On peut éventuellement fournir l'id de la première vidéo à afficher.
|
|
|
|
var vCarousel = function (vContainers, firstVideoId) {
|
|
|
|
if (firstVideoId === void 0) { firstVideoId = ""; }
|
|
|
|
// On commence par vérifier que les ids de conteneurs fournis sont correctes.
|
|
|
|
// C'est-à-dire qu'il s'agit bien d'éléments HTML contenant au moins une vidéo.
|
2021-03-31 18:14:03 +02:00
|
|
|
var realVContainers = [];
|
|
|
|
for (var _i = 0, vContainers_1 = vContainers; _i < vContainers_1.length; _i++) {
|
2021-04-01 12:58:47 +02:00
|
|
|
var containerId = vContainers_1[_i];
|
|
|
|
var checkContainerExist = document.getElementById(containerId);
|
|
|
|
if (checkContainerExist === null)
|
|
|
|
console.error("Aucun élément HTML trouvé dans la page pour l'id fourni " + containerId);
|
2021-03-31 18:14:03 +02:00
|
|
|
else {
|
2021-04-01 12:58:47 +02:00
|
|
|
var checkVideoExist = document.querySelector("#" + containerId + " video");
|
2021-03-31 18:14:03 +02:00
|
|
|
if (checkVideoExist === null)
|
2021-04-01 12:58:47 +02:00
|
|
|
console.error("Aucune balise vidéo trouvée dans l'élément HTML ayant comme id " + containerId);
|
2021-03-31 18:14:03 +02:00
|
|
|
else
|
2021-04-01 12:58:47 +02:00
|
|
|
realVContainers.push({ id: containerId, containerElt: checkContainerExist, videoElt: checkVideoExist });
|
2021-03-31 18:14:03 +02:00
|
|
|
}
|
|
|
|
}
|
2021-04-01 12:58:47 +02:00
|
|
|
// Si firstVideoId a été fourni, on vérifie aussi qu'il est valide.
|
|
|
|
if (firstVideoId !== "" && (realVContainers.findIndex(function (video) { return video.id === firstVideoId; }) === -1)) {
|
|
|
|
console.error("Vous avez fourni l'id de la vidéo à afficher en premier (" + firstVideoId + "), mais il n'est pas valide.");
|
|
|
|
firstVideoId = "";
|
|
|
|
}
|
|
|
|
// Il doit rester au moins deux vidéos
|
|
|
|
var nbVContainers = realVContainers.length;
|
|
|
|
if (nbVContainers < 2)
|
2021-03-31 18:14:03 +02:00
|
|
|
console.error("Il faut fournir au moins deux conteneurs valides pour faire tourner le carrousel.");
|
|
|
|
else {
|
|
|
|
var _loop_1 = function (i) {
|
2021-04-01 12:58:47 +02:00
|
|
|
var vContainer = realVContainers[i].containerElt;
|
2021-03-31 18:14:03 +02:00
|
|
|
var video = realVContainers[i].videoElt;
|
2021-04-01 12:58:47 +02:00
|
|
|
if ((firstVideoId !== "" && realVContainers[i].id !== firstVideoId) || (firstVideoId == "" && i !== 0))
|
|
|
|
vContainer.style.display = "none";
|
|
|
|
else
|
|
|
|
vContainer.style.display = "block"; // nécessaire dans le cas d'un réaffichage
|
2021-03-31 18:14:03 +02:00
|
|
|
video.addEventListener("ended", function () {
|
2021-04-01 12:58:47 +02:00
|
|
|
vContainer.style.display = "none";
|
|
|
|
var nextVContainer, nextHash;
|
|
|
|
if (i < (nbVContainers - 1)) {
|
|
|
|
nextVContainer = realVContainers[i + 1].containerElt;
|
|
|
|
nextHash = realVContainers[i + 1].id;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
nextVContainer = realVContainers[0].containerElt;
|
|
|
|
nextHash = realVContainers[0].id;
|
|
|
|
}
|
|
|
|
nextVContainer.style.display = "block";
|
|
|
|
// On adapte l'ancre de l'url de manière à ce qu'elle soit cohérente avec la vidéo affichée
|
|
|
|
// Attention car cela peut provoquer un déplacement dans la page la première fois pour atteindre l'ancre (à revoir)
|
|
|
|
window.location.assign("#" + nextHash);
|
2021-03-31 18:14:03 +02:00
|
|
|
});
|
|
|
|
};
|
2021-04-01 12:58:47 +02:00
|
|
|
// Tous les conteneurs sont cachés, sauf celui demandé
|
|
|
|
// La fin de lecture d'une vidéo provoque l'affichage du suivant
|
|
|
|
for (var i = 0; i < nbVContainers; i++) {
|
2021-03-31 18:14:03 +02:00
|
|
|
_loop_1(i);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/***/ })
|
|
|
|
|
|
|
|
/******/ });
|
2021-04-01 12:58:47 +02:00
|
|
|
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vd2VicGFjay9ib290c3RyYXAiLCJ3ZWJwYWNrOi8vLy4vc3JjL2V4YW1wbGUudHMiLCJ3ZWJwYWNrOi8vLy4vc3JjL3ZDYXJvdXNlbC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO1FBQUE7UUFDQTs7UUFFQTtRQUNBOztRQUVBO1FBQ0E7UUFDQTtRQUNBO1FBQ0E7UUFDQTtRQUNBO1FBQ0E7UUFDQTtRQUNBOztRQUVBO1FBQ0E7O1FBRUE7UUFDQTs7UUFFQTtRQUNBO1FBQ0E7OztRQUdBO1FBQ0E7O1FBRUE7UUFDQTs7UUFFQTtRQUNBO1FBQ0E7UUFDQSwwQ0FBMEMsZ0NBQWdDO1FBQzFFO1FBQ0E7O1FBRUE7UUFDQTtRQUNBO1FBQ0Esd0RBQXdELGtCQUFrQjtRQUMxRTtRQUNBLGlEQUFpRCxjQUFjO1FBQy9EOztRQUVBO1FBQ0E7UUFDQTtRQUNBO1FBQ0E7UUF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