Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

Javascript code prettifier ÖÐÎÄ°ïÖúÎĵµ

Javascript code prettifier
Javascript ´úÂëÃÀÈÝʦ
°²×°Ê¹ÓÃ
ÏÂÔØ Îļþ
ÔÚÄãµÄÎļþÖаüº¬Õâ¶ùµÄ½Å±¾ºÍÑùʽ±í(ÄãÒª±£Ö¤Õâ¶ùµÄ css ºÍ js Îļþ°´ÔÚÄãµÄ·þÎñÆ÷ÉÏ, ²¢ÇÒµ÷ÕûÔÚ script ºÍ link±êÇ©ÖеÄ·¾¶)
<link href="prettify.css" type="text/css" rel="stylesheet" />
<script type="text/javascript" src="prettify.js"></script>
Ìí¼Óonload="prettyPrint()" µ½ÄãµÄÎļþµÄ body ±êÇ©ÖÐ.
ÐÞ¸ÄÑùʽ±í,ʹÓÃÄã×Ô¼ºÏ²»¶µÄÑÕÉ«.
ʹÓ÷½·¨
ÔÚ <pre class="prettyprint">...</pre> »ò <code class="prettyprint">...</code> Öмä·ÅÉÏ´úÂëƬ¶Î,Ëü¾Í»á×Ô¶¯±»ÃÀ»¯ÁË.
The original Prettier
class Voila {
public:
// Voila
static const string VOILA = "Voila";
// will not interfere with embedded tags.
}
class Voila {
public:
// Voila
static const string VOILA = "Voila";
// will not interfere with embedded tags.
}
³£¼ûÎÊÌâ
ËüÊÇΪʲôÓïÑÔ¹¤×÷µÄ?
prettify.jsÖеÄ×¢ÊÍÊÇȨÍþµÄ,µ«ÊÇËüµÄÓï·¨·ÖÎö³ÌÐò¿ÉÒÔÔںܶàÓïÑÔÖÐʹÓÃ,°üÀ¨ C , Java, Python, Bash, SQL, HTML, XML, CSS, Javascript, ºÍ Makefiles. ËüÔÚ Ruby, PHP, VB, ºÍ Awk Öл¹Ëã¿ÉÒÔ,¶øÇÒÒ²¿ÉÒÔÔÚ Perl ºÍ RubyµÄºÏÊÊ×Ó¼¯ÖÐÆð×÷ÓÃ,µ«ÊÇ, ÒòΪעÊ͵ÄÔ¼¶¨,Ëü¶Ô Smalltalk, »ò CAMLÀàËƵÄÓïÑÔÆð×÷ÓÃ.
LISPϵÁеÄÓïÑÔ¿ÉÒÔʹÓÃÒ»¸öÍØÕ¹lang-lisp.js.
¶ÔÓÚ CSS, Haskell, Lua, OCAML, SML, F#, Visual Basic, SQL, Protocol Buffers, ºÍ WikiText..Ò²ÊÇÀàËƵÄ
Èç¹ûÄãÏë¸øÄãϲ»¶µÄÓïÑÔд¸öÍØÕ¹°æ±¾, Çë²ÎÔÄsrc/lang-lisp.js ,²¢Ð´Ò»¸ö°üÀ¨ÄãµÄÓïÑÔµÄÍØÕ¹µÄ ·¢²¼ ºÍÒ»¸ö²âÊÔÓÃÀý.
ÈçºÎÖ¸¶¨ÎҵĴúÂëÔÚÄÄÖÖÓïÑÔÀï?
Äã²»ÐèÒªÖ¸¶¨ÓïÑÔ»·¾³,ÒòΪ prettyprint() »á¶Ô´Ë½øÐв²â. Äã¿ÉÒÔʹÓà prettyprint Õâ¸öÀàͨ¹ýÖ¸¶¨ÓïÑÔµÄÍØÕ¹ÃûÀ´Ö¸¶¨ÓïÑÔ,¾ÍÏñÕâÑù:
<pre class="prettyprint lang-html">
The lang-* class specifies the language file extensions.
File extensions supported by default include
"bsh", "c", "cc", "cpp", "cs", "csh", "cyc", "cv", "htm", "html",
"java", "js", "m", "mxml", "perl", "pl", "pm", "py", "rb", "sh",
"xhtml", "xml", "xsl".
</pre>
ËüÔÚ»ìÏý´úÂëÀý×ÓÉϲ»Æð×÷ÓÃÂð?
ÊǵÄ. ÃÀ»¯»ìÏý´úÂë¾ÍÏñ¸øСÖíÍ¿¿Úºì,Ò²¾ÍÊDz»ÔÚÕâ¸


