Twitter id

    @@ -1,14 +1,22 @@ /* - * @title TwitterのユーザーIDを取得するブックマークレット - * @description kwsk → http://hentai-kun.hatenablog.jp/entry/2015/05/02/230000 + * @title Twitter id + * @description show Twitter userid * @include https://twitter.com/* + * @contributor hentai-kun http://let.hatelabo.jp/hentai-kun/let/hLHXpJbulNp6 (Fork of) * @license New BSD License - * @require + * @javascript_url */ -(function() { - var p = document.getElementsByClassName('ProfileNav'); - if (p.length) { - var id = p[0].getAttribute('data-user-id'); - window.prompt('User ID', id); + +// original +// http://hentai-kun.hatenablog.jp/entry/2015/05/02/230000 + +// @javascript_url; for over the mixed-content blocker c.f. +// http://let.hatelabo.jp/help#at-javascript_url +// https://support.google.com/chrome/answer/1342714?hl=en + +Array.prototype.some.call(document.querySelectorAll('[data-user-id]'), function (node) { + if (node.dataset.userId) { + window.prompt('userid', node.dataset.userId); + return true; } -})() +});
  • /*
     * @title Twitter id
     * @description show Twitter userid
     * @include https://twitter.com/*
     * @contributor hentai-kun  http://let.hatelabo.jp/hentai-kun/let/hLHXpJbulNp6 (Fork of)
     * @license New BSD License
     * @javascript_url
     */
    
    // original
    // http://hentai-kun.hatenablog.jp/entry/2015/05/02/230000
    
    // @javascript_url; for over the mixed-content blocker c.f.
    // http://let.hatelabo.jp/help#at-javascript_url
    // https://support.google.com/chrome/answer/1342714?hl=en
    
    Array.prototype.some.call(document.querySelectorAll('[data-user-id]'), function (node) {
      if (node.dataset.userId) {
        window.prompt('userid', node.dataset.userId);
        return true;
      }
    });
    
  • Permalink
    このページへの個別リンクです。
    RAW
    書かれたコードへの直接のリンクです。
    Packed
    文字列が圧縮された書かれたコードへのリンクです。
    Userscript
    Greasemonkey 等で利用する場合の .user.js へのリンクです。
    Loader
    @require やソースコードが長い場合に多段ロードする Loader コミのコードへのリンクです。
    Metadata
    コード中にコメントで @xxx と書かれたメタデータの JSON です。

History

  1. 2015/05/06 11:26:44 - 2015-05-06
  2. 2015/05/06 11:26:40 - 2015-05-06