⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 element.style-min.js

📁 Ext JS是一个创建丰富互联网应用程序的跨浏览器的JavaScrip库。它包含:高效率
💻 JS
字号:
/*
 * Ext JS Library 3.0 Pre-alpha
 * Copyright(c) 2006-2008, Ext JS, LLC.
 * licensing@extjs.com
 * 
 * http://extjs.com/license
 */

Ext.Element.addMethods(function(){var propCache={},camelRe=/(-[a-z])/gi,classReCache={},view=document.defaultView,EL=Ext.Element,PADDING="padding",MARGIN="margin",BORDER="border",LEFT="-left",RIGHT="-right",TOP="-top",BOTTOM="-bottom",WIDTH="-width",borders={l:BORDER+LEFT+WIDTH,r:BORDER+RIGHT+WIDTH,t:BORDER+TOP+WIDTH,b:BORDER+BOTTOM+WIDTH},paddings={l:PADDING+LEFT,r:PADDING+RIGHT,t:PADDING+TOP,b:PADDING+BOTTOM},margins={l:MARGIN+LEFT,r:MARGIN+RIGHT,t:MARGIN+TOP,b:MARGIN+BOTTOM};function camelFn(m,a){return a.charAt(1).toUpperCase();}function addStyles(sides,styles){var val=0;Ext.each(sides.match(/\w/g),function(s){if(s=parseInt(this.getStyle(styles[s]),10)){val+=Math.abs(s);}},this);return val;}function chkCache(prop){return propCache[prop]||(propCache[prop]=prop.replace(camelRe,camelFn))}return{adjustWidth:function(width){var me=this;if(typeof width=="number"&&me.autoBoxAdjust&&!me.isBorderBox()){width-=(me.getBorderWidth("lr")+me.getPadding("lr"));width=width<0?0:width;}return width;},adjustHeight:function(height){var me=this;if(typeof height=="number"&&me.autoBoxAdjust&&!me.isBorderBox()){height-=(me.getBorderWidth("tb")+me.getPadding("tb"));height=height<0?0:height;}return height;},addClass:function(className){var me=this;Ext.each(className,function(v){me.dom.className+=(!me.hasClass(v)&&v?" "+v:"");});return me;},radioClass:function(className){Ext.each(this.dom.parentNode.childNodes,function(v){if(v.nodeType==1){Ext.get(v).removeClass(className);}});return this.addClass(className);},removeClass:function(className){var me=this;if(me.dom.className){Ext.each(className,function(v){me.dom.className=me.dom.className.replace(classReCache[v]=classReCache[v]||new RegExp('(?:^|\\s+)'+v+'(?:\\s+|$)',"g")," ");});}return me;},toggleClass:function(className){return this.hasClass(className)?this.removeClass(className):this.addClass(className);},hasClass:function(className){return className&&(' '+this.dom.className+' ').indexOf(' '+className+' ')!=-1;},replaceClass:function(oldClassName,newClassName){return this.removeClass(oldClassName).addClass(newClassName);},isStyle:function(style,val){return this.getStyle(style)==val;},getStyle:function(){return view&&view.getComputedStyle?function(prop){var el=this.dom,v,cs;if(el==document)return null;prop=prop=='float'?'cssFloat':prop;return(v=el.style[prop])?v:(cs=view.getComputedStyle(el,""))?cs[chkCache(prop)]:null;}:function(prop){var el=this.dom,m,cs;if(el==document)return null;if(prop=='opacity'){if(el.style.filter.match){if(m=el.style.filter.match(/alpha\(opacity=(.*)\)/i)){var fv=parseFloat(m[1]);if(!isNaN(fv)){return fv?fv/100:0;}}}return 1;}prop=prop=='float'?'styleFloat':prop;return el.style[prop]||((cs=el.currentStyle)?cs[chkCache(prop)]:null);};}(),getColor:function(attr,defaultValue,prefix){var h,v=this.getStyle(attr),color=prefix||"#";if(!v||v=="transparent"||v=="inherit"){return defaultValue;}if(/^r/.test(v)){Ext.each(v.slice(4,v.length-1).split(","),function(s){h=(s*1).toString(16);color+=h<16?"0"+h:h;});}else{color+=v.replace("#","").replace(/^(\w)(\w)(\w)$/,"$1$1$2$2$3$3");}return color.length>5?color.toLowerCase():defaultValue;},setStyle:function(prop,value){var tmp,style,camel;if(!Ext.isObject(prop)){tmp={};tmp[prop]=value;prop=tmp;}for(style in prop){value=prop[style];camel=chkCache(style);camel=='opacity'?this.setOpacity(value):this.dom.style[camel]=value;}return this;},setOpacity:function(opacity,animate){var me=this,s=me.dom.style;if(!animate||!me.anim){if(Ext.isIE){s.zoom=1;s.filter=(s.filter||'').replace(/alpha\([^\)]*\)/gi,"")+(opacity==1?"":" alpha(opacity="+opacity*100+")");}else{s.opacity=opacity;}}else{me.anim({opacity:{to:opacity}},me.preanim(arguments,1),null,.35,'easeIn');}return me;},clearOpacity:function(){var style=this.dom.style;if(window.ActiveXObject){if(typeof style.filter=='string'&&(/alpha/i).test(style.filter)){style.filter="";}}else{style.opacity="";style["-moz-opacity"]="";style["-khtml-opacity"]="";}return this;},getHeight:function(contentHeight){var h=this.dom.offsetHeight||0;h=!contentHeight?h:h-this.getBorderWidth("tb")-this.getPadding("tb");return h<0?0:h;},getWidth:function(contentWidth){var w=this.dom.offsetWidth||0;w=!contentWidth?w:w-this.getBorderWidth("lr")-this.getPadding("lr");return w<0?0:w;},setWidth:function(width,animate){var me=this;width=me.adjustWidth(width);!animate||!me.anim?me.dom.style.width=me.addUnits(width):me.anim({width:{to:width}},me.preanim(arguments,1));return me;},setHeight:function(height,animate){var me=this;height=me.adjustHeight(height);!animate||!me.anim?me.dom.style.height=me.addUnits(height):me.anim({height:{to:height}},me.preanim(arguments,1));return me;},getBorderWidth:function(side){return addStyles.call(this,side,borders);},getPadding:function(side){return addStyles.call(this,side,paddings);},clip:function(){var me=this;if(!me.isClipped){me.isClipped=true;me.originalClip={o:me.getStyle("overflow"),x:me.getStyle("overflow-x"),y:me.getStyle("overflow-y")};me.setStyle("overflow","hidden");me.setStyle("overflow-x","hidden");me.setStyle("overflow-y","hidden");}return me;},unclip:function(){var me=this;if(me.isClipped){me.isClipped=false;var o=me.originalClip;if(o.o){me.setStyle("overflow",o.o);}if(o.x){me.setStyle("overflow-x",o.x);}if(o.y){me.setStyle("overflow-y",o.y);}}return me;},addStyles:addStyles,margins:margins}}());

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -