Skip to content

Instantly share code, notes, and snippets.

@bigfang
Last active April 13, 2020 14:43
Show Gist options
  • Save bigfang/d49d1e71008f7dfd51a50be0b8b8bcf0 to your computer and use it in GitHub Desktop.
Save bigfang/d49d1e71008f7dfd51a50be0b8b8bcf0 to your computer and use it in GitHub Desktop.

Revisions

  1. bigfang renamed this gist Apr 13, 2020. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  2. bigfang revised this gist Jul 27, 2019. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions autocopy.js
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,6 @@
    // ==UserScript==
    // @name autocopy
    // @namespace https://bigfang.net
    // @namespace https://bigfang.github.io
    // @description Auto copy selected text
    // @match *://*/*
    // @run-at document-end
    @@ -11,7 +11,7 @@ if (typeof GM_setClipboard != 'function') alert('Your UserScript client has no G

    document.addEventListener('mouseup',
    (e) => {
    if (e.button != 0 || e.target.tagName === 'INPUT')
    if (e.button != 0 || ['INPUT', 'TEXTAREA'].includes(e.target.tagName))
    return;
    let stext = getSelection().toString();
    if (stext) {
  3. bigfang revised this gist Jul 13, 2019. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion autocopy.js
    Original file line number Diff line number Diff line change
    @@ -11,7 +11,8 @@ if (typeof GM_setClipboard != 'function') alert('Your UserScript client has no G

    document.addEventListener('mouseup',
    (e) => {
    if (e.button != 0) return;
    if (e.button != 0 || e.target.tagName === 'INPUT')
    return;
    let stext = getSelection().toString();
    if (stext) {
    GM_setClipboard(stext)
  4. bigfang created this gist Jul 12, 2019.
    19 changes: 19 additions & 0 deletions autocopy.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,19 @@
    // ==UserScript==
    // @name autocopy
    // @namespace https://bigfang.net
    // @description Auto copy selected text
    // @match *://*/*
    // @run-at document-end
    // @grant GM_setClipboard
    // ==/UserScript==

    if (typeof GM_setClipboard != 'function') alert('Your UserScript client has no GM_setClipboard support');

    document.addEventListener('mouseup',
    (e) => {
    if (e.button != 0) return;
    let stext = getSelection().toString();
    if (stext) {
    GM_setClipboard(stext)
    }
    }, false);