diff --git a/bin/gitgraph.js b/bin/gitgraph.js
index 62b030d..ff9f360 100644
--- a/bin/gitgraph.js
+++ b/bin/gitgraph.js
@@ -1,4 +1,4 @@
-var gitlost = require('../lib/graph');
+import gitlost from '../lib/graph';
settings = JSON.parse(process.argv.slice(2).join(' ') || '{}');
gitlost.graph(settings).then(function (dot) {
console.log(dot);
diff --git a/bin/gitlost.js b/bin/gitlost.js
index 48fecf9..c423f92 100644
--- a/bin/gitlost.js
+++ b/bin/gitlost.js
@@ -1,5 +1,5 @@
-var opn = require('opn');
-var server = require("../lib/server.js");
+import * as opn from 'opn';
+import server from "../lib/server";
opn('http://localhost:6776', {app: 'chrome'});
server.listen(6776);
diff --git a/lib/graph.js b/lib/graph.js
index e2b4f21..4bfb20b 100644
--- a/lib/graph.js
+++ b/lib/graph.js
@@ -1,5 +1,7 @@
-var child_process = require('child_process');
-var md5 = require('md5');
+"use strict";
+
+import * as child_process from 'child_process';
+import * as md5 from 'md5';
var carot = '^';
if (process.platform === 'win32') {
@@ -64,11 +66,11 @@ function hsl_to_rgb(h, s, l){
var color_hash = function(text) {
text = text.match(/[^\/]+$/)[0];
- hash = parseInt('0x' + md5(text).slice(-5));
+ var hash = parseInt('0x' + md5(text).slice(-5));
var h = (((hash >> 9) & 0x1ff) ^ 0x109) / 512; // map [0,127] to ~[ 0, 1)
var s = ((((hash >> 5) & 0x3f) ^ 0x2f) + 36) / 100; // map [0, 63] to [.36, .99]
var l = ((hash & 0x1f) + 24) / 100; // map [0, 31] to [.24, .55]
- rgb = hsl_to_rgb(h, s, l);
+ var rgb = hsl_to_rgb(h, s, l);
rgb = (rgb[0] << 16) + (rgb[1] << 8) + rgb[2];
//console.log('/* ' + hash.toString(16) + ' - ' + [h, s, l] + '*/')
return '#' + ('000000' + rgb.toString(16)).slice(-6)
@@ -165,6 +167,7 @@ function graph(settings) {
};
})
.sort(function (a, b) {
+ var ax, bx;
return ((ax = settings.branches.indexOf(a.ref_short)) !== -1 ? ax : settings.branches.length) - ((bx = settings.branches.indexOf(b.ref_short)) !== -1 ? bx : settings.branches.length);
});
});
@@ -278,7 +281,4 @@ function graph(settings) {
});
}
-module.exports = {
- graph: graph,
- queue_cmd: queue_cmd
-};
+export { graph, queue_cmd };
diff --git a/lib/server.js b/lib/server.js
index 4a3bcbf..44e463a 100644
--- a/lib/server.js
+++ b/lib/server.js
@@ -1,11 +1,10 @@
-var http = require('http');
-var child_process = require('child_process');
+import * as http from 'http';
var fs = require('fs');
-var path = require('path');
-var EventEmitter = require('events');
-var gitlost = require('./graph');
+import * as path from 'path';
+import * as EventEmitter from 'events';
+import * as gitlost from './graph';
-var webdir = path.join(__dirname, '../web');
+var webdir = __dirname;
var vizjs = path.join(__dirname, '../node_modules/viz.js/viz.js');
var mimetypes = {
@@ -280,4 +279,4 @@ server.on('request', function (request, response) {
}
});
-module.exports = server;
+export default server;
diff --git a/package.json b/package.json
index 3bbe8e7..7533aa9 100644
--- a/package.json
+++ b/package.json
@@ -5,16 +5,30 @@
"main": "./lib/graph.js",
"bin": "./bin/gitlost.js",
"dependencies": {
+ "bootstrap": "^3.0.0",
"bootstrap-menu": "^1.0.14",
- "bootstrap3-dialog": "^1.35.3",
+ "bootstrap-select": "^1.12.4",
+ "bootstrap3-dialog": "^1.35.4",
"d3": "^4.13.0",
"d3-graphviz": "^1.3.4",
+ "jquery": "^3.3.1",
"md5": "^2.2.1",
"opn": "^4.0.2",
"sortablejs": "^1.5.1"
},
- "devDependencies": {},
+ "devDependencies": {
+ "babel-loader": "^7.1.4",
+ "css-loader": "^0.28.10",
+ "file-loader": "^1.1.11",
+ "style-loader": "^0.20.3",
+ "url-loader": "^1.0.1",
+ "webpack": "^4.1.1",
+ "webpack-cli": "^2.0.10",
+ "webpack-node-externals": "^1.6.0"
+ },
"scripts": {
+ "build": "webpack && copy web\\graph.html dist\\graph.html && copy node_modules\\viz.js\\viz.js dist\\viz.js",
+ "start": "./dist/gitlost.js",
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
diff --git a/web/BootstrapMenu.js b/web/BootstrapMenu.js
deleted file mode 100644
index baa3a0c..0000000
--- a/web/BootstrapMenu.js
+++ /dev/null
@@ -1,2589 +0,0 @@
-/******/ (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 entry file to build a standalone browser script. */
- window.BootstrapMenu = __webpack_require__(1);
-
-
-/***/ },
-/* 1 */
-/***/ function(module, exports, __webpack_require__) {
-
- 'use strict';
-
- var classNames = __webpack_require__(2);
- var $ = __webpack_require__(3);
- __webpack_require__(4);
-
- // modular lodash requires
- var _ = function() {
- throw new Error('Custom lodash build for BootstrapMenu. lodash chaining is not included');
- };
-
- _.noop = __webpack_require__(6);
- _.each = __webpack_require__(7);
- _.contains = __webpack_require__(34);
- _.extend = __webpack_require__(42);
- _.uniqueId = __webpack_require__(49);
- _.isFunction = __webpack_require__(19);
-
-
- var defaultOptions = {
- /* container of the context menu, where it will be created and where
- * event listeners will be installed. */
- container: 'body',
-
- /* user-defined function to obtain specific data about the currently
- * opened element, to pass it to the rest of user-defined functions
- * of an action. */
- fetchElementData: _.noop,
-
- /* what the source of the context menu should be when opened.
- * Valid values are 'mouse' and 'element'. */
- menuSource: 'mouse',
-
- /* how to calculate the position of the context menu based on its source.
- * Valid values are 'aboveLeft', 'aboveRight', 'belowLeft', and 'belowRight'. */
- menuPosition: 'belowLeft',
-
- /* the event to listen to open the menu.
- * Valid values are 'click', 'right-click', 'hover' */
- menuEvent: 'right-click', // TODO rename to menuAction in next mayor version
-
- /* group actions to render them next to each other, with a separator
- * between each group. */
- actionsGroups: [],
-
- /* message to show when there are no actions to show in a menu
- * (isShown() returned false on all actions) */
- noActionsMessage: 'No available actions',
-
- /* In some weird cases, another plugin may be installing 'click' listeners
- * in the anchors used for each action of the context menu, and stopping
- * the event bubbling before it reachs this plugin's listener.
- *
- * For those cases, _actionSelectEvent can be used to change the event we
- * listen to, for example to 'mousedown'.
- *
- * Unless the context menu is not working due to this and a workaround is
- * needed, this option can be safely ignored.
- */
- _actionSelectEvent: 'click'
- };
-
- function renderMenu(_this) {
- var $menu = $('
');
-
- var $ul = $('');
-
- // group all actions following the actionsGroups option, to
- // add a separator between each of them.
- var groups = [];
-
- // default group where all ungrouped actions will go
- groups[0] = [];
-
- // add the rest of groups
- _.each(_this.options.actionsGroups, function(groupArr, ind) {
- groups[ind+1] = [];
- });
-
- // find out if any of the actions has an icon
- var actionsHaveIcon = false;
-
- // add each action to the group it belongs to, or the default group
- _.each(_this.options.actions, function(action, actionId) {
- var addedToGroup = false;
-
- _.each(_this.options.actionsGroups, function(groupArr, ind) {
- if (_.contains(groupArr, actionId)) {
- groups[ind+1].push(actionId);
- addedToGroup = true;
- }
- });
-
- if (addedToGroup === false) {
- groups[0].push(actionId);
- }
-
- if (typeof action.iconClass !== 'undefined') {
- actionsHaveIcon = true;
- }
- });
-
- var isFirstNonEmptyGroup = true;
-
- _.each(groups, function(actionsIds) {
- if (actionsIds.length == 0)
- return;
-
- if (isFirstNonEmptyGroup === false) {
- $ul.append('" )
- .css( "position", "absolute" )
- .appendTo( "body" )
- .offset( {
- top: 1.5,
- left: 1.5
- } ),
- support = element.offset().top === 1.5;
-
- element.remove();
-
- supportsOffsetFractions = function() {
- return support;
- };
-
- return support;
- };
-
- function getOffsets( offsets, width, height ) {
- return [
- parseFloat( offsets[ 0 ] ) * ( rpercent.test( offsets[ 0 ] ) ? width / 100 : 1 ),
- parseFloat( offsets[ 1 ] ) * ( rpercent.test( offsets[ 1 ] ) ? height / 100 : 1 )
- ];
- }
-
- function parseCss( element, property ) {
- return parseInt( $.css( element, property ), 10 ) || 0;
- }
-
- function getDimensions( elem ) {
- var raw = elem[ 0 ];
- if ( raw.nodeType === 9 ) {
- return {
- width: elem.width(),
- height: elem.height(),
- offset: { top: 0, left: 0 }
- };
- }
- if ( $.isWindow( raw ) ) {
- return {
- width: elem.width(),
- height: elem.height(),
- offset: { top: elem.scrollTop(), left: elem.scrollLeft() }
- };
- }
- if ( raw.preventDefault ) {
- return {
- width: 0,
- height: 0,
- offset: { top: raw.pageY, left: raw.pageX }
- };
- }
- return {
- width: elem.outerWidth(),
- height: elem.outerHeight(),
- offset: elem.offset()
- };
- }
-
- $.position = {
- scrollbarWidth: function() {
- if ( cachedScrollbarWidth !== undefined ) {
- return cachedScrollbarWidth;
- }
- var w1, w2,
- div = $( "
" ),
- innerDiv = div.children()[ 0 ];
-
- $( "body" ).append( div );
- w1 = innerDiv.offsetWidth;
- div.css( "overflow", "scroll" );
-
- w2 = innerDiv.offsetWidth;
-
- if ( w1 === w2 ) {
- w2 = div[ 0 ].clientWidth;
- }
-
- div.remove();
-
- return ( cachedScrollbarWidth = w1 - w2 );
- },
- getScrollInfo: function( within ) {
- var overflowX = within.isWindow || within.isDocument ? "" :
- within.element.css( "overflow-x" ),
- overflowY = within.isWindow || within.isDocument ? "" :
- within.element.css( "overflow-y" ),
- hasOverflowX = overflowX === "scroll" ||
- ( overflowX === "auto" && within.width < within.element[ 0 ].scrollWidth ),
- hasOverflowY = overflowY === "scroll" ||
- ( overflowY === "auto" && within.height < within.element[ 0 ].scrollHeight );
- return {
- width: hasOverflowY ? $.position.scrollbarWidth() : 0,
- height: hasOverflowX ? $.position.scrollbarWidth() : 0
- };
- },
- getWithinInfo: function( element ) {
- var withinElement = $( element || window ),
- isWindow = $.isWindow( withinElement[ 0 ] ),
- isDocument = !!withinElement[ 0 ] && withinElement[ 0 ].nodeType === 9,
- hasOffset = !isWindow && !isDocument;
- return {
- element: withinElement,
- isWindow: isWindow,
- isDocument: isDocument,
- offset: hasOffset ? $( element ).offset() : { left: 0, top: 0 },
- scrollLeft: withinElement.scrollLeft(),
- scrollTop: withinElement.scrollTop(),
- width: withinElement.outerWidth(),
- height: withinElement.outerHeight()
- };
- }
- };
-
- $.fn.position = function( options ) {
- if ( !options || !options.of ) {
- return _position.apply( this, arguments );
- }
-
- // Make a copy, we don't want to modify arguments
- options = $.extend( {}, options );
-
- var atOffset, targetWidth, targetHeight, targetOffset, basePosition, dimensions,
- target = $( options.of ),
- within = $.position.getWithinInfo( options.within ),
- scrollInfo = $.position.getScrollInfo( within ),
- collision = ( options.collision || "flip" ).split( " " ),
- offsets = {};
-
- dimensions = getDimensions( target );
- if ( target[ 0 ].preventDefault ) {
-
- // Force left top to allow flipping
- options.at = "left top";
- }
- targetWidth = dimensions.width;
- targetHeight = dimensions.height;
- targetOffset = dimensions.offset;
-
- // Clone to reuse original targetOffset later
- basePosition = $.extend( {}, targetOffset );
-
- // Force my and at to have valid horizontal and vertical positions
- // if a value is missing or invalid, it will be converted to center
- $.each( [ "my", "at" ], function() {
- var pos = ( options[ this ] || "" ).split( " " ),
- horizontalOffset,
- verticalOffset;
-
- if ( pos.length === 1 ) {
- pos = rhorizontal.test( pos[ 0 ] ) ?
- pos.concat( [ "center" ] ) :
- rvertical.test( pos[ 0 ] ) ?
- [ "center" ].concat( pos ) :
- [ "center", "center" ];
- }
- pos[ 0 ] = rhorizontal.test( pos[ 0 ] ) ? pos[ 0 ] : "center";
- pos[ 1 ] = rvertical.test( pos[ 1 ] ) ? pos[ 1 ] : "center";
-
- // Calculate offsets
- horizontalOffset = roffset.exec( pos[ 0 ] );
- verticalOffset = roffset.exec( pos[ 1 ] );
- offsets[ this ] = [
- horizontalOffset ? horizontalOffset[ 0 ] : 0,
- verticalOffset ? verticalOffset[ 0 ] : 0
- ];
-
- // Reduce to just the positions without the offsets
- options[ this ] = [
- rposition.exec( pos[ 0 ] )[ 0 ],
- rposition.exec( pos[ 1 ] )[ 0 ]
- ];
- } );
-
- // Normalize collision option
- if ( collision.length === 1 ) {
- collision[ 1 ] = collision[ 0 ];
- }
-
- if ( options.at[ 0 ] === "right" ) {
- basePosition.left += targetWidth;
- } else if ( options.at[ 0 ] === "center" ) {
- basePosition.left += targetWidth / 2;
- }
-
- if ( options.at[ 1 ] === "bottom" ) {
- basePosition.top += targetHeight;
- } else if ( options.at[ 1 ] === "center" ) {
- basePosition.top += targetHeight / 2;
- }
-
- atOffset = getOffsets( offsets.at, targetWidth, targetHeight );
- basePosition.left += atOffset[ 0 ];
- basePosition.top += atOffset[ 1 ];
-
- return this.each( function() {
- var collisionPosition, using,
- elem = $( this ),
- elemWidth = elem.outerWidth(),
- elemHeight = elem.outerHeight(),
- marginLeft = parseCss( this, "marginLeft" ),
- marginTop = parseCss( this, "marginTop" ),
- collisionWidth = elemWidth + marginLeft + parseCss( this, "marginRight" ) +
- scrollInfo.width,
- collisionHeight = elemHeight + marginTop + parseCss( this, "marginBottom" ) +
- scrollInfo.height,
- position = $.extend( {}, basePosition ),
- myOffset = getOffsets( offsets.my, elem.outerWidth(), elem.outerHeight() );
-
- if ( options.my[ 0 ] === "right" ) {
- position.left -= elemWidth;
- } else if ( options.my[ 0 ] === "center" ) {
- position.left -= elemWidth / 2;
- }
-
- if ( options.my[ 1 ] === "bottom" ) {
- position.top -= elemHeight;
- } else if ( options.my[ 1 ] === "center" ) {
- position.top -= elemHeight / 2;
- }
-
- position.left += myOffset[ 0 ];
- position.top += myOffset[ 1 ];
-
- // If the browser doesn't support fractions, then round for consistent results
- if ( !supportsOffsetFractions() ) {
- position.left = round( position.left );
- position.top = round( position.top );
- }
-
- collisionPosition = {
- marginLeft: marginLeft,
- marginTop: marginTop
- };
-
- $.each( [ "left", "top" ], function( i, dir ) {
- if ( $.ui.position[ collision[ i ] ] ) {
- $.ui.position[ collision[ i ] ][ dir ]( position, {
- targetWidth: targetWidth,
- targetHeight: targetHeight,
- elemWidth: elemWidth,
- elemHeight: elemHeight,
- collisionPosition: collisionPosition,
- collisionWidth: collisionWidth,
- collisionHeight: collisionHeight,
- offset: [ atOffset[ 0 ] + myOffset[ 0 ], atOffset [ 1 ] + myOffset[ 1 ] ],
- my: options.my,
- at: options.at,
- within: within,
- elem: elem
- } );
- }
- } );
-
- if ( options.using ) {
-
- // Adds feedback as second argument to using callback, if present
- using = function( props ) {
- var left = targetOffset.left - position.left,
- right = left + targetWidth - elemWidth,
- top = targetOffset.top - position.top,
- bottom = top + targetHeight - elemHeight,
- feedback = {
- target: {
- element: target,
- left: targetOffset.left,
- top: targetOffset.top,
- width: targetWidth,
- height: targetHeight
- },
- element: {
- element: elem,
- left: position.left,
- top: position.top,
- width: elemWidth,
- height: elemHeight
- },
- horizontal: right < 0 ? "left" : left > 0 ? "right" : "center",
- vertical: bottom < 0 ? "top" : top > 0 ? "bottom" : "middle"
- };
- if ( targetWidth < elemWidth && abs( left + right ) < targetWidth ) {
- feedback.horizontal = "center";
- }
- if ( targetHeight < elemHeight && abs( top + bottom ) < targetHeight ) {
- feedback.vertical = "middle";
- }
- if ( max( abs( left ), abs( right ) ) > max( abs( top ), abs( bottom ) ) ) {
- feedback.important = "horizontal";
- } else {
- feedback.important = "vertical";
- }
- options.using.call( this, props, feedback );
- };
- }
-
- elem.offset( $.extend( position, { using: using } ) );
- } );
- };
-
- $.ui.position = {
- fit: {
- left: function( position, data ) {
- var within = data.within,
- withinOffset = within.isWindow ? within.scrollLeft : within.offset.left,
- outerWidth = within.width,
- collisionPosLeft = position.left - data.collisionPosition.marginLeft,
- overLeft = withinOffset - collisionPosLeft,
- overRight = collisionPosLeft + data.collisionWidth - outerWidth - withinOffset,
- newOverRight;
-
- // Element is wider than within
- if ( data.collisionWidth > outerWidth ) {
-
- // Element is initially over the left side of within
- if ( overLeft > 0 && overRight <= 0 ) {
- newOverRight = position.left + overLeft + data.collisionWidth - outerWidth -
- withinOffset;
- position.left += overLeft - newOverRight;
-
- // Element is initially over right side of within
- } else if ( overRight > 0 && overLeft <= 0 ) {
- position.left = withinOffset;
-
- // Element is initially over both left and right sides of within
- } else {
- if ( overLeft > overRight ) {
- position.left = withinOffset + outerWidth - data.collisionWidth;
- } else {
- position.left = withinOffset;
- }
- }
-
- // Too far left -> align with left edge
- } else if ( overLeft > 0 ) {
- position.left += overLeft;
-
- // Too far right -> align with right edge
- } else if ( overRight > 0 ) {
- position.left -= overRight;
-
- // Adjust based on position and margin
- } else {
- position.left = max( position.left - collisionPosLeft, position.left );
- }
- },
- top: function( position, data ) {
- var within = data.within,
- withinOffset = within.isWindow ? within.scrollTop : within.offset.top,
- outerHeight = data.within.height,
- collisionPosTop = position.top - data.collisionPosition.marginTop,
- overTop = withinOffset - collisionPosTop,
- overBottom = collisionPosTop + data.collisionHeight - outerHeight - withinOffset,
- newOverBottom;
-
- // Element is taller than within
- if ( data.collisionHeight > outerHeight ) {
-
- // Element is initially over the top of within
- if ( overTop > 0 && overBottom <= 0 ) {
- newOverBottom = position.top + overTop + data.collisionHeight - outerHeight -
- withinOffset;
- position.top += overTop - newOverBottom;
-
- // Element is initially over bottom of within
- } else if ( overBottom > 0 && overTop <= 0 ) {
- position.top = withinOffset;
-
- // Element is initially over both top and bottom of within
- } else {
- if ( overTop > overBottom ) {
- position.top = withinOffset + outerHeight - data.collisionHeight;
- } else {
- position.top = withinOffset;
- }
- }
-
- // Too far up -> align with top
- } else if ( overTop > 0 ) {
- position.top += overTop;
-
- // Too far down -> align with bottom edge
- } else if ( overBottom > 0 ) {
- position.top -= overBottom;
-
- // Adjust based on position and margin
- } else {
- position.top = max( position.top - collisionPosTop, position.top );
- }
- }
- },
- flip: {
- left: function( position, data ) {
- var within = data.within,
- withinOffset = within.offset.left + within.scrollLeft,
- outerWidth = within.width,
- offsetLeft = within.isWindow ? within.scrollLeft : within.offset.left,
- collisionPosLeft = position.left - data.collisionPosition.marginLeft,
- overLeft = collisionPosLeft - offsetLeft,
- overRight = collisionPosLeft + data.collisionWidth - outerWidth - offsetLeft,
- myOffset = data.my[ 0 ] === "left" ?
- -data.elemWidth :
- data.my[ 0 ] === "right" ?
- data.elemWidth :
- 0,
- atOffset = data.at[ 0 ] === "left" ?
- data.targetWidth :
- data.at[ 0 ] === "right" ?
- -data.targetWidth :
- 0,
- offset = -2 * data.offset[ 0 ],
- newOverRight,
- newOverLeft;
-
- if ( overLeft < 0 ) {
- newOverRight = position.left + myOffset + atOffset + offset + data.collisionWidth -
- outerWidth - withinOffset;
- if ( newOverRight < 0 || newOverRight < abs( overLeft ) ) {
- position.left += myOffset + atOffset + offset;
- }
- } else if ( overRight > 0 ) {
- newOverLeft = position.left - data.collisionPosition.marginLeft + myOffset +
- atOffset + offset - offsetLeft;
- if ( newOverLeft > 0 || abs( newOverLeft ) < overRight ) {
- position.left += myOffset + atOffset + offset;
- }
- }
- },
- top: function( position, data ) {
- var within = data.within,
- withinOffset = within.offset.top + within.scrollTop,
- outerHeight = within.height,
- offsetTop = within.isWindow ? within.scrollTop : within.offset.top,
- collisionPosTop = position.top - data.collisionPosition.marginTop,
- overTop = collisionPosTop - offsetTop,
- overBottom = collisionPosTop + data.collisionHeight - outerHeight - offsetTop,
- top = data.my[ 1 ] === "top",
- myOffset = top ?
- -data.elemHeight :
- data.my[ 1 ] === "bottom" ?
- data.elemHeight :
- 0,
- atOffset = data.at[ 1 ] === "top" ?
- data.targetHeight :
- data.at[ 1 ] === "bottom" ?
- -data.targetHeight :
- 0,
- offset = -2 * data.offset[ 1 ],
- newOverTop,
- newOverBottom;
- if ( overTop < 0 ) {
- newOverBottom = position.top + myOffset + atOffset + offset + data.collisionHeight -
- outerHeight - withinOffset;
- if ( newOverBottom < 0 || newOverBottom < abs( overTop ) ) {
- position.top += myOffset + atOffset + offset;
- }
- } else if ( overBottom > 0 ) {
- newOverTop = position.top - data.collisionPosition.marginTop + myOffset + atOffset +
- offset - offsetTop;
- if ( newOverTop > 0 || abs( newOverTop ) < overBottom ) {
- position.top += myOffset + atOffset + offset;
- }
- }
- }
- },
- flipfit: {
- left: function() {
- $.ui.position.flip.left.apply( this, arguments );
- $.ui.position.fit.left.apply( this, arguments );
- },
- top: function() {
- $.ui.position.flip.top.apply( this, arguments );
- $.ui.position.fit.top.apply( this, arguments );
- }
- }
- };
-
- } )();
-
- return $.ui.position;
-
- } ) );
-
-
-/***/ },
-/* 5 */
-/***/ function(module, exports, __webpack_require__) {
-
- var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;( function( factory ) {
- if ( true ) {
-
- // AMD. Register as an anonymous module.
- !(__WEBPACK_AMD_DEFINE_ARRAY__ = [ __webpack_require__(3) ], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory), __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
- } else {
-
- // Browser globals
- factory( jQuery );
- }
- } ( function( $ ) {
-
- $.ui = $.ui || {};
-
- return $.ui.version = "1.12.0";
-
- } ) );
-
-
-/***/ },
-/* 6 */
-/***/ function(module, exports) {
-
- /**
- * A no-operation function that returns `undefined` regardless of the
- * arguments it receives.
- *
- * @static
- * @memberOf _
- * @category Utility
- * @example
- *
- * var object = { 'user': 'fred' };
- *
- * _.noop(object) === undefined;
- * // => true
- */
- function noop() {
- // No operation performed.
- }
-
- module.exports = noop;
-
-
-/***/ },
-/* 7 */
-/***/ function(module, exports, __webpack_require__) {
-
- module.exports = __webpack_require__(8);
-
-
-/***/ },
-/* 8 */
-/***/ function(module, exports, __webpack_require__) {
-
- var arrayEach = __webpack_require__(9),
- baseEach = __webpack_require__(10),
- createForEach = __webpack_require__(31);
-
- /**
- * Iterates over elements of `collection` invoking `iteratee` for each element.
- * The `iteratee` is bound to `thisArg` and invoked with three arguments:
- * (value, index|key, collection). Iteratee functions may exit iteration early
- * by explicitly returning `false`.
- *
- * **Note:** As with other "Collections" methods, objects with a "length" property
- * are iterated like arrays. To avoid this behavior `_.forIn` or `_.forOwn`
- * may be used for object iteration.
- *
- * @static
- * @memberOf _
- * @alias each
- * @category Collection
- * @param {Array|Object|string} collection The collection to iterate over.
- * @param {Function} [iteratee=_.identity] The function invoked per iteration.
- * @param {*} [thisArg] The `this` binding of `iteratee`.
- * @returns {Array|Object|string} Returns `collection`.
- * @example
- *
- * _([1, 2]).forEach(function(n) {
- * console.log(n);
- * }).value();
- * // => logs each value from left to right and returns the array
- *
- * _.forEach({ 'a': 1, 'b': 2 }, function(n, key) {
- * console.log(n, key);
- * });
- * // => logs each value-key pair and returns the object (iteration order is not guaranteed)
- */
- var forEach = createForEach(arrayEach, baseEach);
-
- module.exports = forEach;
-
-
-/***/ },
-/* 9 */
-/***/ function(module, exports) {
-
- /**
- * A specialized version of `_.forEach` for arrays without support for callback
- * shorthands and `this` binding.
- *
- * @private
- * @param {Array} array The array to iterate over.
- * @param {Function} iteratee The function invoked per iteration.
- * @returns {Array} Returns `array`.
- */
- function arrayEach(array, iteratee) {
- var index = -1,
- length = array.length;
-
- while (++index < length) {
- if (iteratee(array[index], index, array) === false) {
- break;
- }
- }
- return array;
- }
-
- module.exports = arrayEach;
-
-
-/***/ },
-/* 10 */
-/***/ function(module, exports, __webpack_require__) {
-
- var baseForOwn = __webpack_require__(11),
- createBaseEach = __webpack_require__(30);
-
- /**
- * The base implementation of `_.forEach` without support for callback
- * shorthands and `this` binding.
- *
- * @private
- * @param {Array|Object|string} collection The collection to iterate over.
- * @param {Function} iteratee The function invoked per iteration.
- * @returns {Array|Object|string} Returns `collection`.
- */
- var baseEach = createBaseEach(baseForOwn);
-
- module.exports = baseEach;
-
-
-/***/ },
-/* 11 */
-/***/ function(module, exports, __webpack_require__) {
-
- var baseFor = __webpack_require__(12),
- keys = __webpack_require__(16);
-
- /**
- * The base implementation of `_.forOwn` without support for callback
- * shorthands and `this` binding.
- *
- * @private
- * @param {Object} object The object to iterate over.
- * @param {Function} iteratee The function invoked per iteration.
- * @returns {Object} Returns `object`.
- */
- function baseForOwn(object, iteratee) {
- return baseFor(object, iteratee, keys);
- }
-
- module.exports = baseForOwn;
-
-
-/***/ },
-/* 12 */
-/***/ function(module, exports, __webpack_require__) {
-
- var createBaseFor = __webpack_require__(13);
-
- /**
- * The base implementation of `baseForIn` and `baseForOwn` which iterates
- * over `object` properties returned by `keysFunc` invoking `iteratee` for
- * each property. Iteratee functions may exit iteration early by explicitly
- * returning `false`.
- *
- * @private
- * @param {Object} object The object to iterate over.
- * @param {Function} iteratee The function invoked per iteration.
- * @param {Function} keysFunc The function to get the keys of `object`.
- * @returns {Object} Returns `object`.
- */
- var baseFor = createBaseFor();
-
- module.exports = baseFor;
-
-
-/***/ },
-/* 13 */
-/***/ function(module, exports, __webpack_require__) {
-
- var toObject = __webpack_require__(14);
-
- /**
- * Creates a base function for `_.forIn` or `_.forInRight`.
- *
- * @private
- * @param {boolean} [fromRight] Specify iterating from right to left.
- * @returns {Function} Returns the new base function.
- */
- function createBaseFor(fromRight) {
- return function(object, iteratee, keysFunc) {
- var iterable = toObject(object),
- props = keysFunc(object),
- length = props.length,
- index = fromRight ? length : -1;
-
- while ((fromRight ? index-- : ++index < length)) {
- var key = props[index];
- if (iteratee(iterable[key], key, iterable) === false) {
- break;
- }
- }
- return object;
- };
- }
-
- module.exports = createBaseFor;
-
-
-/***/ },
-/* 14 */
-/***/ function(module, exports, __webpack_require__) {
-
- var isObject = __webpack_require__(15);
-
- /**
- * Converts `value` to an object if it's not one.
- *
- * @private
- * @param {*} value The value to process.
- * @returns {Object} Returns the object.
- */
- function toObject(value) {
- return isObject(value) ? value : Object(value);
- }
-
- module.exports = toObject;
-
-
-/***/ },
-/* 15 */
-/***/ function(module, exports) {
-
- /**
- * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`.
- * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
- *
- * @static
- * @memberOf _
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is an object, else `false`.
- * @example
- *
- * _.isObject({});
- * // => true
- *
- * _.isObject([1, 2, 3]);
- * // => true
- *
- * _.isObject(1);
- * // => false
- */
- function isObject(value) {
- // Avoid a V8 JIT bug in Chrome 19-20.
- // See https://code.google.com/p/v8/issues/detail?id=2291 for more details.
- var type = typeof value;
- return !!value && (type == 'object' || type == 'function');
- }
-
- module.exports = isObject;
-
-
-/***/ },
-/* 16 */
-/***/ function(module, exports, __webpack_require__) {
-
- var getNative = __webpack_require__(17),
- isArrayLike = __webpack_require__(21),
- isObject = __webpack_require__(15),
- shimKeys = __webpack_require__(25);
-
- /* Native method references for those with the same name as other `lodash` methods. */
- var nativeKeys = getNative(Object, 'keys');
-
- /**
- * Creates an array of the own enumerable property names of `object`.
- *
- * **Note:** Non-object values are coerced to objects. See the
- * [ES spec](http://ecma-international.org/ecma-262/6.0/#sec-object.keys)
- * for more details.
- *
- * @static
- * @memberOf _
- * @category Object
- * @param {Object} object The object to query.
- * @returns {Array} Returns the array of property names.
- * @example
- *
- * function Foo() {
- * this.a = 1;
- * this.b = 2;
- * }
- *
- * Foo.prototype.c = 3;
- *
- * _.keys(new Foo);
- * // => ['a', 'b'] (iteration order is not guaranteed)
- *
- * _.keys('hi');
- * // => ['0', '1']
- */
- var keys = !nativeKeys ? shimKeys : function(object) {
- var Ctor = object == null ? undefined : object.constructor;
- if ((typeof Ctor == 'function' && Ctor.prototype === object) ||
- (typeof object != 'function' && isArrayLike(object))) {
- return shimKeys(object);
- }
- return isObject(object) ? nativeKeys(object) : [];
- };
-
- module.exports = keys;
-
-
-/***/ },
-/* 17 */
-/***/ function(module, exports, __webpack_require__) {
-
- var isNative = __webpack_require__(18);
-
- /**
- * Gets the native function at `key` of `object`.
- *
- * @private
- * @param {Object} object The object to query.
- * @param {string} key The key of the method to get.
- * @returns {*} Returns the function if it's native, else `undefined`.
- */
- function getNative(object, key) {
- var value = object == null ? undefined : object[key];
- return isNative(value) ? value : undefined;
- }
-
- module.exports = getNative;
-
-
-/***/ },
-/* 18 */
-/***/ function(module, exports, __webpack_require__) {
-
- var isFunction = __webpack_require__(19),
- isObjectLike = __webpack_require__(20);
-
- /** Used to detect host constructors (Safari > 5). */
- var reIsHostCtor = /^\[object .+?Constructor\]$/;
-
- /** Used for native method references. */
- var objectProto = Object.prototype;
-
- /** Used to resolve the decompiled source of functions. */
- var fnToString = Function.prototype.toString;
-
- /** Used to check objects for own properties. */
- var hasOwnProperty = objectProto.hasOwnProperty;
-
- /** Used to detect if a method is native. */
- var reIsNative = RegExp('^' +
- fnToString.call(hasOwnProperty).replace(/[\\^$.*+?()[\]{}|]/g, '\\$&')
- .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
- );
-
- /**
- * Checks if `value` is a native function.
- *
- * @static
- * @memberOf _
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is a native function, else `false`.
- * @example
- *
- * _.isNative(Array.prototype.push);
- * // => true
- *
- * _.isNative(_);
- * // => false
- */
- function isNative(value) {
- if (value == null) {
- return false;
- }
- if (isFunction(value)) {
- return reIsNative.test(fnToString.call(value));
- }
- return isObjectLike(value) && reIsHostCtor.test(value);
- }
-
- module.exports = isNative;
-
-
-/***/ },
-/* 19 */
-/***/ function(module, exports, __webpack_require__) {
-
- var isObject = __webpack_require__(15);
-
- /** `Object#toString` result references. */
- var funcTag = '[object Function]';
-
- /** Used for native method references. */
- var objectProto = Object.prototype;
-
- /**
- * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
- * of values.
- */
- var objToString = objectProto.toString;
-
- /**
- * Checks if `value` is classified as a `Function` object.
- *
- * @static
- * @memberOf _
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
- * @example
- *
- * _.isFunction(_);
- * // => true
- *
- * _.isFunction(/abc/);
- * // => false
- */
- function isFunction(value) {
- // The use of `Object#toString` avoids issues with the `typeof` operator
- // in older versions of Chrome and Safari which return 'function' for regexes
- // and Safari 8 which returns 'object' for typed array constructors.
- return isObject(value) && objToString.call(value) == funcTag;
- }
-
- module.exports = isFunction;
-
-
-/***/ },
-/* 20 */
-/***/ function(module, exports) {
-
- /**
- * Checks if `value` is object-like.
- *
- * @private
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
- */
- function isObjectLike(value) {
- return !!value && typeof value == 'object';
- }
-
- module.exports = isObjectLike;
-
-
-/***/ },
-/* 21 */
-/***/ function(module, exports, __webpack_require__) {
-
- var getLength = __webpack_require__(22),
- isLength = __webpack_require__(24);
-
- /**
- * Checks if `value` is array-like.
- *
- * @private
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
- */
- function isArrayLike(value) {
- return value != null && isLength(getLength(value));
- }
-
- module.exports = isArrayLike;
-
-
-/***/ },
-/* 22 */
-/***/ function(module, exports, __webpack_require__) {
-
- var baseProperty = __webpack_require__(23);
-
- /**
- * Gets the "length" property value of `object`.
- *
- * **Note:** This function is used to avoid a [JIT bug](https://bugs.webkit.org/show_bug.cgi?id=142792)
- * that affects Safari on at least iOS 8.1-8.3 ARM64.
- *
- * @private
- * @param {Object} object The object to query.
- * @returns {*} Returns the "length" value.
- */
- var getLength = baseProperty('length');
-
- module.exports = getLength;
-
-
-/***/ },
-/* 23 */
-/***/ function(module, exports) {
-
- /**
- * The base implementation of `_.property` without support for deep paths.
- *
- * @private
- * @param {string} key The key of the property to get.
- * @returns {Function} Returns the new function.
- */
- function baseProperty(key) {
- return function(object) {
- return object == null ? undefined : object[key];
- };
- }
-
- module.exports = baseProperty;
-
-
-/***/ },
-/* 24 */
-/***/ function(module, exports) {
-
- /**
- * Used as the [maximum length](http://ecma-international.org/ecma-262/6.0/#sec-number.max_safe_integer)
- * of an array-like value.
- */
- var MAX_SAFE_INTEGER = 9007199254740991;
-
- /**
- * Checks if `value` is a valid array-like length.
- *
- * **Note:** This function is based on [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength).
- *
- * @private
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
- */
- function isLength(value) {
- return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
- }
-
- module.exports = isLength;
-
-
-/***/ },
-/* 25 */
-/***/ function(module, exports, __webpack_require__) {
-
- var isArguments = __webpack_require__(26),
- isArray = __webpack_require__(27),
- isIndex = __webpack_require__(28),
- isLength = __webpack_require__(24),
- keysIn = __webpack_require__(29);
-
- /** Used for native method references. */
- var objectProto = Object.prototype;
-
- /** Used to check objects for own properties. */
- var hasOwnProperty = objectProto.hasOwnProperty;
-
- /**
- * A fallback implementation of `Object.keys` which creates an array of the
- * own enumerable property names of `object`.
- *
- * @private
- * @param {Object} object The object to query.
- * @returns {Array} Returns the array of property names.
- */
- function shimKeys(object) {
- var props = keysIn(object),
- propsLength = props.length,
- length = propsLength && object.length;
-
- var allowIndexes = !!length && isLength(length) &&
- (isArray(object) || isArguments(object));
-
- var index = -1,
- result = [];
-
- while (++index < propsLength) {
- var key = props[index];
- if ((allowIndexes && isIndex(key, length)) || hasOwnProperty.call(object, key)) {
- result.push(key);
- }
- }
- return result;
- }
-
- module.exports = shimKeys;
-
-
-/***/ },
-/* 26 */
-/***/ function(module, exports, __webpack_require__) {
-
- var isArrayLike = __webpack_require__(21),
- isObjectLike = __webpack_require__(20);
-
- /** Used for native method references. */
- var objectProto = Object.prototype;
-
- /** Used to check objects for own properties. */
- var hasOwnProperty = objectProto.hasOwnProperty;
-
- /** Native method references. */
- var propertyIsEnumerable = objectProto.propertyIsEnumerable;
-
- /**
- * Checks if `value` is classified as an `arguments` object.
- *
- * @static
- * @memberOf _
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
- * @example
- *
- * _.isArguments(function() { return arguments; }());
- * // => true
- *
- * _.isArguments([1, 2, 3]);
- * // => false
- */
- function isArguments(value) {
- return isObjectLike(value) && isArrayLike(value) &&
- hasOwnProperty.call(value, 'callee') && !propertyIsEnumerable.call(value, 'callee');
- }
-
- module.exports = isArguments;
-
-
-/***/ },
-/* 27 */
-/***/ function(module, exports, __webpack_require__) {
-
- var getNative = __webpack_require__(17),
- isLength = __webpack_require__(24),
- isObjectLike = __webpack_require__(20);
-
- /** `Object#toString` result references. */
- var arrayTag = '[object Array]';
-
- /** Used for native method references. */
- var objectProto = Object.prototype;
-
- /**
- * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
- * of values.
- */
- var objToString = objectProto.toString;
-
- /* Native method references for those with the same name as other `lodash` methods. */
- var nativeIsArray = getNative(Array, 'isArray');
-
- /**
- * Checks if `value` is classified as an `Array` object.
- *
- * @static
- * @memberOf _
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
- * @example
- *
- * _.isArray([1, 2, 3]);
- * // => true
- *
- * _.isArray(function() { return arguments; }());
- * // => false
- */
- var isArray = nativeIsArray || function(value) {
- return isObjectLike(value) && isLength(value.length) && objToString.call(value) == arrayTag;
- };
-
- module.exports = isArray;
-
-
-/***/ },
-/* 28 */
-/***/ function(module, exports) {
-
- /** Used to detect unsigned integer values. */
- var reIsUint = /^\d+$/;
-
- /**
- * Used as the [maximum length](http://ecma-international.org/ecma-262/6.0/#sec-number.max_safe_integer)
- * of an array-like value.
- */
- var MAX_SAFE_INTEGER = 9007199254740991;
-
- /**
- * Checks if `value` is a valid array-like index.
- *
- * @private
- * @param {*} value The value to check.
- * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
- * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
- */
- function isIndex(value, length) {
- value = (typeof value == 'number' || reIsUint.test(value)) ? +value : -1;
- length = length == null ? MAX_SAFE_INTEGER : length;
- return value > -1 && value % 1 == 0 && value < length;
- }
-
- module.exports = isIndex;
-
-
-/***/ },
-/* 29 */
-/***/ function(module, exports, __webpack_require__) {
-
- var isArguments = __webpack_require__(26),
- isArray = __webpack_require__(27),
- isIndex = __webpack_require__(28),
- isLength = __webpack_require__(24),
- isObject = __webpack_require__(15);
-
- /** Used for native method references. */
- var objectProto = Object.prototype;
-
- /** Used to check objects for own properties. */
- var hasOwnProperty = objectProto.hasOwnProperty;
-
- /**
- * Creates an array of the own and inherited enumerable property names of `object`.
- *
- * **Note:** Non-object values are coerced to objects.
- *
- * @static
- * @memberOf _
- * @category Object
- * @param {Object} object The object to query.
- * @returns {Array} Returns the array of property names.
- * @example
- *
- * function Foo() {
- * this.a = 1;
- * this.b = 2;
- * }
- *
- * Foo.prototype.c = 3;
- *
- * _.keysIn(new Foo);
- * // => ['a', 'b', 'c'] (iteration order is not guaranteed)
- */
- function keysIn(object) {
- if (object == null) {
- return [];
- }
- if (!isObject(object)) {
- object = Object(object);
- }
- var length = object.length;
- length = (length && isLength(length) &&
- (isArray(object) || isArguments(object)) && length) || 0;
-
- var Ctor = object.constructor,
- index = -1,
- isProto = typeof Ctor == 'function' && Ctor.prototype === object,
- result = Array(length),
- skipIndexes = length > 0;
-
- while (++index < length) {
- result[index] = (index + '');
- }
- for (var key in object) {
- if (!(skipIndexes && isIndex(key, length)) &&
- !(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) {
- result.push(key);
- }
- }
- return result;
- }
-
- module.exports = keysIn;
-
-
-/***/ },
-/* 30 */
-/***/ function(module, exports, __webpack_require__) {
-
- var getLength = __webpack_require__(22),
- isLength = __webpack_require__(24),
- toObject = __webpack_require__(14);
-
- /**
- * Creates a `baseEach` or `baseEachRight` function.
- *
- * @private
- * @param {Function} eachFunc The function to iterate over a collection.
- * @param {boolean} [fromRight] Specify iterating from right to left.
- * @returns {Function} Returns the new base function.
- */
- function createBaseEach(eachFunc, fromRight) {
- return function(collection, iteratee) {
- var length = collection ? getLength(collection) : 0;
- if (!isLength(length)) {
- return eachFunc(collection, iteratee);
- }
- var index = fromRight ? length : -1,
- iterable = toObject(collection);
-
- while ((fromRight ? index-- : ++index < length)) {
- if (iteratee(iterable[index], index, iterable) === false) {
- break;
- }
- }
- return collection;
- };
- }
-
- module.exports = createBaseEach;
-
-
-/***/ },
-/* 31 */
-/***/ function(module, exports, __webpack_require__) {
-
- var bindCallback = __webpack_require__(32),
- isArray = __webpack_require__(27);
-
- /**
- * Creates a function for `_.forEach` or `_.forEachRight`.
- *
- * @private
- * @param {Function} arrayFunc The function to iterate over an array.
- * @param {Function} eachFunc The function to iterate over a collection.
- * @returns {Function} Returns the new each function.
- */
- function createForEach(arrayFunc, eachFunc) {
- return function(collection, iteratee, thisArg) {
- return (typeof iteratee == 'function' && thisArg === undefined && isArray(collection))
- ? arrayFunc(collection, iteratee)
- : eachFunc(collection, bindCallback(iteratee, thisArg, 3));
- };
- }
-
- module.exports = createForEach;
-
-
-/***/ },
-/* 32 */
-/***/ function(module, exports, __webpack_require__) {
-
- var identity = __webpack_require__(33);
-
- /**
- * A specialized version of `baseCallback` which only supports `this` binding
- * and specifying the number of arguments to provide to `func`.
- *
- * @private
- * @param {Function} func The function to bind.
- * @param {*} thisArg The `this` binding of `func`.
- * @param {number} [argCount] The number of arguments to provide to `func`.
- * @returns {Function} Returns the callback.
- */
- function bindCallback(func, thisArg, argCount) {
- if (typeof func != 'function') {
- return identity;
- }
- if (thisArg === undefined) {
- return func;
- }
- switch (argCount) {
- case 1: return function(value) {
- return func.call(thisArg, value);
- };
- case 3: return function(value, index, collection) {
- return func.call(thisArg, value, index, collection);
- };
- case 4: return function(accumulator, value, index, collection) {
- return func.call(thisArg, accumulator, value, index, collection);
- };
- case 5: return function(value, other, key, object, source) {
- return func.call(thisArg, value, other, key, object, source);
- };
- }
- return function() {
- return func.apply(thisArg, arguments);
- };
- }
-
- module.exports = bindCallback;
-
-
-/***/ },
-/* 33 */
-/***/ function(module, exports) {
-
- /**
- * This method returns the first argument provided to it.
- *
- * @static
- * @memberOf _
- * @category Utility
- * @param {*} value Any value.
- * @returns {*} Returns `value`.
- * @example
- *
- * var object = { 'user': 'fred' };
- *
- * _.identity(object) === object;
- * // => true
- */
- function identity(value) {
- return value;
- }
-
- module.exports = identity;
-
-
-/***/ },
-/* 34 */
-/***/ function(module, exports, __webpack_require__) {
-
- module.exports = __webpack_require__(35);
-
-
-/***/ },
-/* 35 */
-/***/ function(module, exports, __webpack_require__) {
-
- var baseIndexOf = __webpack_require__(36),
- getLength = __webpack_require__(22),
- isArray = __webpack_require__(27),
- isIterateeCall = __webpack_require__(38),
- isLength = __webpack_require__(24),
- isString = __webpack_require__(39),
- values = __webpack_require__(40);
-
- /* Native method references for those with the same name as other `lodash` methods. */
- var nativeMax = Math.max;
-
- /**
- * Checks if `target` is in `collection` using
- * [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
- * for equality comparisons. If `fromIndex` is negative, it's used as the offset
- * from the end of `collection`.
- *
- * @static
- * @memberOf _
- * @alias contains, include
- * @category Collection
- * @param {Array|Object|string} collection The collection to search.
- * @param {*} target The value to search for.
- * @param {number} [fromIndex=0] The index to search from.
- * @param- {Object} [guard] Enables use as a callback for functions like `_.reduce`.
- * @returns {boolean} Returns `true` if a matching element is found, else `false`.
- * @example
- *
- * _.includes([1, 2, 3], 1);
- * // => true
- *
- * _.includes([1, 2, 3], 1, 2);
- * // => false
- *
- * _.includes({ 'user': 'fred', 'age': 40 }, 'fred');
- * // => true
- *
- * _.includes('pebbles', 'eb');
- * // => true
- */
- function includes(collection, target, fromIndex, guard) {
- var length = collection ? getLength(collection) : 0;
- if (!isLength(length)) {
- collection = values(collection);
- length = collection.length;
- }
- if (typeof fromIndex != 'number' || (guard && isIterateeCall(target, fromIndex, guard))) {
- fromIndex = 0;
- } else {
- fromIndex = fromIndex < 0 ? nativeMax(length + fromIndex, 0) : (fromIndex || 0);
- }
- return (typeof collection == 'string' || !isArray(collection) && isString(collection))
- ? (fromIndex <= length && collection.indexOf(target, fromIndex) > -1)
- : (!!length && baseIndexOf(collection, target, fromIndex) > -1);
- }
-
- module.exports = includes;
-
-
-/***/ },
-/* 36 */
-/***/ function(module, exports, __webpack_require__) {
-
- var indexOfNaN = __webpack_require__(37);
-
- /**
- * The base implementation of `_.indexOf` without support for binary searches.
- *
- * @private
- * @param {Array} array The array to search.
- * @param {*} value The value to search for.
- * @param {number} fromIndex The index to search from.
- * @returns {number} Returns the index of the matched value, else `-1`.
- */
- function baseIndexOf(array, value, fromIndex) {
- if (value !== value) {
- return indexOfNaN(array, fromIndex);
- }
- var index = fromIndex - 1,
- length = array.length;
-
- while (++index < length) {
- if (array[index] === value) {
- return index;
- }
- }
- return -1;
- }
-
- module.exports = baseIndexOf;
-
-
-/***/ },
-/* 37 */
-/***/ function(module, exports) {
-
- /**
- * Gets the index at which the first occurrence of `NaN` is found in `array`.
- *
- * @private
- * @param {Array} array The array to search.
- * @param {number} fromIndex The index to search from.
- * @param {boolean} [fromRight] Specify iterating from right to left.
- * @returns {number} Returns the index of the matched `NaN`, else `-1`.
- */
- function indexOfNaN(array, fromIndex, fromRight) {
- var length = array.length,
- index = fromIndex + (fromRight ? 0 : -1);
-
- while ((fromRight ? index-- : ++index < length)) {
- var other = array[index];
- if (other !== other) {
- return index;
- }
- }
- return -1;
- }
-
- module.exports = indexOfNaN;
-
-
-/***/ },
-/* 38 */
-/***/ function(module, exports, __webpack_require__) {
-
- var isArrayLike = __webpack_require__(21),
- isIndex = __webpack_require__(28),
- isObject = __webpack_require__(15);
-
- /**
- * Checks if the provided arguments are from an iteratee call.
- *
- * @private
- * @param {*} value The potential iteratee value argument.
- * @param {*} index The potential iteratee index or key argument.
- * @param {*} object The potential iteratee object argument.
- * @returns {boolean} Returns `true` if the arguments are from an iteratee call, else `false`.
- */
- function isIterateeCall(value, index, object) {
- if (!isObject(object)) {
- return false;
- }
- var type = typeof index;
- if (type == 'number'
- ? (isArrayLike(object) && isIndex(index, object.length))
- : (type == 'string' && index in object)) {
- var other = object[index];
- return value === value ? (value === other) : (other !== other);
- }
- return false;
- }
-
- module.exports = isIterateeCall;
-
-
-/***/ },
-/* 39 */
-/***/ function(module, exports, __webpack_require__) {
-
- var isObjectLike = __webpack_require__(20);
-
- /** `Object#toString` result references. */
- var stringTag = '[object String]';
-
- /** Used for native method references. */
- var objectProto = Object.prototype;
-
- /**
- * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
- * of values.
- */
- var objToString = objectProto.toString;
-
- /**
- * Checks if `value` is classified as a `String` primitive or object.
- *
- * @static
- * @memberOf _
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
- * @example
- *
- * _.isString('abc');
- * // => true
- *
- * _.isString(1);
- * // => false
- */
- function isString(value) {
- return typeof value == 'string' || (isObjectLike(value) && objToString.call(value) == stringTag);
- }
-
- module.exports = isString;
-
-
-/***/ },
-/* 40 */
-/***/ function(module, exports, __webpack_require__) {
-
- var baseValues = __webpack_require__(41),
- keys = __webpack_require__(16);
-
- /**
- * Creates an array of the own enumerable property values of `object`.
- *
- * **Note:** Non-object values are coerced to objects.
- *
- * @static
- * @memberOf _
- * @category Object
- * @param {Object} object The object to query.
- * @returns {Array} Returns the array of property values.
- * @example
- *
- * function Foo() {
- * this.a = 1;
- * this.b = 2;
- * }
- *
- * Foo.prototype.c = 3;
- *
- * _.values(new Foo);
- * // => [1, 2] (iteration order is not guaranteed)
- *
- * _.values('hi');
- * // => ['h', 'i']
- */
- function values(object) {
- return baseValues(object, keys(object));
- }
-
- module.exports = values;
-
-
-/***/ },
-/* 41 */
-/***/ function(module, exports) {
-
- /**
- * The base implementation of `_.values` and `_.valuesIn` which creates an
- * array of `object` property values corresponding to the property names
- * of `props`.
- *
- * @private
- * @param {Object} object The object to query.
- * @param {Array} props The property names to get values for.
- * @returns {Object} Returns the array of property values.
- */
- function baseValues(object, props) {
- var index = -1,
- length = props.length,
- result = Array(length);
-
- while (++index < length) {
- result[index] = object[props[index]];
- }
- return result;
- }
-
- module.exports = baseValues;
-
-
-/***/ },
-/* 42 */
-/***/ function(module, exports, __webpack_require__) {
-
- module.exports = __webpack_require__(43);
-
-
-/***/ },
-/* 43 */
-/***/ function(module, exports, __webpack_require__) {
-
- var assignWith = __webpack_require__(44),
- baseAssign = __webpack_require__(45),
- createAssigner = __webpack_require__(47);
-
- /**
- * Assigns own enumerable properties of source object(s) to the destination
- * object. Subsequent sources overwrite property assignments of previous sources.
- * If `customizer` is provided it's invoked to produce the assigned values.
- * The `customizer` is bound to `thisArg` and invoked with five arguments:
- * (objectValue, sourceValue, key, object, source).
- *
- * **Note:** This method mutates `object` and is based on
- * [`Object.assign`](http://ecma-international.org/ecma-262/6.0/#sec-object.assign).
- *
- * @static
- * @memberOf _
- * @alias extend
- * @category Object
- * @param {Object} object The destination object.
- * @param {...Object} [sources] The source objects.
- * @param {Function} [customizer] The function to customize assigned values.
- * @param {*} [thisArg] The `this` binding of `customizer`.
- * @returns {Object} Returns `object`.
- * @example
- *
- * _.assign({ 'user': 'barney' }, { 'age': 40 }, { 'user': 'fred' });
- * // => { 'user': 'fred', 'age': 40 }
- *
- * // using a customizer callback
- * var defaults = _.partialRight(_.assign, function(value, other) {
- * return _.isUndefined(value) ? other : value;
- * });
- *
- * defaults({ 'user': 'barney' }, { 'age': 36 }, { 'user': 'fred' });
- * // => { 'user': 'barney', 'age': 36 }
- */
- var assign = createAssigner(function(object, source, customizer) {
- return customizer
- ? assignWith(object, source, customizer)
- : baseAssign(object, source);
- });
-
- module.exports = assign;
-
-
-/***/ },
-/* 44 */
-/***/ function(module, exports, __webpack_require__) {
-
- var keys = __webpack_require__(16);
-
- /**
- * A specialized version of `_.assign` for customizing assigned values without
- * support for argument juggling, multiple sources, and `this` binding `customizer`
- * functions.
- *
- * @private
- * @param {Object} object The destination object.
- * @param {Object} source The source object.
- * @param {Function} customizer The function to customize assigned values.
- * @returns {Object} Returns `object`.
- */
- function assignWith(object, source, customizer) {
- var index = -1,
- props = keys(source),
- length = props.length;
-
- while (++index < length) {
- var key = props[index],
- value = object[key],
- result = customizer(value, source[key], key, object, source);
-
- if ((result === result ? (result !== value) : (value === value)) ||
- (value === undefined && !(key in object))) {
- object[key] = result;
- }
- }
- return object;
- }
-
- module.exports = assignWith;
-
-
-/***/ },
-/* 45 */
-/***/ function(module, exports, __webpack_require__) {
-
- var baseCopy = __webpack_require__(46),
- keys = __webpack_require__(16);
-
- /**
- * The base implementation of `_.assign` without support for argument juggling,
- * multiple sources, and `customizer` functions.
- *
- * @private
- * @param {Object} object The destination object.
- * @param {Object} source The source object.
- * @returns {Object} Returns `object`.
- */
- function baseAssign(object, source) {
- return source == null
- ? object
- : baseCopy(source, keys(source), object);
- }
-
- module.exports = baseAssign;
-
-
-/***/ },
-/* 46 */
-/***/ function(module, exports) {
-
- /**
- * Copies properties of `source` to `object`.
- *
- * @private
- * @param {Object} source The object to copy properties from.
- * @param {Array} props The property names to copy.
- * @param {Object} [object={}] The object to copy properties to.
- * @returns {Object} Returns `object`.
- */
- function baseCopy(source, props, object) {
- object || (object = {});
-
- var index = -1,
- length = props.length;
-
- while (++index < length) {
- var key = props[index];
- object[key] = source[key];
- }
- return object;
- }
-
- module.exports = baseCopy;
-
-
-/***/ },
-/* 47 */
-/***/ function(module, exports, __webpack_require__) {
-
- var bindCallback = __webpack_require__(32),
- isIterateeCall = __webpack_require__(38),
- restParam = __webpack_require__(48);
-
- /**
- * Creates a `_.assign`, `_.defaults`, or `_.merge` function.
- *
- * @private
- * @param {Function} assigner The function to assign values.
- * @returns {Function} Returns the new assigner function.
- */
- function createAssigner(assigner) {
- return restParam(function(object, sources) {
- var index = -1,
- length = object == null ? 0 : sources.length,
- customizer = length > 2 ? sources[length - 2] : undefined,
- guard = length > 2 ? sources[2] : undefined,
- thisArg = length > 1 ? sources[length - 1] : undefined;
-
- if (typeof customizer == 'function') {
- customizer = bindCallback(customizer, thisArg, 5);
- length -= 2;
- } else {
- customizer = typeof thisArg == 'function' ? thisArg : undefined;
- length -= (customizer ? 1 : 0);
- }
- if (guard && isIterateeCall(sources[0], sources[1], guard)) {
- customizer = length < 3 ? undefined : customizer;
- length = 1;
- }
- while (++index < length) {
- var source = sources[index];
- if (source) {
- assigner(object, source, customizer);
- }
- }
- return object;
- });
- }
-
- module.exports = createAssigner;
-
-
-/***/ },
-/* 48 */
-/***/ function(module, exports) {
-
- /** Used as the `TypeError` message for "Functions" methods. */
- var FUNC_ERROR_TEXT = 'Expected a function';
-
- /* Native method references for those with the same name as other `lodash` methods. */
- var nativeMax = Math.max;
-
- /**
- * Creates a function that invokes `func` with the `this` binding of the
- * created function and arguments from `start` and beyond provided as an array.
- *
- * **Note:** This method is based on the [rest parameter](https://developer.mozilla.org/Web/JavaScript/Reference/Functions/rest_parameters).
- *
- * @static
- * @memberOf _
- * @category Function
- * @param {Function} func The function to apply a rest parameter to.
- * @param {number} [start=func.length-1] The start position of the rest parameter.
- * @returns {Function} Returns the new function.
- * @example
- *
- * var say = _.restParam(function(what, names) {
- * return what + ' ' + _.initial(names).join(', ') +
- * (_.size(names) > 1 ? ', & ' : '') + _.last(names);
- * });
- *
- * say('hello', 'fred', 'barney', 'pebbles');
- * // => 'hello fred, barney, & pebbles'
- */
- function restParam(func, start) {
- if (typeof func != 'function') {
- throw new TypeError(FUNC_ERROR_TEXT);
- }
- start = nativeMax(start === undefined ? (func.length - 1) : (+start || 0), 0);
- return function() {
- var args = arguments,
- index = -1,
- length = nativeMax(args.length - start, 0),
- rest = Array(length);
-
- while (++index < length) {
- rest[index] = args[start + index];
- }
- switch (start) {
- case 0: return func.call(this, rest);
- case 1: return func.call(this, args[0], rest);
- case 2: return func.call(this, args[0], args[1], rest);
- }
- var otherArgs = Array(start + 1);
- index = -1;
- while (++index < start) {
- otherArgs[index] = args[index];
- }
- otherArgs[start] = rest;
- return func.apply(this, otherArgs);
- };
- }
-
- module.exports = restParam;
-
-
-/***/ },
-/* 49 */
-/***/ function(module, exports, __webpack_require__) {
-
- var baseToString = __webpack_require__(50);
-
- /** Used to generate unique IDs. */
- var idCounter = 0;
-
- /**
- * Generates a unique ID. If `prefix` is provided the ID is appended to it.
- *
- * @static
- * @memberOf _
- * @category Utility
- * @param {string} [prefix] The value to prefix the ID with.
- * @returns {string} Returns the unique ID.
- * @example
- *
- * _.uniqueId('contact_');
- * // => 'contact_104'
- *
- * _.uniqueId();
- * // => '105'
- */
- function uniqueId(prefix) {
- var id = ++idCounter;
- return baseToString(prefix) + id;
- }
-
- module.exports = uniqueId;
-
-
-/***/ },
-/* 50 */
-/***/ function(module, exports) {
-
- /**
- * Converts `value` to a string if it's not one. An empty string is returned
- * for `null` or `undefined` values.
- *
- * @private
- * @param {*} value The value to process.
- * @returns {string} Returns the string.
- */
- function baseToString(value) {
- return value == null ? '' : (value + '');
- }
-
- module.exports = baseToString;
-
-
-/***/ }
-/******/ ]);
\ No newline at end of file
diff --git a/web/Sortable.js b/web/Sortable.js
deleted file mode 100644
index 7c5b6a9..0000000
--- a/web/Sortable.js
+++ /dev/null
@@ -1,1481 +0,0 @@
-/**!
- * Sortable
- * @author RubaXa
- * @license MIT
- */
-
-(function sortableModule(factory) {
- "use strict";
-
- if (typeof define === "function" && define.amd) {
- define(factory);
- }
- else if (typeof module != "undefined" && typeof module.exports != "undefined") {
- module.exports = factory();
- }
- else {
- /* jshint sub:true */
- window["Sortable"] = factory();
- }
-})(function sortableFactory() {
- "use strict";
-
- if (typeof window == "undefined" || !window.document) {
- return function sortableError() {
- throw new Error("Sortable.js requires a window with a document");
- };
- }
-
- var dragEl,
- parentEl,
- ghostEl,
- cloneEl,
- rootEl,
- nextEl,
- lastDownEl,
-
- scrollEl,
- scrollParentEl,
- scrollCustomFn,
-
- lastEl,
- lastCSS,
- lastParentCSS,
-
- oldIndex,
- newIndex,
-
- activeGroup,
- putSortable,
-
- autoScroll = {},
-
- tapEvt,
- touchEvt,
-
- moved,
-
- /** @const */
- R_SPACE = /\s+/g,
- R_FLOAT = /left|right|inline/,
-
- expando = 'Sortable' + (new Date).getTime(),
-
- win = window,
- document = win.document,
- parseInt = win.parseInt,
-
- $ = win.jQuery || win.Zepto,
- Polymer = win.Polymer,
-
- captureMode = false,
-
- supportDraggable = !!('draggable' in document.createElement('div')),
- supportCssPointerEvents = (function (el) {
- // false when IE11
- if (!!navigator.userAgent.match(/Trident.*rv[ :]?11\./)) {
- return false;
- }
- el = document.createElement('x');
- el.style.cssText = 'pointer-events:auto';
- return el.style.pointerEvents === 'auto';
- })(),
-
- _silent = false,
-
- abs = Math.abs,
- min = Math.min,
-
- savedInputChecked = [],
- touchDragOverListeners = [],
-
- _autoScroll = _throttle(function (/**Event*/evt, /**Object*/options, /**HTMLElement*/rootEl) {
- // Bug: https://bugzilla.mozilla.org/show_bug.cgi?id=505521
- if (rootEl && options.scroll) {
- var _this = rootEl[expando],
- el,
- rect,
- sens = options.scrollSensitivity,
- speed = options.scrollSpeed,
-
- x = evt.clientX,
- y = evt.clientY,
-
- winWidth = window.innerWidth,
- winHeight = window.innerHeight,
-
- vx,
- vy,
-
- scrollOffsetX,
- scrollOffsetY
- ;
-
- // Delect scrollEl
- if (scrollParentEl !== rootEl) {
- scrollEl = options.scroll;
- scrollParentEl = rootEl;
- scrollCustomFn = options.scrollFn;
-
- if (scrollEl === true) {
- scrollEl = rootEl;
-
- do {
- if ((scrollEl.offsetWidth < scrollEl.scrollWidth) ||
- (scrollEl.offsetHeight < scrollEl.scrollHeight)
- ) {
- break;
- }
- /* jshint boss:true */
- } while (scrollEl = scrollEl.parentNode);
- }
- }
-
- if (scrollEl) {
- el = scrollEl;
- rect = scrollEl.getBoundingClientRect();
- vx = (abs(rect.right - x) <= sens) - (abs(rect.left - x) <= sens);
- vy = (abs(rect.bottom - y) <= sens) - (abs(rect.top - y) <= sens);
- }
-
-
- if (!(vx || vy)) {
- vx = (winWidth - x <= sens) - (x <= sens);
- vy = (winHeight - y <= sens) - (y <= sens);
-
- /* jshint expr:true */
- (vx || vy) && (el = win);
- }
-
-
- if (autoScroll.vx !== vx || autoScroll.vy !== vy || autoScroll.el !== el) {
- autoScroll.el = el;
- autoScroll.vx = vx;
- autoScroll.vy = vy;
-
- clearInterval(autoScroll.pid);
-
- if (el) {
- autoScroll.pid = setInterval(function () {
- scrollOffsetY = vy ? vy * speed : 0;
- scrollOffsetX = vx ? vx * speed : 0;
-
- if ('function' === typeof(scrollCustomFn)) {
- return scrollCustomFn.call(_this, scrollOffsetX, scrollOffsetY, evt);
- }
-
- if (el === win) {
- win.scrollTo(win.pageXOffset + scrollOffsetX, win.pageYOffset + scrollOffsetY);
- } else {
- el.scrollTop += scrollOffsetY;
- el.scrollLeft += scrollOffsetX;
- }
- }, 24);
- }
- }
- }
- }, 30),
-
- _prepareGroup = function (options) {
- function toFn(value, pull) {
- if (value === void 0 || value === true) {
- value = group.name;
- }
-
- if (typeof value === 'function') {
- return value;
- } else {
- return function (to, from) {
- var fromGroup = from.options.group.name;
-
- return pull
- ? value
- : value && (value.join
- ? value.indexOf(fromGroup) > -1
- : (fromGroup == value)
- );
- };
- }
- }
-
- var group = {};
- var originalGroup = options.group;
-
- if (!originalGroup || typeof originalGroup != 'object') {
- originalGroup = {name: originalGroup};
- }
-
- group.name = originalGroup.name;
- group.checkPull = toFn(originalGroup.pull, true);
- group.checkPut = toFn(originalGroup.put);
- group.revertClone = originalGroup.revertClone;
-
- options.group = group;
- }
- ;
-
-
- /**
- * @class Sortable
- * @param {HTMLElement} el
- * @param {Object} [options]
- */
- function Sortable(el, options) {
- if (!(el && el.nodeType && el.nodeType === 1)) {
- throw 'Sortable: `el` must be HTMLElement, and not ' + {}.toString.call(el);
- }
-
- this.el = el; // root element
- this.options = options = _extend({}, options);
-
-
- // Export instance
- el[expando] = this;
-
- // Default options
- var defaults = {
- group: Math.random(),
- sort: true,
- disabled: false,
- store: null,
- handle: null,
- scroll: true,
- scrollSensitivity: 30,
- scrollSpeed: 10,
- draggable: /[uo]l/i.test(el.nodeName) ? 'li' : '>*',
- ghostClass: 'sortable-ghost',
- chosenClass: 'sortable-chosen',
- dragClass: 'sortable-drag',
- ignore: 'a, img',
- filter: null,
- preventOnFilter: true,
- animation: 0,
- setData: function (dataTransfer, dragEl) {
- dataTransfer.setData('Text', dragEl.textContent);
- },
- dropBubble: false,
- dragoverBubble: false,
- dataIdAttr: 'data-id',
- delay: 0,
- forceFallback: false,
- fallbackClass: 'sortable-fallback',
- fallbackOnBody: false,
- fallbackTolerance: 0,
- fallbackOffset: {x: 0, y: 0}
- };
-
-
- // Set default options
- for (var name in defaults) {
- !(name in options) && (options[name] = defaults[name]);
- }
-
- _prepareGroup(options);
-
- // Bind all private methods
- for (var fn in this) {
- if (fn.charAt(0) === '_' && typeof this[fn] === 'function') {
- this[fn] = this[fn].bind(this);
- }
- }
-
- // Setup drag mode
- this.nativeDraggable = options.forceFallback ? false : supportDraggable;
-
- // Bind events
- _on(el, 'mousedown', this._onTapStart);
- _on(el, 'touchstart', this._onTapStart);
- _on(el, 'pointerdown', this._onTapStart);
-
- if (this.nativeDraggable) {
- _on(el, 'dragover', this);
- _on(el, 'dragenter', this);
- }
-
- touchDragOverListeners.push(this._onDragOver);
-
- // Restore sorting
- options.store && this.sort(options.store.get(this));
- }
-
-
- Sortable.prototype = /** @lends Sortable.prototype */ {
- constructor: Sortable,
-
- _onTapStart: function (/** Event|TouchEvent */evt) {
- var _this = this,
- el = this.el,
- options = this.options,
- preventOnFilter = options.preventOnFilter,
- type = evt.type,
- touch = evt.touches && evt.touches[0],
- target = (touch || evt).target,
- originalTarget = evt.target.shadowRoot && evt.path[0] || target,
- filter = options.filter,
- startIndex;
-
- _saveInputCheckedState(el);
-
-
- // Don't trigger start event when an element is been dragged, otherwise the evt.oldindex always wrong when set option.group.
- if (dragEl) {
- return;
- }
-
- if (type === 'mousedown' && evt.button !== 0 || options.disabled) {
- return; // only left button or enabled
- }
-
-
- target = _closest(target, options.draggable, el);
-
- if (!target) {
- return;
- }
-
- if (lastDownEl === target) {
- // Ignoring duplicate `down`
- return;
- }
-
- // Get the index of the dragged element within its parent
- startIndex = _index(target, options.draggable);
-
- // Check filter
- if (typeof filter === 'function') {
- if (filter.call(this, evt, target, this)) {
- _dispatchEvent(_this, originalTarget, 'filter', target, el, startIndex);
- preventOnFilter && evt.preventDefault();
- return; // cancel dnd
- }
- }
- else if (filter) {
- filter = filter.split(',').some(function (criteria) {
- criteria = _closest(originalTarget, criteria.trim(), el);
-
- if (criteria) {
- _dispatchEvent(_this, criteria, 'filter', target, el, startIndex);
- return true;
- }
- });
-
- if (filter) {
- preventOnFilter && evt.preventDefault();
- return; // cancel dnd
- }
- }
-
- if (options.handle && !_closest(originalTarget, options.handle, el)) {
- return;
- }
-
- // Prepare `dragstart`
- this._prepareDragStart(evt, touch, target, startIndex);
- },
-
- _prepareDragStart: function (/** Event */evt, /** Touch */touch, /** HTMLElement */target, /** Number */startIndex) {
- var _this = this,
- el = _this.el,
- options = _this.options,
- ownerDocument = el.ownerDocument,
- dragStartFn;
-
- if (target && !dragEl && (target.parentNode === el)) {
- tapEvt = evt;
-
- rootEl = el;
- dragEl = target;
- parentEl = dragEl.parentNode;
- nextEl = dragEl.nextSibling;
- lastDownEl = target;
- activeGroup = options.group;
- oldIndex = startIndex;
-
- this._lastX = (touch || evt).clientX;
- this._lastY = (touch || evt).clientY;
-
- dragEl.style['will-change'] = 'transform';
-
- dragStartFn = function () {
- // Delayed drag has been triggered
- // we can re-enable the events: touchmove/mousemove
- _this._disableDelayedDrag();
-
- // Make the element draggable
- dragEl.draggable = _this.nativeDraggable;
-
- // Chosen item
- _toggleClass(dragEl, options.chosenClass, true);
-
- // Bind the events: dragstart/dragend
- _this._triggerDragStart(evt, touch);
-
- // Drag start event
- _dispatchEvent(_this, rootEl, 'choose', dragEl, rootEl, oldIndex);
- };
-
- // Disable "draggable"
- options.ignore.split(',').forEach(function (criteria) {
- _find(dragEl, criteria.trim(), _disableDraggable);
- });
-
- _on(ownerDocument, 'mouseup', _this._onDrop);
- _on(ownerDocument, 'touchend', _this._onDrop);
- _on(ownerDocument, 'touchcancel', _this._onDrop);
- _on(ownerDocument, 'pointercancel', _this._onDrop);
- _on(ownerDocument, 'selectstart', _this);
-
- if (options.delay) {
- // If the user moves the pointer or let go the click or touch
- // before the delay has been reached:
- // disable the delayed drag
- _on(ownerDocument, 'mouseup', _this._disableDelayedDrag);
- _on(ownerDocument, 'touchend', _this._disableDelayedDrag);
- _on(ownerDocument, 'touchcancel', _this._disableDelayedDrag);
- _on(ownerDocument, 'mousemove', _this._disableDelayedDrag);
- _on(ownerDocument, 'touchmove', _this._disableDelayedDrag);
- _on(ownerDocument, 'pointermove', _this._disableDelayedDrag);
-
- _this._dragStartTimer = setTimeout(dragStartFn, options.delay);
- } else {
- dragStartFn();
- }
-
-
- }
- },
-
- _disableDelayedDrag: function () {
- var ownerDocument = this.el.ownerDocument;
-
- clearTimeout(this._dragStartTimer);
- _off(ownerDocument, 'mouseup', this._disableDelayedDrag);
- _off(ownerDocument, 'touchend', this._disableDelayedDrag);
- _off(ownerDocument, 'touchcancel', this._disableDelayedDrag);
- _off(ownerDocument, 'mousemove', this._disableDelayedDrag);
- _off(ownerDocument, 'touchmove', this._disableDelayedDrag);
- _off(ownerDocument, 'pointermove', this._disableDelayedDrag);
- },
-
- _triggerDragStart: function (/** Event */evt, /** Touch */touch) {
- touch = touch || (evt.pointerType == 'touch' ? evt : null);
-
- if (touch) {
- // Touch device support
- tapEvt = {
- target: dragEl,
- clientX: touch.clientX,
- clientY: touch.clientY
- };
-
- this._onDragStart(tapEvt, 'touch');
- }
- else if (!this.nativeDraggable) {
- this._onDragStart(tapEvt, true);
- }
- else {
- _on(dragEl, 'dragend', this);
- _on(rootEl, 'dragstart', this._onDragStart);
- }
-
- try {
- if (document.selection) {
- // Timeout neccessary for IE9
- setTimeout(function () {
- document.selection.empty();
- });
- } else {
- window.getSelection().removeAllRanges();
- }
- } catch (err) {
- }
- },
-
- _dragStarted: function () {
- if (rootEl && dragEl) {
- var options = this.options;
-
- // Apply effect
- _toggleClass(dragEl, options.ghostClass, true);
- _toggleClass(dragEl, options.dragClass, false);
-
- Sortable.active = this;
-
- // Drag start event
- _dispatchEvent(this, rootEl, 'start', dragEl, rootEl, oldIndex);
- } else {
- this._nulling();
- }
- },
-
- _emulateDragOver: function () {
- if (touchEvt) {
- if (this._lastX === touchEvt.clientX && this._lastY === touchEvt.clientY) {
- return;
- }
-
- this._lastX = touchEvt.clientX;
- this._lastY = touchEvt.clientY;
-
- if (!supportCssPointerEvents) {
- _css(ghostEl, 'display', 'none');
- }
-
- var target = document.elementFromPoint(touchEvt.clientX, touchEvt.clientY),
- parent = target,
- i = touchDragOverListeners.length;
-
- if (parent) {
- do {
- if (parent[expando]) {
- while (i--) {
- touchDragOverListeners[i]({
- clientX: touchEvt.clientX,
- clientY: touchEvt.clientY,
- target: target,
- rootEl: parent
- });
- }
-
- break;
- }
-
- target = parent; // store last element
- }
- /* jshint boss:true */
- while (parent = parent.parentNode);
- }
-
- if (!supportCssPointerEvents) {
- _css(ghostEl, 'display', '');
- }
- }
- },
-
-
- _onTouchMove: function (/**TouchEvent*/evt) {
- if (tapEvt) {
- var options = this.options,
- fallbackTolerance = options.fallbackTolerance,
- fallbackOffset = options.fallbackOffset,
- touch = evt.touches ? evt.touches[0] : evt,
- dx = (touch.clientX - tapEvt.clientX) + fallbackOffset.x,
- dy = (touch.clientY - tapEvt.clientY) + fallbackOffset.y,
- translate3d = evt.touches ? 'translate3d(' + dx + 'px,' + dy + 'px,0)' : 'translate(' + dx + 'px,' + dy + 'px)';
-
- // only set the status to dragging, when we are actually dragging
- if (!Sortable.active) {
- if (fallbackTolerance &&
- min(abs(touch.clientX - this._lastX), abs(touch.clientY - this._lastY)) < fallbackTolerance
- ) {
- return;
- }
-
- this._dragStarted();
- }
-
- // as well as creating the ghost element on the document body
- this._appendGhost();
-
- moved = true;
- touchEvt = touch;
-
- _css(ghostEl, 'webkitTransform', translate3d);
- _css(ghostEl, 'mozTransform', translate3d);
- _css(ghostEl, 'msTransform', translate3d);
- _css(ghostEl, 'transform', translate3d);
-
- evt.preventDefault();
- }
- },
-
- _appendGhost: function () {
- if (!ghostEl) {
- var rect = dragEl.getBoundingClientRect(),
- css = _css(dragEl),
- options = this.options,
- ghostRect;
-
- ghostEl = dragEl.cloneNode(true);
-
- _toggleClass(ghostEl, options.ghostClass, false);
- _toggleClass(ghostEl, options.fallbackClass, true);
- _toggleClass(ghostEl, options.dragClass, true);
-
- _css(ghostEl, 'top', rect.top - parseInt(css.marginTop, 10));
- _css(ghostEl, 'left', rect.left - parseInt(css.marginLeft, 10));
- _css(ghostEl, 'width', rect.width);
- _css(ghostEl, 'height', rect.height);
- _css(ghostEl, 'opacity', '0.8');
- _css(ghostEl, 'position', 'fixed');
- _css(ghostEl, 'zIndex', '100000');
- _css(ghostEl, 'pointerEvents', 'none');
-
- options.fallbackOnBody && document.body.appendChild(ghostEl) || rootEl.appendChild(ghostEl);
-
- // Fixing dimensions.
- ghostRect = ghostEl.getBoundingClientRect();
- _css(ghostEl, 'width', rect.width * 2 - ghostRect.width);
- _css(ghostEl, 'height', rect.height * 2 - ghostRect.height);
- }
- },
-
- _onDragStart: function (/**Event*/evt, /**boolean*/useFallback) {
- var dataTransfer = evt.dataTransfer,
- options = this.options;
-
- this._offUpEvents();
-
- if (activeGroup.checkPull(this, this, dragEl, evt)) {
- cloneEl = _clone(dragEl);
-
- cloneEl.draggable = false;
- cloneEl.style['will-change'] = '';
-
- _css(cloneEl, 'display', 'none');
- _toggleClass(cloneEl, this.options.chosenClass, false);
-
- rootEl.insertBefore(cloneEl, dragEl);
- _dispatchEvent(this, rootEl, 'clone', dragEl);
- }
-
- _toggleClass(dragEl, options.dragClass, true);
-
- if (useFallback) {
- if (useFallback === 'touch') {
- // Bind touch events
- _on(document, 'touchmove', this._onTouchMove);
- _on(document, 'touchend', this._onDrop);
- _on(document, 'touchcancel', this._onDrop);
- _on(document, 'pointermove', this._onTouchMove);
- _on(document, 'pointerup', this._onDrop);
- } else {
- // Old brwoser
- _on(document, 'mousemove', this._onTouchMove);
- _on(document, 'mouseup', this._onDrop);
- }
-
- this._loopId = setInterval(this._emulateDragOver, 50);
- }
- else {
- if (dataTransfer) {
- dataTransfer.effectAllowed = 'move';
- options.setData && options.setData.call(this, dataTransfer, dragEl);
- }
-
- _on(document, 'drop', this);
- setTimeout(this._dragStarted, 0);
- }
- },
-
- _onDragOver: function (/**Event*/evt) {
- var el = this.el,
- target,
- dragRect,
- targetRect,
- revert,
- options = this.options,
- group = options.group,
- activeSortable = Sortable.active,
- isOwner = (activeGroup === group),
- isMovingBetweenSortable = false,
- canSort = options.sort;
-
- if (evt.preventDefault !== void 0) {
- evt.preventDefault();
- !options.dragoverBubble && evt.stopPropagation();
- }
-
- if (dragEl.animated) {
- return;
- }
-
- moved = true;
-
- if (activeSortable && !options.disabled &&
- (isOwner
- ? canSort || (revert = !rootEl.contains(dragEl)) // Reverting item into the original list
- : (
- putSortable === this ||
- (
- (activeSortable.lastPullMode = activeGroup.checkPull(this, activeSortable, dragEl, evt)) &&
- group.checkPut(this, activeSortable, dragEl, evt)
- )
- )
- ) &&
- (evt.rootEl === void 0 || evt.rootEl === this.el) // touch fallback
- ) {
- // Smart auto-scrolling
- _autoScroll(evt, options, this.el);
-
- if (_silent) {
- return;
- }
-
- target = _closest(evt.target, options.draggable, el);
- dragRect = dragEl.getBoundingClientRect();
-
- if (putSortable !== this) {
- putSortable = this;
- isMovingBetweenSortable = true;
- }
-
- if (revert) {
- _cloneHide(activeSortable, true);
- parentEl = rootEl; // actualization
-
- if (cloneEl || nextEl) {
- rootEl.insertBefore(dragEl, cloneEl || nextEl);
- }
- else if (!canSort) {
- rootEl.appendChild(dragEl);
- }
-
- return;
- }
-
-
- if ((el.children.length === 0) || (el.children[0] === ghostEl) ||
- (el === evt.target) && (target = _ghostIsLast(el, evt))
- ) {
- if (target) {
- if (target.animated) {
- return;
- }
-
- targetRect = target.getBoundingClientRect();
- }
-
- _cloneHide(activeSortable, isOwner);
-
- if (_onMove(rootEl, el, dragEl, dragRect, target, targetRect, evt) !== false) {
- if (!dragEl.contains(el)) {
- el.appendChild(dragEl);
- parentEl = el; // actualization
- }
-
- this._animate(dragRect, dragEl);
- target && this._animate(targetRect, target);
- }
- }
- else if (target && !target.animated && target !== dragEl && (target.parentNode[expando] !== void 0)) {
- if (lastEl !== target) {
- lastEl = target;
- lastCSS = _css(target);
- lastParentCSS = _css(target.parentNode);
- }
-
- targetRect = target.getBoundingClientRect();
-
- var width = targetRect.right - targetRect.left,
- height = targetRect.bottom - targetRect.top,
- floating = R_FLOAT.test(lastCSS.cssFloat + lastCSS.display)
- || (lastParentCSS.display == 'flex' && lastParentCSS['flex-direction'].indexOf('row') === 0),
- isWide = (target.offsetWidth > dragEl.offsetWidth),
- isLong = (target.offsetHeight > dragEl.offsetHeight),
- halfway = (floating ? (evt.clientX - targetRect.left) / width : (evt.clientY - targetRect.top) / height) > 0.5,
- nextSibling = target.nextElementSibling,
- moveVector = _onMove(rootEl, el, dragEl, dragRect, target, targetRect, evt),
- after = false
- ;
-
- if (moveVector !== false) {
- _silent = true;
- setTimeout(_unsilent, 30);
-
- _cloneHide(activeSortable, isOwner);
-
- if (moveVector === 1 || moveVector === -1) {
- after = (moveVector === 1);
- }
- else if (floating) {
- var elTop = dragEl.offsetTop,
- tgTop = target.offsetTop;
-
- if (elTop === tgTop) {
- after = (target.previousElementSibling === dragEl) && !isWide || halfway && isWide;
- }
- else if (target.previousElementSibling === dragEl || dragEl.previousElementSibling === target) {
- after = (evt.clientY - targetRect.top) / height > 0.5;
- } else {
- after = tgTop > elTop;
- }
- } else if (!isMovingBetweenSortable) {
- after = (nextSibling !== dragEl) && !isLong || halfway && isLong;
- }
-
- if (!dragEl.contains(el)) {
- if (after && !nextSibling) {
- el.appendChild(dragEl);
- } else {
- target.parentNode.insertBefore(dragEl, after ? nextSibling : target);
- }
- }
-
- parentEl = dragEl.parentNode; // actualization
-
- this._animate(dragRect, dragEl);
- this._animate(targetRect, target);
- }
- }
- }
- },
-
- _animate: function (prevRect, target) {
- var ms = this.options.animation;
-
- if (ms) {
- var currentRect = target.getBoundingClientRect();
-
- if (prevRect.nodeType === 1) {
- prevRect = prevRect.getBoundingClientRect();
- }
-
- _css(target, 'transition', 'none');
- _css(target, 'transform', 'translate3d('
- + (prevRect.left - currentRect.left) + 'px,'
- + (prevRect.top - currentRect.top) + 'px,0)'
- );
-
- target.offsetWidth; // repaint
-
- _css(target, 'transition', 'all ' + ms + 'ms');
- _css(target, 'transform', 'translate3d(0,0,0)');
-
- clearTimeout(target.animated);
- target.animated = setTimeout(function () {
- _css(target, 'transition', '');
- _css(target, 'transform', '');
- target.animated = false;
- }, ms);
- }
- },
-
- _offUpEvents: function () {
- var ownerDocument = this.el.ownerDocument;
-
- _off(document, 'touchmove', this._onTouchMove);
- _off(document, 'pointermove', this._onTouchMove);
- _off(ownerDocument, 'mouseup', this._onDrop);
- _off(ownerDocument, 'touchend', this._onDrop);
- _off(ownerDocument, 'pointerup', this._onDrop);
- _off(ownerDocument, 'touchcancel', this._onDrop);
- _off(ownerDocument, 'selectstart', this);
- },
-
- _onDrop: function (/**Event*/evt) {
- var el = this.el,
- options = this.options;
-
- clearInterval(this._loopId);
- clearInterval(autoScroll.pid);
- clearTimeout(this._dragStartTimer);
-
- // Unbind events
- _off(document, 'mousemove', this._onTouchMove);
-
- if (this.nativeDraggable) {
- _off(document, 'drop', this);
- _off(el, 'dragstart', this._onDragStart);
- }
-
- this._offUpEvents();
-
- if (evt) {
- if (moved) {
- evt.preventDefault();
- !options.dropBubble && evt.stopPropagation();
- }
-
- ghostEl && ghostEl.parentNode.removeChild(ghostEl);
-
- if (rootEl === parentEl || Sortable.active.lastPullMode !== 'clone') {
- // Remove clone
- cloneEl && cloneEl.parentNode.removeChild(cloneEl);
- }
-
- if (dragEl) {
- if (this.nativeDraggable) {
- _off(dragEl, 'dragend', this);
- }
-
- _disableDraggable(dragEl);
- dragEl.style['will-change'] = '';
-
- // Remove class's
- _toggleClass(dragEl, this.options.ghostClass, false);
- _toggleClass(dragEl, this.options.chosenClass, false);
-
- if (rootEl !== parentEl) {
- newIndex = _index(dragEl, options.draggable);
-
- if (newIndex >= 0) {
- // Add event
- _dispatchEvent(null, parentEl, 'add', dragEl, rootEl, oldIndex, newIndex);
-
- // Remove event
- _dispatchEvent(this, rootEl, 'remove', dragEl, rootEl, oldIndex, newIndex);
-
- // drag from one list and drop into another
- _dispatchEvent(null, parentEl, 'sort', dragEl, rootEl, oldIndex, newIndex);
- _dispatchEvent(this, rootEl, 'sort', dragEl, rootEl, oldIndex, newIndex);
- }
- }
- else {
- if (dragEl.nextSibling !== nextEl) {
- // Get the index of the dragged element within its parent
- newIndex = _index(dragEl, options.draggable);
-
- if (newIndex >= 0) {
- // drag & drop within the same list
- _dispatchEvent(this, rootEl, 'update', dragEl, rootEl, oldIndex, newIndex);
- _dispatchEvent(this, rootEl, 'sort', dragEl, rootEl, oldIndex, newIndex);
- }
- }
- }
-
- if (Sortable.active) {
- /* jshint eqnull:true */
- if (newIndex == null || newIndex === -1) {
- newIndex = oldIndex;
- }
-
- _dispatchEvent(this, rootEl, 'end', dragEl, rootEl, oldIndex, newIndex);
-
- // Save sorting
- this.save();
- }
- }
-
- }
-
- this._nulling();
- },
-
- _nulling: function() {
- rootEl =
- dragEl =
- parentEl =
- ghostEl =
- nextEl =
- cloneEl =
- lastDownEl =
-
- scrollEl =
- scrollParentEl =
-
- tapEvt =
- touchEvt =
-
- moved =
- newIndex =
-
- lastEl =
- lastCSS =
-
- putSortable =
- activeGroup =
- Sortable.active = null;
-
- savedInputChecked.forEach(function (el) {
- el.checked = true;
- });
- savedInputChecked.length = 0;
- },
-
- handleEvent: function (/**Event*/evt) {
- switch (evt.type) {
- case 'drop':
- case 'dragend':
- this._onDrop(evt);
- break;
-
- case 'dragover':
- case 'dragenter':
- if (dragEl) {
- this._onDragOver(evt);
- _globalDragOver(evt);
- }
- break;
-
- case 'selectstart':
- evt.preventDefault();
- break;
- }
- },
-
-
- /**
- * Serializes the item into an array of string.
- * @returns {String[]}
- */
- toArray: function () {
- var order = [],
- el,
- children = this.el.children,
- i = 0,
- n = children.length,
- options = this.options;
-
- for (; i < n; i++) {
- el = children[i];
- if (_closest(el, options.draggable, this.el)) {
- order.push(el.getAttribute(options.dataIdAttr) || _generateId(el));
- }
- }
-
- return order;
- },
-
-
- /**
- * Sorts the elements according to the array.
- * @param {String[]} order order of the items
- */
- sort: function (order) {
- var items = {}, rootEl = this.el;
-
- this.toArray().forEach(function (id, i) {
- var el = rootEl.children[i];
-
- if (_closest(el, this.options.draggable, rootEl)) {
- items[id] = el;
- }
- }, this);
-
- order.forEach(function (id) {
- if (items[id]) {
- rootEl.removeChild(items[id]);
- rootEl.appendChild(items[id]);
- }
- });
- },
-
-
- /**
- * Save the current sorting
- */
- save: function () {
- var store = this.options.store;
- store && store.set(this);
- },
-
-
- /**
- * For each element in the set, get the first element that matches the selector by testing the element itself and traversing up through its ancestors in the DOM tree.
- * @param {HTMLElement} el
- * @param {String} [selector] default: `options.draggable`
- * @returns {HTMLElement|null}
- */
- closest: function (el, selector) {
- return _closest(el, selector || this.options.draggable, this.el);
- },
-
-
- /**
- * Set/get option
- * @param {string} name
- * @param {*} [value]
- * @returns {*}
- */
- option: function (name, value) {
- var options = this.options;
-
- if (value === void 0) {
- return options[name];
- } else {
- options[name] = value;
-
- if (name === 'group') {
- _prepareGroup(options);
- }
- }
- },
-
-
- /**
- * Destroy
- */
- destroy: function () {
- var el = this.el;
-
- el[expando] = null;
-
- _off(el, 'mousedown', this._onTapStart);
- _off(el, 'touchstart', this._onTapStart);
- _off(el, 'pointerdown', this._onTapStart);
-
- if (this.nativeDraggable) {
- _off(el, 'dragover', this);
- _off(el, 'dragenter', this);
- }
-
- // Remove draggable attributes
- Array.prototype.forEach.call(el.querySelectorAll('[draggable]'), function (el) {
- el.removeAttribute('draggable');
- });
-
- touchDragOverListeners.splice(touchDragOverListeners.indexOf(this._onDragOver), 1);
-
- this._onDrop();
-
- this.el = el = null;
- }
- };
-
-
- function _cloneHide(sortable, state) {
- if (sortable.lastPullMode !== 'clone') {
- state = true;
- }
-
- if (cloneEl && (cloneEl.state !== state)) {
- _css(cloneEl, 'display', state ? 'none' : '');
-
- if (!state) {
- if (cloneEl.state) {
- if (sortable.options.group.revertClone) {
- rootEl.insertBefore(cloneEl, nextEl);
- sortable._animate(dragEl, cloneEl);
- } else {
- rootEl.insertBefore(cloneEl, dragEl);
- }
- }
- }
-
- cloneEl.state = state;
- }
- }
-
-
- function _closest(/**HTMLElement*/el, /**String*/selector, /**HTMLElement*/ctx) {
- if (el) {
- ctx = ctx || document;
-
- do {
- if ((selector === '>*' && el.parentNode === ctx) || _matches(el, selector)) {
- return el;
- }
- /* jshint boss:true */
- } while (el = _getParentOrHost(el));
- }
-
- return null;
- }
-
-
- function _getParentOrHost(el) {
- var parent = el.host;
-
- return (parent && parent.nodeType) ? parent : el.parentNode;
- }
-
-
- function _globalDragOver(/**Event*/evt) {
- if (evt.dataTransfer) {
- evt.dataTransfer.dropEffect = 'move';
- }
- evt.preventDefault();
- }
-
-
- function _on(el, event, fn) {
- el.addEventListener(event, fn, captureMode);
- }
-
-
- function _off(el, event, fn) {
- el.removeEventListener(event, fn, captureMode);
- }
-
-
- function _toggleClass(el, name, state) {
- if (el) {
- if (el.classList) {
- el.classList[state ? 'add' : 'remove'](name);
- }
- else {
- var className = (' ' + el.className + ' ').replace(R_SPACE, ' ').replace(' ' + name + ' ', ' ');
- el.className = (className + (state ? ' ' + name : '')).replace(R_SPACE, ' ');
- }
- }
- }
-
-
- function _css(el, prop, val) {
- var style = el && el.style;
-
- if (style) {
- if (val === void 0) {
- if (document.defaultView && document.defaultView.getComputedStyle) {
- val = document.defaultView.getComputedStyle(el, '');
- }
- else if (el.currentStyle) {
- val = el.currentStyle;
- }
-
- return prop === void 0 ? val : val[prop];
- }
- else {
- if (!(prop in style)) {
- prop = '-webkit-' + prop;
- }
-
- style[prop] = val + (typeof val === 'string' ? '' : 'px');
- }
- }
- }
-
-
- function _find(ctx, tagName, iterator) {
- if (ctx) {
- var list = ctx.getElementsByTagName(tagName), i = 0, n = list.length;
-
- if (iterator) {
- for (; i < n; i++) {
- iterator(list[i], i);
- }
- }
-
- return list;
- }
-
- return [];
- }
-
-
-
- function _dispatchEvent(sortable, rootEl, name, targetEl, fromEl, startIndex, newIndex) {
- sortable = (sortable || rootEl[expando]);
-
- var evt = document.createEvent('Event'),
- options = sortable.options,
- onName = 'on' + name.charAt(0).toUpperCase() + name.substr(1);
-
- evt.initEvent(name, true, true);
-
- evt.to = rootEl;
- evt.from = fromEl || rootEl;
- evt.item = targetEl || rootEl;
- evt.clone = cloneEl;
-
- evt.oldIndex = startIndex;
- evt.newIndex = newIndex;
-
- rootEl.dispatchEvent(evt);
-
- if (options[onName]) {
- options[onName].call(sortable, evt);
- }
- }
-
-
- function _onMove(fromEl, toEl, dragEl, dragRect, targetEl, targetRect, originalEvt) {
- var evt,
- sortable = fromEl[expando],
- onMoveFn = sortable.options.onMove,
- retVal;
-
- evt = document.createEvent('Event');
- evt.initEvent('move', true, true);
-
- evt.to = toEl;
- evt.from = fromEl;
- evt.dragged = dragEl;
- evt.draggedRect = dragRect;
- evt.related = targetEl || toEl;
- evt.relatedRect = targetRect || toEl.getBoundingClientRect();
-
- fromEl.dispatchEvent(evt);
-
- if (onMoveFn) {
- retVal = onMoveFn.call(sortable, evt, originalEvt);
- }
-
- return retVal;
- }
-
-
- function _disableDraggable(el) {
- el.draggable = false;
- }
-
-
- function _unsilent() {
- _silent = false;
- }
-
-
- /** @returns {HTMLElement|false} */
- function _ghostIsLast(el, evt) {
- var lastEl = el.lastElementChild,
- rect = lastEl.getBoundingClientRect();
-
- // 5 — min delta
- // abs — нельзя добавлять, а то глюки при наведении сверху
- return (
- (evt.clientY - (rect.top + rect.height) > 5) ||
- (evt.clientX - (rect.right + rect.width) > 5)
- ) && lastEl;
- }
-
-
- /**
- * Generate id
- * @param {HTMLElement} el
- * @returns {String}
- * @private
- */
- function _generateId(el) {
- var str = el.tagName + el.className + el.src + el.href + el.textContent,
- i = str.length,
- sum = 0;
-
- while (i--) {
- sum += str.charCodeAt(i);
- }
-
- return sum.toString(36);
- }
-
- /**
- * Returns the index of an element within its parent for a selected set of
- * elements
- * @param {HTMLElement} el
- * @param {selector} selector
- * @return {number}
- */
- function _index(el, selector) {
- var index = 0;
-
- if (!el || !el.parentNode) {
- return -1;
- }
-
- while (el && (el = el.previousElementSibling)) {
- if ((el.nodeName.toUpperCase() !== 'TEMPLATE') && (selector === '>*' || _matches(el, selector))) {
- index++;
- }
- }
-
- return index;
- }
-
- function _matches(/**HTMLElement*/el, /**String*/selector) {
- if (el) {
- selector = selector.split('.');
-
- var tag = selector.shift().toUpperCase(),
- re = new RegExp('\\s(' + selector.join('|') + ')(?=\\s)', 'g');
-
- return (
- (tag === '' || el.nodeName.toUpperCase() == tag) &&
- (!selector.length || ((' ' + el.className + ' ').match(re) || []).length == selector.length)
- );
- }
-
- return false;
- }
-
- function _throttle(callback, ms) {
- var args, _this;
-
- return function () {
- if (args === void 0) {
- args = arguments;
- _this = this;
-
- setTimeout(function () {
- if (args.length === 1) {
- callback.call(_this, args[0]);
- } else {
- callback.apply(_this, args);
- }
-
- args = void 0;
- }, ms);
- }
- };
- }
-
- function _extend(dst, src) {
- if (dst && src) {
- for (var key in src) {
- if (src.hasOwnProperty(key)) {
- dst[key] = src[key];
- }
- }
- }
-
- return dst;
- }
-
- function _clone(el) {
- return $
- ? $(el).clone(true)[0]
- : (Polymer && Polymer.dom
- ? Polymer.dom(el).cloneNode(true)
- : el.cloneNode(true)
- );
- }
-
- function _saveInputCheckedState(root) {
- var inputs = root.getElementsByTagName('input');
- var idx = inputs.length;
-
- while (idx--) {
- var el = inputs[idx];
- el.checked && savedInputChecked.push(el);
- }
- }
-
- // Fixed #973:
- _on(document, 'touchmove', function (evt) {
- if (Sortable.active) {
- evt.preventDefault();
- }
- });
-
- try {
- window.addEventListener('test', null, Object.defineProperty({}, 'passive', {
- get: function () {
- captureMode = {
- capture: false,
- passive: false
- };
- }
- }));
- } catch (err) {}
-
- // Export utils
- Sortable.utils = {
- on: _on,
- off: _off,
- css: _css,
- find: _find,
- is: function (el, selector) {
- return !!_closest(el, selector, el);
- },
- extend: _extend,
- throttle: _throttle,
- closest: _closest,
- toggleClass: _toggleClass,
- clone: _clone,
- index: _index
- };
-
-
- /**
- * Create sortable instance
- * @param {HTMLElement} el
- * @param {Object} [options]
- */
- Sortable.create = function (el, options) {
- return new Sortable(el, options);
- };
-
-
- // Export
- Sortable.version = '1.5.1';
- return Sortable;
-});
diff --git a/web/bootstrap-dialog.css b/web/bootstrap-dialog.css
deleted file mode 100644
index 40cf2b2..0000000
--- a/web/bootstrap-dialog.css
+++ /dev/null
@@ -1,111 +0,0 @@
-.bootstrap-dialog {
- /* dialog types */
- /**
- * Icon animation
- * Copied from font-awesome: http://fontawesome.io/
- **/
- /** End of icon animation **/
-}
-.bootstrap-dialog .modal-header {
- border-top-left-radius: 4px;
- border-top-right-radius: 4px;
-}
-.bootstrap-dialog .bootstrap-dialog-title {
- color: #fff;
- display: inline-block;
- font-size: 16px;
-}
-.bootstrap-dialog .bootstrap-dialog-message {
- font-size: 14px;
-}
-.bootstrap-dialog .bootstrap-dialog-button-icon {
- margin-right: 3px;
-}
-.bootstrap-dialog .bootstrap-dialog-close-button {
- font-size: 20px;
- float: right;
- opacity: 0.9;
- filter: alpha(opacity=90);
-}
-.bootstrap-dialog .bootstrap-dialog-close-button:hover {
- cursor: pointer;
- opacity: 1;
- filter: alpha(opacity=100);
-}
-.bootstrap-dialog.type-default .modal-header {
- background-color: #ffffff;
-}
-.bootstrap-dialog.type-default .bootstrap-dialog-title {
- color: #333;
-}
-.bootstrap-dialog.type-info .modal-header {
- background-color: #5bc0de;
-}
-.bootstrap-dialog.type-primary .modal-header {
- background-color: #337ab7;
-}
-.bootstrap-dialog.type-success .modal-header {
- background-color: #5cb85c;
-}
-.bootstrap-dialog.type-warning .modal-header {
- background-color: #f0ad4e;
-}
-.bootstrap-dialog.type-danger .modal-header {
- background-color: #d9534f;
-}
-.bootstrap-dialog.size-large .bootstrap-dialog-title {
- font-size: 24px;
-}
-.bootstrap-dialog.size-large .bootstrap-dialog-close-button {
- font-size: 30px;
-}
-.bootstrap-dialog.size-large .bootstrap-dialog-message {
- font-size: 18px;
-}
-.bootstrap-dialog .icon-spin {
- display: inline-block;
- -moz-animation: spin 2s infinite linear;
- -o-animation: spin 2s infinite linear;
- -webkit-animation: spin 2s infinite linear;
- animation: spin 2s infinite linear;
-}
-@-moz-keyframes spin {
- 0% {
- -moz-transform: rotate(0deg);
- }
- 100% {
- -moz-transform: rotate(359deg);
- }
-}
-@-webkit-keyframes spin {
- 0% {
- -webkit-transform: rotate(0deg);
- }
- 100% {
- -webkit-transform: rotate(359deg);
- }
-}
-@-o-keyframes spin {
- 0% {
- -o-transform: rotate(0deg);
- }
- 100% {
- -o-transform: rotate(359deg);
- }
-}
-@-ms-keyframes spin {
- 0% {
- -ms-transform: rotate(0deg);
- }
- 100% {
- -ms-transform: rotate(359deg);
- }
-}
-@keyframes spin {
- 0% {
- transform: rotate(0deg);
- }
- 100% {
- transform: rotate(359deg);
- }
-}
diff --git a/web/bootstrap-dialog.js b/web/bootstrap-dialog.js
deleted file mode 100644
index 816818a..0000000
--- a/web/bootstrap-dialog.js
+++ /dev/null
@@ -1,1391 +0,0 @@
-/* global define */
-
-/* ================================================
- * Make use of Bootstrap's modal more monkey-friendly.
- *
- * For Bootstrap 3.
- *
- * javanoob@hotmail.com
- *
- * https://github.com/nakupanda/bootstrap3-dialog
- *
- * Licensed under The MIT License.
- * ================================================ */
-(function (root, factory) {
-
- "use strict";
-
- // CommonJS module is defined
- if (typeof module !== 'undefined' && module.exports) {
- module.exports = factory(require('jquery'), require('bootstrap'));
- }
- // AMD module is defined
- else if (typeof define === "function" && define.amd) {
- define("bootstrap-dialog", ["jquery", "bootstrap"], function ($) {
- return factory($);
- });
- } else {
- // planted over the root!
- root.BootstrapDialog = factory(root.jQuery);
- }
-
-}(this, function ($) {
-
- "use strict";
-
- /* ================================================
- * Definition of BootstrapDialogModal.
- * Extend Bootstrap Modal and override some functions.
- * BootstrapDialogModal === Modified Modal.
- * ================================================ */
- var Modal = $.fn.modal.Constructor;
- var BootstrapDialogModal = function (element, options) {
- Modal.call(this, element, options);
- };
- BootstrapDialogModal.getModalVersion = function () {
- var version = null;
- if (typeof $.fn.modal.Constructor.VERSION === 'undefined') {
- version = 'v3.1';
- } else if (/3\.2\.\d+/.test($.fn.modal.Constructor.VERSION)) {
- version = 'v3.2';
- } else if (/3\.3\.[1,2]/.test($.fn.modal.Constructor.VERSION)) {
- version = 'v3.3'; // v3.3.1, v3.3.2
- } else {
- version = 'v3.3.4';
- }
-
- return version;
- };
- BootstrapDialogModal.ORIGINAL_BODY_PADDING = parseInt(($('body').css('padding-right') || 0), 10);
- BootstrapDialogModal.METHODS_TO_OVERRIDE = {};
- BootstrapDialogModal.METHODS_TO_OVERRIDE['v3.1'] = {};
- BootstrapDialogModal.METHODS_TO_OVERRIDE['v3.2'] = {
- hide: function (e) {
- if (e) {
- e.preventDefault();
- }
- e = $.Event('hide.bs.modal');
-
- this.$element.trigger(e);
-
- if (!this.isShown || e.isDefaultPrevented()) {
- return;
- }
-
- this.isShown = false;
-
- // Remove css class 'modal-open' when the last opened dialog is closing.
- var openedDialogs = this.getGlobalOpenedDialogs();
- if (openedDialogs.length === 0) {
- this.$body.removeClass('modal-open');
- }
-
- this.resetScrollbar();
- this.escape();
-
- $(document).off('focusin.bs.modal');
-
- this.$element
- .removeClass('in')
- .attr('aria-hidden', true)
- .off('click.dismiss.bs.modal');
-
- $.support.transition && this.$element.hasClass('fade') ?
- this.$element
- .one('bsTransitionEnd', $.proxy(this.hideModal, this))
- .emulateTransitionEnd(300) :
- this.hideModal();
- }
- };
- BootstrapDialogModal.METHODS_TO_OVERRIDE['v3.3'] = {
- /**
- * Overrided.
- *
- * @returns {undefined}
- */
- setScrollbar: function () {
- var bodyPad = BootstrapDialogModal.ORIGINAL_BODY_PADDING;
- if (this.bodyIsOverflowing) {
- this.$body.css('padding-right', bodyPad + this.scrollbarWidth);
- }
- },
- /**
- * Overrided.
- *
- * @returns {undefined}
- */
- resetScrollbar: function () {
- var openedDialogs = this.getGlobalOpenedDialogs();
- if (openedDialogs.length === 0) {
- this.$body.css('padding-right', BootstrapDialogModal.ORIGINAL_BODY_PADDING);
- }
- },
- /**
- * Overrided.
- *
- * @returns {undefined}
- */
- hideModal: function () {
- this.$element.hide();
- this.backdrop($.proxy(function () {
- var openedDialogs = this.getGlobalOpenedDialogs();
- if (openedDialogs.length === 0) {
- this.$body.removeClass('modal-open');
- }
- this.resetAdjustments();
- this.resetScrollbar();
- this.$element.trigger('hidden.bs.modal');
- }, this));
- }
- };
- BootstrapDialogModal.METHODS_TO_OVERRIDE['v3.3.4'] = $.extend({}, BootstrapDialogModal.METHODS_TO_OVERRIDE['v3.3']);
- BootstrapDialogModal.prototype = {
- constructor: BootstrapDialogModal,
- /**
- * New function, to get the dialogs that opened by BootstrapDialog.
- *
- * @returns {undefined}
- */
- getGlobalOpenedDialogs: function () {
- var openedDialogs = [];
- $.each(BootstrapDialog.dialogs, function (id, dialogInstance) {
- if (dialogInstance.isRealized() && dialogInstance.isOpened()) {
- openedDialogs.push(dialogInstance);
- }
- });
-
- return openedDialogs;
- }
- };
-
- // Add compatible methods.
- BootstrapDialogModal.prototype = $.extend(BootstrapDialogModal.prototype, Modal.prototype, BootstrapDialogModal.METHODS_TO_OVERRIDE[BootstrapDialogModal.getModalVersion()]);
-
- /* ================================================
- * Definition of BootstrapDialog.
- * ================================================ */
- var BootstrapDialog = function (options) {
- this.defaultOptions = $.extend(true, {
- id: BootstrapDialog.newGuid(),
- buttons: [],
- data: {},
- onshow: null,
- onshown: null,
- onhide: null,
- onhidden: null
- }, BootstrapDialog.defaultOptions);
- this.indexedButtons = {};
- this.registeredButtonHotkeys = {};
- this.draggableData = {
- isMouseDown: false,
- mouseOffset: {}
- };
- this.realized = false;
- this.opened = false;
- this.initOptions(options);
- this.holdThisInstance();
- };
-
- BootstrapDialog.BootstrapDialogModal = BootstrapDialogModal;
-
- /**
- * Some constants.
- */
- BootstrapDialog.NAMESPACE = 'bootstrap-dialog';
- BootstrapDialog.TYPE_DEFAULT = 'type-default';
- BootstrapDialog.TYPE_INFO = 'type-info';
- BootstrapDialog.TYPE_PRIMARY = 'type-primary';
- BootstrapDialog.TYPE_SUCCESS = 'type-success';
- BootstrapDialog.TYPE_WARNING = 'type-warning';
- BootstrapDialog.TYPE_DANGER = 'type-danger';
- BootstrapDialog.DEFAULT_TEXTS = {};
- BootstrapDialog.DEFAULT_TEXTS[BootstrapDialog.TYPE_DEFAULT] = 'Information';
- BootstrapDialog.DEFAULT_TEXTS[BootstrapDialog.TYPE_INFO] = 'Information';
- BootstrapDialog.DEFAULT_TEXTS[BootstrapDialog.TYPE_PRIMARY] = 'Information';
- BootstrapDialog.DEFAULT_TEXTS[BootstrapDialog.TYPE_SUCCESS] = 'Success';
- BootstrapDialog.DEFAULT_TEXTS[BootstrapDialog.TYPE_WARNING] = 'Warning';
- BootstrapDialog.DEFAULT_TEXTS[BootstrapDialog.TYPE_DANGER] = 'Danger';
- BootstrapDialog.DEFAULT_TEXTS['OK'] = 'OK';
- BootstrapDialog.DEFAULT_TEXTS['CANCEL'] = 'Cancel';
- BootstrapDialog.DEFAULT_TEXTS['CONFIRM'] = 'Confirmation';
- BootstrapDialog.SIZE_NORMAL = 'size-normal';
- BootstrapDialog.SIZE_SMALL = 'size-small';
- BootstrapDialog.SIZE_WIDE = 'size-wide'; // size-wide is equal to modal-lg
- BootstrapDialog.SIZE_LARGE = 'size-large';
- BootstrapDialog.BUTTON_SIZES = {};
- BootstrapDialog.BUTTON_SIZES[BootstrapDialog.SIZE_NORMAL] = '';
- BootstrapDialog.BUTTON_SIZES[BootstrapDialog.SIZE_SMALL] = '';
- BootstrapDialog.BUTTON_SIZES[BootstrapDialog.SIZE_WIDE] = '';
- BootstrapDialog.BUTTON_SIZES[BootstrapDialog.SIZE_LARGE] = 'btn-lg';
- BootstrapDialog.ICON_SPINNER = 'glyphicon glyphicon-asterisk';
- BootstrapDialog.BUTTONS_ORDER_CANCEL_OK = 'btns-order-cancel-ok';
- BootstrapDialog.BUTTONS_ORDER_OK_CANCEL = 'btns-order-ok-cancel';
-
- /**
- * Default options.
- */
- BootstrapDialog.defaultOptions = {
- type: BootstrapDialog.TYPE_PRIMARY,
- size: BootstrapDialog.SIZE_NORMAL,
- cssClass: '',
- title: null,
- message: null,
- nl2br: true,
- closable: true,
- closeByBackdrop: true,
- closeByKeyboard: true,
- closeIcon: '×',
- spinicon: BootstrapDialog.ICON_SPINNER,
- autodestroy: true,
- draggable: false,
- animate: true,
- description: '',
- tabindex: -1,
- btnsOrder: BootstrapDialog.BUTTONS_ORDER_CANCEL_OK
- };
-
- /**
- * Config default options.
- */
- BootstrapDialog.configDefaultOptions = function (options) {
- BootstrapDialog.defaultOptions = $.extend(true, BootstrapDialog.defaultOptions, options);
- };
-
- /**
- * Open / Close all created dialogs all at once.
- */
- BootstrapDialog.dialogs = {};
- BootstrapDialog.openAll = function () {
- $.each(BootstrapDialog.dialogs, function (id, dialogInstance) {
- dialogInstance.open();
- });
- };
- BootstrapDialog.closeAll = function () {
- $.each(BootstrapDialog.dialogs, function (id, dialogInstance) {
- dialogInstance.close();
- });
- };
-
- /**
- * Get dialog instance by given id.
- *
- * @returns dialog instance
- */
- BootstrapDialog.getDialog = function (id) {
- var dialog = null;
- if (typeof BootstrapDialog.dialogs[id] !== 'undefined') {
- dialog = BootstrapDialog.dialogs[id];
- }
-
- return dialog;
- };
-
- /**
- * Set a dialog.
- *
- * @returns the dialog that has just been set.
- */
- BootstrapDialog.setDialog = function (dialog) {
- BootstrapDialog.dialogs[dialog.getId()] = dialog;
-
- return dialog;
- };
-
- /**
- * Alias of BootstrapDialog.setDialog(dialog)
- *
- * @param {type} dialog
- * @returns {unresolved}
- */
- BootstrapDialog.addDialog = function (dialog) {
- return BootstrapDialog.setDialog(dialog);
- };
-
- /**
- * Move focus to next visible dialog.
- */
- BootstrapDialog.moveFocus = function () {
- var lastDialogInstance = null;
- $.each(BootstrapDialog.dialogs, function (id, dialogInstance) {
- if (dialogInstance.isRealized() && dialogInstance.isOpened()) {
- lastDialogInstance = dialogInstance;
- }
- });
- if (lastDialogInstance !== null) {
- lastDialogInstance.getModal().focus();
- }
- };
-
- BootstrapDialog.METHODS_TO_OVERRIDE = {};
- BootstrapDialog.METHODS_TO_OVERRIDE['v3.1'] = {
- handleModalBackdropEvent: function () {
- this.getModal().on('click', {dialog: this}, function (event) {
- event.target === this && event.data.dialog.isClosable() && event.data.dialog.canCloseByBackdrop() && event.data.dialog.close();
- });
-
- return this;
- },
- /**
- * To make multiple opened dialogs look better.
- *
- * Will be removed in later version, after Bootstrap Modal >= 3.3.0, updating z-index is unnecessary.
- */
- updateZIndex: function () {
- if (this.isOpened()) {
- var zIndexBackdrop = 1040;
- var zIndexModal = 1050;
- var dialogCount = 0;
- $.each(BootstrapDialog.dialogs, function (dialogId, dialogInstance) {
- if (dialogInstance.isRealized() && dialogInstance.isOpened()) {
- dialogCount++;
- }
- });
- var $modal = this.getModal();
- var $backdrop = $modal.data('bs.modal').$backdrop;
- $modal.css('z-index', zIndexModal + (dialogCount - 1) * 20);
- $backdrop.css('z-index', zIndexBackdrop + (dialogCount - 1) * 20);
- }
-
- return this;
- },
- open: function () {
- !this.isRealized() && this.realize();
- this.getModal().modal('show');
- this.updateZIndex();
-
- return this;
- }
- };
- BootstrapDialog.METHODS_TO_OVERRIDE['v3.2'] = {
- handleModalBackdropEvent: BootstrapDialog.METHODS_TO_OVERRIDE['v3.1']['handleModalBackdropEvent'],
- updateZIndex: BootstrapDialog.METHODS_TO_OVERRIDE['v3.1']['updateZIndex'],
- open: BootstrapDialog.METHODS_TO_OVERRIDE['v3.1']['open']
- };
- BootstrapDialog.METHODS_TO_OVERRIDE['v3.3'] = {};
- BootstrapDialog.METHODS_TO_OVERRIDE['v3.3.4'] = $.extend({}, BootstrapDialog.METHODS_TO_OVERRIDE['v3.1']);
- BootstrapDialog.prototype = {
- constructor: BootstrapDialog,
- initOptions: function (options) {
- this.options = $.extend(true, this.defaultOptions, options);
-
- return this;
- },
- holdThisInstance: function () {
- BootstrapDialog.addDialog(this);
-
- return this;
- },
- initModalStuff: function () {
- this.setModal(this.createModal())
- .setModalDialog(this.createModalDialog())
- .setModalContent(this.createModalContent())
- .setModalHeader(this.createModalHeader())
- .setModalBody(this.createModalBody())
- .setModalFooter(this.createModalFooter());
-
- this.getModal().append(this.getModalDialog());
- this.getModalDialog().append(this.getModalContent());
- this.getModalContent()
- .append(this.getModalHeader())
- .append(this.getModalBody())
- .append(this.getModalFooter());
-
- return this;
- },
- createModal: function () {
- var $modal = $('
');
- $modal.prop('id', this.getId());
- $modal.attr('aria-labelledby', this.getId() + '_title');
-
- return $modal;
- },
- getModal: function () {
- return this.$modal;
- },
- setModal: function ($modal) {
- this.$modal = $modal;
-
- return this;
- },
- createModalDialog: function () {
- return $('
');
- },
- getModalDialog: function () {
- return this.$modalDialog;
- },
- setModalDialog: function ($modalDialog) {
- this.$modalDialog = $modalDialog;
-
- return this;
- },
- createModalContent: function () {
- return $('
');
- },
- getModalContent: function () {
- return this.$modalContent;
- },
- setModalContent: function ($modalContent) {
- this.$modalContent = $modalContent;
-
- return this;
- },
- createModalHeader: function () {
- return $('');
- },
- getModalHeader: function () {
- return this.$modalHeader;
- },
- setModalHeader: function ($modalHeader) {
- this.$modalHeader = $modalHeader;
-
- return this;
- },
- createModalBody: function () {
- return $('
');
- },
- getModalBody: function () {
- return this.$modalBody;
- },
- setModalBody: function ($modalBody) {
- this.$modalBody = $modalBody;
-
- return this;
- },
- createModalFooter: function () {
- return $('');
- },
- getModalFooter: function () {
- return this.$modalFooter;
- },
- setModalFooter: function ($modalFooter) {
- this.$modalFooter = $modalFooter;
-
- return this;
- },
- createDynamicContent: function (rawContent) {
- var content = null;
- if (typeof rawContent === 'function') {
- content = rawContent.call(rawContent, this);
- } else {
- content = rawContent;
- }
- if (typeof content === 'string') {
- content = this.formatStringContent(content);
- }
-
- return content;
- },
- formatStringContent: function (content) {
- if (this.options.nl2br) {
- return content.replace(/\r\n/g, ' ').replace(/[\r\n]/g, ' ');
- }
-
- return content;
- },
- setData: function (key, value) {
- this.options.data[key] = value;
-
- return this;
- },
- getData: function (key) {
- return this.options.data[key];
- },
- setId: function (id) {
- this.options.id = id;
-
- return this;
- },
- getId: function () {
- return this.options.id;
- },
- getType: function () {
- return this.options.type;
- },
- setType: function (type) {
- this.options.type = type;
- this.updateType();
-
- return this;
- },
- updateType: function () {
- if (this.isRealized()) {
- var types = [BootstrapDialog.TYPE_DEFAULT,
- BootstrapDialog.TYPE_INFO,
- BootstrapDialog.TYPE_PRIMARY,
- BootstrapDialog.TYPE_SUCCESS,
- BootstrapDialog.TYPE_WARNING,
- BootstrapDialog.TYPE_DANGER];
-
- this.getModal().removeClass(types.join(' ')).addClass(this.getType());
- }
-
- return this;
- },
- getSize: function () {
- return this.options.size;
- },
- setSize: function (size) {
- this.options.size = size;
- this.updateSize();
-
- return this;
- },
- updateSize: function () {
- if (this.isRealized()) {
- var dialog = this;
-
- // Dialog size
- this.getModal().removeClass(BootstrapDialog.SIZE_NORMAL)
- .removeClass(BootstrapDialog.SIZE_SMALL)
- .removeClass(BootstrapDialog.SIZE_WIDE)
- .removeClass(BootstrapDialog.SIZE_LARGE);
- this.getModal().addClass(this.getSize());
-
- // Smaller dialog.
- this.getModalDialog().removeClass('modal-sm');
- if (this.getSize() === BootstrapDialog.SIZE_SMALL) {
- this.getModalDialog().addClass('modal-sm');
- }
-
- // Wider dialog.
- this.getModalDialog().removeClass('modal-lg');
- if (this.getSize() === BootstrapDialog.SIZE_WIDE) {
- this.getModalDialog().addClass('modal-lg');
- }
-
- // Button size
- $.each(this.options.buttons, function (index, button) {
- var $button = dialog.getButton(button.id);
- var buttonSizes = ['btn-lg', 'btn-sm', 'btn-xs'];
- var sizeClassSpecified = false;
- if (typeof button['cssClass'] === 'string') {
- var btnClasses = button['cssClass'].split(' ');
- $.each(btnClasses, function (index, btnClass) {
- if ($.inArray(btnClass, buttonSizes) !== -1) {
- sizeClassSpecified = true;
- }
- });
- }
- if (!sizeClassSpecified) {
- $button.removeClass(buttonSizes.join(' '));
- $button.addClass(dialog.getButtonSize());
- }
- });
- }
-
- return this;
- },
- getCssClass: function () {
- return this.options.cssClass;
- },
- setCssClass: function (cssClass) {
- this.options.cssClass = cssClass;
-
- return this;
- },
- getTitle: function () {
- return this.options.title;
- },
- setTitle: function (title) {
- this.options.title = title;
- this.updateTitle();
-
- return this;
- },
- updateTitle: function () {
- if (this.isRealized()) {
- var title = this.getTitle() !== null ? this.createDynamicContent(this.getTitle()) : this.getDefaultText();
- this.getModalHeader().find('.' + this.getNamespace('title')).html('').append(title).prop('id', this.getId() + '_title');
- }
-
- return this;
- },
- getMessage: function () {
- return this.options.message;
- },
- setMessage: function (message) {
- this.options.message = message;
- this.updateMessage();
-
- return this;
- },
- updateMessage: function () {
- if (this.isRealized()) {
- var message = this.createDynamicContent(this.getMessage());
- this.getModalBody().find('.' + this.getNamespace('message')).html('').append(message);
- }
-
- return this;
- },
- isClosable: function () {
- return this.options.closable;
- },
- setClosable: function (closable) {
- this.options.closable = closable;
- this.updateClosable();
-
- return this;
- },
- setCloseByBackdrop: function (closeByBackdrop) {
- this.options.closeByBackdrop = closeByBackdrop;
-
- return this;
- },
- canCloseByBackdrop: function () {
- return this.options.closeByBackdrop;
- },
- setCloseByKeyboard: function (closeByKeyboard) {
- this.options.closeByKeyboard = closeByKeyboard;
-
- return this;
- },
- canCloseByKeyboard: function () {
- return this.options.closeByKeyboard;
- },
- isAnimate: function () {
- return this.options.animate;
- },
- setAnimate: function (animate) {
- this.options.animate = animate;
-
- return this;
- },
- updateAnimate: function () {
- if (this.isRealized()) {
- this.getModal().toggleClass('fade', this.isAnimate());
- }
-
- return this;
- },
- getSpinicon: function () {
- return this.options.spinicon;
- },
- setSpinicon: function (spinicon) {
- this.options.spinicon = spinicon;
-
- return this;
- },
- addButton: function (button) {
- this.options.buttons.push(button);
-
- return this;
- },
- addButtons: function (buttons) {
- var that = this;
- $.each(buttons, function (index, button) {
- that.addButton(button);
- });
-
- return this;
- },
- getButtons: function () {
- return this.options.buttons;
- },
- setButtons: function (buttons) {
- this.options.buttons = buttons;
- this.updateButtons();
-
- return this;
- },
- /**
- * If there is id provided for a button option, it will be in dialog.indexedButtons list.
- *
- * In that case you can use dialog.getButton(id) to find the button.
- *
- * @param {type} id
- * @returns {undefined}
- */
- getButton: function (id) {
- if (typeof this.indexedButtons[id] !== 'undefined') {
- return this.indexedButtons[id];
- }
-
- return null;
- },
- getButtonSize: function () {
- if (typeof BootstrapDialog.BUTTON_SIZES[this.getSize()] !== 'undefined') {
- return BootstrapDialog.BUTTON_SIZES[this.getSize()];
- }
-
- return '';
- },
- updateButtons: function () {
- if (this.isRealized()) {
- if (this.getButtons().length === 0) {
- this.getModalFooter().hide();
- } else {
- this.getModalFooter().show().find('.' + this.getNamespace('footer')).html('').append(this.createFooterButtons());
- }
- }
-
- return this;
- },
- isAutodestroy: function () {
- return this.options.autodestroy;
- },
- setAutodestroy: function (autodestroy) {
- this.options.autodestroy = autodestroy;
- },
- getDescription: function () {
- return this.options.description;
- },
- setDescription: function (description) {
- this.options.description = description;
-
- return this;
- },
- setTabindex: function (tabindex) {
- this.options.tabindex = tabindex;
-
- return this;
- },
- getTabindex: function () {
- return this.options.tabindex;
- },
- updateTabindex: function () {
- if (this.isRealized()) {
- this.getModal().attr('tabindex', this.getTabindex());
- }
-
- return this;
- },
- getDefaultText: function () {
- return BootstrapDialog.DEFAULT_TEXTS[this.getType()];
- },
- getNamespace: function (name) {
- return BootstrapDialog.NAMESPACE + '-' + name;
- },
- createHeaderContent: function () {
- var $container = $('
');
- $container.addClass(this.getNamespace('header'));
-
- // title
- $container.append(this.createTitleContent());
-
- // Close button
- $container.prepend(this.createCloseButton());
-
- return $container;
- },
- createTitleContent: function () {
- var $title = $('
');
- $title.addClass(this.getNamespace('title'));
-
- return $title;
- },
- createCloseButton: function () {
- var $container = $('
');
- $container.addClass(this.getNamespace('close-button'));
- var $icon = $(' ');
- $icon.append(this.options.closeIcon);
- $container.append($icon);
- $container.on('click', {dialog: this}, function (event) {
- event.data.dialog.close();
- });
-
- return $container;
- },
- createBodyContent: function () {
- var $container = $('
');
- $container.addClass(this.getNamespace('body'));
-
- // Message
- $container.append(this.createMessageContent());
-
- return $container;
- },
- createMessageContent: function () {
- var $message = $('
');
- $message.addClass(this.getNamespace('message'));
-
- return $message;
- },
- createFooterContent: function () {
- var $container = $('
');
- $container.addClass(this.getNamespace('footer'));
-
- return $container;
- },
- createFooterButtons: function () {
- var that = this;
- var $container = $('
');
- $container.addClass(this.getNamespace('footer-buttons'));
- this.indexedButtons = {};
- $.each(this.options.buttons, function (index, button) {
- if (!button.id) {
- button.id = BootstrapDialog.newGuid();
- }
- var $button = that.createButton(button);
- that.indexedButtons[button.id] = $button;
- $container.append($button);
- });
-
- return $container;
- },
- createButton: function (button) {
- var $button = $(' ');
- $button.prop('id', button.id);
- $button.data('button', button);
-
- // Icon
- if (typeof button.icon !== 'undefined' && $.trim(button.icon) !== '') {
- $button.append(this.createButtonIcon(button.icon));
- }
-
- // Label
- if (typeof button.label !== 'undefined') {
- $button.append(button.label);
- }
-
- // title
- if (typeof button.title !== 'undefined') {
- $button.attr('title', button.title);
- }
-
- // Css class
- if (typeof button.cssClass !== 'undefined' && $.trim(button.cssClass) !== '') {
- $button.addClass(button.cssClass);
- } else {
- $button.addClass('btn-default');
- }
-
- // Data attributes
- if (typeof button.data === 'object' && button.data.constructor === {}.constructor) {
- $.each(button.data, function (key, value) {
- $button.attr('data-' + key, value);
- });
- }
-
- // Hotkey
- if (typeof button.hotkey !== 'undefined') {
- this.registeredButtonHotkeys[button.hotkey] = $button;
- }
-
- // Button on click
- $button.on('click', {dialog: this, $button: $button, button: button}, function (event) {
- var dialog = event.data.dialog;
- var $button = event.data.$button;
- var button = $button.data('button');
- if (button.autospin) {
- $button.toggleSpin(true);
- }
- if (typeof button.action === 'function') {
- return button.action.call($button, dialog, event);
- }
- });
-
- // Dynamically add extra functions to $button
- this.enhanceButton($button);
-
- //Initialize enabled or not
- if (typeof button.enabled !== 'undefined') {
- $button.toggleEnable(button.enabled);
- }
-
- return $button;
- },
- /**
- * Dynamically add extra functions to $button
- *
- * Using '$this' to reference 'this' is just for better readability.
- *
- * @param {type} $button
- * @returns {_L13.BootstrapDialog.prototype}
- */
- enhanceButton: function ($button) {
- $button.dialog = this;
-
- // Enable / Disable
- $button.toggleEnable = function (enable) {
- var $this = this;
- if (typeof enable !== 'undefined') {
- $this.prop("disabled", !enable).toggleClass('disabled', !enable);
- } else {
- $this.prop("disabled", !$this.prop("disabled"));
- }
-
- return $this;
- };
- $button.enable = function () {
- var $this = this;
- $this.toggleEnable(true);
-
- return $this;
- };
- $button.disable = function () {
- var $this = this;
- $this.toggleEnable(false);
-
- return $this;
- };
-
- // Icon spinning, helpful for indicating ajax loading status.
- $button.toggleSpin = function (spin) {
- var $this = this;
- var dialog = $this.dialog;
- var $icon = $this.find('.' + dialog.getNamespace('button-icon'));
- if (typeof spin === 'undefined') {
- spin = !($button.find('.icon-spin').length > 0);
- }
- if (spin) {
- $icon.hide();
- $button.prepend(dialog.createButtonIcon(dialog.getSpinicon()).addClass('icon-spin'));
- } else {
- $icon.show();
- $button.find('.icon-spin').remove();
- }
-
- return $this;
- };
- $button.spin = function () {
- var $this = this;
- $this.toggleSpin(true);
-
- return $this;
- };
- $button.stopSpin = function () {
- var $this = this;
- $this.toggleSpin(false);
-
- return $this;
- };
-
- return this;
- },
- createButtonIcon: function (icon) {
- var $icon = $(' ');
- $icon.addClass(this.getNamespace('button-icon')).addClass(icon);
-
- return $icon;
- },
- /**
- * Invoke this only after the dialog is realized.
- *
- * @param {type} enable
- * @returns {undefined}
- */
- enableButtons: function (enable) {
- $.each(this.indexedButtons, function (id, $button) {
- $button.toggleEnable(enable);
- });
-
- return this;
- },
- /**
- * Invoke this only after the dialog is realized.
- *
- * @returns {undefined}
- */
- updateClosable: function () {
- if (this.isRealized()) {
- // Close button
- this.getModalHeader().find('.' + this.getNamespace('close-button')).toggle(this.isClosable());
- }
-
- return this;
- },
- /**
- * Set handler for modal event 'show.bs.modal'.
- * This is a setter!
- */
- onShow: function (onshow) {
- this.options.onshow = onshow;
-
- return this;
- },
- /**
- * Set handler for modal event 'shown.bs.modal'.
- * This is a setter!
- */
- onShown: function (onshown) {
- this.options.onshown = onshown;
-
- return this;
- },
- /**
- * Set handler for modal event 'hide.bs.modal'.
- * This is a setter!
- */
- onHide: function (onhide) {
- this.options.onhide = onhide;
-
- return this;
- },
- /**
- * Set handler for modal event 'hidden.bs.modal'.
- * This is a setter!
- */
- onHidden: function (onhidden) {
- this.options.onhidden = onhidden;
-
- return this;
- },
- isRealized: function () {
- return this.realized;
- },
- setRealized: function (realized) {
- this.realized = realized;
-
- return this;
- },
- isOpened: function () {
- return this.opened;
- },
- setOpened: function (opened) {
- this.opened = opened;
-
- return this;
- },
- handleModalEvents: function () {
- this.getModal().on('show.bs.modal', {dialog: this}, function (event) {
- var dialog = event.data.dialog;
- dialog.setOpened(true);
- if (dialog.isModalEvent(event) && typeof dialog.options.onshow === 'function') {
- var openIt = dialog.options.onshow(dialog);
- if (openIt === false) {
- dialog.setOpened(false);
- }
-
- return openIt;
- }
- });
- this.getModal().on('shown.bs.modal', {dialog: this}, function (event) {
- var dialog = event.data.dialog;
- dialog.isModalEvent(event) && typeof dialog.options.onshown === 'function' && dialog.options.onshown(dialog);
- });
- this.getModal().on('hide.bs.modal', {dialog: this}, function (event) {
- var dialog = event.data.dialog;
- dialog.setOpened(false);
- if (dialog.isModalEvent(event) && typeof dialog.options.onhide === 'function') {
- var hideIt = dialog.options.onhide(dialog);
- if (hideIt === false) {
- dialog.setOpened(true);
- }
-
- return hideIt;
- }
- });
- this.getModal().on('hidden.bs.modal', {dialog: this}, function (event) {
- var dialog = event.data.dialog;
- dialog.isModalEvent(event) && typeof dialog.options.onhidden === 'function' && dialog.options.onhidden(dialog);
- if (dialog.isAutodestroy()) {
- dialog.setRealized(false);
- delete BootstrapDialog.dialogs[dialog.getId()];
- $(this).remove();
- }
- BootstrapDialog.moveFocus();
- });
-
- // Backdrop, I did't find a way to change bs3 backdrop option after the dialog is popped up, so here's a new wheel.
- this.handleModalBackdropEvent();
-
- // ESC key support
- this.getModal().on('keyup', {dialog: this}, function (event) {
- event.which === 27 && event.data.dialog.isClosable() && event.data.dialog.canCloseByKeyboard() && event.data.dialog.close();
- });
-
- // Button hotkey
- this.getModal().on('keyup', {dialog: this}, function (event) {
- var dialog = event.data.dialog;
- if (typeof dialog.registeredButtonHotkeys[event.which] !== 'undefined') {
- var $button = $(dialog.registeredButtonHotkeys[event.which]);
- !$button.prop('disabled') && $button.focus().trigger('click');
- }
- });
-
- return this;
- },
- handleModalBackdropEvent: function () {
- this.getModal().on('click', {dialog: this}, function (event) {
- $(event.target).hasClass('modal-backdrop') && event.data.dialog.isClosable() && event.data.dialog.canCloseByBackdrop() && event.data.dialog.close();
- });
-
- return this;
- },
- isModalEvent: function (event) {
- return typeof event.namespace !== 'undefined' && event.namespace === 'bs.modal';
- },
- makeModalDraggable: function () {
- if (this.options.draggable) {
- this.getModalHeader().addClass(this.getNamespace('draggable')).on('mousedown', {dialog: this}, function (event) {
- var dialog = event.data.dialog;
- dialog.draggableData.isMouseDown = true;
- var dialogOffset = dialog.getModalDialog().offset();
- dialog.draggableData.mouseOffset = {
- top: event.clientY - dialogOffset.top,
- left: event.clientX - dialogOffset.left
- };
- });
- this.getModal().on('mouseup mouseleave', {dialog: this}, function (event) {
- event.data.dialog.draggableData.isMouseDown = false;
- });
- $('body').on('mousemove', {dialog: this}, function (event) {
- var dialog = event.data.dialog;
- if (!dialog.draggableData.isMouseDown) {
- return;
- }
- dialog.getModalDialog().offset({
- top: event.clientY - dialog.draggableData.mouseOffset.top,
- left: event.clientX - dialog.draggableData.mouseOffset.left
- });
- });
- }
-
- return this;
- },
- realize: function () {
- this.initModalStuff();
- this.getModal().addClass(BootstrapDialog.NAMESPACE)
- .addClass(this.getCssClass());
- this.updateSize();
- if (this.getDescription()) {
- this.getModal().attr('aria-describedby', this.getDescription());
- }
- this.getModalFooter().append(this.createFooterContent());
- this.getModalHeader().append(this.createHeaderContent());
- this.getModalBody().append(this.createBodyContent());
- this.getModal().data('bs.modal', new BootstrapDialogModal(this.getModal(), {
- backdrop: 'static',
- keyboard: false,
- show: false
- }));
- this.makeModalDraggable();
- this.handleModalEvents();
- this.setRealized(true);
- this.updateButtons();
- this.updateType();
- this.updateTitle();
- this.updateMessage();
- this.updateClosable();
- this.updateAnimate();
- this.updateSize();
- this.updateTabindex();
-
- return this;
- },
- open: function () {
- !this.isRealized() && this.realize();
- this.getModal().modal('show');
-
- return this;
- },
- close: function () {
- !this.isRealized() && this.realize();
- this.getModal().modal('hide');
-
- return this;
- }
- };
-
- // Add compatible methods.
- BootstrapDialog.prototype = $.extend(BootstrapDialog.prototype, BootstrapDialog.METHODS_TO_OVERRIDE[BootstrapDialogModal.getModalVersion()]);
-
- /**
- * RFC4122 version 4 compliant unique id creator.
- *
- * Added by https://github.com/tufanbarisyildirim/
- *
- * @returns {String}
- */
- BootstrapDialog.newGuid = function () {
- return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
- var r = Math.random() * 16 | 0, v = c === 'x' ? r : (r & 0x3 | 0x8);
- return v.toString(16);
- });
- };
-
- /* ================================================
- * For lazy people
- * ================================================ */
-
- /**
- * Shortcut function: show
- *
- * @param {type} options
- * @returns the created dialog instance
- */
- BootstrapDialog.show = function (options) {
- return new BootstrapDialog(options).open();
- };
-
- /**
- * Alert window
- *
- * @returns the created dialog instance
- */
- BootstrapDialog.alert = function () {
- var alertOptions = {};
- var defaultAlertOptions = {
- type: BootstrapDialog.TYPE_PRIMARY,
- title: null,
- message: null,
- closable: false,
- draggable: false,
- buttonLabel: BootstrapDialog.DEFAULT_TEXTS.OK,
- buttonHotkey: null,
- callback: null
- };
-
- if (typeof arguments[0] === 'object' && arguments[0].constructor === {}.constructor) {
- alertOptions = $.extend(true, defaultAlertOptions, arguments[0]);
- } else {
- alertOptions = $.extend(true, defaultAlertOptions, {
- message: arguments[0],
- callback: typeof arguments[1] !== 'undefined' ? arguments[1] : null
- });
- }
-
- var dialog = new BootstrapDialog(alertOptions);
- dialog.setData('callback', alertOptions.callback);
- dialog.addButton({
- label: alertOptions.buttonLabel,
- hotkey: alertOptions.buttonHotkey,
- action: function (dialog) {
- if (typeof dialog.getData('callback') === 'function' && dialog.getData('callback').call(this, true) === false) {
- return false;
- }
- dialog.setData('btnClicked', true);
-
- return dialog.close();
- }
- });
- if (typeof dialog.options.onhide === 'function') {
- dialog.onHide(function (dialog) {
- var hideIt = true;
- if (!dialog.getData('btnClicked') && dialog.isClosable() && typeof dialog.getData('callback') === 'function') {
- hideIt = dialog.getData('callback')(false);
- }
- if (hideIt === false) {
- return false;
- }
- hideIt = this.onhide(dialog);
-
- return hideIt;
- }.bind({
- onhide: dialog.options.onhide
- }));
- } else {
- dialog.onHide(function (dialog) {
- var hideIt = true;
- if (!dialog.getData('btnClicked') && dialog.isClosable() && typeof dialog.getData('callback') === 'function') {
- hideIt = dialog.getData('callback')(false);
- }
-
- return hideIt;
- });
- }
-
- return dialog.open();
- };
-
- /**
- * Confirm window
- *
- * @returns the created dialog instance
- */
- BootstrapDialog.confirm = function () {
- var confirmOptions = {};
- var defaultConfirmOptions = {
- type: BootstrapDialog.TYPE_PRIMARY,
- title: null,
- message: null,
- closable: false,
- draggable: false,
- btnCancelLabel: BootstrapDialog.DEFAULT_TEXTS.CANCEL,
- btnCancelClass: null,
- btnCancelHotkey: null,
- btnOKLabel: BootstrapDialog.DEFAULT_TEXTS.OK,
- btnOKClass: null,
- btnOKHotkey: null,
- btnsOrder: BootstrapDialog.defaultOptions.btnsOrder,
- callback: null
- };
- if (typeof arguments[0] === 'object' && arguments[0].constructor === {}.constructor) {
- confirmOptions = $.extend(true, defaultConfirmOptions, arguments[0]);
- } else {
- confirmOptions = $.extend(true, defaultConfirmOptions, {
- message: arguments[0],
- callback: typeof arguments[1] !== 'undefined' ? arguments[1] : null
- });
- }
- if (confirmOptions.btnOKClass === null) {
- confirmOptions.btnOKClass = ['btn', confirmOptions.type.split('-')[1]].join('-');
- }
-
- var dialog = new BootstrapDialog(confirmOptions);
- dialog.setData('callback', confirmOptions.callback);
-
- var buttons = [{
- label: confirmOptions.btnCancelLabel,
- cssClass: confirmOptions.btnCancelClass,
- hotkey: confirmOptions.btnCancelHotkey,
- action: function (dialog) {
- if (typeof dialog.getData('callback') === 'function' && dialog.getData('callback').call(this, false) === false) {
- return false;
- }
-
- return dialog.close();
- }
- }, {
- label: confirmOptions.btnOKLabel,
- cssClass: confirmOptions.btnOKClass,
- hotkey: confirmOptions.btnOKHotkey,
- action: function (dialog) {
- if (typeof dialog.getData('callback') === 'function' && dialog.getData('callback').call(this, true) === false) {
- return false;
- }
-
- return dialog.close();
- }
- }];
- if (confirmOptions.btnsOrder === BootstrapDialog.BUTTONS_ORDER_OK_CANCEL) {
- buttons.reverse();
- }
- dialog.addButtons(buttons);
-
- return dialog.open();
-
- };
-
- /**
- * Warning window
- *
- * @param {type} message
- * @returns the created dialog instance
- */
- BootstrapDialog.warning = function (message, callback) {
- return new BootstrapDialog({
- type: BootstrapDialog.TYPE_WARNING,
- message: message
- }).open();
- };
-
- /**
- * Danger window
- *
- * @param {type} message
- * @returns the created dialog instance
- */
- BootstrapDialog.danger = function (message, callback) {
- return new BootstrapDialog({
- type: BootstrapDialog.TYPE_DANGER,
- message: message
- }).open();
- };
-
- /**
- * Success window
- *
- * @param {type} message
- * @returns the created dialog instance
- */
- BootstrapDialog.success = function (message, callback) {
- return new BootstrapDialog({
- type: BootstrapDialog.TYPE_SUCCESS,
- message: message
- }).open();
- };
-
- return BootstrapDialog;
-
-}));
diff --git a/web/client.js b/web/client.js
index cfb21a4..c370044 100644
--- a/web/client.js
+++ b/web/client.js
@@ -1,5 +1,14 @@
+import * as d3 from 'd3';
+import BootstrapDialog from 'bootstrap3-dialog';
+import BootstrapMenu from 'bootstrap-menu';
+import Sortable from 'sortablejs';
+import * as $ from 'jquery';
+require('bootstrap-select');
+require('d3-graphviz');
+import './graph.css';
+
$(function () {
- settings = {};
+ var settings = {};
// Configure UI
$( "button[name=rankdir]")
.click(function () {
diff --git a/web/graph.css b/web/graph.css
index 63b8bf4..e497d47 100644
--- a/web/graph.css
+++ b/web/graph.css
@@ -1,3 +1,7 @@
+@import '~bootstrap/dist/css/bootstrap.css';
+@import '~bootstrap-select/dist/css/bootstrap-select.css';
+@import '~bootstrap3-dialog/dist/css/bootstrap-dialog.css';
+
html {
height:100%;
}
diff --git a/web/graph.html b/web/graph.html
index 8fa439d..a65fd46 100644
--- a/web/graph.html
+++ b/web/graph.html
@@ -3,22 +3,8 @@
GitLost
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
diff --git a/webpack.config.js b/webpack.config.js
new file mode 100644
index 0000000..bd41ec5
--- /dev/null
+++ b/webpack.config.js
@@ -0,0 +1,94 @@
+const path = require('path');
+const webpack = require('webpack');
+
+var nodeExternals = require('webpack-node-externals');
+
+const common = {
+ plugins: [ /* common plugins */],
+ resolve: {
+ extensions: ['.js', '.css', '.less'], // common extensions
+ modules: [
+ 'node_modules'
+ ]
+ },
+ mode: 'development',
+ // other plugins, postcss config etc. common for frontend and backend
+};
+
+const frontend = {
+ entry: [
+ './web/client.js'
+ ],
+ output: {
+ filename: 'web.bundle.js',
+ path: path.resolve(__dirname, 'dist')
+ },
+ module: {
+ rules: [
+ {
+ test: /\.js$/,
+ exclude: /node_modules/,
+ use: ['babel-loader']
+ },
+ {
+ test: /\.css$/,
+ use: ['style-loader', 'css-loader']
+ },
+ { test: /\.(png|jpg|gif|svg|eot|ttf|woff|woff2)$/, loader: 'url-loader?limit=100000' }
+ ]
+ },
+ devtool: 'inline-source-map',
+ plugins: [
+ new webpack.ProvidePlugin({
+ jQuery: 'jquery'
+ })
+ ]
+ // other loaders, plugins etc. specific for frontend
+};
+
+const backend = {
+ entry: [
+ './bin/gitlost.js'
+ ],
+ output: {
+ filename: 'gitlost.js',
+ path: path.resolve(__dirname, 'dist')
+ },
+ target: 'node',
+ stats: 'verbose',
+ externals: [nodeExternals()],
+ node: {
+ __dirname: false
+ }
+ // other loaders, plugins etc. specific for backend
+};
+
+const css = {
+ entry: './web/graph.css',
+ output: {
+ filename: 'graph.css',
+ path: path.resolve(__dirname, 'dist')
+ },
+ module: {
+ rules: [
+ {
+ test: /\.css$/,
+ use: ['style-loader', 'css-loader']
+ },
+ { test: /\.(png|jpg|gif|svg|eot|ttf|woff|woff2)$/, loader: 'url-loader?limit=100000' }
+ ]
+ },
+ resolve: {
+ extensions: ['.js', '.css', '.less'],
+ modules: [
+ 'node_modules'
+ ]
+ },
+ mode: 'development',
+}
+
+
+module.exports = [
+ Object.assign({}, common, frontend),
+ Object.assign({}, common, backend)
+];
\ No newline at end of file