<span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 13px; border-collapse: collapse; ">Hi,<br><br>I am currently working on some elaborate jquery plugin projects with a lot of custom javascript generation. But i find it very difficult to check if the generated javascript is correct in firebug, because it appears all on one line. <br>
<br>Is there a special javascript stream which does all the formatting?<br><br>For instance, i am currnetly porting the squak jqgrid plugin to visual works and I am adding the editing functionality to it. <br><br>I end up with strings like this:<br>
<br>/*&lt;![CDATA[*/function onLoad(){$(&quot;#grid&quot;).jqGrid({datatype:&quot;json&quot;,url:&quot;/jqgrid?_s=djvP-IcmhCV41XX9&amp;_k=F3dJxyNWd7_KXQ8C&amp;1&quot;,editurl:&quot;/jqgrid?_s=djvP-IcmhCV41XX9&amp;_k=F3dJxyNWd7_KXQ8C&amp;2&quot;,viewrecords:true,height:&quot;100%&quot;,onSelectRow:function(id){if(id &amp;&amp; id!==lastsel){ $(&quot;#grid&quot;).jqGrid(&quot;restoreRow&quot;,lastsel); $(&quot;#grid&quot;).jqGrid(&quot;editRow&quot;,id,true); lastsel=id;} },colNames:[&quot;Inv No.&quot;,&quot;Date&quot;,&quot;Client&quot;,&quot;Amount&quot;,&quot;Tax&quot;,&quot;Total&quot;,&quot;Notes&quot;],colModel:[{index:&quot;id&quot;,name:&quot;id&quot;,width:70},{index:&quot;invdate&quot;,name:&quot;invdate&quot;,editable:true,width:110},{index:&quot;name&quot;,name:&quot;name&quot;,editable:true,width:100},{index:&quot;amount&quot;,name:&quot;amount&quot;,align:&quot;right&quot;,editable:true,width:100},{index:&quot;tax&quot;,name:&quot;tax&quot;,align:&quot;right&quot;,editable:true,width:80},{index:&quot;total&quot;,name:&quot;total&quot;,align:&quot;right&quot;,editable:true,width:80},{index:&quot;note&quot;,name:&quot;note&quot;,editable:true,sortable:false,width:150}],altRows:true,rowNum:10,rowList:[10,20,40,100],pager:&quot;pager&quot;,sortname:&quot;id&quot;,caption:&quot;JSON Example&quot;})}/*]]&gt;*/<br>
&lt;/script&gt;<br>&lt;/body&gt;<br><br>But I would like to end up with something like this (generated by <a href="http://jsbeautifier.org/" target="_blank" style="color: rgb(7, 77, 143); ">http://jsbeautifier.org/</a>)<div>
<br></div><div><br><div><div>function onLoad() {</div><div>    $(&quot;#grid&quot;).jqGrid({</div><div>        datatype: &quot;json&quot;,</div><div>        url: &quot;/jqgrid?_s=djvP-IcmhCV41XX9&amp;_k=F3dJxyNWd7_KXQ8C&amp;1&quot;,</div>
<div>        editurl: &quot;/jqgrid?_s=djvP-IcmhCV41XX9&amp;_k=F3dJxyNWd7_KXQ8C&amp;2&quot;,</div><div>        viewrecords: true,</div><div>        height: &quot;100%&quot;,</div><div>        onSelectRow: function (id) {</div>
<div>            if (id &amp;&amp; id !== lastsel) {</div><div>                $(&quot;#grid&quot;).jqGrid(&quot;restoreRow&quot;, lastsel);</div><div>                $(&quot;#grid&quot;).jqGrid(&quot;editRow&quot;, id, true);</div>
<div>                lastsel = id;</div><div>            }</div><div>        },</div><div>        colNames: [&quot;Inv No.&quot;, &quot;Date&quot;, &quot;Client&quot;, &quot;Amount&quot;, &quot;Tax&quot;, &quot;Total&quot;, &quot;Notes&quot;],</div>
<div>        colModel: [{</div><div>            index: &quot;id&quot;,</div><div>            name: &quot;id&quot;,</div><div>            width: 70</div><div>        },</div><div>        {</div><div>            index: &quot;invdate&quot;,</div>
<div>            name: &quot;invdate&quot;,</div><div>            editable: true,</div><div>            width: 110</div><div>        },</div><div>        {</div><div>            index: &quot;name&quot;,</div><div>            name: &quot;name&quot;,</div>
<div>            editable: true,</div><div>            width: 100</div><div>        },</div><div>        {</div><div>            index: &quot;amount&quot;,</div><div>            name: &quot;amount&quot;,</div><div>            align: &quot;right&quot;,</div>
<div>            editable: true,</div><div>            width: 100</div><div>        },</div><div>        {</div><div>            index: &quot;tax&quot;,</div><div>            name: &quot;tax&quot;,</div><div>            align: &quot;right&quot;,</div>
<div>            editable: true,</div><div>            width: 80</div><div>        },</div><div>        {</div><div>            index: &quot;total&quot;,</div><div>            name: &quot;total&quot;,</div><div>            align: &quot;right&quot;,</div>
<div>            editable: true,</div><div>            width: 80</div><div>        },</div><div>        {</div><div>            index: &quot;note&quot;,</div><div>            name: &quot;note&quot;,</div><div>            editable: true,</div>
<div>            sortable: false,</div><div>            width: 150</div><div>        }],</div><div>        altRows: true,</div><div>        rowNum: 10,</div><div>        rowList: [10, 20, 40, 100],</div><div>        pager: &quot;pager&quot;,</div>
<div>        sortname: &quot;id&quot;,</div><div>        caption: &quot;JSON Example&quot;</div><div>    })</div><div>}</div></div></div><div><br></div><div>Is that possible? </div><div><br></div><div>I could add the extra tab&#39;s and linefeeds to the stream functions in the JSStream but I am hoping that there might already be an implementation that beautifies javascript (Like the WAPrettyPrintDocument used by the Halo&#39;s (would be great if that could be the default writer as well ;-) )).</div>
<div><br></div><div>Regards,</div><div><br></div><div>Bart Veenstra</div></span>