マストドン横断検索 (自分用)
by
pacochi
2017-05-07 [2017/05/07 23:24:16]
自分用です。
@@ -1,24 +1,25 @@
/*
- * @title マストドン横断検索 (グローバル汚染回避版)
+ * @title マストドン横断検索 (自分用)
* @description 自分用です。
* @include *
- * @license MIT License
+ * @license CC0-1.0
* @javascript_url
*/
/*
-元のスクリプト (PublicDomain https://mstdn.jp/users/mastodonsearch/updates/951700) :
+元のスクリプト (ライセンスは PublicDomain https://mstdn.jp/users/mastodonsearch/updates/951700) :
var txt=window.getSelection().toString();var key=window.prompt("横断検索したい言葉を入力",txt);if(key!=null){window.open("http://mastodonsearch.jp/cross/?q="+encodeURIComponent(key)+"&distinct=1")};
+上記はここに書いた当時の内容、現在はグローバル汚染なし
元のスクリプトが書かれてあるサイト :
http://mastodonsearch.jp/
縮めたもの :
-(k=>{k&&open('http://mastodonsearch.jp/cross/?distinct=1&q='+encodeURIComponent(k))})((''+getSelection())||prompt('検索ワード',''));
+(k=>{k&&open('http://mastodonsearch.jp/cross/?distinct=1&q='+encodeURIComponent(k))})((''+getSelection()).trim().replace(/\s+/g,' ')||prompt('検索ワード',''));
*/
(k => {
k && open('http://mastodonsearch.jp/cross/?distinct=1&q=' + encodeURIComponent(k))
})(
- ('' + getSelection()) || prompt('検索ワード', '')
+ ('' + getSelection()).trim().replace(/\s+/g, ' ') || prompt('検索ワード', '')
);
/*
* @title マストドン横断検索 (自分用)
* @description 自分用です。
* @include *
* @license CC0-1.0
* @javascript_url
*/
/*
元のスクリプト (ライセンスは PublicDomain https://mstdn.jp/users/mastodonsearch/updates/951700) :
var txt=window.getSelection().toString();var key=window.prompt("横断検索したい言葉を入力",txt);if(key!=null){window.open("http://mastodonsearch.jp/cross/?q="+encodeURIComponent(key)+"&distinct=1")};
上記はここに書いた当時の内容、現在はグローバル汚染なし
元のスクリプトが書かれてあるサイト :
http://mastodonsearch.jp/
縮めたもの :
(k=>{k&&open('http://mastodonsearch.jp/cross/?distinct=1&q='+encodeURIComponent(k))})((''+getSelection()).trim().replace(/\s+/g,' ')||prompt('検索ワード',''));
*/
(k => {
k && open('http://mastodonsearch.jp/cross/?distinct=1&q=' + encodeURIComponent(k))
})(
('' + getSelection()).trim().replace(/\s+/g, ' ') || prompt('検索ワード', '')
);
- Permalink
- このページへの個別リンクです。
- RAW
- 書かれたコードへの直接のリンクです。
- Packed
- 文字列が圧縮された書かれたコードへのリンクです。
- Userscript
- Greasemonkey 等で利用する場合の .user.js へのリンクです。
- Loader
- @require やソースコードが長い場合に多段ロードする Loader コミのコードへのリンクです。
- Metadata
- コード中にコメントで @xxx と書かれたメタデータの JSON です。