#target estoolkit#dbg var toolMenu = MenuElement.find ("toolA") || new MenuElement("menu", "ツール", "at the end of menubar", "toolA"); var beautifyCommand = MenuElement.find ("toolA/beautify") || new MenuElement("command", "整形", "at the end of toolA", "toolA/beautify"); var js_beautify = (function () { var exports = {}; #include "C:\\lib\\beautify.js" return exports; })(); beautifyCommand.onSelect = function() { try { var editor = document.editor; var selText=editor.textselection; var code=selText.length>0?selText:editor.text; code = code.replace(/^\s*#(?=(target|targetengine|include|includepath|script|strict))/mg, "//@"); if (code.indexOf("\"\"\"") > -1) { if(!confirm("\"\"\"が含まれているため正常に整形できない可能性があります.\n続行しますか?")) return; } code = js_beautify.js_beautify(code); if (selText.length>0) document.editor.textselection = code; else editor.text = code; } catch (e) { alert(e); } }
プロフィール
最近の記事