restore my rights

    @@ -31,7 +31,7 @@ '-khtml-', '-ms-', '-o-' - ].forEach((prefix) => { + ].forEach(prefix => { node.style[prefix + 'user-select'] = 'initial'; }); // *1: Fx can not access by bracket-notation; node.style['-moz-user-select'] @@ -43,7 +43,7 @@ clearEvents(document); const clearEventsAll = (ctx) => { - Array.from(ctx.querySelectorAll('*')).forEach((node) => { + Array.from(ctx.querySelectorAll('*')).forEach(node => { clearEvents(node); }); };
  • /*
     * @title restore my rights
     * @description (x_x)
     * @include http://example.com/DIY/*
     * @contributor yuta25  http://let.hatelabo.jp/yuta25/let/hLHWnL_HmJof (Fork of)
     * @license MIT License
     * @javascript_url
     */
    
    // UserScript
    // https://gist.github.com/noromanba/a350b4060098c8ddcc91
    
    (() => {
      const clearEvents = (node) => {
        node.getAttribute && node.getAttribute('unselectable') && node.setAttribute('unselectable', 'off');
        node.onkeydown = null;
        node.onkeypress = null;
        node.onkeyup = null;
        node.onmousedown = null;
        node.oncontextmenu = null;
        node.onselectstart = null;
        node.onselect = null;
        node.oncopy = null;
        node.oncut = null;
    
        if (!node.style) return;
        [
          '',
          //'-moz-', // *1
          '-webkit-',
          '-khtml-',
          '-ms-',
          '-o-'
        ].forEach(prefix => {
          node.style[prefix + 'user-select'] = 'initial';
        });
        // *1: Fx can not access by bracket-notation; node.style['-moz-user-select']
        //       e.g. http://www.softel.co.jp/blogs/tech/archives/2909
        //       alt; node.style.getPropertyValue('-moz-user-select')
        //     property works well
        node.style.MozUserSelect && (node.style.MozUserSelect = 'initial');
      };
      clearEvents(document);
    
      const clearEventsAll = (ctx) => {
        Array.from(ctx.querySelectorAll('*')).forEach(node => {
          clearEvents(node);
        });
      };
      clearEventsAll(document);
    
      new MutationObserver(records => {
        records.forEach(record => {
          const ctx = record.target;
          if (!ctx.tagName || !ctx.querySelectorAll) return;
    
          clearEventsAll(ctx);
        });
      }).observe(document.body, { childList: true, subtree: true });
    })();
    
    
  • Permalink
    このページへの個別リンクです。
    RAW
    書かれたコードへの直接のリンクです。
    Packed
    文字列が圧縮された書かれたコードへのリンクです。
    Userscript
    Greasemonkey 等で利用する場合の .user.js へのリンクです。
    Loader
    @require やソースコードが長い場合に多段ロードする Loader コミのコードへのリンクです。
    Metadata
    コード中にコメントで @xxx と書かれたメタデータの JSON です。

History

  1. 2016/01/15 09:05:08 - 2016-01-15
  2. 2016/01/15 07:48:23 - 2016-01-15
  3. 2015/12/10 05:01:58 - 2015-12-10
  4. 2015/07/07 04:57:48 - 2015-07-07
  5. 2014/12/01 05:40:15 - 2014-12-01
  6. 2014/11/30 15:37:14 - 2014-11-30
  7. 2014/11/30 15:37:02 - 2014-11-30