Created
September 8, 2022 18:08
-
-
Save depfryer/3c186c2675b2e22dfbab73d4c821a8ae to your computer and use it in GitHub Desktop.
flem.js pour violentmonkey (a adapter au site voulu), permet simplement de copier dans le presse papier un element dans un id
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name scriptflem_getInfo | |
// @namespace Violentmonkey Scripts | |
// @version 1.0.0 | |
// @match | |
// @downloadURL | |
// @updateURL | |
// @homepageURL | |
// @grant GM_setClipboard | |
// @grant GM_notification | |
// @grant GM_addStyle | |
// @run-at document-end | |
// @iconURL | |
// ==/UserScript== | |
// permet de copier les informations present dans l'element (en fonction de l'ID) | |
element_copy = [''] | |
// a.style.cursor = 'pointer' | |
// TODO rajouter ca a l'element pour signifier la posibilité de cliquer dessus | |
function copyText() | |
{ | |
text = this.innerHTML | |
GM_setClipboard(text, "text/plain") | |
GM_notification({title: "Copie dans le presse papier",text : text, timeout : 1000, image : ""}) | |
} | |
function setTextCop(id){ | |
element = document.getElementById(id).onclick = copyText | |
} | |
// en cas de besoin, il peut etre utile de rajouter un "eventlistener" | |
// https://www.w3schools.com/js/js_htmldom_eventlistener.asp | |
// permet de garder le "onclick" original tout en rajoutant des effets |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment