|
|
@@ -4,9 +4,6 @@
|
|
|
* @license CC-BY - http://creativecommons.org/licenses/by/3.0/
|
|
|
*/
|
|
|
|
|
|
-// TODO: make sure that there is no duplicate code in bx_loading functions
|
|
|
-// TODO: name it with jquery. prefix since it is jquery plugin
|
|
|
-
|
|
|
$.fn.bx_anim = function(action, effect, speed, h) {
|
|
|
return this.each(function() {
|
|
|
var sFunc = '';
|
|
|
@@ -53,55 +50,24 @@ $.fn.bx_anim = function(action, effect, speed, h) {
|
|
|
return this;
|
|
|
});
|
|
|
};
|
|
|
-$.fn.bx_loading = function(sParentSelector) {
|
|
|
- var iWidth = 0, iHeight =0;
|
|
|
- var oParent = null, oOffset = null;
|
|
|
-
|
|
|
- if(sParentSelector != undefined)
|
|
|
- oParent = $(sParentSelector);
|
|
|
-
|
|
|
- return this.each(function() {
|
|
|
- var oLoading = $(this);
|
|
|
- var oLoadingIcon = oLoading.children('.sys-loading-icon');
|
|
|
-
|
|
|
- oParent = oParent != null ? oParent : oLoading.parent();
|
|
|
-
|
|
|
- if(!oLoading.is(':visible')) {
|
|
|
- oOffset = oParent.offset();
|
|
|
- iWidth = oParent.outerWidth();
|
|
|
- iHeight = oParent.outerHeight();
|
|
|
|
|
|
- /*--- Set Main ---*/
|
|
|
- oLoading.width(iWidth);
|
|
|
- oLoading.height(iHeight);
|
|
|
+$.fn.bx_loading = function(bForceIndicator) {
|
|
|
+ return $.fn._bx_loading('.bx-loading-ajax', bForceIndicator);
|
|
|
+};
|
|
|
|
|
|
- /*--- Set Icon ---*/
|
|
|
- oLoadingIcon.css('left', (iWidth - parseInt(oLoadingIcon.css('width')))/2);
|
|
|
- oLoadingIcon.css('top', (iHeight - parseInt(oLoadingIcon.css('height')))/2);
|
|
|
- oLoading.show();
|
|
|
- }
|
|
|
- else
|
|
|
- oLoading.hide();
|
|
|
- });
|
|
|
+$.fn.bx_loading_btn = function(bForceIndicator) {
|
|
|
+ return $.fn._bx_loading('.bx-loading-ajax-btn', bForceIndicator);
|
|
|
};
|
|
|
-$.fn.bx_btn_loading = function(sParentSelector) {
|
|
|
- var sAttr = 'bx-loading-id';
|
|
|
- var oDate = new Date();
|
|
|
- return this.each(function() {
|
|
|
- var oObject = $(this);
|
|
|
- if(!oObject.hasClass('bx-btn'))
|
|
|
- return;
|
|
|
|
|
|
- if(oObject.is(':visible')) {
|
|
|
- var oClone = oObject.attr(sAttr, oDate.getTime()).clone().attr('disabled', 'disabled').addClass('bx-btn-loading').html(aDolLang['_sys_txt_btn_loading']);
|
|
|
- oObject.hide().after(oClone);
|
|
|
- }
|
|
|
- else {
|
|
|
- var iId = oObject.attr(sAttr);
|
|
|
- oObject.removeAttr(sAttr).show().siblings("[" + sAttr + "='" + iId + "']").remove();
|
|
|
- }
|
|
|
+$.fn._bx_loading = function(sLoadingSelector, bForceIndicator) {
|
|
|
+ return this.each(function() {
|
|
|
+ var oContainer = $(this);
|
|
|
+ var oLoading = oContainer.find(sLoadingSelector);
|
|
|
+ bForceIndicator = 'undefined' == typeof(bForceIndicator) ? oLoading.length && oLoading.is(':visible') : bForceIndicator;
|
|
|
+ bx_loading_btn(oContainer, bForceIndicator);
|
|
|
});
|
|
|
};
|
|
|
+
|
|
|
$.fn.bx_message_box = function(sMessage, iTimer, onClose) {
|
|
|
return this.each(function() {
|
|
|
var oParent = $(this);
|