206 lines
22 KiB
JavaScript
206 lines
22 KiB
JavaScript
/******/ (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__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./vCarousel */ "./src/vCarousel.ts");
|
|
/// Exemple d'utilisation de vCarousel avec 3 vidéos
|
|
|
|
try {
|
|
// 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 :
|
|
if (window.location.hash !== undefined && window.location.hash !== "")
|
|
Object(_vCarousel__WEBPACK_IMPORTED_MODULE_0__["vCarousel"])(videosContainers_1, window.location.hash.replace("#", ""));
|
|
else
|
|
Object(_vCarousel__WEBPACK_IMPORTED_MODULE_0__["vCarousel"])(videosContainers_1); // le deuxième paramètre est facultatif sauf si on souhaite qu'une des vidéos soit affichée par défaut
|
|
// 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) {
|
|
Object(_vCarousel__WEBPACK_IMPORTED_MODULE_0__["vCarousel"])(videosContainers_1, link.hash.replace("#", ""));
|
|
});
|
|
};
|
|
for (var i = 0; i < selectLinks.length; i++) {
|
|
_loop_1(i);
|
|
}
|
|
}
|
|
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; });
|
|
/// 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 rester libre d'afficher plusieurs fois la même vidéo durant un tour du carrousel.
|
|
/// On peut éventuellement fournir l'id du conteneur de la première vidéo à afficher lors de l'appel
|
|
/// Ou encore indiqué qu'aucune ne doit être affichée sans action en passant une chaîne vide
|
|
/// Par défaut la première vidéo de la liste sera affichée
|
|
var vCarousel = function (vContainers, 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.
|
|
var realVContainers = [];
|
|
for (var _i = 0, vContainers_1 = vContainers; _i < vContainers_1.length; _i++) {
|
|
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);
|
|
else {
|
|
var checkVideoExist = document.querySelector("#" + containerId + " video");
|
|
if (checkVideoExist === null)
|
|
console.error("Aucune balise vidéo trouvée dans l'élément HTML ayant comme id " + containerId);
|
|
else
|
|
realVContainers.push({ id: containerId, containerElt: checkContainerExist, videoElt: checkVideoExist });
|
|
}
|
|
}
|
|
// Si firstVideoId a été fourni, on vérifie aussi qu'il est valide.
|
|
if (firstVideoId !== undefined && 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 = undefined;
|
|
}
|
|
// Il doit rester au moins deux vidéos à faire tourner.
|
|
var nbVContainers = realVContainers.length;
|
|
if (nbVContainers < 2)
|
|
console.error("Il faut fournir au moins deux conteneurs valides pour faire tourner le carrousel.");
|
|
else {
|
|
var _loop_1 = function (i) {
|
|
var vContainer = realVContainers[i].containerElt;
|
|
var video = realVContainers[i].videoElt;
|
|
if ((firstVideoId !== undefined && realVContainers[i].id !== firstVideoId) || (firstVideoId === undefined && i !== 0) || firstVideoId === "")
|
|
vContainer.style.display = "none";
|
|
else
|
|
vContainer.style.display = "block"; // nécessaire dans le cas d'un réaffichage.
|
|
video.addEventListener("ended", function () {
|
|
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.
|
|
window.location.assign("#" + nextHash);
|
|
});
|
|
};
|
|
// Tous les conteneurs sont cachés, sauf celui demandé.
|
|
// La fin de lecture d'une vidéo provoque son remplacement par la suivante.
|
|
for (var i = 0; i < nbVContainers; i++) {
|
|
_loop_1(i);
|
|
}
|
|
}
|
|
};
|
|
|
|
|
|
/***/ })
|
|
|
|
/******/ });
|
|
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vd2VicGFjay9ib290c3RyYXAiLCJ3ZWJwYWNrOi8vLy4vc3JjL2V4YW1wbGUudHMiLCJ3ZWJwYWNrOi8vLy4vc3JjL3ZDYXJvdXNlbC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO1FBQUE7UUFDQTs7UUFFQTtRQUNBOztRQUVBO1FBQ0E7UUFDQTtRQUNBO1FBQ0E7UUFDQTtRQUNBO1FBQ0E7UUFDQTtRQUNBOztRQUVBO1FBQ0E7O1FBRUE7UUFDQTs7UUFFQTtRQUNBO1FBQ0E7OztRQUdBO1FBQ0E7O1FBRUE7UUFDQTs7UUFFQTtRQUNBO1FBQ0E7UUFDQSwwQ0FBMEMsZ0NBQWdDO1FBQzFFO1FBQ0E7O1FBRUE7UUFDQTtRQUNBO1FBQ0Esd0RBQXdELGtCQUFrQjtRQUMxRTtRQUNBLGlEQUFpRCxjQUFjO1FBQy9EOztRQUVBO1FBQ0E7UUFDQTtRQUNBO1FBQ0E7UUFDQTtRQUNBO1FBQ0E7UUFDQTtRQUNBO1FBQ0E7UUFDQSx5Q0FBeUMsaUNBQWlDO1FBQzFFLGdIQUFn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XIgZmFpcmUgdG91cm5lciBsZSBjYXJyb3VzZWwuXCIpO1xuICAgIGVsc2Uge1xuICAgICAgICB2YXIgX2xvb3BfMSA9IGZ1bmN0aW9uIChpKSB7XG4gICAgICAgICAgICB2YXIgdkNvbnRhaW5lciA9IHJlYWxWQ29udGFpbmVyc1tpXS5jb250YWluZXJFbHQ7XG4gICAgICAgICAgICB2YXIgdmlkZW8gPSByZWFsVkNvbnRhaW5lcnNbaV0udmlkZW9FbHQ7XG4gICAgICAgICAgICBpZiAoKGZpcnN0VmlkZW9JZCAhPT0gdW5kZWZpbmVkICYmIHJlYWxWQ29udGFpbmVyc1tpXS5pZCAhPT0gZmlyc3RWaWRlb0lkKSB8fCAoZmlyc3RWaWRlb0lkID09PSB1bmRlZmluZWQgJiYgaSAhPT0gMCkgfHwgZmlyc3RWaWRlb0lkID09PSBcIlwiKVxuICAgICAgICAgICAgICAgIHZDb250YWluZXIuc3R5bGUuZGlzcGxheSA9IFwibm9uZVwiO1xuICAgICAgICAgICAgZWxzZVxuICAgICAgICAgICAgICAgIHZDb250YWluZXIuc3R5bGUuZGlzcGxheSA9IFwiYmxvY2tcIjsgLy8gbsOpY2Vzc2FpcmUgZGFucyBsZSBjYXMgZCd1biByw6lhZmZpY2hhZ2UuXG4gICAgICAgICAgICB2aWRlby5hZGRFdmVudExpc3RlbmVyKFwiZW5kZWRcIiwgZnVuY3Rpb24gKCkge1xuICAgICAgICAgICAgICAgIHZDb250YWluZXIuc3R5bGUuZGlzcGxheSA9IFwibm9uZVwiO1xuICAgICAgICAgICAgICAgIHZhciBuZXh0VkNvbnRhaW5lciwgbmV4dEhhc2g7XG4gICAgICAgICAgICAgICAgaWYgKGkgPCAobmJWQ29udGFpbmVycyAtIDEpKSB7XG4gICAgICAgICAgICAgICAgICAgIG5leHRWQ29udGFpbmVyID0gcmVhbFZDb250YWluZXJzW2kgKyAxXS5jb250YWluZXJFbHQ7XG4gICAgICAgICAgICAgICAgICAgIG5leHRIYXNoID0gcmVhbFZDb250YWluZXJzW2kgKyAxXS5pZDtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgIG5leHRWQ29udGFpbmVyID0gcmVhbFZDb250YWluZXJzWzBdLmNvbnRhaW5lckVsdDtcbiAgICAgICAgICAgICAgICAgICAgbmV4dEhhc2ggPSByZWFsVkNvbnRhaW5lcnNbMF0uaWQ7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIG5leHRWQ29udGFpbmVyLnN0eWxlLmRpc3BsYXkgPSBcImJsb2NrXCI7XG4gICAgICAgICAgICAgICAgLy8gT24gYWRhcHRlIGwnYW5jcmUgZGUgbCd1cmwgZGUgbWFuacOocmUgw6AgY2UgcXUnZWxsZSBzb2l0IGNvaMOpcmVudGUgYXZlYyBsYSB2aWTDqW8gYWZmaWNow6llLlxuICAgICAgICAgICAgICAgIC8vIEF0dGVudGlvbiBjYXIgY2VsYSBwZXV0IHByb3ZvcXVlciB1biBkw6lwbGFjZW1lbnQgZGFucyBsYSBwYWdlIGxhIHByZW1pw6hyZSBmb2lzIHBvdXIgYXR0ZWluZHJlIGwnYW5jcmUuXG4gICAgICAgICAgICAgICAgd2luZG93LmxvY2F0aW9uLmFzc2lnbihcIiNcIiArIG5leHRIYXNoKTtcbiAgICAgICAgICAgIH0pO1xuICAgICAgICB9O1xuICAgICAgICAvLyBUb3VzIGxlcyBjb250ZW5ldXJzIHNvbnQgY2FjaMOpcywgc2F1ZiBjZWx1aSBkZW1hbmTDqS5cbiAgICAgICAgLy8gTGEgZmluIGRlIGxlY3R1cmUgZCd1bmUgdmlkw6lvIHByb3ZvcXVlIHNvbiByZW1wbGFjZW1lbnQgcGFyIGxhIHN1aXZhbnRlLlxuICAgICAgICBmb3IgKHZhciBpID0gMDsgaSA8IG5iVkNvbnRhaW5lcnM7IGkrKykge1xuICAgICAgICAgICAgX2xvb3BfMShpKTtcbiAgICAgICAgfVxuICAgIH1cbn07XG4iXSwic291cmNlUm9vdCI6IiJ9
|