「JavaScript を実行」の版間の差分
<source>タグを<syntaxhighlight>タグに置き換える |
オブジェクト名の修正(マクロリファレンス:3:OutputBar オブジェクトを参照) |
||
| (同じ利用者による、間の2版が非表示) | |||
| 2行目: | 2行目: | ||
== 置き換え版 == | == 置き換え版 == | ||
<syntaxhighlight lang="javascript"> | <syntaxhighlight lang="javascript" copy> | ||
// JavaScriptを実行 (置き換え版).js | // JavaScriptを実行 (置き換え版).js | ||
if (document.selection.IsEmpty) { | if (document.selection.IsEmpty) { | ||
document.selection.EndOfLine(false, mePosLogical) | document.selection.EndOfLine(false, mePosLogical); | ||
document.selection.StartOfLine(true, mePosLogical) | document.selection.StartOfLine(true, mePosLogical); | ||
} | } | ||
if (document.selection.Text) { | if (document.selection.Text) { | ||
document.selection.Text = eval(document.selection.Text) | document.selection.Text = eval(document.selection.Text); | ||
} | } | ||
</syntaxhighlight> | </syntaxhighlight> | ||
== 挿入版 == | == 挿入版 == | ||
<syntaxhighlight lang="javascript"> | <syntaxhighlight lang="javascript" copy> | ||
// JavaScriptを実行.js (挿入版) | // JavaScriptを実行.js (挿入版) | ||
if (document.selection.IsEmpty) { | if (document.selection.IsEmpty) { | ||
document.selection.EndOfLine(false, mePosLogical) | document.selection.EndOfLine(false, mePosLogical); | ||
document.selection.StartOfLine(true, mePosLogical) | document.selection.StartOfLine(true, mePosLogical); | ||
} | } | ||
if (document.selection.Text) { | if (document.selection.Text) { | ||
document.selection.Text = document.selection.Text + ' => ' + eval(document.selection.Text) | document.selection.Text = document.selection.Text + ' => ' + eval(document.selection.Text); | ||
} | } | ||
</syntaxhighlight> | </syntaxhighlight> | ||
== アウトプットバー版 == | == アウトプットバー版 == | ||
<syntaxhighlight lang="javascript"> | <syntaxhighlight lang="javascript" copy> | ||
// JavaScriptを実行 (アウトプットバー版).js | // JavaScriptを実行 (アウトプットバー版).js | ||
if (document.selection.IsEmpty) { | if (document.selection.IsEmpty) { | ||
document.selection.EndOfLine(false, mePosLogical) | document.selection.EndOfLine(false, mePosLogical); | ||
document.selection.StartOfLine(true, mePosLogical) | document.selection.StartOfLine(true, mePosLogical); | ||
} | } | ||
if (document.selection.Text) { | if (document.selection.Text) { | ||
outputBar.visible = true; | |||
// | // outputBar.Writeln(">> " + document.selection.Text); | ||
outputBar.Writeln("=> " + eval(document.selection.Text).toString()); | |||
} | } | ||
</syntaxhighlight> | </syntaxhighlight> | ||
スポンサーリンク