Commit d03ac54c authored by Valentin Hervieu's avatar Valentin Hervieu

Apply editorconfig formatting

parent a7c7f0e3
...@@ -71,16 +71,17 @@ module.exports = function(grunt) { ...@@ -71,16 +71,17 @@ module.exports = function(grunt) {
replace: { replace: {
dist: { dist: {
options: { options: {
patterns: [ patterns: [{
{
match: /\/\*templateReplacement\*\//, match: /\/\*templateReplacement\*\//,
replacement: '<%= grunt.file.read("temp/templates.js") %>' replacement: '<%= grunt.file.read("temp/templates.js") %>'
} }]
]
}, },
files: [ files: [{
{expand: true, flatten: true, src: ['src/rzslider.js'], dest: 'dist/'} expand: true,
] flatten: true,
src: ['src/rzslider.js'],
dest: 'dist/'
}]
} }
}, },
...@@ -94,8 +95,7 @@ module.exports = function(grunt) { ...@@ -94,8 +95,7 @@ module.exports = function(grunt) {
}, { }, {
expand: true, expand: true,
src: ['dist/rzslider.js'] src: ['dist/rzslider.js']
} }]
]
} }
}, },
watch: { watch: {
......
...@@ -368,8 +368,7 @@ ...@@ -368,8 +368,7 @@
this.customTrFn = function(value) { this.customTrFn = function(value) {
return this.options.stepsArray[value]; return this.options.stepsArray[value];
}; };
} } else if (this.options.translate)
else if (this.options.translate)
this.customTrFn = this.options.translate; this.customTrFn = this.options.translate;
else else
this.customTrFn = function(value) { this.customTrFn = function(value) {
...@@ -505,8 +504,7 @@ ...@@ -505,8 +504,7 @@
setDisabledState: function() { setDisabledState: function() {
if (this.options.disabled) { if (this.options.disabled) {
this.sliderElem.attr('disabled', 'disabled'); this.sliderElem.attr('disabled', 'disabled');
} } else {
else {
this.sliderElem.attr('disabled', null); this.sliderElem.attr('disabled', null);
} }
}, },
...@@ -802,13 +800,13 @@ ...@@ -802,13 +800,13 @@
* @returns {undefined} * @returns {undefined}
*/ */
shFloorCeil: function() { shFloorCeil: function() {
var flHidden = false, clHidden = false; var flHidden = false,
clHidden = false;
if (this.minLab.rzsl <= this.flrLab.rzsl + this.flrLab.rzsw + 5) { if (this.minLab.rzsl <= this.flrLab.rzsl + this.flrLab.rzsw + 5) {
flHidden = true; flHidden = true;
this.hideEl(this.flrLab); this.hideEl(this.flrLab);
} } else {
else {
flHidden = false; flHidden = false;
this.showEl(this.flrLab); this.showEl(this.flrLab);
} }
...@@ -816,8 +814,7 @@ ...@@ -816,8 +814,7 @@
if (this.minLab.rzsl + this.minLab.rzsw >= this.ceilLab.rzsl - this.handleHalfWidth - 10) { if (this.minLab.rzsl + this.minLab.rzsw >= this.ceilLab.rzsl - this.handleHalfWidth - 10) {
clHidden = true; clHidden = true;
this.hideEl(this.ceilLab); this.hideEl(this.ceilLab);
} } else {
else {
clHidden = false; clHidden = false;
this.showEl(this.ceilLab); this.showEl(this.ceilLab);
} }
...@@ -825,16 +822,14 @@ ...@@ -825,16 +822,14 @@
if (this.range) { if (this.range) {
if (this.maxLab.rzsl + this.maxLab.rzsw >= this.ceilLab.rzsl - 10) { if (this.maxLab.rzsl + this.maxLab.rzsw >= this.ceilLab.rzsl - 10) {
this.hideEl(this.ceilLab); this.hideEl(this.ceilLab);
} } else if (!clHidden) {
else if (!clHidden) {
this.showEl(this.ceilLab); this.showEl(this.ceilLab);
} }
// Hide or show floor label // Hide or show floor label
if (this.maxLab.rzsl <= this.flrLab.rzsl + this.flrLab.rzsw + this.handleHalfWidth) { if (this.maxLab.rzsl <= this.flrLab.rzsl + this.flrLab.rzsw + this.handleHalfWidth) {
this.hideEl(this.flrLab); this.hideEl(this.flrLab);
} } else if (!flHidden) {
else if (!flHidden) {
this.showEl(this.flrLab); this.showEl(this.flrLab);
} }
} }
...@@ -867,8 +862,7 @@ ...@@ -867,8 +862,7 @@
this.hideEl(this.minLab); this.hideEl(this.minLab);
this.hideEl(this.maxLab); this.hideEl(this.maxLab);
this.showEl(this.cmbLab); this.showEl(this.cmbLab);
} } else {
else {
this.showEl(this.maxLab); this.showEl(this.maxLab);
this.showEl(this.minLab); this.showEl(this.minLab);
this.hideEl(this.cmbLab); this.hideEl(this.cmbLab);
...@@ -906,7 +900,9 @@ ...@@ -906,7 +900,9 @@
* @returns {jqLite} The jqLite wrapped DOM element * @returns {jqLite} The jqLite wrapped DOM element
*/ */
hideEl: function(element) { hideEl: function(element) {
return element.css({opacity: 0}); return element.css({
opacity: 0
});
}, },
/** /**
...@@ -920,7 +916,9 @@ ...@@ -920,7 +916,9 @@
return element; return element;
} }
return element.css({opacity: 1}); return element.css({
opacity: 1
});
}, },
/** /**
...@@ -932,7 +930,9 @@ ...@@ -932,7 +930,9 @@
*/ */
setLeft: function(elem, left) { setLeft: function(elem, left) {
elem.rzsl = left; elem.rzsl = left;
elem.css({left: left + 'px'}); elem.css({
left: left + 'px'
});
return left; return left;
}, },
...@@ -957,7 +957,9 @@ ...@@ -957,7 +957,9 @@
*/ */
setWidth: function(elem, width) { setWidth: function(elem, width) {
elem.rzsw = width; elem.rzsw = width;
elem.css({width: width + 'px'}); elem.css({
width: width + 'px'
});
return width; return width;
}, },
...@@ -1007,8 +1009,7 @@ ...@@ -1007,8 +1009,7 @@
} }
return event.originalEvent === undefined ? return event.originalEvent === undefined ?
event.touches[0].clientX event.touches[0].clientX : event.originalEvent.touches[0].clientX;
: event.originalEvent.touches[0].clientX;
}, },
/** /**
...@@ -1038,8 +1039,7 @@ ...@@ -1038,8 +1039,7 @@
barTracking = 'rzSliderDrag'; barTracking = 'rzSliderDrag';
barStart = this.onDragStart; barStart = this.onDragStart;
barMove = this.onDragMove; barMove = this.onDragMove;
} } else {
else {
barTracking = 'rzSliderModel'; barTracking = 'rzSliderModel';
barStart = this.onStart; barStart = this.onStart;
barMove = this.onMove; barMove = this.onMove;
...@@ -1106,8 +1106,7 @@ ...@@ -1106,8 +1106,7 @@
if (pointer) { if (pointer) {
this.tracking = ref; this.tracking = ref;
} } else {
else {
pointer = this.getNearestHandle(event); pointer = this.getNearestHandle(event);
this.tracking = pointer === this.minH ? 'rzSliderModel' : 'rzSliderHigh'; this.tracking = pointer === this.minH ? 'rzSliderModel' : 'rzSliderHigh';
} }
...@@ -1141,14 +1140,12 @@ ...@@ -1141,14 +1140,12 @@
return; return;
newValue = this.minValue; newValue = this.minValue;
newOffset = 0; newOffset = 0;
} } else if (newOffset >= this.maxLeft) {
else if (newOffset >= this.maxLeft) {
if (pointer.rzsl === this.maxLeft) if (pointer.rzsl === this.maxLeft)
return; return;
newValue = this.maxValue; newValue = this.maxValue;
newOffset = this.maxLeft; newOffset = this.maxLeft;
} } else {
else {
newValue = this.offsetToValue(newOffset); newValue = this.offsetToValue(newOffset);
newValue = this.roundStep(newValue); newValue = this.roundStep(newValue);
newOffset = this.valueToOffset(newValue); newOffset = this.valueToOffset(newValue);
...@@ -1204,8 +1201,7 @@ ...@@ -1204,8 +1201,7 @@
newMinOffset = 0; newMinOffset = 0;
newMaxValue = this.minValue + this.dragging.difference; newMaxValue = this.minValue + this.dragging.difference;
newMaxOffset = this.valueToOffset(newMaxValue); newMaxOffset = this.valueToOffset(newMaxValue);
} } else if (newOffset >= this.maxLeft - this.dragging.highDist) {
else if (newOffset >= this.maxLeft - this.dragging.highDist) {
if (pointer.rzsl === this.dragging.highDist) { if (pointer.rzsl === this.dragging.highDist) {
return; return;
} }
...@@ -1213,8 +1209,7 @@ ...@@ -1213,8 +1209,7 @@
newMaxOffset = this.maxLeft; newMaxOffset = this.maxLeft;
newMinValue = this.maxValue - this.dragging.difference; newMinValue = this.maxValue - this.dragging.difference;
newMinOffset = this.valueToOffset(newMinValue); newMinOffset = this.valueToOffset(newMinValue);
} } else {
else {
newMinValue = this.offsetToValue(newOffset - this.dragging.lowDist); newMinValue = this.offsetToValue(newOffset - this.dragging.lowDist);
newMinValue = this.roundStep(newMinValue); newMinValue = this.roundStep(newMinValue);
newMinOffset = this.valueToOffset(newMinValue); newMinOffset = this.valueToOffset(newMinValue);
...@@ -1260,8 +1255,7 @@ ...@@ -1260,8 +1255,7 @@
/* We need to apply here because we are not sure that we will enter the next block */ /* We need to apply here because we are not sure that we will enter the next block */
this.scope.$apply(); this.scope.$apply();
this.callOnChange(); this.callOnChange();
} } else if (this.tracking === 'rzSliderHigh' && newValue <= this.scope.rzSliderModel) {
else if (this.tracking === 'rzSliderHigh' && newValue <= this.scope.rzSliderModel) {
this.scope[this.tracking] = this.scope.rzSliderModel; this.scope[this.tracking] = this.scope.rzSliderModel;
this.updateHandles(this.tracking, this.minH.rzsl); this.updateHandles(this.tracking, this.minH.rzsl);
this.tracking = 'rzSliderModel'; this.tracking = 'rzSliderModel';
...@@ -1311,13 +1305,15 @@ ...@@ -1311,13 +1305,15 @@
* @return {{moveEvent: string, endEvent: string}} * @return {{moveEvent: string, endEvent: string}}
*/ */
getEventNames: function(event) { getEventNames: function(event) {
var eventNames = {moveEvent: '', endEvent: ''}; var eventNames = {
moveEvent: '',
endEvent: ''
};
if (event.touches || (event.originalEvent !== undefined && event.originalEvent.touches)) { if (event.touches || (event.originalEvent !== undefined && event.originalEvent.touches)) {
eventNames.moveEvent = 'touchmove'; eventNames.moveEvent = 'touchmove';
eventNames.endEvent = 'touchend'; eventNames.endEvent = 'touchend';
} } else {
else {
eventNames.moveEvent = 'mousemove'; eventNames.moveEvent = 'mousemove';
eventNames.endEvent = 'mouseup'; eventNames.endEvent = 'mouseup';
} }
...@@ -1359,7 +1355,7 @@ ...@@ -1359,7 +1355,7 @@
}; };
}]); }]);
// IDE assist // IDE assist
/** /**
* @name ngScope * @name ngScope
......
...@@ -368,8 +368,7 @@ ...@@ -368,8 +368,7 @@
this.customTrFn = function(value) { this.customTrFn = function(value) {
return this.options.stepsArray[value]; return this.options.stepsArray[value];
}; };
} } else if (this.options.translate)
else if (this.options.translate)
this.customTrFn = this.options.translate; this.customTrFn = this.options.translate;
else else
this.customTrFn = function(value) { this.customTrFn = function(value) {
...@@ -505,8 +504,7 @@ ...@@ -505,8 +504,7 @@
setDisabledState: function() { setDisabledState: function() {
if (this.options.disabled) { if (this.options.disabled) {
this.sliderElem.attr('disabled', 'disabled'); this.sliderElem.attr('disabled', 'disabled');
} } else {
else {
this.sliderElem.attr('disabled', null); this.sliderElem.attr('disabled', null);
} }
}, },
...@@ -802,13 +800,13 @@ ...@@ -802,13 +800,13 @@
* @returns {undefined} * @returns {undefined}
*/ */
shFloorCeil: function() { shFloorCeil: function() {
var flHidden = false, clHidden = false; var flHidden = false,
clHidden = false;
if (this.minLab.rzsl <= this.flrLab.rzsl + this.flrLab.rzsw + 5) { if (this.minLab.rzsl <= this.flrLab.rzsl + this.flrLab.rzsw + 5) {
flHidden = true; flHidden = true;
this.hideEl(this.flrLab); this.hideEl(this.flrLab);
} } else {
else {
flHidden = false; flHidden = false;
this.showEl(this.flrLab); this.showEl(this.flrLab);
} }
...@@ -816,8 +814,7 @@ ...@@ -816,8 +814,7 @@
if (this.minLab.rzsl + this.minLab.rzsw >= this.ceilLab.rzsl - this.handleHalfWidth - 10) { if (this.minLab.rzsl + this.minLab.rzsw >= this.ceilLab.rzsl - this.handleHalfWidth - 10) {
clHidden = true; clHidden = true;
this.hideEl(this.ceilLab); this.hideEl(this.ceilLab);
} } else {
else {
clHidden = false; clHidden = false;
this.showEl(this.ceilLab); this.showEl(this.ceilLab);
} }
...@@ -825,16 +822,14 @@ ...@@ -825,16 +822,14 @@
if (this.range) { if (this.range) {
if (this.maxLab.rzsl + this.maxLab.rzsw >= this.ceilLab.rzsl - 10) { if (this.maxLab.rzsl + this.maxLab.rzsw >= this.ceilLab.rzsl - 10) {
this.hideEl(this.ceilLab); this.hideEl(this.ceilLab);
} } else if (!clHidden) {
else if (!clHidden) {
this.showEl(this.ceilLab); this.showEl(this.ceilLab);
} }
// Hide or show floor label // Hide or show floor label
if (this.maxLab.rzsl <= this.flrLab.rzsl + this.flrLab.rzsw + this.handleHalfWidth) { if (this.maxLab.rzsl <= this.flrLab.rzsl + this.flrLab.rzsw + this.handleHalfWidth) {
this.hideEl(this.flrLab); this.hideEl(this.flrLab);
} } else if (!flHidden) {
else if (!flHidden) {
this.showEl(this.flrLab); this.showEl(this.flrLab);
} }
} }
...@@ -867,8 +862,7 @@ ...@@ -867,8 +862,7 @@
this.hideEl(this.minLab); this.hideEl(this.minLab);
this.hideEl(this.maxLab); this.hideEl(this.maxLab);
this.showEl(this.cmbLab); this.showEl(this.cmbLab);
} } else {
else {
this.showEl(this.maxLab); this.showEl(this.maxLab);
this.showEl(this.minLab); this.showEl(this.minLab);
this.hideEl(this.cmbLab); this.hideEl(this.cmbLab);
...@@ -906,7 +900,9 @@ ...@@ -906,7 +900,9 @@
* @returns {jqLite} The jqLite wrapped DOM element * @returns {jqLite} The jqLite wrapped DOM element
*/ */
hideEl: function(element) { hideEl: function(element) {
return element.css({opacity: 0}); return element.css({
opacity: 0
});
}, },
/** /**
...@@ -920,7 +916,9 @@ ...@@ -920,7 +916,9 @@
return element; return element;
} }
return element.css({opacity: 1}); return element.css({
opacity: 1
});
}, },
/** /**
...@@ -932,7 +930,9 @@ ...@@ -932,7 +930,9 @@
*/ */
setLeft: function(elem, left) { setLeft: function(elem, left) {
elem.rzsl = left; elem.rzsl = left;
elem.css({left: left + 'px'}); elem.css({
left: left + 'px'
});
return left; return left;
}, },
...@@ -957,7 +957,9 @@ ...@@ -957,7 +957,9 @@
*/ */
setWidth: function(elem, width) { setWidth: function(elem, width) {
elem.rzsw = width; elem.rzsw = width;
elem.css({width: width + 'px'}); elem.css({
width: width + 'px'
});
return width; return width;
}, },
...@@ -1007,8 +1009,7 @@ ...@@ -1007,8 +1009,7 @@
} }
return event.originalEvent === undefined ? return event.originalEvent === undefined ?
event.touches[0].clientX event.touches[0].clientX : event.originalEvent.touches[0].clientX;
: event.originalEvent.touches[0].clientX;
}, },
/** /**
...@@ -1038,8 +1039,7 @@ ...@@ -1038,8 +1039,7 @@
barTracking = 'rzSliderDrag'; barTracking = 'rzSliderDrag';
barStart = this.onDragStart; barStart = this.onDragStart;
barMove = this.onDragMove; barMove = this.onDragMove;
} } else {
else {
barTracking = 'rzSliderModel'; barTracking = 'rzSliderModel';
barStart = this.onStart; barStart = this.onStart;
barMove = this.onMove; barMove = this.onMove;
...@@ -1106,8 +1106,7 @@ ...@@ -1106,8 +1106,7 @@
if (pointer) { if (pointer) {
this.tracking = ref; this.tracking = ref;
} } else {
else {
pointer = this.getNearestHandle(event); pointer = this.getNearestHandle(event);
this.tracking = pointer === this.minH ? 'rzSliderModel' : 'rzSliderHigh'; this.tracking = pointer === this.minH ? 'rzSliderModel' : 'rzSliderHigh';
} }
...@@ -1141,14 +1140,12 @@ ...@@ -1141,14 +1140,12 @@
return; return;
newValue = this.minValue; newValue = this.minValue;
newOffset = 0; newOffset = 0;
} } else if (newOffset >= this.maxLeft) {
else if (newOffset >= this.maxLeft) {
if (pointer.rzsl === this.maxLeft) if (pointer.rzsl === this.maxLeft)
return; return;
newValue = this.maxValue; newValue = this.maxValue;
newOffset = this.maxLeft; newOffset = this.maxLeft;
} } else {
else {
newValue = this.offsetToValue(newOffset); newValue = this.offsetToValue(newOffset);
newValue = this.roundStep(newValue); newValue = this.roundStep(newValue);
newOffset = this.valueToOffset(newValue); newOffset = this.valueToOffset(newValue);
...@@ -1204,8 +1201,7 @@ ...@@ -1204,8 +1201,7 @@
newMinOffset = 0; newMinOffset = 0;
newMaxValue = this.minValue + this.dragging.difference; newMaxValue = this.minValue + this.dragging.difference;
newMaxOffset = this.valueToOffset(newMaxValue); newMaxOffset = this.valueToOffset(newMaxValue);
} } else if (newOffset >= this.maxLeft - this.dragging.highDist) {
else if (newOffset >= this.maxLeft - this.dragging.highDist) {
if (pointer.rzsl === this.dragging.highDist) { if (pointer.rzsl === this.dragging.highDist) {
return; return;
} }
...@@ -1213,8 +1209,7 @@ ...@@ -1213,8 +1209,7 @@
newMaxOffset = this.maxLeft; newMaxOffset = this.maxLeft;
newMinValue = this.maxValue - this.dragging.difference; newMinValue = this.maxValue - this.dragging.difference;
newMinOffset = this.valueToOffset(newMinValue); newMinOffset = this.valueToOffset(newMinValue);
} } else {
else {
newMinValue = this.offsetToValue(newOffset - this.dragging.lowDist); newMinValue = this.offsetToValue(newOffset - this.dragging.lowDist);
newMinValue = this.roundStep(newMinValue); newMinValue = this.roundStep(newMinValue);
newMinOffset = this.valueToOffset(newMinValue); newMinOffset = this.valueToOffset(newMinValue);
...@@ -1260,8 +1255,7 @@ ...@@ -1260,8 +1255,7 @@
/* We need to apply here because we are not sure that we will enter the next block */ /* We need to apply here because we are not sure that we will enter the next block */
this.scope.$apply(); this.scope.$apply();
this.callOnChange(); this.callOnChange();
} } else if (this.tracking === 'rzSliderHigh' && newValue <= this.scope.rzSliderModel) {
else if (this.tracking === 'rzSliderHigh' && newValue <= this.scope.rzSliderModel) {
this.scope[this.tracking] = this.scope.rzSliderModel; this.scope[this.tracking] = this.scope.rzSliderModel;
this.updateHandles(this.tracking, this.minH.rzsl); this.updateHandles(this.tracking, this.minH.rzsl);
this.tracking = 'rzSliderModel'; this.tracking = 'rzSliderModel';
...@@ -1311,13 +1305,15 @@ ...@@ -1311,13 +1305,15 @@
* @return {{moveEvent: string, endEvent: string}} * @return {{moveEvent: string, endEvent: string}}
*/ */
getEventNames: function(event) { getEventNames: function(event) {
var eventNames = {moveEvent: '', endEvent: ''}; var eventNames = {
moveEvent: '',
endEvent: ''
};
if (event.touches || (event.originalEvent !== undefined && event.originalEvent.touches)) { if (event.touches || (event.originalEvent !== undefined && event.originalEvent.touches)) {
eventNames.moveEvent = 'touchmove'; eventNames.moveEvent = 'touchmove';
eventNames.endEvent = 'touchend'; eventNames.endEvent = 'touchend';
} } else {
else {
eventNames.moveEvent = 'mousemove'; eventNames.moveEvent = 'mousemove';
eventNames.endEvent = 'mouseup'; eventNames.endEvent = 'mouseup';
} }
...@@ -1359,7 +1355,7 @@ ...@@ -1359,7 +1355,7 @@
}; };
}); });
// IDE assist // IDE assist
/** /**
* @name ngScope * @name ngScope
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment