mirror of
https://gitea.msk.dinamika-avia.ru/Constanta-Design/region-edoc.git
synced 2026-01-24 15:55:38 +03:00
Поправлена структура, разделы в подразделы до 3.3
This commit is contained in:
28
ИЭТР-тест/Develop/app/js/Number-Input-Spinner-jQuery-Nice-Number/dist/jquery.nice-number.css
vendored
Normal file
28
ИЭТР-тест/Develop/app/js/Number-Input-Spinner-jQuery-Nice-Number/dist/jquery.nice-number.css
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
.nice-number {
|
||||
display: inline-flex;
|
||||
justify-content: stretch;
|
||||
}
|
||||
.nice-number button{
|
||||
width: 26px;
|
||||
height: 26px;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
border-radius: 2px 0 0 2px;
|
||||
}
|
||||
.nice-number input+button{
|
||||
border-radius: 0 2px 2px 0;
|
||||
}
|
||||
|
||||
.nice-number input {
|
||||
vertical-align: middle;
|
||||
-moz-appearance: textfield;
|
||||
box-sizing: content-box;
|
||||
margin: 0;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.nice-number input::-webkit-inner-spin-button,
|
||||
.nice-number input::-webkit-outer-spin-button {
|
||||
-webkit-appearance: none;
|
||||
margin: 0;
|
||||
}
|
||||
145
ИЭТР-тест/Develop/app/js/Number-Input-Spinner-jQuery-Nice-Number/dist/jquery.nice-number.js
vendored
Normal file
145
ИЭТР-тест/Develop/app/js/Number-Input-Spinner-jQuery-Nice-Number/dist/jquery.nice-number.js
vendored
Normal file
@@ -0,0 +1,145 @@
|
||||
(function ($) {
|
||||
$.fn.niceNumber = function(options) {
|
||||
var settings = $.extend({
|
||||
autoSize: true,
|
||||
autoSizeBuffer: 1,
|
||||
buttonDecrement: '-',
|
||||
buttonIncrement: "+",
|
||||
buttonPosition: 'around'
|
||||
}, options);
|
||||
|
||||
return this.each(function(){
|
||||
var currentInput = this,
|
||||
$currentInput = $(currentInput),
|
||||
attrMax = null,
|
||||
attrMin = null;
|
||||
|
||||
// Handle max and min values
|
||||
if (
|
||||
typeof $currentInput.attr('max') !== typeof undefined
|
||||
&& $currentInput.attr('max') !== false
|
||||
) {
|
||||
attrMax = parseFloat($currentInput.attr('max'));
|
||||
}
|
||||
|
||||
if (
|
||||
typeof $currentInput.attr('min') !== typeof undefined
|
||||
&& $currentInput.attr('min') !== false
|
||||
) {
|
||||
attrMin = parseFloat($currentInput.attr('min'));
|
||||
}
|
||||
|
||||
// Fix issue with initial value being < min
|
||||
if (
|
||||
attrMin
|
||||
&& !currentInput.value
|
||||
) {
|
||||
$currentInput.val(attrMin);
|
||||
}
|
||||
|
||||
// Generate container
|
||||
var $inputContainer = $('<div/>',{
|
||||
class: 'nice-number'
|
||||
})
|
||||
.insertAfter(currentInput);
|
||||
|
||||
// Generate interval (object so it is passed by reference)
|
||||
var interval = {};
|
||||
|
||||
// Generate buttons
|
||||
var $minusButton = $('<button/>')
|
||||
.attr('type', 'button')
|
||||
.html(settings.buttonDecrement)
|
||||
.on('mousedown mouseup mouseleave', function(event){
|
||||
changeInterval(event.type, interval, function(){
|
||||
if (
|
||||
attrMin == null
|
||||
|| attrMin < parseFloat(currentInput.value)
|
||||
) {
|
||||
currentInput.value--;
|
||||
}
|
||||
});
|
||||
|
||||
// Trigger the input event here to avoid event spam
|
||||
if (
|
||||
event.type == 'mouseup'
|
||||
|| event.type == 'mouseleave'
|
||||
) {
|
||||
$currentInput.trigger('input');
|
||||
}
|
||||
});
|
||||
|
||||
var $plusButton = $('<button/>')
|
||||
.attr('type', 'button')
|
||||
.html(settings.buttonIncrement)
|
||||
.on('mousedown mouseup mouseleave', function(event){
|
||||
changeInterval(event.type, interval, function(){
|
||||
if (
|
||||
attrMax == null
|
||||
|| attrMax > parseFloat(currentInput.value)
|
||||
) {
|
||||
currentInput.value++;
|
||||
}
|
||||
});
|
||||
|
||||
// Trigger the input event here to avoid event spam
|
||||
if (
|
||||
event.type == 'mouseup'
|
||||
|| event.type == 'mouseleave'
|
||||
) {
|
||||
$currentInput.trigger('input');
|
||||
}
|
||||
});
|
||||
|
||||
// Append elements
|
||||
switch (settings.buttonPosition) {
|
||||
case 'left':
|
||||
$minusButton.appendTo($inputContainer);
|
||||
$plusButton.appendTo($inputContainer);
|
||||
$currentInput.appendTo($inputContainer);
|
||||
break;
|
||||
case 'right':
|
||||
$currentInput.appendTo($inputContainer);
|
||||
$minusButton.appendTo($inputContainer);
|
||||
$plusButton.appendTo($inputContainer);
|
||||
break;
|
||||
case 'around':
|
||||
default:
|
||||
$minusButton.appendTo($inputContainer);
|
||||
$currentInput.appendTo($inputContainer);
|
||||
$plusButton.appendTo($inputContainer);
|
||||
break;
|
||||
}
|
||||
|
||||
// Nicely size input
|
||||
if (settings.autoSize) {
|
||||
$currentInput.width(
|
||||
$currentInput.val().length+settings.autoSizeBuffer+"ch"
|
||||
);
|
||||
$currentInput.on('keyup input',function(){
|
||||
$currentInput.animate({
|
||||
'width': $currentInput.val().length+settings.autoSizeBuffer+"ch"
|
||||
}, 200);
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
function changeInterval(eventType, interval, callback) {
|
||||
if (eventType == "mousedown") {
|
||||
interval.timeout = setTimeout(function(){
|
||||
interval.actualInterval = setInterval(function(){
|
||||
callback();
|
||||
}, 100);
|
||||
}, 200);
|
||||
callback();
|
||||
} else {
|
||||
if (interval.timeout) {
|
||||
clearTimeout(interval.timeout);
|
||||
}
|
||||
if (interval.actualInterval) {
|
||||
clearInterval(interval.actualInterval);
|
||||
}
|
||||
}
|
||||
}
|
||||
}(jQuery));
|
||||
@@ -0,0 +1,2 @@
|
||||
.nice-number{display:inline-flex;justify-content:stretch}.nice-number input{vertical-align:middle;-moz-appearance:textfield;box-sizing:content-box;margin:0;text-align:center}
|
||||
.nice-number input::-webkit-inner-spin-button,.nice-number input::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}
|
||||
@@ -0,0 +1 @@
|
||||
!function(t){t.fn.niceNumber=function(n){var a=t.extend({autoSize:!0,autoSizeBuffer:1,buttonDecrement:"-",buttonIncrement:"+",buttonPosition:"around"},n);return this.each(function(){var n=this,u=t(n),o=null,i=null;void 0!==u.attr("max")&&!1!==u.attr("max")&&(o=parseFloat(u.attr("max"))),void 0!==u.attr("min")&&!1!==u.attr("min")&&(i=parseFloat(u.attr("min"))),i&&!n.value&&u.val(i);var r=t("<div/>",{class:"nice-number"}).insertAfter(n),l={},p=t("<button/>").attr("type","button").html(a.buttonDecrement).on("mousedown mouseup mouseleave",function(t){e(t.type,l,function(){(null==i||i<parseFloat(n.value))&&n.value--}),"mouseup"!=t.type&&"mouseleave"!=t.type||u.trigger("input")}),m=t("<button/>").attr("type","button").html(a.buttonIncrement).on("mousedown mouseup mouseleave",function(t){e(t.type,l,function(){(null==o||o>parseFloat(n.value))&&n.value++}),"mouseup"!=t.type&&"mouseleave"!=t.type||u.trigger("input")});switch(a.buttonPosition){case"left":p.appendTo(r),m.appendTo(r),u.appendTo(r);break;case"right":u.appendTo(r),p.appendTo(r),m.appendTo(r);break;case"around":default:p.appendTo(r),u.appendTo(r),m.appendTo(r)}a.autoSize&&(u.width(u.val().length+a.autoSizeBuffer+"ch"),u.on("keyup input",function(){u.animate({width:u.val().length+a.autoSizeBuffer+"ch"},200)}))})};function e(t,e,n){"mousedown"==t?(e.timeout=setTimeout(function(){e.actualInterval=setInterval(function(){n()},100)},200),n()):(e.timeout&&clearTimeout(e.timeout),e.actualInterval&&clearInterval(e.actualInterval))}}(jQuery);
|
||||
Reference in New Issue
Block a user