mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-07-19 01:17:18 +00:00
feature(edward) add showMessage
This commit is contained in:
parent
7de1fcf1f4
commit
3a62894312
2 changed files with 41 additions and 38 deletions
|
|
@ -1,4 +1,4 @@
|
|||
var CloudCmd, Util, DOM, CloudFunc, io, ace, Zip, MenuIO, Format;
|
||||
var CloudCmd, Util, DOM, CloudFunc, io, ace, Zip, MenuIO, Format, edward;
|
||||
(function(CloudCmd, Util, DOM, CloudFunc) {
|
||||
'use strict';
|
||||
|
||||
|
|
@ -40,16 +40,18 @@ var CloudCmd, Util, DOM, CloudFunc, io, ace, Zip, MenuIO, Format;
|
|||
};
|
||||
|
||||
function init(callback) {
|
||||
var element = createElement();
|
||||
|
||||
exec.series([
|
||||
CloudCmd.View,
|
||||
loadFiles,
|
||||
function(callback) {
|
||||
loadFiles(element, callback);
|
||||
},
|
||||
function(callback) {
|
||||
DOM.loadSocket(initSocket);
|
||||
callback();
|
||||
},
|
||||
function(callback) {
|
||||
var element = createElement();
|
||||
|
||||
Edit.create(element)
|
||||
.show(callback);
|
||||
|
||||
|
|
@ -560,7 +562,7 @@ var CloudCmd, Util, DOM, CloudFunc, io, ace, Zip, MenuIO, Format;
|
|||
}
|
||||
}
|
||||
|
||||
function loadFiles(callback) {
|
||||
function loadFiles(element, callback) {
|
||||
var dir = CloudCmd.LIBDIRCLIENT,
|
||||
name = 'edward',
|
||||
url = dir + name + '.js';
|
||||
|
|
@ -570,7 +572,7 @@ var CloudCmd, Util, DOM, CloudFunc, io, ace, Zip, MenuIO, Format;
|
|||
DOM.load.js(url, function() {
|
||||
Loading = false;
|
||||
|
||||
window.edward(null, function() {
|
||||
edward(element, function() {
|
||||
Util.timeEnd(Name + ' load');
|
||||
exec(callback);
|
||||
});
|
||||
|
|
@ -642,26 +644,7 @@ var CloudCmd, Util, DOM, CloudFunc, io, ace, Zip, MenuIO, Format;
|
|||
}
|
||||
|
||||
this.showMessage = function(text) {
|
||||
var msg, HIDE_TIME = 2000;
|
||||
|
||||
/*
|
||||
* Msg should be created and removed
|
||||
* if it's not and just inner text
|
||||
* is changing, and hide and show of DOM
|
||||
* is called - bug occures: empty box
|
||||
* with no text inside.
|
||||
*/
|
||||
msg = DOM.load({
|
||||
name : 'div',
|
||||
className : 'edward-msg',
|
||||
parent : Element,
|
||||
inner : text,
|
||||
func : alert
|
||||
});
|
||||
|
||||
setTimeout(function() {
|
||||
DOM.remove(msg, Element);
|
||||
}, HIDE_TIME);
|
||||
edward.showMessage(text);
|
||||
};
|
||||
|
||||
init(callback);
|
||||
|
|
|
|||
|
|
@ -4,21 +4,39 @@ var join, Util, DOM;
|
|||
'use strict';
|
||||
|
||||
if (typeof module !== 'undefined' && module.exports)
|
||||
module.exports = edward;
|
||||
module.exports = new edward();
|
||||
else
|
||||
global.edward = edward;
|
||||
global.edward = new edward();
|
||||
|
||||
function edward(el, callback) {
|
||||
var Element = el || document.body;
|
||||
|
||||
if (!(this instanceof edward))
|
||||
return new edward(Element, callback);
|
||||
|
||||
init(callback);
|
||||
|
||||
function init(callback) {
|
||||
function edward() {
|
||||
var Element,
|
||||
ed = function(el, callback) {
|
||||
Element = el || document.body;
|
||||
loadFiles(callback);
|
||||
}
|
||||
};
|
||||
|
||||
ed.showMessage = function(text) {
|
||||
var msg, HIDE_TIME = 2000;
|
||||
|
||||
/*
|
||||
* Msg should be created and removed
|
||||
* if it's not and just inner text
|
||||
* is changing, and hide and show of DOM
|
||||
* is called - bug occures: empty box
|
||||
* with no text inside.
|
||||
*/
|
||||
msg = DOM.load({
|
||||
name : 'div',
|
||||
className : 'edward-msg',
|
||||
parent : Element,
|
||||
inner : text,
|
||||
func : alert
|
||||
});
|
||||
|
||||
setTimeout(function() {
|
||||
DOM.remove(msg, Element);
|
||||
}, HIDE_TIME);
|
||||
};
|
||||
|
||||
function loadFiles(callback) {
|
||||
var css = '/css/edward.css',
|
||||
|
|
@ -38,6 +56,8 @@ var join, Util, DOM;
|
|||
});
|
||||
});
|
||||
}
|
||||
|
||||
return ed;
|
||||
}
|
||||
|
||||
})(this, join, DOM, Util.exec);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue