{"id":626,"date":"2010-09-13T23:48:22","date_gmt":"2010-09-13T15:48:22","guid":{"rendered":""},"modified":"2014-03-11T22:34:08","modified_gmt":"2014-03-11T14:34:08","slug":"javascript-%e5%8a%a0%e5%af%86%e3%80%81%e8%a7%a3%e5%af%86%e4%bb%a3%e7%a0%81-htm","status":"publish","type":"post","link":"http:\/\/www.xiaoyebailong.com\/index.php\/2010\/09\/13\/626.htm","title":{"rendered":"javascript \u52a0\u5bc6\u3001\u89e3\u5bc6\u4ee3\u7801.htm"},"content":{"rendered":"<div class=\"UBBDiv\">\n<p>[Code]&lt;script&gt;&nbsp; <br \/>\na=62;&nbsp; <br \/>\nfunction&nbsp;encode()&nbsp;{&nbsp; <br \/>\nvar&nbsp;code&nbsp;=&nbsp;document.getElementById(&#8216;code&#8217;).value;&nbsp; <br \/>\ncode&nbsp;=&nbsp;code.replace(\/[\\r\\n]+\/g,&nbsp;&#8221;);&nbsp; <br \/>\ncode&nbsp;=&nbsp;code.replace(\/&#8217;\/g,&nbsp;&quot;\\\\&#8217;&quot;);&nbsp; <br \/>\nvar&nbsp;tmp&nbsp;=&nbsp;code.match(\/\\b(\\w+)\\b\/g);&nbsp; <br \/>\ntmp.sort();&nbsp; <br \/>\nvar&nbsp;dict&nbsp;=&nbsp;[];&nbsp; <br \/>\nvar&nbsp;i,&nbsp;t&nbsp;=&nbsp;&#8221;;&nbsp; <br \/>\nfor(var&nbsp;i=0;&nbsp;i&lt;tmp.length;&nbsp;i++)&nbsp;{&nbsp; <br \/>\n&nbsp;&nbsp;&nbsp;if(tmp[i]&nbsp;!=&nbsp;t)&nbsp;dict.push(t&nbsp;=&nbsp;tmp[i]);&nbsp; <br \/>\n}&nbsp; <br \/>\nvar&nbsp;len&nbsp;=&nbsp;dict.length;&nbsp; <br \/>\nvar&nbsp;ch;&nbsp; <br \/>\nfor(i=0;&nbsp;i&lt;len;&nbsp;i++)&nbsp;{&nbsp; <br \/>\n&nbsp;&nbsp;&nbsp;ch&nbsp;=&nbsp;num(i);&nbsp; <br \/>\n&nbsp;&nbsp;&nbsp;code&nbsp;=&nbsp;code.replace(new&nbsp;RegExp(&#8216;\\\\b&#8217;+dict[i]+&#8217;\\\\b&#8217;,&#8217;g&#8217;),&nbsp;ch);&nbsp; <br \/>\n&nbsp;&nbsp;&nbsp;if(ch&nbsp;==&nbsp;dict[i])&nbsp;dict[i]&nbsp;=&nbsp;&#8221;;&nbsp; <br \/>\n}&nbsp; <br \/>\ndocument.getElementById(&#8216;code&#8217;).value&nbsp;=&nbsp;&quot;eval(function(p,a,c,k,e,d){e=function(c){return(c&lt;a?&#8221;:e(parseInt(c\/a)))+((c=c%a)&gt;35?String.fromCharCode(c+29):c.toString(36))};if(!&#8221;.replace(\/^\/,String)){while(c&#8211;)d[e(c)]=k[c]||e(c);k=[function(e){return&nbsp;d[e]}];e=function(){return&#8217;\\\\\\\\w+&#8217;};c=1};while(c&#8211;)if(k[c])p=p.replace(new&nbsp;RegExp(&#8216;\\\\\\\\b&#8217;+e(c)+&#8217;\\\\\\\\b&#8217;,&#8217;g&#8217;),k[c]);return&nbsp;p}(&quot;&nbsp; <br \/>\n&nbsp;&nbsp;&nbsp;+&nbsp;&quot;&#8217;&quot;+code+&quot;&#8217;,&quot;+a+&quot;,&quot;+len+&quot;,&#8217;&quot;+&nbsp;dict.join(&#8216;|&#8217;)+&quot;&#8217;.split(&#8216;|&#8217;),0,{}))&quot;;&nbsp; <br \/>\n}&nbsp; <\/p>\n<p>function&nbsp;num(c)&nbsp;{&nbsp; <br \/>\nreturn(c&lt;a?&#8221;:num(parseInt(c\/a)))+((c=c%a)&gt;35?String.fromCharCode(c+29):c.toString(36));&nbsp; <br \/>\n}&nbsp; <\/p>\n<p>function&nbsp;run()&nbsp;{&nbsp; <br \/>\neval(document.getElementById(&#8216;code&#8217;).value);&nbsp; <br \/>\n}&nbsp; <\/p>\n<p>function&nbsp;decode()&nbsp;{&nbsp; <br \/>\nvar&nbsp;code&nbsp;=&nbsp;document.getElementById(&#8216;code&#8217;).value;&nbsp; <br \/>\ncode&nbsp;=&nbsp;code.replace(\/^eval\/,&nbsp;&#8221;);&nbsp; <br \/>\ndocument.getElementById(&#8216;code&#8217;).value&nbsp;=&nbsp;eval(code);&nbsp; <br \/>\n}&nbsp; <br \/>\n&lt;\/script&gt;&nbsp; <\/p>\n<p>\n&lt;textarea&nbsp;id=code&nbsp;cols=80&nbsp;rows=20&gt;&nbsp; <\/p>\n<p>&lt;\/textarea&gt;&nbsp; <\/p>\n<p>&lt;input&nbsp;type=button&nbsp;onclick=encode()&nbsp;value=\u7f16\u7801&gt;&nbsp; <br \/>\n&lt;input&nbsp;type=button&nbsp;onclick=run()&nbsp;value=\u6267\u884c&gt;&nbsp; <br \/>\n&lt;input&nbsp;type=button&nbsp;onclick=decode()&nbsp;value=\u89e3\u7801&gt;&nbsp; <br \/>\n[\/Code]<\/p>\n<p>&nbsp;<\/p>\n<p>\u5b58\u4e3ahtm\u5c31\u53ef\u4ee5\u8fd0\u884c<\/p>\n<p>&nbsp;<\/p>\n<\/div>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>[Code]&lt;script&gt;&nbsp; a=62;&nbsp; function&nbsp;encode()&nbsp;{&nbsp; var&nbsp;code&nbsp;=&nbsp;document.getElement&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"topic":[],"class_list":["post-626","post","type-post","status-publish","format-standard","hentry","category-technology"],"_links":{"self":[{"href":"http:\/\/www.xiaoyebailong.com\/index.php\/wp-json\/wp\/v2\/posts\/626","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.xiaoyebailong.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.xiaoyebailong.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.xiaoyebailong.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.xiaoyebailong.com\/index.php\/wp-json\/wp\/v2\/comments?post=626"}],"version-history":[{"count":1,"href":"http:\/\/www.xiaoyebailong.com\/index.php\/wp-json\/wp\/v2\/posts\/626\/revisions"}],"predecessor-version":[{"id":66501,"href":"http:\/\/www.xiaoyebailong.com\/index.php\/wp-json\/wp\/v2\/posts\/626\/revisions\/66501"}],"wp:attachment":[{"href":"http:\/\/www.xiaoyebailong.com\/index.php\/wp-json\/wp\/v2\/media?parent=626"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.xiaoyebailong.com\/index.php\/wp-json\/wp\/v2\/categories?post=626"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.xiaoyebailong.com\/index.php\/wp-json\/wp\/v2\/tags?post=626"},{"taxonomy":"topic","embeddable":true,"href":"http:\/\/www.xiaoyebailong.com\/index.php\/wp-json\/wp\/v2\/topic?post=626"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}