Ïà¹ØÎĵµ£º

JavaScript¾«´â¶ÁÊé±Ê¼Ç(1)

http://blog.csdn.net/mouyong/archive/2009/10/02/4626852.aspx
Èç¹ûÄãÏë¼ÓÔ­×÷ÕßΪºÃÓÑ£ºÇëµã»÷ÒÔÏÂÁ´½Óhttp://hi.csdn.net/invite.php?u=8943&c=759c7fc189ea23c1
µÚ1Õ   ¾«»ª
JavaScriptµÄÌØÐÔÖÐÓÐÒ»²¿·ÖÌØÐÔ´øÀ´µÄÂé·³Ô¶Ô¶³¬³öËüÃǵļÛÖµ¡£ÆäÖУ¬Ò»Ð©ÌØÐÔÊÇÒòΪ¹æ·¶ºÜ²»ÍêÉÆ£¬´Ó¶ø¿ÉÄܵ¼Ö¿ÉÒÆ ......

JavaScript¾«´â¶ÁÊé±Ê¼Ç(6)

http://blog.csdn.net/mouyong/archive/2010/01/25/5252558.aspx
µÚ6Õ  Êý×é
Êý×éÊÇÒ»¶ÎÏßÐÔ·ÖÅäµÄÄڴ棬Ëüͨ¹ýÕûÊýÈ¥¼ÆËãÆ«ÒƲ¢·ÃÎÊÆäÖеÄÔªËØ¡£Êý×é¿ÉÒÔÊǺܿìµÄÊý¾Ý½á¹¹¡£²»ÐÒµÄÊÇ£¬JavaScriptµÄÊý×é²»ÊÇÕâÑùµÄ¡£ËüÌṩÁËÒ»ÖÖÓµÓÐÀàËÆÊý×éÌØÐԵĶÔÏó¡£Ëü°ÑÊý×éµÄϱêת±ä³É×Ö·û´®£¬ÓÃÆä×÷ΪÊôÐÔ¡£ËüÃ÷ÏԵر ......

JavaScript¾«´â¶ÁÊé±Ê¼Ç(7)


http://blog.csdn.net/mouyong/archive/2010/01/31/5275562.aspx
µÚ7Õ  ÕýÔò±í´ïʽ
JavaScriptµÄÐí¶àÌØÐÔ¶¼½è¼ø×ÔÆäËûÓïÑÔ¡£Óï·¨½è¼ø×ÔJava£¬º¯Êý½è¼ø×ÔScheme£¬Ô­Ðͼ̳нè¼ø×ÔSelf¡£¶øJavaScriptµÄÕýÔò±í´ïʽÌØÐÔÔò½è¼ø×ÔPerl¡£
ÕýÔò±í´ïʽÆðÔ´ÓÚ¶ÔÐÎʽÓïÑÔµÄÊýѧÑо¿¡£
ÔÚJavaScriptÖУ¬ÕýÔò±í´ïʽµÄÓï· ......

JavaScriptͦÈë·þÎñÆ÷¶Ë¿ª·¢ÓïÑÔÐòÁÐ

Ô­ÎÄÁ´½Ó£ºJavaScript: Its Not Just for Browsers Any More
Node.jsÊÇÒ»Ì×ÓÃÀ´±àд¸ßÐÔÄÜÍøÂç·þÎñÆ÷µÄJavaScript¹¤¾ß°ü£¬Ò»ÏµÁеı仯ÓÉ´Ë¿ªÊ¼¡£
Ò²ÐíÄ㻹²»ÖªµÀ£¬JavaScriptÏÖÔÚÒѾ­³ÉÁËÒ»Ãſɱàд³öЧÂʼ«¸ßµÄ¡¢¿ÉÓÃÓÚ¿ª·¢²úÆ·¼¶web·þÎñÆ÷µÄ³öÉ«ÓïÑÔ¡£Æð³õÎÒÒ²²»ÏàÐÅ£¬µ«2009 ÄêÆô¶¯µÄÁ½¸öÏîÄ¿ÈÃÕâ³ÉΪ¿ÉÄÜ£ºCommonJSº ......

JavaScript ÕÚÕֲ㠵¯³ö¿ò

<script type="text/javas
cript">
var docEle = function() {
    return document.getElementById(arguments[0]) || false;
}
function openNewDiv(_id){
    var m = "mask";
    if (docEle(_id)) document.body.removeChild(docEle(_i ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