Bug 868: Remove AD-SAL components which were deprecated in Lithium
[controller.git] / opendaylight / adsal / web / root / src / main / resources / js / fuelux / spinner.js
diff --git a/opendaylight/adsal/web/root/src/main/resources/js/fuelux/spinner.js b/opendaylight/adsal/web/root/src/main/resources/js/fuelux/spinner.js
deleted file mode 100755 (executable)
index 97720ee..0000000
+++ /dev/null
@@ -1,201 +0,0 @@
-/*\r
- * Fuel UX Spinner\r
- * https://github.com/ExactTarget/fuelux\r
- *\r
- * Copyright (c) 2012 ExactTarget\r
- * Licensed under the MIT license.\r
- */\r
-\r
-define(['require','jquery'],function(require) {\r
-\r
-       var $ = require('jquery');\r
-\r
-\r
-       // SPINNER CONSTRUCTOR AND PROTOTYPE\r
-\r
-       var Spinner = function (element, options) {\r
-               this.$element = $(element);\r
-               this.options = $.extend({}, $.fn.spinner.defaults, options);\r
-               this.$input = this.$element.find('.spinner-input');\r
-               this.$element.on('keyup', this.$input, $.proxy(this.change, this));\r
-\r
-               if (this.options.hold) {\r
-                       this.$element.on('mousedown', '.spinner-up', $.proxy(function() { this.startSpin(true); } , this));\r
-                       this.$element.on('mouseup', '.spinner-up, .spinner-down', $.proxy(this.stopSpin, this));\r
-                       this.$element.on('mouseout', '.spinner-up, .spinner-down', $.proxy(this.stopSpin, this));\r
-                       this.$element.on('mousedown', '.spinner-down', $.proxy(function() {this.startSpin(false);} , this));\r
-               } else {\r
-                       this.$element.on('click', '.spinner-up', $.proxy(function() { this.step(true); } , this));\r
-                       this.$element.on('click', '.spinner-down', $.proxy(function() { this.step(false); }, this));\r
-               }\r
-\r
-               this.switches = {\r
-                       count: 1,\r
-                       enabled: true\r
-               };\r
-\r
-               if (this.options.speed === 'medium') {\r
-                       this.switches.speed = 300;\r
-               } else if (this.options.speed === 'fast') {\r
-                       this.switches.speed = 100;\r
-               } else {\r
-                       this.switches.speed = 500;\r
-               }\r
-\r
-               this.lastValue = null;\r
-\r
-               this.render();\r
-\r
-               if (this.options.disabled) {\r
-                       this.disable();\r
-               }\r
-       };\r
-\r
-       Spinner.prototype = {\r
-               constructor: Spinner,\r
-\r
-               render: function () {\r
-                       this.$input.val(this.options.value);\r
-                       this.$input.attr('maxlength',(this.options.max + '').split('').length);\r
-               },\r
-\r
-               change: function () {\r
-                       var newVal = this.$input.val();\r
-\r
-                       if(newVal/1){\r
-                               this.options.value = newVal/1;\r
-                       }else{\r
-                               newVal = newVal.replace(/[^0-9]/g,'');\r
-                               this.$input.val(newVal);\r
-                               this.options.value = newVal/1;\r
-                       }\r
-\r
-                       this.triggerChangedEvent();\r
-               },\r
-\r
-               stopSpin: function () {\r
-                       clearTimeout(this.switches.timeout);\r
-                       this.switches.count = 1;\r
-                       this.triggerChangedEvent();\r
-               },\r
-\r
-               triggerChangedEvent: function () {\r
-                       var currentValue = this.value();\r
-                       if (currentValue === this.lastValue) return;\r
-\r
-                       this.lastValue = currentValue;\r
-\r
-                       // Primary changed event\r
-                       this.$element.trigger('changed', currentValue);\r
-\r
-                       // Undocumented, kept for backward compatibility\r
-                       this.$element.trigger('change');\r
-               },\r
-\r
-               startSpin: function (type) {\r
-\r
-                       if (!this.options.disabled) {\r
-                               var divisor = this.switches.count;\r
-\r
-                               if (divisor === 1) {\r
-                                       this.step(type);\r
-                                       divisor = 1;\r
-                               } else if (divisor < 3){\r
-                                       divisor = 1.5;\r
-                               } else if (divisor < 8){\r
-                                       divisor = 2.5;\r
-                               } else {\r
-                                       divisor = 4;\r
-                               }\r
-\r
-                               this.switches.timeout = setTimeout($.proxy(function() {this.iterator(type);} ,this),this.switches.speed/divisor);\r
-                               this.switches.count++;\r
-                       }\r
-               },\r
-\r
-               iterator: function (type) {\r
-                       this.step(type);\r
-                       this.startSpin(type);\r
-               },\r
-\r
-               step: function (dir) {\r
-                       var curValue = this.options.value;\r
-                       var limValue = dir ? this.options.max : this.options.min;\r
-\r
-                       if ((dir ? curValue < limValue : curValue > limValue)) {\r
-                               var newVal = curValue + (dir ? 1 : -1) * this.options.step;\r
-\r
-                               if (dir ? newVal > limValue : newVal < limValue) {\r
-                                       this.value(limValue);\r
-                               } else {\r
-                                       this.value(newVal);\r
-                               }\r
-                       }\r
-               },\r
-\r
-               value: function (value) {\r
-                       if (!isNaN(parseFloat(value)) && isFinite(value)) {\r
-                               value = parseFloat(value);\r
-                               this.options.value = value;\r
-                               this.$input.val(value);\r
-                               return this;\r
-                       } else {\r
-                               return this.options.value;\r
-                       }\r
-               },\r
-\r
-               disable: function () {\r
-                       this.options.disabled = true;\r
-                       this.$input.attr('disabled','');\r
-                       this.$element.find('button').addClass('disabled');\r
-               },\r
-\r
-               enable: function () {\r
-                       this.options.disabled = false;\r
-                       this.$input.removeAttr("disabled");\r
-                       this.$element.find('button').removeClass('disabled');\r
-               }\r
-       };\r
-\r
-\r
-       // SPINNER PLUGIN DEFINITION\r
-\r
-       $.fn.spinner = function (option,value) {\r
-               var methodReturn;\r
-\r
-               var $set = this.each(function () {\r
-                       var $this = $(this);\r
-                       var data = $this.data('spinner');\r
-                       var options = typeof option === 'object' && option;\r
-\r
-                       if (!data) $this.data('spinner', (data = new Spinner(this, options)));\r
-                       if (typeof option === 'string') methodReturn = data[option](value);\r
-               });\r
-\r
-               return (methodReturn === undefined) ? $set : methodReturn;\r
-       };\r
-\r
-       $.fn.spinner.defaults = {\r
-               value: 1,\r
-               min: 1,\r
-               max: 999,\r
-               step: 1,\r
-               hold: true,\r
-               speed: 'medium',\r
-               disabled: false\r
-       };\r
-\r
-       $.fn.spinner.Constructor = Spinner;\r
-\r
-\r
-       // SPINNER DATA-API\r
-\r
-       $(function () {\r
-               $('body').on('mousedown.spinner.data-api', '.spinner', function (e) {\r
-                       var $this = $(this);\r
-                       if ($this.data('spinner')) return;\r
-                       $this.spinner($this.data());\r
-               });\r
-       });\r
-\r
-});\r