「JavaScript を実行」の版間の差分

提供: MeryWiki
ナビゲーションに移動 検索に移動
編集の要約なし
編集の要約なし
1行目: 1行目:
選択範囲をevalして結果をその場に出します。電卓代わりにどうぞ。
選択範囲をevalして結果をその場に出します。電卓代わりにどうぞ。


== 置き換え版 ==
<source lang="javascript">
// JavaScriptを実行 (置き換え版).js
if (!document.selection.Text) {
  document.selection.EndOfLine(false);
  document.selection.StartOfLine(true);
}


挿入版
if (document.selection.Text) {
  document.selection.Text = eval(document.selection.Text)
}
</source>
 
== 挿入版 ==
<source lang="javascript">
<source lang="javascript">
// JavaScriptを実行.js
// JavaScriptを実行.js (挿入版)
 
if (!document.selection.Text) {
  document.selection.EndOfLine(false);
  document.selection.StartOfLine(true);
}


if (document.selection.Text) {
if (document.selection.Text) {
11行目: 29行目:
</source>
</source>


置き換え版
== アウトプットバー版 ==
<source lang="javascript">
<source lang="javascript">
// JavaScriptを実行.js
// JavaScriptを実行 (アウトプットバー版).js
 
if (!document.selection.Text) {
  document.selection.EndOfLine(false);
  document.selection.StartOfLine(true);
}


if (document.selection.Text) {
if (document.selection.Text) {
   document.selection.Text = eval(document.selection.Text)
   outputbar.visible = true;
  // outputbar.Writeln(">> " + document.selection.Text)
  outputbar.Writeln("=> " + eval(document.selection.Text).toString())
}
}
</source>
</source>

2013年12月8日 (日) 00:18時点における版

選択範囲をevalして結果をその場に出します。電卓代わりにどうぞ。

置き換え版

// JavaScriptを実行 (置き換え版).js

if (!document.selection.Text) {
  document.selection.EndOfLine(false);
  document.selection.StartOfLine(true);
}

if (document.selection.Text) {
  document.selection.Text = eval(document.selection.Text)
}

挿入版

// JavaScriptを実行.js (挿入版)

if (!document.selection.Text) {
  document.selection.EndOfLine(false);
  document.selection.StartOfLine(true);
}

if (document.selection.Text) {
  document.selection.Text = document.selection.Text + ' => ' + eval(document.selection.Text)
}

アウトプットバー版

// JavaScriptを実行 (アウトプットバー版).js

if (!document.selection.Text) {
  document.selection.EndOfLine(false);
  document.selection.StartOfLine(true);
}

if (document.selection.Text) {
  outputbar.visible = true;
  // outputbar.Writeln(">> " + document.selection.Text)
  outputbar.Writeln("=> " + eval(document.selection.Text).toString())
}
スポンサーリンク