[hatena]この人のプロフィール

    @@ -1,103 +1,113 @@ /* - * @title この人のはてなプロフィール + * @title [hatena]この人のプロフィール * @description profile.hatena.ne.jp に飛びます。 * @include * * @license MIT License * @javascript_url */ - /* - 人間性センターに行ってみたかったので自分用のやつをひとまず投稿 (作成ページ行く前に人間性問われた) - 確実にプロフある状況でしか使ってないからあんまちゃんとしてない - */ -(function() { - -var i, a; -var u = location.href.match(/^https?:\/\/.*?([^\.]*)\.?(hatena\.ne\.jp|hatelabo\.jp|hatena\.com)\/([^\/]+)(.*)$/); -var $ = q => document.querySelector(q); -var d = (c, q) => { i = (c && (a = $(q))) ? a.getAttribute('href').replace(/^(\/users?\/|\/)([^\/]+)\/?.*$/g, '$2') : (/^users?$/.test(u[3]) ? u[4].replace(/^\/([^\/]+)\/?.*$/, '$1') : u[3]) }; - -// ざっくりとしたはてなブログ扱い -if (!u) { - - // はてなブログ Media (http://business.hatenastaff.com/entry/ownedmedia_case) 系はライターじゃなく企業の id が出てくるけど気にしない - if (a = $('html[data-author]')) i = a.getAttribute('data-author'); - -} else { - - switch (u[1]) { - - case 'daishonin': - - d(false, ''); - break; - - case 'daichkr': - - d((u[3] == 'antenna'), 'div.created a'); - break; - - case 'quyo': - - d((u[3] == 'items'), 'div.author a'); - break; - - case 'copie': - - d((u[3] == 'cp'), 'div[class="banner"] a'); - break; - - case 'counting': - - d((u[3] == 'count'), 'a.username'); - break; - - case 'serif': - - // 画像ページもセリフページも同じセレクタで取れた - // ./list の時は誰のことか特定できないからほっとく - d((u[3].length == 40), 'a.userlink'); - break; - - case 'q': - - if (a = location.hash.match(/(a\d+)/)) { - - // 怒涛の parentNode に困惑してぺけぱす書いたらもっと長くなったからそのまま - //a = document.evaluate(`//div[h3/span/a[@name="${a[1]}"]]/div[@class="f-left"]/a`, document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue; - a = $(`a[name="${a[1]}"]`).parentNode.parentNode.parentNode.querySelector('div.f-left a'); - if (a) i = a.getAttribute('href').replace(/\//g, ''); - - } else d(/^\d+$/.test(u[3]), 'div.questioner-title a'); - - break; - - - case 'a': - - i = (a = location.search.match(/uid=([^&]+)/)) ? a[1] : u[3]; - break; - - case 'd': - - i = u[3].replace(/\+.+$/, ''); - break; - - case 'b': - - i = (a = u[4].match(/\/comment\/(.+)/)) ? a[1] : u[3]; - break; - - default: - - i = u[3]; +/* +// ノード見る方 +[ +'https://daichkr.hatelabo.jp/antenna/960669575395951115', +'http://quyo.hatelabo.jp/items/5476c75138633800021d0000', +'http://copie.hatelabo.jp/cp/gYC-xLrOpsWNbA', +'http://counting.hatelabo.jp/count/118791', +'http://serif.hatelabo.jp/a2504c7ccb748c24565b1feb73f6bf2192e81383/', +'http://serif.hatelabo.jp/a2504c7ccb748c24565b1feb73f6bf2192e81383/6bfba5ff61d5d7699d620e9f72ffae17efabc2b5', +'http://d.hatena.ne.jp/sample/20071112#c1194857635', +'http://d.hatena.ne.jp/hatenadiary/20030314#c1047642967', +'http://d.hatena.ne.jp/keywordlog?klid=1005025', +'http://sample.g.hatena.ne.jp/sample/20040418#c1167971092', +'http://sample.g.hatena.ne.jp/sample/20040418#c1297938357', +'http://sample.hatenastaff.com/', +'http://i.hatena.ne.jp/idea/162', +'http://q.hatena.ne.jp/1189538758', +'http://q.hatena.ne.jp/1189538758/115450/#i115450', +'http://q.hatena.ne.jp/1345623024#a1163768', +'http://q.hatena.ne.jp/1284525413#c213292', +]; +*/ +/* +// URL だけ見る方 +[ +'https://daichkr.hatelabo.jp/hatelabo/', +'http://quyo.hatelabo.jp/users/hakobe932', +'http://daishonin.hatelabo.jp/user/hatelabo', +'http://daishonin.hatelabo.jp/user/hatelabo/52fc4783021d8693c0000006', +'http://let.hatelabo.jp/secondlife/', +'http://let.hatelabo.jp/secondlife/let/gYC-xpO2uIvsEQ', +'http://let.st-hatelabo.com/secondlife/let/gYC-xpO2uIvsEQ.bookmarklet.js', +'http://copie.hatelabo.jp/cho45/', +'http://counting.hatelabo.jp/user/chris4403', +'http://serif.hatelabo.jp/secondlife/', +'http://cdn1.www.st-hatena.com/users/sa/sample/profile.gif', +'http://a.hatena.ne.jp/sample/', +'http://a.hatena.ne.jp/include?uid=sample', +'http://b.hatena.ne.jp/sample/', +'http://b.hatena.ne.jp/entry/574190/comment/sample', +'http://d.hatena.ne.jp/sample/', +'http://d.hatena.ne.jp/hatenadiary+cooking/', +'http://f.hatena.ne.jp/sample/', +'http://cdn-ak.f.st-hatena.com/images/fotolife/s/sample/20050728/20050728171129.jpg', +'http://sample.g.hatena.ne.jp/sample/', +'http://h.hatena.ne.jp/hatenahaiku/', +'http://h.hatena.ne.jp/id/hatenahaiku/', +'http://i.hatena.ne.jp/hatenaidea/', +'http://q.hatena.ne.jp/hatenaquestion/', +'http://s.hatena.ne.jp/sample/' // その他のサービス代表 +].forEach( +*/ +((a, i, p = 'parentNode', q = 'querySelector', m = 'match', h = 'pathname', l = location, + u = (a || l.href)[m](/(\w+)\.(st-)?(hate(labo|na)\.(ne\.jp|jp|com))(\/touch|\/mobile)?\/([^\/]+)(.*)/), + f = u[7], s = u[8], + b = '', e = [b, f], + $ = _ => document[q](_), + r = _ => ((_ = l.hash[m](_)) ? $(`a[name="${_[1]}"]`) : 0), + t = _ => (_[h] ? _[h].slice(1, -1) : f), + d = (_ = 0, z = b) => (_ && (_ = $(z)) + ? _[h][m](/^(\/users?\/|\/)([^\/]+)/)[2] + : (/^(users?|id)$/.test(f) ? s[m](/[^\/]{3,}/)[0] : f) + ), + g = f => ((a = r(/(c\d+)/)) ? t(a[p][p][q]('.hatena-id-icon')) : f)[m](/[^+]+/)[0] +) => ((i = u ? + ({ + /*'daishonin': f => d(),*/ + 'daichkr': f => d(f == 'antenna', '.created a'), + 'quyo': f => d(f == 'items', '.author a'), + 'copie': f => d(f == 'cp', 'div[class="banner"] a'), + /* div.username が存在する */ + 'counting': f => d(f == 'count', 'a.username'), + 'serif': f => d(f.length == 40, '.userlink'), + /*'www': f => d(),*/ + 'a': f => (l.search[m](/uid=([^&]+)/) || e)[1], + 'b': f => (s[m](/\/comment\/(.+)/) || e)[1], + 'd': f => (f[m](/^keywordlog\?/) ? d(1, '.username') : g(f)), + 'f': f => (s[m](/([^\/]+)\/\d{8}\//) || e)[1], + 'g': g, + /*'h': f => d(),*/ + 'i': f => d(f == 'idea', 'td a'), + 'k': f => d(f == 'idea', 'td a'), + /* 退会者の処理はしょった */ + 'q': f => ((a = r(/([aci]\d+)/)) && (a = t({ + a: a[p][p][p][q]('.f-left a'), + c: a[p][p][q]('a'), + i: a[p][q]('a[href$="/"]:not([class])') + }[l.hash.charAt(1)])) ? a : d(/^\d+$/.test(f), '.questioner-title a')) + }[u[1]] || (f => d()))(f) + /* コメントのパーマリンクもあるけど隠されてるのでスルー */ + : $('html').dataset.author + ) + && /^[A-Za-z][\-\w]{1,30}[\dA-Za-z]$/.test(i) +/* && console.log(i, u[0])*/ + && window.open(`http:\u002F\u002Fprofile.hatena.ne.jp/${i}/`) +) - } -} +)() -// はてな id 取れてなかったら潔く諦める -// recent とか help とか search とか list とかでも id 扱いして飛んじゃうけど気にしない -// `http://profile.hatena.ne.jp/${i}/` にしたら let が切れた -if (i && /^[a-zA-Z][\w\-]{1,30}[a-zA-Z\d]$/.test(i)) window.open('http://profile.hatena.ne.jp/' + i + '/'); +/*));*/ -})(); +/* +人間性センターに行ってみたかったので自分用のやつをひとまず投稿 (作成ページ行く前に人間性問われた) +確実にプロフある状況でしか使ってないからあんまちゃんとしてない +*/
  • /*
     * @title [hatena]この人のプロフィール
     * @description profile.hatena.ne.jp に飛びます。
     * @include *
     * @license MIT License
     * @javascript_url
     */
    
    /*
    // ノード見る方
    [
    'https://daichkr.hatelabo.jp/antenna/960669575395951115',
    'http://quyo.hatelabo.jp/items/5476c75138633800021d0000',
    'http://copie.hatelabo.jp/cp/gYC-xLrOpsWNbA',
    'http://counting.hatelabo.jp/count/118791',
    'http://serif.hatelabo.jp/a2504c7ccb748c24565b1feb73f6bf2192e81383/',
    'http://serif.hatelabo.jp/a2504c7ccb748c24565b1feb73f6bf2192e81383/6bfba5ff61d5d7699d620e9f72ffae17efabc2b5',
    'http://d.hatena.ne.jp/sample/20071112#c1194857635',
    'http://d.hatena.ne.jp/hatenadiary/20030314#c1047642967',
    'http://d.hatena.ne.jp/keywordlog?klid=1005025',
    'http://sample.g.hatena.ne.jp/sample/20040418#c1167971092',
    'http://sample.g.hatena.ne.jp/sample/20040418#c1297938357',
    'http://sample.hatenastaff.com/',
    'http://i.hatena.ne.jp/idea/162',
    'http://q.hatena.ne.jp/1189538758',
    'http://q.hatena.ne.jp/1189538758/115450/#i115450',
    'http://q.hatena.ne.jp/1345623024#a1163768',
    'http://q.hatena.ne.jp/1284525413#c213292',
    ];
    */
    /*
    // URL だけ見る方
    [
    'https://daichkr.hatelabo.jp/hatelabo/',
    'http://quyo.hatelabo.jp/users/hakobe932',
    'http://daishonin.hatelabo.jp/user/hatelabo',
    'http://daishonin.hatelabo.jp/user/hatelabo/52fc4783021d8693c0000006',
    'http://let.hatelabo.jp/secondlife/',
    'http://let.hatelabo.jp/secondlife/let/gYC-xpO2uIvsEQ',
    'http://let.st-hatelabo.com/secondlife/let/gYC-xpO2uIvsEQ.bookmarklet.js',
    'http://copie.hatelabo.jp/cho45/',
    'http://counting.hatelabo.jp/user/chris4403',
    'http://serif.hatelabo.jp/secondlife/',
    'http://cdn1.www.st-hatena.com/users/sa/sample/profile.gif',
    'http://a.hatena.ne.jp/sample/',
    'http://a.hatena.ne.jp/include?uid=sample',
    'http://b.hatena.ne.jp/sample/',
    'http://b.hatena.ne.jp/entry/574190/comment/sample',
    'http://d.hatena.ne.jp/sample/',
    'http://d.hatena.ne.jp/hatenadiary+cooking/',
    'http://f.hatena.ne.jp/sample/',
    'http://cdn-ak.f.st-hatena.com/images/fotolife/s/sample/20050728/20050728171129.jpg',
    'http://sample.g.hatena.ne.jp/sample/',
    'http://h.hatena.ne.jp/hatenahaiku/',
    'http://h.hatena.ne.jp/id/hatenahaiku/',
    'http://i.hatena.ne.jp/hatenaidea/',
    'http://q.hatena.ne.jp/hatenaquestion/',
    'http://s.hatena.ne.jp/sample/' // その他のサービス代表
    ].forEach(
    */
    ((a, i, p = 'parentNode', q = 'querySelector', m = 'match', h = 'pathname', l = location,
     u = (a || l.href)[m](/(\w+)\.(st-)?(hate(labo|na)\.(ne\.jp|jp|com))(\/touch|\/mobile)?\/([^\/]+)(.*)/),
     f = u[7], s = u[8],
     b = '', e = [b, f],
     $ = _ => document[q](_),
     r = _ => ((_ = l.hash[m](_)) ? $(`a[name="${_[1]}"]`) : 0),
     t = _ => (_[h] ? _[h].slice(1, -1) : f),
     d = (_ = 0, z = b) => (_ && (_ = $(z))
      ? _[h][m](/^(\/users?\/|\/)([^\/]+)/)[2]
      : (/^(users?|id)$/.test(f) ? s[m](/[^\/]{3,}/)[0] : f)
     ),
     g = f => ((a = r(/(c\d+)/)) ? t(a[p][p][q]('.hatena-id-icon')) : f)[m](/[^+]+/)[0]
    ) => ((i = u ?
    	({
    		/*'daishonin': f => d(),*/
    		'daichkr': f => d(f == 'antenna', '.created a'),
    		'quyo': f => d(f == 'items', '.author a'),
    		'copie': f => d(f == 'cp', 'div[class="banner"] a'),
    		/* div.username が存在する */
    		'counting': f => d(f == 'count', 'a.username'),
    		'serif': f => d(f.length == 40, '.userlink'),
    		/*'www': f => d(),*/
    		'a': f => (l.search[m](/uid=([^&]+)/) || e)[1],
    		'b': f => (s[m](/\/comment\/(.+)/) || e)[1],
    		'd': f => (f[m](/^keywordlog\?/) ? d(1, '.username') : g(f)),
    		'f': f => (s[m](/([^\/]+)\/\d{8}\//) || e)[1],
    		'g': g,
    		/*'h': f => d(),*/
    		'i': f => d(f == 'idea', 'td a'),
    		'k': f => d(f == 'idea', 'td a'),
    		/* 退会者の処理はしょった */
    		'q': f => ((a = r(/([aci]\d+)/)) && (a = t({
    			a: a[p][p][p][q]('.f-left a'),
    			c: a[p][p][q]('a'),
    			i: a[p][q]('a[href$="/"]:not([class])')
    		 }[l.hash.charAt(1)])) ? a : d(/^\d+$/.test(f), '.questioner-title a'))
    	}[u[1]] || (f => d()))(f)
    	/* コメントのパーマリンクもあるけど隠されてるのでスルー */
    	 : $('html').dataset.author
     )
     && /^[A-Za-z][\-\w]{1,30}[\dA-Za-z]$/.test(i) 
    /* && console.log(i, u[0])*/
     && window.open(`http:\u002F\u002Fprofile.hatena.ne.jp/${i}/`)
    )
    
    )()
    
    /*));*/
    
    /*
    人間性センターに行ってみたかったので自分用のやつをひとまず投稿 (作成ページ行く前に人間性問われた)
    確実にプロフある状況でしか使ってないからあんまちゃんとしてない
    */
  • Permalink
    このページへの個別リンクです。
    RAW
    書かれたコードへの直接のリンクです。
    Packed
    文字列が圧縮された書かれたコードへのリンクです。
    Userscript
    Greasemonkey 等で利用する場合の .user.js へのリンクです。
    Loader
    @require やソースコードが長い場合に多段ロードする Loader コミのコードへのリンクです。
    Metadata
    コード中にコメントで @xxx と書かれたメタデータの JSON です。

History

  1. 2017/03/01 00:25:33 - 2017-03-01
  2. 2017/02/27 00:19:50 - 2017-02-27
  3. 2017/02/27 00:17:04 - 2017-02-27
  4. 2017/02/27 00:15:03 - 2017-02-27
  5. 2017/02/27 00:11:15 - 2017-02-27
  6. 2017/02/27 00:00:48 - 2017-02-27
  7. 2017/02/26 23:55:47 - 2017-02-26
  8. 2017/02/26 23:49:53 - 2017-02-26
  9. 2016/12/07 13:37:35 - 2016-12-07
  10. 2016/12/07 13:18:40 - 2016-12-07
  11. 2016/12/07 12:52:01 - 2016-12-07
  12. 2016/12/07 12:47:52 - 2016-12-07