Skip to content

Instantly share code, notes, and snippets.

@sergiitk
Created September 26, 2013 15:20
Show Gist options
  • Save sergiitk/6715690 to your computer and use it in GitHub Desktop.
Save sergiitk/6715690 to your computer and use it in GitHub Desktop.
GistBox copy code on double click
// ==UserScript==
// @name GitBox extra features
// @namespace https://www.facebook.com/sergii.tk
// @version 0.1
// @description Copies code blocks to clipboard
// @match https://app.gistboxapp.com/*
// @copyright 2013+, Sergii Tkachenko
// @require https://raw.github.com/rafjaf/ClipCopy-for-TM/master/lib/installGM_setClipboard.js
// ==/UserScript==
// Tested with tampermonkey 3.5.3630.44.
// https://chrome.google.com/webstore/detail/gcalenpjmijncebpfijmoaglllgpjagf
function gitbox_extra_save_to_clipboard(text, text_copied) {
if (text_copied == null) {
text_copied = "Copied!";
}
GM_setClipboard(text);
notyfy({text: text_copied, layout: 'topRight', type: 'Success', timeout: 2000});
}
// Copy code tags with double click.
$(document).on('dblclick', '.gist-file-code code', function() {
gitbox_extra_save_to_clipboard($(this).text());
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment