copylet

    @@ -14,24 +14,18 @@ // - [ ] @javascript_url-nize both of loader-code // - TODO support @require e.g. // http://let.hatelabo.jp/mattn/let/gYC-ypuU7rrgaQ -// Hatena::Let loader's bug; missing semicolons of loder +// Hatena::Let loader's bug; missing semicolons of loader // - self patching? WTH // completely copy, but needs twice execute ver. // http://let.hatelabo.jp/noromanba/let/hJmczoeEkbdW (() => { - 'use strict'; - if (!/let\.(?:st\-)?hatelabo\.(?:jp|com)$/.test(location.hostname) || location.pathname.split('/').slice(1) < 3) { return; } - //let title = document.body.querySelector('#bookmarklet-title .title'); - //// trim and delete "Fork" - //title = title.firstChild.textContent; - const packed = document.body.querySelector('.information a[href$="packed.js"]'); const xhr = new XMLHttpRequest(); @@ -42,7 +36,7 @@ // TBD readonly textarea const input = document.createElement('input'); - input.style.position = 'fixed'; + input.style.position = 'absolute'; input.style.top = '0'; input.style.left = '0'; input.style.width = '50%'; @@ -51,7 +45,9 @@ input.value = 'javascript:' + xhr.responseText; document.body.appendChild(input); + input.select(); + input.scrollIntoView(); }); xhr.send(); })();
  • /*
     * @title copylet
     * @description show minified code on Hatena::Let; for copy of mobile
     * @include http://let.hatelabo.jp/*
     * @include http://let.st-hatelabo.com/*
     * @contributor mino90  http://let.hatelabo.ne.jp/mino90/let/gYC-xYDKx6O-dA
     * @contributor noromanba http://let.hatelabo.jp/noromanba/let/hLHUzoSn6YtX (Fork of)
     * @license MIT License http://opensource.org/licenses/MIT
     * @javascript_url
     */
    
    // WIP
    // - [x] only once execute
    // - [ ] @javascript_url-nize both of loader-code
    //  - TODO support @require e.g.
    //    http://let.hatelabo.jp/mattn/let/gYC-ypuU7rrgaQ
    //    Hatena::Let loader's bug; missing semicolons of loader
    //    - self patching? WTH
    
    // completely copy, but needs twice execute ver.
    // http://let.hatelabo.jp/noromanba/let/hJmczoeEkbdW
    
    (() => {
        if (!/let\.(?:st\-)?hatelabo\.(?:jp|com)$/.test(location.hostname) ||
            location.pathname.split('/').slice(1) < 3) {
            return;
        }
    
        const packed = document.body.querySelector('.information a[href$="packed.js"]');
    
        const xhr = new XMLHttpRequest();
        xhr.open('GET', packed.href);
        xhr.timeout = 2000;
        xhr.addEventListener('load', () => {
            if (xhr.readyState !== 4 || xhr.status !== 200) return;
    
            // TBD readonly textarea
            const input = document.createElement('input');
            input.style.position = 'absolute';
            input.style.top = '0';
            input.style.left = '0';
            input.style.width = '50%';
    
            input.type = 'text';
            input.value = 'javascript:' + xhr.responseText;
    
            document.body.appendChild(input);
    
            input.select();
            input.scrollIntoView();
        });
        xhr.send();
    })();
    
    
  • Permalink
    このページへの個別リンクです。
    RAW
    書かれたコードへの直接のリンクです。
    Packed
    文字列が圧縮された書かれたコードへのリンクです。
    Userscript
    Greasemonkey 等で利用する場合の .user.js へのリンクです。
    Loader
    @require やソースコードが長い場合に多段ロードする Loader コミのコードへのリンクです。
    Metadata
    コード中にコメントで @xxx と書かれたメタデータの JSON です。

History

  1. 2016/01/24 11:56:31 - 2016-01-24
  2. 2016/01/24 11:40:20 - 2016-01-24
  3. 2016/01/24 11:20:02 - 2016-01-24
  4. 2016/01/24 07:09:58 - 2016-01-24
  5. 2016/01/24 06:57:19 - 2016-01-24
  6. 2016/01/24 06:49:18 - 2016-01-24