|
|
@ -4,9 +4,22 @@ define(
|
|
|
|
], function ($) {
|
|
|
|
], function ($) {
|
|
|
|
'use strict';
|
|
|
|
'use strict';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$.fn.spinForPromise = function (promise) {
|
|
|
|
|
|
|
|
var self = this;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!promise || promise.state() !== 'pending') {
|
|
|
|
|
|
|
|
return this;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
promise.always(function () {
|
|
|
|
|
|
|
|
self.stopSpin();
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return this.startSpin();
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
$.fn.startSpin = function () {
|
|
|
|
$.fn.startSpin = function () {
|
|
|
|
|
|
|
|
|
|
|
|
var icon = this.find('i');
|
|
|
|
var icon = this.find('i').andSelf('i');
|
|
|
|
|
|
|
|
|
|
|
|
var iconClasses = icon.attr('class').match(/(?:^|\s)icon\-.+?(?:$|\s)/);
|
|
|
|
var iconClasses = icon.attr('class').match(/(?:^|\s)icon\-.+?(?:$|\s)/);
|
|
|
|
|
|
|
|
|
|
|
@ -31,7 +44,7 @@ define(
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
$.fn.stopSpin = function () {
|
|
|
|
$.fn.stopSpin = function () {
|
|
|
|
var icon = this.find('i');
|
|
|
|
var icon = this.find('i').andSelf('i');
|
|
|
|
|
|
|
|
|
|
|
|
this.removeClass('disabled');
|
|
|
|
this.removeClass('disabled');
|
|
|
|
icon.removeClass('icon-spin icon-nd-spinner');
|
|
|
|
icon.removeClass('icon-spin icon-nd-spinner');
|
|
|
|