cleanup spin functions - actually use our defaults - provide means to tweak defaults...
authorThierry Parmentelat <thierry.parmentelat@inria.fr>
Sat, 14 Dec 2013 13:52:56 +0000 (14:52 +0100)
committerThierry Parmentelat <thierry.parmentelat@inria.fr>
Sat, 14 Dec 2013 13:52:56 +0000 (14:52 +0100)
manifold/static/js/manifold.js
manifold/static/js/plugin.js

index dc72826..df8955d 100644 (file)
@@ -186,19 +186,6 @@ var manifold = {
 
     separator: '__',
 
-    spin_presets: {},
-
-    spin: function(locator, active /*= true */) {
-        active = typeof active !== 'undefined' ? active : true;
-        try {
-            if (active) {
-                $(locator).spin(manifold.spin_presets);
-            } else {
-                $(locator).spin(false);
-            }
-        } catch (err) { messages.debug("Cannot turn spins on/off " + err); }
-    },
-
     get_type: function(variable) {
         switch(Object.toType(variable)) {
             case 'number':
index fb7bf59..a751e17 100644 (file)
@@ -264,13 +264,18 @@ var Plugin = Class.extend({
     },
 
     /* SPIN */
-
-    spin: function() {
-        manifold.spin(this.element);
+    // use spin() to get our default spin settings (called presets)
+    // use spin(true) to get spin's builtin defaults
+    // you can also call spin_presets() yourself and tweak what you need to, like validatebutton does
+    spin: function (presets) {
+       var presets = ( presets === undefined ) ? spin_presets() : presets;
+       try { this.$element.spin(presets); }
+       catch (err) { messages.debug("Cannot turn on spin " + err); }
     },
 
     unspin: function() {
-        manifold.spin(this.element, false);
+       try { this.$element.spin(false); }
+       catch (err) { messages.debug("Cannot turn off spin " + err); }
     },
 
     /* TEMPLATE */