Removed unused code from JavaScript files

This commit is contained in:
djmaze
2020-07-27 14:52:18 +02:00
parent dc233bfc90
commit 1b331aca32
12 changed files with 140 additions and 427 deletions

View File

@@ -51,12 +51,30 @@ This fork has the following changes:
* CRLF => LF line endings
* Ongoing removal of jQuery and Underscore.js dependencies (things are native these days)
### slim jQuery and Underscore.js
js: 1.14.0 = 7960367 / native = 5131640 bytes
### jQuery.slim and Underscore.js
js/min: 1.14.0 = 1766594 / native = 1405919 bytes
This fork has no support for Internet Explorer.
Things might work in Edge 15-18, Firefox 47-62 and Chrome 54-68 due to one polyfill for array.flat().
360.675 bytes is not much, but it feels faster.
|js/* |1.14.0 |native | div |
|----------- |--------: |--------: |--------: |
|admin.js |2.130.942 |1.359.501 | |
|app.js |4.184.455 |3.127.807 | |
|boot.js | 671.522 | 120.319 | |
|libs.js | 647.614 | 511.296 | |
|polyfills.js | 325.834 | 0 | |
|TOTAL js |7.960.367 |5.119.409 | |
|js/min/* |1.14.0 |native | div |
|----------- |--------: |--------: |--------: |
|admin.js | 252.147 | 177.094 | |
|app.js | 511.202 | 409.778 | |
|boot.js | 66.007 | 14.697 | |
|libs.js | 572.545 | 468.224 | |
|polyfills.js | 32.452 | 0 | |
|TOTAL js/min |1.434.353 |1.069.793 |364.560 |
364.560 bytes is not much, but it feels faster.
### PHP73 branch

View File

@@ -171,7 +171,6 @@ function runApp() {
) {
const p = progressJs;
p.setOptions({ theme: 'rainloop' });
p.start().set(5);
const libs = () =>

View File

@@ -1,11 +1 @@
(function(l,e){"object"===typeof exports?e(exports):"function"===typeof define&&define.amd?define(["exports"],e):e(l)})(this,function(l){function e(a){this._targetElement="undefined"!=typeof a.length?a:[a];"undefined"===typeof window._progressjsId&&(window._progressjsId=1);"undefined"===typeof window._progressjsIntervals&&(window._progressjsIntervals={});this._options={theme:"blue",overlayMode:!1,considerTransition:!0}}function m(a,c){var d=this;100<=c&&(c=100);a.hasAttribute("data-progressjs")&&
setTimeout(function(){"undefined"!=typeof d._onProgressCallback&&d._onProgressCallback.call(d,a,c);var b=h(a);b.style.width=parseInt(c)+"%";var b=b.querySelector(".progressjs-percent"),g=parseInt(b.innerHTML.replace("%","")),e=parseInt(c),j=function(a,b,c){var d=Math.abs(b-c);3>d?k=30:20>d?k=20:intervanIn=1;0!=b-c&&(a.innerHTML=(f?++b:--b)+"%",setTimeout(function(){j(a,b,c)},k))},f=!0;g>e&&(f=!1);var k=10;j(b,g,e)},50)}function h(a){a=parseInt(a.getAttribute("data-progressjs"));return document.querySelector('.progressjs-container > .progressjs-progress[data-progressjs="'+
a+'"] > .progressjs-inner')}function p(a){for(var c=0,d=this._targetElement.length;c<d;c++){var b=this._targetElement[c];if(b.hasAttribute("data-progressjs")){var g=h(b);(g=parseInt(g.style.width.replace("%","")))&&m.call(this,b,g+(a||1))}}}function q(){var a,c=document.createElement("fakeelement"),d={transition:"transitionend",OTransition:"oTransitionEnd",MozTransition:"transitionend",WebkitTransition:"webkitTransitionEnd"};for(a in d)if(void 0!==c.style[a])return d[a]}var n=function(a){if("object"===
typeof a)return new e(a);if("string"===typeof a){if(a=document.querySelectorAll(a))return new e(a);throw Error("There is no element with given selector.");}return new e(document.body)};n.version="0.1.0";n.fn=e.prototype={clone:function(){return new e(this)},setOption:function(a,c){this._options[a]=c;return this},setOptions:function(a){var c=this._options,d={},b;for(b in c)d[b]=c[b];for(b in a)d[b]=a[b];this._options=d;return this},start:function(){"undefined"!=typeof this._onBeforeStartCallback&&
this._onBeforeStartCallback.call(this);if(!document.querySelector(".progressjs-container")){var a=document.createElement("div");a.className="progressjs-container";document.body.appendChild(a)}for(var a=0,c=this._targetElement.length;a<c;a++){var d=this._targetElement[a];if(!d.hasAttribute("data-progressjs")){var b=d,g,e,j;"body"===b.tagName.toLowerCase()?(g=b.clientWidth,e=b.clientHeight):(g=b.offsetWidth,e=b.offsetHeight);for(var f=j=0;b&&!isNaN(b.offsetLeft)&&!isNaN(b.offsetTop);)j+=b.offsetLeft,
f+=b.offsetTop,b=b.offsetParent;b=f;d.setAttribute("data-progressjs",window._progressjsId);f=document.createElement("div");f.className="progressjs-progress progressjs-theme-"+this._options.theme;f.style.position="body"===d.tagName.toLowerCase()?"fixed":"absolute";f.setAttribute("data-progressjs",window._progressjsId);var k=document.createElement("div");k.className="progressjs-inner";var h=document.createElement("div");h.className="progressjs-percent";h.innerHTML="1%";k.appendChild(h);this._options.overlayMode&&
"body"===d.tagName.toLowerCase()?(f.style.left=0,f.style.right=0,f.style.top=0,f.style.bottom=0):(f.style.left=j+"px",f.style.top=b+"px",f.style.width=g+"px",this._options.overlayMode&&(f.style.height=e+"px"));f.appendChild(k);document.querySelector(".progressjs-container").appendChild(f);m(d,1);++window._progressjsId}}return this},set:function(a){for(var c=0,d=this._targetElement.length;c<d;c++)m.call(this,this._targetElement[c],a);return this},increase:function(a){p.call(this,a);return this},autoIncrease:function(a,
c){var d=this,b=parseInt(this._targetElement[0].getAttribute("data-progressjs"));"undefined"!=typeof window._progressjsIntervals[b]&&clearInterval(window._progressjsIntervals[b]);window._progressjsIntervals[b]=setInterval(function(){p.call(d,a)},c);return this},end:function(){a:{"undefined"!=typeof this._onBeforeEndCallback&&(!0===this._options.considerTransition?h(this._targetElement[0]).addEventListener(q(),this._onBeforeEndCallback,!1):this._onBeforeEndCallback.call(this));for(var a=parseInt(this._targetElement[0].getAttribute("data-progressjs")),
c=0,d=this._targetElement.length;c<d;c++){var b=this._targetElement[c],e=h(b);if(!e)break a;var l=1;100>parseInt(e.style.width.replace("%",""))&&(m.call(this,b,100),l=500);(function(a,b){setTimeout(function(){a.parentNode.className+=" progressjs-end";setTimeout(function(){a.parentNode.parentNode.removeChild(a.parentNode);b.removeAttribute("data-progressjs")},1E3)},l)})(e,b)}if(window._progressjsIntervals[a])try{clearInterval(window._progressjsIntervals[a]),window._progressjsIntervals[a]=null,delete window._progressjsIntervals[a]}catch(j){}}return this},
onbeforeend:function(a){if("function"===typeof a)this._onBeforeEndCallback=a;else throw Error("Provided callback for onbeforeend was not a function");return this},onbeforestart:function(a){if("function"===typeof a)this._onBeforeStartCallback=a;else throw Error("Provided callback for onbeforestart was not a function");return this},onprogress:function(a){if("function"===typeof a)this._onProgressCallback=a;else throw Error("Provided callback for onprogress was not a function");return this}};return l.progressJs=
n});
(e=>{function t(e){void 0!==e.length?this._targetElement=e:this._targetElement=[e],void 0===window._progressjsId&&(window._progressjsId=1),void 0===window._progressjsIntervals&&(window._progressjsIntervals={}),this._options={theme:"rainloop",overlayMode:!1,considerTransition:!0}}function r(){void 0!==this._onBeforeStartCallback&&this._onBeforeStartCallback.call(this),function(){if(!document.querySelector(".progressjs-container")){var e=document.createElement("div");e.className="progressjs-container",document.body.appendChild(e)}}.call(this);for(var e=0,t=this._targetElement.length;e<t;e++)s.call(this,this._targetElement[e])}function s(e){if(!e.hasAttribute("data-progressjs")){var t=function(e){var t={};"body"===e.tagName.toLowerCase()?(t.width=e.clientWidth,t.height=e.clientHeight):(t.width=e.offsetWidth,t.height=e.offsetHeight);var r=0,s=0;for(;e&&!isNaN(e.offsetLeft)&&!isNaN(e.offsetTop);)r+=e.offsetLeft,s+=e.offsetTop,e=e.offsetParent;return t.top=s,t.left=r,t}.call(this,e);e.setAttribute("data-progressjs",window._progressjsId);var r=document.createElement("div");r.className="progressjs-progress progressjs-theme-"+this._options.theme,"body"===e.tagName.toLowerCase()?r.style.position="fixed":r.style.position="absolute",r.setAttribute("data-progressjs",window._progressjsId);var s=document.createElement("div");s.className="progressjs-inner";var o=document.createElement("div");o.className="progressjs-percent",o.innerHTML="1%",s.appendChild(o),this._options.overlayMode&&"body"===e.tagName.toLowerCase()?(r.style.left=0,r.style.right=0,r.style.top=0,r.style.bottom=0):(r.style.left=t.left+"px",r.style.top=t.top+"px",r.style.width=t.width+"px",this._options.overlayMode&&(r.style.height=t.height+"px")),r.appendChild(s),document.querySelector(".progressjs-container").appendChild(r),n(e,1),++window._progressjsId}}function n(e,t){t>=100&&(t=100),e.hasAttribute("data-progressjs")&&setTimeout(function(){var r=o(e);r.style.width=parseInt(t)+"%",r=r.querySelector(".progressjs-percent");var s=parseInt(r.innerHTML.replace("%",""));!function(e,t,r){var s=!0;t>r&&(s=!1);var n=10;!function e(t,r,o){var i=Math.abs(r-o);n=i<3?30:i<20?20:1,r-o!=0&&(t.innerHTML=(s?++r:--r)+"%",setTimeout(function(){e(t,r,o)},n))}(e,t,r)}(r,s,parseInt(t))},50)}function o(e){var t=parseInt(e.getAttribute("data-progressjs"));return document.querySelector('.progressjs-container > .progressjs-progress[data-progressjs="'+t+'"] > .progressjs-inner')}function i(){void 0!==this._onBeforeEndCallback&&(!0===this._options.considerTransition?o(this._targetElement[0]).addEventListener(function(){var e,t=document.createElement("fakeelement"),r={transition:"transitionend",OTransition:"oTransitionEnd",MozTransition:"transitionend",WebkitTransition:"webkitTransitionEnd"};for(e in r)if(void 0!==t.style[e])return r[e]}(),this._onBeforeEndCallback,!1):this._onBeforeEndCallback.call(this));for(var e=parseInt(this._targetElement[0].getAttribute("data-progressjs")),t=0,r=this._targetElement.length;t<r;t++){var s=this._targetElement[t],i=o(s);if(!i)return;var a=parseInt(i.style.width.replace("%","")),l=1;a<100&&(n.call(this,s,100),l=500),function(e,t){setTimeout(function(){e.parentNode.className+=" progressjs-end",setTimeout(function(){e.parentNode.parentNode.removeChild(e.parentNode),t.removeAttribute("data-progressjs")},1e3)},l)}(i,s)}if(window._progressjsIntervals[e])try{clearInterval(window._progressjsIntervals[e]),window._progressjsIntervals[e]=null,delete window._progressjsIntervals[e]}catch(e){}}var a=function(e){if("object"==typeof e)return new t(e);if("string"==typeof e){var r=document.querySelectorAll(e);if(r)return new t(r);throw new Error("There is no element with given selector.")}return new t(document.body)};a.version="0.1.0",a.fn=t.prototype={start:function(){return r.call(this),this},set:function(e){return function(e){for(var t=0,r=this._targetElement.length;t<r;t++)n.call(this,this._targetElement[t],e)}.call(this,e),this},end:function(){return i.call(this),this},onbeforeend:function(e){if("function"!=typeof e)throw new Error("Provided callback for onbeforeend was not a function");return this._onBeforeEndCallback=e,this}},e.progressJs=a})(this);

View File

@@ -6,18 +6,7 @@
* Copyright (C) 2013 usabli.ca - Afshin Mehrabani (@afshinmeh)
*/
(function (root, factory) {
if (typeof exports === 'object') {
// CommonJS
factory(exports);
} else if (typeof define === 'function' && define.amd) {
// AMD. Register as an anonymous module.
define(['exports'], factory);
} else {
// Browser globals
factory(root);
}
} (this, function (exports) {
(exports => {
//Default config/variables
var VERSION = '0.1.0';
@@ -42,7 +31,7 @@
this._options = {
//progress bar theme
theme: 'blue',
theme: 'rainloop',
//overlay mode makes an overlay layer in the target element
overlayMode: false,
//to consider CSS3 transitions in events
@@ -163,8 +152,6 @@
* @param {Number} percent
*/
function _setPercentFor(targetElement, percent) {
var self = this;
//prevent overflow!
if (percent >= 100)
percent = 100;
@@ -173,15 +160,10 @@
//setTimeout for better CSS3 animation applying in some cases
setTimeout(function() {
//call the onprogress callback
if (typeof self._onProgressCallback != 'undefined') {
self._onProgressCallback.call(self, targetElement, percent);
}
var percentElement = _getPercentElement(targetElement);
percentElement.style.width = parseInt(percent) + '%';
var percentElement = percentElement.querySelector(".progressjs-percent");
percentElement = percentElement.querySelector(".progressjs-percent");
var existingPercent = parseInt(percentElement.innerHTML.replace('%', ''));
//start increase/decrease the percent element with animation
@@ -201,7 +183,7 @@
} else if (distance < 20) {
intervalIn = 20;
} else {
intervanIn = 1;
intervalIn = 1;
}
if ((existingPercent - currentPercent) != 0) {
@@ -231,47 +213,6 @@
return document.querySelector('.progressjs-container > .progressjs-progress[data-progressjs="' + progressjsId + '"] > .progressjs-inner');
}
/**
* Auto increase the progress bar every X milliseconds
*
* @api private
* @method _autoIncrease
* @param {Number} size
* @param {Number} millisecond
*/
function _autoIncrease(size, millisecond) {
var self = this;
var progressjsId = parseInt(this._targetElement[0].getAttribute('data-progressjs'));
if (typeof window._progressjsIntervals[progressjsId] != 'undefined') {
clearInterval(window._progressjsIntervals[progressjsId]);
}
window._progressjsIntervals[progressjsId] = setInterval(function() {
_increasePercent.call(self, size);
}, millisecond);
}
/**
* Increase the size of progress bar
*
* @api private
* @method _increasePercent
* @param {Number} size
*/
function _increasePercent(size) {
for (var i = 0, elmsLength = this._targetElement.length; i < elmsLength; i++) {
var currentElement = this._targetElement[i];
if (currentElement.hasAttribute('data-progressjs')) {
var percentElement = _getPercentElement(currentElement);
var existingPercent = parseInt(percentElement.style.width.replace('%', ''));
if (existingPercent) {
_setPercentFor.call(this, currentElement, existingPercent + (size || 1));
}
}
}
}
/**
* Close and remove progress bar
*
@@ -389,27 +330,12 @@
return elementPosition;
}
/**
* Overwrites obj1's values with obj2's and adds obj2's if non existent in obj1
* via: http://stackoverflow.com/questions/171251/how-can-i-merge-properties-of-two-javascript-objects-dynamically
*
* @param obj1
* @param obj2
* @returns obj3 a new object based on obj1 and obj2
*/
function _mergeOptions(obj1, obj2) {
var obj3 = {};
for (var attrname in obj1) { obj3[attrname] = obj1[attrname]; }
for (var attrname in obj2) { obj3[attrname] = obj2[attrname]; }
return obj3;
}
var progressJs = function (targetElm) {
if (typeof (targetElm) === 'object') {
//Ok, create a new instance
return new ProgressJs(targetElm);
} else if (typeof (targetElm) === 'string') {
}
if (typeof (targetElm) === 'string') {
//select the target element with query selector
var targetElement = document.querySelectorAll(targetElm);
@@ -418,9 +344,8 @@
} else {
throw new Error('There is no element with given selector.');
}
} else {
return new ProgressJs(document.body);
}
return new ProgressJs(document.body);
};
/**
@@ -430,9 +355,9 @@
* @returns transition name
*/
function whichTransitionEvent() {
var t;
var el = document.createElement('fakeelement');
var transitions = {
var t,
el = document.createElement('fakeelement'),
transitions = {
'transition': 'transitionend',
'OTransition': 'oTransitionEnd',
'MozTransition': 'transitionend',
@@ -456,17 +381,6 @@
//Prototype
progressJs.fn = ProgressJs.prototype = {
clone: function () {
return new ProgressJs(this);
},
setOption: function(option, value) {
this._options[option] = value;
return this;
},
setOptions: function(options) {
this._options = _mergeOptions(this._options, options);
return this;
},
start: function() {
_startProgress.call(this);
return this;
@@ -475,14 +389,6 @@
_setPercent.call(this, percent);
return this;
},
increase: function(size) {
_increasePercent.call(this, size);
return this;
},
autoIncrease: function(size, millisecond) {
_autoIncrease.call(this, size, millisecond);
return this;
},
end: function() {
_end.call(this);
return this;
@@ -494,25 +400,9 @@
throw new Error('Provided callback for onbeforeend was not a function');
}
return this;
},
onbeforestart: function(providedCallback) {
if (typeof (providedCallback) === 'function') {
this._onBeforeStartCallback = providedCallback;
} else {
throw new Error('Provided callback for onbeforestart was not a function');
}
return this;
},
onprogress: function(providedCallback) {
if (typeof (providedCallback) === 'function') {
this._onProgressCallback = providedCallback;
} else {
throw new Error('Provided callback for onprogress was not a function');
}
return this;
}
};
exports.progressJs = progressJs;
return progressJs;
}));
})(this);

View File

@@ -670,27 +670,31 @@
_attachEvents : function() {
var widget = this;
var widget = this, els = this.elements;
if (els) {
els.input.on('keyup.inputosaurus', {widget : widget}, this._inputKeypress);
els.input.on('keydown.inputosaurus', {widget : widget}, this._inputKeypress);
els.input.on('change.inputosaurus', {widget : widget}, this._inputKeypress);
els.input.on('focus.inputosaurus', {widget : widget}, this._inputFocus);
this.elements.input.on('keyup.inputosaurus', {widget : widget}, this._inputKeypress);
this.elements.input.on('keydown.inputosaurus', {widget : widget}, this._inputKeypress);
this.elements.input.on('change.inputosaurus', {widget : widget}, this._inputKeypress);
this.elements.input.on('focus.inputosaurus', {widget : widget}, this._inputFocus);
this.options.parseOnBlur && els.input.on('blur.inputosaurus', {widget : widget}, this.parseInput);
this.options.parseOnBlur && this.elements.input.on('blur.inputosaurus', {widget : widget}, this.parseInput);
this.elements.ul.on('click.inputosaurus', {widget : widget}, this._focus);
this.elements.ul.on('click.inputosaurus', 'a', {widget : widget}, this._removeTag);
this.elements.ul.on('dblclick.inputosaurus', 'li', {widget : widget}, this._editTag);
this.elements.ul.on('doubletap.inputosaurus', 'li', {widget : widget}, this._editTag);
this.elements.ul.on('focus.inputosaurus', 'a', {widget : widget}, this._tagFocus);
this.elements.ul.on('blur.inputosaurus', 'a', {widget : widget}, this._tagFocus);
this.elements.ul.on('keydown.inputosaurus', 'a', {widget : widget}, this._tagKeypress);
els.ul.on('click.inputosaurus', {widget : widget}, this._focus);
els.ul.on('click.inputosaurus', 'a', {widget : widget}, this._removeTag);
els.ul.on('dblclick.inputosaurus', 'li', {widget : widget}, this._editTag);
els.ul.on('doubletap.inputosaurus', 'li', {widget : widget}, this._editTag);
els.ul.on('focus.inputosaurus', 'a', {widget : widget}, this._tagFocus);
els.ul.on('blur.inputosaurus', 'a', {widget : widget}, this._tagFocus);
els.ul.on('keydown.inputosaurus', 'a', {widget : widget}, this._tagKeypress);
}
},
_destroy: function() {
this.elements.input.unbind('.inputosaurus');
this.elements.ul.replaceWith(this.element);
var els = this.elements;
if (els) {
els.input.unbind('.inputosaurus');
els.ul.replaceWith(this.element);
}
}
};

View File

@@ -3,17 +3,7 @@
* Includes: widget.js, position.js, data.js, keycode.js, scroll-parent.js, widgets/autocomplete.js, widgets/draggable.js, widgets/droppable.js, widgets/menu.js, widgets/mouse.js, widgets/selectable.js, widgets/sortable.js
* Copyright jQuery Foundation and other contributors; Licensed MIT */
(function( factory ) {
if ( typeof define === "function" && define.amd ) {
// AMD. Register as an anonymous module.
define([ "jquery" ], factory );
} else {
// Browser globals
factory( jQuery );
}
}(function( $ ) {
(( $ ) => {
$.ui = $.ui || {};
@@ -70,16 +60,14 @@ $.cleanData = ( function( orig ) {
return function( elems ) {
var events, elem, i;
for ( i = 0; ( elem = elems[ i ] ) != null; i++ ) {
try {
// try {
// Only trigger remove when necessary to save time
events = $._data( elem, "events" );
if ( events && events.remove ) {
$( elem ).triggerHandler( "remove" );
}
// Http://bugs.jquery.com/ticket/8235
} catch ( e ) {}
// } catch ( e ) {}
}
orig( elems );
};
@@ -378,11 +366,11 @@ $.Widget.prototype = {
return {};
},
_getCreateEventData: $.noop,
_getCreateEventData: ()=>{},
_create: $.noop,
_create: ()=>{},
_init: $.noop,
_init: ()=>{},
destroy: function() {
var that = this;
@@ -405,7 +393,7 @@ $.Widget.prototype = {
this.bindings.off( this.eventNamespace );
},
_destroy: $.noop,
_destroy: ()=>{},
widget: function() {
return this.element;
@@ -791,7 +779,7 @@ var cachedScrollbarWidth,
abs = Math.abs,
rhorizontal = /left|center|right/,
rvertical = /top|center|bottom/,
roffset = /[\+\-]\d+(\.[\d]+)?%?/,
roffset = /[+-]\d+(\.[\d]+)?%?/,
rposition = /^\w+/,
rpercent = /%$/,
_position = $.fn.position;
@@ -1268,7 +1256,7 @@ $.ui.position = {
//>>docs: http://api.jqueryui.com/data-selector/
var data = $.extend( $.expr[ ":" ], {
$.extend( $.expr[ ":" ], {
data: $.expr.createPseudo ?
$.expr.createPseudo( function( dataName ) {
return function( elem ) {
@@ -1958,7 +1946,7 @@ $.widget( "ui.menu", {
},
_filterMenuItems: function( character ) {
var escapedCharacter = character.replace( /[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&" ),
var escapedCharacter = character.replace( /[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&" ),
regex = new RegExp( "^" + escapedCharacter, "i" );
return this.activeMenu
@@ -2595,7 +2583,7 @@ $.widget( "ui.autocomplete", {
$.extend( $.ui.autocomplete, {
escapeRegex: function( value ) {
return value.replace( /[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&" );
return value.replace( /[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&" );
},
filter: function( array, term ) {
var matcher = new RegExp( $.ui.autocomplete.escapeRegex( term ), "i" );
@@ -3812,17 +3800,12 @@ $.widget( "ui.droppable", {
}
} );
var intersect = $.ui.intersect = ( function() {
function isOverAxis( x, reference, size ) {
return ( x >= reference ) && ( x < ( reference + size ) );
}
return function( draggable, droppable, toleranceMode, event ) {
if ( !droppable.offset ) {
return false;
}
function isOverAxis( x, reference, size ) {
return ( x >= reference ) && ( x < ( reference + size ) );
}
var intersect = function( draggable, droppable, mode, event ) {
if ( droppable.offset ) {
var x1 = ( draggable.positionAbs ||
draggable.position.absolute ).left + draggable.margins.left,
y1 = ( draggable.positionAbs ||
@@ -3834,32 +3817,27 @@ var intersect = $.ui.intersect = ( function() {
r = l + droppable.proportions().width,
b = t + droppable.proportions().height;
switch ( toleranceMode ) {
case "fit":
return ( l <= x1 && x2 <= r && t <= y1 && y2 <= b );
case "intersect":
return ( l < x1 + ( draggable.helperProportions.width / 2 ) && // Right Half
x2 - ( draggable.helperProportions.width / 2 ) < r && // Left Half
t < y1 + ( draggable.helperProportions.height / 2 ) && // Bottom Half
y2 - ( draggable.helperProportions.height / 2 ) < b ); // Top Half
case "pointer":
return isOverAxis( event.pageY, t, droppable.proportions().height ) &&
isOverAxis( event.pageX, l, droppable.proportions().width );
case "touch":
return (
( y1 >= t && y1 <= b ) || // Top edge touching
( y2 >= t && y2 <= b ) || // Bottom edge touching
( y1 < t && y2 > b ) // Surrounded vertically
return "fit" == mode
? ( l <= x1 && x2 <= r && t <= y1 && y2 <= b )
: "intersect" == mode
? ( l < x1 + ( draggable.helperProportions.width / 2 ) &&
x2 - ( draggable.helperProportions.width / 2 ) < r &&
t < y1 + ( draggable.helperProportions.height / 2 ) &&
y2 - ( draggable.helperProportions.height / 2 ) < b )
: "pointer" == mode
? isOverAxis( event.pageY, t, droppable.proportions().height ) &&
isOverAxis( event.pageX, l, droppable.proportions().width )
: "touch" == mode
? (
( y1 >= t && y1 <= b ) || ( y2 >= t && y2 <= b ) || ( y1 < t && y2 > b )
) && (
( x1 >= l && x1 <= r ) || // Left edge touching
( x2 >= l && x2 <= r ) || // Right edge touching
( x1 < l && x2 > r ) // Surrounded horizontally
);
default:
return false;
}
};
} )();
( x1 >= l && x1 <= r ) || ( x2 >= l && x2 <= r ) || ( x1 < l && x2 > r )
)
: false;
}
return false;
};
/*
This manager tracks offsets of draggables and droppables
@@ -4870,7 +4848,7 @@ $.widget( "ui.sortable", $.ui.mouse, {
$( items ).each( function() {
var res = ( $( o.item || this ).attr( o.attribute || "id" ) || "" )
.match( o.expression || ( /(.+)[\-=_](.+)/ ) );
.match( o.expression || ( /(.+)[-=_](.+)/ ) );
if ( res ) {
str.push(
( o.key || res[ 1 ] + "[]" ) +
@@ -5845,8 +5823,4 @@ $.widget( "ui.sortable", $.ui.mouse, {
} );
}));
})(jQuery);

File diff suppressed because one or more lines are too long

24
vendors/jua/jua.js vendored
View File

@@ -70,17 +70,6 @@
Globals.iDefLimit = 20;
Globals.bIsAjaxUploaderSupported = (function () {
var
window = __webpack_require__(1),
oInput = window.document.createElement('input')
;
oInput.type = 'file';
return !!('XMLHttpRequest' in window && 'multiple' in oInput && 'FormData' in window && (new window.XMLHttpRequest()).upload && true);
}());
module.exports = Globals;
}());
@@ -997,7 +986,7 @@
});
}
Driver = (self.isAjaxUploaderSupported() && !Utils.getValue(self.oOptions, 'disableAjaxUpload', false) ?
Driver = (!Utils.getValue(self.oOptions, 'disableAjaxUpload', false) ?
__webpack_require__(5) : __webpack_require__(6));
self.oDriver = new Driver(self, self.oOptions);
@@ -1205,7 +1194,6 @@
Utils.setValue(self, 'on', self.on);
Utils.setValue(self, 'cancel', self.cancel);
Utils.setValue(self, 'isDragAndDropSupported', self.isDragAndDropSupported);
Utils.setValue(self, 'isAjaxUploaderSupported', self.isAjaxUploaderSupported);
Utils.setValue(self, 'setDragAndDropEnabledStatus', self.setDragAndDropEnabledStatus);
}
@@ -1277,14 +1265,6 @@
this.oDriver.cancel(sUid);
};
/**
* @return {boolean}
*/
Jua.prototype.isAjaxUploaderSupported = function ()
{
return Globals.bIsAjaxUploaderSupported;
};
/**
* @param {boolean} bEnabled
*/
@@ -1339,4 +1319,4 @@
module.exports = queue;
/***/ }
/******/ ]);
/******/ ]);

File diff suppressed because one or more lines are too long

View File

@@ -2,7 +2,7 @@
// (c) 2011-2013 Thomas Fuchs
// keymaster.js may be freely distributed under the MIT license.
;(function(global){
(global=>{
var k,
_handlers = {},
_mods = { 16: false, 18: false, 17: false, 91: false },
@@ -37,22 +37,6 @@
for(k=1;k<20;k++) _MAP['f'+k] = 111+k;
// IE doesn't support Array#indexOf, so have a simple replacement
function index(array, item){
var i = array.length;
while(i--) if(array[i]===item) return i;
return -1;
}
// for comparing mods before unassignment
function compareArray(a1, a2) {
if (a1.length != a2.length) return false;
for (var i = 0; i < a1.length; i++) {
if (a1[i] !== a2[i]) return false;
}
return true;
}
var modifierMap = {
16:'shiftKey',
18:'altKey',
@@ -61,14 +45,14 @@
};
function updateModifierKey(event) {
for(k in _mods) _mods[k] = event[modifierMap[k]];
};
}
// handle keydown event
function dispatch(event) {
var key, handler, k, i, modifiersMatch, scope;
key = event.keyCode;
if (index(_downKeys, key) == -1) {
if (!_downKeys.includes(key)) {
_downKeys.push(key);
}
@@ -100,8 +84,8 @@
// check if modifiers match if any
modifiersMatch = handler.mods.length > 0;
for(k in _mods)
if((!_mods[k] && index(handler.mods, +k) > -1) ||
(_mods[k] && index(handler.mods, +k) == -1)) modifiersMatch = false;
if((!_mods[k] && handler.mods.includes(+k)) ||
(_mods[k] && !handler.mods.includes(+k))) modifiersMatch = false;
// call the handler and stop the event if neccessary
if((handler.mods.length == 0 && !_mods[16] && !_mods[18] && !_mods[17] && !_mods[91]) || modifiersMatch){
if(handler.method(event, handler)===false){
@@ -113,12 +97,12 @@
}
}
}
};
}
// unset modifier keys on keyup
function clearModifier(event){
var key = event.keyCode, k,
i = index(_downKeys, key);
i = _downKeys.indexOf(key);
// remove key from _downKeys
if (i >= 0) {
@@ -130,12 +114,12 @@
_mods[key] = false;
for(k in _MODIFIERS) if(_MODIFIERS[k] == key) assignKey[k] = false;
}
};
}
function resetModifiers() {
for(k in _mods) _mods[k] = false;
for(k in _MODIFIERS) assignKey[k] = false;
};
for(let k in _mods) _mods[k] = false;
for(let k in _MODIFIERS) assignKey[k] = false;
}
// parse and assign shortcut
function assignKey(key, scope, method){
@@ -146,7 +130,7 @@
scope = 'all';
}
bScopeIsArray = !!(typeof scope !== 'string' && scope.length && typeof scope[0] === 'string');
bScopeIsArray = !!(typeof scope !== 'string' && scope.length && typeof scope[0] === 'string');
// for each shortcut
for (var i = 0; i < keys.length; i++) {
@@ -163,61 +147,14 @@
// ...store handler
if (!(key in _handlers)) _handlers[key] = [];
if (bScopeIsArray) {
for (var j = 0; j < scope.length; j++) {
_handlers[key].push({ shortcut: keys[i], scope: scope[j], method: method, key: keys[i], mods: mods });
}
} else {
_handlers[key].push({ shortcut: keys[i], scope: scope, method: method, key: keys[i], mods: mods });
}
}
};
// unbind all handlers for given key in current scope
function unbindKey(key, scope) {
var multipleKeys, keys,
mods = [],
i, j, obj;
multipleKeys = getKeys(key);
for (j = 0; j < multipleKeys.length; j++) {
keys = multipleKeys[j].split('+');
if (keys.length > 1) {
mods = getMods(keys);
key = keys[keys.length - 1];
}
key = code(key);
if (scope === undefined) {
scope = getScope();
}
if (!_handlers[key]) {
return;
}
for (i = 0; i < _handlers[key].length; i++) {
obj = _handlers[key][i];
// only clear handlers if correct scope and mods match
if (obj.scope === scope && compareArray(obj.mods, mods)) {
_handlers[key][i] = {};
}
if (bScopeIsArray) {
for (var j = 0; j < scope.length; j++) {
_handlers[key].push({ shortcut: keys[i], scope: scope[j], method: method, key: keys[i], mods: mods });
}
} else {
_handlers[key].push({ shortcut: keys[i], scope: scope, method: method, key: keys[i], mods: mods });
}
}
};
// Returns true if the key with code 'keyCode' is currently down
// Converts strings into key codes.
function isPressed(keyCode) {
if (typeof(keyCode)=='string') {
keyCode = code(keyCode);
}
return index(_downKeys, keyCode) != -1;
}
function getPressedKeyCodes() {
return _downKeys.slice(0);
}
function filter(event){
@@ -230,76 +167,39 @@
for(k in _MODIFIERS) assignKey[k] = false;
// set current scope (default 'all')
function setScope(scope){ _scope = scope || 'all' };
function getScope(){ return _scope || 'all' };
// delete all handlers for a given scope
function deleteScope(scope){
var key, handlers, i;
for (key in _handlers) {
handlers = _handlers[key];
for (i = 0; i < handlers.length; ) {
if (handlers[i].scope === scope) handlers.splice(i, 1);
else i++;
const
setScope = scope => { _scope = scope || 'all' },
getScope = () => _scope || 'all',
// abstract key logic for assign and unassign
getKeys = key => {
var keys;
key = key.replace(/\s/g, '');
keys = key.split(',');
if ((keys[keys.length - 1]) == '') {
keys[keys.length - 2] += ',';
}
}
};
// abstract key logic for assign and unassign
function getKeys(key) {
var keys;
key = key.replace(/\s/g, '');
keys = key.split(',');
if ((keys[keys.length - 1]) == '') {
keys[keys.length - 2] += ',';
}
return keys;
}
// abstract mods logic for assign and unassign
function getMods(key) {
var mods = key.slice(0, key.length - 1);
for (var mi = 0; mi < mods.length; mi++)
mods[mi] = _MODIFIERS[mods[mi]];
return mods;
}
// cross-browser events
function addEvent(object, event, method) {
if (object.addEventListener)
object.addEventListener(event, method, false);
else if(object.attachEvent)
object.attachEvent('on'+event, function(){ method(window.event) });
};
return keys;
},
// abstract mods logic for assign and unassign
getMods = key => {
var mods = key.slice(0, key.length - 1);
for (var mi = 0; mi < mods.length; mi++)
mods[mi] = _MODIFIERS[mods[mi]];
return mods;
};
// set the handlers globally on document
addEvent(document, 'keydown', function(event) { dispatch(event) }); // Passing _scope to a callback to ensure it remains the same by execution. Fixes #48
addEvent(document, 'keyup', clearModifier);
document.addEventListener('keydown', function(event) { dispatch(event) }); // Passing _scope to a callback to ensure it remains the same by execution. Fixes #48
document.addEventListener('keyup', clearModifier);
// reset modifiers to false whenever the window is (re)focused.
addEvent(window, 'focus', resetModifiers);
window.addEventListener('focus', resetModifiers);
// store previously defined key
var previousKey = global.key;
// restore previously defined key and return reference to our key object
function noConflict() {
var k = global.key;
global.key = previousKey;
return k;
}
// set window.key and window.key.set/get/deleteScope, and the default filter
// set window.key and window.key.set/get, and the default filter
global.key = assignKey;
global.key.setScope = setScope;
global.key.getScope = getScope;
global.key.deleteScope = deleteScope;
global.key.filter = filter;
global.key.isPressed = isPressed;
global.key.getPressedKeyCodes = getPressedKeyCodes;
global.key.noConflict = noConflict;
global.key.unbind = unbindKey;
if(typeof module !== 'undefined') module.exports = key;

44
vendors/qr.js/qr.js vendored
View File

@@ -7,7 +7,7 @@
// For all details and documentation:
// <http://neocotic.com/qr.js>
(function (root) {
(root => {
'use strict';
@@ -203,22 +203,6 @@
return data || {};
}
// Override the `qr` API methods that require HTML5 canvas support to throw a relevant error.
function overrideAPI(qr) {
var methods = [ 'canvas', 'image', 'save', 'saveSync', 'toDataURL' ];
var i;
function overrideMethod(name) {
qr[name] = function () {
throw new Error(name + ' requires HTML5 canvas element support');
};
}
for (i = 0; i < methods.length; i++) {
overrideMethod(methods[i]);
}
}
// Asynchronously write the data of the rendered canvas to a given file path.
function writeFile(cvs, data, callback) {
if (typeof data.path !== 'string') {
@@ -1188,30 +1172,6 @@
// Support
// -------
// Export `qr` for node.js and CommonJS.
if (typeof exports !== 'undefined') {
inNode = true;
if (typeof module !== 'undefined' && module.exports) {
exports = module.exports = qr;
}
exports.qr = qr;
// Import required node.js modules.
Canvas = require('canvas');
Image = Canvas.Image;
fs = require('fs');
} else if (typeof define === 'function' && define.amd) {
define(function () {
return qr;
});
} else {
// In non-HTML5 browser so strip base functionality.
if (!root.HTMLCanvasElement) {
overrideAPI(qr);
}
root.qr = qr;
}
root.qr = qr;
})(this);

File diff suppressed because one or more lines are too long