2007年11月23日金曜日

選択した文字列をURLエンコード/デコードするBookmarklet b

コメントをURLエンコードで書いてる人がいたので,簡単に読むためにてきとーに作成


選択文字列をURLエンコードするBookmarklet

javascript:(function(){var d=document,w=window,ds=d.selection,ws=w.selection,wg=w.getSelection;t=((ds?ds.createRange().text:ws?ws.createRange().text:wg?wg():d.getSelection?d.getSelection():'')+'');prompt('encode selected text.', encodeURI(t))})();


選択文字列をURLデコードするBookmarklet
javascript:(function(){var d=document,w=window,ds=d.selection,ws=w.selection,wg=w.getSelection;t=((ds?ds.createRange().text:ws?ws.createRange().text:wg?wg():d.getSelection?d.getSelection():'')+'');prompt('decode selected text.', decodeURI(t))})();


どう作ったらすっきりするかなぁ

0 件のコメント: