**哪位大虾可以提供一个单机的JS压缩和混淆工具**

dqk1985 2011-04-14 11:21:15
如果有的话小弟全分送上,自己也没有找到合适的。先谢谢了
...全文
59 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
dqk1985 2011-04-14
  • 打赏
  • 举报
回复
我的邮箱是dqk1985@163.com
或是提供个下载地址
hch126163 2011-04-14
  • 打赏
  • 举报
回复
导入上面js 就可以了


<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<title>/packer/</title>

</head>
<body>
<div class="document">
<div class="content">
<h2><span class="description">packer</span>
<span class="version">version 2.0.2</span></h2>
<form id="packer" action="/packer/" method="post">
<textarea class="disabled pre" id="output" name="output" rows="10" cols="80"></textarea></p>
<p id="message" class="error">disabled</p>
<p class="form-buttons">
<button type="button" id="packScript">压缩</button>
<button type="button" id="decodeScript">解压</button>
</p>
<p id="controls">
<label for="ascii-encoding">Encoding:</label>
<select id="ascii-encoding" name="ascii_encoding">
<option value="0">(None)</option>
<option value="10">Numeric</option>
<option value="62" selected="selected">Normal</option>
<option value="95">High ASCII</option>
</select><br />
<label for="fast-decode">Fast Decode:
<input type="checkbox" id="fast-decode" name="fast_decode" value="1" checked="checked"/></label><br />
<label for="special-chars">Special Characters:
<input type="checkbox" id="special-chars" name="special_chars" value="1"/></label>
</p>
<fieldset style="display: none;">
<input type="hidden" name="command" value=""/>
<input type="hidden" name="filename" value=""/>
<input type="hidden" name="filetype" value=""/>
</fieldset>
</form>
</div>
</div>
</body>
</html>
hch126163 2011-04-14
  • 打赏
  • 举报
回复
js 版本 js 压缩工具

