「JavaScript を実行」の版間の差分
ナビゲーションに移動
検索に移動
文の末尾にセミコロンを追加 |
SyntaxHighlightにcopyの追加 |
||
| 2行目: | 2行目: | ||
== 置き換え版 == | == 置き換え版 == | ||
<syntaxhighlight lang="javascript"> | <syntaxhighlight lang="javascript" copy> | ||
// JavaScriptを実行 (置き換え版).js | // JavaScriptを実行 (置き換え版).js | ||
| 15行目: | 15行目: | ||
== 挿入版 == | == 挿入版 == | ||
<syntaxhighlight lang="javascript"> | <syntaxhighlight lang="javascript" copy> | ||
// JavaScriptを実行.js (挿入版) | // JavaScriptを実行.js (挿入版) | ||
| 29行目: | 29行目: | ||
== アウトプットバー版 == | == アウトプットバー版 == | ||
<syntaxhighlight lang="javascript"> | <syntaxhighlight lang="javascript" copy> | ||
// JavaScriptを実行 (アウトプットバー版).js | // JavaScriptを実行 (アウトプットバー版).js | ||
2025年6月30日 (月) 00:42時点における版
選択範囲をevalして結果をその場に出します。電卓代わりにどうぞ。
置き換え版
// JavaScriptを実行 (置き換え版).js
if (document.selection.IsEmpty) {
document.selection.EndOfLine(false, mePosLogical);
document.selection.StartOfLine(true, mePosLogical);
}
if (document.selection.Text) {
document.selection.Text = eval(document.selection.Text);
}
挿入版
// JavaScriptを実行.js (挿入版)
if (document.selection.IsEmpty) {
document.selection.EndOfLine(false, mePosLogical);
document.selection.StartOfLine(true, mePosLogical);
}
if (document.selection.Text) {
document.selection.Text = document.selection.Text + ' => ' + eval(document.selection.Text);
}
アウトプットバー版
// JavaScriptを実行 (アウトプットバー版).js
if (document.selection.IsEmpty) {
document.selection.EndOfLine(false, mePosLogical);
document.selection.StartOfLine(true, mePosLogical);
}
if (document.selection.Text) {
outputbar.visible = true;
// outputbar.Writeln(">> " + document.selection.Text);
outputbar.Writeln("=> " + eval(document.selection.Text).toString());
}
スポンサーリンク