Thursday, December 18, 2008

JavaScript::Beautifier

I just uploaded my yet another module JavaScript::Beautifier to CPAN.

The module is mostly a Perl-rewrite of http://github.com/einars/js-beautify/tree/master/beautify.js

The js demo is http://elfz.laacz.lv/beautify/ which is really cool.

I'm going to write a plugin for Padre soon or later.

just enjoy!

Labels:

Friday, July 27, 2007

Javascript Minfier

As Yahoo! suggested, minified js would improve your site performance.
http://developer.yahoo.com/performance/rules.html#minify

Luckily, Perl has JavaScript::Minifier.
but be careful, cpan will fail, u need download from web then perl Makefile.PL.

I wrote a script to minify all js files under a dir.

@Enjoy.

Labels:

Thursday, December 14, 2006

Autocompleter.Local

I'm pretty happy with scriptaculous. Ajax.Autocompleter works fine expect a bit slow than I thought.
so sometimes u may want that acts much faster. In that situation, I bet u can have a try of Autocompleter.Local

Autocompleter.Local is somehow the same as Ajax.Autocompleter but the third param is an array ref instead of a remote url.

for more details, please check:
http://wiki.script.aculo.us/scriptaculous/show/Autocompleter.Local

Labels: ,

Tuesday, September 26, 2006

XML.ObjTree and force_array

在以前的 blog 里提过 JSAN 的 XML.ObjTree. See javascript XML parser
今天发现一点新东西。所以要做一下修正。
最主要是 force_array 这个以前被我忽略了但非常有用的参数。
<xml><message>OK</message></xml>
<xml><message>OK</message><message>DEL</message></xml>

以前写起来比较麻烦,要用 if (tree.xml.message) { 来判断是不是一个。
现在发现有了 force_array, 就非常简单了。:)

JSAN.use('XML.ObjTree');
var xotree = new XML.ObjTree();
xotree.force_array = [ "message" ];
var tree = xotree.parseXML( response );
for (i = 0; i <>不管有多少个 messages, 一律强制使用 array
以前的我真是有点笨。

any way, JSAN 和 XML.ObjTree 都非常好用。:)

Labels: