📄 jsap.hta
字号:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml">
<head><hta:application id=jsvm2JsarPackager applicationname="JSVM JavaScript Archive Packager V0.2" border="dialog" [thick/dialog window/none/thin] borderStyle="raised" [normal/complex/raised/static/sunken] caption="yes" icon="res/logo.ico" maximizebutton="no" minimizebutton="yes" showintaskbar="yes" singleinstance="yes" sysmenu="yes" version="1.0" windowstate="normal" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"><title>JSVM JavaScript Archive Packager V0.2</title>
<style>body {padding:0px;background-color:white;color:black;font-family:MS Sans Serif;font-size:12px;} .panel {border:2px inset;width:440px;height:320px;overflow:auto;padding:5px} .button {margin-top:2px}</style>
<script>window.resizeTo(490,540);</script>
<script src="../jsre.js" modules="runtime,tools"></script>
<script>$import('js.lang.System');var fso=null;var getFileSystemObject=function(){if(fso!=null){return fso;}try{fso=new ActiveXObject("Scripting.FileSystemObject");return fso;}catch(e){throw "Not support 'Scripting.FileSystemObject'!";}};var classHome=null;var getTreeNodeByClassHome=function(){classHome=document.getElementById('jsrepath').value;if(classHome!=''){classHome=classHome.replace(/jsre\.js$/,'classes');}else{classHome=System.getClassHome();}if(/^file:\/\//.test(classHome)){classHome=classHome.replace(/^file:\/\//, '');};try {classHome=getFileSystemObject().getFolder(classHome).path;}catch(e){throw 'Security Error! FSO can not access the real path (classHome):'+classHome;};var root=new jsvm.tools.TreeNode("Class Home", classHome);finishChildNodes(root);return root;};var finishChildNodes=function(node){var folder=getFileSystemObject().getFolder(node.value);var files=new Enumerator(folder.Files);for(;!files.atEnd();files.moveNext()){var file=files.item();if(/\.class\.js$/.test(file.name)){var childNode=new jsvm.tools.TreeNode(file.name, file.path);var className=file.path.replace(classHome,"").replace(".class.js","").replace(/^\\/, "").replace(/\\/g, ".");childNode.setAttribute("className", className);node.appendChild(childNode);}}var folders=new Enumerator(folder.SubFolders);for(;!folders.atEnd();folders.moveNext()){var subfolder=folders.item();if(subfolder.name!="CVS"){var childNode=new jsvm.tools.TreeNode(subfolder.name, subfolder.path);finishChildNodes(childNode);node.appendChild(childNode);}}};
var out={print:function(s){System.out.print(s);document.getElementById('divPanel3').insertAdjacentHTML("beforeEnd",s);},println:function(s){System.out.println(s);document.getElementById('divPanel3').insertAdjacentHTML("beforeEnd",s+'<br/>');}};var currIndex=0;function showPanel(n){if(n<4)currIndex=n;hideAllPanel();document.getElementById('divPanel'+n).style.display='';}
function hideAllPanel(){for(var i=0;i<4;i++)document.getElementById('divPanel'+i).style.display='none';}
var allClassTree=null;function listAllClasses(){try {System.gc();allClassTree=getTreeNodeByClassHome();allClassTree.build('allClassTreeContainer');allClassTree.expand();}catch(e){alert(e.message||e);}}
function listLibClasses(){var path=document.getElementById('jsarpath').value;if(path==''){alert('Must enter the js archive location.');return;}var lib=jsvm.tools.JSArchivePackager.loadLibInfo(path);var sb=[];for(var clz in lib.entity){if(clz==null||clz=='null'){continue;}var id='libclz_'+clz;sb.push('<input type=checkbox checked name=\'lib-class\' id=\''+id+'\' value=\''+clz+'\'> <label for=\''+id+'\'>'+clz+'</label>');};document.getElementById('libClassesContainer').innerHTML=sb.join('<br/>')||'No class found';}
function listLoadedClasses(){try {var classes=jsvm.tools.JSArchivePackager.getLoadedClasses();var sb=[];for(var i=0;i<classes.length;i++){var clz=classes[i],id='loadclz_'+clz;sb.push('<input type=checkbox checked name=\'loaded-class\' id=\''+id+'\' value=\''+clz+'\'> <label for=\''+id+'\'>'+clz+'</label>');};document.getElementById('loadedClassesContainer').innerHTML=sb.join('<br/>')||'No class found';}catch(e){alert(e.message||e);}}
function getSelectedAllClasses(){if(allClassTree==null)return[];var classes=[];var nodes=allClassTree.getCheckedChildNodes();for(var i=0;i<nodes.length;i++){var className=nodes[i].getAttribute('className');if(className!=null){classes.push(className);}}return classes;}
function getSelectedLibClasses(){var els=document.getElementsByName('lib-class');var clzes=[];for(var i=0;i<els.length;i++){if(els[i].checked){clzes.push(els[i].value);}}return clzes;}
function getSelectedLoadedClasses(){var els=document.getElementsByName('loaded-class');var clzes=[];for(var i=0;i<els.length;i++){if(els[i].checked){clzes.push(els[i].value);}}return clzes;}
function getJSARClasses(){if(currIndex==0){return getSelectedAllClasses();}else if(currIndex==1){return getSelectedLibClasses();}else if(currIndex==2){return getSelectedLoadedClasses();}else{alert('err currIndex');}}
function buildJSAR(){var path = document.getElementById('ja_path').value;if(path==''){alert('Must enter the path of export!');return;}
if(getFileSystemObject().fileExists(path)&&!confirm('File: \''+path+'\' already exists, overwrite it?')){return;};var config={path: path,name: document.getElementById('ja_name').value,version: document.getElementById('ja_version').value,author: document.getElementById('ja_author').value,classes:getJSARClasses(),isOverwrite:true,ignoreError:document.getElementById('js_ignore').checked};setTimeout(function(){jsvm.tools.JSArchivePackager.exportJSArchive(config, out);});}
</script></head><body scroll="auto" onload="showPanel(0)"><div style='margin-bottom:5px'><input type=radio name='panelSwith' id='panel0' onclick='showPanel(0);' checked><label for='panel0'>All Class</label> <input type=radio id='panel1' name='panelSwith' onclick='showPanel(1);'><label for='panel1'>File Class</label> <input type=radio id='panel2' name='panelSwith' onclick='showPanel(2);'><label for='panel2'>Loaded Class</label> <input type=radio id='panel3' name='panelSwith' onclick='showPanel(3);'><label for='panel3'>Execute Logs</label></div><div id='divPanel0' class='panel' style='display:none;'><div><strong>jsvm2/jsre.js location:</strong> <input type=file id='jsrepath' style='height:22px'><input type=button style='height:22px' value=' list ' onclick='listAllClasses();'></div><div id='allClassTreeContainer'>no data</div></div><div id='divPanel1' class='panel' style='display:none;'><div><strong>js archive location:</strong> <input id='jsarpath' type=file style='height:22px'><input type=button style='height:22px' value=' list ' onclick='listLibClasses();'></div><div id='libClassesContainer'>no data</div></div><div id='divPanel2' class='panel' style='display:none;'><div><strong>all loaded classes in memory.</strong> <a href='#' onclick='listLoadedClasses();return false;'>list & refresh</a></div><div id='loadedClassesContainer'>no data</div></div><div id='divPanel3' class='panel' style='display:none;' contentEditable=true>JavaScript Archive Packager :
</div><fieldset style='margin-top:5px;margin-bottom:5px;padding:5px;width:440px;'><legend style='padding:2px'>JS Archive Information</legend>Name: <input type='text' style='width:120px' id='ja_name' /> Author: <input type='text' style='width:120px' id='ja_author' /> Version:<input type='text' style='width:60px' value='1.0' id='ja_version' /><br/>Path:<input type='file' style='width:300px;margin-left:9px' id='ja_path' /> <input type='checkbox' id='js_ignore' checked /> <label for='js_ignore'>ignore error</label><br/></fieldset><input type='button' class='button' value='export' onclick='buildJSAR();' /> <input type='button' class='button' value='close' onclick='window.close();' /></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -