{"version":3,"file":"js/slideshow-717d07e96e401513c1a9.js","sources":["webpack:///webpack/bootstrap","webpack:///./app/javascript/packs/slideshow.js"],"sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"/packs-test/\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = \"./app/javascript/packs/slideshow.js\");\n","(function($) {\n\n function slide($slideshow, slideTo) {\n var $items = $slideshow.find('.slideshow__item')\n var $itemCurrent = $slideshow.find('.slideshow__item--current');\n var $counter = $slideshow.find('.slideshow__counter');\n var $next = $slideshow.find('.slideshow__control--next');\n var $prev = $slideshow.find('.slideshow__control--prev');\n var $dots = $slideshow.find('.slideshow__dot');\n var $dotCurrent = $slideshow.find('.slideshow__dot--current');\n var current = $itemCurrent.index();\n var total = $items.length;\n\n $itemCurrent.removeClass('slideshow__item--current');\n $slideshow.find('.slideshow__item').eq(slideTo).addClass('slideshow__item--current');\n $counter.html( (slideTo + 1) + '/' + total )\n\n $dotCurrent.removeClass('slideshow__dot--current');\n $slideshow.find('.slideshow__dot').eq(slideTo).addClass('slideshow__dot--current');\n\n\n /* Disabling arrows */\n\n $prev.removeClass('slideshow__control--disabled').prop('disabled', false);\n $next.removeClass('slideshow__control--disabled').prop('disabled', false);\n\n if ( slideTo === total - 1 ) {\n $next.addClass('slideshow__control--disabled').prop('disabled', true);\n } else if ( slideTo === 0 ) {\n $prev.addClass('slideshow__control--disabled').prop('disabled', true);\n }\n\n }\n\n\n /* Navigation using timeout */\n\n /* This may need extra work if more than one autoscroll slideshow will appear on the page.\n * Now we have one Interval for all slideshow and it should be rewritten the way\n * each slideshow has it's own interval. But there is a problem that we don't\n * have such thing as slideshow in JavaScript, they are just in DOM.\n * So need to connect \"var timeout = setInterval\" with DOM so it can be\n * clearInterval(timeout) by clicking arrows or dots in DOM.\n */\n\n var timeout = setInterval(function () {\n $('.slideshow--autoscroll').each(function () {\n var $slideshow = $(this);\n var current = $slideshow.find('.slideshow__item--current').index();\n var total = $slideshow.find('.slideshow__item').length;\n\n if (current + 1 === total) {\n slide($slideshow, 0);\n } else {\n slide($slideshow, current + 1);\n }\n });\n }, 10000);\n\n if ($(window).width() < 768) {\n clearInterval(timeout);\n }\n\n\n /* Navigation using dots */\n\n $('.slideshow__dot').on('click', function () {\n slide( $(this).parents('.slideshow'), $(this).index());\n clearInterval(timeout);\n });\n\n\n /* Navigation using arrows */\n\n $('.slideshow__control').on('click', function () {\n var $this = $(this);\n var $slideshow = $this.parents('.slideshow');\n var current = $slideshow.find('.slideshow__item--current').index();\n var total = $slideshow.find('.slideshow__item').length;\n var slideTo = 0;\n\n\n /* Sliding */\n\n if( $this.hasClass('slideshow__control--next') ) {\n if (current + 1 === total) {\n return;\n } else {\n slideTo = current + 1;\n }\n }\n\n if( $this.hasClass('slideshow__control--prev') ) {\n if (current === 0) {\n return;\n } else {\n slideTo = current - 1;\n }\n }\n\n slide( $(this).parents('.slideshow'), slideTo);\n clearInterval(timeout);\n });\n\n\n})(jQuery);\n"],"mappings":";AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;AClFA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AAEA;AACA;AACA;AAEA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AAEA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AAGA;;;;A","sourceRoot":""}