Compress scripts using Dojo and link to the compressed versions, saving about 27kb total. Everything I tested still worked, except the colorpicker which is why it's not compressed.

git-svn-id: https://develop.svn.wordpress.org/trunk@4566 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Matt Mullenweg 2006-12-01 03:13:21 +00:00
parent 1e969aed95
commit 5e9ecfffb0
6 changed files with 10 additions and 5 deletions

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1 @@
var Fat={make_hex:function(r,g,b){r=r.toString(16);if(r.length==1){r="0"+r;}g=g.toString(16);if(g.length==1){g="0"+g;}b=b.toString(16);if(b.length==1){b="0"+b;}return "#"+r+g+b;},fade_all:function(_4){var a=document.getElementsByTagName("*");for(var i=0;i<a.length;i++){var o=a[i];var r=/fade-?(\w{3,6})?/.exec(o.className);if(r){if(!r[1]){r[1]="";}if(o.id){Fat.fade_element(o.id,null,_4,"#"+r[1]);}}}},fade_element:function(id,_a,_b,_c,to){if(!_a){_a=30;}if(!_b){_b=3000;}if(!_c||_c=="#"){_c="#FFFF33";}if(!to){to=this.get_bgcolor(id);}var _e=Math.round(_a*(_b/1000));var _f=_b/_e;var _10=_f;var _11=0;if(_c.length<7){_c+=_c.substr(1,3);}if(to.length<7){to+=to.substr(1,3);}var rf=parseInt(_c.substr(1,2),16);var gf=parseInt(_c.substr(3,2),16);var bf=parseInt(_c.substr(5,2),16);var rt=parseInt(to.substr(1,2),16);var gt=parseInt(to.substr(3,2),16);var bt=parseInt(to.substr(5,2),16);var r,g,b,h;while(_11<_e){r=Math.floor(rf*((_e-_11)/_e)+rt*(_11/_e));g=Math.floor(gf*((_e-_11)/_e)+gt*(_11/_e));b=Math.floor(bf*((_e-_11)/_e)+bt*(_11/_e));h=this.make_hex(r,g,b);setTimeout("Fat.set_bgcolor('"+id+"','"+h+"')",_10);_11++;_10=_f*_11;}setTimeout("Fat.set_bgcolor('"+id+"','"+to+"')",_10);},set_bgcolor:function(id,c){var o=document.getElementById(id);o.style.backgroundColor=c;},get_bgcolor:function(id){var o=document.getElementById(id);while(o){var c;if(window.getComputedStyle){c=window.getComputedStyle(o,null).getPropertyValue("background-color");}if(o.currentStyle){c=o.currentStyle.backgroundColor;}if((c!=""&&c!="transparent")||o.tagName=="BODY"){break;}o=o.parentNode;}if(c==undefined||c==""||c=="transparent"){c="#FFFFFF";}var rgb=c.match(/rgb\s*\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*\)/);if(rgb){c=this.make_hex(parseInt(rgb[1]),parseInt(rgb[2]),parseInt(rgb[3]));}return c;}};addLoadEvent(function(){Fat.fade_all();});

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1 @@
function sack(_1){this.xmlhttp=null;this.resetData=function(){this.method="POST";this.queryStringSeparator="?";this.argumentSeparator="&";this.URLString="";this.encodeURIString=true;this.execute=false;this.element=null;this.elementObj=null;this.requestFile=_1;this.vars=new Object();this.responseStatus=new Array(2);};this.resetFunctions=function(){this.onLoading=function(){};this.onLoaded=function(){};this.onInteractive=function(){};this.onCompletion=function(){};this.onError=function(){};this.onFail=function(){};};this.reset=function(){this.resetFunctions();this.resetData();};this.createAJAX=function(){try{this.xmlhttp=new ActiveXObject("Msxml2.XMLHTTP");}catch(e1){try{this.xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");}catch(e2){this.xmlhttp=null;}}if(!this.xmlhttp){if(typeof XMLHttpRequest!="undefined"){this.xmlhttp=new XMLHttpRequest();}else{this.failed=true;}}};this.setVar=function(_2,_3){this.vars[_2]=Array(_3,false);};this.encVar=function(_4,_5,_6){if(true==_6){return Array(encodeURIComponent(_4),encodeURIComponent(_5));}else{this.vars[encodeURIComponent(_4)]=Array(encodeURIComponent(_5),true);}};this.processURLString=function(_7,_8){encoded=encodeURIComponent(this.argumentSeparator);regexp=new RegExp(this.argumentSeparator+"|"+encoded);varArray=_7.split(regexp);for(i=0;i<varArray.length;i++){urlVars=varArray[i].split("=");if(true==_8){this.encVar(urlVars[0],urlVars[1]);}else{this.setVar(urlVars[0],urlVars[1]);}}};this.createURLString=function(_9){if(this.encodeURIString&&this.URLString.length){this.processURLString(this.URLString,true);}if(_9){if(this.URLString.length){this.URLString+=this.argumentSeparator+_9;}else{this.URLString=_9;}}this.setVar("rndval",new Date().getTime());urlstringtemp=new Array();for(key in this.vars){if(false==this.vars[key][1]&&true==this.encodeURIString){encoded=this.encVar(key,this.vars[key][0],true);delete this.vars[key];this.vars[encoded[0]]=Array(encoded[1],true);key=encoded[0];}urlstringtemp[urlstringtemp.length]=key+"="+this.vars[key][0];}if(_9){this.URLString+=this.argumentSeparator+urlstringtemp.join(this.argumentSeparator);}else{this.URLString+=urlstringtemp.join(this.argumentSeparator);}};this.runResponse=function(){eval(this.response);};this.runAJAX=function(_a){if(this.failed){this.onFail();}else{this.createURLString(_a);if(this.element){this.elementObj=document.getElementById(this.element);}if(this.xmlhttp){var _b=this;if(this.method=="GET"){totalurlstring=this.requestFile+this.queryStringSeparator+this.URLString;this.xmlhttp.open(this.method,totalurlstring,true);}else{this.xmlhttp.open(this.method,this.requestFile,true);try{this.xmlhttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");}catch(e){}}this.xmlhttp.onreadystatechange=function(){switch(_b.xmlhttp.readyState){case 1:_b.onLoading();break;case 2:_b.onLoaded();break;case 3:_b.onInteractive();break;case 4:_b.response=_b.xmlhttp.responseText;_b.responseXML=_b.xmlhttp.responseXML;_b.responseStatus[0]=_b.xmlhttp.status;_b.responseStatus[1]=_b.xmlhttp.statusText;if(_b.execute){_b.runResponse();}if(_b.elementObj){elemNodeName=_b.elementObj.nodeName;elemNodeName.toLowerCase();if(elemNodeName=="input"||elemNodeName=="select"||elemNodeName=="option"||elemNodeName=="textarea"){_b.elementObj.value=_b.response;}else{_b.elementObj.innerHTML=_b.response;}}if(_b.responseStatus[0]=="200"){_b.onCompletion();}else{_b.onError();}_b.URLString="";break;}};this.xmlhttp.send(this.URLString);}}};this.reset();this.createAJAX();}

