diff options
| author | Arjun Roychowdhury <pliablepixels@gmail.com> | 2015-09-17 12:32:47 -0400 |
|---|---|---|
| committer | Arjun Roychowdhury <pliablepixels@gmail.com> | 2015-09-17 12:32:47 -0400 |
| commit | 7c385a7877aa4b0163dda6206f656846db2cf039 (patch) | |
| tree | 0dd09ef3261f0eca43cda22d27ab3a431ad1cd2f /www/lib/angular-awesome-slider/src | |
| parent | a0b74399c4f1a7754029e1fd7f4be3b20836404a (diff) | |
iOS9 fixes (which includes ionic updates to 1.1.0)
Diffstat (limited to 'www/lib/angular-awesome-slider/src')
14 files changed, 414 insertions, 412 deletions
diff --git a/www/lib/angular-awesome-slider/src/core/config/constants.js b/www/lib/angular-awesome-slider/src/core/config/constants.js index ed032d4d..1bda35ef 100644 --- a/www/lib/angular-awesome-slider/src/core/config/constants.js +++ b/www/lib/angular-awesome-slider/src/core/config/constants.js @@ -8,7 +8,7 @@ step: 1, smooth: true, limits: false, - round: false, + round: false, value: "3", dimension: "", vertical: false, @@ -25,8 +25,8 @@ } }, EVENTS: { - + } }); -}(angular)); +}(angular));
\ No newline at end of file diff --git a/www/lib/angular-awesome-slider/src/core/index.js b/www/lib/angular-awesome-slider/src/core/index.js index 75ca7888..069c02df 100644 --- a/www/lib/angular-awesome-slider/src/core/index.js +++ b/www/lib/angular-awesome-slider/src/core/index.js @@ -49,7 +49,7 @@ if (scope.options.calculate && typeof scope.options.calculate === 'function') { scope.from = scope.options.calculate(scope.from); scope.to = scope.options.calculate(scope.to); - } + } var OPTIONS = { from: !scope.options.round ? parseInt(scope.options.from, 10) : parseFloat(scope.options.from), @@ -88,7 +88,7 @@ if (scope.ngDisabled) { disabler(scope.ngDisabled); - } + } initialized = true; }; @@ -118,16 +118,16 @@ } if (scope.slider) { - var firstPtr = scope.slider.getPointers()[0]; - // reset to lowest value - firstPtr.set(scope.from, true); - if (ngModel.$viewValue.split(';')[1]) { - var secondPtr = scope.slider.getPointers()[1]; - // reset to biggest value - firstPtr.set(scope.to, true); - secondPtr.set(ngModel.$viewValue.split(';')[1], true); + var vals = ngModel.$viewValue.split(";"); + scope.slider.getPointers()[0].set(vals[0], true); + if (vals[1]) { + scope.slider.getPointers()[1].set(vals[1], true); + //if moving left to right with two pointers + //we need to "finish" moving the first + if(parseInt(vals[1]) > parseInt(vals[0])){ + scope.slider.getPointers()[0].set(vals[0], true); + } } - firstPtr.set(ngModel.$viewValue.split(';')[0], true); } }; @@ -161,14 +161,14 @@ scope.$watch('ngDisabled', function(value) { disabler(value); - }); + }); scope.limitValue = function(value) { if (scope.options.modelLabels) { if (angular.isFunction(scope.options.modelLabels)) { return scope.options.modelLabels(value); - } - return scope.options.modelLabels[value] !== undefined ? scope.options.modelLabels[value] : value; + } + return scope.options.modelLabels[value] !== undefined ? scope.options.modelLabels[value] : value; } return value; }; diff --git a/www/lib/angular-awesome-slider/src/core/model/draggable.factory.js b/www/lib/angular-awesome-slider/src/core/model/draggable.factory.js index 892b13a8..56dd625f 100644 --- a/www/lib/angular-awesome-slider/src/core/model/draggable.factory.js +++ b/www/lib/angular-awesome-slider/src/core/model/draggable.factory.js @@ -70,7 +70,7 @@ if( this.supportTouches_ ){ ptr[0].addEventListener( this.events_[ eventType ].touch, handler, false ); } - + ptr.bind( this.events_[ eventType ].nonTouch, handler ); }; @@ -88,13 +88,13 @@ var documentElt = angular.element(window.document); - this._bindEvent(documentElt, 'move', function(event) { + this._bindEvent(documentElt, 'move', function(event) { if(self.is.drag) { event.stopPropagation(); event.preventDefault(); if (!self.parent.disabled) { - self._mousemove(event); - } + self._mousemove(event); + } } }); this._bindEvent(documentElt, 'down', function(event) { @@ -103,8 +103,8 @@ event.preventDefault(); } }); - this._bindEvent(documentElt, 'up', function(event) { - self._mouseup(event); + this._bindEvent(documentElt, 'up', function(event) { + self._mouseup(event); }); this._bindEvent( this.ptr, 'down', function(event) { @@ -113,8 +113,8 @@ }); this._bindEvent( this.ptr, 'up', function(event) { self._mouseup( event ); - }); - + }); + // TODO see if needed this.events(); }; @@ -122,13 +122,13 @@ Draggable.prototype._mousedown = function( evt ){ this.is.drag = true; this.is.clicked = false; - this.is.mouseup = false; + this.is.mouseup = false; var coords = this._getPageCoords( evt ); this.cx = coords.x - this.ptr[0].offsetLeft; this.cy = coords.y - this.ptr[0].offsetTop; - angular.extend(this.d, { + angular.extend(this.d, { left: coords.x, top: coords.y, width: this.ptr[0].clientWidth, @@ -146,7 +146,7 @@ this.is.toclick = false; var coords = this._getPageCoords( evt ); this.onmousemove( evt, coords.x - this.cx, coords.y - this.cy ); - }; + }; Draggable.prototype._mouseup = function( evt ){ var oThis = this; @@ -171,7 +171,7 @@ // } else { // this.outer.css({ height: "auto" }); // } - + } this.onmouseup( evt ); @@ -180,4 +180,4 @@ return Draggable; }]); -}(angular)); +}(angular));
\ No newline at end of file diff --git a/www/lib/angular-awesome-slider/src/core/model/pointer.factory.js b/www/lib/angular-awesome-slider/src/core/model/pointer.factory.js index 6b23c5f7..8f938b12 100644 --- a/www/lib/angular-awesome-slider/src/core/model/pointer.factory.js +++ b/www/lib/angular-awesome-slider/src/core/model/pointer.factory.js @@ -97,4 +97,4 @@ return SliderPointer; }]); -}(angular)); +}(angular));
\ No newline at end of file diff --git a/www/lib/angular-awesome-slider/src/core/model/slider.factory.js b/www/lib/angular-awesome-slider/src/core/model/slider.factory.js index 4a905e4e..f04672b2 100644 --- a/www/lib/angular-awesome-slider/src/core/model/slider.factory.js +++ b/www/lib/angular-awesome-slider/src/core/model/slider.factory.js @@ -7,13 +7,13 @@ return this.init.apply(this, arguments); } - Slider.prototype.init = function( inputNode, templateNode, settings ){ - this.settings = settings; + Slider.prototype.init = function( inputNode, templateNode, settings ){ + this.settings = settings; this.inputNode = inputNode; this.inputNode.addClass("ng-hide"); this.settings.interval = this.settings.to-this.settings.from; - + if(this.settings.calculate && angular.isFunction(this.settings.calculate)) this.nice = this.settings.calculate; @@ -27,7 +27,7 @@ this.isAsc = settings.from < settings.to; this.create(templateNode); - + return this; }; @@ -56,20 +56,20 @@ indicator2 = angElt(is[4]), indicator3 = angElt(is[5]), indicator4 = angElt(is[6]), - pointers = [pointer1, pointer2], + pointers = [pointer1, pointer2], off = utils.offset(this.domNode), offset = { left: off.left, top: off.top, width: this.domNode[0].clientWidth, height: this.domNode[0].clientHeight - }, + }, values = self.settings.value.split(';'); - this.sizes = { + this.sizes = { domWidth: this.domNode[0].clientWidth, domHeight: this.domNode[0].clientHeight, - domOffset: offset + domOffset: offset }; // find some objects @@ -87,9 +87,9 @@ angExt(this.o.labels[1], { value: this.o.labels[1].o.find("span") }); - + // single pointer - this.settings.single = !self.settings.value.split(";")[1]; + this.settings.single = !self.settings.value.split(";")[1]; if (this.settings.single) { range.addClass('ng-hide'); @@ -121,38 +121,38 @@ /* test = self.isAsc ? value < self.settings.from : value > self.settings.from, value1 = test ? self.settings.from : value; */ - test = self.isAsc ? value > self.settings.to : value < self.settings.to; + test = self.isAsc ? value > self.settings.to : value < self.settings.to; value1 = test ? self.settings.to : value; self.o.pointers[key].set( value1, true ); - + // reinit position d offset = utils.offset(self.o.pointers[key].ptr); self.o.pointers[key].d = { left: offset.left, top: offset.top - }; - } + }; + } }); self.domNode.bind('mousedown', self.clickHandler.apply(self)); - this.o.value = angElt(this.domNode.find("i")[2]); + this.o.value = angElt(this.domNode.find("i")[2]); this.is.init = true; // CSS SKIN - if (this.settings.css) { + if (this.settings.css) { indicatorLeft.css(this.settings.css.background ? this.settings.css.background : {}); indicatorRight.css(this.settings.css.background ? this.settings.css.background : {}); if (!this.o.pointers[1]) { - indicator1.css(this.settings.css.before ? this.settings.css.before : {}); + indicator1.css(this.settings.css.before ? this.settings.css.before : {}); indicator4.css(this.settings.css.after ? this.settings.css.after : {}); } - indicator2.css(this.settings.css.default ? this.settings.css.default : {}); + indicator2.css(this.settings.css.default ? this.settings.css.default : {}); indicator3.css(this.settings.css.default ? this.settings.css.default : {}); - + range.css(this.settings.css.range ? this.settings.css.range : {}); pointer1.css(this.settings.css.pointer ? this.settings.css.pointer : {}); pointer2.css(this.settings.css.pointer ? this.settings.css.pointer : {}); @@ -165,7 +165,7 @@ }; Slider.prototype.clickHandler = function() { - var self = this; + var self = this; // in case of showing/hiding var resetPtrSize = function( ptr ) { @@ -191,51 +191,51 @@ return function(evt) { if (self.disabled) - return; + return; var vertical = self.settings.vertical, targetIdx = 0, _off = utils.offset(self.domNode), firstPtr = self.o.pointers[0], secondPtr = self.o.pointers[1] ? self.o.pointers[1] : null, - tmpPtr, + tmpPtr, evtPosition = evt.originalEvent ? evt.originalEvent: evt, - mouse = vertical ? evtPosition.pageY : evtPosition.pageX, + mouse = vertical ? evtPosition.pageY : evtPosition.pageX, css = vertical ? 'top' : 'left', offset = { left: _off.left, top: _off.top, width: self.domNode[0].clientWidth, height: self.domNode[0].clientHeight }, targetPtr = self.o.pointers[targetIdx]; - + if (secondPtr) { if (!secondPtr.d.width) { resetPtrSize(); - } + } var firstPtrPosition = utils.offset(firstPtr.ptr)[css]; var secondPtrPosition = utils.offset(secondPtr.ptr)[css]; - var middleGap = Math.abs((secondPtrPosition - firstPtrPosition) / 2); + var middleGap = Math.abs((secondPtrPosition - firstPtrPosition) / 2); var testSecondPtrToMove = mouse >= secondPtrPosition || mouse >= (secondPtrPosition - middleGap); if (testSecondPtrToMove) { targetPtr = secondPtr; } } targetPtr._parent = {offset: offset, width: offset.width, height: offset.height}; - var coords = firstPtr._getPageCoords( evt ); + var coords = firstPtr._getPageCoords( evt ); targetPtr.cx = coords.x - targetPtr.d.left; - targetPtr.cy = coords.y - targetPtr.d.top; + targetPtr.cy = coords.y - targetPtr.d.top; targetPtr.onmousemove( evt, coords.x, coords.y); - targetPtr.onmouseup(); + targetPtr.onmouseup(); angular.extend(targetPtr.d, { left: coords.x, - top: coords.y - }); - + top: coords.y + }); + self.redraw(targetPtr); return false; }; }; - Slider.prototype.disable = function( bool ) { + Slider.prototype.disable = function( bool ) { this.disabled = bool; - }; + }; Slider.prototype.nice = function( value ){ return value; @@ -260,7 +260,7 @@ if(x > 100) x = 100; return Math.round(x*10) / 10; - }; + }; Slider.prototype.getPointers = function(){ return this.o.pointers; @@ -283,7 +283,7 @@ str += '<span style="'+ position + ': ' + i*prc + '%">' + ( s[i] != '|' ? '<ins>' + s[i] + '</ins>' : '' ) + '</span>'; } - if (s[i].val <= this.settings.to && s[i].val >= this.settings.from && ! duplicate[s[i].val]) { + if (s[i].val <= this.settings.to && s[i].val >= this.settings.from && ! duplicate[s[i].val]) { duplicate[s[i].val] = true; prc = this.valueToPrc(s[i].val); label = s[i].label ? s[i].label : s[i].val; @@ -318,15 +318,15 @@ Slider.prototype.update = function(){ this.onresize(); this.drawScale(); - }; + }; Slider.prototype.drawScale = function( scaleDiv ){ angular.forEach(angular.element(scaleDiv).find('ins'), function(scaleLabel, key) { scaleLabel.style.marginLeft = - scaleLabel.clientWidth / 2; }); - }; + }; - Slider.prototype.redraw = function( pointer ){ + Slider.prototype.redraw = function( pointer ){ if(!this.is.init) { // this.settings.single if(this.o.pointers[0] && !this.o.pointers[1]) { @@ -348,13 +348,13 @@ var newPos, newWidth; - // redraw range line + // redraw range line if(this.o.pointers[0] && this.o.pointers[1]) { - newPos = !this.settings.vertical ? + newPos = !this.settings.vertical ? { left: this.o.pointers[0].value.prc + "%", width: ( this.o.pointers[1].value.prc - this.o.pointers[0].value.prc ) + "%" } : { top: this.o.pointers[0].value.prc + "%", height: ( this.o.pointers[1].value.prc - this.o.pointers[0].value.prc ) + "%" }; - + this.o.value.css(newPos); // both pointer overlap on limits @@ -363,7 +363,7 @@ } } - + if(this.o.pointers[0] && !this.o.pointers[1]) { newWidth = this.o.pointers[0].value.prc - this.originValue; if (newWidth >= 0) { @@ -378,9 +378,9 @@ } else { this.o.indicators[0].css(!this.settings.vertical ? {width: this.originValue + "%"} : {height: this.originValue + "%"}); - } + } - } + } var value = this.nice(pointer.value.origin); if (this.settings.modelLabels) { @@ -391,8 +391,8 @@ value = this.settings.modelLabels[value] !== undefined ? this.settings.modelLabels[value] : value; } } - - this.o.labels[pointer.uid].value.html(value); + + this.o.labels[pointer.uid].value.html(value); // redraw position of labels this.redrawLabels( pointer ); @@ -415,10 +415,10 @@ sizes.margin = 0; sizes.right = true; } else - sizes.right = false; - } + sizes.right = false; + } - if (!self.settings.vertical) + if (!self.settings.vertical) label.o.css({ left: prc + "%", marginLeft: sizes.margin+"px", right: "auto" }); else label.o.css({ top: prc + "%", marginLeft: "20px", marginTop: sizes.margin, bottom: "auto" }); @@ -436,9 +436,9 @@ prc = pointer.value.prc, // case hidden labelWidthSize = label.o[0].offsetWidth === 0 ? (label.o[0].textContent.length)*7 : label.o[0].offsetWidth; - + this.sizes.domWidth = this.domNode[0].clientWidth; - this.sizes.domHeight = this.domNode[0].clientHeight; + this.sizes.domHeight = this.domNode[0].clientHeight; var sizes = { label: !self.settings.vertical ? labelWidthSize : label.o[0].offsetHeight, @@ -448,12 +448,12 @@ var anotherIdx = pointer.uid === 0 ? 1:0, anotherLabel, - anotherPtr; + anotherPtr; if (!this.settings.single && !this.settings.vertical){ - // glue if near; + // glue if near; anotherLabel = this.o.labels[anotherIdx]; - anotherPtr = this.o.pointers[anotherIdx]; + anotherPtr = this.o.pointers[anotherIdx]; var label1 = this.o.labels[0], label2 = this.o.labels[1], ptr1 = this.o.pointers[0], @@ -465,27 +465,27 @@ label2.o.css(this.css.visible); value = this.getLabelValue(value); - + if (gapBetweenLabel + 10 < label1.o[0].offsetWidth+label2.o[0].offsetWidth) { anotherLabel.o.css(this.css.hidden); - + anotherLabel.value.html(value); prc = (anotherPtr.value.prc - prc) / 2 + prc; if(anotherPtr.value.prc != pointer.value.prc){ value = this.nice(this.o.pointers[0].value.origin); var value1 = this.nice(this.o.pointers[1].value.origin); value = this.getLabelValue(value); - value1 = this.getLabelValue(value1); - + value1 = this.getLabelValue(value1); + label.value.html(value + " – " + value1); sizes.label = label.o[0].offsetWidth; sizes.border = (prc * domSize) / 100; } } - else { + else { anotherLabel.value.html(value); anotherLabel.o.css(this.css.visible); - } + } } sizes = setPosition(label, sizes, prc); @@ -503,9 +503,9 @@ }; sizes = setPosition(anotherLabel, sizes2, anotherPtr.value.prc); } - + this.redrawLimits(); - }; + }; Slider.prototype.redrawLimits = function() { if (this.settings.limits) { @@ -528,19 +528,19 @@ limit = this.o.limits[1]; if(label_left + label.o[0].clientWidth > this.sizes.domWidth - limit[0].clientWidth){ - limits[1] = false; + limits[1] = false; } - + } } for(; i < limits.length; i++){ if(limits[i]){ // TODO animate - angular.element(this.o.limits[i]).addClass("animate-show"); + angular.element(this.o.limits[i]).addClass("animate-show"); } else{ angular.element(this.o.limits[i]).addClass("animate-hidde"); - } + } } } }; @@ -557,7 +557,7 @@ var value = ""; angular.forEach(this.o.pointers, function(pointer, key){ - if(pointer.value.prc !== undefined && !isNaN(pointer.value.prc)) + if(pointer.value.prc !== undefined && !isNaN(pointer.value.prc)) value += (key > 0 ? ";" : "") + $this.prcToValue(pointer.value.prc); }); return value; @@ -565,14 +565,14 @@ Slider.prototype.getLabelValue = function(value){ if (this.settings.modelLabels) { - if (angular.isFunction(this.settings.modelLabels)) { + if (angular.isFunction(this.settings.modelLabels)) { return this.settings.modelLabels(value); } else { return this.settings.modelLabels[value] !== undefined ? this.settings.modelLabels[value] : value; } - } - + } + return value; }; @@ -590,7 +590,7 @@ Slider.prototype.prcToValue = function( prc ){ var value; - if (this.settings.heterogeneity && this.settings.heterogeneity.length > 0){ + if (this.settings.heterogeneity && this.settings.heterogeneity.length > 0){ var h = this.settings.heterogeneity, _start = 0, _from = this.settings.round ? parseFloat(this.settings.from) : parseInt(this.settings.from, 10), @@ -599,7 +599,7 @@ for (; i <= h.length; i++){ var v; - if(h[i]) + if(h[i]) v = h[i].split('/'); else v = [100, _to]; @@ -614,10 +614,10 @@ _start = v1; _from = v2; } - } + } else { value = this.settings.from + (prc * this.settings.interval) / 100; - } + } return this.round(value); }; @@ -625,10 +625,10 @@ Slider.prototype.valueToPrc = function( value, pointer ){ var prc, _from = this.settings.round ? parseFloat(this.settings.from) : parseInt(this.settings.from, 10); - + if (this.settings.heterogeneity && this.settings.heterogeneity.length > 0){ var h = this.settings.heterogeneity, - _start = 0, + _start = 0, i = 0; for (; i <= h.length; i++) { @@ -636,7 +636,7 @@ if(h[i]) v = h[i].split('/'); else - v = [100, this.settings.to]; + v = [100, this.settings.to]; var v1 = this.settings.round ? parseFloat(v[0]) : parseInt(v[0], 10); var v2 = this.settings.round ? parseFloat(v[1]) : parseInt(v[1], 10); @@ -666,14 +666,14 @@ Slider.prototype.round = function( value ){ value = Math.round(value / this.settings.step) * this.settings.step; - if(this.settings.round) + if(this.settings.round) value = Math.round(value * Math.pow(10, this.settings.round)) / Math.pow(10, this.settings.round); - else + else value = Math.round(value); - return value; + return value; }; return Slider; }]); -}(angular)); +}(angular));
\ No newline at end of file diff --git a/www/lib/angular-awesome-slider/src/core/template/slider.tmpl.js b/www/lib/angular-awesome-slider/src/core/template/slider.tmpl.js index 9529f46d..af2b1499 100644 --- a/www/lib/angular-awesome-slider/src/core/template/slider.tmpl.js +++ b/www/lib/angular-awesome-slider/src/core/template/slider.tmpl.js @@ -13,7 +13,7 @@ '<i class="before"></i>'+ '<i class="default"></i>'+ '<i class="default"></i>'+ - '<i class="after"></i>'+ + '<i class="after"></i>'+ '</div>' + '<div class="jslider-pointer"></div>' + '<div class="jslider-pointer jslider-pointer-to"></div>' + diff --git a/www/lib/angular-awesome-slider/src/core/utils/utils.factory.js b/www/lib/angular-awesome-slider/src/core/utils/utils.factory.js index 180d1071..52ff8f5f 100644 --- a/www/lib/angular-awesome-slider/src/core/utils/utils.factory.js +++ b/www/lib/angular-awesome-slider/src/core/utils/utils.factory.js @@ -3,21 +3,21 @@ angular.module('angularAwesomeSlider').factory('sliderUtils', ['$window', function(win) { return { - offset: function(elm) { - // try {return elm.offset();} catch(e) {} - var rawDom = elm[0]; - var _x = 0; - var _y = 0; - var body = document.documentElement || document.body; - var scrollX = window.pageXOffset || body.scrollLeft; - var scrollY = window.pageYOffset || body.scrollTop; - _x = rawDom.getBoundingClientRect().left + scrollX; - _y = rawDom.getBoundingClientRect().top + scrollY; + offset: function(elm) { + // try {return elm.offset();} catch(e) {} + var rawDom = elm[0]; + var _x = 0; + var _y = 0; + var body = document.documentElement || document.body; + var scrollX = window.pageXOffset || body.scrollLeft; + var scrollY = window.pageYOffset || body.scrollTop; + _x = rawDom.getBoundingClientRect().left + scrollX; + _y = rawDom.getBoundingClientRect().top + scrollY; return { left: _x, top:_y }; }, browser: function() { // TODO finish browser detection and this case - var userAgent = win.navigator.userAgent; + var userAgent = win.navigator.userAgent; var browsers = {mozilla: /mozilla/i, chrome: /chrome/i, safari: /safari/i, firefox: /firefox/i, ie: /internet explorer/i}; for(var key in browsers) { if (browsers[key].test(userAgent)) { @@ -27,8 +27,8 @@ return 'unknown'; } }; - }]); + }]); })(angular); - + diff --git a/www/lib/angular-awesome-slider/src/css/less/main.less b/www/lib/angular-awesome-slider/src/css/less/main.less index 5182d4af..ce03b5fa 100644 --- a/www/lib/angular-awesome-slider/src/css/less/main.less +++ b/www/lib/angular-awesome-slider/src/css/less/main.less @@ -13,26 +13,26 @@ top: 0.6em; /* Box-model */ - cursor: pointer; - display: block; - width: 100%; + cursor: pointer; + display: block; + width: 100%; height: 1em; - /* Typography */ + /* Typography */ font-family: @font-family-base; // disabled &.disabled { opacity: 0.5; } table { - border-collapse: collapse; + border-collapse: collapse; border: 0; width: 100%; td, th { width: 100%; vertical-align: top; border: 0; - padding: 0; + padding: 0; text-align: left; vertical-align: top; } @@ -45,73 +45,73 @@ div.jslider-bg { position: relative; - i { + i { position: absolute; top: 0; height: 5px; - &.left { + &.left { left: 0; - width: 50%; - background-position: 0 0; + width: 50%; + background-position: 0 0; } &.right { left: 50%; - width: 50%; + width: 50%; background-position: right 0; } - &.range { + &.range { position: absolute; top: 0; left: 20%; width: 60%; height: 5px; z-index: 1; - background-repeat: repeat-x; - background-position: 0 -40px; + background-repeat: repeat-x; + background-position: 0 -40px; } &.default { left: 0; width: 1px; - z-index: 1; + z-index: 1; background-color: @color-pointers-default-value; - } + } - } + } } // END RANGES // POINTERS // single value hide to &.jslider-single { - div.jslider-pointer-to, - div.jslider-value-to, + div.jslider-pointer-to, + div.jslider-value-to, div.jslider-bg .v, .jslider-limitless .jslider-label { display: none; - } + } } div.jslider-pointer { position: absolute; top: -4px; - left: 20%; - z-index: 2; - width: 15px; - height: 15px; - background-position: 2px -60px; - margin-left: -8px; - cursor: pointer; + left: 20%; + z-index: 2; + width: 15px; + height: 15px; + background-position: 2px -60px; + margin-left: -8px; + cursor: pointer; cursor: hand; - &.jslider-pointer-to { + &.jslider-pointer-to { left: 80%; } - &.jslider-pointer-hover { + &.jslider-pointer-hover { background-position: -18px -60px; } } @@ -119,27 +119,27 @@ // LABELS div.jslider-label small, - div.jslider-value small { - position: relative; - top: -0.4em; + div.jslider-value small { + position: relative; + top: -0.4em; } - // limits + // limits div.jslider-label { position: absolute; - top: -18px; + top: -18px; left: 0px; padding: 0px 2px; opacity: 0.4; - color: @color-pointers-label; - font-size: @font-size-pointers-label; - line-height: @line-height-pointers-label; - white-space: nowrap; - - &.jslider-label-to { - left: auto; + color: @color-pointers-label; + font-size: @font-size-pointers-label; + line-height: @line-height-pointers-label; + white-space: nowrap; + + &.jslider-label-to { + left: auto; right: 0; - } + } } // END LABELS @@ -152,66 +152,66 @@ background: white; font-size: @font-size-pointers-value; line-height: @line-height-pointers-value; - white-space: nowrap; - -moz-border-radius: 2px; - -webkit-border-radius: 2px; - -o-border-radius: 2px; + white-space: nowrap; + -moz-border-radius: 2px; + -webkit-border-radius: 2px; + -o-border-radius: 2px; border-radius: 2px; &.jslider-value-to { left: 80%; - } + } } - // END POINTERS VALUE + // END POINTERS VALUE // SCALE - div.jslider-scale { - position: relative; + div.jslider-scale { + position: relative; top: 9px; - span { - position: absolute; - height: 5px; - border-left: 1px solid #999; - font-size: 0; + span { + position: absolute; + height: 5px; + border-left: 1px solid #999; + font-size: 0; } ins { position: absolute; top: 5px; - left: 0px; + left: 0px; font-size: 9px; - text-decoration: none; + text-decoration: none; color: #999; } } // END SCALE // VERTICAL &.vertical { - display: block; + display: block; width: 17px; height: 100%; position: relative; top: 0.6em; font-family: Arial, sans-serif; table { - height: 100%; + height: 100%; } - + &.sliderCSS .jslider-bg i, &.jslider-pointer { background-color: silver; background-image: none; } - // RANGES + // RANGES div.jslider-bg i,.jslider-pointer { background: url(../img/jslider.vertical.png) no-repeat 0 0; } - div.jslider-bg { - position: relative; + div.jslider-bg { + position: relative; height:100%; i { position: absolute; - top: 0; + top: 0; width: 5px; font-size: 0; @@ -223,16 +223,16 @@ &.left { top: 0; left: 50%; - height: 50%; - background-position: right 0; + height: 50%; + background-position: right 0; background-repeat: repeat-y } &.right { top: 50%; left: 50%; - height: 50%; - background-position: right 0; + height: 50%; + background-position: right 0; background-repeat: repeat-y } @@ -243,37 +243,37 @@ width: 60%; height: 100%; z-index: 1; - background-repeat: repeat-y; - background-position: -36px 0px; + background-repeat: repeat-y; + background-position: -36px 0px; } &.default { left: 50%; width: 5px; height:1px; - z-index: 1; + z-index: 1; background-color: @color-pointers-default-value; } - } + } } // END RANGES // POINTERS - div.jslider-pointer { - left: 62%; + div.jslider-pointer { + left: 62%; background-position: -7px -1px; - &.jslider-pointer-hover { - background-position: -7px -21px; + &.jslider-pointer-hover { + background-position: -7px -21px; } - &.jslider-pointer-to { - left: 62%; + &.jslider-pointer-to { + left: 62%; } - &.jslider-pointer-to.jslider-pointer-hover { - background-position: -7px -21px; + &.jslider-pointer-to.jslider-pointer-hover { + background-position: -7px -21px; } } // END POINTERS @@ -281,54 +281,54 @@ // LABELS div.jslider-label { top: -5px; - margin-left: 22px; + margin-left: 22px; &.jslider-label-to { top:100%; - left: inherit; + left: inherit; right: inherit; margin-top: -5px; } } // END LABELS - + // POINTERS VALUE div.jslider-value { top: 0; - left: 0; + left: 0; } - + div.jslider-value-to { top: 80%; - left: 0; + left: 0; } // END POINTERS VALUE - - // SCALES - div.jslider-scale { - position: inherit; - span { - position: absolute; - width: 5px; - height: 1px; - border-left: none; - font-size: 0; + + // SCALES + div.jslider-scale { + position: inherit; + span { + position: absolute; + width: 5px; + height: 1px; + border-left: none; + font-size: 0; border-top: 1px solid #999; } ins { - position: absolute; - left: 0px; - top: 5px; - font-size: 9px; - text-decoration: none; - color: @color-scale; + position: absolute; + left: 0px; + top: 5px; + font-size: 9px; + text-decoration: none; + color: @color-scale; } } - + } // END VERTICAL - + // SKINS @import "skin-css.less"; diff --git a/www/lib/angular-awesome-slider/src/css/less/skin-blue.less b/www/lib/angular-awesome-slider/src/css/less/skin-blue.less index 931c6afb..b5dc3545 100644 --- a/www/lib/angular-awesome-slider/src/css/less/skin-blue.less +++ b/www/lib/angular-awesome-slider/src/css/less/skin-blue.less @@ -4,8 +4,8 @@ &.jslider_blue { .jslider-bg i, - .jslider-pointer { - background: url(../img/jslider.blue.png) no-repeat 0 0; + .jslider-pointer { + background: url(../img/jslider.blue.png) no-repeat 0 0; } .jslider-bg { @@ -15,29 +15,29 @@ background-color: @color-skin-pointers-default-value; } - &.range { + &.range { z-index: 1; background-position: 0 -40px; } } } - + div.jslider-pointer { top: -6px; - width: 20px; + width: 20px; height: 17px; background-position: 2px -60px; z-index: 2; - - &.jslider-pointer-hover { + + &.jslider-pointer-hover { background-position: -20px -60px; } } - + &.vertical { div.jslider-bg i, - div.jslider-pointer { - background: url(../img/jslider.blue.vertical.png) no-repeat 0 0; + div.jslider-pointer { + background: url(../img/jslider.blue.vertical.png) no-repeat 0 0; } div.jslider-bg { @@ -48,7 +48,7 @@ background-position: -37px 0; } - &.before, + &.before, &.after { background: none; } @@ -60,15 +60,15 @@ } div.jslider-pointer { - top: -6px; - width: 20px; - height: 17px; + top: -6px; + width: 20px; + height: 17px; background-position: -7px 0; - &.jslider-pointer-hover { + &.jslider-pointer-hover { background-position: -7px -20px; } - + } div.jslider-value { @@ -76,4 +76,4 @@ } } -} +}
\ No newline at end of file diff --git a/www/lib/angular-awesome-slider/src/css/less/skin-css.less b/www/lib/angular-awesome-slider/src/css/less/skin-css.less index 43b45901..8c06ba85 100644 --- a/www/lib/angular-awesome-slider/src/css/less/skin-css.less +++ b/www/lib/angular-awesome-slider/src/css/less/skin-css.less @@ -8,56 +8,56 @@ i { &.left { left: 0; - width: 50%; - background-color: @color-skin-background; + width: 50%; + background-color: @color-skin-background; background-image: none; } - &.right { - width: 50%; - left: 50%; - background-color: @color-skin-background; + &.right { + width: 50%; + left: 50%; + background-color: @color-skin-background; background-image: none; } - &.before { - left: 0; - width: 1px; - background-color: @color-skin-css-pointers-before-value; + &.before { + left: 0; + width: 1px; + background-color: @color-skin-css-pointers-before-value; background-image: none; } &.default { - left: 0; + left: 0; width: 1px; - z-index: 1; - background-color: @color-skin-css-pointers-default-value; + z-index: 1; + background-color: @color-skin-css-pointers-default-value; background-image: none; } - &.after { - left: 0; - background-color: @color-skin-css-pointers-after-value; + &.after { + left: 0; + background-color: @color-skin-css-pointers-after-value; background-image: none; } &.range { position: absolute; top: 0; left: 20%; - width: 60%; + width: 60%; height: 5px; - z-index: 1; - background-image: none; - background-color: #777575 + z-index: 1; + background-image: none; + background-color: #777575 } } } div.jslider-pointer { top: -3px; - left: 15px; - width: 10px; + left: 15px; + width: 10px; height: 10px; margin-left: -5px; - background-color: silver; - background-color: #615959; - border-radius: 50%; + background-color: silver; + background-color: #615959; + border-radius: 50%; } div.jslider-bg i,div.jslider-pointer { @@ -78,45 +78,45 @@ width: 5px; &.left { - top: 0; - height: 50%; - background-color: @color-skin-background; + top: 0; + height: 50%; + background-color: @color-skin-background; background-image: none; } - &.right { - height: 50%; - top: 50%; - background-color: @color-skin-background; + &.right { + height: 50%; + top: 50%; + background-color: @color-skin-background; background-image: none; } - &.range { + &.range { height: 100%; z-index: 1; - background-color: #777575; + background-color: #777575; background-image: none; } - &.before { - background-color: @color-skin-css-pointers-before-value; + &.before { + background-color: @color-skin-css-pointers-before-value; background-image: none; } &.default { height: 1px; - background-color: @color-skin-css-pointers-default-value; + background-color: @color-skin-css-pointers-default-value; background-image: none; - z-index: 2; + z-index: 2; } - &.after { - background-color: @color-skin-css-pointers-after-value; + &.after { + background-color: @color-skin-css-pointers-after-value; background-image: none; } } - + } div.jslider-bg i,div.jslider-pointer { @@ -125,10 +125,10 @@ div.jslider-pointer { left: 50%; - width: 10px; + width: 10px; height: 10px; - background-color: #615959; - border-radius: 50%; + background-color: #615959; + border-radius: 50%; margin-left: -3px; &.jslider-pointer-to { @@ -136,4 +136,4 @@ } } } -} +} diff --git a/www/lib/angular-awesome-slider/src/css/less/skin-plastic.less b/www/lib/angular-awesome-slider/src/css/less/skin-plastic.less index 31ebf55d..a6c41106 100644 --- a/www/lib/angular-awesome-slider/src/css/less/skin-plastic.less +++ b/www/lib/angular-awesome-slider/src/css/less/skin-plastic.less @@ -4,8 +4,8 @@ &.jslider_plastic { .jslider-bg i, - .jslider-pointer { - background: url(../img/jslider.plastic.png) no-repeat 0 0; + .jslider-pointer { + background: url(../img/jslider.plastic.png) no-repeat 0 0; } .jslider-bg { @@ -15,29 +15,29 @@ background-color: @color-skin-pointers-default-value; } - &.range { + &.range { z-index: 1; background-position: 0 -40px; } } } - + .jslider-pointer { - z-index: 2; - width: 20px; - height: 17px; + z-index: 2; + width: 20px; + height: 17px; top: -4px; background-position: 2px -60px; - &.jslider-pointer-hover { + &.jslider-pointer-hover { background-position: -18px -60px; } } - + &.vertical { div.jslider-bg i, - div.jslider-pointer { - background: url(../img/jslider.plastic.vertical.png) no-repeat 0 0; + div.jslider-pointer { + background: url(../img/jslider.plastic.vertical.png) no-repeat 0 0; } div.jslider-bg { @@ -49,7 +49,7 @@ background-position: -35px 0; } - &.before, + &.before, &.after { background: none; } @@ -63,11 +63,11 @@ div.jslider-pointer { top: -6px; margin-left: -6px; - width: 20px; - height: 17px; + width: 20px; + height: 17px; background-position: -7px -1px; - &.jslider-pointer-hover { + &.jslider-pointer-hover { background-position: -7px -21px; } diff --git a/www/lib/angular-awesome-slider/src/css/less/skin-round.less b/www/lib/angular-awesome-slider/src/css/less/skin-round.less index b0247d7b..4e7ddf1c 100644 --- a/www/lib/angular-awesome-slider/src/css/less/skin-round.less +++ b/www/lib/angular-awesome-slider/src/css/less/skin-round.less @@ -4,10 +4,10 @@ &.jslider_round { div.jslider-bg i, - div.jslider-pointer { - background: url(../img/jslider.round.png) no-repeat 0 0; + div.jslider-pointer { + background: url(../img/jslider.round.png) no-repeat 0 0; } - + div.jslider-bg { i { background-position: 0 -20px; @@ -15,29 +15,29 @@ background-color: #C2C7CA; } - &.range { + &.range { z-index: 1; background-position: 0 -40px; } } - } + } div.jslider-pointer { top: -6px; - width: 20px; - height: 17px; + width: 20px; + height: 17px; background-position: 0 -60px; z-index: 2; - &.jslider-pointer-hover { + &.jslider-pointer-hover { background-position: -20px -60px; } } &.vertical { div.jslider-bg i, - div.jslider-pointer { - background: url(../img/jslider.round.vertical.png) no-repeat 0 0; + div.jslider-pointer { + background: url(../img/jslider.round.vertical.png) no-repeat 0 0; } div.jslider-bg { @@ -47,7 +47,7 @@ background-position: -37px 0; } - &.before, + &.before, &.after { background: none; } @@ -55,17 +55,17 @@ &.default { background-color: @color-skin-pointers-default-value; } - } + } } div.jslider-pointer { - top: -6px; - width: 20px; - height: 17px; + top: -6px; + width: 20px; + height: 17px; background-position: -4px -3px; - &.jslider-pointer-hover { - background-position: -4px -23px; + &.jslider-pointer-hover { + background-position: -4px -23px; } &.jslider-value-to { @@ -78,4 +78,4 @@ } } -} +}
\ No newline at end of file diff --git a/www/lib/angular-awesome-slider/src/index.html b/www/lib/angular-awesome-slider/src/index.html index 06b3eb90..2f34491b 100644 --- a/www/lib/angular-awesome-slider/src/index.html +++ b/www/lib/angular-awesome-slider/src/index.html @@ -16,6 +16,8 @@ <script type="text/javascript" src="core/utils/utils.factory.js"></script> <script type="text/javascript" src="core/template/slider.tmpl.js"></script> + <!--<script type="text/javascript" src="../dist/angular-awesome-slider.js"></script>--> + <!-- <script type="text/javascript" src="../dist/angular-awesome-slider.min.js"></script> @@ -132,7 +134,7 @@ $scope.id2 = "bob"; $scope.value = "10;20"; $scope.value2 = "12;15"; - $scope.value3 = "7;20"; + $scope.value3 = {value:"7;20"}; $scope.value3bis = "8"; $scope.value4 = "999;1700"; $scope.value5 = "10;20"; @@ -366,7 +368,7 @@ step: 1, dimension: "" }; - //$scope.value3 = "10;50"; + $scope.value3 = {value:"10;50"}; }; @@ -377,7 +379,7 @@ app.directive('sliderRangeFilter', [function() { return { restrict: 'A', - template: '<div id="searchBySliderFilter" class="filter-slider"><input ng-model="value3" type="text" id="mySlider1" slider options="options" /></div><div>Current value is: {{value3}}</div>', + template: '<div id="searchBySliderFilter" class="filter-slider"><input ng-model="value3.value" type="text" id="mySlider1" slider options="options" /></div><div>Current value is: {{value3.value}}</div>', link: function($scope, element, attrs) { } diff --git a/www/lib/angular-awesome-slider/src/jquery.slider.js b/www/lib/angular-awesome-slider/src/jquery.slider.js index 6c373fcc..60c86773 100644 --- a/www/lib/angular-awesome-slider/src/jquery.slider.js +++ b/www/lib/angular-awesome-slider/src/jquery.slider.js @@ -1,6 +1,6 @@ /** * jquery.slider - Slider ui control in jQuery - * + * * Written by * Egor Khmelev (hmelyoff@gmail.com) * @@ -8,22 +8,22 @@ * * @author Egor Khmelev * @version 1.1.0-RELEASE ($Id$) - * + * * Dependencies - * + * * jQuery (http://jquery.com) * jquery.numberformatter (http://code.google.com/p/jquery-numberformatter/) * tmpl (http://ejohn.org/blog/javascript-micro-templating/) * jquery.dependClass * draggable - * + * **/ (function( $ ) { - + function isArray( value ){ if( typeof value == "undefined" ) return false; - + if (value instanceof Array || (!(value instanceof Object) && (Object.prototype.toString.call((value)) == '[object Array]') || typeof value.length == 'number' && @@ -33,7 +33,7 @@ )) { return true; } - + return false; } @@ -41,13 +41,13 @@ var jNode = $(node); if( !jNode.data( "jslider" ) ) jNode.data( "jslider", new jSlider( node, settings ) ); - + return jNode.data( "jslider" ); }; - + $.fn.slider = function( action, opt_value ){ var returnValue, args = arguments; - + function isDef( val ){ return val !== undefined; }; @@ -55,10 +55,10 @@ function isDefAndNotNull( val ){ return val != null; }; - + this.each(function(){ var self = $.slider( this, action ); - + // do actions if( typeof action == "string" ){ switch( action ){ @@ -69,13 +69,13 @@ pointers[0].set( args[ 1 ] ); pointers[0].setIndexOver(); } - + if( isDefAndNotNull( pointers[1] ) && isDefAndNotNull( args[2] ) ){ pointers[1].set( args[ 2 ] ); pointers[1].setIndexOver(); } } - + else if( isDef( args[ 1 ] ) ){ var pointers = self.getPointers(); if( isDefAndNotNull( pointers[0] ) && isDefAndNotNull( args[1] ) ){ @@ -83,7 +83,7 @@ pointers[0].setIndexOver(); } } - + else returnValue = self.getValue(); @@ -122,17 +122,17 @@ for (var i=0; i < value.length; i++) { returnValue += (i > 0 ? ";" : "") + self.nice( value[i] ); }; - + break; - + case "skin": self.setSkin( args[1] ); break; }; - + } - + // return actual object else if( !action && !opt_value ){ if( !isArray( returnValue ) ) @@ -141,14 +141,14 @@ returnValue.push( self ); } }); - + // flatten array just with one slider if( isArray( returnValue ) && returnValue.length == 1 ) returnValue = returnValue[ 0 ]; - + return returnValue || this; }; - + var OPTIONS = { settings: { @@ -162,7 +162,7 @@ value: "5;7", dimension: "" }, - + className: "jslider", selector: ".jslider-", @@ -176,19 +176,19 @@ '<div class="<%=className%>-pointer"></div>' + '<div class="<%=className%>-pointer <%=className%>-pointer-to"></div>' + - + '<div class="<%=className%>-label"><span><%=settings.from%></span></div>' + '<div class="<%=className%>-label <%=className%>-label-to"><span><%=settings.to%></span><%=settings.dimension%></div>' + '<div class="<%=className%>-value"><span></span><%=settings.dimension%></div>' + '<div class="<%=className%>-value <%=className%>-value-to"><span></span><%=settings.dimension%></div>' + - + '<div class="<%=className%>-scale"><%=scale%></div>'+ '</td></tr></table>' + '</span>' ) - + }; function jSlider(){ @@ -197,13 +197,13 @@ jSlider.prototype.init = function( node, settings ){ this.settings = $.extend(true, {}, OPTIONS.settings, settings ? settings : {}); - + // obj.sliderHandler = this; this.inputNode = $( node ).hide(); - + this.settings.interval = this.settings.to-this.settings.from; this.settings.value = this.inputNode.attr("value"); - + if( this.settings.calculate && $.isFunction( this.settings.calculate ) ) this.nice = this.settings.calculate; @@ -217,14 +217,14 @@ this.create(); }; - + jSlider.prototype.onstatechange = function(){ - + }; - + jSlider.prototype.create = function(){ var $this = this; - + this.domNode = $( OPTIONS.template({ className: OPTIONS.className, settings: { @@ -234,10 +234,10 @@ }, scale: this.generateScale() }) ); - + this.inputNode.after( this.domNode ); this.drawScale(); - + // set skin class if( this.settings.skin && this.settings.skin.length > 0 ) this.setSkin( this.settings.skin ); @@ -272,7 +272,7 @@ value: this.o.labels[1].o.find("span") }); - + if( !$this.settings.value.split(";")[1] ){ this.settings.single = true; this.domNode.addDependClass("single"); @@ -291,18 +291,18 @@ value = value < $this.settings.from ? $this.settings.from : value; value = value > $this.settings.to ? $this.settings.to : value; - + $this.o.pointers[i].set( value, true ); } }); - + this.o.value = this.domNode.find(".v"); this.is.init = true; - + $.each(this.o.pointers, function(i){ $this.redraw(this); }); - + (function(self){ $(window).resize(function(){ self.onresize(); @@ -310,24 +310,24 @@ })(this); }; - + jSlider.prototype.setSkin = function( skin ){ if( this.skin_ ) this.domNode.removeDependClass( this.skin_, "_" ); this.domNode.addDependClass( this.skin_ = skin, "_" ); }; - + jSlider.prototype.setPointersIndex = function( i ){ $.each(this.getPointers(), function(i){ this.index( i ); }); }; - + jSlider.prototype.getPointers = function(){ return this.o.pointers; }; - + jSlider.prototype.generateScale = function(){ if( this.settings.scale && this.settings.scale.length > 0 ){ var str = ""; @@ -341,13 +341,13 @@ return ""; }; - + jSlider.prototype.drawScale = function(){ this.domNode.find(OPTIONS.selector + "scale span ins").each(function(){ $(this).css({ marginLeft: -$(this).outerWidth()/2 }); }); }; - + jSlider.prototype.onresize = function(){ var self = this; this.sizes = { @@ -359,19 +359,19 @@ self.redraw(this); }); }; - + jSlider.prototype.update = function(){ this.onresize(); this.drawScale(); }; - + jSlider.prototype.limits = function( x, pointer ){ // smooth if( !this.settings.smooth ){ var step = this.settings.step*100 / ( this.settings.interval ); x = Math.round( x/step ) * step; } - + var another = this.o.pointers[1-pointer.uid]; if( another && pointer.uid && x < another.value.prc ) x = another.value.prc; if( another && !pointer.uid && x > another.value.prc ) x = another.value.prc; @@ -379,15 +379,15 @@ // base limit if( x < 0 ) x = 0; if( x > 100 ) x = 100; - + return Math.round( x*10 ) / 10; }; - + jSlider.prototype.redraw = function( pointer ){ if( !this.is.init ) return false; - + this.setValue(); - + // redraw range line if( this.o.pointers[0] && this.o.pointers[1] ) this.o.value.css({ left: this.o.pointers[0].value.prc + "%", width: ( this.o.pointers[1].value.prc - this.o.pointers[0].value.prc ) + "%" }); @@ -397,12 +397,12 @@ pointer.value.origin ) ); - + // redraw position of labels this.redrawLabels( pointer ); }; - + jSlider.prototype.redrawLabels = function( pointer ){ function setPosition( label, sizes, prc ){ @@ -419,7 +419,7 @@ sizes.right = true; } else sizes.right = false; - + label.o.css({ left: prc + "%", marginLeft: sizes.margin, right: "auto" }); if( sizes.right ) label.o.css({ left: "auto", right: 0 }); return sizes; @@ -480,7 +480,7 @@ } sizes = setPosition( label, sizes, prc ); - + /* draw second label */ if( another_label ){ var sizes = { @@ -490,10 +490,10 @@ }; sizes = setPosition( another_label, sizes, another.value.prc ); } - + this.redrawLimits(); }; - + jSlider.prototype.redrawLimits = function(){ if( this.settings.limits ){ @@ -502,7 +502,7 @@ for( key in this.o.pointers ){ if( !this.settings.single || key == 0 ){ - + var pointer = this.o.pointers[key]; var label = this.o.labels[pointer.uid]; var label_left = label.o.offset().left - this.sizes.domOffset.left; @@ -527,7 +527,7 @@ } }; - + jSlider.prototype.setValue = function(){ var value = this.getValue(); this.inputNode.attr( "value", value ); @@ -537,7 +537,7 @@ jSlider.prototype.getValue = function(){ if(!this.is.init) return false; var $this = this; - + var value = ""; $.each( this.o.pointers, function(i){ if( this.value.prc != undefined && !isNaN(this.value.prc) ) value += (i > 0 ? ";" : "") + $this.prcToValue( this.value.prc ); @@ -548,14 +548,14 @@ jSlider.prototype.getPrcValue = function(){ if(!this.is.init) return false; var $this = this; - + var value = ""; $.each( this.o.pointers, function(i){ if( this.value.prc != undefined && !isNaN(this.value.prc) ) value += (i > 0 ? ";" : "") + this.value.prc; }); return value; }; - + jSlider.prototype.prcToValue = function( prc ){ if( this.settings.heterogeneity && this.settings.heterogeneity.length > 0 ){ @@ -567,10 +567,10 @@ for( var i=0; i <= h.length; i++ ){ if( h[i] ) var v = h[i].split("/"); else var v = [100, this.settings.to]; - + v[0] = new Number(v[0]); v[1] = new Number(v[1]); - + if( prc >= _start && prc <= v[0] ) { var value = _from + ( (prc-_start) * (v[1]-_from) ) / (v[0]-_start); } @@ -585,8 +585,8 @@ return this.round( value ); }; - - jSlider.prototype.valueToPrc = function( value, pointer ){ + + jSlider.prototype.valueToPrc = function( value, pointer ){ if( this.settings.heterogeneity && this.settings.heterogeneity.length > 0 ){ var h = this.settings.heterogeneity; @@ -597,7 +597,7 @@ if(h[i]) var v = h[i].split("/"); else var v = [100, this.settings.to]; v[0] = new Number(v[0]); v[1] = new Number(v[1]); - + if(value >= _from && value <= v[1]){ var prc = pointer.limits(_start + (value-_from)*(v[0]-_start)/(v[1]-_from)); } @@ -611,39 +611,39 @@ return prc; }; - + jSlider.prototype.round = function( value ){ value = Math.round( value / this.settings.step ) * this.settings.step; if( this.settings.round ) value = Math.round( value * Math.pow(10, this.settings.round) ) / Math.pow(10, this.settings.round); else value = Math.round( value ); return value; }; - + jSlider.prototype.nice = function( value ){ value = value.toString().replace(/,/gi, ".").replace(/ /gi, "");; if( $.formatNumber ){ return $.formatNumber( new Number(value), this.settings.format || {} ).replace( /-/gi, "−" ); } - + else { return new Number(value); } }; - + function jSliderPointer(){ Draggable.apply( this, arguments ); } jSliderPointer.prototype = new Draggable(); - + jSliderPointer.prototype.oninit = function( ptr, id, _constructor ){ this.uid = id; this.parent = _constructor; this.value = {}; this.settings = this.parent.settings; }; - + jSliderPointer.prototype.onmousedown = function(evt){ this._parent = { offset: this.parent.domNode.offset(), @@ -657,27 +657,27 @@ var coords = this._getPageCoords( evt ); this._set( this.calc( coords.x ) ); }; - + jSliderPointer.prototype.onmouseup = function( evt ){ if( this.parent.settings.callback && $.isFunction(this.parent.settings.callback) ) this.parent.settings.callback.call( this.parent, this.parent.getValue() ); - + this.ptr.removeDependClass("hover"); }; - + jSliderPointer.prototype.setIndexOver = function(){ this.parent.setPointersIndex( 1 ); this.index( 2 ); }; - + jSliderPointer.prototype.index = function( i ){ this.ptr.css({ zIndex: i }); }; - + jSliderPointer.prototype.limits = function( x ){ return this.parent.limits( x, this ); }; - + jSliderPointer.prototype.calc = function(coords){ var x = this.limits(((coords-this._parent.offset.left)*100)/this._parent.width); return x; @@ -687,7 +687,7 @@ this.value.origin = this.parent.round(value); this._set( this.parent.valueToPrc( value, this ), opt_origin ); }; - + jSliderPointer.prototype._set = function( prc, opt_origin ){ if( !opt_origin ) this.value.origin = this.parent.prcToValue(prc); @@ -696,5 +696,5 @@ this.ptr.css({ left: prc + "%" }); this.parent.redraw(this); }; - + })(jQuery); |
