Removed unnecessary extra layer in resource folder structure.
This commit is contained in:
parent
94485b5633
commit
d8a1b66738
190 changed files with 11 additions and 11 deletions
21
hal-core/resources/web/js/lib/bootstrap-colorpicker.LICENSE
Normal file
21
hal-core/resources/web/js/lib/bootstrap-colorpicker.LICENSE
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) 2017 Javi Aguilar
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
6252
hal-core/resources/web/js/lib/bootstrap-colorpicker.js
vendored
Normal file
6252
hal-core/resources/web/js/lib/bootstrap-colorpicker.js
vendored
Normal file
File diff suppressed because it is too large
Load diff
10
hal-core/resources/web/js/lib/bootstrap-colorpicker.min.js
vendored
Normal file
10
hal-core/resources/web/js/lib/bootstrap-colorpicker.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
21
hal-core/resources/web/js/lib/bootstrap-switch.LICENSE
Normal file
21
hal-core/resources/web/js/lib/bootstrap-switch.LICENSE
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2013-2015 The authors of Bootstrap Switch
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
784
hal-core/resources/web/js/lib/bootstrap-switch.js
vendored
Normal file
784
hal-core/resources/web/js/lib/bootstrap-switch.js
vendored
Normal file
|
|
@ -0,0 +1,784 @@
|
|||
/**
|
||||
* bootstrap-switch - Turn checkboxes and radio buttons into toggle switches.
|
||||
*
|
||||
* @version v3.3.4
|
||||
* @homepage https://bttstrp.github.io/bootstrap-switch
|
||||
* @author Mattia Larentis <mattia@larentis.eu> (http://larentis.eu)
|
||||
* @license Apache-2.0
|
||||
*/
|
||||
|
||||
(function (global, factory) {
|
||||
if (typeof define === "function" && define.amd) {
|
||||
define(['jquery'], factory);
|
||||
} else if (typeof exports !== "undefined") {
|
||||
factory(require('jquery'));
|
||||
} else {
|
||||
var mod = {
|
||||
exports: {}
|
||||
};
|
||||
factory(global.jquery);
|
||||
global.bootstrapSwitch = mod.exports;
|
||||
}
|
||||
})(this, function (_jquery) {
|
||||
'use strict';
|
||||
|
||||
var _jquery2 = _interopRequireDefault(_jquery);
|
||||
|
||||
function _interopRequireDefault(obj) {
|
||||
return obj && obj.__esModule ? obj : {
|
||||
default: obj
|
||||
};
|
||||
}
|
||||
|
||||
var _extends = Object.assign || function (target) {
|
||||
for (var i = 1; i < arguments.length; i++) {
|
||||
var source = arguments[i];
|
||||
|
||||
for (var key in source) {
|
||||
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
||||
target[key] = source[key];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return target;
|
||||
};
|
||||
|
||||
function _classCallCheck(instance, Constructor) {
|
||||
if (!(instance instanceof Constructor)) {
|
||||
throw new TypeError("Cannot call a class as a function");
|
||||
}
|
||||
}
|
||||
|
||||
var _createClass = function () {
|
||||
function defineProperties(target, props) {
|
||||
for (var i = 0; i < props.length; i++) {
|
||||
var descriptor = props[i];
|
||||
descriptor.enumerable = descriptor.enumerable || false;
|
||||
descriptor.configurable = true;
|
||||
if ("value" in descriptor) descriptor.writable = true;
|
||||
Object.defineProperty(target, descriptor.key, descriptor);
|
||||
}
|
||||
}
|
||||
|
||||
return function (Constructor, protoProps, staticProps) {
|
||||
if (protoProps) defineProperties(Constructor.prototype, protoProps);
|
||||
if (staticProps) defineProperties(Constructor, staticProps);
|
||||
return Constructor;
|
||||
};
|
||||
}();
|
||||
|
||||
var $ = _jquery2.default || window.jQuery || window.$;
|
||||
|
||||
var BootstrapSwitch = function () {
|
||||
function BootstrapSwitch(element) {
|
||||
var _this = this;
|
||||
|
||||
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
||||
|
||||
_classCallCheck(this, BootstrapSwitch);
|
||||
|
||||
this.$element = $(element);
|
||||
this.options = $.extend({}, $.fn.bootstrapSwitch.defaults, this._getElementOptions(), options);
|
||||
this.prevOptions = {};
|
||||
this.$wrapper = $('<div>', {
|
||||
class: function _class() {
|
||||
var classes = [];
|
||||
classes.push(_this.options.state ? 'on' : 'off');
|
||||
if (_this.options.size) {
|
||||
classes.push(_this.options.size);
|
||||
}
|
||||
if (_this.options.disabled) {
|
||||
classes.push('disabled');
|
||||
}
|
||||
if (_this.options.readonly) {
|
||||
classes.push('readonly');
|
||||
}
|
||||
if (_this.options.indeterminate) {
|
||||
classes.push('indeterminate');
|
||||
}
|
||||
if (_this.options.inverse) {
|
||||
classes.push('inverse');
|
||||
}
|
||||
if (_this.$element.attr('id')) {
|
||||
classes.push('id-' + _this.$element.attr('id'));
|
||||
}
|
||||
return classes.map(_this._getClass.bind(_this)).concat([_this.options.baseClass], _this._getClasses(_this.options.wrapperClass)).join(' ');
|
||||
}
|
||||
});
|
||||
this.$container = $('<div>', { class: this._getClass('container') });
|
||||
this.$on = $('<span>', {
|
||||
html: this.options.onText,
|
||||
class: this._getClass('handle-on') + ' ' + this._getClass(this.options.onColor)
|
||||
});
|
||||
this.$off = $('<span>', {
|
||||
html: this.options.offText,
|
||||
class: this._getClass('handle-off') + ' ' + this._getClass(this.options.offColor)
|
||||
});
|
||||
this.$label = $('<span>', {
|
||||
html: this.options.labelText,
|
||||
class: this._getClass('label')
|
||||
});
|
||||
|
||||
this.$element.on('init.bootstrapSwitch', this.options.onInit.bind(this, element));
|
||||
this.$element.on('switchChange.bootstrapSwitch', function () {
|
||||
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
|
||||
args[_key] = arguments[_key];
|
||||
}
|
||||
|
||||
if (_this.options.onSwitchChange.apply(element, args) === false) {
|
||||
if (_this.$element.is(':radio')) {
|
||||
$('[name="' + _this.$element.attr('name') + '"]').trigger('previousState.bootstrapSwitch', true);
|
||||
} else {
|
||||
_this.$element.trigger('previousState.bootstrapSwitch', true);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
this.$container = this.$element.wrap(this.$container).parent();
|
||||
this.$wrapper = this.$container.wrap(this.$wrapper).parent();
|
||||
this.$element.before(this.options.inverse ? this.$off : this.$on).before(this.$label).before(this.options.inverse ? this.$on : this.$off);
|
||||
|
||||
if (this.options.indeterminate) {
|
||||
this.$element.prop('indeterminate', true);
|
||||
}
|
||||
|
||||
this._init();
|
||||
this._elementHandlers();
|
||||
this._handleHandlers();
|
||||
this._labelHandlers();
|
||||
this._formHandler();
|
||||
this._externalLabelHandler();
|
||||
this.$element.trigger('init.bootstrapSwitch', this.options.state);
|
||||
}
|
||||
|
||||
_createClass(BootstrapSwitch, [{
|
||||
key: 'setPrevOptions',
|
||||
value: function setPrevOptions() {
|
||||
this.prevOptions = _extends({}, this.options);
|
||||
}
|
||||
}, {
|
||||
key: 'state',
|
||||
value: function state(value, skip) {
|
||||
if (typeof value === 'undefined') {
|
||||
return this.options.state;
|
||||
}
|
||||
if (this.options.disabled || this.options.readonly || this.options.state && !this.options.radioAllOff && this.$element.is(':radio')) {
|
||||
return this.$element;
|
||||
}
|
||||
if (this.$element.is(':radio')) {
|
||||
$('[name="' + this.$element.attr('name') + '"]').trigger('setPreviousOptions.bootstrapSwitch');
|
||||
} else {
|
||||
this.$element.trigger('setPreviousOptions.bootstrapSwitch');
|
||||
}
|
||||
if (this.options.indeterminate) {
|
||||
this.indeterminate(false);
|
||||
}
|
||||
this.$element.prop('checked', Boolean(value)).trigger('change.bootstrapSwitch', skip);
|
||||
return this.$element;
|
||||
}
|
||||
}, {
|
||||
key: 'toggleState',
|
||||
value: function toggleState(skip) {
|
||||
if (this.options.disabled || this.options.readonly) {
|
||||
return this.$element;
|
||||
}
|
||||
if (this.options.indeterminate) {
|
||||
this.indeterminate(false);
|
||||
return this.state(true);
|
||||
} else {
|
||||
return this.$element.prop('checked', !this.options.state).trigger('change.bootstrapSwitch', skip);
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: 'size',
|
||||
value: function size(value) {
|
||||
if (typeof value === 'undefined') {
|
||||
return this.options.size;
|
||||
}
|
||||
if (this.options.size != null) {
|
||||
this.$wrapper.removeClass(this._getClass(this.options.size));
|
||||
}
|
||||
if (value) {
|
||||
this.$wrapper.addClass(this._getClass(value));
|
||||
}
|
||||
this._width();
|
||||
this._containerPosition();
|
||||
this.options.size = value;
|
||||
return this.$element;
|
||||
}
|
||||
}, {
|
||||
key: 'animate',
|
||||
value: function animate(value) {
|
||||
if (typeof value === 'undefined') {
|
||||
return this.options.animate;
|
||||
}
|
||||
if (this.options.animate === Boolean(value)) {
|
||||
return this.$element;
|
||||
}
|
||||
return this.toggleAnimate();
|
||||
}
|
||||
}, {
|
||||
key: 'toggleAnimate',
|
||||
value: function toggleAnimate() {
|
||||
this.options.animate = !this.options.animate;
|
||||
this.$wrapper.toggleClass(this._getClass('animate'));
|
||||
return this.$element;
|
||||
}
|
||||
}, {
|
||||
key: 'disabled',
|
||||
value: function disabled(value) {
|
||||
if (typeof value === 'undefined') {
|
||||
return this.options.disabled;
|
||||
}
|
||||
if (this.options.disabled === Boolean(value)) {
|
||||
return this.$element;
|
||||
}
|
||||
return this.toggleDisabled();
|
||||
}
|
||||
}, {
|
||||
key: 'toggleDisabled',
|
||||
value: function toggleDisabled() {
|
||||
this.options.disabled = !this.options.disabled;
|
||||
this.$element.prop('disabled', this.options.disabled);
|
||||
this.$wrapper.toggleClass(this._getClass('disabled'));
|
||||
return this.$element;
|
||||
}
|
||||
}, {
|
||||
key: 'readonly',
|
||||
value: function readonly(value) {
|
||||
if (typeof value === 'undefined') {
|
||||
return this.options.readonly;
|
||||
}
|
||||
if (this.options.readonly === Boolean(value)) {
|
||||
return this.$element;
|
||||
}
|
||||
return this.toggleReadonly();
|
||||
}
|
||||
}, {
|
||||
key: 'toggleReadonly',
|
||||
value: function toggleReadonly() {
|
||||
this.options.readonly = !this.options.readonly;
|
||||
this.$element.prop('readonly', this.options.readonly);
|
||||
this.$wrapper.toggleClass(this._getClass('readonly'));
|
||||
return this.$element;
|
||||
}
|
||||
}, {
|
||||
key: 'indeterminate',
|
||||
value: function indeterminate(value) {
|
||||
if (typeof value === 'undefined') {
|
||||
return this.options.indeterminate;
|
||||
}
|
||||
if (this.options.indeterminate === Boolean(value)) {
|
||||
return this.$element;
|
||||
}
|
||||
return this.toggleIndeterminate();
|
||||
}
|
||||
}, {
|
||||
key: 'toggleIndeterminate',
|
||||
value: function toggleIndeterminate() {
|
||||
this.options.indeterminate = !this.options.indeterminate;
|
||||
this.$element.prop('indeterminate', this.options.indeterminate);
|
||||
this.$wrapper.toggleClass(this._getClass('indeterminate'));
|
||||
this._containerPosition();
|
||||
return this.$element;
|
||||
}
|
||||
}, {
|
||||
key: 'inverse',
|
||||
value: function inverse(value) {
|
||||
if (typeof value === 'undefined') {
|
||||
return this.options.inverse;
|
||||
}
|
||||
if (this.options.inverse === Boolean(value)) {
|
||||
return this.$element;
|
||||
}
|
||||
return this.toggleInverse();
|
||||
}
|
||||
}, {
|
||||
key: 'toggleInverse',
|
||||
value: function toggleInverse() {
|
||||
this.$wrapper.toggleClass(this._getClass('inverse'));
|
||||
var $on = this.$on.clone(true);
|
||||
var $off = this.$off.clone(true);
|
||||
this.$on.replaceWith($off);
|
||||
this.$off.replaceWith($on);
|
||||
this.$on = $off;
|
||||
this.$off = $on;
|
||||
this.options.inverse = !this.options.inverse;
|
||||
return this.$element;
|
||||
}
|
||||
}, {
|
||||
key: 'onColor',
|
||||
value: function onColor(value) {
|
||||
if (typeof value === 'undefined') {
|
||||
return this.options.onColor;
|
||||
}
|
||||
if (this.options.onColor) {
|
||||
this.$on.removeClass(this._getClass(this.options.onColor));
|
||||
}
|
||||
this.$on.addClass(this._getClass(value));
|
||||
this.options.onColor = value;
|
||||
return this.$element;
|
||||
}
|
||||
}, {
|
||||
key: 'offColor',
|
||||
value: function offColor(value) {
|
||||
if (typeof value === 'undefined') {
|
||||
return this.options.offColor;
|
||||
}
|
||||
if (this.options.offColor) {
|
||||
this.$off.removeClass(this._getClass(this.options.offColor));
|
||||
}
|
||||
this.$off.addClass(this._getClass(value));
|
||||
this.options.offColor = value;
|
||||
return this.$element;
|
||||
}
|
||||
}, {
|
||||
key: 'onText',
|
||||
value: function onText(value) {
|
||||
if (typeof value === 'undefined') {
|
||||
return this.options.onText;
|
||||
}
|
||||
this.$on.html(value);
|
||||
this._width();
|
||||
this._containerPosition();
|
||||
this.options.onText = value;
|
||||
return this.$element;
|
||||
}
|
||||
}, {
|
||||
key: 'offText',
|
||||
value: function offText(value) {
|
||||
if (typeof value === 'undefined') {
|
||||
return this.options.offText;
|
||||
}
|
||||
this.$off.html(value);
|
||||
this._width();
|
||||
this._containerPosition();
|
||||
this.options.offText = value;
|
||||
return this.$element;
|
||||
}
|
||||
}, {
|
||||
key: 'labelText',
|
||||
value: function labelText(value) {
|
||||
if (typeof value === 'undefined') {
|
||||
return this.options.labelText;
|
||||
}
|
||||
this.$label.html(value);
|
||||
this._width();
|
||||
this.options.labelText = value;
|
||||
return this.$element;
|
||||
}
|
||||
}, {
|
||||
key: 'handleWidth',
|
||||
value: function handleWidth(value) {
|
||||
if (typeof value === 'undefined') {
|
||||
return this.options.handleWidth;
|
||||
}
|
||||
this.options.handleWidth = value;
|
||||
this._width();
|
||||
this._containerPosition();
|
||||
return this.$element;
|
||||
}
|
||||
}, {
|
||||
key: 'labelWidth',
|
||||
value: function labelWidth(value) {
|
||||
if (typeof value === 'undefined') {
|
||||
return this.options.labelWidth;
|
||||
}
|
||||
this.options.labelWidth = value;
|
||||
this._width();
|
||||
this._containerPosition();
|
||||
return this.$element;
|
||||
}
|
||||
}, {
|
||||
key: 'baseClass',
|
||||
value: function baseClass(value) {
|
||||
return this.options.baseClass;
|
||||
}
|
||||
}, {
|
||||
key: 'wrapperClass',
|
||||
value: function wrapperClass(value) {
|
||||
if (typeof value === 'undefined') {
|
||||
return this.options.wrapperClass;
|
||||
}
|
||||
if (!value) {
|
||||
value = $.fn.bootstrapSwitch.defaults.wrapperClass;
|
||||
}
|
||||
this.$wrapper.removeClass(this._getClasses(this.options.wrapperClass).join(' '));
|
||||
this.$wrapper.addClass(this._getClasses(value).join(' '));
|
||||
this.options.wrapperClass = value;
|
||||
return this.$element;
|
||||
}
|
||||
}, {
|
||||
key: 'radioAllOff',
|
||||
value: function radioAllOff(value) {
|
||||
if (typeof value === 'undefined') {
|
||||
return this.options.radioAllOff;
|
||||
}
|
||||
var val = Boolean(value);
|
||||
if (this.options.radioAllOff === val) {
|
||||
return this.$element;
|
||||
}
|
||||
this.options.radioAllOff = val;
|
||||
return this.$element;
|
||||
}
|
||||
}, {
|
||||
key: 'onInit',
|
||||
value: function onInit(value) {
|
||||
if (typeof value === 'undefined') {
|
||||
return this.options.onInit;
|
||||
}
|
||||
if (!value) {
|
||||
value = $.fn.bootstrapSwitch.defaults.onInit;
|
||||
}
|
||||
this.options.onInit = value;
|
||||
return this.$element;
|
||||
}
|
||||
}, {
|
||||
key: 'onSwitchChange',
|
||||
value: function onSwitchChange(value) {
|
||||
if (typeof value === 'undefined') {
|
||||
return this.options.onSwitchChange;
|
||||
}
|
||||
if (!value) {
|
||||
value = $.fn.bootstrapSwitch.defaults.onSwitchChange;
|
||||
}
|
||||
this.options.onSwitchChange = value;
|
||||
return this.$element;
|
||||
}
|
||||
}, {
|
||||
key: 'destroy',
|
||||
value: function destroy() {
|
||||
var $form = this.$element.closest('form');
|
||||
if ($form.length) {
|
||||
$form.off('reset.bootstrapSwitch').removeData('bootstrap-switch');
|
||||
}
|
||||
this.$container.children().not(this.$element).remove();
|
||||
this.$element.unwrap().unwrap().off('.bootstrapSwitch').removeData('bootstrap-switch');
|
||||
return this.$element;
|
||||
}
|
||||
}, {
|
||||
key: '_getElementOptions',
|
||||
value: function _getElementOptions() {
|
||||
return {
|
||||
state: this.$element.is(':checked'),
|
||||
size: this.$element.data('size'),
|
||||
animate: this.$element.data('animate'),
|
||||
disabled: this.$element.is(':disabled'),
|
||||
readonly: this.$element.is('[readonly]'),
|
||||
indeterminate: this.$element.data('indeterminate'),
|
||||
inverse: this.$element.data('inverse'),
|
||||
radioAllOff: this.$element.data('radio-all-off'),
|
||||
onColor: this.$element.data('on-color'),
|
||||
offColor: this.$element.data('off-color'),
|
||||
onText: this.$element.data('on-text'),
|
||||
offText: this.$element.data('off-text'),
|
||||
labelText: this.$element.data('label-text'),
|
||||
handleWidth: this.$element.data('handle-width'),
|
||||
labelWidth: this.$element.data('label-width'),
|
||||
baseClass: this.$element.data('base-class'),
|
||||
wrapperClass: this.$element.data('wrapper-class')
|
||||
};
|
||||
}
|
||||
}, {
|
||||
key: '_width',
|
||||
value: function _width() {
|
||||
var _this2 = this;
|
||||
|
||||
var $handles = this.$on.add(this.$off).add(this.$label).css('width', '');
|
||||
var handleWidth = this.options.handleWidth === 'auto' ? Math.round(Math.max(this.$on.width(), this.$off.width())) : this.options.handleWidth;
|
||||
$handles.width(handleWidth);
|
||||
this.$label.width(function (index, width) {
|
||||
if (_this2.options.labelWidth !== 'auto') {
|
||||
return _this2.options.labelWidth;
|
||||
}
|
||||
if (width < handleWidth) {
|
||||
return handleWidth;
|
||||
}
|
||||
return width;
|
||||
});
|
||||
this._handleWidth = this.$on.outerWidth();
|
||||
this._labelWidth = this.$label.outerWidth();
|
||||
this.$container.width(this._handleWidth * 2 + this._labelWidth);
|
||||
return this.$wrapper.width(this._handleWidth + this._labelWidth);
|
||||
}
|
||||
}, {
|
||||
key: '_containerPosition',
|
||||
value: function _containerPosition() {
|
||||
var _this3 = this;
|
||||
|
||||
var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.options.state;
|
||||
var callback = arguments[1];
|
||||
|
||||
this.$container.css('margin-left', function () {
|
||||
var values = [0, '-' + _this3._handleWidth + 'px'];
|
||||
if (_this3.options.indeterminate) {
|
||||
return '-' + _this3._handleWidth / 2 + 'px';
|
||||
}
|
||||
if (state) {
|
||||
if (_this3.options.inverse) {
|
||||
return values[1];
|
||||
} else {
|
||||
return values[0];
|
||||
}
|
||||
} else {
|
||||
if (_this3.options.inverse) {
|
||||
return values[0];
|
||||
} else {
|
||||
return values[1];
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}, {
|
||||
key: '_init',
|
||||
value: function _init() {
|
||||
var _this4 = this;
|
||||
|
||||
var init = function init() {
|
||||
_this4.setPrevOptions();
|
||||
_this4._width();
|
||||
_this4._containerPosition();
|
||||
setTimeout(function () {
|
||||
if (_this4.options.animate) {
|
||||
return _this4.$wrapper.addClass(_this4._getClass('animate'));
|
||||
}
|
||||
}, 50);
|
||||
};
|
||||
if (this.$wrapper.is(':visible')) {
|
||||
init();
|
||||
return;
|
||||
}
|
||||
var initInterval = window.setInterval(function () {
|
||||
if (_this4.$wrapper.is(':visible')) {
|
||||
init();
|
||||
return window.clearInterval(initInterval);
|
||||
}
|
||||
}, 50);
|
||||
}
|
||||
}, {
|
||||
key: '_elementHandlers',
|
||||
value: function _elementHandlers() {
|
||||
var _this5 = this;
|
||||
|
||||
return this.$element.on({
|
||||
'setPreviousOptions.bootstrapSwitch': this.setPrevOptions.bind(this),
|
||||
|
||||
'previousState.bootstrapSwitch': function previousStateBootstrapSwitch() {
|
||||
_this5.options = _this5.prevOptions;
|
||||
if (_this5.options.indeterminate) {
|
||||
_this5.$wrapper.addClass(_this5._getClass('indeterminate'));
|
||||
}
|
||||
_this5.$element.prop('checked', _this5.options.state).trigger('change.bootstrapSwitch', true);
|
||||
},
|
||||
|
||||
'change.bootstrapSwitch': function changeBootstrapSwitch(event, skip) {
|
||||
event.preventDefault();
|
||||
event.stopImmediatePropagation();
|
||||
var state = _this5.$element.is(':checked');
|
||||
_this5._containerPosition(state);
|
||||
if (state === _this5.options.state) {
|
||||
return;
|
||||
}
|
||||
_this5.options.state = state;
|
||||
_this5.$wrapper.toggleClass(_this5._getClass('off')).toggleClass(_this5._getClass('on'));
|
||||
if (!skip) {
|
||||
if (_this5.$element.is(':radio')) {
|
||||
$('[name="' + _this5.$element.attr('name') + '"]').not(_this5.$element).prop('checked', false).trigger('change.bootstrapSwitch', true);
|
||||
}
|
||||
_this5.$element.trigger('switchChange.bootstrapSwitch', [state]);
|
||||
}
|
||||
},
|
||||
|
||||
'focus.bootstrapSwitch': function focusBootstrapSwitch(event) {
|
||||
event.preventDefault();
|
||||
_this5.$wrapper.addClass(_this5._getClass('focused'));
|
||||
},
|
||||
|
||||
'blur.bootstrapSwitch': function blurBootstrapSwitch(event) {
|
||||
event.preventDefault();
|
||||
_this5.$wrapper.removeClass(_this5._getClass('focused'));
|
||||
},
|
||||
|
||||
'keydown.bootstrapSwitch': function keydownBootstrapSwitch(event) {
|
||||
if (!event.which || _this5.options.disabled || _this5.options.readonly) {
|
||||
return;
|
||||
}
|
||||
if (event.which === 37 || event.which === 39) {
|
||||
event.preventDefault();
|
||||
event.stopImmediatePropagation();
|
||||
_this5.state(event.which === 39);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}, {
|
||||
key: '_handleHandlers',
|
||||
value: function _handleHandlers() {
|
||||
var _this6 = this;
|
||||
|
||||
this.$on.on('click.bootstrapSwitch', function (event) {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
_this6.state(false);
|
||||
return _this6.$element.trigger('focus.bootstrapSwitch');
|
||||
});
|
||||
return this.$off.on('click.bootstrapSwitch', function (event) {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
_this6.state(true);
|
||||
return _this6.$element.trigger('focus.bootstrapSwitch');
|
||||
});
|
||||
}
|
||||
}, {
|
||||
key: '_labelHandlers',
|
||||
value: function _labelHandlers() {
|
||||
var _this7 = this;
|
||||
|
||||
var handlers = {
|
||||
click: function click(event) {
|
||||
event.stopPropagation();
|
||||
},
|
||||
|
||||
|
||||
'mousedown.bootstrapSwitch touchstart.bootstrapSwitch': function mousedownBootstrapSwitchTouchstartBootstrapSwitch(event) {
|
||||
if (_this7._dragStart || _this7.options.disabled || _this7.options.readonly) {
|
||||
return;
|
||||
}
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
_this7._dragStart = (event.pageX || event.originalEvent.touches[0].pageX) - parseInt(_this7.$container.css('margin-left'), 10);
|
||||
if (_this7.options.animate) {
|
||||
_this7.$wrapper.removeClass(_this7._getClass('animate'));
|
||||
}
|
||||
_this7.$element.trigger('focus.bootstrapSwitch');
|
||||
},
|
||||
|
||||
'mousemove.bootstrapSwitch touchmove.bootstrapSwitch': function mousemoveBootstrapSwitchTouchmoveBootstrapSwitch(event) {
|
||||
if (_this7._dragStart == null) {
|
||||
return;
|
||||
}
|
||||
var difference = (event.pageX || event.originalEvent.touches[0].pageX) - _this7._dragStart;
|
||||
event.preventDefault();
|
||||
if (difference < -_this7._handleWidth || difference > 0) {
|
||||
return;
|
||||
}
|
||||
_this7._dragEnd = difference;
|
||||
_this7.$container.css('margin-left', _this7._dragEnd + 'px');
|
||||
},
|
||||
|
||||
'mouseup.bootstrapSwitch touchend.bootstrapSwitch': function mouseupBootstrapSwitchTouchendBootstrapSwitch(event) {
|
||||
if (!_this7._dragStart) {
|
||||
return;
|
||||
}
|
||||
event.preventDefault();
|
||||
if (_this7.options.animate) {
|
||||
_this7.$wrapper.addClass(_this7._getClass('animate'));
|
||||
}
|
||||
if (_this7._dragEnd) {
|
||||
var state = _this7._dragEnd > -(_this7._handleWidth / 2);
|
||||
_this7._dragEnd = false;
|
||||
_this7.state(_this7.options.inverse ? !state : state);
|
||||
} else {
|
||||
_this7.state(!_this7.options.state);
|
||||
}
|
||||
_this7._dragStart = false;
|
||||
},
|
||||
|
||||
'mouseleave.bootstrapSwitch': function mouseleaveBootstrapSwitch() {
|
||||
_this7.$label.trigger('mouseup.bootstrapSwitch');
|
||||
}
|
||||
};
|
||||
this.$label.on(handlers);
|
||||
}
|
||||
}, {
|
||||
key: '_externalLabelHandler',
|
||||
value: function _externalLabelHandler() {
|
||||
var _this8 = this;
|
||||
|
||||
var $externalLabel = this.$element.closest('label');
|
||||
$externalLabel.on('click', function (event) {
|
||||
event.preventDefault();
|
||||
event.stopImmediatePropagation();
|
||||
if (event.target === $externalLabel[0]) {
|
||||
_this8.toggleState();
|
||||
}
|
||||
});
|
||||
}
|
||||
}, {
|
||||
key: '_formHandler',
|
||||
value: function _formHandler() {
|
||||
var $form = this.$element.closest('form');
|
||||
if ($form.data('bootstrap-switch')) {
|
||||
return;
|
||||
}
|
||||
$form.on('reset.bootstrapSwitch', function () {
|
||||
window.setTimeout(function () {
|
||||
$form.find('input').filter(function () {
|
||||
return $(this).data('bootstrap-switch');
|
||||
}).each(function () {
|
||||
return $(this).bootstrapSwitch('state', this.checked);
|
||||
});
|
||||
}, 1);
|
||||
}).data('bootstrap-switch', true);
|
||||
}
|
||||
}, {
|
||||
key: '_getClass',
|
||||
value: function _getClass(name) {
|
||||
return this.options.baseClass + '-' + name;
|
||||
}
|
||||
}, {
|
||||
key: '_getClasses',
|
||||
value: function _getClasses(classes) {
|
||||
if (!$.isArray(classes)) {
|
||||
return [this._getClass(classes)];
|
||||
}
|
||||
return classes.map(this._getClass.bind(this));
|
||||
}
|
||||
}]);
|
||||
|
||||
return BootstrapSwitch;
|
||||
}();
|
||||
|
||||
$.fn.bootstrapSwitch = function (option) {
|
||||
for (var _len2 = arguments.length, args = Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
|
||||
args[_key2 - 1] = arguments[_key2];
|
||||
}
|
||||
|
||||
function reducer(ret, next) {
|
||||
var $this = $(next);
|
||||
var existingData = $this.data('bootstrap-switch');
|
||||
var data = existingData || new BootstrapSwitch(next, option);
|
||||
if (!existingData) {
|
||||
$this.data('bootstrap-switch', data);
|
||||
}
|
||||
if (typeof option === 'string') {
|
||||
return data[option].apply(data, args);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
return Array.prototype.reduce.call(this, reducer, this);
|
||||
};
|
||||
$.fn.bootstrapSwitch.Constructor = BootstrapSwitch;
|
||||
$.fn.bootstrapSwitch.defaults = {
|
||||
state: true,
|
||||
size: null,
|
||||
animate: true,
|
||||
disabled: false,
|
||||
readonly: false,
|
||||
indeterminate: false,
|
||||
inverse: false,
|
||||
radioAllOff: false,
|
||||
onColor: 'primary',
|
||||
offColor: 'default',
|
||||
onText: 'ON',
|
||||
offText: 'OFF',
|
||||
labelText: ' ',
|
||||
handleWidth: 'auto',
|
||||
labelWidth: 'auto',
|
||||
baseClass: 'bootstrap-switch',
|
||||
wrapperClass: 'wrapper',
|
||||
onInit: function onInit() {},
|
||||
onSwitchChange: function onSwitchChange() {}
|
||||
};
|
||||
});
|
||||
10
hal-core/resources/web/js/lib/bootstrap-switch.min.js
vendored
Normal file
10
hal-core/resources/web/js/lib/bootstrap-switch.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
2377
hal-core/resources/web/js/lib/bootstrap.js
vendored
Normal file
2377
hal-core/resources/web/js/lib/bootstrap.js
vendored
Normal file
File diff suppressed because it is too large
Load diff
7
hal-core/resources/web/js/lib/bootstrap.min.js
vendored
Normal file
7
hal-core/resources/web/js/lib/bootstrap.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
20
hal-core/resources/web/js/lib/c3.LICENSE
Normal file
20
hal-core/resources/web/js/lib/c3.LICENSE
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2013 Masayuki Tanaka
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
8202
hal-core/resources/web/js/lib/c3.js
vendored
Normal file
8202
hal-core/resources/web/js/lib/c3.js
vendored
Normal file
File diff suppressed because it is too large
Load diff
6
hal-core/resources/web/js/lib/c3.min.js
vendored
Normal file
6
hal-core/resources/web/js/lib/c3.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
13
hal-core/resources/web/js/lib/d3.LICENSE
Normal file
13
hal-core/resources/web/js/lib/d3.LICENSE
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
Copyright 2010-2021 Mike Bostock
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any purpose
|
||||
with or without fee is hereby granted, provided that the above copyright notice
|
||||
and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
||||
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
||||
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
|
||||
OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
||||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
|
||||
THIS SOFTWARE.
|
||||
9554
hal-core/resources/web/js/lib/d3.js
vendored
Normal file
9554
hal-core/resources/web/js/lib/d3.js
vendored
Normal file
File diff suppressed because it is too large
Load diff
5
hal-core/resources/web/js/lib/jquery-1.11.3.min.js
vendored
Normal file
5
hal-core/resources/web/js/lib/jquery-1.11.3.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
991
hal-core/resources/web/js/lib/jquery.filer.js
vendored
Normal file
991
hal-core/resources/web/js/lib/jquery.filer.js
vendored
Normal file
|
|
@ -0,0 +1,991 @@
|
|||
/*!
|
||||
* jQuery.filer
|
||||
* Copyright (c) 2015 CreativeDream
|
||||
* Website: https://github.com/CreativeDream/jquery.filer
|
||||
* Version: 1.0.5 (19-Nov-2015)
|
||||
* Requires: jQuery v1.7.1 or later
|
||||
*/
|
||||
(function($) {
|
||||
"use strict";
|
||||
$.fn.filer = function(q) {
|
||||
return this.each(function(t, r) {
|
||||
var s = $(r),
|
||||
b = '.jFiler',
|
||||
p = $(),
|
||||
o = $(),
|
||||
l = $(),
|
||||
sl = [],
|
||||
n_f = $.isFunction(q) ? q(s, $.fn.filer.defaults) : q,
|
||||
n = n_f && $.isPlainObject(n_f) ? $.extend(true, {}, $.fn.filer.defaults, n_f) : $.fn.filer.defaults,
|
||||
f = {
|
||||
init: function() {
|
||||
s.wrap('<div class="jFiler"></div>');
|
||||
f._set('props');
|
||||
s.prop("jFiler").boxEl = p = s.closest(b);
|
||||
f._changeInput();
|
||||
},
|
||||
_bindInput: function() {
|
||||
if(n.changeInput && o.size() > 0) {
|
||||
o.bind("click", f._clickHandler);
|
||||
}
|
||||
s.on({
|
||||
"focus": function() {
|
||||
o.addClass('focused');
|
||||
},
|
||||
"blur": function() {
|
||||
o.removeClass('focused');
|
||||
},
|
||||
"change": function() {
|
||||
f._onChange();
|
||||
}
|
||||
});
|
||||
if(n.dragDrop) {
|
||||
(o.length > 0 ? o : s)
|
||||
.bind("drop", f._dragDrop.drop)
|
||||
.bind("dragover", f._dragDrop.dragEnter)
|
||||
.bind("dragleave", f._dragDrop.dragLeave);
|
||||
}
|
||||
if(n.uploadFile && n.clipBoardPaste) {
|
||||
$(window)
|
||||
.on("paste", f._clipboardPaste);
|
||||
}
|
||||
},
|
||||
_unbindInput: function() {
|
||||
if(n.changeInput && o.size() > 0) {
|
||||
o.unbind("click", f._clickHandler);
|
||||
}
|
||||
},
|
||||
_clickHandler: function() {
|
||||
s.click()
|
||||
},
|
||||
_applyAttrSettings: function() {
|
||||
var d = ["name", "limit", "maxSize", "extensions", "changeInput", "showThumbs", "appendTo", "theme", "addMore", "excludeName", "files", "uploadUrl", "uploadData", "options"];
|
||||
for(var k in d) {
|
||||
var j = "data-jfiler-" + d[k];
|
||||
if(f._assets.hasAttr(j)) {
|
||||
switch(d[k]) {
|
||||
case "changeInput":
|
||||
case "showThumbs":
|
||||
case "addMore":
|
||||
n[d[k]] = (["true", "false"].indexOf(s.attr(j)) > -1 ? s.attr(j) == "true" : s.attr(j));
|
||||
break;
|
||||
case "extensions":
|
||||
n[d[k]] = s.attr(j)
|
||||
.replace(/ /g, '')
|
||||
.split(",");
|
||||
break;
|
||||
case "uploadUrl":
|
||||
if(n.uploadFile) n.uploadFile.url = s.attr(j);
|
||||
break;
|
||||
case "uploadData":
|
||||
if(n.uploadFile) n.uploadFile.data = JSON.parse(s.attr(j));
|
||||
break;
|
||||
case "files":
|
||||
case "options":
|
||||
n[d[k]] = JSON.parse(s.attr(j));
|
||||
break;
|
||||
default:
|
||||
n[d[k]] = s.attr(j);
|
||||
}
|
||||
s.removeAttr(j);
|
||||
}
|
||||
}
|
||||
},
|
||||
_changeInput: function() {
|
||||
f._applyAttrSettings();
|
||||
n.beforeRender != null && typeof n.beforeRender == "function" ? n.beforeRender(p, s) : null;
|
||||
if(n.theme) {
|
||||
p.addClass('jFiler-theme-' + n.theme);
|
||||
}
|
||||
if(s.get(0)
|
||||
.tagName.toLowerCase() != "input" && s.get(0)
|
||||
.type != "file") {
|
||||
o = s;
|
||||
s = $("<input type=\"file\" name=\"" + n.name + "\" />");
|
||||
s.css({
|
||||
position: "absolute",
|
||||
left: "-9999px",
|
||||
top: "-9999px",
|
||||
"z-index": "-9999"
|
||||
});
|
||||
p.prepend(s);
|
||||
f._isGn = s;
|
||||
} else {
|
||||
if(n.changeInput) {
|
||||
switch(typeof n.changeInput) {
|
||||
case "boolean":
|
||||
o = $('<div class="jFiler-input"><div class="jFiler-input-caption"><span>' + n.captions.feedback + '</span></div><div class="jFiler-input-button">' + n.captions.button + '</div></div>"');
|
||||
break;
|
||||
case "string":
|
||||
case "object":
|
||||
o = $(n.changeInput);
|
||||
break;
|
||||
case "function":
|
||||
o = $(n.changeInput(p, s, n));
|
||||
break;
|
||||
}
|
||||
s.after(o);
|
||||
s.css({
|
||||
position: "absolute",
|
||||
left: "-9999px",
|
||||
top: "-9999px",
|
||||
"z-index": "-9999"
|
||||
});
|
||||
}
|
||||
}
|
||||
s.prop("jFiler").newInputEl = o;
|
||||
if(!n.limit || (n.limit && n.limit >= 2)) {
|
||||
s.attr("multiple", "multiple");
|
||||
s.attr("name")
|
||||
.slice(-2) != "[]" ? s.attr("name", s.attr("name") + "[]") : null;
|
||||
}
|
||||
f._bindInput();
|
||||
if(n.files) {
|
||||
f._append(false, {
|
||||
files: n.files
|
||||
});
|
||||
}
|
||||
n.afterRender != null && typeof n.afterRender == "function" ? n.afterRender(l, p, o, s) : null;
|
||||
},
|
||||
_clear: function() {
|
||||
f.files = null;
|
||||
s.prop("jFiler")
|
||||
.files = null;
|
||||
if(!n.uploadFile && !n.addMore) {
|
||||
f._reset();
|
||||
}
|
||||
f._set('feedback', (f._itFl && f._itFl.length > 0 ? f._itFl.length + ' ' + n.captions.feedback2 : n.captions.feedback));
|
||||
n.onEmpty != null && typeof n.onEmpty == "function" ? n.onEmpty(p, o, s) : null
|
||||
},
|
||||
_reset: function(a) {
|
||||
if(!a) {
|
||||
if(!n.uploadFile && n.addMore) {
|
||||
for(var i = 0; i < sl.length; i++) {
|
||||
sl[i].remove();
|
||||
}
|
||||
sl = [];
|
||||
f._unbindInput();
|
||||
if(f._isGn) {
|
||||
s = f._isGn;
|
||||
} else {
|
||||
s = $(r);
|
||||
}
|
||||
f._bindInput();
|
||||
}
|
||||
f._set('input', '');
|
||||
}
|
||||
f._itFl = [];
|
||||
f._itFc = null;
|
||||
f._ajFc = 0;
|
||||
f._set('props');
|
||||
s.prop("jFiler")
|
||||
.files_list = f._itFl;
|
||||
s.prop("jFiler")
|
||||
.current_file = f._itFc;
|
||||
if(!f._prEr) {
|
||||
f._itFr = [];
|
||||
p.find("input[name^='jfiler-items-exclude-']:hidden")
|
||||
.remove();
|
||||
}
|
||||
l.fadeOut("fast", function() {
|
||||
$(this)
|
||||
.remove();
|
||||
});
|
||||
s.prop("jFiler").listEl = l = $();
|
||||
},
|
||||
_set: function(element, value) {
|
||||
switch(element) {
|
||||
case 'input':
|
||||
s.val("");
|
||||
break;
|
||||
case 'feedback':
|
||||
if(o.length > 0) {
|
||||
o.find('.jFiler-input-caption span')
|
||||
.html(value);
|
||||
}
|
||||
break;
|
||||
case 'props':
|
||||
if(!s.prop("jFiler")){
|
||||
s.prop("jFiler", {
|
||||
options: n,
|
||||
listEl: l,
|
||||
boxEl: p,
|
||||
newInputEl: o,
|
||||
inputEl: s,
|
||||
files: f.files,
|
||||
files_list: f._itFl,
|
||||
current_file: f._itFc,
|
||||
append: function(data) {
|
||||
return f._append(false, {
|
||||
files: [data]
|
||||
});
|
||||
},
|
||||
remove: function(id) {
|
||||
f._remove(null, {
|
||||
binded: true,
|
||||
data: {
|
||||
id: id
|
||||
}
|
||||
});
|
||||
return true;
|
||||
},
|
||||
reset: function() {
|
||||
f._reset();
|
||||
f._clear();
|
||||
return true;
|
||||
},
|
||||
retry: function(data) {
|
||||
return f._retryUpload(data);
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
},
|
||||
_filesCheck: function() {
|
||||
var s = 0;
|
||||
if(n.limit && f.files.length + f._itFl.length > n.limit) {
|
||||
alert(f._assets.textParse(n.captions.errors.filesLimit));
|
||||
return false
|
||||
}
|
||||
for(var t = 0; t < f.files.length; t++) {
|
||||
var x = f.files[t].name.split(".")
|
||||
.pop()
|
||||
.toLowerCase(),
|
||||
file = f.files[t],
|
||||
m = {
|
||||
name: file.name,
|
||||
size: file.size,
|
||||
size2: f._assets.bytesToSize(file.size),
|
||||
type: file.type,
|
||||
ext: x
|
||||
};
|
||||
if(n.extensions != null && $.inArray(x, n.extensions) == -1) {
|
||||
alert(f._assets.textParse(n.captions.errors.filesType, m));
|
||||
return false;
|
||||
break
|
||||
}
|
||||
if(n.maxSize != null && f.files[t].size > n.maxSize * 1048576) {
|
||||
alert(f._assets.textParse(n.captions.errors.filesSize, m));
|
||||
return false;
|
||||
break
|
||||
}
|
||||
if(file.size == 4096 && file.type.length == 0) {
|
||||
return false;
|
||||
break
|
||||
}
|
||||
s += f.files[t].size
|
||||
}
|
||||
if(n.maxSize != null && s >= Math.round(n.maxSize * 1048576)) {
|
||||
alert(f._assets.textParse(n.captions.errors.filesSizeAll));
|
||||
return false
|
||||
}
|
||||
if((n.addMore || n.uploadFile)) {
|
||||
var m = f._itFl.filter(function(a, b) {
|
||||
if(a.file.name == file.name && a.file.size == file.size && a.file.type == file.type && (file.lastModified ? a.file.lastModified == file.lastModified : true)) {
|
||||
return true;
|
||||
}
|
||||
});
|
||||
if(m.length > 0) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
return true;
|
||||
},
|
||||
_thumbCreator: {
|
||||
create: function(i) {
|
||||
var file = f.files[i],
|
||||
id = (f._itFc ? f._itFc.id : i),
|
||||
name = file.name,
|
||||
size = file.size,
|
||||
type = file.type.split("/", 1)
|
||||
.toString()
|
||||
.toLowerCase(),
|
||||
ext = name.indexOf(".") != -1 ? name.split(".")
|
||||
.pop()
|
||||
.toLowerCase() : "",
|
||||
progressBar = n.uploadFile ? '<div class="jFiler-jProgressBar">' + n.templates.progressBar + '</div>' : '',
|
||||
opts = {
|
||||
id: id,
|
||||
name: name,
|
||||
size: size,
|
||||
size2: f._assets.bytesToSize(size),
|
||||
type: type,
|
||||
extension: ext,
|
||||
icon: f._assets.getIcon(ext, type),
|
||||
icon2: f._thumbCreator.generateIcon({
|
||||
type: type,
|
||||
extension: ext
|
||||
}),
|
||||
image: '<div class="jFiler-item-thumb-image fi-loading"></div>',
|
||||
progressBar: progressBar,
|
||||
_appended: file._appended
|
||||
},
|
||||
html = "";
|
||||
if(file.opts) {
|
||||
opts = $.extend({}, file.opts, opts);
|
||||
}
|
||||
html = $(f._thumbCreator.renderContent(opts))
|
||||
.attr("data-jfiler-index", id);
|
||||
html.get(0)
|
||||
.jfiler_id = id;
|
||||
f._thumbCreator.renderFile(file, html, opts);
|
||||
if(file.forList) {
|
||||
return html;
|
||||
}
|
||||
f._itFc.html = html;
|
||||
html.hide()[n.templates.itemAppendToEnd ? "appendTo" : "prependTo"](l.find(n.templates._selectors.list))
|
||||
.show();
|
||||
if(!file._appended) {
|
||||
f._onSelect(i);
|
||||
}
|
||||
},
|
||||
renderContent: function(opts) {
|
||||
return f._assets.textParse((opts._appended ? n.templates.itemAppend : n.templates.item), opts);
|
||||
},
|
||||
renderFile: function(file, html, opts) {
|
||||
if(html.find('.jFiler-item-thumb-image')
|
||||
.size() == 0) {
|
||||
return false;
|
||||
}
|
||||
if(file.file && opts.type == "image") {
|
||||
var g = '<img src="' + file.file + '" draggable="false" />',
|
||||
m = html.find('.jFiler-item-thumb-image.fi-loading');
|
||||
$(g)
|
||||
.error(function() {
|
||||
g = f._thumbCreator.generateIcon(opts);
|
||||
html.addClass('jFiler-no-thumbnail');
|
||||
m.removeClass('fi-loading')
|
||||
.html(g);
|
||||
})
|
||||
.load(function() {
|
||||
m.removeClass('fi-loading')
|
||||
.html(g);
|
||||
});
|
||||
return true;
|
||||
}
|
||||
if(window.File && window.FileList && window.FileReader && opts.type == "image" && opts.size < 6e+6) {
|
||||
var y = new FileReader;
|
||||
y.onload = function(e) {
|
||||
var g = '<img src="' + e.target.result + '" draggable="false" />',
|
||||
m = html.find('.jFiler-item-thumb-image.fi-loading');
|
||||
$(g)
|
||||
.error(function() {
|
||||
g = f._thumbCreator.generateIcon(opts);
|
||||
html.addClass('jFiler-no-thumbnail');
|
||||
m.removeClass('fi-loading')
|
||||
.html(g);
|
||||
})
|
||||
.load(function() {
|
||||
m.removeClass('fi-loading')
|
||||
.html(g);
|
||||
});
|
||||
};
|
||||
y.readAsDataURL(file);
|
||||
} else {
|
||||
var g = f._thumbCreator.generateIcon(opts),
|
||||
m = html.find('.jFiler-item-thumb-image.fi-loading');
|
||||
html.addClass('jFiler-no-thumbnail');
|
||||
m.removeClass('fi-loading')
|
||||
.html(g);
|
||||
}
|
||||
},
|
||||
generateIcon: function(obj) {
|
||||
var m = new Array(3);
|
||||
if(obj && obj.type && obj.extension) {
|
||||
switch(obj.type) {
|
||||
case "image":
|
||||
m[0] = "f-image";
|
||||
m[1] = "<i class=\"icon-jfi-file-image\"></i>"
|
||||
break;
|
||||
case "video":
|
||||
m[0] = "f-video";
|
||||
m[1] = "<i class=\"icon-jfi-file-video\"></i>"
|
||||
break;
|
||||
case "audio":
|
||||
m[0] = "f-audio";
|
||||
m[1] = "<i class=\"icon-jfi-file-audio\"></i>"
|
||||
break;
|
||||
default:
|
||||
m[0] = "f-file f-file-ext-" + obj.extension;
|
||||
m[1] = (obj.extension.length > 0 ? "." + obj.extension : "");
|
||||
m[2] = 1
|
||||
}
|
||||
} else {
|
||||
m[0] = "f-file";
|
||||
m[1] = (obj.extension && obj.extension.length > 0 ? "." + obj.extension : "");
|
||||
m[2] = 1
|
||||
}
|
||||
var el = '<span class="jFiler-icon-file ' + m[0] + '">' + m[1] + '</span>';
|
||||
if(m[2] == 1) {
|
||||
var c = f._assets.text2Color(obj.extension);
|
||||
if(c) {
|
||||
var j = $(el)
|
||||
.appendTo("body"),
|
||||
h = j.css("box-shadow");
|
||||
h = c + h.substring(h.replace(/^.*(rgba?\([^)]+\)).*$/, '$1')
|
||||
.length, h.length);
|
||||
j.css({
|
||||
'-webkit-box-shadow': h,
|
||||
'-moz-box-shadow': h,
|
||||
'box-shadow': h
|
||||
})
|
||||
.attr('style', '-webkit-box-shadow: ' + h + '; -moz-box-shadow: ' + h + '; box-shadow: ' + h + ';');
|
||||
el = j.prop('outerHTML');
|
||||
j.remove();
|
||||
}
|
||||
}
|
||||
return el;
|
||||
},
|
||||
_box: function(params) {
|
||||
if(n.beforeShow != null && typeof n.beforeShow == "function" ? !n.beforeShow(f.files, l, p, o, s) : false) {
|
||||
return false
|
||||
}
|
||||
if(l.length < 1) {
|
||||
if(n.appendTo) {
|
||||
var appendTo = $(n.appendTo);
|
||||
} else {
|
||||
var appendTo = p;
|
||||
}
|
||||
appendTo.find('.jFiler-items')
|
||||
.remove();
|
||||
l = $('<div class="jFiler-items jFiler-row"></div>');
|
||||
s.prop("jFiler").listEl = l;
|
||||
l.append(f._assets.textParse(n.templates.box))
|
||||
.appendTo(appendTo);
|
||||
l.on('click', n.templates._selectors.remove, function(e) {
|
||||
e.preventDefault();
|
||||
var cf = n.templates.removeConfirmation ? confirm(n.captions.removeConfirmation) : true;
|
||||
if(cf) {
|
||||
f._remove(params ? params.remove.event : e, params ? params.remove.el : $(this)
|
||||
.closest(n.templates._selectors.item));
|
||||
}
|
||||
});
|
||||
}
|
||||
for(var i = 0; i < f.files.length; i++) {
|
||||
if(!f.files[i]._appended) f.files[i]._choosed = true;
|
||||
f._addToMemory(i);
|
||||
f._thumbCreator.create(i);
|
||||
}
|
||||
}
|
||||
},
|
||||
_upload: function(i) {
|
||||
var el = f._itFc.html,
|
||||
formData = new FormData();
|
||||
formData.append(s.attr('name'), f._itFc.file, (f._itFc.file.name ? f._itFc.file.name : false));
|
||||
if(n.uploadFile.data != null && $.isPlainObject(n.uploadFile.data)) {
|
||||
for(var k in n.uploadFile.data) {
|
||||
formData.append(k, n.uploadFile.data[k])
|
||||
}
|
||||
}
|
||||
f._ajax.send(el, formData, f._itFc);
|
||||
},
|
||||
_ajax: {
|
||||
send: function(el, formData, c) {
|
||||
c.ajax = $.ajax({
|
||||
url: n.uploadFile.url,
|
||||
data: formData,
|
||||
type: n.uploadFile.type,
|
||||
enctype: n.uploadFile.enctype,
|
||||
xhr: function() {
|
||||
var myXhr = $.ajaxSettings.xhr();
|
||||
if(myXhr.upload) {
|
||||
myXhr.upload.addEventListener("progress", function(e) {
|
||||
f._ajax.progressHandling(e, el)
|
||||
}, false)
|
||||
}
|
||||
return myXhr
|
||||
},
|
||||
complete: function(jqXHR, textStatus) {
|
||||
c.ajax = false;
|
||||
f._ajFc++;
|
||||
if(f._ajFc >= f.files.length) {
|
||||
f._ajFc = 0;
|
||||
n.uploadFile.onComplete != null && typeof n.uploadFile.onComplete == "function" ? n.uploadFile.onComplete(l, p, o, s, jqXHR, textStatus) : null;
|
||||
}
|
||||
},
|
||||
beforeSend: function(jqXHR, settings) {
|
||||
return n.uploadFile.beforeSend != null && typeof n.uploadFile.beforeSend == "function" ? n.uploadFile.beforeSend(el, l, p, o, s, c.id, jqXHR, settings) : true;
|
||||
},
|
||||
success: function(data, textStatus, jqXHR) {
|
||||
c.uploaded = true;
|
||||
n.uploadFile.success != null && typeof n.uploadFile.success == "function" ? n.uploadFile.success(data, el, l, p, o, s, c.id, textStatus, jqXHR) : null
|
||||
},
|
||||
error: function(jqXHR, textStatus, errorThrown) {
|
||||
c.uploaded = false;
|
||||
n.uploadFile.error != null && typeof n.uploadFile.error == "function" ? n.uploadFile.error(el, l, p, o, s, c.id, jqXHR, textStatus, errorThrown) : null
|
||||
},
|
||||
statusCode: n.uploadFile.statusCode,
|
||||
cache: false,
|
||||
contentType: false,
|
||||
processData: false
|
||||
});
|
||||
return c.ajax;
|
||||
},
|
||||
progressHandling: function(e, el) {
|
||||
if(e.lengthComputable) {
|
||||
var t = Math.round(e.loaded * 100 / e.total)
|
||||
.toString();
|
||||
n.uploadFile.onProgress != null && typeof n.uploadFile.onProgress == "function" ? n.uploadFile.onProgress(t, el, l, p, o, s) : null;
|
||||
el.find('.jFiler-jProgressBar')
|
||||
.find(n.templates._selectors.progressBar)
|
||||
.css("width", t + "%")
|
||||
}
|
||||
}
|
||||
},
|
||||
_dragDrop: {
|
||||
dragEnter: function(e) {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
p.addClass('dragged');
|
||||
f._set('feedback', n.captions.drop);
|
||||
n.dragDrop.dragEnter != null && typeof n.dragDrop.dragEnter == "function" ? n.dragDrop.dragEnter(e, o, s, p) : null;
|
||||
},
|
||||
dragLeave: function(e) {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
if(!f._dragDrop._dragLeaveCheck(e)) {
|
||||
return false
|
||||
}
|
||||
p.removeClass('dragged');
|
||||
f._set('feedback', n.captions.feedback);
|
||||
n.dragDrop.dragLeave != null && typeof n.dragDrop.dragLeave == "function" ? n.dragDrop.dragLeave(e, o, s, p) : null;
|
||||
},
|
||||
drop: function(e) {
|
||||
e.preventDefault();
|
||||
p.removeClass('dragged');
|
||||
f._set('feedback', n.captions.feedback);
|
||||
if(e && e.originalEvent && e.originalEvent.dataTransfer && e.originalEvent.dataTransfer.files && e.originalEvent.dataTransfer.files.length > 0) {
|
||||
f._onChange(e, e.originalEvent.dataTransfer.files);
|
||||
}
|
||||
n.dragDrop.drop != null && typeof n.dragDrop.drop == "function" ? n.dragDrop.drop(e.originalEvent.dataTransfer.files, e, o, s, p) : null;
|
||||
},
|
||||
_dragLeaveCheck: function(e) {
|
||||
var related = e.relatedTarget,
|
||||
inside = false;
|
||||
if(related !== o) {
|
||||
if(related) {
|
||||
inside = $.contains(o, related);
|
||||
}
|
||||
if(inside) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
},
|
||||
_clipboardPaste: function(e, fromDrop) {
|
||||
if(!fromDrop && (!e.originalEvent.clipboardData && !e.originalEvent.clipboardData.items)) {
|
||||
return
|
||||
}
|
||||
if(fromDrop && (!e.originalEvent.dataTransfer && !e.originalEvent.dataTransfer.items)) {
|
||||
return
|
||||
}
|
||||
if(f._clPsePre) {
|
||||
return
|
||||
}
|
||||
var items = (fromDrop ? e.originalEvent.dataTransfer.items : e.originalEvent.clipboardData.items),
|
||||
b64toBlob = function(b64Data, contentType, sliceSize) {
|
||||
contentType = contentType || '';
|
||||
sliceSize = sliceSize || 512;
|
||||
var byteCharacters = atob(b64Data);
|
||||
var byteArrays = [];
|
||||
for(var offset = 0; offset < byteCharacters.length; offset += sliceSize) {
|
||||
var slice = byteCharacters.slice(offset, offset + sliceSize);
|
||||
var byteNumbers = new Array(slice.length);
|
||||
for(var i = 0; i < slice.length; i++) {
|
||||
byteNumbers[i] = slice.charCodeAt(i);
|
||||
}
|
||||
var byteArray = new Uint8Array(byteNumbers);
|
||||
byteArrays.push(byteArray);
|
||||
}
|
||||
var blob = new Blob(byteArrays, {
|
||||
type: contentType
|
||||
});
|
||||
return blob;
|
||||
};
|
||||
if(items) {
|
||||
for(var i = 0; i < items.length; i++) {
|
||||
if(items[i].type.indexOf("image") !== -1 || items[i].type.indexOf("text/uri-list") !== -1) {
|
||||
if(fromDrop) {
|
||||
try {
|
||||
window.atob(e.originalEvent.dataTransfer.getData("text/uri-list")
|
||||
.toString()
|
||||
.split(',')[1]);
|
||||
} catch(e) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
var blob = (fromDrop ? b64toBlob(e.originalEvent.dataTransfer.getData("text/uri-list")
|
||||
.toString()
|
||||
.split(',')[1], "image/png") : items[i].getAsFile());
|
||||
blob.name = Math.random()
|
||||
.toString(36)
|
||||
.substring(5);
|
||||
blob.name += blob.type.indexOf("/") != -1 ? "." + blob.type.split("/")[1].toString()
|
||||
.toLowerCase() : ".png";
|
||||
f._onChange(e, [blob]);
|
||||
f._clPsePre = setTimeout(function() {
|
||||
delete f._clPsePre
|
||||
}, 1000);
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
_onSelect: function(i) {
|
||||
if(n.uploadFile && !$.isEmptyObject(n.uploadFile)) {
|
||||
f._upload(i)
|
||||
}
|
||||
n.onSelect != null && typeof n.onSelect == "function" ? n.onSelect(f.files[i], f._itFc.html, l, p, o, s) : null;
|
||||
if(i + 1 >= f.files.length) {
|
||||
n.afterShow != null && typeof n.afterShow == "function" ? n.afterShow(l, p, o, s) : null
|
||||
}
|
||||
},
|
||||
_onChange: function(e, d) {
|
||||
if(!d) {
|
||||
if(!s.get(0)
|
||||
.files || typeof s.get(0)
|
||||
.files == "undefined" || s.get(0)
|
||||
.files.length == 0) {
|
||||
if(!n.uploadFile && !n.addMore) {
|
||||
f._set('input', '');
|
||||
f._clear();
|
||||
}
|
||||
return false
|
||||
}
|
||||
f.files = s.get(0)
|
||||
.files;
|
||||
} else {
|
||||
if(!d || d.length == 0) {
|
||||
f._set('input', '');
|
||||
f._clear();
|
||||
return false
|
||||
}
|
||||
f.files = d;
|
||||
}
|
||||
if(!n.uploadFile && !n.addMore) {
|
||||
f._reset(true);
|
||||
}
|
||||
s.prop("jFiler")
|
||||
.files = f.files;
|
||||
if(!f._filesCheck() || (n.beforeSelect != null && typeof n.beforeSelect == "function" ? !n.beforeSelect(f.files, l, p, o, s) : false)) {
|
||||
f._set('input', '');
|
||||
f._clear();
|
||||
return false
|
||||
}
|
||||
f._set('feedback', f.files.length + f._itFl.length + ' ' + n.captions.feedback2);
|
||||
if(n.showThumbs) {
|
||||
f._thumbCreator._box();
|
||||
} else {
|
||||
for(var i = 0; i < f.files.length; i++) {
|
||||
f.files[i]._choosed = true;
|
||||
f._addToMemory(i);
|
||||
f._onSelect(i);
|
||||
}
|
||||
}
|
||||
if(!n.uploadFile && n.addMore) {
|
||||
var elem = $('<input type="file" />');
|
||||
var attributes = s.prop("attributes");
|
||||
$.each(attributes, function() {
|
||||
elem.attr(this.name, this.value);
|
||||
});
|
||||
s.after(elem);
|
||||
f._unbindInput();
|
||||
sl.push(elem);
|
||||
s = elem;
|
||||
f._bindInput();
|
||||
f._set('props');
|
||||
}
|
||||
},
|
||||
_append: function(e, data) {
|
||||
var files = (!data ? false : data.files);
|
||||
if(!files || files.length <= 0) {
|
||||
return;
|
||||
}
|
||||
f.files = files;
|
||||
s.prop("jFiler")
|
||||
.files = f.files;
|
||||
if(n.showThumbs) {
|
||||
for(var i = 0; i < f.files.length; i++) {
|
||||
f.files[i]._appended = true;
|
||||
}
|
||||
f._thumbCreator._box();
|
||||
}
|
||||
},
|
||||
_getList: function(e, data) {
|
||||
var files = (!data ? false : data.files);
|
||||
if(!files || files.length <= 0) {
|
||||
return;
|
||||
}
|
||||
f.files = files;
|
||||
s.prop("jFiler")
|
||||
.files = f.files;
|
||||
if(n.showThumbs) {
|
||||
var returnData = [];
|
||||
for(var i = 0; i < f.files.length; i++) {
|
||||
f.files[i].forList = true;
|
||||
returnData.push(f._thumbCreator.create(i));
|
||||
}
|
||||
if(data.callback) {
|
||||
data.callback(returnData, l, p, o, s);
|
||||
}
|
||||
}
|
||||
},
|
||||
_retryUpload: function(e, data) {
|
||||
var id = parseInt(typeof data == "object" ? data.attr("data-jfiler-index") : data),
|
||||
obj = f._itFl.filter(function(value, key) {
|
||||
return value.id == id;
|
||||
});
|
||||
if(obj.length > 0) {
|
||||
if(n.uploadFile && !$.isEmptyObject(n.uploadFile) && !obj[0].uploaded) {
|
||||
f._itFc = obj[0];
|
||||
s.prop("jFiler")
|
||||
.current_file = f._itFc;
|
||||
f._upload(id);
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
},
|
||||
_remove: function(e, el) {
|
||||
if(el.binded) {
|
||||
if(typeof(el.data.id) != "undefined") {
|
||||
el = l.find(n.templates._selectors.item + "[data-jfiler-index='" + el.data.id + "']");
|
||||
if(el.size() == 0) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
if(el.data.el) {
|
||||
el = el.data.el;
|
||||
}
|
||||
}
|
||||
var attrId = el.get(0)
|
||||
.jfiler_id || el.attr('data-jfiler-index'),
|
||||
id = null,
|
||||
excl_input = function(id) {
|
||||
var input = p.find("input[name^='jfiler-items-exclude-']:hidden")
|
||||
.first(),
|
||||
item = f._itFl[id],
|
||||
val = [];
|
||||
if(input.size() == 0) {
|
||||
input = $('<input type="hidden" name="jfiler-items-exclude-' + (n.excludeName ? n.excludeName : (s.attr("name")
|
||||
.slice(-2) != "[]" ? s.attr("name") : s.attr("name")
|
||||
.substring(0, s.attr("name")
|
||||
.length - 2)) + "-" + t) + '">');
|
||||
input.appendTo(p);
|
||||
}
|
||||
if(item.file._choosed || item.file._appended || item.uploaded) {
|
||||
f._prEr = true;
|
||||
f._itFr.push(item);
|
||||
if(n.addMore) {
|
||||
var current_input = item.input,
|
||||
count_same_input = 0;
|
||||
f._itFl.filter(function(val, index) {
|
||||
if(val.file._choosed && val.input.get(0) == current_input.get(0)) count_same_input++;
|
||||
});
|
||||
if(count_same_input == 1) {
|
||||
f._itFr = f._itFr.filter(function(val, index) {
|
||||
return val.file._choosed ? val.input.get(0) != current_input.get(0) : true;
|
||||
});
|
||||
current_input.val("");
|
||||
f._prEr = false;
|
||||
}
|
||||
}
|
||||
for(var i = 0; i < f._itFr.length; i++) {
|
||||
val.push(f._itFr[i].file.name);
|
||||
}
|
||||
val = JSON.stringify(val);
|
||||
input.val(val);
|
||||
}
|
||||
},
|
||||
callback = function(el, id) {
|
||||
excl_input(id);
|
||||
f._itFl.splice(id, 1);
|
||||
if(f._itFl.length < 1) {
|
||||
f._reset();
|
||||
f._clear();
|
||||
} else {
|
||||
f._set('feedback', f._itFl.length + ' ' + n.captions.feedback2);
|
||||
}
|
||||
el.fadeOut("fast", function() {
|
||||
$(this)
|
||||
.remove();
|
||||
});
|
||||
};
|
||||
for(var key in f._itFl) {
|
||||
if(key === 'length' || !f._itFl.hasOwnProperty(key)) continue;
|
||||
if(f._itFl[key].id == attrId) {
|
||||
id = key;
|
||||
}
|
||||
}
|
||||
if(!f._itFl.hasOwnProperty(id)) {
|
||||
return false
|
||||
}
|
||||
if(f._itFl[id].ajax) {
|
||||
f._itFl[id].ajax.abort();
|
||||
callback(el, id);
|
||||
return;
|
||||
}
|
||||
n.onRemove != null && typeof n.onRemove == "function" ? n.onRemove(el, f._itFl[id].file, id, l, p, o, s) : null;
|
||||
callback(el, id);
|
||||
},
|
||||
_addToMemory: function(i) {
|
||||
f._itFl.push({
|
||||
id: f._itFl.length,
|
||||
file: f.files[i],
|
||||
html: $(),
|
||||
ajax: false,
|
||||
uploaded: false,
|
||||
});
|
||||
if(n.addMore && !f.files[i]._appended) f._itFl[f._itFl.length - 1].input = s;
|
||||
f._itFc = f._itFl[f._itFl.length - 1];
|
||||
s.prop("jFiler")
|
||||
.files_list = f._itFl;
|
||||
s.prop("jFiler")
|
||||
.current_file = f._itFc;
|
||||
},
|
||||
_assets: {
|
||||
bytesToSize: function(bytes) {
|
||||
if(bytes == 0) return '0 Byte';
|
||||
var k = 1000;
|
||||
var sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];
|
||||
var i = Math.floor(Math.log(bytes) / Math.log(k));
|
||||
return(bytes / Math.pow(k, i))
|
||||
.toPrecision(3) + ' ' + sizes[i];
|
||||
},
|
||||
hasAttr: function(attr, el) {
|
||||
var el = (!el ? s : el),
|
||||
a = el.attr(attr);
|
||||
if(!a || typeof a == "undefined") {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
},
|
||||
getIcon: function(ext, type) {
|
||||
var types = ["audio", "image", "text", "video"];
|
||||
if($.inArray(type, types) > -1) {
|
||||
return '<i class="icon-jfi-file-' + type + ' jfi-file-ext-' + ext + '"></i>';
|
||||
}
|
||||
return '<i class="icon-jfi-file-o jfi-file-type-' + type + ' jfi-file-ext-' + ext + '"></i>';
|
||||
},
|
||||
textParse: function(text, opts) {
|
||||
opts = $.extend({}, {
|
||||
limit: n.limit,
|
||||
maxSize: n.maxSize,
|
||||
extensions: n.extensions ? n.extensions.join(',') : null,
|
||||
}, (opts && $.isPlainObject(opts) ? opts : {}), n.options);
|
||||
switch(typeof(text)) {
|
||||
case "string":
|
||||
return text.replace(/\{\{fi-(.*?)\}\}/g, function(match, a) {
|
||||
a = a.replace(/ /g, '');
|
||||
if(a.match(/(.*?)\|limitTo\:(\d+)/)) {
|
||||
return a.replace(/(.*?)\|limitTo\:(\d+)/, function(match, a, b) {
|
||||
var a = (opts[a] ? opts[a] : ""),
|
||||
str = a.substring(0, b);
|
||||
str = (a.length > str.length ? str.substring(0, str.length - 3) + "..." : str);
|
||||
return str;
|
||||
});
|
||||
} else {
|
||||
return(opts[a] ? opts[a] : "");
|
||||
}
|
||||
});
|
||||
break;
|
||||
case "function":
|
||||
return text(opts);
|
||||
break;
|
||||
default:
|
||||
return text;
|
||||
}
|
||||
},
|
||||
text2Color: function(str) {
|
||||
if(!str || str.length == 0) {
|
||||
return false
|
||||
}
|
||||
for(var i = 0, hash = 0; i < str.length; hash = str.charCodeAt(i++) + ((hash << 5) - hash));
|
||||
for(var i = 0, colour = "#"; i < 3; colour += ("00" + ((hash >> i++ * 2) & 0xFF)
|
||||
.toString(16))
|
||||
.slice(-2));
|
||||
return colour;
|
||||
}
|
||||
},
|
||||
files: null,
|
||||
_itFl: [],
|
||||
_itFc: null,
|
||||
_itFr: [],
|
||||
_ajFc: 0,
|
||||
_prEr: false
|
||||
}
|
||||
|
||||
s.on("filer.append", function(e, data) {
|
||||
f._append(e, data)
|
||||
}).on("filer.remove", function(e, data) {
|
||||
data.binded = true;
|
||||
f._remove(e, data);
|
||||
}).on("filer.reset", function(e) {
|
||||
f._reset();
|
||||
f._clear();
|
||||
return true;
|
||||
}).on("filer.generateList", function(e, data) {
|
||||
return f._getList(e, data)
|
||||
}).on("filer.retry", function(e, data) {
|
||||
return f._retryUpload(e, data)
|
||||
});
|
||||
|
||||
f.init();
|
||||
|
||||
return this;
|
||||
});
|
||||
};
|
||||
$.fn.filer.defaults = {
|
||||
limit: null,
|
||||
maxSize: null,
|
||||
extensions: null,
|
||||
changeInput: true,
|
||||
showThumbs: false,
|
||||
appendTo: null,
|
||||
theme: 'default',
|
||||
templates: {
|
||||
box: '<ul class="jFiler-items-list jFiler-items-default"></ul>',
|
||||
item: '<li class="jFiler-item"><div class="jFiler-item-container"><div class="jFiler-item-inner"><div class="jFiler-item-icon pull-left">{{fi-icon}}</div><div class="jFiler-item-info pull-left"><div class="jFiler-item-title" title="{{fi-name}}">{{fi-name | limitTo:30}}</div><div class="jFiler-item-others"><span>size: {{fi-size2}}</span><span>type: {{fi-extension}}</span><span class="jFiler-item-status">{{fi-progressBar}}</span></div><div class="jFiler-item-assets"><ul class="list-inline"><li><a class="icon-jfi-trash jFiler-item-trash-action"></a></li></ul></div></div></div></div></li>',
|
||||
itemAppend: '<li class="jFiler-item"><div class="jFiler-item-container"><div class="jFiler-item-inner"><div class="jFiler-item-icon pull-left">{{fi-icon}}</div><div class="jFiler-item-info pull-left"><div class="jFiler-item-title">{{fi-name | limitTo:35}}</div><div class="jFiler-item-others"><span>size: {{fi-size2}}</span><span>type: {{fi-extension}}</span><span class="jFiler-item-status"></span></div><div class="jFiler-item-assets"><ul class="list-inline"><li><a class="icon-jfi-trash jFiler-item-trash-action"></a></li></ul></div></div></div></div></li>',
|
||||
progressBar: '<div class="bar"></div>',
|
||||
itemAppendToEnd: false,
|
||||
removeConfirmation: true,
|
||||
_selectors: {
|
||||
list: '.jFiler-items-list',
|
||||
item: '.jFiler-item',
|
||||
progressBar: '.bar',
|
||||
remove: '.jFiler-item-trash-action'
|
||||
}
|
||||
},
|
||||
files: null,
|
||||
uploadFile: null,
|
||||
dragDrop: null,
|
||||
addMore: false,
|
||||
clipBoardPaste: true,
|
||||
excludeName: null,
|
||||
beforeRender: null,
|
||||
afterRender: null,
|
||||
beforeShow: null,
|
||||
beforeSelect: null,
|
||||
onSelect: null,
|
||||
afterShow: null,
|
||||
onRemove: null,
|
||||
onEmpty: null,
|
||||
options: null,
|
||||
captions: {
|
||||
button: "Choose Files",
|
||||
feedback: "Choose files To Upload",
|
||||
feedback2: "files were chosen",
|
||||
drop: "Drop file here to Upload",
|
||||
removeConfirmation: "Are you sure you want to remove this file?",
|
||||
errors: {
|
||||
filesLimit: "Only {{fi-limit}} files are allowed to be uploaded.",
|
||||
filesType: "Only Images are allowed to be uploaded.",
|
||||
filesSize: "{{fi-name}} is too large! Please upload file up to {{fi-maxSize}} MB.",
|
||||
filesSizeAll: "Files you've choosed are too large! Please upload files up to {{fi-maxSize}} MB."
|
||||
}
|
||||
}
|
||||
}
|
||||
})(jQuery);
|
||||
8
hal-core/resources/web/js/lib/jquery.filer.min.js
vendored
Normal file
8
hal-core/resources/web/js/lib/jquery.filer.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
22
hal-core/resources/web/js/lib/moment.LICENSE.txt
Normal file
22
hal-core/resources/web/js/lib/moment.LICENSE.txt
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
Copyright (c) JS Foundation and other contributors
|
||||
|
||||
Permission is hereby granted, free of charge, to any person
|
||||
obtaining a copy of this software and associated documentation
|
||||
files (the "Software"), to deal in the Software without
|
||||
restriction, including without limitation the rights to use,
|
||||
copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the
|
||||
Software is furnished to do so, subject to the following
|
||||
conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
OTHER DEALINGS IN THE SOFTWARE.
|
||||
3606
hal-core/resources/web/js/lib/moment.js
vendored
Normal file
3606
hal-core/resources/web/js/lib/moment.js
vendored
Normal file
File diff suppressed because it is too large
Load diff
21
hal-core/resources/web/js/lib/svg.LICENSE
Normal file
21
hal-core/resources/web/js/lib/svg.LICENSE
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
Copyright (c) 2012-2018 Wout Fierens
|
||||
https://svgdotjs.github.io/
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
21
hal-core/resources/web/js/lib/svg.draggable.LICENSE.txt
Normal file
21
hal-core/resources/web/js/lib/svg.draggable.LICENSE.txt
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2018 Ulrich-Matthias
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
221
hal-core/resources/web/js/lib/svg.draggable.js
vendored
Normal file
221
hal-core/resources/web/js/lib/svg.draggable.js
vendored
Normal file
|
|
@ -0,0 +1,221 @@
|
|||
/*! svg.draggable.js - v2.2.0 - 2016-05-21
|
||||
* https://github.com/wout/svg.draggable.js
|
||||
* Copyright (c) 2016 Wout Fierens; Licensed MIT */
|
||||
;(function() {
|
||||
|
||||
// creates handler, saves it
|
||||
function DragHandler(el){
|
||||
el.remember('_draggable', this)
|
||||
this.el = el
|
||||
}
|
||||
|
||||
|
||||
// Sets new parameter, starts dragging
|
||||
DragHandler.prototype.init = function(constraint, val){
|
||||
var _this = this
|
||||
this.constraint = constraint
|
||||
this.value = val
|
||||
this.el.on('mousedown.drag', function(e){ _this.start(e) })
|
||||
this.el.on('touchstart.drag', function(e){ _this.start(e) })
|
||||
}
|
||||
|
||||
// transforms one point from screen to user coords
|
||||
DragHandler.prototype.transformPoint = function(event, offset){
|
||||
event = event || window.event
|
||||
var touches = event.changedTouches && event.changedTouches[0] || event
|
||||
this.p.x = touches.pageX - (offset || 0)
|
||||
this.p.y = touches.pageY
|
||||
return this.p.matrixTransform(this.m)
|
||||
}
|
||||
|
||||
// gets elements bounding box with special handling of groups, nested and use
|
||||
DragHandler.prototype.getBBox = function(){
|
||||
|
||||
var box = this.el.bbox()
|
||||
|
||||
if(this.el instanceof SVG.Nested) box = this.el.rbox()
|
||||
|
||||
if (this.el instanceof SVG.G || this.el instanceof SVG.Use || this.el instanceof SVG.Nested) {
|
||||
box.x = this.el.x()
|
||||
box.y = this.el.y()
|
||||
}
|
||||
|
||||
return box
|
||||
}
|
||||
|
||||
// start dragging
|
||||
DragHandler.prototype.start = function(e){
|
||||
|
||||
// check for left button
|
||||
if(e.type == 'click'|| e.type == 'mousedown' || e.type == 'mousemove'){
|
||||
if((e.which || e.buttons) != 1){
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
var _this = this
|
||||
|
||||
// fire beforedrag event
|
||||
this.el.fire('beforedrag', { event: e, handler: this })
|
||||
|
||||
// search for parent on the fly to make sure we can call
|
||||
// draggable() even when element is not in the dom currently
|
||||
this.parent = this.parent || this.el.parent(SVG.Nested) || this.el.parent(SVG.Doc)
|
||||
this.p = this.parent.node.createSVGPoint()
|
||||
|
||||
// save current transformation matrix
|
||||
this.m = this.el.node.getScreenCTM().inverse()
|
||||
|
||||
var box = this.getBBox()
|
||||
|
||||
var anchorOffset;
|
||||
|
||||
// fix text-anchor in text-element (#37)
|
||||
if(this.el instanceof SVG.Text){
|
||||
anchorOffset = this.el.node.getComputedTextLength();
|
||||
|
||||
switch(this.el.attr('text-anchor')){
|
||||
case 'middle':
|
||||
anchorOffset /= 2;
|
||||
break
|
||||
case 'start':
|
||||
anchorOffset = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
this.startPoints = {
|
||||
// We take absolute coordinates since we are just using a delta here
|
||||
point: this.transformPoint(e, anchorOffset),
|
||||
box: box
|
||||
}
|
||||
|
||||
// add drag and end events to window
|
||||
SVG.on(window, 'mousemove.drag', function(e){ _this.drag(e) })
|
||||
SVG.on(window, 'touchmove.drag', function(e){ _this.drag(e) })
|
||||
SVG.on(window, 'mouseup.drag', function(e){ _this.end(e) })
|
||||
SVG.on(window, 'touchend.drag', function(e){ _this.end(e) })
|
||||
|
||||
// fire dragstart event
|
||||
this.el.fire('dragstart', {event: e, p: this.startPoints.point, m: this.m, handler: this})
|
||||
|
||||
// prevent browser drag behavior
|
||||
e.preventDefault()
|
||||
|
||||
// prevent propagation to a parent that might also have dragging enabled
|
||||
e.stopPropagation();
|
||||
}
|
||||
|
||||
// while dragging
|
||||
DragHandler.prototype.drag = function(e){
|
||||
|
||||
var box = this.getBBox()
|
||||
, p = this.transformPoint(e)
|
||||
, x = this.startPoints.box.x + p.x - this.startPoints.point.x
|
||||
, y = this.startPoints.box.y + p.y - this.startPoints.point.y
|
||||
, c = this.constraint
|
||||
|
||||
var event = new CustomEvent('dragmove', {
|
||||
detail: {
|
||||
event: e
|
||||
, p: p
|
||||
, m: this.m
|
||||
, handler: this
|
||||
}
|
||||
, cancelable: true
|
||||
})
|
||||
|
||||
this.el.fire(event)
|
||||
|
||||
if(event.defaultPrevented) return p
|
||||
|
||||
// move the element to its new position, if possible by constraint
|
||||
if (typeof c == 'function') {
|
||||
|
||||
var coord = c.call(this.el, x, y, this.m)
|
||||
|
||||
// bool, just show us if movement is allowed or not
|
||||
if (typeof coord == 'boolean') {
|
||||
coord = {
|
||||
x: coord,
|
||||
y: coord
|
||||
}
|
||||
}
|
||||
|
||||
// if true, we just move. If !false its a number and we move it there
|
||||
if (coord.x === true) {
|
||||
this.el.x(x)
|
||||
} else if (coord.x !== false) {
|
||||
this.el.x(coord.x)
|
||||
}
|
||||
|
||||
if (coord.y === true) {
|
||||
this.el.y(y)
|
||||
} else if (coord.y !== false) {
|
||||
this.el.y(coord.y)
|
||||
}
|
||||
|
||||
} else if (typeof c == 'object') {
|
||||
|
||||
// keep element within constrained box
|
||||
if (c.minX != null && x < c.minX)
|
||||
x = c.minX
|
||||
else if (c.maxX != null && x > c.maxX - box.width){
|
||||
x = c.maxX - box.width
|
||||
}if (c.minY != null && y < c.minY)
|
||||
y = c.minY
|
||||
else if (c.maxY != null && y > c.maxY - box.height)
|
||||
y = c.maxY - box.height
|
||||
|
||||
this.el.move(x, y)
|
||||
}
|
||||
|
||||
// so we can use it in the end-method, too
|
||||
return p
|
||||
}
|
||||
|
||||
DragHandler.prototype.end = function(e){
|
||||
|
||||
// final drag
|
||||
var p = this.drag(e);
|
||||
|
||||
// fire dragend event
|
||||
this.el.fire('dragend', { event: e, p: p, m: this.m, handler: this })
|
||||
|
||||
// unbind events
|
||||
SVG.off(window, 'mousemove.drag')
|
||||
SVG.off(window, 'touchmove.drag')
|
||||
SVG.off(window, 'mouseup.drag')
|
||||
SVG.off(window, 'touchend.drag')
|
||||
|
||||
}
|
||||
|
||||
SVG.extend(SVG.Element, {
|
||||
// Make element draggable
|
||||
// Constraint might be an object (as described in readme.md) or a function in the form "function (x, y)" that gets called before every move.
|
||||
// The function can return a boolean or an object of the form {x, y}, to which the element will be moved. "False" skips moving, true moves to raw x, y.
|
||||
draggable: function(value, constraint) {
|
||||
|
||||
// Check the parameters and reassign if needed
|
||||
if (typeof value == 'function' || typeof value == 'object') {
|
||||
constraint = value
|
||||
value = true
|
||||
}
|
||||
|
||||
var dragHandler = this.remember('_draggable') || new DragHandler(this)
|
||||
|
||||
// When no parameter is given, value is true
|
||||
value = typeof value === 'undefined' ? true : value
|
||||
|
||||
if(value) dragHandler.init(constraint || {}, value)
|
||||
else {
|
||||
this.off('mousedown.drag')
|
||||
this.off('touchstart.drag')
|
||||
}
|
||||
|
||||
return this
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
}).call(this);
|
||||
4
hal-core/resources/web/js/lib/svg.draggable.min.js
vendored
Normal file
4
hal-core/resources/web/js/lib/svg.draggable.min.js
vendored
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
/*! svg.draggable.js - v2.2.0 - 2016-05-21
|
||||
* https://github.com/wout/svg.draggable.js
|
||||
* Copyright (c) 2016 Wout Fierens; Licensed MIT */
|
||||
(function(){function a(a){a.remember("_draggable",this),this.el=a}a.prototype.init=function(a,b){var c=this;this.constraint=a,this.value=b,this.el.on("mousedown.drag",function(a){c.start(a)}),this.el.on("touchstart.drag",function(a){c.start(a)})},a.prototype.transformPoint=function(a,b){a=a||window.event;var c=a.changedTouches&&a.changedTouches[0]||a;return this.p.x=c.pageX-(b||0),this.p.y=c.pageY,this.p.matrixTransform(this.m)},a.prototype.getBBox=function(){var a=this.el.bbox();return this.el instanceof SVG.Nested&&(a=this.el.rbox()),(this.el instanceof SVG.G||this.el instanceof SVG.Use||this.el instanceof SVG.Nested)&&(a.x=this.el.x(),a.y=this.el.y()),a},a.prototype.start=function(a){if("click"!=a.type&&"mousedown"!=a.type&&"mousemove"!=a.type||1==(a.which||a.buttons)){var b=this;this.el.fire("beforedrag",{event:a,handler:this}),this.parent=this.parent||this.el.parent(SVG.Nested)||this.el.parent(SVG.Doc),this.p=this.parent.node.createSVGPoint(),this.m=this.el.node.getScreenCTM().inverse();var c,d=this.getBBox();if(this.el instanceof SVG.Text)switch(c=this.el.node.getComputedTextLength(),this.el.attr("text-anchor")){case"middle":c/=2;break;case"start":c=0}this.startPoints={point:this.transformPoint(a,c),box:d},SVG.on(window,"mousemove.drag",function(a){b.drag(a)}),SVG.on(window,"touchmove.drag",function(a){b.drag(a)}),SVG.on(window,"mouseup.drag",function(a){b.end(a)}),SVG.on(window,"touchend.drag",function(a){b.end(a)}),this.el.fire("dragstart",{event:a,p:this.startPoints.point,m:this.m,handler:this}),a.preventDefault(),a.stopPropagation()}},a.prototype.drag=function(a){var b=this.getBBox(),c=this.transformPoint(a),d=this.startPoints.box.x+c.x-this.startPoints.point.x,e=this.startPoints.box.y+c.y-this.startPoints.point.y,f=this.constraint,g=new CustomEvent("dragmove",{detail:{event:a,p:c,m:this.m,handler:this},cancelable:!0});if(this.el.fire(g),g.defaultPrevented)return c;if("function"==typeof f){var h=f.call(this.el,d,e,this.m);"boolean"==typeof h&&(h={x:h,y:h}),h.x===!0?this.el.x(d):h.x!==!1&&this.el.x(h.x),h.y===!0?this.el.y(e):h.y!==!1&&this.el.y(h.y)}else"object"==typeof f&&(null!=f.minX&&d<f.minX?d=f.minX:null!=f.maxX&&d>f.maxX-b.width&&(d=f.maxX-b.width),null!=f.minY&&e<f.minY?e=f.minY:null!=f.maxY&&e>f.maxY-b.height&&(e=f.maxY-b.height),this.el.move(d,e));return c},a.prototype.end=function(a){var b=this.drag(a);this.el.fire("dragend",{event:a,p:b,m:this.m,handler:this}),SVG.off(window,"mousemove.drag"),SVG.off(window,"touchmove.drag"),SVG.off(window,"mouseup.drag"),SVG.off(window,"touchend.drag")},SVG.extend(SVG.Element,{draggable:function(b,c){("function"==typeof b||"object"==typeof b)&&(c=b,b=!0);var d=this.remember("_draggable")||new a(this);return b="undefined"==typeof b?!0:b,b?d.init(c||{},b):(this.off("mousedown.drag"),this.off("touchstart.drag")),this}})}).call(this);
|
||||
5601
hal-core/resources/web/js/lib/svg.js
vendored
Normal file
5601
hal-core/resources/web/js/lib/svg.js
vendored
Normal file
File diff suppressed because it is too large
Load diff
3
hal-core/resources/web/js/lib/svg.min.js
vendored
Normal file
3
hal-core/resources/web/js/lib/svg.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
26
hal-core/resources/web/js/lib/svg.title.js
vendored
Normal file
26
hal-core/resources/web/js/lib/svg.title.js
vendored
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
// Title Plugin
|
||||
// Source: https://github.com/wout/svg.js/issues/147
|
||||
//
|
||||
// // example usage
|
||||
// var draw = SVG('drawing')
|
||||
// var group = draw.group()
|
||||
// group.title('This is a pink square.')
|
||||
// group.rect(100,100).fill('#f06')
|
||||
|
||||
SVG.Title = SVG.invent({
|
||||
create: 'title',
|
||||
inherit: SVG.Element,
|
||||
extend: {
|
||||
text: function(text) {
|
||||
while (this.node.firstChild)
|
||||
this.node.removeChild(this.node.firstChild)
|
||||
this.node.appendChild(document.createTextNode(text))
|
||||
return this
|
||||
}
|
||||
},
|
||||
construct: {
|
||||
title: function(text) {
|
||||
return this.put(new SVG.Title).text(text)
|
||||
}
|
||||
}
|
||||
})
|
||||
Loading…
Add table
Add a link
Reference in a new issue