* テキストブラウザ化(Html Source View) [#qe075a04]
-ページ: [[Macro/投稿]]
-作者: [[ぷる]]
-カテゴリー: js
-投稿日: 2005-08-26 (金) 21:52:59
** メッセージ [#f794340c]
#code(javascript){{
var selection = Editor.GetSelectedString(0);
if(selection.length == 0)
{
selection = "http://www.yahoo.co.jp/";
}
else
{
if(!selection.match(/:\/\/.*/))
{
Editor.GoFileTop();
Editor.Down();
Editor.GoLineEnd_Sel(0);
selection = selection.replace(/^\//, "");
selection = Editor.GetSelectedString(0) + selection;
}
}
Editor.SelectAll();
Editor.InsText(selection + " を読み込み中...");
Editor.GoFileTop();
Editor.ReDraw();
var http = new ActiveXObject("Microsoft.XMLHTTP");
if(http != null)
{
var uri = selection;
http.open("GET", uri, false);
http.send(null);
var html = http.responseText;
var result = "";
result += "------------------------------------------------------------\r\n";
result += selection + "\r\n";
result += "------------------------------------------------------------\r\n";
result += html;
Editor.SelectAll();
Editor.InsText(result);
Editor.GoFileTop();
Editor.ReDraw();
}
}}
----
#comment