EmEditorのマクロでXmlHttpがつかえてどうなんだ?と思って。http:// xxx で色が変わるリンク先のソースを取得するEmEditorのマクロ書いてみた。
「XMLソースファイルを表示できません」とIEに怒られたときに使うと便利かも。
以下ソース
/****
* @name Emeditor マクロ
* @desciption カーソル位置のリンクURLのコンテンツを取得し、新規タブの中に入れる。
* @modified 06/11/10
* @author takuya
* @finename viewSrcInNewTab.jsee
*/
function XmlHttpRequest(){
this.context = null;//static
this.xmlhttp = function(){//static
var obj = new ActiveXObject("Microsoft.XMLHTTP");
return obj;
}
this.request = function(url){
var req = this.xmlhttp();
req.open("GET", url, false );
req.send(null);
this.context = req.responseText;
}
}
document.selection.copyLink();
text = Window.clipboardData.getData("Text");
if(text.indexOf("http://") == 0) {
var client = new XmlHttpRequest();
client.request(text);
var html = client.context;
if(html.length > 0){
editor.newFile();
document.ConfigName = "HTML";
document.write(html);
}
}