|
// ================================Loading===================================//
|
Loading = $.fm.LoadingClass = Control.subClass({
|
template: [
|
'<div class="loading_mask" style="display: none" align="center">',
|
'<div id="area" class="loading_area" align="center">',
|
'<div class="loading_image"></div>',
|
'</div>',
|
'</div>'
|
],
|
itemTemplate: '<div class="loading_text"></div>',
|
itemList: {},
|
|
init: function(options) {
|
options = options ? options : {};
|
Control.call(this, options);
|
this.canvas = $(window.top.window.document.body);
|
|
this.createEl();
|
},
|
|
createEl: function() {
|
var el = this.el = $(this.template.join(""));
|
this.area = $("#area", el);
|
this.canvas.append(this.el);
|
},
|
|
show: function (code, text) {
|
text = text || code;
|
code = code || "item";
|
|
var item = this.itemList[code];
|
|
if (!item) {
|
item = this.itemList[code] = $(this.itemTemplate);
|
this.area.append(item);
|
}
|
|
item.html(text);
|
this.el.show();
|
},
|
|
hide: function(code) {
|
if (code) {
|
var item = this.itemList[code];
|
if (item) {
|
item.remove();
|
}
|
|
for (var n in this.itemList) {
|
return;
|
}
|
|
this.el.hide();
|
return;
|
}
|
|
this.el.hide();
|
|
for (var n in this.itemList) {
|
var item = this.itemList[n];
|
if (item.remove) {
|
item.remove();
|
}
|
}
|
this.itemList = {};
|
}
|
});
|
|
Loading.show = function(code, text) {
|
var instance = window.top.window.Loading.instance || this.instance;
|
|
if (!instance) {
|
instance = this.instance = new $.fm.LoadingClass();
|
}
|
|
instance.show(code, text);
|
};
|
|
Loading.hide = function(code) {
|
var instance = window.top.window.Loading.instance || this.instance;
|
|
if (!instance) {
|
instance = this.instance = new $.fm.LoadingClass();
|
}
|
|
instance.hide(code);
|
};
|
|
$(window.document).ready(function() {
|
Loading.hide();
|
});
|