Index: ssts-web/src/main/webapp/ext/example/examples.js =================================================================== diff -u -r15770 -r33363 --- ssts-web/src/main/webapp/ext/example/examples.js (.../examples.js) (revision 15770) +++ ssts-web/src/main/webapp/ext/example/examples.js (.../examples.js) (revision 33363) @@ -4,79 +4,95 @@ * MsgTip.msg('消息标题', '消息内容',true);//默认5秒后自动隐藏 * MsgTip.msg('消息标题', '消息内容',true,10);//10秒后自动隐藏 */ -MsgTip = function(){ +MsgTip = function () { var msgCt; - function createBox(t, s){ + function createBox(t, s) { return ['
', - '
', - '

', t, '

    ', s, '
', - '
', - '
'].join(''); + '
', + '

', t, '

    ', s, '
', + '
', + ''].join(''); } return { - msg : function(title, message,autoHide,pauseTime){ - if(!msgCt){ - msgCt = Ext.DomHelper.insertFirst(document.body, {id:'msg-div22',style:'position:absolute;top:10px;width:300px;margin:0 auto;z-index:20000;'}, true); + msg: function (title, message, autoHide, pauseTime) { + if (!msgCt) { + msgCt = Ext.DomHelper.insertFirst(document.body, { id: 'msg-div22', style: 'position:absolute;top:10px;width:300px;margin:0 auto;z-index:20000;' }, true); } msgCt.alignTo(document, 't-t'); //给消息框右下角增加一个关闭按钮 - message+='
' + - '关闭' - var m = Ext.DomHelper.append(msgCt, {html:createBox(title, message)}, true); + message += '
' + + '关闭' + var m = Ext.DomHelper.append(msgCt, { html: createBox(title, message) }, true); m.slideIn('t'); - if(!Ext.isEmpty(autoHide)&&autoHide==true){ - if(Ext.isEmpty(pauseTime)){ - pauseTime=5; - } - //如果pauseTime小于0,则永远不会关闭,需要点击才可以关闭 - if (pauseTime < 0){ - m.pause(pauseTime); - } - else { - m.pause(pauseTime).ghost("tr", {remove:true}); - } + if (!Ext.isEmpty(autoHide) && autoHide == true) { + if (Ext.isEmpty(pauseTime)) { + pauseTime = 5; + } + //如果pauseTime小于0,则永远不会关闭,需要点击才可以关闭 + if (pauseTime < 0) { + m.pause(pauseTime); + } + else { + m.pause(pauseTime).ghost("tr", { remove: true }); + } } }, - msgExt : function(paramsCfg){ - var cfg = { - title:'提示', - message:'', - autoHide:true, - pauseTime:5, - alignTo:'t-t' - } - top.Ext.apply(cfg,paramsCfg); - var title = cfg.title; - var message = cfg.message; - var autoHide = cfg.autoHide; - var pauseTime = cfg.pauseTime; - var alignTo = cfg.alignTo; - var message = ''+message+''; - if(!msgCt){ - msgCt = Ext.DomHelper.insertFirst(document.body, {id:'msg-div22',style:'position:absolute;top:10px;width:300px;margin:0 auto;z-index:20000;'}, true); + msgExt: function (paramsCfg) { + var cfg = { + title: '提示', + message: '', + autoHide: true, + pauseTime: 5, + alignTo: 't-t' } + top.Ext.apply(cfg, paramsCfg); + var title = cfg.title; + var message = cfg.message; + var autoHide = cfg.autoHide; + var pauseTime = cfg.pauseTime; + var alignTo = cfg.alignTo; + var message = '' + message + ''; + if (!msgCt) { + msgCt = Ext.DomHelper.insertFirst(document.body, { id: 'msg-div22', style: 'position:absolute;top:10px;width:300px;margin:0 auto;z-index:20000;' }, true); + } msgCt.alignTo(document, alignTo); //给消息框右下角增加一个关闭按钮 - message+='
' + - '关闭' - var m = Ext.DomHelper.append(msgCt, {html:createBox(title, message)}, true); + message += '
' + + '关闭' + var m = Ext.DomHelper.append(msgCt, { html: createBox(title, message) }, true); m.slideIn('t'); - if(!Ext.isEmpty(autoHide)&&autoHide==true){ - if(Ext.isEmpty(pauseTime)){ - pauseTime=5; - } - //如果pauseTime小于0,则永远不会关闭,需要点击才可以关闭 - if (pauseTime < 0){ - m.pause(pauseTime); - } - else { - m.pause(pauseTime).ghost("tr", {remove:true}); - } + if (!Ext.isEmpty(autoHide) && autoHide == true) { + if (Ext.isEmpty(pauseTime)) { + pauseTime = 5; + } + //如果pauseTime小于0,则永远不会关闭,需要点击才可以关闭 + if (pauseTime < 0) { + m.pause(pauseTime); + } + else { + m.pause(pauseTime).ghost("tr", { remove: true }); + } } }, - hide:function(v){ - var msg=Ext.get(v.parentElement.parentElement.parentElement.parentElement.parentElement.parentElement); - msg.ghost("tr", {remove:true}); + newMsg: function (title, message) { + if (!msgCt) { + msgCt = Ext.DomHelper.insertFirst(document.body, { id: 'msg-div33', 'class': 'msg-div33', style: 'position:absolute;top:10px;width:370px;margin:0 auto;z-index:20000;' }, true); + } + msgCt.alignTo(document, 't-t'); + //给消息框右下角增加一个关闭按钮 + message += '
' + + '关闭' + var m = Ext.DomHelper.append(msgCt, { html: createBox(title, message) }, true); + m.slideIn('t'); + }, + hide: function (v) { + var msg = Ext.get(v.parentElement.parentElement.parentElement.parentElement.parentElement.parentElement.parentElement); + msg.ghost("tr", { remove: true }); + }, + remove: function () { + if (document.getElementById('msg-div33') && document.getElementById('msg-div33').getElementsByTagName('div')[0]) { + Ext.get(document.getElementById('msg-div33').getElementsByTagName('div')[0]).ghost("tr", { remove: true }); + } } }; }(); \ No newline at end of file