View File

@ -10,15 +10,15 @@ class WP_Scripts {
}
function default_scripts() {
$this->add( 'dbx', '/wp-includes/js/dbx.js', false, '2.05' );
$this->add( 'fat', '/wp-includes/js/fat.js', false, '1.0-RC1_3660' );
$this->add( 'sack', '/wp-includes/js/tw-sack.js', false, '1.6.1' );
$this->add( 'quicktags', '/wp-includes/js/quicktags.js', false, '3517' );
$this->add( 'dbx', '/wp-includes/js/dbx.compressed.js', false, '2.05' );
$this->add( 'fat', '/wp-includes/js/fat.compressed.js', false, '1.0-RC1_3660' );
$this->add( 'sack', '/wp-includes/js/tw-sack.compressed.js', false, '1.6.1' );
$this->add( 'quicktags', '/wp-includes/js/quicktags.compressed.js', false, '3517' );
$this->add( 'colorpicker', '/wp-includes/js/colorpicker.js', false, '3517' );
$this->add( 'tiny_mce', '/wp-includes/js/tinymce/tiny_mce_gzip.php', false, '20061113' );
$mce_config = apply_filters('tiny_mce_config_url', '/wp-includes/js/tinymce/tiny_mce_config.php');
$this->add( 'wp_tiny_mce', $mce_config, array('tiny_mce'), '20061113' );
$this->add( 'prototype', '/wp-includes/js/prototype.js', false, '1.5.0');
$this->add( 'prototype', '/wp-includes/js/prototype.compressed.js', false, '1.5.0');
$this->add( 'autosave', '/wp-includes/js/autosave.js.php', array('prototype', 'sack'), '4508');
$this->add( 'wp-ajax', '/wp-includes/js/wp-ajax-js.php', array('prototype'), '4459');
$this->add( 'listman', '/wp-includes/js/list-manipulation-js.php', array('wp-ajax', 'fat'), '4459');