From b319a0f95b9137aeb86317f0c1ee417d9c58c0fa Mon Sep 17 00:00:00 2001 From: Thierry Parmentelat Date: Sat, 14 Dec 2013 14:52:56 +0100 Subject: [PATCH] cleanup spin functions - actually use our defaults - provide means to tweak defaults on a per plugin basis --- manifold/static/js/manifold.js | 13 ------------- manifold/static/js/plugin.js | 13 +++++++++---- 2 files changed, 9 insertions(+), 17 deletions(-) diff --git a/manifold/static/js/manifold.js b/manifold/static/js/manifold.js index dc728264..df8955d1 100644 --- a/manifold/static/js/manifold.js +++ b/manifold/static/js/manifold.js @@ -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': diff --git a/manifold/static/js/plugin.js b/manifold/static/js/plugin.js index fb7bf595..a751e171 100644 --- a/manifold/static/js/plugin.js +++ b/manifold/static/js/plugin.js @@ -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 */ -- 2.43.0