Hatena::Let self fork
-
/*
* @title Hatena::Let self fork
* @description append self-fork icon on Hatena::Let
* @include http://let.hatelabo.jp/*
* @contributor taizooo http://let.hatelabo.jp/taizooo/let/gYC-ydPttrvedg (Fork of)
* @author noromanba http://let.hatelabo.jp/noromanba/let/gYC-x6_02LnWEg
* @license MIT License https://opensource.org/licenses/MIT
*/
// UserScript
// https://gist.github.com/noromanba/f5bc6779c3c3005d6d106da5aa624990
(() => {
'use strict';
const edit = document.body.querySelector('a.edit-link[href*="/let.edit"]');
if (!edit) return;
// fork URL syntax
// http://let.hatelabo.jp/<USER_ID>/let.fork?code_id=<LET_ID>
// http://let.hatelabo.jp/<USER_ID>/let/<LET_ID>
// http://let.hatelabo.jp/<USER_ID>/let.fork?rev_id=<REV_ID>
// http://let.hatelabo.jp/<USER_ID>/let/<LET_ID>/rev/<REV_ID>
const fork = edit.cloneNode();
fork.pathname = edit.pathname.replace(/\.edit$/, '.fork');
fork.textContent = 'Fork';
// TBD change image
edit.parentNode.appendChild(fork);
})();
/* for mobile
javascript:(function(){var a=document.body.querySelector('a.edit-link[href*="/let.edit"]');if(a){var b=a.cloneNode();b.pathname=a.pathname.replace(/\.edit$/,'.fork'),b.textContent='Fork',a.parentNode.appendChild(b)}})();
*/
// minified and transpiled w/ Babili
// https://babeljs.io/repl/
-
- Permalink
- このページへの個別リンクです。
- RAW
- 書かれたコードへの直接のリンクです。
- Packed
- 文字列が圧縮された書かれたコードへのリンクです。
- Userscript
- Greasemonkey 等で利用する場合の .user.js へのリンクです。
- Loader
- @require やソースコードが長い場合に多段ロードする Loader コミのコードへのリンクです。
- Metadata
- コード中にコメントで @xxx と書かれたメタデータの JSON です。