joke bookmarklet

    @@ -3,7 +3,6 @@ * @description 選択文字を仕事の流儀ぽく表示(音はでません) * @include http://* * @license MIT License - * @private * @javascript_url */ @@ -18,7 +17,6 @@ box.style.display = 'flex'; box.style.alignItems = 'center'; box.style.justifyContent = 'center'; - box.style.left = 0; box.style.background = '#000'; box.style.color = '#fff'; box.style.zIndex = 2147483647;
  • /*
     * @title joke bookmarklet
     * @description 選択文字を仕事の流儀ぽく表示(音はでません)
     * @include http://*
     * @license MIT License
     * @javascript_url
     */
    
    (function (d, w) {
      const box = d.createElement('div');
      box.id = 'echoText';
      box.style.position = 'absolute';
      box.style.width = '100%';
      box.style.height = '100%';
      box.style.top = 0;
      box.style.left = 0;
      box.style.display = 'flex';
      box.style.alignItems = 'center';
      box.style.justifyContent = 'center';
      box.style.background = '#000';
      box.style.color = '#fff';
      box.style.zIndex = 2147483647;
      if (!d.querySelector('#echoText')) {
        const selText = w.getSelection().toString();
        if (selText) {
          box.innerText = selText;
          d.body.appendChild(box);
          w.scrollTo(0, 0);
        }
      } else {
        const Target = d.getElementById('echoText');
        d.body.removeChild(Target);
        return;
      }
    })(document, window);
  • Permalink
    このページへの個別リンクです。
    RAW
    書かれたコードへの直接のリンクです。
    Packed
    文字列が圧縮された書かれたコードへのリンクです。
    Userscript
    Greasemonkey 等で利用する場合の .user.js へのリンクです。
    Loader
    @require やソースコードが長い場合に多段ロードする Loader コミのコードへのリンクです。
    Metadata
    コード中にコメントで @xxx と書かれたメタデータの JSON です。

History

  1. 2017/01/30 22:09:19 - 2017-01-30
  2. 2017/01/30 22:01:46 - 2017-01-30