*/
setOption: function(optionName, optionData) {
this.options[optionName] = optionData;
+ },
+
+ /**
+ * Displays a spinner image for given element.
+ *
+ * @param jQuery element
+ */
+ showSpinner: function(element) {
+ element = $(element);
+
+ if (element.getTagName() !== 'img') {
+ console.debug('Given element is not an image, aborting.');
+ return;
+ }
+
+ // force element dimensions
+ element.attr('width', element.attr('width'));
+ element.attr('height', element.attr('height'));
+
+ // replace image
+ element.attr('src', WCF.Icon.get('wcf.global.spinner'));
}
};
if ($target.data('confirmMessage')) {
if (confirm($target.data('confirmMessage'))) {
+ this.proxy.showSpinner($target);
this._sendRequest($target);
}
}
else {
+ this.proxy.showSpinner($target);
this._sendRequest($target);
}
_variables: new WCF.Dictionary(),
/**
- * @see WCF.Dictionary.addObject()
+ * @see WCF.Dictionary.add()
*/
add: function(key, value) {
this._variables.add(key, value);
}
};
+/**
+ * Icon collection used across all JavaScript classes.
+ *
+ * @see WCF.Dictionary
+ */
+WCF.Icon = {
+ /**
+ * list of icons
+ * @var WCF.Dictionary
+ */
+ _icons: new WCF.Dictionary(),
+
+ /**
+ * @see WCF.Dictionary.add()
+ */
+ add: function(name, path) {
+ this._icons.add(name, path);
+ },
+
+ /**
+ * @see WCF.Dictionary.addObject()
+ */
+ addObject: function(object) {
+ this._icons.addObject(object);
+ },
+
+ /**
+ * @see WCF.Dictionary.get()
+ */
+ get: function(name) {
+ return this._icons.get(name);
+ }
+};
+
/**
* Number utilities.
*/