<script language="javascript">
function ICommon(that){if(that!=null){that.inherit=Common.prototype.inherit;that.specialize=Common.prototype.specialize}return that};ICommon.specialize=function(p,c){if(!p)p={};if(!c)c=p.constructor;if(c=={}.constructor)c=new Function("this.inherit()");c.valueOf=new Function("return this");c.valueOf.prototype=new this.valueOf;c.valueOf.prototype.specialize(p);c.prototype=new c.valueOf;c.valueOf.prototype.constructor=c.prototype.constructor=c;c.ancestor=this;c.specialize=arguments.callee;c.ancestorOf=this.ancestorOf;return c};ICommon.valueOf=new Function("return this");ICommon.valueOf.prototype={constructor:ICommon,inherit:function(){return arguments.callee.caller.ancestor.apply(this,arguments)},specialize:function(that){if(this==this.constructor.prototype&&this.constructor.specialize){return this.constructor.valueOf.prototype.specialize(that)}for(var i in that){switch(i){case"constructor":case"toString":case"valueOf":continue}if(typeof that[i]=="function"&&that[i]!=this[i]){that[i].ancestor=this[i]}this[i]=that[i]}if(that.toString!=this.toString&&that.toString!={}.toString){that.toString.ancestor=this.toString;this.toString=that.toString}return this}};function Common(){};this.Common=ICommon.specialize({constructor:Common,toString:function(){return"[common "+(this.constructor.className||"Object")+"]"},instanceOf:function(klass){return this.constructor==klass||klass.ancestorOf(this.constructor)}});Common.className="Common";Common.ancestor=null;Common.ancestorOf=function(klass){while(klass&&klass.ancestor!=this)klass=klass.ancestor;return Boolean(klass)};Common.valueOf.ancestor=ICommon;function ParseMaster(){var E=0,R=1,L=2;var G=/\(/g,S=/\$\d/,I=/^\$\d+$/,T=/(['"])\1\+(.*)\+\1\1$/,ES=/\\./g,Q=/'/,DE=/\x01[^\x01]*\x01/g;var self=this;this.add=function(e,r){if(!r)r="";var l=(_14(String(e)).match(G)||"").length+1;if(S.test(r)){if(I.test(r)){r=parseInt(r.slice(1))-1}else{var i=l;var q=Q.test(_14(r))?'"':"'";while(i)r=r.split("$"+i--).join(q+"+a[o+"+i+"]+"+q);r=new Function("a,o","return"+q+r.replace(T,"$1")+q)}}_33(e||"/^$/",r,l)};this.exec=function(s){_3.length=0;return _30(_5(s,this.escapeChar).replace(new RegExp(_1,this.ignoreCase?"gi":"g"),_31),this.escapeChar).replace(DE,"")};this.reset=function(){_1.length=0};var _3=[];var _1=[];var _32=function(){return"("+String(this[E]).slice(1,-1)+")"};_1.toString=function(){return this.join("|")};function _33(){arguments.toString=_32;_1[_1.length]=arguments}function _31(){if(!arguments[0])return"";var i=1,j=0,p;while(p=_1[j++]){if(arguments[i]){var r=p[R];switch(typeof r){case"function":return r(arguments,i);case"number":return arguments[r+i]}var d=(arguments[i].indexOf(self.escapeChar)==-1)?"":"\x01"+arguments[i]+"\x01";return d+r}else i+=p[L]}};function _5(s,e){return e?s.replace(new RegExp("\\"+e+"(.)","g"),function(m,c){_3[_3.length]=c;return e}):s};function _30(s,e){var i=0;return e?s.replace(new RegExp("\\"+e,"g"),function(){return e+(_3[i++]||"")}):s};function _14(s){return s.replace(ES,"")}};ParseMaster.prototype={constructor:ParseMaster,ignoreCase:false,escapeChar:""};if(/MSIE 5.0/.test(navigator.userAgent))new function(){var ap=function(f,o,a){f.apply(o,a)};if(''.replace(/^/,String)){var _28=String.prototype.replace;var _29=function(e,r){var m,n="",s=this;while(s&&(m=e.exec(s))){n+=s.slice(0,m.index)+ap(r,this,m);s=s.slice(m.lastIndex)}return n+s};String.prototype.replace=function(e,r){this.replace=(typeof r=="function")?_29:_28;return this.replace(e,r)}}if(!Function.apply){var APPLY="apply-"+Number(new Date);ap=function(f,o,a){var r;o[APPLY]=f;switch(a.length){case 0:r=o[APPLY]();break;case 1:r=o[APPLY](a[0]);break;case 2:r=o[APPLY](a[0],a[1]);break;case 3:r=o[APPLY](a[0],a[1],a[2]);break;case 4:r=o[APPLY](a[0],a[1],a[2],a[3]);break;default:var aa=[],i=a.length-1;do aa[i]="a["+i+"]";while(i--);eval("r=o[APPLY]("+aa+")")}delete o[APPLY];return r};if(typeof ICommon=="function")ICommon.valueOf.prototype.inherit=function(){return ap(arguments.callee.caller.ancestor,this,arguments)}}if(![].push)Array.prototype.push=function(){for(var i=0;i<arguments.length;i++){this[this.length]=arguments[i]}return this.length};if(![].pop)Array.prototype.pop=function(){var i=this[this.length-1];this.length--;return i}};function pack(_7,_0,_2,_8){var I="$1";_7+="\n";_0=Math.min(parseInt(_0),95);function _15(s){var i,p;for(i=0;(p=_6[i]);i++){s=p(s)}return s};var _25=function(p,a,c,k,e,d){while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p};var _26=function(){if(!''.replace(/^/,String)){while(c--)d[e(c)]=k[c]||e(c);k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1}};var _6=[];function _4(p){_6[_6.length]=p};function _18(s){var p=new ParseMaster;p.escapeChar="\\";p.add(/'[^'\n\r]*'/,I);p.add(/"[^"\n\r]*"/,I);p.add(/\/\/[^\n\r]*[\n\r]/," ");p.add(/\/\*[^*]*\*+([^\/][^*]*\*+)*\//," ");p.add(/\s+(\/[^\/\n\r\*][^\/\n\r]*\/g?i?)/,"$2");p.add(/[^\w\x24\/'"*)\?:]\/[^\/\n\r\*][^\/\n\r]*\/g?i?/,I);if(_8)p.add(/;;;[^\n\r]+[\n\r]/);p.add(/\(;;\)/,I);p.add(/;+\s*([};])/,"$2");s=p.exec(s);p.add(/(\b|\x24)\s+(\b|\x24)/,"$2 $3");p.add(/([+\-])\s+([+\-])/,"$2 $3");p.add(/\s+/,"");return p.exec(s)};function _17(s){var p=new ParseMaster;p.add(/((\x24+)([a-zA-Z_]+))(\d*)/,function(m,o){var l=m[o+2].length;var s=l-Math.max(l-m[o+3].length,0);return m[o+1].substr(s,l)+m[o+4]});var r=/\b_[A-Za-z\d]\w*/;var k=_13(s,_9(r),_21);var e=k.e;p.add(r,function(m,o){return e[m[o]]});return p.exec(s)};function _16(s){if(_0>62)s=_20(s);var p=new ParseMaster;var e=_12(_0);var r=(_0>62)?/\w\w+/ :/\w+/;k=_13(s,_9(r),e);var e=k.e;p.add(r,function(m,o){return e[m[o]]});return s&&_27(p.exec(s),k)};function _13(s,r,e){var a=s.match(r);var so=[];var en={};var pr={};if(a){var u=[];var p={};var v={};var c={};var i=a.length,j=0,w;do{w="$"+a[--i];if(!c[w]){c[w]=0;u[j]=w;p["$"+(v[j]=e(j))]=j++}c[w]++}while(i);i=u.length;do{w=u[--i];if(p[w]!=null){so[p[w]]=w.slice(1);pr[p[w]]=true;c[w]=0}}while(i);u.sort(function(m1,m2){return c[m2]-c[m1]});j=0;do{if(so[i]==null)so[i]=u[j++].slice(1);en[so[i]]=v[i]}while(++i<u.length)}return{s:so,e:en,p:pr}};function _27(p,k){var E=_10("e\\(c\\)","g");p="'"+_5(p)+"'";var a=Math.min(k.s.length,_0)||1;var c=k.s.length;for(var i in k.p)k.s[i]="";k="'"+k.s.join("|")+"'.split('|')";var e=_0>62?_11:_12(a);e=String(e).replace(/_0/g,"a").replace(/arguments\.callee/g,"e");var i="c"+(a>10?".toString(a)":"");if(_2){var d=_19(_26);if(_0>62)d=d.replace(/\\\\w/g,"[\\xa1-\\xff]");else if(a<36)d=d.replace(E,i);if(!c)d=d.replace(_10("(c)\\s*=\\s*1"),"$1=0")}var u=String(_25);if(_2){u=u.replace(/\{/,"{"+d+";")}u=u.replace(/"/g,"'");if(_0>62){u=u.replace(/'\\\\b'\s*\+|\+\s*'\\\\b'/g,"")}if(a>36||_0>62||_2){u=u.replace(/\{/,"{e="+e+";")}else{u=u.replace(E,i)}u=pack(u,0,false,true);var p=[p,a,c,k];if(_2){p=p.concat(0,"{}")}return"eval("+u+"("+p+"))\n"};function _12(a){return a>10?a>36?a>62?_11:_22:_23:_24};var _24=function(c){return c};var _23=function(c){return c.toString(36)};var _22=function(c){return(c<_0?'':arguments.callee(parseInt(c/_0)))+((c=c%_0)>35?String.fromCharCode(c+29):c.toString(36))};var _11=function(c){return(c<_0?'':arguments.callee(c/_0))+String.fromCharCode(c%_0+161)};var _21=function(c){return"_"+c};function _5(s){return s.replace(/([\\'])/g,"\\$1")};function _20(s){return s.replace(/[\xa1-\xff]/g,function(m){return"\\x"+m.charCodeAt(0).toString(16)})};function _10(s,f){return new RegExp(s.replace(/\$/g,"\\$"),f)};function _19(f){with(String(f))return slice(indexOf("{")+1,lastIndexOf("}"))};function _9(r){return new RegExp(String(r).slice(1,-1),"g")};_4(_18);if(_8)_4(_17);if(_0)_4(_16);return _15(_7)};var input,output;onload=function(){if(!document.getElementById||''.replace(/^/,String))return;input=document.getElementById("output");output=document.getElementById("output");var message=document.getElementById("message");var encoding=document.getElementById("ascii-encoding");var fastDecode=document.getElementById("fast-decode");var specialChars=document.getElementById("special-chars");function packScript(){try{if(input.value){output.value=pack(input.value,encoding.value,fastDecode.checked,specialChars.checked);calculateRatio();disableDecode(!output.value||encoding.value==0)}}catch(e){reportError("error packing script",e.message)}};function decodeScript(){try{if(output.value){eval("output.value=String"+output.value.slice(4));calculateRatio()}}catch(e){reportError("error decoding script",e.message)}finally{decodeScript.button.blur();disableDecode(true)}};function disableDecode(disabled){decodeScript.button.disabled=false;};function enableFastDecode(){fastDecode.disabled=Boolean(encoding.value==0);fastDecode.parentNode.className=(encoding.value==0)?"disabled":""};function calculateRatio(){var calc=output.value.length+"/"+input.value.length;var result=Number(eval(calc));var ratio=result.toFixed?result.toFixed(3):result;message.firstChild.nodeValue="compression ratio: "+calc+"="+ratio;message.className=""};function reportError(m,e){message.innerHTML=m+(e?": "+e:"");message.className="error"};encoding.onclick=enableFastDecode;var buttons=document.getElementsByTagName("button");var button,i;for(i=0;(button=buttons[i]);i++){var handler=eval(button.id);button.onclick=handler;handler.button=button}fastDecode.checked=true;var packer=document.forms[0];packer.className="";};
</script>

87,901

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