選択範囲をGistに保存するBookmarklet
by
Kanasansoft
2010-05-27 [2010/05/27 18:32:47]
選択範囲の文字列(utf-8のみ)をGistに保存します。詳細はこちら。 => http://www.kanasansoft.com/weblab/2010/01/post_selection_text_to_gist.html
-
/*
* @title 選択範囲をGistに保存するBookmarklet
* @description 選択範囲の文字列(utf-8のみ)をGistに保存します。詳細はこちら。 => http://www.kanasansoft.com/weblab/2010/01/post_selection_text_to_gist.html
* @include http://*
* @license MIT License
* @require
*/
/*
================================================================================
Name : 選択範囲をGistに保存するBookmarklet Ver1.0.0
In : [none]
Out : [none]
Note : 選択範囲の文字列(utf-8のみ)をGistに保存します。
--------------------------------------------------------------------------------
Version : Ver1.0.0 | 2010/01/28 | 新規作成
--------------------------------------------------------------------------------
License : MIT license
URL : www.kanasansoft.com
================================================================================
*/
(
function(w,d,s,c,a,g,p,n){
var
t=d[c]("textarea")
,f=d[c]("form")
,i=d[c]("iframe")
;
if(d[p]){
s=d[p].createRange().text
}else if(d[g]){
s=d[g]()
}else if(w[g]){
s=w[g]()
}
i.name=n;
t.value=s;
t.name="files["+n+".txt]";
f.method="post";
f.action="http://gist.github.com/api/v1/plaintext/new";
f.target=n;
f.style.displey="none";
f[a](i);
f[a](t);
d.body[a](f);
f.submit();
}
)
(window,document,"","createElement","appendChild","getSelection","selection",(location+"_gist_"+Math.random()).replace(/[^\d\w]+/g,"_"))
-
- Permalink
- このページへの個別リンクです。
- RAW
- 書かれたコードへの直接のリンクです。
- Packed
- 文字列が圧縮された書かれたコードへのリンクです。
- Userscript
- Greasemonkey 等で利用する場合の .user.js へのリンクです。
- Loader
- @require やソースコードが長い場合に多段ロードする Loader コミのコードへのリンクです。
- Metadata
- コード中にコメントで @xxx と書かれたメタデータの JSON です。