Javascript 查看器、美化器、格式化器、编辑器
将您凌乱、压缩或混淆的 Javascript(JS) 代码输入到上方的字段中,即可将其清理干净,变得美观大方。上方的编辑器还包含实用的行号和语法高亮显示功能。此外,还有许多选项可供您根据个人格式偏好定制美化器。
何时使用 Javascript Viewer、Beautifier 和 Formatter、Editor
编写 JavaScript(JS) 时,缩进、间距和其他格式设置经常会变得有些混乱。多个开发人员共同开发一个项目,而他们各自使用不同的格式化技术,这种情况也很常见。此工具有助于保持文件格式的一致性。JavaScript(JS) 代码也经常需要进行最小化或混淆处理。您可以使用此工具使代码看起来更美观、更易读,从而更易于编辑。
JavaScript 美化器示例
最小化的 Javascript:
var a=document.createElement('a');mimeType=mimeType||'application/octet-stream';if(navigator.msSaveBlob){navigator.msSaveBlob(new Blob([content],{type:mimeType}),fileName);}else if(URL&&'download'in a){a.href=URL.createObjectURL(new Blob([content],{type:mimeType}));a.setAttribute('download',fileName);document.body.appendChild(a);a.click();document.body.removeChild(a);}else{location.href='data:application/octet-stream,'+encodeURIComponent(content);}
变得如此美丽:
var a = document.createElement('a');
mimeType = mimeType || 'application/octet-stream';
if(navigator.msSaveBlob) {
navigator.msSaveBlob(new Blob([content], {
type: mimeType
}), fileName);
} else if(URL && 'download' in a) {
a.href = URL.createObjectURL(new Blob([content], {
type: mimeType
}));
a.setAttribute('download', fileName);
document.body.appendChild(a);
a.click();
document.body.removeChild(a);
} else {
location.href = 'data:application/octet-stream,' + encodeURIComponent(content);
}