getHTMLsource
by
sin5
2010-06-25 [2010/06/25 22:49:28]
選択した範囲のHTMLのソースを整形して表示してくれるWEBサービスに飛ばします。
@@ -15,7 +15,7 @@
}
var form = document.createElement("form");
-form.action = "http://nagisa:3000/create";
+form.action = "http://nagisa:3000/show";
form.method = "POST";
source_input = document.createElement('input');
/*
* @title getHTMLsource
* @description get selected HTML source
* @license MIT License
* @private
*/
var source = "";
if(window.getSelection){
var con = window.getSelection().getRangeAt(0).cloneContents();
var div = document.createElement('div');
div.appendChild(con);
source = div.innerHTML
} else if(document.selection){
source = document.selection.createRange().htmlText;
}
var form = document.createElement("form");
form.action = "http://nagisa:3000/show";
form.method = "POST";
source_input = document.createElement('input');
source_input.type = 'hidden';
source_input.name = 'source';
source_input.value = source;
title_input = document.createElement('input');
title_input.type = 'hidden';
title_input.name = 'title';
title_input.value = document.title;
url_input = document.createElement('input');
url_input.type = 'hidden';
url_input.name = 'url'
url_input.value = document.location.href;
form.appendChild(source_input);
form.appendChild(title_input);
form.appendChild(url_input);
form.submit();
- Permalink
- このページへの個別リンクです。
- RAW
- 書かれたコードへの直接のリンクです。
- Packed
- 文字列が圧縮された書かれたコードへのリンクです。
- Userscript
- Greasemonkey 等で利用する場合の .user.js へのリンクです。
- Loader
- @require やソースコードが長い場合に多段ロードする Loader コミのコードへのリンクです。
- Metadata
- コード中にコメントで @xxx と書かれたメタデータの JSON です。