Index: ssts-web/src/main/webapp/buttjoint/alertDiv/AlertBox.js =================================================================== diff -u --- ssts-web/src/main/webapp/buttjoint/alertDiv/AlertBox.js (revision 0) +++ ssts-web/src/main/webapp/buttjoint/alertDiv/AlertBox.js (revision 35078) @@ -0,0 +1,238 @@ +/*! + * AlertBox + * Copyright (c) 2010 cloudgamer + * Blog: http://cloudgamer.cnblogs.com/ + * Date: 2010-10-10 + */ + +//显示层对象 +var AlertBox = function(box, options){ + //初始化程序 + this._initialize( box, options ); + this._initBox(); +}; +AlertBox.prototype = { + _initialize: function(box, options) { + + this.box = $$(box);//显示层 + + this._css = null;//备份样式 + + this._setOptions(options); + + this.fixed = !!this.options.fixed; + this.zIndex = this.options.zIndex; + + this.onShow = this.options.onShow; + this.onClose = this.options.onClose; + + $$CE.fireEvent( this, "init" ); + }, + //设置默认属性 + _setOptions: function(options) { + this.options = {//默认值 + fixed: false,//是否固定定位 + zIndex: 1000,//层叠值 + onShow: $$.emptyFunction,//显示时执行 + onClose: $$.emptyFunction//关闭时执行 + }; + return $$.extend(this.options, options || {}); + }, + //初始化显示层对象 + _initBox: function() { + var style = this.box.style; + this._css = { "display": style.display, "visibility": style.visibility, "position": style.position, "zIndex": style.zIndex };//备份样式 + style.display = "none"; + style.visibility = "visible"; + document.body.insertBefore(this.box, document.body.childNodes[0]); + $$CE.fireEvent( this, "initBox" ); + }, + //显示 + show: function(isResize) { + //定位显示 + var style = this.box.style; + style.position = this.fixed ? "fixed" : "absolute"; + style.zIndex = this.zIndex; + $$CE.fireEvent( this, "show", isResize ); + style.display = "block"; + this.onShow(); + }, + //关闭 + close: function() { + this.box.style.display = "none"; + $$CE.fireEvent( this, "close" ); + this.onClose(); + }, + //销毁程序 + dispose: function() { + $$CE.fireEvent( this, "dispose" ); + $$D.setStyle( this.box, this._css );//恢复样式 + //清除属性 + this.box = this.onShow = this.onClose = null; + } +}; + + + +//修正fixed对象 +var RepairFixed = function() { + if ( !$$B.ie6 ) return; + var layer, body, parent = "__repairfixed";//记录父节点 + function Create(){//创建定位层函数 + body = document.body + if (body.currentStyle.backgroundAttachment !== "fixed") { + if (body.currentStyle.backgroundImage === "none") { + body.runtimeStyle.backgroundRepeat = "no-repeat"; + body.runtimeStyle.backgroundImage = "url(about:blank)"; + } + body.runtimeStyle.backgroundAttachment = "fixed"; + } + layer = document.createElement("
"); + Create = $$.emptyFunction; + } + return { + "append": function(elem){ + Create(); + elem[ parent ] = elem.parentNode; + layer.appendChild(elem).runtimeStyle.position = "absolute"; + //插入body + if ( layer.parentNode !== body ) body.insertBefore(layer, body.childNodes[0]); + }, + "remove": function(elem){ + if ( !layer ) return; + //移除元素 + if ( elem.parentNode === layer ) { + elem.runtimeStyle.position = ""; + elem[ parent ] ? elem[parent].appendChild(elem) : layer.removeChild(elem); + elem.removeAttribute(parent);//不能用delete + } + //没有内部元素就移除 + if ( !layer.childNodes.length && layer.parentNode == body ) body.removeChild(layer); + } + }; +}(); + +//兼容ie6扩展 +if ( $$B.ie6 ) { AlertBox.prototype._initialize = (function(){ + var init = AlertBox.prototype._initialize, + methods = { + "init": function(){ + this._iframe = null;//遮盖select的iframe + this.fixSelect = !!this.options.fixSelect; + }, + "show": function(isResize) { + RepairFixed[ this.fixed ? "append" : "remove" ]( this.box ); + if ( this.fixSelect ) { + if ( !this._iframe ) { + this._iframe = this.box.appendChild( document.createElement("") ); + isResize = true; + } + if ( isResize ) { + var size = $$D.getSize(this.box); + $$D.setStyle( this._iframe, { + height: size.height + "px", width: size.width + "px", + top: -this.box.clientTop + "px", left: -this.box.clientLeft + "px" + }); + } + } + }, + "close": function() { + RepairFixed.remove( this.box ); + }, + "dispose": function() { + RepairFixed.remove( this.box ); + if ( this._iframe ) this.box.removeChild( this._iframe ); + this._iframe = null; + } + }; + return function(){ + var args = [].slice.call(arguments), options = args[1] = args[1] || {}; + //扩展options + $$.extend( options, { + fixSelect: true//是否修复select遮盖问题 + }, false ); + //扩展钩子 + $$A.forEach( methods, function( method, name ){ + $$CE.addEvent( this, name, method ); + }, this ); + init.apply( this, args ); + } +})();} + + +//居中扩展 +AlertBox.prototype._initialize = (function(){ + var init = AlertBox.prototype._initialize, + methods = { + "init": function(){ + this._centerCss = null;//记录原始样式 + this.center = !!this.options.center; + }, + "show": function(isResize){ + if ( this.center ) { + if ( !this._centerCss ) { + var style = this.box.style; + this._centerCss = { marginTop: style.marginTop, marginLeft: style.marginLeft, left: style.left, top: style.top }; + isResize = true; + } + if ( isResize ) { + var size = $$D.getSize(this.box); + $$D.setStyle( this.box, { + marginTop: (this.fixed ? 0 : $$D.getScrollTop()) - size.height / 2 + "px", + marginLeft: (this.fixed ? 0 : $$D.getScrollLeft()) - size.width / 2 + "px", + top: "50%", left: "50%" + }); + } + } else { + if ( this._centerCss ) { + $$D.setStyle( this.box, this._centerCss ); this._centerCss = null; + } + } + }, + "dispose": function(){ + if ( this._centerCss ) $$D.setStyle( this.box, this._centerCss ); + this._centerCss = null; + } + }; + return function(){ + var args = [].slice.call(arguments), options = args[1] = args[1] || {}; + //扩展options + $$.extend( options, { + center: false//是否居中 + }, false ); + //扩展钩子 + $$A.forEach( methods, function( method, name ){ + $$CE.addEvent( this, name, method ); + }, this ); + init.apply( this, args ); + } +})(); + + +//覆盖层 +var OverLay = function(){ + var overlay; + function Create(){ + var lay = document.body.insertBefore(document.createElement("div"), document.body.childNodes[0]); + $$D.setStyle( lay, { + overflow: "hidden", width: "100%", height: "100%", + border: 0, padding: 0, margin: 0, top: 0, left: 0 + }); + overlay = new AlertBox( lay, { fixed: true } ); + Create = $$.emptyFunction; + } + return { + "color": "#fff",//背景色 + "opacity": .5,//透明度(0-1) + "zIndex": 100,//层叠值 + "show": function(){ + Create(); + $$D.setStyle( overlay.box, { + backgroundColor: this.color, opacity: this.opacity + }); + overlay.zIndex = this.zIndex; + overlay.show(); + }, + "close": function(){ overlay && overlay.close(); } + }; +}() \ No newline at end of file Index: ssts-web/src/main/webapp/buttjoint/alertDiv/CJL.0.1.min.js =================================================================== diff -u --- ssts-web/src/main/webapp/buttjoint/alertDiv/CJL.0.1.min.js (revision 0) +++ ssts-web/src/main/webapp/buttjoint/alertDiv/CJL.0.1.min.js (revision 35078) @@ -0,0 +1 @@ +eval(function(p,a,c,k,e,r){e=function(c){return(c<62?'':e(parseInt(c/62)))+((c=c%62)>35?String.fromCharCode(c+29):c.toString(36))};if('0'.replace(0,e)==0){while(c--)r[e(c)]=k[c];k=[function(e){return r[e]||e}];e=function(){return'([3-59cf-hj-mo-rt-yCG-NP-RT-Z]|[12]\\w)'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('4 $$,$$B,$$A,$$F,$$D,$$E,$$CE,$$S;(3(1K){4 O,B,A,F,D,E,CE,S;O=3(id){5"2f"==1L id?G.getElementById(id):id};O.emptyFunction=3(){};O.extend=3(Q,13,1v){9(1v===1K)1v=14;J(4 R x 13){9(1v||!(R x Q)){Q[R]=13[R]}}5 Q};O.deepextend=3(Q,13){J(4 R x 13){4 1j=13[R];9(Q===1j)continue;9(1L 1j==="c"){Q[R]=M.callee(Q[R]||{},1j)}N{Q[R]=1j}}5 Q};O.wrapper=3(me,15){4 1M=3(){me.T(Z,M)};4 1N=3(){};1N.17=15.17;1M.17=new 1N;5 1M};B=(3(U){4 b={18:/18/.P(U)&&!/1O/.P(U),1O:/1O/.P(U),2h:/webkit/.P(U)&&!/1P/.P(U),2i:/2i/.P(U),1P:/1P/.P(U)};4 1w="";J(4 i x b){9(b[i]){1w="2h"==i?"1k":i;1Q}}b.1k=1w&&1R("(?:"+1w+")[\\\\/: ]([\\\\d.]+)").P(U)?1R.$1:"0";b.ie=b.18;b.2j=b.18&&1T(b.1k,10)==6;b.ie7=b.18&&1T(b.1k,10)==7;b.2k=b.18&&1T(b.1k,10)==8;5 b})(1U.navigator.userAgent.toLowerCase());A=3(){4 p={isArray:3(2l){5 Object.17.toString.19(2l)==="[c 1V]"},1x:3(K,W,l){9(K.1x){5 1y(l)?K.1x(W):K.1x(W,l)}N{4 V=K.1l;l=1y(l)?0:l<0?1z.2m(l)+V:1z.2n(l);J(;l=V-1?V-1:l<0?1z.2m(l)+V:1z.2n(l);J(;l>-1;l--){9(K[l]===W)5 l}5-1}}};3 11(c,u){9(1K===c.1l){J(4 o x c){9(y===u(c[o],o,c))1Q}}N{J(4 i=0,V=c.1l;i - - + +