From 515c898a8e0420dfcbee7d983c82094f06e08134 Mon Sep 17 00:00:00 2001 From: Victor Häggqvist Date: Sat, 16 Jan 2016 22:41:39 +0100 Subject: --git-dir=../.git 9e7b91f --- Gruntfile.js | 89 -- LightBox.ActivityIndicator.js | 106 +++ LightBox.Captions.js | 108 +++ LightBox.CloseButton.js | 113 +++ LightBox.Core.js | 851 ++++++++++++++++++ LightBox.Navigation.js | 138 +++ LightBox.Overlay.js | 96 ++ Vagrantfile | 124 --- bower.json | 19 - build.sh | 2 - demo.js | 125 --- images.md | 22 - images.php | 34 - images/original/12173370053_39624f5dc6_o.jpg | Bin 115955 -> 0 bytes images/original/14448239362_53203a94bf_o.jpg | Bin 1393294 -> 0 bytes images/original/14459672716_2fd51d6133_o.jpg | Bin 9687146 -> 0 bytes images/original/14461842031_f854d30f15_o.jpg | Bin 786744 -> 0 bytes images/original/1483066391_ba9ceea56a_o.jpg | Bin 2642724 -> 0 bytes images/original/3155078790_b365637b61_o.jpg | Bin 1195618 -> 0 bytes images/original/443441197_c38caf32ee_o.jpg | Bin 136371 -> 0 bytes images/original/4436427104_9cd5f0daba_o.jpg | Bin 11796632 -> 0 bytes images/original/4440609236_fbfbe396b5_o.jpg | Bin 502329 -> 0 bytes images/original/5578985145_640f215e42_o.jpg | Bin 1683646 -> 0 bytes images/original/6178731018_10e6fd6a9d_o.jpg | Bin 8697212 -> 0 bytes images/original/6260329772_7ce10ac83c_o.jpg | Bin 4096753 -> 0 bytes images/original/7073381043_e3e50744eb_o.jpg | Bin 10775407 -> 0 bytes images/original/8553010494_a36be7fcc8_o.jpg | Bin 1877541 -> 0 bytes images/original/8573651373_6650a080d1_o.jpg | Bin 2891385 -> 0 bytes images/original/8677766442_7d184f890e_o.jpg | Bin 221932 -> 0 bytes images/original/9212256888_c44fdaa46f_o.jpg | Bin 9439557 -> 0 bytes images/original/9440861328_1326d64dbd_o.jpg | Bin 14545423 -> 0 bytes images/original/CREDITS.md | 24 - images/thumb/12173370053_39624f5dc6_o.jpg | Bin 15591 -> 0 bytes images/thumb/14448239362_53203a94bf_o.jpg | Bin 35524 -> 0 bytes images/thumb/14459672716_2fd51d6133_o.jpg | Bin 47115 -> 0 bytes images/thumb/14461842031_f854d30f15_o.jpg | Bin 57352 -> 0 bytes images/thumb/1483066391_ba9ceea56a_o.jpg | Bin 60080 -> 0 bytes images/thumb/3155078790_b365637b61_o.jpg | Bin 80585 -> 0 bytes images/thumb/443441197_c38caf32ee_o.jpg | Bin 13409 -> 0 bytes images/thumb/4436427104_9cd5f0daba_o.jpg | Bin 40118 -> 0 bytes images/thumb/4440609236_fbfbe396b5_o.jpg | Bin 47510 -> 0 bytes images/thumb/5578985145_640f215e42_o.jpg | Bin 24135 -> 0 bytes images/thumb/6178731018_10e6fd6a9d_o.jpg | Bin 94278 -> 0 bytes images/thumb/6260329772_7ce10ac83c_o.jpg | Bin 55539 -> 0 bytes images/thumb/7073381043_e3e50744eb_o.jpg | Bin 23140 -> 0 bytes images/thumb/8553010494_a36be7fcc8_o.jpg | Bin 49081 -> 0 bytes images/thumb/8573651373_6650a080d1_o.jpg | Bin 69305 -> 0 bytes images/thumb/8677766442_7d184f890e_o.jpg | Bin 29320 -> 0 bytes images/thumb/9212256888_c44fdaa46f_o.jpg | Bin 68567 -> 0 bytes images/thumb/9440861328_1326d64dbd_o.jpg | Bin 58707 -> 0 bytes images/web/12173370053_39624f5dc6_o.jpg | Bin 323261 -> 0 bytes images/web/14448239362_53203a94bf_o.jpg | Bin 265437 -> 0 bytes images/web/14459672716_2fd51d6133_o.jpg | Bin 298186 -> 0 bytes images/web/14461842031_f854d30f15_o.jpg | Bin 359665 -> 0 bytes images/web/1483066391_ba9ceea56a_o.jpg | Bin 644727 -> 0 bytes images/web/3155078790_b365637b61_o.jpg | Bin 952752 -> 0 bytes images/web/443441197_c38caf32ee_o.jpg | Bin 239577 -> 0 bytes images/web/4436427104_9cd5f0daba_o.jpg | Bin 378646 -> 0 bytes images/web/4440609236_fbfbe396b5_o.jpg | Bin 484688 -> 0 bytes images/web/5578985145_640f215e42_o.jpg | Bin 347420 -> 0 bytes images/web/6178731018_10e6fd6a9d_o.jpg | Bin 865570 -> 0 bytes images/web/6260329772_7ce10ac83c_o.jpg | Bin 791519 -> 0 bytes images/web/7073381043_e3e50744eb_o.jpg | Bin 361806 -> 0 bytes images/web/8553010494_a36be7fcc8_o.jpg | Bin 546541 -> 0 bytes images/web/8573651373_6650a080d1_o.jpg | Bin 512390 -> 0 bytes images/web/8677766442_7d184f890e_o.jpg | Bin 218025 -> 0 bytes images/web/9212256888_c44fdaa46f_o.jpg | Bin 894563 -> 0 bytes images/web/9440861328_1326d64dbd_o.jpg | Bin 577863 -> 0 bytes index.html | 224 ++++- index.php | 65 -- package.json | 13 - sass/demo.scss | 121 --- touch-imagelightbox.css | 1 + touch-imagelightbox.js | 1214 ++++++++++++++++++++++++++ touch-imagelightbox.min.js | 5 - vagrant.sh | 13 - 76 files changed, 2832 insertions(+), 675 deletions(-) delete mode 100644 Gruntfile.js create mode 100644 LightBox.ActivityIndicator.js create mode 100644 LightBox.Captions.js create mode 100644 LightBox.CloseButton.js create mode 100644 LightBox.Core.js create mode 100644 LightBox.Navigation.js create mode 100644 LightBox.Overlay.js delete mode 100644 Vagrantfile delete mode 100644 bower.json delete mode 100755 build.sh delete mode 100644 demo.js delete mode 100644 images.md delete mode 100644 images.php delete mode 100644 images/original/12173370053_39624f5dc6_o.jpg delete mode 100644 images/original/14448239362_53203a94bf_o.jpg delete mode 100644 images/original/14459672716_2fd51d6133_o.jpg delete mode 100644 images/original/14461842031_f854d30f15_o.jpg delete mode 100644 images/original/1483066391_ba9ceea56a_o.jpg delete mode 100644 images/original/3155078790_b365637b61_o.jpg delete mode 100644 images/original/443441197_c38caf32ee_o.jpg delete mode 100644 images/original/4436427104_9cd5f0daba_o.jpg delete mode 100644 images/original/4440609236_fbfbe396b5_o.jpg delete mode 100644 images/original/5578985145_640f215e42_o.jpg delete mode 100644 images/original/6178731018_10e6fd6a9d_o.jpg delete mode 100644 images/original/6260329772_7ce10ac83c_o.jpg delete mode 100644 images/original/7073381043_e3e50744eb_o.jpg delete mode 100644 images/original/8553010494_a36be7fcc8_o.jpg delete mode 100644 images/original/8573651373_6650a080d1_o.jpg delete mode 100644 images/original/8677766442_7d184f890e_o.jpg delete mode 100644 images/original/9212256888_c44fdaa46f_o.jpg delete mode 100644 images/original/9440861328_1326d64dbd_o.jpg delete mode 100644 images/original/CREDITS.md delete mode 100644 images/thumb/12173370053_39624f5dc6_o.jpg delete mode 100644 images/thumb/14448239362_53203a94bf_o.jpg delete mode 100644 images/thumb/14459672716_2fd51d6133_o.jpg delete mode 100644 images/thumb/14461842031_f854d30f15_o.jpg delete mode 100644 images/thumb/1483066391_ba9ceea56a_o.jpg delete mode 100644 images/thumb/3155078790_b365637b61_o.jpg delete mode 100644 images/thumb/443441197_c38caf32ee_o.jpg delete mode 100644 images/thumb/4436427104_9cd5f0daba_o.jpg delete mode 100644 images/thumb/4440609236_fbfbe396b5_o.jpg delete mode 100644 images/thumb/5578985145_640f215e42_o.jpg delete mode 100644 images/thumb/6178731018_10e6fd6a9d_o.jpg delete mode 100644 images/thumb/6260329772_7ce10ac83c_o.jpg delete mode 100644 images/thumb/7073381043_e3e50744eb_o.jpg delete mode 100644 images/thumb/8553010494_a36be7fcc8_o.jpg delete mode 100644 images/thumb/8573651373_6650a080d1_o.jpg delete mode 100644 images/thumb/8677766442_7d184f890e_o.jpg delete mode 100644 images/thumb/9212256888_c44fdaa46f_o.jpg delete mode 100644 images/thumb/9440861328_1326d64dbd_o.jpg delete mode 100644 images/web/12173370053_39624f5dc6_o.jpg delete mode 100644 images/web/14448239362_53203a94bf_o.jpg delete mode 100644 images/web/14459672716_2fd51d6133_o.jpg delete mode 100644 images/web/14461842031_f854d30f15_o.jpg delete mode 100644 images/web/1483066391_ba9ceea56a_o.jpg delete mode 100644 images/web/3155078790_b365637b61_o.jpg delete mode 100644 images/web/443441197_c38caf32ee_o.jpg delete mode 100644 images/web/4436427104_9cd5f0daba_o.jpg delete mode 100644 images/web/4440609236_fbfbe396b5_o.jpg delete mode 100644 images/web/5578985145_640f215e42_o.jpg delete mode 100644 images/web/6178731018_10e6fd6a9d_o.jpg delete mode 100644 images/web/6260329772_7ce10ac83c_o.jpg delete mode 100644 images/web/7073381043_e3e50744eb_o.jpg delete mode 100644 images/web/8553010494_a36be7fcc8_o.jpg delete mode 100644 images/web/8573651373_6650a080d1_o.jpg delete mode 100644 images/web/8677766442_7d184f890e_o.jpg delete mode 100644 images/web/9212256888_c44fdaa46f_o.jpg delete mode 100644 images/web/9440861328_1326d64dbd_o.jpg delete mode 100644 index.php delete mode 100644 package.json delete mode 100644 sass/demo.scss create mode 100644 touch-imagelightbox.css create mode 100644 touch-imagelightbox.js delete mode 100644 touch-imagelightbox.min.js delete mode 100644 vagrant.sh diff --git a/Gruntfile.js b/Gruntfile.js deleted file mode 100644 index 6fd1978..0000000 --- a/Gruntfile.js +++ /dev/null @@ -1,89 +0,0 @@ -/*global module:false*/ -module.exports = function(grunt) { - - // Project configuration. - grunt.initConfig({ - // Metadata. - pkg: grunt.file.readJSON('package.json'), - banner: '/*! <%= pkg.title || pkg.name %> - v<%= pkg.version %> - ' + - '<%= grunt.template.today("yyyy-mm-dd") %>\n' + - '<%= pkg.homepage ? "* " + pkg.homepage + "\\n" : "" %>' + - '* Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author.name %>;' + - ' Licensed <%= _.pluck(pkg.licenses, "type").join(", ") %> */\n', - // Task configuration. - watch: { - main: { - options: { - reload: true - }, - files: ['index.php', 'sass/demo.scss'], - tasks: ['sass'] - } - }, - responsive_images: { - full: { - options: { - engine: 'im', - sizes: [{ - name: 'web', - width: 800 - }, - { - name: 'thumb', - height: 100 - }] - }, - files: [{ - expand: true, - flatten: true, - src: ['images/original/*.jpg'], - cwd: './', - custom_dest: 'images/{%= name %}/' - }] - } - }, - sass: { - main: { - options: { - style: 'compressed' - }, - files: { - 'demo.css': 'sass/demo.scss' - } - } - }, - copy: { - lightbox_js: { - expand: true, - flatten: true, - src: ['bower_components/touch-imagelightbox/dist/touch-imagelightbox.min.js'], - dest: './', - filter: 'isFile' - }, - lightbox_css: { - expand: true, - flatten: true, - src: ['bower_components/touch-imagelightbox/dist/touch-imagelightbox.min.css'], - dest: './', - filter: 'isFile' - } - }, - command : { - build: { - type: 'shell', - cmd: './build.sh' - } - } - }); - - // These plugins provide necessary tasks. - grunt.loadNpmTasks('grunt-contrib-sass'); - grunt.loadNpmTasks('grunt-contrib-copy'); - grunt.loadNpmTasks('grunt-responsive-images'); - grunt.loadNpmTasks('grunt-contrib-commands'); - grunt.loadNpmTasks('grunt-contrib-watch'); - - // Default task. - grunt.registerTask('default', ['responsive_images', 'sass', 'copy', 'command']); - -}; diff --git a/LightBox.ActivityIndicator.js b/LightBox.ActivityIndicator.js new file mode 100644 index 0000000..479372e --- /dev/null +++ b/LightBox.ActivityIndicator.js @@ -0,0 +1,106 @@ +var LightBox = LightBox || {}; LightBox["ActivityIndicator"] = +/******/ (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] = { +/******/ exports: {}, +/******/ id: moduleId, +/******/ loaded: false +/******/ }; + +/******/ // Execute the module function +/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); + +/******/ // Flag the module as loaded +/******/ module.loaded = 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; + +/******/ // __webpack_public_path__ +/******/ __webpack_require__.p = ""; + +/******/ // Load entry module and return exports +/******/ return __webpack_require__(0); +/******/ }) +/************************************************************************/ +/******/ ([ +/* 0 */ +/***/ function(module, exports) { + + 'use strict'; + + var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + /** + * + * @author Victor Häggqvist + * @since 2016-01-14 + */ + + var ActivityIndicator = function () { + function ActivityIndicator() { + _classCallCheck(this, ActivityIndicator); + + this.element = document.createElement('div'); + this.element.id = 'imagelightbox-loading'; + this.element.appendChild(document.createElement('div')); + } + + /** + * + * @param {LightBox} lightbox + */ + + _createClass(ActivityIndicator, [{ + key: 'register', + value: function register(lightbox) { + lightbox.addOnLoadStartListener(this.activityIndicatorOn.bind(this)); + lightbox.addOnLoadEndListener(this.activityIndicatorOff.bind(this)); + lightbox.addOnEndListener(this.activityIndicatorOff.bind(this)); + } + }, { + key: 'activityIndicatorOn', + value: function activityIndicatorOn() { + document.body.appendChild(this.element); + } + }, { + key: 'activityIndicatorOff', + value: function activityIndicatorOff() { + try { + document.body.removeChild(this.element); + } catch (e) {} + } + }]); + + return ActivityIndicator; + }(); + + exports.default = ActivityIndicator; + module.exports = exports['default']; + +/***/ } +/******/ ]); \ No newline at end of file diff --git a/LightBox.Captions.js b/LightBox.Captions.js new file mode 100644 index 0000000..8207f97 --- /dev/null +++ b/LightBox.Captions.js @@ -0,0 +1,108 @@ +var LightBox = LightBox || {}; LightBox["Captions"] = +/******/ (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] = { +/******/ exports: {}, +/******/ id: moduleId, +/******/ loaded: false +/******/ }; + +/******/ // Execute the module function +/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); + +/******/ // Flag the module as loaded +/******/ module.loaded = 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; + +/******/ // __webpack_public_path__ +/******/ __webpack_require__.p = ""; + +/******/ // Load entry module and return exports +/******/ return __webpack_require__(0); +/******/ }) +/************************************************************************/ +/******/ ([ +/* 0 */ +/***/ function(module, exports) { + + 'use strict'; + + var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + /** + * @author Victor Häggqvist + * @since 2016-01-16 + */ + + var Captions = function () { + function Captions() { + _classCallCheck(this, Captions); + + this.element = document.createElement('div'); + this.element.id = 'imagelightbox-caption'; + } + + _createClass(Captions, [{ + key: 'register', + value: function register(lightbox) { + this.lightbox = lightbox; + lightbox.addOnLoadStartListener(this.hideCaption.bind(this)); + lightbox.addOnLoadEndListener(this.showCaption.bind(this)); + lightbox.addOnEndListener(this.hideCaption.bind(this)); + } + }, { + key: 'showCaption', + value: function showCaption() { + var img = this.lightbox.target.querySelector('img'); + + if (img === null) return; + + var caption = img.getAttribute('alt'); + if (caption !== null && caption.length > 0) { + this.element.innerHTML = img.alt; + document.body.appendChild(this.element); + } + } + }, { + key: 'hideCaption', + value: function hideCaption() { + try { + document.body.removeChild(this.element); + } catch (e) {} + } + }]); + + return Captions; + }(); + + exports.default = Captions; + module.exports = exports['default']; + +/***/ } +/******/ ]); \ No newline at end of file diff --git a/LightBox.CloseButton.js b/LightBox.CloseButton.js new file mode 100644 index 0000000..287ad0e --- /dev/null +++ b/LightBox.CloseButton.js @@ -0,0 +1,113 @@ +var LightBox = LightBox || {}; LightBox["CloseButton"] = +/******/ (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] = { +/******/ exports: {}, +/******/ id: moduleId, +/******/ loaded: false +/******/ }; + +/******/ // Execute the module function +/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); + +/******/ // Flag the module as loaded +/******/ module.loaded = 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; + +/******/ // __webpack_public_path__ +/******/ __webpack_require__.p = ""; + +/******/ // Load entry module and return exports +/******/ return __webpack_require__(0); +/******/ }) +/************************************************************************/ +/******/ ([ +/* 0 */ +/***/ function(module, exports) { + + 'use strict'; + + var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + /** + * @author Victor Häggqvist + * @since 2016-01-14 + */ + + var CloseButton = function () { + function CloseButton() { + var closeOnDocumentClick = arguments.length <= 0 || arguments[0] === undefined ? false : arguments[0]; + + _classCallCheck(this, CloseButton); + + this.closeOnDocumentClick = closeOnDocumentClick; + this.element = document.createElement('a'); + this.element.id = 'imagelightbox-close'; + this.element.innerHTML = 'Close'; + } + + _createClass(CloseButton, [{ + key: 'register', + value: function register(lightbox) { + this.lightbox = lightbox; + lightbox.addOnStartListener(this.showButton.bind(this)); + lightbox.addOnEndListener(this.hideButton.bind(this)); + } + }, { + key: 'showButton', + value: function showButton() { + var _this = this; + + this.lightbox.options.quitOnDocClick = this.closeOnDocumentClick; + ['click', 'touchend'].forEach(function (name) { + _this.element.addEventListener(name, _this.exitLightbox.bind(_this)); + }); + + document.body.appendChild(this.element); + } + }, { + key: 'hideButton', + value: function hideButton() { + document.body.removeChild(this.element); + } + }, { + key: 'exitLightbox', + value: function exitLightbox() { + this.lightbox.quitLightbox(); + } + }]); + + return CloseButton; + }(); + + exports.default = CloseButton; + module.exports = exports['default']; + +/***/ } +/******/ ]); \ No newline at end of file diff --git a/LightBox.Core.js b/LightBox.Core.js new file mode 100644 index 0000000..a39d2a9 --- /dev/null +++ b/LightBox.Core.js @@ -0,0 +1,851 @@ +var LightBox = LightBox || {}; LightBox["Core"] = +/******/ (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] = { +/******/ exports: {}, +/******/ id: moduleId, +/******/ loaded: false +/******/ }; + +/******/ // Execute the module function +/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); + +/******/ // Flag the module as loaded +/******/ module.loaded = 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; + +/******/ // __webpack_public_path__ +/******/ __webpack_require__.p = ""; + +/******/ // Load entry module and return exports +/******/ return __webpack_require__(0); +/******/ }) +/************************************************************************/ +/******/ ([ +/* 0 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); /** + * @author Victor Häggqvist + * @since 2016-01-12 + */ + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + var _CSSUtil = __webpack_require__(1); + + var _LightDirection = __webpack_require__(2); + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + var log = __webpack_require__(3); + + log.setDefaultLevel(log.levels.DEBUG); + + var LightBox = function () { + function LightBox(targetSelector) { + var options = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1]; + + _classCallCheck(this, LightBox); + + log.info('LightBox'); + this.targets = document.querySelectorAll(targetSelector); + log.debug(this.targets); + + log.debug('HAS_TOUCH ' + LightBox.HAS_TOUCH); + var defaultOptions = { + allowedTypes: 'png|jpg|jpeg|gif', + restrictTypes: false, + selectorId: 'imagelightbox', + animationSpeed: 350, + preloadNext: true, + enableKeyboard: true, + quitOnEnd: false, + quitOnImgClick: false, + quitOnDocClick: true + }; + + this.options = Object.assign(options, defaultOptions); + log.info(this.options); + + this.target = null; + this.image = null; + this.imageWidth = 0; + this.imageHeight = 0; + this.swipeDiff = 0; + this.inProgress = false; + + this.swipeStart = 0; + this.swipeEnd = 0; + + this.onStartListeners = []; + this.onEndListeners = []; + this.onLoadStartListeners = []; + this.onLoadEndListeners = []; + + this.bindEvents(); + } + + _createClass(LightBox, [{ + key: 'bindEvents', + value: function bindEvents() { + var _this = this; + + Array.prototype.forEach.call(this.targets, function (ele) { + ele.addEventListener('click', _this.onImageClick.bind(_this)); + }); + window.addEventListener('resize', this.windowResizeListener.bind(this)); + + if (this.options.quitOnDocClick) { + document.body.addEventListener(LightBox.HAS_TOUCH ? 'touchend' : 'click', this.documentClick.bind(this)); + } + + if (this.options.enableKeyboard) { + document.body.addEventListener('keyup', this.handleKeyboard.bind(this)); + } + } + }, { + key: 'handleKeyboard', + value: function handleKeyboard(e) { + if (this.image === null) return true; + + e.preventDefault(); + + if (e.keyCode === 27) this.quitLightbox(); + + if (e.keyCode === 37 || e.keyCode === 39) { + var gotoIndex = Array.prototype.indexOf.call(this.targets, this.target) - (e.keyCode === 37 ? 1 : -1); + + if (gotoIndex > this.targets.length - 1) { + this.target = this.targets[0]; + } else if (gotoIndex < 0) { + this.target = this.targets[this.targets.length - 1]; + } else { + this.target = this.targets[gotoIndex]; + } + + this.loadImage(); + } + } + }, { + key: 'documentClick', + value: function documentClick() { + log.debug('document click'); + + if (this.image !== null && this.target.href === this.image.src) { + log.info('quitting'); + if (this.options.quitOnDocClick) this.quitLightbox(); + } + } + }, { + key: 'quitLightbox', + value: function quitLightbox() { + var _this2 = this; + + log.debug('quitLightbox'); + if (this.image === null) return; + + _CSSUtil.CSSUtil.setTransitionProperty(this.image, 'opacity ' + this.options.animationSpeed / 1000 + 's linear'); + setTimeout(function () { + // without timeout it's to fast to make it fade and just jumps to 1 instant + _this2.image.style.opacity = 0; + }, 5); + + setTimeout(function () { + _this2.removeImage(); + _this2.inProgress = false; + + _this2.onEndListeners.forEach(function (l) { + return l(); + }); + }, this.options.animationSpeed); + } + }, { + key: 'onImageClick', + value: function onImageClick(event) { + log.debug(event); + var element = event.srcElement.parentElement; + if (!this.isTargetValid(element)) return true; + + event.preventDefault(); + + if (this.inProgress) return; + + this.inProgress = false; + + this.onStartListeners.forEach(function (l) { + return l(); + }); + + this.target = element; + + this.loadImage(); + } + }, { + key: 'isTargetValid', + value: function isTargetValid(element) { + if (this.options.restrictTypes === false) return true; + + var validTypes = new RegExp("(\.(" + this.options.allowedTypes + ")$)"); + + return element.tagName.toLowerCase() === 'a' && validTypes.test(element.href); + } + }, { + key: 'loadImage', + value: function loadImage() { + var _this3 = this; + + var direction = arguments.length <= 0 || arguments[0] === undefined ? false : arguments[0]; + + log.info('loadImage'); + if (this.inProgress) return false; + log.debug('not progress'); + + if (this.image !== null) { + log.debug('has current image'); + if (direction !== false && (this.targets.length < 2 || this.options.quitOnEnd === true && (direction === _LightDirection.LightDirection.RIGHT && Array.prototype.indexOf(this.targets, this.target) === 0 || direction === _LightDirection.LightDirection.LEFT && Array.prototype.indexOf(this.targets, this.target) === targets.length - 1))) { + this.quitLightbox(); + return false; + } + + log.debug('unload'); + _CSSUtil.CSSUtil.setTransitionProperty(this.image, 'opacity ' + this.options.animationSpeed / 1000 + 's linear'); + + var transitionArgs = '0px'; + if (direction !== false) { + transitionArgs = 100 * direction - this.swipeDiff + 'px'; + } + + this.image.style.transform = 'translateX(' + transitionArgs + ')'; + + setTimeout(function () { + // without timeout it's to fast to make it fade and just jumps to 1 instant + _this3.image.style.opacity = 0; + }, 5); + + setTimeout(function () { + log.debug('remove from dom'); + _this3.removeImage(); + }, this.options.animationSpeed); + + this.swipeDiff = 0; + } + + this.inProgress = true; + this.onLoadStartListeners.forEach(function (l) { + return l(); + }); + + setTimeout(function () { + log.debug('loadImage in'); + var image = new Image(); + _this3.image = image; + image.onload = function () { + image.id = _this3.options.selectorId; + log.debug('img loaded'); + document.body.appendChild(image); + _this3.setImage(); + + image.style.opacity = 0; + + var interpretedSpeed = _this3.options.animationSpeed / 1000; + log.debug(interpretedSpeed); + _CSSUtil.CSSUtil.setTransitionProperty(image, 'opacity ' + interpretedSpeed + 's ease'); + image.style.transform = 'translateX(0px)'; + + setTimeout(function () { + // without timeout it's to fast to make it fade and just jumps to 1 instant + image.style.opacity = 1; + }, 10); + + setTimeout(function () { + _this3.inProgress = false; + _this3.onLoadEndListeners.forEach(function (l) { + return l(); + }); + }, _this3.options.animationSpeed); + + if (_this3.options.preloadNext) { + var index = Array.prototype.indexOf.call(_this3.targets, _this3.target); + var next = _this3.targets[index + 1]; + + if (next !== null && next !== undefined) { + log.debug('preloading next'); + var nextImg = new Image(); + nextImg.src = next.href; + } else { + log.debug('no preloading'); + } + } + }; + image.src = _this3.target.href; + + _this3.swipeStart = 0; + _this3.swipeEnd = 0; + //this.imagePosLeft = 0; + + if (LightBox.HAS_POINTERS) { + image.addEventListener('pointerup', _this3.imageClickEvent.bind(_this3)); + image.addEventListener('MSPointerUp', _this3.imageClickEvent.bind(_this3)); + } else { + image.addEventListener('click', _this3.imageClickEvent.bind(_this3)); + } + + ['touchstart', 'pointerdown', 'MSPointerDown'].forEach(function (name) { + image.addEventListener(name, _this3.imageTouchStart.bind(_this3)); + }); + + ['touchmove', 'pointermove', 'MSPointerMove'].forEach(function (name) { + image.addEventListener(name, _this3.imageTouchMove.bind(_this3)); + }); + + ['touchend', 'touchcancel', 'pointerup', 'MSPointerUp'].forEach(function (name) { + image.addEventListener(name, _this3.imageTouchEnd.bind(_this3)); + }); + }, this.options.animationSpeed + 100); + } + }, { + key: 'removeImage', + value: function removeImage() { + var image = document.querySelector('#' + this.options.selectorId); + document.body.removeChild(image); + this.image = null; + } + }, { + key: 'imageClickEvent', + value: function imageClickEvent(e) { + e.preventDefault(); + log.debug('click'); + + if (this.options.quitOnImgClick) { + this.quitLightbox(); + return false; + } + + if (this.wasTouched(e)) return true; + + var posX = e.pageX - e.target.offsetLeft; + log.debug(posX); + + var gotoIndex = Array.prototype.indexOf.call(this.targets, this.target) - (this.imageWidth / 2 > posX ? 1 : -1); + + if (gotoIndex > this.targets.length - 1) { + this.target = this.targets[0]; + } else if (gotoIndex < 0) { + this.target = this.targets[this.targets.length - 1]; + } else { + this.target = this.targets[gotoIndex]; + } + + this.loadImage(); + } + }, { + key: 'imageTouchStart', + value: function imageTouchStart(e) { + if (!this.wasTouched(e) || this.options.quitOnImgClick) return true; + + this.swipeStart = e.pageX || e.touches[0].pageX; + } + }, { + key: 'imageTouchMove', + value: function imageTouchMove(e) { + if (!this.wasTouched(e) || this.options.quitOnImgClick) return true; + + e.preventDefault(); + this.swipeEnd = e.pageX || e.touches[0].pageX; + this.swipeDiff = this.swipeStart - this.swipeEnd; + + this.image.style.transform = 'translateX(' + -this.swipeDiff + 'px)'; + //CSSUtil.setTransitionProperty(this.image, 'transform 0s linear'); + } + }, { + key: 'imageTouchEnd', + value: function imageTouchEnd(e) { + if (!this.wasTouched(e) || this.options.quitOnImgClick) return true; + + log.debug(this.swipeDiff); + if (Math.abs(this.swipeDiff) > 50) { + var gotoIndex = Array.prototype.indexOf.call(this.targets, this.target) - (this.swipeDiff < 0 ? 1 : -1); + + if (gotoIndex > this.targets.length - 1) { + this.target = this.targets[0]; + } else if (gotoIndex < 0) { + this.target = this.targets[this.targets.length - 1]; + } else { + this.target = this.targets[gotoIndex]; + } + + var direction = this.swipeDiff > 0 ? _LightDirection.LightDirection.RIGHT : _LightDirection.LightDirection.LEFT; + this.loadImage(direction); + } else { + this.image.style.transform = 'translateX(0px)'; + //CSSUtil.setTransitionProperty(this.image, 'transform '+ options.animationSpeed / 1000 +'s linear'); + } + } + }, { + key: 'setImage', + value: function setImage() { + var _this4 = this; + + if (!this.image) return false; + + var screenWidth = window.innerWidth * 0.8; + var screenHeight = window.innerHeight * 0.9; + + var tmpImage = new Image(); + tmpImage.src = this.image.src; + tmpImage.onload = function () { + _this4.imageWidth = tmpImage.width; + _this4.imageHeight = tmpImage.height; + + if (_this4.imageWidth > screenWidth || _this4.imageHeight > screenHeight) { + var ratio = _this4.imageWidth / _this4.imageHeight > screenWidth / screenHeight ? _this4.imageWidth / screenWidth : _this4.imageHeight / screenHeight; + _this4.imageWidth /= ratio; + _this4.imageHeight /= ratio; + } + + _this4.image.style.width = _this4.imageWidth + 'px'; + _this4.image.style.height = _this4.imageHeight + 'px'; + _this4.image.style.top = (window.innerHeight - _this4.imageHeight) / 2 + 'px'; + _this4.image.style.left = (window.innerWidth - _this4.imageWidth) / 2 + 'px'; + }; + } + }, { + key: 'wasTouched', + value: function wasTouched(event) { + if (LightBox.HAS_TOUCH) return true; + + if (!LightBox.HAS_POINTERS || typeof event === 'undefined' || typeof event.pointerType === 'undefined') return false; + + if (typeof event.MSPOINTER_TYPE_MOUSE !== 'undefined') { + if (event.MSPOINTER_TYPE_MOUSE !== event.pointerType) return true; + } else { + if (event.pointerType !== 'mouse') return true; + } + + return false; + } + }, { + key: 'switchToIndex', + value: function switchToIndex(index) { + if (index >= 0 && index < this.targets.length) { + this.target = this.targets[index]; + this.loadImage(); + } + } + }, { + key: 'windowResizeListener', + value: function windowResizeListener() { + log.debug('resized'); + this.setImage(); + } + }, { + key: 'addOnStartListener', + value: function addOnStartListener(listener) { + this.onStartListeners.push(listener); + } + }, { + key: 'addOnEndListener', + value: function addOnEndListener(listener) { + this.onEndListeners.push(listener); + } + }, { + key: 'addOnLoadStartListener', + value: function addOnLoadStartListener(listener) { + this.onLoadStartListeners.push(listener); + } + }, { + key: 'addOnLoadEndListener', + value: function addOnLoadEndListener(listener) { + this.onLoadEndListeners.push(listener); + } + }, { + key: 'registerPlugin', + value: function registerPlugin(plugin) { + plugin.register(this); + } + }]); + + return LightBox; + }(); + + exports.default = LightBox; + + LightBox.HAS_TOUCH = 'ontouchstart' in window; + LightBox.HAS_POINTERS = window.navigator.pointerEnabled || window.navigator.msPointerEnabled; + module.exports = exports['default']; + +/***/ }, +/* 1 */ +/***/ function(module, exports) { + + 'use strict'; + + var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + /** + * Created by Victor Häggqvist on 1/12/16. + */ + + var CSSUtil = exports.CSSUtil = function () { + function CSSUtil() { + _classCallCheck(this, CSSUtil); + } + + _createClass(CSSUtil, null, [{ + key: 'setTransitionProperty', + + /** + * transion need to be set on property + * + * using key-value dont work + * + * @param ele DOMElement + * @param value + */ + value: function setTransitionProperty(ele, value) { + var style = ele.style; + if (style.transition === '') { + style.transition = value; + return; + } + if (style.WebkitTransition === '') { + style.WebkitTransition = value; + return; + } + if (style.MozTransition === '') { + style.MozTransition = value; + return; + } + if (style.OTransition === '') { + style.OTransition = value; + } + } + }, { + key: 'cssTransitionSupport', + value: function cssTransitionSupport() { + var d = document.body || document.documentElement, + s = d.style; + if (s.WebkitTransition === '') return '-webkit-'; + if (s.MozTransition === '') return '-moz-'; + if (s.OTransition === '') return '-o-'; + if (s.transition === '') return ''; + return false; + } + }, { + key: 'cssTransitionTranslateX', + value: function cssTransitionTranslateX(element, positionX, speed) { + var prefix = CSSUtil.cssTransitionSupport(); + element.style[prefix + 'transform'] = 'translateX(' + positionX + ')'; + element.style[prefix + 'transition'] = prefix + 'transform ' + speed + 's linear'; + } + }]); + + return CSSUtil; + }(); + + CSSUtil.isCssTransitionSupport = CSSUtil.cssTransitionSupport() !== false; + +/***/ }, +/* 2 */ +/***/ function(module, exports) { + + "use strict"; + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + /** + * Created by Victor Häggqvist on 1/14/16. + */ + + var LightDirection = exports.LightDirection = function LightDirection() { + _classCallCheck(this, LightDirection); + }; + + LightDirection.LEFT = 1; + LightDirection.RIGHT = -1; + +/***/ }, +/* 3 */ +/***/ function(module, exports, __webpack_require__) { + + var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function(module) {'use strict'; + + var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; }; + + /* + * loglevel - https://github.com/pimterry/loglevel + * + * Copyright (c) 2013 Tim Perry + * Licensed under the MIT license. + */ + (function (root, definition) { + "use strict"; + + if (( false ? 'undefined' : _typeof(module)) === 'object' && module.exports && "function" === 'function') { + module.exports = definition(); + } else if ("function" === 'function' && _typeof(__webpack_require__(5)) === 'object') { + !(__WEBPACK_AMD_DEFINE_FACTORY__ = (definition), __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? (__WEBPACK_AMD_DEFINE_FACTORY__.call(exports, __webpack_require__, exports, module)) : __WEBPACK_AMD_DEFINE_FACTORY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); + } else { + root.log = definition(); + } + })(undefined, function () { + "use strict"; + + var noop = function noop() {}; + var undefinedType = "undefined"; + + function realMethod(methodName) { + if ((typeof console === 'undefined' ? 'undefined' : _typeof(console)) === undefinedType) { + return false; // We can't build a real method without a console to log to + } else if (console[methodName] !== undefined) { + return bindMethod(console, methodName); + } else if (console.log !== undefined) { + return bindMethod(console, 'log'); + } else { + return noop; + } + } + + function bindMethod(obj, methodName) { + var method = obj[methodName]; + if (typeof method.bind === 'function') { + return method.bind(obj); + } else { + try { + return Function.prototype.bind.call(method, obj); + } catch (e) { + // Missing bind shim or IE8 + Modernizr, fallback to wrapping + return function () { + return Function.prototype.apply.apply(method, [obj, arguments]); + }; + } + } + } + + // these private functions always need `this` to be set properly + + function enableLoggingWhenConsoleArrives(methodName, level, loggerName) { + return function () { + if ((typeof console === 'undefined' ? 'undefined' : _typeof(console)) !== undefinedType) { + replaceLoggingMethods.call(this, level, loggerName); + this[methodName].apply(this, arguments); + } + }; + } + + function replaceLoggingMethods(level, loggerName) { + /*jshint validthis:true */ + for (var i = 0; i < logMethods.length; i++) { + var methodName = logMethods[i]; + this[methodName] = i < level ? noop : this.methodFactory(methodName, level, loggerName); + } + } + + function defaultMethodFactory(methodName, level, loggerName) { + /*jshint validthis:true */ + return realMethod(methodName) || enableLoggingWhenConsoleArrives.apply(this, arguments); + } + + var logMethods = ["trace", "debug", "info", "warn", "error"]; + + function Logger(name, defaultLevel, factory) { + var self = this; + var currentLevel; + var storageKey = "loglevel"; + if (name) { + storageKey += ":" + name; + } + + function persistLevelIfPossible(levelNum) { + var levelName = (logMethods[levelNum] || 'silent').toUpperCase(); + + // Use localStorage if available + try { + window.localStorage[storageKey] = levelName; + return; + } catch (ignore) {} + + // Use session cookie as fallback + try { + window.document.cookie = encodeURIComponent(storageKey) + "=" + levelName + ";"; + } catch (ignore) {} + } + + function getPersistedLevel() { + var storedLevel; + + try { + storedLevel = window.localStorage[storageKey]; + } catch (ignore) {} + + if ((typeof storedLevel === 'undefined' ? 'undefined' : _typeof(storedLevel)) === undefinedType) { + try { + var cookie = window.document.cookie; + var location = cookie.indexOf(encodeURIComponent(storageKey) + "="); + if (location) { + storedLevel = /^([^;]+)/.exec(cookie.slice(location))[1]; + } + } catch (ignore) {} + } + + // If the stored level is not valid, treat it as if nothing was stored. + if (self.levels[storedLevel] === undefined) { + storedLevel = undefined; + } + + return storedLevel; + } + + /* + * + * Public API + * + */ + + self.levels = { "TRACE": 0, "DEBUG": 1, "INFO": 2, "WARN": 3, + "ERROR": 4, "SILENT": 5 }; + + self.methodFactory = factory || defaultMethodFactory; + + self.getLevel = function () { + return currentLevel; + }; + + self.setLevel = function (level, persist) { + if (typeof level === "string" && self.levels[level.toUpperCase()] !== undefined) { + level = self.levels[level.toUpperCase()]; + } + if (typeof level === "number" && level >= 0 && level <= self.levels.SILENT) { + currentLevel = level; + if (persist !== false) { + // defaults to true + persistLevelIfPossible(level); + } + replaceLoggingMethods.call(self, level, name); + if ((typeof console === 'undefined' ? 'undefined' : _typeof(console)) === undefinedType && level < self.levels.SILENT) { + return "No console available for logging"; + } + } else { + throw "log.setLevel() called with invalid level: " + level; + } + }; + + self.setDefaultLevel = function (level) { + if (!getPersistedLevel()) { + self.setLevel(level, false); + } + }; + + self.enableAll = function (persist) { + self.setLevel(self.levels.TRACE, persist); + }; + + self.disableAll = function (persist) { + self.setLevel(self.levels.SILENT, persist); + }; + + // Initialize with the right level + var initialLevel = getPersistedLevel(); + if (initialLevel == null) { + initialLevel = defaultLevel == null ? "WARN" : defaultLevel; + } + self.setLevel(initialLevel, false); + } + + /* + * + * Package-level API + * + */ + + var defaultLogger = new Logger(); + + var _loggersByName = {}; + defaultLogger.getLogger = function getLogger(name) { + if (typeof name !== "string" || name === "") { + throw new TypeError("You must supply a name when creating a logger."); + } + + var logger = _loggersByName[name]; + if (!logger) { + logger = _loggersByName[name] = new Logger(name, defaultLogger.getLevel(), defaultLogger.methodFactory); + } + return logger; + }; + + // Grab the current global log variable in case of overwrite + var _log = (typeof window === 'undefined' ? 'undefined' : _typeof(window)) !== undefinedType ? window.log : undefined; + defaultLogger.noConflict = function () { + if ((typeof window === 'undefined' ? 'undefined' : _typeof(window)) !== undefinedType && window.log === defaultLogger) { + window.log = _log; + } + + return defaultLogger; + }; + + return defaultLogger; + }); + /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(4)(module))) + +/***/ }, +/* 4 */ +/***/ function(module, exports) { + + "use strict"; + + module.exports = function (module) { + if (!module.webpackPolyfill) { + module.deprecate = function () {}; + module.paths = []; + // module.parent = undefined by default + module.children = []; + module.webpackPolyfill = 1; + } + return module; + }; + +/***/ }, +/* 5 */ +/***/ function(module, exports) { + + /* WEBPACK VAR INJECTION */(function(__webpack_amd_options__) {module.exports = __webpack_amd_options__; + + /* WEBPACK VAR INJECTION */}.call(exports, {})) + +/***/ } +/******/ ]); \ No newline at end of file diff --git a/LightBox.Navigation.js b/LightBox.Navigation.js new file mode 100644 index 0000000..abcc5b4 --- /dev/null +++ b/LightBox.Navigation.js @@ -0,0 +1,138 @@ +var LightBox = LightBox || {}; LightBox["Navigation"] = +/******/ (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] = { +/******/ exports: {}, +/******/ id: moduleId, +/******/ loaded: false +/******/ }; + +/******/ // Execute the module function +/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); + +/******/ // Flag the module as loaded +/******/ module.loaded = 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; + +/******/ // __webpack_public_path__ +/******/ __webpack_require__.p = ""; + +/******/ // Load entry module and return exports +/******/ return __webpack_require__(0); +/******/ }) +/************************************************************************/ +/******/ ([ +/* 0 */ +/***/ function(module, exports) { + + 'use strict'; + + var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + /** + * @author Victor Häggqvist + * @since 1/15/16 + */ + + var Navigation = function () { + function Navigation() { + _classCallCheck(this, Navigation); + } + + _createClass(Navigation, [{ + key: 'register', + value: function register(lightbox) { + this.lightbox = lightbox; + lightbox.addOnStartListener(this.showNavigation.bind(this)); + lightbox.addOnEndListener(this.hideNavigation.bind(this)); + lightbox.addOnLoadEndListener(this.updateNavigation.bind(this)); + } + }, { + key: 'showNavigation', + value: function showNavigation() { + var _this = this; + + this.sink = document.createElement('div'); + this.sink.id = 'imagelightbox-nav-sink'; + this.nav = document.createElement('div'); + this.nav.id = 'imagelightbox-nav'; + this.sink.appendChild(this.nav); + + Array.prototype.forEach.call(this.lightbox.targets, function (_) { + _this.nav.appendChild(document.createElement('a')); + }); + + document.body.appendChild(this.sink); + + var navItems = this.nav.querySelectorAll('a'); + Array.prototype.forEach.call(navItems, function (item, i) { + ['click', 'touchend'].forEach(function (name) { + item.addEventListener(name, _this.navClick.bind(_this, i)); + }); + }); + + // make the nav actually centered, flex center dont make it + var rect = this.nav.getBoundingClientRect(); + var diff = rect.width / 2; + this.nav.style.marginLeft = '-' + diff + 'px'; + } + }, { + key: 'updateNavigation', + value: function updateNavigation() { + Array.prototype.forEach.call(this.nav.childNodes, function (n) { + n.classList.remove('active'); + }); + + var current = Array.prototype.indexOf.call(this.lightbox.targets, this.lightbox.target); + this.nav.childNodes[current].classList.add('active'); + } + }, { + key: 'hideNavigation', + value: function hideNavigation() { + try { + document.body.removeChild(this.sink); + } catch (e) {} + } + }, { + key: 'navClick', + value: function navClick(index, e) { + e.stopPropagation(); + e.cancelBubble = true; + this.lightbox.switchToIndex(index); + } + }]); + + return Navigation; + }(); + + exports.default = Navigation; + module.exports = exports['default']; + +/***/ } +/******/ ]); \ No newline at end of file diff --git a/LightBox.Overlay.js b/LightBox.Overlay.js new file mode 100644 index 0000000..e52a586 --- /dev/null +++ b/LightBox.Overlay.js @@ -0,0 +1,96 @@ +var LightBox = LightBox || {}; LightBox["Overlay"] = +/******/ (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] = { +/******/ exports: {}, +/******/ id: moduleId, +/******/ loaded: false +/******/ }; + +/******/ // Execute the module function +/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); + +/******/ // Flag the module as loaded +/******/ module.loaded = 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; + +/******/ // __webpack_public_path__ +/******/ __webpack_require__.p = ""; + +/******/ // Load entry module and return exports +/******/ return __webpack_require__(0); +/******/ }) +/************************************************************************/ +/******/ ([ +/* 0 */ +/***/ function(module, exports) { + + 'use strict'; + + var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + /** + * @author Victor Häggqvist + * @since 2016-01-14 + */ + + var Overlay = function () { + function Overlay() { + _classCallCheck(this, Overlay); + + this.element = document.createElement('div'); + this.element.id = 'imagelightbox-overlay'; + } + + _createClass(Overlay, [{ + key: 'register', + value: function register(lightbox) { + lightbox.addOnStartListener(this.overlayOn.bind(this)); + lightbox.addOnEndListener(this.overlayOff.bind(this)); + } + }, { + key: 'overlayOn', + value: function overlayOn() { + document.body.appendChild(this.element); + } + }, { + key: 'overlayOff', + value: function overlayOff() { + document.body.removeChild(this.element); + } + }]); + + return Overlay; + }(); + + exports.default = Overlay; + module.exports = exports['default']; + +/***/ } +/******/ ]); \ No newline at end of file diff --git a/Vagrantfile b/Vagrantfile deleted file mode 100644 index dcba421..0000000 --- a/Vagrantfile +++ /dev/null @@ -1,124 +0,0 @@ -# -*- mode: ruby -*- -# vi: set ft=ruby : - -# Vagrantfile API/syntax version. Don't touch unless you know what you're doing! -VAGRANTFILE_API_VERSION = "2" - -Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| - # All Vagrant configuration is done here. The most common configuration - # options are documented and commented below. For a complete reference, - # please see the online documentation at vagrantup.com. - - # Every Vagrant virtual environment requires a box to build off of. - config.vm.box = "ubuntu/trusty32" - config.vm.provision :shell, :path => "vagrant.sh" - config.vm.network :forwarded_port, host: 4044, guest: 80 - - # Disable automatic box update checking. If you disable this, then - # boxes will only be checked for updates when the user runs - # `vagrant box outdated`. This is not recommended. - # config.vm.box_check_update = false - - # Create a forwarded port mapping which allows access to a specific port - # within the machine from a port on the host machine. In the example below, - # accessing "localhost:8080" will access port 80 on the guest machine. - # config.vm.network "forwarded_port", guest: 80, host: 8080 - - # Create a private network, which allows host-only access to the machine - # using a specific IP. - # config.vm.network "private_network", ip: "192.168.33.10" - - # Create a public network, which generally matched to bridged network. - # Bridged networks make the machine appear as another physical device on - # your network. - # config.vm.network "public_network" - - # If true, then any SSH connections made will enable agent forwarding. - # Default value: false - # config.ssh.forward_agent = true - - # Share an additional folder to the guest VM. The first argument is - # the path on the host to the actual folder. The second argument is - # the path on the guest to mount the folder. And the optional third - # argument is a set of non-required options. - # config.vm.synced_folder "../data", "/vagrant_data" - - # Provider-specific configuration so you can fine-tune various - # backing providers for Vagrant. These expose provider-specific options. - # Example for VirtualBox: - # - # config.vm.provider "virtualbox" do |vb| - # # Don't boot with headless mode - # vb.gui = true - # - # # Use VBoxManage to customize the VM. For example to change memory: - # vb.customize ["modifyvm", :id, "--memory", "1024"] - # end - # - # View the documentation for the provider you're using for more - # information on available options. - - # Enable provisioning with CFEngine. CFEngine Community packages are - # automatically installed. For example, configure the host as a - # policy server and optionally a policy file to run: - # - # config.vm.provision "cfengine" do |cf| - # cf.am_policy_hub = true - # # cf.run_file = "motd.cf" - # end - # - # You can also configure and bootstrap a client to an existing - # policy server: - # - # config.vm.provision "cfengine" do |cf| - # cf.policy_server_address = "10.0.2.15" - # end - - # Enable provisioning with Puppet stand alone. Puppet manifests - # are contained in a directory path relative to this Vagrantfile. - # You will need to create the manifests directory and a manifest in - # the file default.pp in the manifests_path directory. - # - # config.vm.provision "puppet" do |puppet| - # puppet.manifests_path = "manifests" - # puppet.manifest_file = "site.pp" - # end - - # Enable provisioning with chef solo, specifying a cookbooks path, roles - # path, and data_bags path (all relative to this Vagrantfile), and adding - # some recipes and/or roles. - # - # config.vm.provision "chef_solo" do |chef| - # chef.cookbooks_path = "../my-recipes/cookbooks" - # chef.roles_path = "../my-recipes/roles" - # chef.data_bags_path = "../my-recipes/data_bags" - # chef.add_recipe "mysql" - # chef.add_role "web" - # - # # You may also specify custom JSON attributes: - # chef.json = { :mysql_password => "foo" } - # end - - # Enable provisioning with chef server, specifying the chef server URL, - # and the path to the validation key (relative to this Vagrantfile). - # - # The Opscode Platform uses HTTPS. Substitute your organization for - # ORGNAME in the URL and validation key. - # - # If you have your own Chef Server, use the appropriate URL, which may be - # HTTP instead of HTTPS depending on your configuration. Also change the - # validation key to validation.pem. - # - # config.vm.provision "chef_client" do |chef| - # chef.chef_server_url = "https://api.opscode.com/organizations/ORGNAME" - # chef.validation_key_path = "ORGNAME-validator.pem" - # end - # - # If you're using the Opscode platform, your validator client is - # ORGNAME-validator, replacing ORGNAME with your organization name. - # - # If you have your own Chef Server, the default validation client name is - # chef-validator, unless you changed the configuration. - # - # chef.validation_client_name = "ORGNAME-validator" -end diff --git a/bower.json b/bower.json deleted file mode 100644 index da514fd..0000000 --- a/bower.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "name": "touch-imagelightbox-demo", - "version": "0.0.0", - "authors": [ - "Victor Häggqvist " - ], - "license": "MIT", - "private": true, - "ignore": [ - "**/.*", - "node_modules", - "bower_components", - "test", - "tests" - ], - "dependencies": { - "touch-imagelightbox": "~0.1.2" - } -} diff --git a/build.sh b/build.sh deleted file mode 100755 index aaca1a2..0000000 --- a/build.sh +++ /dev/null @@ -1,2 +0,0 @@ -php images.php md -php index.php > index.html diff --git a/demo.js b/demo.js deleted file mode 100644 index cae2059..0000000 --- a/demo.js +++ /dev/null @@ -1,125 +0,0 @@ -$( function() { - - // Show and hide loader - var activityIndicatorOn = function() { - $('
' ).appendTo('body'); - }, - activityIndicatorOff = function() { - $('#imagelightbox-loading').remove(); - }, - - // Show and hide overlay - overlayOn = function() { - $('
').appendTo('body'); - }, - overlayOff = function() { - $('#imagelightbox-overlay').remove(); - }, - - // Show and hide close button - closeButtonOn = function(instance) { - $('Close').appendTo('body').on('click touchend', function(){ $(this).remove(); instance.quitImageLightbox(); return false; }); - }, - closeButtonOff = function() { - $('#imagelightbox-close').remove(); - }, - - // Show and hide caption - captionOn = function() { - var description = $('a[href="' + $('#imagelightbox').attr('src') + '"] img').attr('alt'); - if(description.length > 0) - $('
' + description + '
').appendTo('body'); - }, - captionOff = function() { - $('#imagelightbox-caption').remove(); - }, - - // Show, hide and keep navigation boubble updated - navigationOn = function(instance, selector) { - var images = $(selector); - if (images.length) { - var nav = $('
'); - for(var i = 0; i < images.length; i++) - nav.append(''); - - nav.appendTo('body'); - nav.on('click touchend', function(){ return false; }); - - var navItems = nav.find('a'); - navItems.on('click touchend', function() { - var $this = $(this); - if (images.eq($this.index()).attr('href') != $('#imagelightbox').attr('src')) - instance.switchImageLightbox($this.index()); - - navItems.removeClass('active'); - navItems.eq($this.index()).addClass('active'); - - return false; - }) - .on('touchend', function(){ return false; }); - } - }, - navigationUpdate = function(selector) { - var items = $('#imagelightbox-nav a'); - items.removeClass('active'); - items.eq( $( selector ).filter('[href="' + $('#imagelightbox').attr('src') + '"]').index( selector ) ).addClass('active'); - }, - navigationOff = function() { - $('#imagelightbox-nav').remove(); - }; - - // WITH ACTIVITY INDICATION - $('a[data-imagelightbox="0"]').imageLightbox( - { - onLoadStart: function() { activityIndicatorOn(); }, - onLoadEnd: function() { activityIndicatorOff(); }, - onEnd: function() { activityIndicatorOff(); } - }); - - // WITH OVERLAY & ACTIVITY INDICATION - $('a[data-imagelightbox="1"]').imageLightbox( - { - onStart: function() { overlayOn(); }, - onEnd: function() { overlayOff(); activityIndicatorOff(); }, - onLoadStart: function() { activityIndicatorOn(); }, - onLoadEnd: function() { activityIndicatorOff(); } - }); - - // WITH "CLOSE" BUTTON & ACTIVITY INDICATION - var instanceTwo = $('a[data-imagelightbox="2"]').imageLightbox( - { - quitOnDocClick: false, - onStart: function() { closeButtonOn( instanceTwo ); }, - onEnd: function() { closeButtonOff(); activityIndicatorOff(); }, - onLoadStart: function() { activityIndicatorOn(); }, - onLoadEnd: function() { activityIndicatorOff(); } - }); - - // WITH CAPTION & ACTIVITY INDICATION - $('a[data-imagelightbox="3"]').imageLightbox( - { - onLoadStart: function() { captionOff(); activityIndicatorOn(); }, - onLoadEnd: function() { captionOn(); activityIndicatorOff(); }, - onEnd: function() { captionOff(); activityIndicatorOff(); } - }); - - // WITH DIRECTION REFERENCE - var selectorFour = 'a[data-imagelightbox="4"]'; - var instanceFour = $(selectorFour).imageLightbox( - { - onStart: function() { navigationOn( instanceFour, selectorFour ); }, - onEnd: function() { navigationOff(); activityIndicatorOff(); }, - onLoadStart: function() { activityIndicatorOn(); }, - onLoadEnd: function() { navigationUpdate( selectorFour ); activityIndicatorOff(); } - }); - - // ALL COMBINED - var instanceF = $('a[data-imagelightbox="5"]').imageLightbox( - { - onStart: function() { overlayOn(); closeButtonOn( instanceF ); }, - onEnd: function() { overlayOff(); captionOff(); closeButtonOff(); activityIndicatorOff(); }, - onLoadStart: function() { captionOff(); activityIndicatorOn(); }, - onLoadEnd: function() { captionOn(); activityIndicatorOff(); } - }); - -}); diff --git a/images.md b/images.md deleted file mode 100644 index f813793..0000000 --- a/images.md +++ /dev/null @@ -1,22 +0,0 @@ -Image Credits -============= -All images are licensed CC BY 2.0 -file - name - source -- 14448239362_53203a94bf_o.jpg - Sunrise - https://secure.flickr.com/photos/manal/14448239362 -- 6260329772_7ce10ac83c_o.jpg - transalpina - https://secure.flickr.com/photos/dexxus/6260329772 -- 7073381043_e3e50744eb_o.jpg - Water, rocks, sun, sea and cloud! - https://secure.flickr.com/photos/avidlyabide/7073381043 -- 9440861328_1326d64dbd_o.jpg - Sunday nature - https://secure.flickr.com/photos/pixlense/9440861328 -- 4440609236_fbfbe396b5_o.jpg - Light after Darkness - https://secure.flickr.com/photos/japokskee/4440609236 -- 14459672716_2fd51d6133_o.jpg - A Dragonfly! - https://secure.flickr.com/photos/lingeswaran/14459672716 -- 14461842031_f854d30f15_o.jpg - Marumi DHG Macro 200 + Tamron 17-50mm. 2.8 - https://secure.flickr.com/photos/gaby1/14461842031 -- 6178731018_10e6fd6a9d_o.jpg - Times Square in the rain - https://secure.flickr.com/photos/en321/6178731018 -- 12173370053_39624f5dc6_o.jpg - Manchester City Centre - Northern Quarter Viewed from the 15th Floor - https://secure.flickr.com/photos/staceycav/12173370053 -- 8677766442_7d184f890e_o.jpg - City sunset - https://secure.flickr.com/photos/melburnian/8677766442 -- 8553010494_a36be7fcc8_o.jpg - City Lights - https://secure.flickr.com/photos/duncanh1/8553010494 -- 3155078790_b365637b61_o.jpg - Ready . . . Set .................... - https://secure.flickr.com/photos/oneworldgallery/3155078790 -- 443441197_c38caf32ee_o.jpg - Lights ou - https://secure.flickr.com/photos/aussiegall/443441197 -- 4436427104_9cd5f0daba_o.jpg - Golden Gate Bridge - https://secure.flickr.com/photos/kevcole/4436427104 -- 9212256888_c44fdaa46f_o.jpg - Red Spruce Peak - https://secure.flickr.com/photos/dbnunley/9212256888 -- 8573651373_6650a080d1_o.jpg - The Lou Ruvo Center for Brain Health, Las Vegas, Nevada - https://secure.flickr.com/photos/opalsson/8573651373/ -- 1483066391_ba9ceea56a_o.jpg - Nightfall over South End of Stockholm - https://secure.flickr.com/photos/ichimusai/1483066391 -- 5578985145_640f215e42_o.jpg - Grand Canyon Morning #dailyshoot - https://secure.flickr.com/photos/leshaines123/5578985145 \ No newline at end of file diff --git a/images.php b/images.php deleted file mode 100644 index fcd25db..0000000 --- a/images.php +++ /dev/null @@ -1,34 +0,0 @@ -1 && $argv[1]=='md') { - $mdfile = "Image Credits\n=============\nAll images are licensed CC BY 2.0\nfile - name - source"; - $json = json_decode($images); - foreach ($json as $img) { - $mdfile .= "\n- ".$img->src." - ".$img->name." - ".$img->url; - } - file_put_contents('images.md',$mdfile); - echo 'images.md created'; - } -} - - ?> diff --git a/images/original/12173370053_39624f5dc6_o.jpg b/images/original/12173370053_39624f5dc6_o.jpg deleted file mode 100644 index 751a85d..0000000 Binary files a/images/original/12173370053_39624f5dc6_o.jpg and /dev/null differ diff --git a/images/original/14448239362_53203a94bf_o.jpg b/images/original/14448239362_53203a94bf_o.jpg deleted file mode 100644 index f85b25c..0000000 Binary files a/images/original/14448239362_53203a94bf_o.jpg and /dev/null differ diff --git a/images/original/14459672716_2fd51d6133_o.jpg b/images/original/14459672716_2fd51d6133_o.jpg deleted file mode 100644 index c1631f8..0000000 Binary files a/images/original/14459672716_2fd51d6133_o.jpg and /dev/null differ diff --git a/images/original/14461842031_f854d30f15_o.jpg b/images/original/14461842031_f854d30f15_o.jpg deleted file mode 100644 index d69b9d0..0000000 Binary files a/images/original/14461842031_f854d30f15_o.jpg and /dev/null differ diff --git a/images/original/1483066391_ba9ceea56a_o.jpg b/images/original/1483066391_ba9ceea56a_o.jpg deleted file mode 100644 index c0304c7..0000000 Binary files a/images/original/1483066391_ba9ceea56a_o.jpg and /dev/null differ diff --git a/images/original/3155078790_b365637b61_o.jpg b/images/original/3155078790_b365637b61_o.jpg deleted file mode 100644 index d499e53..0000000 Binary files a/images/original/3155078790_b365637b61_o.jpg and /dev/null differ diff --git a/images/original/443441197_c38caf32ee_o.jpg b/images/original/443441197_c38caf32ee_o.jpg deleted file mode 100644 index 9e21418..0000000 Binary files a/images/original/443441197_c38caf32ee_o.jpg and /dev/null differ diff --git a/images/original/4436427104_9cd5f0daba_o.jpg b/images/original/4436427104_9cd5f0daba_o.jpg deleted file mode 100644 index 29ca470..0000000 Binary files a/images/original/4436427104_9cd5f0daba_o.jpg and /dev/null differ diff --git a/images/original/4440609236_fbfbe396b5_o.jpg b/images/original/4440609236_fbfbe396b5_o.jpg deleted file mode 100644 index 18ecf51..0000000 Binary files a/images/original/4440609236_fbfbe396b5_o.jpg and /dev/null differ diff --git a/images/original/5578985145_640f215e42_o.jpg b/images/original/5578985145_640f215e42_o.jpg deleted file mode 100644 index 42dbceb..0000000 Binary files a/images/original/5578985145_640f215e42_o.jpg and /dev/null differ diff --git a/images/original/6178731018_10e6fd6a9d_o.jpg b/images/original/6178731018_10e6fd6a9d_o.jpg deleted file mode 100644 index e790bf3..0000000 Binary files a/images/original/6178731018_10e6fd6a9d_o.jpg and /dev/null differ diff --git a/images/original/6260329772_7ce10ac83c_o.jpg b/images/original/6260329772_7ce10ac83c_o.jpg deleted file mode 100644 index 7ec94bb..0000000 Binary files a/images/original/6260329772_7ce10ac83c_o.jpg and /dev/null differ diff --git a/images/original/7073381043_e3e50744eb_o.jpg b/images/original/7073381043_e3e50744eb_o.jpg deleted file mode 100644 index 6c887b4..0000000 Binary files a/images/original/7073381043_e3e50744eb_o.jpg and /dev/null differ diff --git a/images/original/8553010494_a36be7fcc8_o.jpg b/images/original/8553010494_a36be7fcc8_o.jpg deleted file mode 100644 index def02ba..0000000 Binary files a/images/original/8553010494_a36be7fcc8_o.jpg and /dev/null differ diff --git a/images/original/8573651373_6650a080d1_o.jpg b/images/original/8573651373_6650a080d1_o.jpg deleted file mode 100644 index 1342a64..0000000 Binary files a/images/original/8573651373_6650a080d1_o.jpg and /dev/null differ diff --git a/images/original/8677766442_7d184f890e_o.jpg b/images/original/8677766442_7d184f890e_o.jpg deleted file mode 100644 index 99b0532..0000000 Binary files a/images/original/8677766442_7d184f890e_o.jpg and /dev/null differ diff --git a/images/original/9212256888_c44fdaa46f_o.jpg b/images/original/9212256888_c44fdaa46f_o.jpg deleted file mode 100644 index b4ce544..0000000 Binary files a/images/original/9212256888_c44fdaa46f_o.jpg and /dev/null differ diff --git a/images/original/9440861328_1326d64dbd_o.jpg b/images/original/9440861328_1326d64dbd_o.jpg deleted file mode 100644 index 3da8594..0000000 Binary files a/images/original/9440861328_1326d64dbd_o.jpg and /dev/null differ diff --git a/images/original/CREDITS.md b/images/original/CREDITS.md deleted file mode 100644 index 8004594..0000000 --- a/images/original/CREDITS.md +++ /dev/null @@ -1,24 +0,0 @@ -Image Credits -============= - -All images are licensed CC BY 2.0 - -file - name - source - - - 14448239362_53203a94bf_o.jpg - Sunrise - https://secure.flickr.com/photos/manal/14448239362 - - 6260329772_7ce10ac83c_o.jpg - transalpina - https://secure.flickr.com/photos/dexxus/6260329772 - - 7073381043_e3e50744eb_o.jpg - Water, rocks, sun, sea and cloud! - https://secure.flickr.com/photos/avidlyabide/7073381043 - - 9440861328_1326d64dbd_o.jpg - Sunday nature - https://secure.flickr.com/photos/pixlense/9440861328 - - 4440609236_fbfbe396b5_o.jpg - Light after Darkness - https://secure.flickr.com/photos/japokskee/4440609236 - - 14459672716_2fd51d6133_o.jpg - A Dragonfly! - https://secure.flickr.com/photos/lingeswaran/14459672716 - - 14461842031_f854d30f15_o.jpg - Marumi DHG Macro 200 + Tamron 17-50mm. 2.8 - https://secure.flickr.com/photos/gaby1/14461842031 - - 6178731018_10e6fd6a9d_o.jpg - Times Square in the rain - https://secure.flickr.com/photos/en321/6178731018 - - 12173370053_39624f5dc6_o.jpg - Manchester City Centre - Northern Quarter Viewed from the 15th Floor - https://secure.flickr.com/photos/staceycav/12173370053 - - 8677766442_7d184f890e_o.jpg - City sunset - https://secure.flickr.com/photos/melburnian/8677766442 - - 8553010494_a36be7fcc8_o.jpg - City Lights - https://secure.flickr.com/photos/duncanh1/8553010494 - - 3155078790_b365637b61_o.jpg - Ready . . . Set .................... - https://secure.flickr.com/photos/oneworldgallery/3155078790 - - 443441197_c38caf32ee_o.jpg - Lights out- https://secure.flickr.com/photos/aussiegall/443441197 - - 4436427104_9cd5f0daba_o.jpg - Golden Gate Bridge - https://secure.flickr.com/photos/kevcole/4436427104 - - 9212256888_c44fdaa46f_o.jpg - Red Spruce Peak - https://secure.flickr.com/photos/dbnunley/9212256888 - - 8573651373_6650a080d1_o.jpg - The Lou Ruvo Center for Brain Health, Las Vegas, Nevada - https://secure.flickr.com/photos/opalsson/8573651373/ - - 1483066391_ba9ceea56a_o.jpg - Nightfall over South End of Stockholm - https://secure.flickr.com/photos/ichimusai/1483066391 diff --git a/images/thumb/12173370053_39624f5dc6_o.jpg b/images/thumb/12173370053_39624f5dc6_o.jpg deleted file mode 100644 index a6b8e14..0000000 Binary files a/images/thumb/12173370053_39624f5dc6_o.jpg and /dev/null differ diff --git a/images/thumb/14448239362_53203a94bf_o.jpg b/images/thumb/14448239362_53203a94bf_o.jpg deleted file mode 100644 index a697db9..0000000 Binary files a/images/thumb/14448239362_53203a94bf_o.jpg and /dev/null differ diff --git a/images/thumb/14459672716_2fd51d6133_o.jpg b/images/thumb/14459672716_2fd51d6133_o.jpg deleted file mode 100644 index 05354b9..0000000 Binary files a/images/thumb/14459672716_2fd51d6133_o.jpg and /dev/null differ diff --git a/images/thumb/14461842031_f854d30f15_o.jpg b/images/thumb/14461842031_f854d30f15_o.jpg deleted file mode 100644 index 3f46e81..0000000 Binary files a/images/thumb/14461842031_f854d30f15_o.jpg and /dev/null differ diff --git a/images/thumb/1483066391_ba9ceea56a_o.jpg b/images/thumb/1483066391_ba9ceea56a_o.jpg deleted file mode 100644 index af6a189..0000000 Binary files a/images/thumb/1483066391_ba9ceea56a_o.jpg and /dev/null differ diff --git a/images/thumb/3155078790_b365637b61_o.jpg b/images/thumb/3155078790_b365637b61_o.jpg deleted file mode 100644 index b0b7c07..0000000 Binary files a/images/thumb/3155078790_b365637b61_o.jpg and /dev/null differ diff --git a/images/thumb/443441197_c38caf32ee_o.jpg b/images/thumb/443441197_c38caf32ee_o.jpg deleted file mode 100644 index e5300e6..0000000 Binary files a/images/thumb/443441197_c38caf32ee_o.jpg and /dev/null differ diff --git a/images/thumb/4436427104_9cd5f0daba_o.jpg b/images/thumb/4436427104_9cd5f0daba_o.jpg deleted file mode 100644 index 15c8958..0000000 Binary files a/images/thumb/4436427104_9cd5f0daba_o.jpg and /dev/null differ diff --git a/images/thumb/4440609236_fbfbe396b5_o.jpg b/images/thumb/4440609236_fbfbe396b5_o.jpg deleted file mode 100644 index c711459..0000000 Binary files a/images/thumb/4440609236_fbfbe396b5_o.jpg and /dev/null differ diff --git a/images/thumb/5578985145_640f215e42_o.jpg b/images/thumb/5578985145_640f215e42_o.jpg deleted file mode 100644 index 07b9fee..0000000 Binary files a/images/thumb/5578985145_640f215e42_o.jpg and /dev/null differ diff --git a/images/thumb/6178731018_10e6fd6a9d_o.jpg b/images/thumb/6178731018_10e6fd6a9d_o.jpg deleted file mode 100644 index ede3701..0000000 Binary files a/images/thumb/6178731018_10e6fd6a9d_o.jpg and /dev/null differ diff --git a/images/thumb/6260329772_7ce10ac83c_o.jpg b/images/thumb/6260329772_7ce10ac83c_o.jpg deleted file mode 100644 index 24d5131..0000000 Binary files a/images/thumb/6260329772_7ce10ac83c_o.jpg and /dev/null differ diff --git a/images/thumb/7073381043_e3e50744eb_o.jpg b/images/thumb/7073381043_e3e50744eb_o.jpg deleted file mode 100644 index d5c04c0..0000000 Binary files a/images/thumb/7073381043_e3e50744eb_o.jpg and /dev/null differ diff --git a/images/thumb/8553010494_a36be7fcc8_o.jpg b/images/thumb/8553010494_a36be7fcc8_o.jpg deleted file mode 100644 index 212ae5c..0000000 Binary files a/images/thumb/8553010494_a36be7fcc8_o.jpg and /dev/null differ diff --git a/images/thumb/8573651373_6650a080d1_o.jpg b/images/thumb/8573651373_6650a080d1_o.jpg deleted file mode 100644 index 4580cde..0000000 Binary files a/images/thumb/8573651373_6650a080d1_o.jpg and /dev/null differ diff --git a/images/thumb/8677766442_7d184f890e_o.jpg b/images/thumb/8677766442_7d184f890e_o.jpg deleted file mode 100644 index 53c50c8..0000000 Binary files a/images/thumb/8677766442_7d184f890e_o.jpg and /dev/null differ diff --git a/images/thumb/9212256888_c44fdaa46f_o.jpg b/images/thumb/9212256888_c44fdaa46f_o.jpg deleted file mode 100644 index 2c722d1..0000000 Binary files a/images/thumb/9212256888_c44fdaa46f_o.jpg and /dev/null differ diff --git a/images/thumb/9440861328_1326d64dbd_o.jpg b/images/thumb/9440861328_1326d64dbd_o.jpg deleted file mode 100644 index dca21a3..0000000 Binary files a/images/thumb/9440861328_1326d64dbd_o.jpg and /dev/null differ diff --git a/images/web/12173370053_39624f5dc6_o.jpg b/images/web/12173370053_39624f5dc6_o.jpg deleted file mode 100644 index 8e85078..0000000 Binary files a/images/web/12173370053_39624f5dc6_o.jpg and /dev/null differ diff --git a/images/web/14448239362_53203a94bf_o.jpg b/images/web/14448239362_53203a94bf_o.jpg deleted file mode 100644 index 05675f3..0000000 Binary files a/images/web/14448239362_53203a94bf_o.jpg and /dev/null differ diff --git a/images/web/14459672716_2fd51d6133_o.jpg b/images/web/14459672716_2fd51d6133_o.jpg deleted file mode 100644 index af2c646..0000000 Binary files a/images/web/14459672716_2fd51d6133_o.jpg and /dev/null differ diff --git a/images/web/14461842031_f854d30f15_o.jpg b/images/web/14461842031_f854d30f15_o.jpg deleted file mode 100644 index 5fa1754..0000000 Binary files a/images/web/14461842031_f854d30f15_o.jpg and /dev/null differ diff --git a/images/web/1483066391_ba9ceea56a_o.jpg b/images/web/1483066391_ba9ceea56a_o.jpg deleted file mode 100644 index 67abf9d..0000000 Binary files a/images/web/1483066391_ba9ceea56a_o.jpg and /dev/null differ diff --git a/images/web/3155078790_b365637b61_o.jpg b/images/web/3155078790_b365637b61_o.jpg deleted file mode 100644 index 86de9f5..0000000 Binary files a/images/web/3155078790_b365637b61_o.jpg and /dev/null differ diff --git a/images/web/443441197_c38caf32ee_o.jpg b/images/web/443441197_c38caf32ee_o.jpg deleted file mode 100644 index 50ff6c4..0000000 Binary files a/images/web/443441197_c38caf32ee_o.jpg and /dev/null differ diff --git a/images/web/4436427104_9cd5f0daba_o.jpg b/images/web/4436427104_9cd5f0daba_o.jpg deleted file mode 100644 index 3cbab7f..0000000 Binary files a/images/web/4436427104_9cd5f0daba_o.jpg and /dev/null differ diff --git a/images/web/4440609236_fbfbe396b5_o.jpg b/images/web/4440609236_fbfbe396b5_o.jpg deleted file mode 100644 index 0a80b10..0000000 Binary files a/images/web/4440609236_fbfbe396b5_o.jpg and /dev/null differ diff --git a/images/web/5578985145_640f215e42_o.jpg b/images/web/5578985145_640f215e42_o.jpg deleted file mode 100644 index 481952c..0000000 Binary files a/images/web/5578985145_640f215e42_o.jpg and /dev/null differ diff --git a/images/web/6178731018_10e6fd6a9d_o.jpg b/images/web/6178731018_10e6fd6a9d_o.jpg deleted file mode 100644 index d30b8ca..0000000 Binary files a/images/web/6178731018_10e6fd6a9d_o.jpg and /dev/null differ diff --git a/images/web/6260329772_7ce10ac83c_o.jpg b/images/web/6260329772_7ce10ac83c_o.jpg deleted file mode 100644 index ddfee82..0000000 Binary files a/images/web/6260329772_7ce10ac83c_o.jpg and /dev/null differ diff --git a/images/web/7073381043_e3e50744eb_o.jpg b/images/web/7073381043_e3e50744eb_o.jpg deleted file mode 100644 index a9be9a9..0000000 Binary files a/images/web/7073381043_e3e50744eb_o.jpg and /dev/null differ diff --git a/images/web/8553010494_a36be7fcc8_o.jpg b/images/web/8553010494_a36be7fcc8_o.jpg deleted file mode 100644 index cadbc3d..0000000 Binary files a/images/web/8553010494_a36be7fcc8_o.jpg and /dev/null differ diff --git a/images/web/8573651373_6650a080d1_o.jpg b/images/web/8573651373_6650a080d1_o.jpg deleted file mode 100644 index 777e14f..0000000 Binary files a/images/web/8573651373_6650a080d1_o.jpg and /dev/null differ diff --git a/images/web/8677766442_7d184f890e_o.jpg b/images/web/8677766442_7d184f890e_o.jpg deleted file mode 100644 index 28e9752..0000000 Binary files a/images/web/8677766442_7d184f890e_o.jpg and /dev/null differ diff --git a/images/web/9212256888_c44fdaa46f_o.jpg b/images/web/9212256888_c44fdaa46f_o.jpg deleted file mode 100644 index a58ccc1..0000000 Binary files a/images/web/9212256888_c44fdaa46f_o.jpg and /dev/null differ diff --git a/images/web/9440861328_1326d64dbd_o.jpg b/images/web/9440861328_1326d64dbd_o.jpg deleted file mode 100644 index cbc2d8a..0000000 Binary files a/images/web/9440861328_1326d64dbd_o.jpg and /dev/null differ diff --git a/index.html b/index.html index 6c6b76e..d1e167c 100644 --- a/index.html +++ b/index.html @@ -1,6 +1,6 @@ - + @@ -9,28 +9,214 @@ Image Lightbox Demo - + + - + + - - Fork me on GitHub -
-
-

Image LightboxResponsive & Touch-Friendly

- +
+
+

Image LightboxResponsive & Touch-Friendly

View source of demos on Github.

-
+
-

With activity indication

  • Sunrise
  • transalpina
  • Water, rocks, sun, sea and cloud!

With overlay & activity indication

  • Sunday nature
  • Light after Darkness
  • A Dragonfly!

With "close" button & activity indication

  • Marumi DHG Macro 200 + Tamron 17-50mm. 2.8
  • Times Square in the rain
  • Manchester City Centre - Northern Quarter Viewed from the 15th Floor

With caption & activity indication

  • City sunset
  • City Lights
  • Ready . . . Set ....................

With navigation & activity indication

  • Lights ou
  • Golden Gate Bridge
  • Red Spruce Peak

Combination

  • The Lou Ruvo Center for Brain Health, Las Vegas, Nevada
  • Nightfall over South End of Stockholm
  • Grand Canyon Morning #dailyshoot
- -
+ + +

Core

+ + + +

With activity indication

+ + + +

With overlay & activity indication

+ + + +

With "close" button & activity indication

+ + + +

With caption & activity indication

+ + + +

With navigation & activity indication

+ + + +

Combination

+ + + + - - - - + + + + + + + + diff --git a/index.php b/index.php deleted file mode 100644 index fa198a5..0000000 --- a/index.php +++ /dev/null @@ -1,65 +0,0 @@ - - - - - - - - - Image Lightbox Demo - - - - - - - - Fork me on GitHub -& activity indication', - 'With "close" button & activity indication', - 'With caption & activity indication', - 'With navigation & activity indication', - 'Combination'); - - - ?> -
-
-

Image LightboxResponsive & Touch-Friendly

- -

View source of demos on Github.

-
- - '.$headings[$round].''; - echo '
    '; - } - echo '
  • '.$json[$i]->name.'
  • '; - if ($i%3==2) { - echo '
'; - } - } - ?> - - -
- - - - - - - diff --git a/package.json b/package.json deleted file mode 100644 index 4640550..0000000 --- a/package.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "engines": { - "node": ">= 0.10.0" - }, - "devDependencies": { - "grunt": "~0.4.2", - "grunt-contrib-commands": "^0.1.6", - "grunt-contrib-copy": "^0.5.0", - "grunt-contrib-sass": "^0.7.3", - "grunt-contrib-watch": "~0.5.3", - "grunt-responsive-images": "^0.1.3" - } -} diff --git a/sass/demo.scss b/sass/demo.scss deleted file mode 100644 index e2e345a..0000000 --- a/sass/demo.scss +++ /dev/null @@ -1,121 +0,0 @@ -body { - font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; -} - -#container { - margin: 50px auto 100px; - padding: 0 20px; - text-align: center; - width: 700px; - - img { - border: .625em solid rgba(255, 255, 255, .5); - // border-color: #eee; - - -moz-box-shadow: 0 0 .313em rgba(0, 0, 0, .05); - -webkit-box-shadow: 0 0 .313em rgba(0, 0, 0, .05); - box-shadow: 0 0 .313em rgba(0, 0, 0, .05); - height: 8.75em; - - -moz-transition: -moz-box-shadow .3s ease, border-color .3s ease; - -ms-transition: -ms-box-shadow .3s ease, border-color .3s ease; - -o-transition: -o-box-shadow .3s ease, border-color .3s ease; - -webkit-transition: -webkit-box-shadow .3s ease, border-color .3s ease; - transition: box-shadow .3s ease, border-color .3s ease; - width: 8.75em; - - &:hover { - border-color: #fff; - - -moz-box-shadow: 0 0 .938em rgba(0, 0, 0, .25); - -webkit-box-shadow: 0 0 .938em rgba(0, 0, 0, .25); - box-shadow: 0 0 .938em rgba(0, 0, 0, .25); - } - } -} - -h1 { - font-size: 37px; - line-height: .882em; - text-transform: uppercase; - - span { - color: #aaa; - display: block; - font-size: .588em; - line-height: 1em; - } - - &:hover { - color: #666; - - span { - color: #666; - } - } -} - -h2 { - border-top: 1px solid #ddd; - margin-bottom: 15px; - margin-top: 45px; - padding-top: 45px; - - span { - color: #666; - } -} - -li { - display: inline-block; - margin: .625em; -} - -footer { - border-top: 1px solid #ddd; - color: #aaa; - font-size: .875em; - margin-top: 2.143em; - padding-top: 2.143em; - - a { - color: #666; - } -} - - -#fork-button { - display: none; -} - -@media only screen and (max-width: 660px) { - #container { - width: 90%; - - &:before, - &:after { - content: ' '; - display: table; - } - } - - #fork-ribbon { - display: none; - } - - #fork-button { - display: inline-block; - } - - h1 { - margin-bottom: 5px; - } - - h2:first-of-type { - margin-top: 30px; - } -} - -ul { - padding: 0; -} diff --git a/touch-imagelightbox.css b/touch-imagelightbox.css new file mode 100644 index 0000000..f1911e9 --- /dev/null +++ b/touch-imagelightbox.css @@ -0,0 +1 @@ +#imagelightbox-loading,#imagelightbox-loading div{border-radius:50%}#imagelightbox-loading{box-shadow:rgba(0,0,0,0.75) 0 0 40px;background:rgba(0,0,0,0.5);height:20px;left:50%;margin:-20px 0 0 -20px;padding:10px;position:fixed;top:50%;width:20px;z-index:10003;animation:fade-in .25s linear}#imagelightbox-loading div{animation:imagelightbox-loading .5s ease infinite;background-color:#fff;height:20px;width:20px}@keyframes imagelightbox-loading{0%{opacity:.5;transform:scale(0.75)}50%{opacity:1;transform:scale(1)}100%{opacity:.5;transform:scale(0.75)}}@keyframes fade-in{0%{opacity:0}100%{opacity:1}}#imagelightbox-overlay{background:rgba(255,255,255,0.9);bottom:0;left:0;position:fixed;right:0;top:0;z-index:9998;animation:fade-in .25s linear}@keyframes fade-in{0%{opacity:0}100%{opacity:1}}#imagelightbox-close{border-radius:50%;background-color:#666;height:40px;position:fixed;right:40px;text-align:left;text-indent:-9999px;top:40px;transition:color .3s ease;width:40px;z-index:10002;cursor:pointer;animation:fade-in .25s linear}#imagelightbox-close:hover{background-color:#111}#imagelightbox-close:before,#imagelightbox-close:after{background-color:#fff;bottom:20%;content:'';left:50%;margin-left:-1px;position:absolute;top:20%;width:2px}#imagelightbox-close:before{rotate:45deg}#imagelightbox-close:after{rotate:-45deg}@keyframes fade-in{0%{opacity:0}100%{opacity:1}}@media only screen and (max-width: 660px){#imagelightbox-close{right:20px;top:20px}}#imagelightbox-nav-sink{display:flex;justify-content:center}#imagelightbox-nav{border-radius:20px;animation:fade-in .25s linear;background-color:rgba(0,0,0,0.5);bottom:60px;padding:5px 2px 1px;position:fixed;z-index:10001}#imagelightbox-nav a{border-radius:50%;border:1px solid #fff;display:inline-block;height:20px;margin:0 5px;width:20px}#imagelightbox-nav .active{background-color:#fff}@media only screen and (max-width: 660px){#imagelightbox-nav{bottom:20px}}@keyframes fade-in{0%{opacity:0}100%{opacity:1}}#imagelightbox-caption{background-color:#666;bottom:0;color:#fff;left:0;padding:10px;position:fixed;right:0;text-align:center;z-index:10001;animation:fade-in .25s linear}@keyframes fade-in{0%{opacity:0}100%{opacity:1}}html{-ms-touch-action:manipulation;touch-action:manipulation}#imagelightbox{-ms-touch-action:none;touch-action:none;box-shadow:rgba(0,0,0,0.75) 0 0 50px;cursor:pointer;position:fixed;z-index:10000} diff --git a/touch-imagelightbox.js b/touch-imagelightbox.js new file mode 100644 index 0000000..1117518 --- /dev/null +++ b/touch-imagelightbox.js @@ -0,0 +1,1214 @@ +var LightBox = +/******/ (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] = { +/******/ exports: {}, +/******/ id: moduleId, +/******/ loaded: false +/******/ }; + +/******/ // Execute the module function +/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); + +/******/ // Flag the module as loaded +/******/ module.loaded = 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; + +/******/ // __webpack_public_path__ +/******/ __webpack_require__.p = ""; + +/******/ // Load entry module and return exports +/******/ return __webpack_require__(0); +/******/ }) +/************************************************************************/ +/******/ ([ +/* 0 */ +/***/ function(module, exports, __webpack_require__) { + + __webpack_require__(1); + __webpack_require__(8); + __webpack_require__(9); + module.exports = __webpack_require__(10); + + +/***/ }, +/* 1 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); /** + * Created by Victor Häggqvist on 1/12/16. + */ + + Object.defineProperty(exports, "__esModule", { + value: true + }); + exports.LightBox = undefined; + + var _CSSUtil = __webpack_require__(2); + + var _animate = __webpack_require__(3); + + var _LightDirection = __webpack_require__(4); + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + var log = __webpack_require__(5); + + log.setDefaultLevel(log.levels.DEBUG); + + var LightBox = exports.LightBox = function () { + function LightBox(targetSelector) { + var options = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1]; + + _classCallCheck(this, LightBox); + + log.info('LightBox'); + this.targets = document.querySelectorAll(targetSelector); + log.debug(this.targets); + + log.debug('HAS_TOUCH ' + LightBox.HAS_TOUCH); + var defaultOptions = { + allowedTypes: 'png|jpg|jpeg|gif', + selectorId: 'imagelightbox', + animationSpeed: 350, + preloadNext: true, + enableKeyboard: true, + quitOnEnd: false, + quitOnImgClick: false, + quitOnDocClick: true, + //onStart: false, + //onEnd: false, + //onLoadStart: false, + //onLoadEnd: false, + requestFullscreenOnMobile: true + }; + + this.options = Object.assign(options, defaultOptions); + log.info(this.options); + + this.target = null; + this.image = null; + this.imageWidth = 0; + this.imageHeight = 0; + this.swipeDiff = 0; + this.inProgress = false; + + this.swipeStart = 0; + this.swipeEnd = 0; + this.imagePosLeft = 0; + + this.onStartListeners = []; + this.onEndListeners = []; + this.onLoadStartListeners = []; + this.onLoadEndListeners = []; + + this.bindEvents(); + } + + _createClass(LightBox, [{ + key: 'bindEvents', + value: function bindEvents() { + var _this = this; + + Array.prototype.forEach.call(this.targets, function (ele) { + ele.addEventListener('click', _this.onImageClick.bind(_this)); + }); + window.addEventListener('resize', this.windowResizeListener.bind(this)); + + if (this.options.quitOnDocClick) { + document.body.addEventListener(LightBox.HAS_TOUCH ? 'touchend' : 'click', this.documentClick.bind(this)); + } + + if (this.options.enableKeyboard) { + document.body.addEventListener('keyup', this.handleKeyboard.bind(this)); + } + + //document.querySelector('#'+this.options.selectorId).addEventListener('click', this.floatingImageClick.bind(this)); + } + }, { + key: 'handleKeyboard', + value: function handleKeyboard(e) { + if (this.image === null) return true; + + e.preventDefault(); + + if (e.keyCode === 27) this.quitLightbox(); + + if (e.keyCode === 37 || e.keyCode === 39) { + var gotoIndex = Array.prototype.indexOf.call(this.targets, this.target) - (e.keyCode === 37 ? 1 : -1); + + if (gotoIndex > this.targets.length - 1) { + this.target = this.targets[0]; + } else if (gotoIndex < 0) { + this.target = this.targets[this.targets.length - 1]; + } else { + this.target = this.targets[gotoIndex]; + } + + this.loadImage(e.keyCode === 37 ? _LightDirection.LightDirection.LEFT : _LightDirection.LightDirection.RIGHT); + } + } + }, { + key: 'documentClick', + value: function documentClick() { + log.debug('document click'); + + if (this.image !== null && this.target.href === this.image.src) { + log.info('quitting'); + this.quitLightbox(); + } + } + }, { + key: 'quitLightbox', + value: function quitLightbox() { + var _this2 = this; + + log.debug('quitLightbox'); + if (this.image === null) return false; + + _CSSUtil.CSSUtil.setTransitionProperty(this.image, 'opacity ' + this.options.animationSpeed / 1000 + 's linear'); + setTimeout(function () { + // without timeout it's to fast to make it fade and just jumps to 1 instant + _this2.image.style.opacity = 0; + }, 5); + + setTimeout(function () { + _this2.removeImage(); + _this2.inProgress = false; + if (_this2.options.onEnd !== false) _this2.options.onEnd(); + }, this.options.animationSpeed); + } + }, { + key: 'onImageClick', + value: function onImageClick(event) { + console.log(event); + var element = event.srcElement.parentElement; + //console.log(this.isTargetValid(nav)); + if (!this.isTargetValid(element)) return true; + + event.preventDefault(); + + //if (LightBox.HAS_TOUCH) { + // log.debug('requesting fullscreen'); + // document.body.webkitRequestFullscreen() + //} + + if (this.inProgress) return; + + this.inProgress = false; + + this.onStartListener.forEach(function (l) { + return l(); + }); + + this.target = element; + + this.loadImage(); + } + }, { + key: 'isTargetValid', + value: function isTargetValid(element) { + var validTypes = new RegExp("(\.(" + this.options.allowedTypes + ")$)"); + + return element.tagName.toLowerCase() === 'a' && validTypes.test(element.href); + } + }, { + key: 'loadImage', + value: function loadImage() { + var _this3 = this; + + var direction = arguments.length <= 0 || arguments[0] === undefined ? false : arguments[0]; + + log.info('loadImage'); + if (this.inProgress) return false; + log.debug('not progress'); + + if (this.image !== null) { + log.debug('has current image'); + if (direction !== false && (this.targets.length < 2 || this.options.quitOnEnd === true && (direction === _LightDirection.LightDirection.RIGHT && Array.prototype.indexOf(this.targets, this.target) === 0 || direction === _LightDirection.LightDirection.LEFT && Array.prototype.indexOf(this.targets, this.target) === targets.length - 1))) { + //quitLightbox(); + return false; + } + + log.debug('unload'); + + _CSSUtil.CSSUtil.setTransitionProperty(this.image, 'opacity ' + this.options.animationSpeed / 1000 + 's linear'); + var transitionArgs = 100 * direction - this.swipeDiff + 'px'; + this.image.style.transform = 'translateX(' + transitionArgs + ')'; + + setTimeout(function () { + // without timeout it's to fast to make it fade and just jumps to 1 instant + _this3.image.style.opacity = 0; + }, 5); + + setTimeout(function () { + log.debug('remove from dom'); + _this3.removeImage(); + }, this.options.animationSpeed); + + this.swipeDiff = 0; + } + + this.inProgress = true; + this.onLoadStartListeners.forEach(function (l) { + return l(); + }); + + setTimeout(function () { + log.debug('loadImage in'); + var image = new Image(); + _this3.image = image; + image.onload = function () { + image.id = _this3.options.selectorId; + log.debug('img loaded'); + document.body.appendChild(image); + _this3.setImage(); + + image.style.opacity = 0; + + var interpretedSpeed = _this3.options.animationSpeed / 1000; + log.debug(interpretedSpeed); + _CSSUtil.CSSUtil.setTransitionProperty(image, 'opacity ' + interpretedSpeed + 's ease'); + image.style.transform = 'translateX(0px)'; + + setTimeout(function () { + // without timeout it's to fast to make it fade and just jumps to 1 instant + image.style.opacity = 1; + }, 10); + + setTimeout(function () { + _this3.inProgress = false; + _this3.onLoadEndListeners.forEach(function (l) { + return l(); + }); + }, _this3.options.animationSpeed); + + if (_this3.options.preloadNext) { + var index = Array.prototype.indexOf.call(_this3.targets, _this3.target); + var next = _this3.targets[index + 1]; + + if (next !== null) { + log.debug('preloading next'); + var nextImg = new Image(); + nextImg.src = next.href; + } else { + log.debug('no preloading'); + } + } + }; + image.src = _this3.target.href; + + _this3.swipeStart = 0; + _this3.swipeEnd = 0; + //this.imagePosLeft = 0; + + if (LightBox.HAS_POINTERS) { + image.addEventListener('pointerup', _this3.imageClickEvent.bind(_this3)); + image.addEventListener('MSPointerUp', _this3.imageClickEvent.bind(_this3)); + } else { + image.addEventListener('click', _this3.imageClickEvent.bind(_this3)); + } + + ['touchstart', 'pointerdown', 'MSPointerDown'].forEach(function (name) { + image.addEventListener(name, _this3.imageTouchStart.bind(_this3)); + }); + + ['touchmove', 'pointermove', 'MSPointerMove'].forEach(function (name) { + image.addEventListener(name, _this3.imageTouchMove.bind(_this3)); + }); + + ['touchend', 'touchcancel', 'pointerup', 'MSPointerUp'].forEach(function (name) { + image.addEventListener(name, _this3.imageTouchEnd.bind(_this3)); + }); + }, this.options.animationSpeed + 100); + } + }, { + key: 'removeImage', + value: function removeImage() { + document.body.removeChild(this.image); + this.image = null; + } + }, { + key: 'imageClickEvent', + value: function imageClickEvent(e) { + e.preventDefault(); + log.debug('click'); + + if (this.options.quitOnImgClick) { + L.i('implement this'); + //quitLightbox(); + return false; + } + + if (this.wasTouched(e)) return true; + + var posX = e.pageX - e.target.offsetLeft; + log.debug(posX); + + var gotoIndex = Array.prototype.indexOf.call(this.targets, this.target) - (this.imageWidth / 2 > posX ? 1 : -1); + + if (gotoIndex > this.targets.length - 1) { + this.target = this.targets[0]; + } else if (gotoIndex < 0) { + this.target = this.targets[this.targets.length - 1]; + } else { + this.target = this.targets[gotoIndex]; + } + + this.loadImage(this.imageWidth / 2 > posX ? _LightDirection.LightDirection.LEFT : _LightDirection.LightDirection.RIGHT); + } + }, { + key: 'imageTouchStart', + value: function imageTouchStart(e) { + if (!this.wasTouched(e) || this.options.quitOnImgClick) return true; + + this.swipeStart = e.pageX || e.touches[0].pageX; + } + }, { + key: 'imageTouchMove', + value: function imageTouchMove(e) { + if (!this.wasTouched(e) || this.options.quitOnImgClick) return true; + + e.preventDefault(); + this.swipeEnd = e.pageX || e.touches[0].pageX; + this.swipeDiff = this.swipeStart - this.swipeEnd; + + this.image.style.transform = 'translateX(' + -this.swipeDiff + 'px)'; + //CSSUtil.setTransitionProperty(this.image, 'transform 0s linear'); + } + }, { + key: 'imageTouchEnd', + value: function imageTouchEnd(e) { + if (!this.wasTouched(e) || this.options.quitOnImgClick) return true; + + log.debug(this.swipeDiff); + if (Math.abs(this.swipeDiff) > 50) { + var gotoIndex = Array.prototype.indexOf.call(this.targets, this.target) - (this.swipeDiff < 0 ? 1 : -1); + + if (gotoIndex > this.targets.length - 1) { + this.target = this.targets[0]; + } else if (gotoIndex < 0) { + this.target = this.targets[this.targets.length - 1]; + } else { + this.target = this.targets[gotoIndex]; + } + + var direction = this.swipeDiff > 0 ? _LightDirection.LightDirection.RIGHT : _LightDirection.LightDirection.LEFT; + this.loadImage(direction); + } else { + this.image.style.transform = 'translateX(0px)'; + //CSSUtil.setTransitionProperty(this.image, 'transform '+ options.animationSpeed / 1000 +'s linear'); + } + } + }, { + key: 'setImage', + value: function setImage() { + var _this4 = this; + + if (!this.image) return false; + + var screenWidth = window.innerWidth * 0.8; + var screenHeight = window.innerHeight * 0.9; + + var tmpImage = new Image(); + tmpImage.src = this.image.src; + tmpImage.onload = function () { + _this4.imageWidth = tmpImage.width; + _this4.imageHeight = tmpImage.height; + + if (_this4.imageWidth > screenWidth || _this4.imageHeight > screenHeight) { + var ratio = _this4.imageWidth / _this4.imageHeight > screenWidth / screenHeight ? _this4.imageWidth / screenWidth : _this4.imageHeight / screenHeight; + _this4.imageWidth /= ratio; + _this4.imageHeight /= ratio; + } + + _this4.image.style.width = _this4.imageWidth + 'px'; + _this4.image.style.height = _this4.imageHeight + 'px'; + _this4.image.style.top = (window.innerHeight - _this4.imageHeight) / 2 + 'px'; + _this4.image.style.left = (window.innerWidth - _this4.imageWidth) / 2 + 'px'; + }; + } + }, { + key: 'wasTouched', + value: function wasTouched(event) { + if (LightBox.HAS_TOUCH) return true; + + if (!LightBox.HAS_POINTERS || typeof event === 'undefined' || typeof event.pointerType === 'undefined') return false; + + if (typeof event.MSPOINTER_TYPE_MOUSE !== 'undefined') { + if (event.MSPOINTER_TYPE_MOUSE !== event.pointerType) return true; + } else { + if (event.pointerType !== 'mouse') return true; + } + + return false; + } + }, { + key: 'windowResizeListener', + value: function windowResizeListener() { + log.debug('resized'); + this.setImage(); + } + }, { + key: 'addOnStartListener', + value: function addOnStartListener(listener) { + this.onStartListeners.push(listener); + } + }, { + key: 'addOnEndListener', + value: function addOnEndListener(listener) { + this.onEndListeners.push(listener); + } + }, { + key: 'addOnLoadStartListener', + value: function addOnLoadStartListener(listener) { + this.onLoadStartListeners.push(listener); + } + }, { + key: 'addOnLoadEndListener', + value: function addOnLoadEndListener(listener) { + this.onLoadEndListeners.push(listener); + } + }, { + key: 'registerPlugin', + value: function registerPlugin(plugin) { + plugin.register(this); + } + }]); + + return LightBox; + }(); + + LightBox.HAS_TOUCH = 'ontouchstart' in window; + LightBox.HAS_POINTERS = window.navigator.pointerEnabled || window.navigator.msPointerEnabled; + +/***/ }, +/* 2 */ +/***/ function(module, exports) { + + 'use strict'; + + var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + /** + * Created by Victor Häggqvist on 1/12/16. + */ + + var CSSUtil = exports.CSSUtil = function () { + function CSSUtil() { + _classCallCheck(this, CSSUtil); + } + + _createClass(CSSUtil, null, [{ + key: 'setTransitionProperty', + + /** + * transion need to be set on property + * + * using key-value dont work + * + * @param ele DOMElement + * @param value + */ + value: function setTransitionProperty(ele, value) { + var style = ele.style; + if (style.transition === '') { + style.transition = value; + return; + } + if (style.WebkitTransition === '') { + style.WebkitTransition = value; + return; + } + if (style.MozTransition === '') { + style.MozTransition = value; + return; + } + if (style.OTransition === '') { + style.OTransition = value; + } + } + }, { + key: 'cssTransitionSupport', + value: function cssTransitionSupport() { + var d = document.body || document.documentElement, + s = d.style; + if (s.WebkitTransition === '') return '-webkit-'; + if (s.MozTransition === '') return '-moz-'; + if (s.OTransition === '') return '-o-'; + if (s.transition === '') return ''; + return false; + } + }, { + key: 'cssTransitionTranslateX', + value: function cssTransitionTranslateX(element, positionX, speed) { + var options = {}; + var prefix = CSSUtil.cssTransitionSupport(); + element.style[prefix + 'transform'] = 'translateX(' + positionX + ')'; + element.style[prefix + 'transition'] = prefix + 'transform ' + speed + 's linear'; + //nav.style = Object.assign(options, nav.style); + } + }]); + + return CSSUtil; + }(); + + CSSUtil.isCssTransitionSupport = CSSUtil.cssTransitionSupport() !== false; + +/***/ }, +/* 3 */ +/***/ function(module, exports) { + + "use strict"; + + var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; }; + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } } + + var animate = exports.animate = function () { + + "use strict"; + + var defaults = { + delay: 0, + duration: 400, + easing: "ease" + }; + + // array utils =================================================================================== + + var head = function head(arr) { + return arr[0]; + }; + + var tail = function tail(arr) { + return arr.slice(1); + }; + + var contains = function () { + return Array.prototype.includes ? function (arr, value) { + return arr.includes(value); + } : function (arr, value) { + return arr.some(function (el) { + return el === value; + }); + }; + }(); + + var toArray = function toArray(obj) { + if (obj.nodeType) { + return [obj]; + } + if (Array.isArray(obj)) { + return obj; + } + return [].concat(_toConsumableArray(obj)); + }; + + // params utils ================================================================================== + + var requireParams = function requireParams(func) { + return function (params) { + if ((typeof params === "undefined" ? "undefined" : _typeof(params)) != "object") return; + func(params); + }; + }; + + var getParamsEl = function getParamsEl(el) { + return toArray(typeof el == "string" ? selectElements(el) : el); + }; + + // misc utils ==================================================================================== + + var selectElements = function selectElements(selector) { + var context = arguments.length <= 1 || arguments[1] === undefined ? document : arguments[1]; + + if (/^[\#.]?[\w-]+$/.test(selector)) { + if (head(selector) == ".") { + return context.getElementsByClassName(tail(selector)); + } + if (head(selector) == "#") { + return context.getElementById(tail(selector)); + } + return context.getElementsByTagName(selector); + } + return context.querySelectorAll(selector); + }; + + var hasUnit = function hasUnit(value) { + return (/\D$/.test(value) + ); + }; + + // transition ==================================================================================== + + var setTransition = function () { + var addUnit = function addUnit(value) { + if (hasUnit(value)) { + return value; + } + return value + "ms"; + }; + return function (el, params) { + var transition = { + "property": "opacity," + transformProperty(), + "duration": addUnit(params.duration || defaults.duration), + "timing-function": params.easing || defaults.easing, + "delay": addUnit(params.delay || defaults.delay) + }; + Object.keys(transition).forEach(function (prop) { + el.style["transition-" + prop] = transition[prop]; + }); + }; + }(); + + var clearTransition = function clearTransition(params) { + var clearListener = function clearListener(event) { + event.target.removeEventListener("transitionend", clearListener); + if (!params.complete) return; + params.complete.call(event.target); + }; + return clearListener; + }; + + // opacity ======================================================================================= + + var setOpacity = function setOpacity(el, params) { + if (params.opacity == undefined) return; + el.style.opacity = params.opacity; + }; + + // transform ===================================================================================== + + var transformProperty = function () { + var transform; + return function () { + if (!transform) { + transform = "transform" in document.body.style ? "transform" : "-webkit-transform"; + } + return transform; + }; + }(); + + var isTransform = function () { + var ignore = ["complete", "el", "opacity"].concat(Object.keys(defaults)); + return function (key) { + return !contains(ignore, key); + }; + }(); + + var getTransformFunctions = function getTransformFunctions(params) { + return Object.keys(params).filter(function (key) { + return isTransform(key); + }); + }; + + var setTransform = function () { + var addUnit = function addUnit(transformFunction, value) { + if (hasUnit(value) || /scale/.test(transformFunction)) { + return value; + } + if (/rotate|skew/.test(transformFunction)) { + return value + "deg"; + } + return value + "px"; + }; + return function (el, params) { + var transforms = getTransformFunctions(params); + if (!transforms.length) return; + el.style[transformProperty()] = transforms.map(function (func) { + return func + "(" + addUnit(func, params[func]) + ")"; + }).join(" "); + }; + }(); + + // init ========================================================================================== + + var setStyle = function setStyle(params) { + return function (el) { + // wait for the next frame + requestAnimationFrame(function () { + [setTransition, setOpacity, setTransform].forEach(function (func) { + func(el, params); + }); + }); + el.addEventListener("transitionend", clearTransition(params)); + }; + }; + + return requireParams(function (params) { + getParamsEl(params.el).forEach(setStyle(params)); + }); + }(); + +/***/ }, +/* 4 */ +/***/ function(module, exports) { + + "use strict"; + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + /** + * Created by Victor Häggqvist on 1/14/16. + */ + + var LightDirection = exports.LightDirection = function LightDirection() { + _classCallCheck(this, LightDirection); + }; + + LightDirection.LEFT = 1; + LightDirection.RIGHT = -1; + +/***/ }, +/* 5 */ +/***/ function(module, exports, __webpack_require__) { + + var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function(module) {'use strict'; + + var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; }; + + /* + * loglevel - https://github.com/pimterry/loglevel + * + * Copyright (c) 2013 Tim Perry + * Licensed under the MIT license. + */ + (function (root, definition) { + "use strict"; + + if (( false ? 'undefined' : _typeof(module)) === 'object' && module.exports && "function" === 'function') { + module.exports = definition(); + } else if ("function" === 'function' && _typeof(__webpack_require__(7)) === 'object') { + !(__WEBPACK_AMD_DEFINE_FACTORY__ = (definition), __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? (__WEBPACK_AMD_DEFINE_FACTORY__.call(exports, __webpack_require__, exports, module)) : __WEBPACK_AMD_DEFINE_FACTORY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); + } else { + root.log = definition(); + } + })(undefined, function () { + "use strict"; + + var noop = function noop() {}; + var undefinedType = "undefined"; + + function realMethod(methodName) { + if ((typeof console === 'undefined' ? 'undefined' : _typeof(console)) === undefinedType) { + return false; // We can't build a real method without a console to log to + } else if (console[methodName] !== undefined) { + return bindMethod(console, methodName); + } else if (console.log !== undefined) { + return bindMethod(console, 'log'); + } else { + return noop; + } + } + + function bindMethod(obj, methodName) { + var method = obj[methodName]; + if (typeof method.bind === 'function') { + return method.bind(obj); + } else { + try { + return Function.prototype.bind.call(method, obj); + } catch (e) { + // Missing bind shim or IE8 + Modernizr, fallback to wrapping + return function () { + return Function.prototype.apply.apply(method, [obj, arguments]); + }; + } + } + } + + // these private functions always need `this` to be set properly + + function enableLoggingWhenConsoleArrives(methodName, level, loggerName) { + return function () { + if ((typeof console === 'undefined' ? 'undefined' : _typeof(console)) !== undefinedType) { + replaceLoggingMethods.call(this, level, loggerName); + this[methodName].apply(this, arguments); + } + }; + } + + function replaceLoggingMethods(level, loggerName) { + /*jshint validthis:true */ + for (var i = 0; i < logMethods.length; i++) { + var methodName = logMethods[i]; + this[methodName] = i < level ? noop : this.methodFactory(methodName, level, loggerName); + } + } + + function defaultMethodFactory(methodName, level, loggerName) { + /*jshint validthis:true */ + return realMethod(methodName) || enableLoggingWhenConsoleArrives.apply(this, arguments); + } + + var logMethods = ["trace", "debug", "info", "warn", "error"]; + + function Logger(name, defaultLevel, factory) { + var self = this; + var currentLevel; + var storageKey = "loglevel"; + if (name) { + storageKey += ":" + name; + } + + function persistLevelIfPossible(levelNum) { + var levelName = (logMethods[levelNum] || 'silent').toUpperCase(); + + // Use localStorage if available + try { + window.localStorage[storageKey] = levelName; + return; + } catch (ignore) {} + + // Use session cookie as fallback + try { + window.document.cookie = encodeURIComponent(storageKey) + "=" + levelName + ";"; + } catch (ignore) {} + } + + function getPersistedLevel() { + var storedLevel; + + try { + storedLevel = window.localStorage[storageKey]; + } catch (ignore) {} + + if ((typeof storedLevel === 'undefined' ? 'undefined' : _typeof(storedLevel)) === undefinedType) { + try { + var cookie = window.document.cookie; + var location = cookie.indexOf(encodeURIComponent(storageKey) + "="); + if (location) { + storedLevel = /^([^;]+)/.exec(cookie.slice(location))[1]; + } + } catch (ignore) {} + } + + // If the stored level is not valid, treat it as if nothing was stored. + if (self.levels[storedLevel] === undefined) { + storedLevel = undefined; + } + + return storedLevel; + } + + /* + * + * Public API + * + */ + + self.levels = { "TRACE": 0, "DEBUG": 1, "INFO": 2, "WARN": 3, + "ERROR": 4, "SILENT": 5 }; + + self.methodFactory = factory || defaultMethodFactory; + + self.getLevel = function () { + return currentLevel; + }; + + self.setLevel = function (level, persist) { + if (typeof level === "string" && self.levels[level.toUpperCase()] !== undefined) { + level = self.levels[level.toUpperCase()]; + } + if (typeof level === "number" && level >= 0 && level <= self.levels.SILENT) { + currentLevel = level; + if (persist !== false) { + // defaults to true + persistLevelIfPossible(level); + } + replaceLoggingMethods.call(self, level, name); + if ((typeof console === 'undefined' ? 'undefined' : _typeof(console)) === undefinedType && level < self.levels.SILENT) { + return "No console available for logging"; + } + } else { + throw "log.setLevel() called with invalid level: " + level; + } + }; + + self.setDefaultLevel = function (level) { + if (!getPersistedLevel()) { + self.setLevel(level, false); + } + }; + + self.enableAll = function (persist) { + self.setLevel(self.levels.TRACE, persist); + }; + + self.disableAll = function (persist) { + self.setLevel(self.levels.SILENT, persist); + }; + + // Initialize with the right level + var initialLevel = getPersistedLevel(); + if (initialLevel == null) { + initialLevel = defaultLevel == null ? "WARN" : defaultLevel; + } + self.setLevel(initialLevel, false); + } + + /* + * + * Package-level API + * + */ + + var defaultLogger = new Logger(); + + var _loggersByName = {}; + defaultLogger.getLogger = function getLogger(name) { + if (typeof name !== "string" || name === "") { + throw new TypeError("You must supply a name when creating a logger."); + } + + var logger = _loggersByName[name]; + if (!logger) { + logger = _loggersByName[name] = new Logger(name, defaultLogger.getLevel(), defaultLogger.methodFactory); + } + return logger; + }; + + // Grab the current global log variable in case of overwrite + var _log = (typeof window === 'undefined' ? 'undefined' : _typeof(window)) !== undefinedType ? window.log : undefined; + defaultLogger.noConflict = function () { + if ((typeof window === 'undefined' ? 'undefined' : _typeof(window)) !== undefinedType && window.log === defaultLogger) { + window.log = _log; + } + + return defaultLogger; + }; + + return defaultLogger; + }); + /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(6)(module))) + +/***/ }, +/* 6 */ +/***/ function(module, exports) { + + "use strict"; + + module.exports = function (module) { + if (!module.webpackPolyfill) { + module.deprecate = function () {}; + module.paths = []; + // module.parent = undefined by default + module.children = []; + module.webpackPolyfill = 1; + } + return module; + }; + +/***/ }, +/* 7 */ +/***/ function(module, exports) { + + /* WEBPACK VAR INJECTION */(function(__webpack_amd_options__) {module.exports = __webpack_amd_options__; + + /* WEBPACK VAR INJECTION */}.call(exports, {})) + +/***/ }, +/* 8 */ +/***/ function(module, exports) { + + 'use strict'; + + var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + /** + * Created by Victor Häggqvist on 1/14/16. + */ + + var ActivityIndicator = exports.ActivityIndicator = function () { + function ActivityIndicator() { + _classCallCheck(this, ActivityIndicator); + + this.nav = document.createElement('div'); + this.nav.id = 'imagelightbox-loading'; + this.nav.appendChild(document.createElement('div')); + } + + /** + * + * @param {LightBox} lightbox + */ + + _createClass(ActivityIndicator, [{ + key: 'register', + value: function register(lightbox) { + lightbox.addOnLoadStartListener(this.activityIndicatorOn.bind(this)); + lightbox.addOnLoadEndListener(this.activityIndicatorOff.bind(this)); + lightbox.addOnEndListener(this.activityIndicatorOff.bind(this)); + } + }, { + key: 'activityIndicatorOn', + value: function activityIndicatorOn() { + document.body.appendChild(this.nav); + //$('
' ).appendTo('body'); + } + }, { + key: 'activityIndicatorOff', + value: function activityIndicatorOff() { + document.body.removeChild(this.nav); + //$('#imagelightbox-loading').remove(); + } + }]); + + return ActivityIndicator; + }(); + +/***/ }, +/* 9 */ +/***/ function(module, exports) { + + 'use strict'; + + var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + /** + * Created by Victor Häggqvist on 1/14/16. + */ + + var CloseButton = exports.CloseButton = function () { + function CloseButton() { + _classCallCheck(this, CloseButton); + + this.nav = document.createElement('a'); + this.nav.id = 'imagelightbox-close'; + this.nav.innerHTML = 'Close'; + } + + _createClass(CloseButton, [{ + key: 'register', + value: function register(lightbox) { + this.lightbox = lightbox; + lightbox.addOnStartListener(this.showButton.bind(this)); + lightbox.addOnEndListener(this.hideButton.bind(this)); + } + }, { + key: 'showButton', + value: function showButton() { + var _this = this; + + ['click', 'touchend'].forEach(function (name) { + _this.nav.addEventListener(name, _this.exitLightbox.bind(_this)); + }); + + document.body.appendChild(this.nav); + + //$('Close').appendTo('body') + // .on('click touchend', function(){ $(this).remove(); instance.quitImageLightbox(); return false; }); + } + }, { + key: 'hideButton', + value: function hideButton() { + document.body.removeChild(this.nav); + } + }, { + key: 'exitLightbox', + value: function exitLightbox() { + this.lightbox.quitImageLightbox(); + } + }]); + + return CloseButton; + }(); + +/***/ }, +/* 10 */ +/***/ function(module, exports) { + + 'use strict'; + + var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + /** + * Created by Victor Häggqvist on 1/14/16. + */ + + var Overlay = exports.Overlay = function () { + function Overlay() { + _classCallCheck(this, Overlay); + + this.nav = document.createElement('div'); + this.nav.id = 'imagelightbox-overlay'; + } + + _createClass(Overlay, [{ + key: 'register', + value: function register(lightbox) { + lightbox.addOnStartListener(this.overlayOn.bind(this)); + lightbox.addOnEndListener(this.overlayOff.bind(this)); + } + }, { + key: 'overlayOn', + value: function overlayOn() { + document.body.appendChild(this.nav); + } + }, { + key: 'overlayOff', + value: function overlayOff() { + document.body.removeChild(this.nav); + } + }]); + + return Overlay; + }(); + +/***/ } +/******/ ]); diff --git a/touch-imagelightbox.min.js b/touch-imagelightbox.min.js deleted file mode 100644 index 8e5aacf..0000000 --- a/touch-imagelightbox.min.js +++ /dev/null @@ -1,5 +0,0 @@ -/*! touch-imagelightbox - v0.1.0 - 2014-06-27 -* https://github.com/victorhaggqvist/touch-imagelightbox -* Copyright (c) 2014 Osvaldas Valutis (www.osvaldas.info); Licensed MIT -* Contributors Victor Häggqvist (victorhaggqvist.com) */ -!function(a,b,c){"use strict";var d,e=function(){var a=c.body||c.documentElement,b=a.style;return""===b.WebkitTransition?"-webkit-":""===b.MozTransition?"-moz-":""===b.OTransition?"-o-":""===b.transition?"":!1},f=e()===!1?!1:!0,g=function(a,b,c){d={};var f=e();d[f+"transform"]="translateX("+b+")",d[f+"transition"]=f+"transform "+c+"s linear",a.css(d)},h="ontouchstart"in b,i=b.navigator.pointerEnabled||b.navigator.msPointerEnabled,j=function(a){if(h)return!0;if(!i||"undefined"==typeof a||"undefined"==typeof a.pointerType)return!1;if("undefined"!=typeof a.MSPOINTER_TYPE_MOUSE){if(a.MSPOINTER_TYPE_MOUSE!==a.pointerType)return!0}else if("mouse"!==a.pointerType)return!0;return!1};a.fn.imageLightbox=function(d){d=a.extend({selector:'id="imagelightbox"',allowedTypes:"png|jpg|jpeg|gif",animationSpeed:250,preloadNext:!0,enableKeyboard:!0,quitOnEnd:!1,quitOnImgClick:!1,quitOnDocClick:!0,onStart:!1,onEnd:!1,onLoadStart:!1,onLoadEnd:!1},d);var e=a([]),k=a(),l=a(),m=0,n=0,o=0,p=!1,q=function(b){return d.regexValidObject=new RegExp("(.("+d.allowedTypes+")$)"),"a"===a(b).prop("tagName").toLowerCase()&&d.regexValidObject.test(a(b).attr("href"))},r=function(){if(!l.length)return!1;var c=.8*a(b).width(),d=.9*a(b).height(),e=new Image;e.src=l.attr("src"),e.onload=function(){if(m=e.width,n=e.height,m>c||n>d){var f=m/n>c/d?m/c:n/d;m/=f,n/=f}l.css({width:m+"px",height:n+"px",top:(a(b).height()-n)/2+"px",left:(a(b).width()-m)/2+"px"})}},s=function(b){if(p)return!1;if(b="undefined"==typeof b?!1:"left"===b?1:-1,l.length){if(b!==!1&&(e.length<2||d.quitOnEnd===!0&&(-1===b&&0===e.index(k)||1===b&&e.index(k)===e.length-1)))return u(),!1;var c={opacity:0};f?g(l,100*b-o+"px",d.animationSpeed/1e3):c.left=parseInt(l.css("left"))+100*b+"px",l.animate(c,d.animationSpeed,function(){t()}),o=0}p=!0,d.onLoadStart!==!1&&d.onLoadStart(),setTimeout(function(){l=a("").attr("src",k.attr("href")).load(function(){l.appendTo("body"),r();var c={opacity:1};if(l.css("opacity",0),f)g(l,-100*b+"px",0),setTimeout(function(){g(l,"0px",d.animationSpeed/1e3)},50);else{var h=parseInt(l.css("left"));c.left=h+"px",l.css("left",h-100*b+"px")}if(l.animate(c,d.animationSpeed,function(){p=!1,d.onLoadEnd!==!1&&d.onLoadEnd()}),d.preloadNext){var i=e.eq(e.index(k)+1);i.length||(i=e.eq(0)),a("").attr("src",i.attr("href")).load()}}).error(function(){d.onLoadEnd!==!1&&d.onLoadEnd()});var c=0,h=0,n=0;l.on(i?"pointerup MSPointerUp":"click",function(a){if(a.preventDefault(),d.quitOnImgClick)return u(),!1;if(j(a.originalEvent))return!0;var b=(a.pageX||a.originalEvent.pageX)-a.target.offsetLeft;k=e.eq(e.index(k)-(m/2>b?1:-1)),k.length||(k=e.eq(m/2>b?e.length:0)),s(m/2>b?"left":"right")}).on("touchstart pointerdown MSPointerDown",function(a){return!j(a.originalEvent)||d.quitOnImgClick?!0:(f&&(n=parseInt(l.css("left"))),void(c=a.originalEvent.pageX||a.originalEvent.touches[0].pageX))}).on("touchmove pointermove MSPointerMove",function(a){return!j(a.originalEvent)||d.quitOnImgClick?!0:(a.preventDefault(),h=a.originalEvent.pageX||a.originalEvent.touches[0].pageX,o=c-h,void(f?g(l,-o+"px",0):l.css("left",n-o+"px")))}).on("touchend touchcancel pointerup MSPointerUp",function(a){return!j(a.originalEvent)||d.quitOnImgClick?!0:void(Math.abs(o)>50?(k=e.eq(e.index(k)-(0>o?1:-1)),k.length||(k=e.eq(0>o?e.length:0)),s(o>0?"right":"left")):f?g(l,"0px",d.animationSpeed/1e3):l.animate({left:n+"px"},d.animationSpeed/2))})},d.animationSpeed+100)},t=function(){return l.length?(l.remove(),void(l=a())):!1},u=function(){return l.length?void l.animate({opacity:0},d.animationSpeed,function(){t(),p=!1,d.onEnd!==!1&&d.onEnd()}):!1};return a(b).on("resize",r),d.quitOnDocClick&&a(c).on(h?"touchend":"click",function(b){l.length&&!a(b.target).is(l)&&u()}),d.enableKeyboard&&a(c).on("keyup",function(a){return l.length?(a.preventDefault(),27===a.keyCode&&u(),void((37===a.keyCode||39===a.keyCode)&&(k=e.eq(e.index(k)-(37===a.keyCode?1:-1)),k.length||(k=e.eq(37===a.keyCode?e.length:0)),s(37===a.keyCode?"left":"right")))):!0}),a(c).on("click",this.selector,function(b){return q(this)?(b.preventDefault(),p?!1:(p=!1,d.onStart!==!1&&d.onStart(),k=a(this),void s())):!0}),this.each(function(){return q(this)?void(e=e.add(a(this))):!0}),this.switchImageLightbox=function(a){var b=e.eq(a);if(b.length){var c=e.index(k);k=b,s(c>a?"left":"right")}return this},this.quitImageLightbox=function(){return u(),this},this}}(jQuery,window,document); \ No newline at end of file diff --git a/vagrant.sh b/vagrant.sh deleted file mode 100644 index e38dca7..0000000 --- a/vagrant.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/usr/bin/env bash -apt-get update -apt-get install -y apache2 vim php5 - -# set web root -rm -rf /var/www/html -ln -fs /vagrant /var/www/html - -# conf apache -sudo echo "export APACHE_RUN_USER=vagrant" >> /etc/apache2/envvars -sudo echo "export APACHE_RUN_GROUP=vagrant" >> /etc/apache2/envvars - -sudo service apache2 restart -- cgit v1.2.3