diff options
author | polo-pc-greta <ordipolo@gmx.fr> | 2025-03-27 10:13:03 +0100 |
---|---|---|
committer | polo-pc-greta <ordipolo@gmx.fr> | 2025-03-27 10:13:03 +0100 |
commit | df3612ed7e6691530503f79483d2fdbc032d01b8 (patch) | |
tree | 56d1c68fdc8625f5dad1937a654299d45142c79a /public/js/main.js | |
download | cms-df3612ed7e6691530503f79483d2fdbc032d01b8.zip |
mise en ligne github
Diffstat (limited to 'public/js/main.js')
-rw-r--r-- | public/js/main.js | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/public/js/main.js b/public/js/main.js new file mode 100644 index 0000000..c86ec51 --- /dev/null +++ b/public/js/main.js | |||
@@ -0,0 +1,30 @@ | |||
1 | function newPassword(page, id = ''){ | ||
2 | if(id != ''){ | ||
3 | id = '&id=' + id; | ||
4 | } | ||
5 | alert('Le mot de passe a été modifié.'); | ||
6 | window.setTimeout(function(){ | ||
7 | location.href = "index.php?page=" + page + "&message=nouveau_mdp" + id; | ||
8 | }, 0); | ||
9 | } | ||
10 | |||
11 | function copyInClipBoard(link){ | ||
12 | // une balise <input> avec des attributs | ||
13 | var element = document.createElement("input"); | ||
14 | element.setAttribute("id", "copyMe"); | ||
15 | element.setAttribute("value", link); | ||
16 | |||
17 | // placement dans la page (= le "document") | ||
18 | document.body.appendChild(element); | ||
19 | var cible = document.getElementById('copyMe'); | ||
20 | |||
21 | // selection comme on le ferait à la souris | ||
22 | cible.select(); | ||
23 | // copie (= Ctrl + C) | ||
24 | document.execCommand("copy"); | ||
25 | |||
26 | // nettoyage | ||
27 | element.parentNode.removeChild(element); | ||
28 | |||
29 | alert('Cette adresse a été copiée dans le presse-papier:\n\n' + link); | ||
30 | } \ No newline at end of file | ||