From c791a19a00f8dd9dba26dda697c0154a2d7d9e57 Mon Sep 17 00:00:00 2001 From: RedHoodSu Date: Wed, 16 Mar 2016 20:13:30 +0800 Subject: [PATCH] Del: Generated file --- dist/eruda.js | 11467 ------------------------------------------------ 1 file changed, 11467 deletions(-) delete mode 100644 dist/eruda.js diff --git a/dist/eruda.js b/dist/eruda.js deleted file mode 100644 index d321616..0000000 --- a/dist/eruda.js +++ /dev/null @@ -1,11467 +0,0 @@ -var eruda = -/******/ (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'; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - - var _HomeBtn = __webpack_require__(1); - - var _HomeBtn2 = _interopRequireDefault(_HomeBtn); - - var _DevTools = __webpack_require__(32); - - var _DevTools2 = _interopRequireDefault(_DevTools); - - var _Console = __webpack_require__(39); - - var _Console2 = _interopRequireDefault(_Console); - - var _Network = __webpack_require__(51); - - var _Network2 = _interopRequireDefault(_Network); - - var _Elements = __webpack_require__(55); - - var _Elements2 = _interopRequireDefault(_Elements); - - var _Snippets = __webpack_require__(62); - - var _Snippets2 = _interopRequireDefault(_Snippets); - - var _Resources = __webpack_require__(67); - - var _Resources2 = _interopRequireDefault(_Resources); - - var _Info = __webpack_require__(71); - - var _Info2 = _interopRequireDefault(_Info); - - var _Features = __webpack_require__(76); - - var _Features2 = _interopRequireDefault(_Features); - - var _Settings = __webpack_require__(82); - - var _Settings2 = _interopRequireDefault(_Settings); - - var _util = __webpack_require__(2); - - var _util2 = _interopRequireDefault(_util); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - __webpack_require__(87); - - var $container; - - var isDebugMode = /eruda=true/.test(window.location); - - if (isDebugMode) { - appendContainer(); - - var devTools = new _DevTools2.default($container); - - var homeBtn = new _HomeBtn2.default($container); - - homeBtn.on('click', function () { - return devTools.toggle(); - }); - - var consoleTool = new _Console2.default(), - network = new _Network2.default(), - elements = new _Elements2.default(), - snippets = new _Snippets2.default(), - resources = new _Resources2.default(), - info = new _Info2.default(), - features = new _Features2.default(), - settings = new _Settings2.default(); - - devTools.add(consoleTool).add(network).add(elements).add(snippets).add(resources).add(info).add(features).add(settings).showTool('console'); - - settings.separator().add(devTools.config, 'transparent', 'Transparent').add(devTools.config, 'halfScreen', 'Half Screen Size'); - } - - function appendContainer() { - _util2.default.$('body').append('
'); - $container = _util2.default.$('#eruda'); - } - - exports.default = { - get: function get(name) { - return devTools.get(name); - } - }; - -/***/ }, -/* 1 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - - 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; }; }(); - - var _util = __webpack_require__(2); - - var _util2 = _interopRequireDefault(_util); - - var _draggabilly = __webpack_require__(3); - - var _draggabilly2 = _interopRequireDefault(_draggabilly); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - - function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - - __webpack_require__(8); - - var HomeBtn = function (_util$Emitter) { - _inherits(HomeBtn, _util$Emitter); - - function HomeBtn($parent) { - _classCallCheck(this, HomeBtn); - - var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(HomeBtn).call(this)); - - _this._$parent = $parent; - - _this._appendTpl(); - _this._makeDraggable(); - _this._setPos(); - _this._bindEvent(); - return _this; - } - - _createClass(HomeBtn, [{ - key: '_appendTpl', - value: function _appendTpl() { - var $parent = this._$parent; - - $parent.append(__webpack_require__(12)()); - - this._$el = $parent.find('.eruda-home-btn'); - } - }, { - key: '_setPos', - value: function _setPos() { - var wh = window.innerHeight, - ww = window.innerWidth; - - this._$el.css({ - left: ww - 50, - top: wh - 50 - }); - } - }, { - key: '_bindEvent', - value: function _bindEvent() { - var _this2 = this; - - this._draggabilly.on('staticClick', function () { - return _this2.emit('click'); - }); - - _util2.default.orientation.on('change', function () { - return _this2._setPos(); - }); - } - }, { - key: '_makeDraggable', - value: function _makeDraggable() { - this._draggabilly = new _draggabilly2.default(this._$el.get(0), { - containment: true - }); - } - }]); - - return HomeBtn; - }(_util2.default.Emitter); - - exports.default = HomeBtn; - ; - -/***/ }, -/* 2 */ -/***/ function(module, exports) { - - // Built by eustia. - module.exports = (function () - { - var _ = {}; - - /* ------------------------------ last ------------------------------ */ - - var last; - - _.last = (function () - { - // TODO - - /* function - * last: Gets the last element of array. - * array(array): The array to query. - * return(*): Returns the last element of array. - */ - - last = function (arr) - { - var len = arr ? arr.length : 0; - - return len ? arr[len - 1] : undefined; - }; - - return last; - })(); - - /* ------------------------------ isUndef ------------------------------ */ - - var isUndef; - - _.isUndef = (function () - { - /* function - * - * isUndef: Checks if value is undefined. - * value(*): The value to check. - * return(boolean): Returns true if value is undefined, else false. - * - * ```javascript - * _.isUndef(void 0) // -> true - * _.isUndef(null) // -> false - * ``` - * - * Just a shortcut for **x === undefined**, doesn't matter that much whether you - * use it or not. - */ - - isUndef = function (value) { return value === void 0 }; - - return isUndef; - })(); - - /* ------------------------------ isObj ------------------------------ */ - - var isObj; - - _.isObj = (function () - { - // TODO - - /* function - * isObj: Checks if value is the language type of Object. - * value(*): The value to check. - * return(boolean): Returns true if value is an object, else false. - */ - - isObj = function (val) - { - var type = typeof val; - - return type === 'function' || type === 'object'; - }; - - return isObj; - })(); - - /* ------------------------------ camelize ------------------------------ */ - - var camelize; - - _.camelize = (function () - { - // TODO - - /* function - * camelCase: Convert string to "camelCase" text. - */ - - camelize = function (str, char) - { - char = char || '-'; - - return str.replace(new RegExp(char + '+(.)?', 'g'), function (match, char) - { - return char ? char.toUpperCase() : ''; - }); - }; - - return camelize; - })(); - - /* ------------------------------ dasherize ------------------------------ */ - - var dasherize; - - _.dasherize = (function () - { - // TODO - - /* function - * - * dasherize: Convert string to "dashCase". - */ - - dasherize = function (str) - { - return str.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase(); - }; - - return dasherize; - })(); - - /* ------------------------------ inherits ------------------------------ */ - - var inherits; - - _.inherits = (function () - { - // TODO - - /* function - * inherits: Inherit the prototype methods from one constructor into another. - * Class(function): Child Class. - * SuperClass(function): Super Class. - */ - - var objCreate = Object.create; - - function noop() {} - - inherits = function (Class, SuperClass) - { - if (objCreate) return Class.prototype = objCreate(SuperClass.prototype); - - noop.prototype = SuperClass.prototype; - Class.prototype = new noop(); - }; - - return inherits; - })(); - - /* ------------------------------ has ------------------------------ */ - - var has; - - _.has = (function () - { - /* function - * has: Checks if key is a direct property. - * object(object): The object to query. - * key(string): The path to check. - * return(boolean): Returns true if key is a direct property, else false. - */ - - var hasOwnProp = Object.prototype.hasOwnProperty; - - has = function (obj, key) - { - return hasOwnProp.call(obj, key); - }; - - return has; - })(); - - /* ------------------------------ slice ------------------------------ */ - - var slice; - - _.slice = (function () - { - // TODO - - var arrProto = Array.prototype; - - slice = function (arr, start, end) - { - return arrProto.slice.call(arr, start, end); - }; - - return slice; - })(); - - /* ------------------------------ _createAssigner ------------------------------ */ - - var _createAssigner; - - _._createAssigner = (function () - { - - _createAssigner = function (keysFunc, defaults) - { - return function (obj) - { - var len = arguments.length; - - if (defaults) obj = Object(obj); - - if (len < 2 || obj == null) return obj; - - for (var i = 1; i < len; i++) - { - var src = arguments[i], - keys = keysFunc(src), - keysLen = keys.length; - - for (var j = 0; j < keysLen; j++) - { - var key = keys[j]; - if (!defaults || isUndef(obj[key])) obj[key] = src[key]; - } - } - - return obj; - }; - }; - - return _createAssigner; - })(); - - /* ------------------------------ allKeys ------------------------------ */ - - var allKeys; - - _.allKeys = (function () - { - /* function - * allKeys: Retrieve all the names of object's own and inherited properties. - * object(object): The object to query. - * return(array): Returns the array of all property names. - * - * ```javascript - * var obj = Object.create({ a: 0 }); - * obj.b = 1; - * _.allKeys(obj) // -> ['a', 'b'] - * ``` - * - * > Members of Object's prototype won't be retrieved. - */ - - allKeys = function (obj) - { - var ret = [], key; - - for (key in obj) ret.push(key); - - return ret; - }; - - return allKeys; - })(); - - /* ------------------------------ extend ------------------------------ */ - - var extend; - - _.extend = (function () - { - // TODO - - extend = _createAssigner(allKeys); - - return extend; - })(); - - /* ------------------------------ indexOf ------------------------------ */ - - var indexOf; - - _.indexOf = (function () - { - // TODO - - indexOf = function (arr, val) - { - return Array.prototype.indexOf.call(arr, val); - }; - - return indexOf; - })(); - - /* ------------------------------ defaults ------------------------------ */ - - var defaults; - - _.defaults = (function () - { - // TODO - - defaults = _createAssigner(allKeys, true); - - return defaults; - })(); - - /* ------------------------------ keys ------------------------------ */ - - var keys; - - _.keys = (function () - { - /* function - * keys: Creates an array of the own enumerable property names of object. - * object(object): The object to query. - * return(array): Returns the array of property names. - */ - - keys = Object.keys || function (obj) - { - var ret = [], key; - - for (key in obj) - { - if (has(obj, key)) ret.push(key); - } - - return ret; - }; - - return keys; - })(); - - /* ------------------------------ evalCss ------------------------------ */ - - var evalCss; - - _.evalCss = (function () - { - evalCss = function (css) - { - var style = document.createElement('style'); - style.textContent = css; - style.type = 'text/css'; - document.body.appendChild(style); - }; - - return evalCss; - })(); - - /* ------------------------------ extendOwn ------------------------------ */ - - var extendOwn; - - _.extendOwn = (function () - { - // TODO - - extendOwn = _createAssigner(keys); - - return extendOwn; - })(); - - /* ------------------------------ objToStr ------------------------------ */ - - var objToStr; - - _.objToStr = (function () - { - /* function - * objToStr: Alias of Object.prototype.toString. - * value(*): The source value. - * return(string): String representation of the given value. - */ - - var ObjToStr = Object.prototype.toString; - - objToStr = function (val) - { - return ObjToStr.call(val); - }; - - return objToStr; - })(); - - /* ------------------------------ isArr ------------------------------ */ - - var isArr; - - _.isArr = (function () - { - /* function - * isArr: Check if value is an array. - * value(*): The value to check. - * return(boolean): True if value is an array, else false. - */ - - isArr = Array.isArray || function (val) - { - return objToStr(val) === '[object Array]'; - }; - - return isArr; - })(); - - /* ------------------------------ isNum ------------------------------ */ - - var isNum; - - _.isNum = (function () - { - // TODO - - /* function - * isNum: Checks if value is classified as a Number primitive or object. - * value(*): The value to check. - * return(boolean): Returns true if value is correctly classified, else false. - */ - - isNum = function (value) { return objToStr(value) === '[object Number]' }; - - return isNum; - })(); - - /* ------------------------------ cookie ------------------------------ */ - - var cookie; - - _.cookie = (function () - { - // TODO - - /* module - * cookie: Simple api for handling browser cookies. - */ - - var defOpts = { path: '/' }; - - function setCookie(key, val, options) - { - if (arguments.length > 1) - { - options = extend(defOpts, options); - - if (isNum(options.expires)) - { - var expires = new Date(); - expires.setMilliseconds(expires.getMilliseconds() + options.expires * 864e+5); - options.expires = expires; - } - - val = encodeURIComponent(String(val)); - key = encodeURIComponent(key); - - document.cookie = [ - key, '=', val, - options.expires && '; expires=' + options.expires.toUTCString(), - options.path && '; path=' + options.path, - options.domain && '; domain=' + options.domain, - options.secure ? '; secure' : '' - ].join(''); - - return cookie; - } - - var cookies = document.cookie ? document.cookie.split('; ') : [], - result = key ? undefined : {}; - - for (var i = 0, len = cookies.length; i < len; i++) - { - var c = cookies[i], - parts = c.split('='), - name = decodeURIComponent(parts.shift()); - - c = parts.join('='); - c = decodeURIComponent(c); - - if (key === name) - { - result = c; - break; - } - - if (!key) result[name] = c; - } - - return result; - } - - cookie = { - /* member - * cookie.get: Read cookie. - * key(string): The cookie name. - * return(string): Returns cookie value if exists, eles undefined. - */ - get: setCookie, - /* member - * cookie.set: Set cookie. - * key(string): The cookie name. - * val(string): The cookie value. - * options(Object): Options. - */ - set: setCookie, - remove: function (key, options) - { - options = options || {}; - options.expires = -1; - return setCookie(key, '', options); - } - }; - - return cookie; - })(); - - /* ------------------------------ isArrLike ------------------------------ */ - - var isArrLike; - - _.isArrLike = (function () - { - // TODO - - var MAX_ARR_IDX = Math.pow(2, 53) - 1; - - isArrLike = function (val) - { - if (!has(val, 'length')) return false; - - var len = val.length; - - return isNum(len) && len >= 0 && len <= MAX_ARR_IDX; - }; - - return isArrLike; - })(); - - /* ------------------------------ each ------------------------------ */ - - var each; - - _.each = (function () - { - // TODO - - each = function (obj, iteratee, ctx) - { - var i, len; - - if (isArrLike(obj)) - { - for (i = 0, len = obj.length; i < len; i++) iteratee.call(ctx, obj[i], i, obj); - } else - { - var _keys = keys(obj); - for (i = 0, len = _keys.length; i < len; i++) - { - iteratee.call(ctx, obj[_keys[i]], _keys[i], obj); - } - } - - return obj; - }; - - return each; - })(); - - /* ------------------------------ values ------------------------------ */ - - var values; - - _.values = (function () - { - /* function - * values: Creates an array of the own enumerable property values of object. - * object(object): The object to query. - * return(array): The array of property values. - * - * ```javascript - * values({one: 1, two: 2}); // -> [1, 2] - * ``` - */ - - values = function (obj) - { - var ret = []; - - each(obj, function (val) { ret.push(val) }); - - return ret; - }; - - return values; - })(); - - /* ------------------------------ contain ------------------------------ */ - - var contain; - - _.contain = (function () - { - // TODO - - contain = function (arr, val) - { - if (!isArrLike(arr)) arr = values(arr); - - return indexOf(arr, val) >= 0; - }; - - return contain; - })(); - - /* ------------------------------ isStr ------------------------------ */ - - var isStr; - - _.isStr = (function () - { - // TODO - - /* function - * isStr: Checks if value is classified as a String primitive or object. - * value(*): The value to check. - * return(boolean): Returns true if value is correctly classified, else false. - */ - - isStr = function (value) { return objToStr(value) === '[object String]' }; - - return isStr; - })(); - - /* ------------------------------ isErr ------------------------------ */ - - var isErr; - - _.isErr = (function () - { - // TODO - - /* function - * isErr: Checks if value is an Error. - * value(*): The value to check. - * return(boolean): Returns true if value is an error object, else false. - */ - - isErr = function (val) { return objToStr(val) === '[object Error]' }; - - return isErr; - })(); - - /* ------------------------------ isFn ------------------------------ */ - - var isFn; - - _.isFn = (function () - { - /* function - * isFn: Check if value is a function. - * value(*): The value to check. - * return(boolean): True if value is a function, else false. - */ - - isFn = function (val) - { - return objToStr(val) === '[object Function]'; - }; - - return isFn; - })(); - - /* ------------------------------ isMatch ------------------------------ */ - - var isMatch; - - _.isMatch = (function () - { - // TODO - - isMatch = function (obj, attrs) - { - var _keys = keys(attrs), - len = _keys.length; - - if (obj == null) return !len; - - obj = Object(obj); - - for (var i = 0; i < len; i++) - { - var key = keys[i]; - if (attrs[key] !== obj[key] || !(key in obj)) return false; - } - - return true; - }; - - return isMatch; - })(); - - /* ------------------------------ isRegExp ------------------------------ */ - - var isRegExp; - - _.isRegExp = (function () - { - // TODO - - isRegExp = function (value) - { - return objToStr(value) === '[object RegExp]'; - }; - - return isRegExp; - })(); - - /* ------------------------------ loadJs ------------------------------ */ - - var loadJs; - - _.loadJs = (function () - { - loadJs = function (url, cb) - { - var script = document.createElement('script'); - script.src = url; - script.onload = function () - { - var isNotLoaded = script.readyState && - script.readyState != "complete" && - script.readyState != "loaded"; - - cb && cb(!isNotLoaded); - }; - document.body.appendChild(script); - }; - - return loadJs; - })(); - - /* ------------------------------ ltrim ------------------------------ */ - - var ltrim; - - _.ltrim = (function () - { - // TODO - - var regSpace = /^\s+/; - - ltrim = function (str, chars) - { - if (chars == null) return str.replace(regSpace, ''); - - var start = 0, - len = str.length, - charLen = chars.length, - found = true, - i, c; - - while (found && start < len) - { - found = false; - i = -1; - c = str.charAt(start); - - while (++i < charLen) - { - if (c === chars[i]) - { - found = true; - start++; - break; - } - } - } - - return (start >= len) ? '' : str.substr(start, len); - }; - - return ltrim; - })(); - - /* ------------------------------ matcher ------------------------------ */ - - var matcher; - - _.matcher = (function () - { - // TODO - - matcher = function (attrs) - { - attrs = extendOwn({}, attrs); - - return function (obj) - { - return isMatch(obj, attrs); - }; - }; - - return matcher; - })(); - - /* ------------------------------ optimizeCb ------------------------------ */ - - var optimizeCb; - - _.optimizeCb = (function () - { - - optimizeCb = function (func, ctx, argCount) - { - if (isUndef(ctx)) return func; - - switch (argCount == null ? 3 : argCount) - { - case 1: return function (val) - { - return func.call(ctx, val); - }; - case 3: return function (val, idx, collection) - { - return func.call(ctx, val, idx, collection); - }; - case 4: return function (accumulator, val, idx, collection) - { - return func.call(ctx, accumulator, val, idx, collection); - } - } - - return function () - { - return func.apply(ctx, arguments); - }; - }; - - return optimizeCb; - })(); - - /* ------------------------------ safeCb ------------------------------ */ - - var safeCb; - - _.safeCb = (function () - { - /* function - * safeCb: Create callback based on input value. - */ - - safeCb = function (val, ctx, argCount) - { - if (val == null) return function (val) { return val }; - - if (isFn(val)) return optimizeCb(val, ctx, argCount); - - if (isObj(val)) return matcher(val); - - return function (key) - { - return function (obj) - { - return obj == null ? undefined : obj[key]; - } - }; - }; - - return safeCb; - })(); - - /* ------------------------------ filter ------------------------------ */ - - var filter; - - _.filter = (function () - { - // TODO - - filter = function (obj, predicate, ctx) - { - var ret = []; - - predicate = safeCb(predicate, ctx); - - each(obj, function (val, idx, list) - { - if (predicate(val, idx, list)) ret.push(val); - }); - - return ret; - }; - - return filter; - })(); - - /* ------------------------------ map ------------------------------ */ - - var map; - - _.map = (function () - { - // TODO - - map = function (obj, iteratee, ctx) - { - iteratee = safeCb(iteratee, ctx); - - var _keys = !isArrLike(obj) && keys(obj), - len = (_keys || obj).length, - results = Array(len); - - for (var i = 0; i < len; i++) - { - var curKey = _keys ? _keys[i] : i; - results[i] = iteratee(obj[curKey], curKey, obj); - } - - return results; - }; - - return map; - })(); - - /* ------------------------------ toArr ------------------------------ */ - - var toArr; - - _.toArr = (function () - { - - toArr = function (obj) - { - if (isArr(obj)) return obj; - - return isArrLike(obj) && !isStr(obj) - ? map(obj, function (val) { return val }) - : [obj]; - }; - - return toArr; - })(); - - /* ------------------------------ Class ------------------------------ */ - - var Class; - - _.Class = (function () - { - // TODO - - /* function - * - * Class: Create JavaScript class. - * methods(object): Public methods. - * statics(object): Static methods. - * return(function): Return function used to create instances. - */ - - var regCallSuper = /callSuper/; - - function makeClass(parent, methods, statics) - { - statics = statics || {}; - - var ctor = function () - { - var args = toArr(arguments); - - if (has(ctor.prototype, 'initialize') && - !regCallSuper.test(this.initialize.toString()) && - this.callSuper) - { - args.unshift('initialize'); - this.callSuper.apply(this, args); - args.shift(); - } - - return this.initialize - ? this.initialize.apply(this, args) || this - : this; - }; - - inherits(ctor, parent); - ctor.superclass = ctor.prototype.superclass = parent; - - ctor.extend = function (methods, statics) { return makeClass(ctor, methods, statics) }; - ctor.inherits = function (Class) { inherits(Class, ctor) }; - ctor.methods = function (methods) { extend(ctor.prototype, methods); return ctor }; - ctor.statics = function (statics) { extend(ctor, statics); return ctor }; - - ctor.methods(methods).statics(statics); - - return ctor; - } - - Class = function (methods, statics) { return Base.extend(methods, statics) }; - - var Base = Class.Base = makeClass(Object, { - className: 'Base', - callSuper: function (name) - { - var superMethod = this.superclass.prototype[name]; - - if (!superMethod) return; - - return superMethod.apply(this, toArr(arguments).slice(1)); - }, - toString: function () - { - return this.className; - } - }); - - return Class; - })(); - - /* ------------------------------ Emitter ------------------------------ */ - - var Emitter; - - _.Emitter = (function () - { - - Emitter = Class({ - initialize: function () - { - this._events = this._events || {}; - }, - on: function (event, listener) - { - this._events[event] = this._events[event] || []; - this._events[event].push(listener); - - return this; - }, - off: function (event, listener) - { - if (!has(this._events, event)) return; - - this._events[event].splice(this._events[event].indexOf(listener), 1); - - return this; - }, - once: function (event, listener) - { - var fired = false; - - function g() - { - this.off(event, g); - if (!fired) - { - fired = true; - listener.apply(this, arguments); - } - } - - this.on(event, g); - - return this; - }, - emit: function (event) - { - if (!has(this._events, event)) return; - - var args = slice(arguments, 1); - - each(this._events[event], function (val) - { - val.apply(this, args); - }, this); - - return this; - } - }, { - mixin: function (obj) - { - each(['on', 'off', 'once', 'emit'], function (val) - { - obj[val] = Emitter.prototype[val]; - }); - - obj._events = obj._events || {}; - } - }); - - return Emitter; - })(); - - /* ------------------------------ delegate ------------------------------ */ - - var delegate; - - _.delegate = (function () - { - - function retTrue() { return true } - function retFalse() { return false } - - function trigger(e) - { - var handlers = this.events[e.type], - handler, - handlerQueue = formatHandlers.call(this, e, handlers); - - e = new delegate.Event(e); - - var i = 0, j, matched, ret; - - while ((matched = handlerQueue[i++]) && !e.isPropagationStopped()) - { - e.curTarget = matched.el; - j = 0; - while ((handler = matched.handlers[j++]) && !e.isImmediatePropagationStopped()) - { - ret = handler.handler.apply(matched.el, [e]); - - if (ret === false) - { - e.preventDefault(); - e.stopPropagation(); - } - } - } - } - - function formatHandlers(e, handlers) - { - var current = e.target, - ret = [], - delegateCount = handlers.delegateCount, - selector, matches, handler, i; - - if (current.nodeType) - { - for (; current !== this; current = current.parentNode || this) - { - matches = []; - for (i = 0; i < delegateCount; i++) - { - handler = handlers[i]; - selector = handler.selector + ' '; - if (matches[selector] === undefined) - { - matches[selector] = contain(this.querySelectorAll(selector), current); - } - if (matches[selector]) matches.push(handler); - } - if (matches.length) ret.push({ el: current, handlers: matches}); - } - } - - if (delegateCount < handlers.length) - { - ret.push({ - el: this, - handlers: handlers.slice(delegateCount) - }); - } - - return ret; - } - - delegate = { - add: function (el, type, selector, fn) - { - var handler = { - selector: selector, - handler : fn - }, - handlers; - - if (!el.events) el.events = {}; - - if (!(handlers = el.events[type])) - { - handlers = el.events[type] = []; - handlers.delegateCount = 0; - el.addEventListener(type, function (e) - { - trigger.apply(el, arguments); - }, false); - } - - selector ? handlers.splice(handlers.delegateCount++, 0, handler) - : handlers.push(handler); - }, - remove: function (el, type, selector, fn) - { - var events = el.events; - - if (!events || !events[type]) return; - - var handlers = events[type], - i = handlers.length, - handler; - - while (i--) - { - handler = handlers[i]; - - if ((!selector || handler.selector == selector) && handler.handler == fn) - { - handlers.splice(i, 1); - if (handler.selector) - { - handlers.delegateCount--; - } - } - } - }, - Event: Class({ - className: 'Event', - initialize: function Event(e) { this.origEvent = e }, - isDefaultPrevented: retFalse, - isPropagationStopped: retFalse, - isImmediatePropagationStopped: retFalse, - preventDefault: function () - { - var e = this.origEvent; - - this.isDefaultPrevented = retTrue; - if (e && e.preventDefault) e.preventDefault(); - }, - stopPropagation: function () - { - var e = this.origEvent; - - this.isPropagationStopped = retTrue; - if (e && e.stopPropagation) e.stopPropagation(); - }, - stopImmediatePropagation: function () - { - var e = this.origEvent; - - this.isImmediatePropagationStopped = retTrue; - if (e && e.stopImmediatePropagation) e.stopImmediatePropagation(); - this.stopPropagation(); - } - }) - }; - - return delegate; - })(); - - /* ------------------------------ some ------------------------------ */ - - var some; - - _.some = (function () - { - // TODO - - some = function (obj, predicate, ctx) - { - predicate = safeCb(predicate, ctx); - - var _keys = !isArrLike(obj) && keys(obj), - len = (_keys || obj).length; - - for (var i = 0; i < len; i++) - { - var key = _keys ? _keys[i] : i; - if (predicate(obj[key], key, obj)) return true; - } - - return false; - }; - - return some; - })(); - - /* ------------------------------ Select ------------------------------ */ - - var Select; - - _.Select = (function () - { - // TODO - - /* class - * Select: jQuery like dom manipulator. - */ - - function mergeArr(first, second) - { - var len = second.length, - i = first.length; - - for (var j = 0; j < len; j++) first[i++] = second[j]; - - first.length = i; - - return first; - } - - Select = Class({ - className: 'Select', - initialize: function (selector) - { - this.length = 0; - - if (!selector) return this; - - if (isStr(selector)) return rootSelect.find(selector); - - if (selector.nodeType) - { - this[0] = selector; - this.length = 1; - } - }, - find: function (selector) - { - var ret = new Select; - - this.each(function () - { - mergeArr(ret, this.querySelectorAll(selector)); - }); - - return ret; - }, - each: function (fn) - { - each(this, function (element, idx) - { - fn.call(element, idx, element); - }); - - return this; - } - }); - - var rootSelect = new Select(document); - - return Select; - })(); - - /* ------------------------------ $safeNodes ------------------------------ */ - - var $safeNodes; - - _.$safeNodes = (function () - { - - $safeNodes = function (nodes) - { - if (isStr(nodes)) return new Select(nodes); - - return toArr(nodes); - }; - - return $safeNodes; - })(); - - /* ------------------------------ $attr ------------------------------ */ - - var $attr; - - _.$attr = (function () - { - - $attr = function (nodes, name, val) - { - nodes = $safeNodes(nodes); - - var isGetter = isUndef(val) && isStr(name); - if (isGetter) return getAttr(nodes[0], name); - - var attrs = name; - if (!isObj(attrs)) - { - attrs = {}; - attrs[name] = val; - } - - setAttr(nodes, attrs); - }; - - $attr.remove = function (nodes, names) - { - nodes = $safeNodes(nodes); - names = toArr(names); - - each(nodes, function (node) - { - each(names, function (name) - { - node.removeAttribute(name); - }); - }); - }; - - function getAttr(node, name) - { - return node.getAttribute(name); - } - - function setAttr(nodes, attrs) - { - each(nodes, function (node) - { - each(attrs, function (val, name) - { - node.setAttribute(name, val); - }); - }) - } - - return $attr; - })(); - - /* ------------------------------ $data ------------------------------ */ - - var $data; - - _.$data = (function () - { - - $data = function (nodes, name, val) - { - var dataName = name; - - if (isStr(name)) dataName = 'data-' + name; - if (isObj(name)) - { - dataName = {}; - each(name, function (val, key) - { - dataName['data-' + key] = val; - }); - } - - return $attr(nodes, dataName, val); - }; - - return $data; - })(); - - /* ------------------------------ $class ------------------------------ */ - - var $class; - - _.$class = (function () - { - - $class = { - add: function (nodes, name) - { - nodes = $safeNodes(nodes); - var names = toArr(name); - - each(nodes, function (node) - { - var classList = []; - - each(names, function (name) - { - if (!$class.has(node, name)) classList.push(name); - }); - - if (classList.length !== 0) node.className += ' ' + classList.join(' '); - }); - }, - has: function (nodes, name) - { - nodes = $safeNodes(nodes); - - var regName = new RegExp('(^|\\s)' + name + '(\\s|$)'); - - return some(nodes, function (node) - { - return regName.test(node.className); - }); - }, - toggle: function (nodes, name) - { - nodes = $safeNodes(nodes); - - each(nodes, function (node) - { - if (!$class.has(node, name)) return $class.add(node, name); - - $class.remove(node, name); - }); - }, - remove: function (nodes, name) - { - nodes = $safeNodes(nodes); - var names = toArr(name); - - each(nodes, function (node) - { - each(names, function (name) - { - node.classList.remove(name); - }); - }); - } - }; - - return $class; - })(); - - /* ------------------------------ $css ------------------------------ */ - - var $css; - - _.$css = (function () - { - - $css = function (nodes, name, val) - { - nodes = $safeNodes(nodes); - - var isGetter = isUndef(val) && isStr(name); - if (isGetter) return getCss(nodes[0], name); - - var css = name; - if (!isObj(css)) - { - css = {}; - css[name] = val; - } - - setCss(nodes, css); - }; - - function getCss(node, name) - { - return node.style[camelize(name)]; - } - - function setCss(nodes, css) - { - each(nodes, function (node) - { - var cssText = ';'; - each(css, function (val, key) - { - cssText += dasherize(key) + ':' + addPx(key, val) + ';'; - }); - node.style.cssText += cssText; - }); - } - - var cssNumProps = [ - 'column-count', - 'columns', - 'font-weight', - 'line-weight', - 'opacity', - 'z-index', - 'zoom' - ]; - - function addPx(key, val) - { - var needPx = isNum(val) && !contain(cssNumProps, dasherize(key)); - - return needPx ? val + 'px' : val; - } - - return $css; - })(); - - /* ------------------------------ $event ------------------------------ */ - - var $event; - - _.$event = (function () - { - - $event = { - on: eventFactory('add'), - off: eventFactory('remove') - }; - - function eventFactory(type) - { - return function (nodes, event, selector, handler) - { - nodes = $safeNodes(nodes); - - if (isUndef(handler)) - { - handler = selector; - selector = undefined; - } - - each(nodes, function (node) - { - delegate[type](node, event, selector, handler); - }); - }; - } - - return $event; - })(); - - /* ------------------------------ $insert ------------------------------ */ - - var $insert; - - _.$insert = (function () - { - - $insert = { - before: insertFactory('beforebegin'), - after: insertFactory('afterend'), - append: insertFactory('beforeend'), - prepend: insertFactory('afterbegin') - }; - - function insertFactory(type) - { - return function (nodes, val) - { - nodes = $safeNodes(nodes); - - each(nodes, function (node) - { - node.insertAdjacentHTML(type, val); - }); - }; - } - - return $insert; - })(); - - /* ------------------------------ $offset ------------------------------ */ - - var $offset; - - _.$offset = (function () - { - - $offset = function (nodes) - { - nodes = $safeNodes(nodes); - - var node = nodes[0]; - - var clientRect = node.getBoundingClientRect(); - - return { - left: clientRect.left + window.pageXOffset, - top : clientRect.top + window.pageYOffset, - width : Math.round(clientRect.width), - height: Math.round(clientRect.height) - }; - }; - - return $offset; - })(); - - /* ------------------------------ $property ------------------------------ */ - - var $property; - - _.$property = (function () - { - - $property = { - html: propFactory('innerHTML'), - text: propFactory('textContent'), - val: propFactory('value') - }; - - function propFactory(name) - { - return function (nodes, val) - { - nodes = $safeNodes(nodes); - - if (isUndef(val)) return nodes[0][name]; - - each(nodes, function (node) - { - node[name] = val; - }); - }; - } - - return $property; - })(); - - /* ------------------------------ $remove ------------------------------ */ - - var $remove; - - _.$remove = (function () - { - - $remove = function (nodes) - { - nodes = $safeNodes(nodes); - - each(nodes, function (node) - { - var parent = node.parentNode; - - if (parent) parent.removeChild(node); - }); - }; - - return $remove; - })(); - - /* ------------------------------ $show ------------------------------ */ - - var $show; - - _.$show = (function () - { - - $show = function (nodes) - { - nodes = $safeNodes(nodes); - - each(nodes, function (node) - { - if (isHidden(node)) - { - node.style.display = getDefDisplay(node.nodeName); - } - }); - }; - - function isHidden(node) - { - return getComputedStyle(node, '').getPropertyValue('display') == 'none'; - } - - var elDisplay = {}; - - function getDefDisplay(nodeName) - { - var el, display; - - if (!elDisplay[nodeName]) - { - el = document.createElement(nodeName); - document.body.appendChild(el); - display = getComputedStyle(el, '').getPropertyValue("display"); - el.parentNode.removeChild(el); - display == "none" && (display = "block"); - elDisplay[nodeName] = display; - } - - return elDisplay[nodeName]; - } - - return $show; - })(); - - /* ------------------------------ $ ------------------------------ */ - - var $; - - _.$ = (function () - { - - $ = function (selector) - { - return new Select(selector); - }; - - Select.methods({ - offset: function () - { - return $offset(this); - }, - hide: function () - { - return this.css('display', 'none'); - }, - show: function () - { - $show(this); - - return this; - }, - first: function () - { - return $(this[0]); - }, - last: function () { - return $(last(this)); - }, - get: function (idx) - { - return this[idx]; - }, - eq: function (idx) - { - return $(idx); - }, - on: function (event, selector, handler) - { - $event.on(this, event, selector, handler); - - return this; - }, - off: function (event, selector, handler) - { - $event.off(this, event, selector, handler); - - return this; - }, - html: function (val) - { - var result = $property.html(this, val); - - if (isUndef(val)) return result; - - return this; - }, - text: function (val) - { - var result = $property.text(this, val); - - if (isUndef(val)) return result; - - return this; - }, - val: function (val) - { - var result = $property.val(this, val); - - if (isUndef(val)) return result; - - return this; - }, - css: function (name, val) - { - var result = $css(this, name, val); - - if (isGetter(name, val)) return result; - - return this; - }, - attr: function (name, val) - { - var result = $attr(this, name, val); - - if (isGetter(name, val)) return result; - - return this; - }, - data: function (name, val) - { - var result = $data(this, name, val); - - if (isGetter(name, val)) return result; - - return this; - }, - rmAttr: function (name) - { - $attr.remove(this, name); - - return this; - }, - remove: function () - { - $remove(this); - - return this; - }, - addClass: function (name) - { - $class.add(this, name); - - return this; - }, - rmClass: function (name) - { - $class.remove(this, name); - - return this; - }, - toggleClass: function (name) - { - $class.toggle(this, name); - - return this; - }, - hasClass: function (name) - { - return $class.has(this, name); - }, - append: function (val) - { - $insert.append(this, val); - - return this; - }, - prepend: function (val) - { - $insert.prepend(this, val); - - return this; - }, - before: function (val) - { - $insert.before(this, val); - - return this; - }, - after: function (val) - { - $insert.after(this, val); - - return this; - } - }); - - function isGetter(name, val) - { - return isUndef(val) && isStr(name); - } - - return $; - })(); - - /* ------------------------------ orientation ------------------------------ */ - - var orientation; - - _.orientation = (function () - { - - orientation = {}; - - Emitter.mixin(orientation); - - window.addEventListener('orientationchange', function () - { - setTimeout(function () - { - orientation.emit('change'); - }, 150); - }, false); - - return orientation; - })(); - - /* ------------------------------ rtrim ------------------------------ */ - - var rtrim; - - _.rtrim = (function () - { - // TODO - - var regSpace = /\s+$/; - - rtrim = function (str, chars) - { - if (chars == null) return str.replace(regSpace, ''); - - var end = str.length - 1, - charLen = chars.length, - found = true, - i, c; - - while (found && end >= 0) - { - found = false; - i = -1; - c = str.charAt(end); - - while (++i < charLen) - { - if (c === chars[i]) - { - found = true; - end--; - break; - } - } - } - - return (end >= 0) ? str.substring(0, end + 1) : ''; - }; - - return rtrim; - })(); - - /* ------------------------------ startWith ------------------------------ */ - - var startWith; - - _.startWith = (function () - { - // TODO - - /* function - * startWith: Checks if string starts with the given target string. - * string(string): The string to search. - * prefix(string): String prefix. - * return(boolean): Returns true if string starts with prefix, else false. - */ - - startWith = function (str, prefix) { return str.indexOf(prefix) === 0 }; - - return startWith; - })(); - - /* ------------------------------ trim ------------------------------ */ - - var trim; - - _.trim = (function () - { - // TODO - - var regSpace = /^\s+|\s+$/g; - - trim = function (str, chars) - { - if (chars == null) return str.replace(regSpace, ''); - - return ltrim(rtrim(str, chars), chars); - }; - - return trim; - })(); - - /* ------------------------------ unique ------------------------------ */ - - var unique; - - _.unique = (function () - { - - function isEqual(a, b) { return a === b } - - unique = function (arr, compare) - { - compare = compare || isEqual; - - return filter(arr, function (item, idx, arr) - { - var len = arr.length; - - while (++idx < len) - { - if (compare(item, arr[idx])) return false; - } - - return true; - }); - }; - - return unique; - })(); - - return _; - })(); - -/***/ }, -/* 3 */ -/***/ function(module, exports, __webpack_require__) { - - var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*! - * Draggabilly v2.1.0 - * Make that shiz draggable - * http://draggabilly.desandro.com - * MIT license - */ - - /*jshint browser: true, strict: true, undef: true, unused: true */ - - ( function( window, factory ) { - // universal module definition - /* jshint strict: false */ /*globals define, module, require */ - if ( true ) { - // AMD - !(__WEBPACK_AMD_DEFINE_ARRAY__ = [ - __webpack_require__(4), - __webpack_require__(5) - ], __WEBPACK_AMD_DEFINE_RESULT__ = function( getSize, Unidragger ) { - return factory( window, getSize, Unidragger ); - }.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); - } else if ( typeof module == 'object' && module.exports ) { - // CommonJS - module.exports = factory( - window, - require('get-size'), - require('unidragger') - ); - } else { - // browser global - window.Draggabilly = factory( - window, - window.getSize, - window.Unidragger - ); - } - - }( window, function factory( window, getSize, Unidragger ) { - - 'use strict'; - - // vars - var document = window.document; - - function noop() {} - - // -------------------------- helpers -------------------------- // - - // extend objects - function extend( a, b ) { - for ( var prop in b ) { - a[ prop ] = b[ prop ]; - } - return a; - } - - function isElement( obj ) { - return obj instanceof HTMLElement; - } - - // -------------------------- requestAnimationFrame -------------------------- // - - // get rAF, prefixed, if present - var requestAnimationFrame = window.requestAnimationFrame || - window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame; - - // fallback to setTimeout - var lastTime = 0; - if ( !requestAnimationFrame ) { - requestAnimationFrame = function( callback ) { - var currTime = new Date().getTime(); - var timeToCall = Math.max( 0, 16 - ( currTime - lastTime ) ); - var id = setTimeout( callback, timeToCall ); - lastTime = currTime + timeToCall; - return id; - }; - } - - // -------------------------- support -------------------------- // - - var docElem = document.documentElement; - var transformProperty = typeof docElem.style.transform == 'string' ? - 'transform' : 'WebkitTransform'; - - var jQuery = window.jQuery; - - // -------------------------- -------------------------- // - - function Draggabilly( element, options ) { - // querySelector if string - this.element = typeof element == 'string' ? - document.querySelector( element ) : element; - - if ( jQuery ) { - this.$element = jQuery( this.element ); - } - - // options - this.options = extend( {}, this.constructor.defaults ); - this.option( options ); - - this._create(); - } - - // inherit Unidragger methods - var proto = Draggabilly.prototype = Object.create( Unidragger.prototype ); - - Draggabilly.defaults = { - }; - - /** - * set options - * @param {Object} opts - */ - proto.option = function( opts ) { - extend( this.options, opts ); - }; - - proto._create = function() { - - // properties - this.position = {}; - this._getPosition(); - - this.startPoint = { x: 0, y: 0 }; - this.dragPoint = { x: 0, y: 0 }; - - this.startPosition = extend( {}, this.position ); - - // set relative positioning - var style = getComputedStyle( this.element ); - if ( style.position != 'relative' && style.position != 'absolute' ) { - this.element.style.position = 'relative'; - } - - this.enable(); - this.setHandles(); - - }; - - /** - * set this.handles and bind start events to 'em - */ - proto.setHandles = function() { - this.handles = this.options.handle ? - this.element.querySelectorAll( this.options.handle ) : [ this.element ]; - - this.bindHandles(); - }; - - /** - * emits events via EvEmitter and jQuery events - * @param {String} type - name of event - * @param {Event} event - original event - * @param {Array} args - extra arguments - */ - proto.dispatchEvent = function( type, event, args ) { - var emitArgs = [ event ].concat( args ); - this.emitEvent( type, emitArgs ); - var jQuery = window.jQuery; - // trigger jQuery event - if ( jQuery && this.$element ) { - if ( event ) { - // create jQuery event - var $event = jQuery.Event( event ); - $event.type = type; - this.$element.trigger( $event, args ); - } else { - // just trigger with type if no event available - this.$element.trigger( type, args ); - } - } - }; - - // -------------------------- position -------------------------- // - - // get x/y position from style - Draggabilly.prototype._getPosition = function() { - var style = getComputedStyle( this.element ); - var x = this._getPositionCoord( style.left, 'width' ); - var y = this._getPositionCoord( style.top, 'height' ); - // clean up 'auto' or other non-integer values - this.position.x = isNaN( x ) ? 0 : x; - this.position.y = isNaN( y ) ? 0 : y; - - this._addTransformPosition( style ); - }; - - Draggabilly.prototype._getPositionCoord = function( styleSide, measure ) { - if ( styleSide.indexOf('%') != -1 ) { - // convert percent into pixel for Safari, #75 - var parentSize = getSize( this.element.parentNode ); - return ( parseFloat( styleSide ) / 100 ) * parentSize[ measure ]; - } - - return parseInt( styleSide, 10 ); - }; - - // add transform: translate( x, y ) to position - proto._addTransformPosition = function( style ) { - var transform = style[ transformProperty ]; - // bail out if value is 'none' - if ( transform.indexOf('matrix') !== 0 ) { - return; - } - // split matrix(1, 0, 0, 1, x, y) - var matrixValues = transform.split(','); - // translate X value is in 12th or 4th position - var xIndex = transform.indexOf('matrix3d') === 0 ? 12 : 4; - var translateX = parseInt( matrixValues[ xIndex ], 10 ); - // translate Y value is in 13th or 5th position - var translateY = parseInt( matrixValues[ xIndex + 1 ], 10 ); - this.position.x += translateX; - this.position.y += translateY; - }; - - // -------------------------- events -------------------------- // - - /** - * pointer start - * @param {Event} event - * @param {Event or Touch} pointer - */ - proto.pointerDown = function( event, pointer ) { - this._dragPointerDown( event, pointer ); - // kludge to blur focused inputs in dragger - var focused = document.activeElement; - // do not blur body for IE10, metafizzy/flickity#117 - if ( focused && focused.blur && focused != document.body ) { - focused.blur(); - } - // bind move and end events - this._bindPostStartEvents( event ); - this.element.classList.add('is-pointer-down'); - this.dispatchEvent( 'pointerDown', event, [ pointer ] ); - }; - - /** - * drag move - * @param {Event} event - * @param {Event or Touch} pointer - */ - proto.pointerMove = function( event, pointer ) { - var moveVector = this._dragPointerMove( event, pointer ); - this.dispatchEvent( 'pointerMove', event, [ pointer, moveVector ] ); - this._dragMove( event, pointer, moveVector ); - }; - - /** - * drag start - * @param {Event} event - * @param {Event or Touch} pointer - */ - proto.dragStart = function( event, pointer ) { - if ( !this.isEnabled ) { - return; - } - this._getPosition(); - this.measureContainment(); - // position _when_ drag began - this.startPosition.x = this.position.x; - this.startPosition.y = this.position.y; - // reset left/top style - this.setLeftTop(); - - this.dragPoint.x = 0; - this.dragPoint.y = 0; - - this.element.classList.add('is-dragging'); - this.dispatchEvent( 'dragStart', event, [ pointer ] ); - // start animation - this.animate(); - }; - - proto.measureContainment = function() { - var containment = this.options.containment; - if ( !containment ) { - return; - } - - // use element if element - var container = isElement( containment ) ? containment : - // fallback to querySelector if string - typeof containment == 'string' ? document.querySelector( containment ) : - // otherwise just `true`, use the parent - this.element.parentNode; - - var elemSize = getSize( this.element ); - var containerSize = getSize( container ); - var elemRect = this.element.getBoundingClientRect(); - var containerRect = container.getBoundingClientRect(); - - var borderSizeX = containerSize.borderLeftWidth + containerSize.borderRightWidth; - var borderSizeY = containerSize.borderTopWidth + containerSize.borderBottomWidth; - - var position = this.relativeStartPosition = { - x: elemRect.left - ( containerRect.left + containerSize.borderLeftWidth ), - y: elemRect.top - ( containerRect.top + containerSize.borderTopWidth ) - }; - - this.containSize = { - width: ( containerSize.width - borderSizeX ) - position.x - elemSize.width, - height: ( containerSize.height - borderSizeY ) - position.y - elemSize.height - }; - }; - - // ----- move event ----- // - - /** - * drag move - * @param {Event} event - * @param {Event or Touch} pointer - */ - proto.dragMove = function( event, pointer, moveVector ) { - if ( !this.isEnabled ) { - return; - } - var dragX = moveVector.x; - var dragY = moveVector.y; - - var grid = this.options.grid; - var gridX = grid && grid[0]; - var gridY = grid && grid[1]; - - dragX = applyGrid( dragX, gridX ); - dragY = applyGrid( dragY, gridY ); - - dragX = this.containDrag( 'x', dragX, gridX ); - dragY = this.containDrag( 'y', dragY, gridY ); - - // constrain to axis - dragX = this.options.axis == 'y' ? 0 : dragX; - dragY = this.options.axis == 'x' ? 0 : dragY; - - this.position.x = this.startPosition.x + dragX; - this.position.y = this.startPosition.y + dragY; - // set dragPoint properties - this.dragPoint.x = dragX; - this.dragPoint.y = dragY; - - this.dispatchEvent( 'dragMove', event, [ pointer, moveVector ] ); - }; - - function applyGrid( value, grid, method ) { - method = method || 'round'; - return grid ? Math[ method ]( value / grid ) * grid : value; - } - - proto.containDrag = function( axis, drag, grid ) { - if ( !this.options.containment ) { - return drag; - } - var measure = axis == 'x' ? 'width' : 'height'; - - var rel = this.relativeStartPosition[ axis ]; - var min = applyGrid( -rel, grid, 'ceil' ); - var max = this.containSize[ measure ]; - max = applyGrid( max, grid, 'floor' ); - return Math.min( max, Math.max( min, drag ) ); - }; - - // ----- end event ----- // - - /** - * pointer up - * @param {Event} event - * @param {Event or Touch} pointer - */ - proto.pointerUp = function( event, pointer ) { - this.element.classList.remove('is-pointer-down'); - this.dispatchEvent( 'pointerUp', event, [ pointer ] ); - this._dragPointerUp( event, pointer ); - }; - - /** - * drag end - * @param {Event} event - * @param {Event or Touch} pointer - */ - proto.dragEnd = function( event, pointer ) { - if ( !this.isEnabled ) { - return; - } - // use top left position when complete - if ( transformProperty ) { - this.element.style[ transformProperty ] = ''; - this.setLeftTop(); - } - this.element.classList.remove('is-dragging'); - this.dispatchEvent( 'dragEnd', event, [ pointer ] ); - }; - - // -------------------------- animation -------------------------- // - - proto.animate = function() { - // only render and animate if dragging - if ( !this.isDragging ) { - return; - } - - this.positionDrag(); - - var _this = this; - requestAnimationFrame( function animateFrame() { - _this.animate(); - }); - - }; - - // left/top positioning - proto.setLeftTop = function() { - this.element.style.left = this.position.x + 'px'; - this.element.style.top = this.position.y + 'px'; - }; - - proto.positionDrag = function() { - this.element.style[ transformProperty ] = 'translate3d( ' + this.dragPoint.x + - 'px, ' + this.dragPoint.y + 'px, 0)'; - }; - - // ----- staticClick ----- // - - proto.staticClick = function( event, pointer ) { - this.dispatchEvent( 'staticClick', event, [ pointer ] ); - }; - - // ----- methods ----- // - - proto.enable = function() { - this.isEnabled = true; - }; - - proto.disable = function() { - this.isEnabled = false; - if ( this.isDragging ) { - this.dragEnd(); - } - }; - - proto.destroy = function() { - this.disable(); - // reset styles - this.element.style[ transformProperty ] = ''; - this.element.style.left = ''; - this.element.style.top = ''; - this.element.style.position = ''; - // unbind handles - this.unbindHandles(); - // remove jQuery data - if ( this.$element ) { - this.$element.removeData('draggabilly'); - } - }; - - // ----- jQuery bridget ----- // - - // required for jQuery bridget - proto._init = noop; - - if ( jQuery && jQuery.bridget ) { - jQuery.bridget( 'draggabilly', Draggabilly ); - } - - // ----- ----- // - - return Draggabilly; - - })); - - -/***/ }, -/* 4 */ -/***/ function(module, exports, __webpack_require__) { - - var __WEBPACK_AMD_DEFINE_RESULT__;/*! - * getSize v2.0.2 - * measure size of elements - * MIT license - */ - - /*jshint browser: true, strict: true, undef: true, unused: true */ - /*global define: false, module: false, console: false */ - - ( function( window, factory ) { - 'use strict'; - - if ( true ) { - // AMD - !(__WEBPACK_AMD_DEFINE_RESULT__ = function() { - return factory(); - }.call(exports, __webpack_require__, exports, module), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); - } else if ( typeof module == 'object' && module.exports ) { - // CommonJS - module.exports = factory(); - } else { - // browser global - window.getSize = factory(); - } - - })( window, function factory() { - 'use strict'; - - // -------------------------- helpers -------------------------- // - - // get a number from a string, not a percentage - function getStyleSize( value ) { - var num = parseFloat( value ); - // not a percent like '100%', and a number - var isValid = value.indexOf('%') == -1 && !isNaN( num ); - return isValid && num; - } - - function noop() {} - - var logError = typeof console == 'undefined' ? noop : - function( message ) { - console.error( message ); - }; - - // -------------------------- measurements -------------------------- // - - var measurements = [ - 'paddingLeft', - 'paddingRight', - 'paddingTop', - 'paddingBottom', - 'marginLeft', - 'marginRight', - 'marginTop', - 'marginBottom', - 'borderLeftWidth', - 'borderRightWidth', - 'borderTopWidth', - 'borderBottomWidth' - ]; - - var measurementsLength = measurements.length; - - function getZeroSize() { - var size = { - width: 0, - height: 0, - innerWidth: 0, - innerHeight: 0, - outerWidth: 0, - outerHeight: 0 - }; - for ( var i=0; i < measurementsLength; i++ ) { - var measurement = measurements[i]; - size[ measurement ] = 0; - } - return size; - } - - // -------------------------- getStyle -------------------------- // - - /** - * getStyle, get style of element, check for Firefox bug - * https://bugzilla.mozilla.org/show_bug.cgi?id=548397 - */ - function getStyle( elem ) { - var style = getComputedStyle( elem ); - if ( !style ) { - logError( 'Style returned ' + style + - '. Are you running this code in a hidden iframe on Firefox? ' + - 'See http://bit.ly/getsizebug1' ); - } - return style; - } - - // -------------------------- setup -------------------------- // - - var isSetup = false; - - var isBoxSizeOuter; - - /** - * setup - * check isBoxSizerOuter - * do on first getSize() rather than on page load for Firefox bug - */ - function setup() { - // setup once - if ( isSetup ) { - return; - } - isSetup = true; - - // -------------------------- box sizing -------------------------- // - - /** - * WebKit measures the outer-width on style.width on border-box elems - * IE & Firefox<29 measures the inner-width - */ - var div = document.createElement('div'); - div.style.width = '200px'; - div.style.padding = '1px 2px 3px 4px'; - div.style.borderStyle = 'solid'; - div.style.borderWidth = '1px 2px 3px 4px'; - div.style.boxSizing = 'border-box'; - - var body = document.body || document.documentElement; - body.appendChild( div ); - var style = getStyle( div ); - - getSize.isBoxSizeOuter = isBoxSizeOuter = getStyleSize( style.width ) == 200; - body.removeChild( div ); - - } - - // -------------------------- getSize -------------------------- // - - function getSize( elem ) { - setup(); - - // use querySeletor if elem is string - if ( typeof elem == 'string' ) { - elem = document.querySelector( elem ); - } - - // do not proceed on non-objects - if ( !elem || typeof elem != 'object' || !elem.nodeType ) { - return; - } - - var style = getStyle( elem ); - - // if hidden, everything is 0 - if ( style.display == 'none' ) { - return getZeroSize(); - } - - var size = {}; - size.width = elem.offsetWidth; - size.height = elem.offsetHeight; - - var isBorderBox = size.isBorderBox = style.boxSizing == 'border-box'; - - // get all measurements - for ( var i=0; i < measurementsLength; i++ ) { - var measurement = measurements[i]; - var value = style[ measurement ]; - var num = parseFloat( value ); - // any 'auto', 'medium' value will be 0 - size[ measurement ] = !isNaN( num ) ? num : 0; - } - - var paddingWidth = size.paddingLeft + size.paddingRight; - var paddingHeight = size.paddingTop + size.paddingBottom; - var marginWidth = size.marginLeft + size.marginRight; - var marginHeight = size.marginTop + size.marginBottom; - var borderWidth = size.borderLeftWidth + size.borderRightWidth; - var borderHeight = size.borderTopWidth + size.borderBottomWidth; - - var isBorderBoxSizeOuter = isBorderBox && isBoxSizeOuter; - - // overwrite width and height if we can get it from style - var styleWidth = getStyleSize( style.width ); - if ( styleWidth !== false ) { - size.width = styleWidth + - // add padding and border unless it's already including it - ( isBorderBoxSizeOuter ? 0 : paddingWidth + borderWidth ); - } - - var styleHeight = getStyleSize( style.height ); - if ( styleHeight !== false ) { - size.height = styleHeight + - // add padding and border unless it's already including it - ( isBorderBoxSizeOuter ? 0 : paddingHeight + borderHeight ); - } - - size.innerWidth = size.width - ( paddingWidth + borderWidth ); - size.innerHeight = size.height - ( paddingHeight + borderHeight ); - - size.outerWidth = size.width + marginWidth; - size.outerHeight = size.height + marginHeight; - - return size; - } - - return getSize; - - }); - - -/***/ }, -/* 5 */ -/***/ function(module, exports, __webpack_require__) { - - var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*! - * Unidragger v2.1.0 - * Draggable base class - * MIT license - */ - - /*jshint browser: true, unused: true, undef: true, strict: true */ - - ( function( window, factory ) { - // universal module definition - /*jshint strict: false */ /*globals define, module, require */ - - if ( true ) { - // AMD - !(__WEBPACK_AMD_DEFINE_ARRAY__ = [ - __webpack_require__(6) - ], __WEBPACK_AMD_DEFINE_RESULT__ = function( Unipointer ) { - return factory( window, Unipointer ); - }.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); - } else if ( typeof module == 'object' && module.exports ) { - // CommonJS - module.exports = factory( - window, - require('unipointer') - ); - } else { - // browser global - window.Unidragger = factory( - window, - window.Unipointer - ); - } - - }( window, function factory( window, Unipointer ) { - - 'use strict'; - - // ----- ----- // - - function noop() {} - - // -------------------------- Unidragger -------------------------- // - - function Unidragger() {} - - // inherit Unipointer & EvEmitter - var proto = Unidragger.prototype = Object.create( Unipointer.prototype ); - - // ----- bind start ----- // - - proto.bindHandles = function() { - this._bindHandles( true ); - }; - - proto.unbindHandles = function() { - this._bindHandles( false ); - }; - - var navigator = window.navigator; - /** - * works as unbinder, as you can .bindHandles( false ) to unbind - * @param {Boolean} isBind - will unbind if falsey - */ - proto._bindHandles = function( isBind ) { - // munge isBind, default to true - isBind = isBind === undefined ? true : !!isBind; - // extra bind logic - var binderExtra; - if ( navigator.pointerEnabled ) { - binderExtra = function( handle ) { - // disable scrolling on the element - handle.style.touchAction = isBind ? 'none' : ''; - }; - } else if ( navigator.msPointerEnabled ) { - binderExtra = function( handle ) { - // disable scrolling on the element - handle.style.msTouchAction = isBind ? 'none' : ''; - }; - } else { - binderExtra = noop; - } - // bind each handle - var bindMethod = isBind ? 'addEventListener' : 'removeEventListener'; - for ( var i=0; i < this.handles.length; i++ ) { - var handle = this.handles[i]; - this._bindStartEvent( handle, isBind ); - binderExtra( handle ); - handle[ bindMethod ]( 'click', this ); - } - }; - - // ----- start event ----- // - - /** - * pointer start - * @param {Event} event - * @param {Event or Touch} pointer - */ - proto.pointerDown = function( event, pointer ) { - // dismiss range sliders - if ( event.target.nodeName == 'INPUT' && event.target.type == 'range' ) { - // reset pointerDown logic - this.isPointerDown = false; - delete this.pointerIdentifier; - return; - } - - this._dragPointerDown( event, pointer ); - // kludge to blur focused inputs in dragger - var focused = document.activeElement; - if ( focused && focused.blur ) { - focused.blur(); - } - // bind move and end events - this._bindPostStartEvents( event ); - this.emitEvent( 'pointerDown', [ event, pointer ] ); - }; - - // base pointer down logic - proto._dragPointerDown = function( event, pointer ) { - // track to see when dragging starts - this.pointerDownPoint = Unipointer.getPointerPoint( pointer ); - - var canPreventDefault = this.canPreventDefaultOnPointerDown( event, pointer ); - if ( canPreventDefault ) { - event.preventDefault(); - } - }; - - // overwriteable method so Flickity can prevent for scrolling - proto.canPreventDefaultOnPointerDown = function( event ) { - // prevent default, unless touchstart or s and