Просмотр исходного кода

Copy paste to clipboard button added. Copy paste to clipboard shortcut added

ribas160 1 год назад
Родитель
Сommit
6c39a1441c

+ 39 - 0
css/bootstrap/privatebin.css

@@ -175,3 +175,42 @@ html[dir="rtl"] #language {
 html[dir="rtl"] #deletelink, html[dir="rtl"] #qrcodemodalClose {
 	float: left;
 }
+
+#prettyprint {
+	padding-right: 30px;
+}
+
+#prettymessageCopyBtn {
+	position: absolute;
+	top: 5px;
+	right: 20px;
+	width: 25px;
+	height: 25px;
+	padding: 0;
+	background: none;
+	border: none;
+	z-index: 1;
+}
+
+#prettymessageCopyBtn svg {
+	width: 100%;
+}
+
+#copyIcon {
+	fill: rgb(145, 152, 161);
+	opacity: 0.4;
+	transition: all 0.3s ease;
+}
+
+#copyIcon:hover {
+	opacity: 1;
+}
+
+#copySuccessIcon {
+	fill: rgb(63, 185, 80);
+	display: none;
+}
+
+#copyShortcutHint {
+	margin-bottom: 5px;
+}

+ 35 - 0
css/bootstrap5/privatebin.css

@@ -84,3 +84,38 @@ li.L0, li.L1, li.L2, li.L3, li.L4, li.L5, li.L6, li.L7, li.L8, li.L9 {
 html[dir="rtl"] #deletelink, html[dir="rtl"] #qrcodemodalClose {
 	float: left;
 }
+
+#prettyprint {
+	padding-right: 30px;
+}
+
+#prettymessageCopyBtn {
+	position: absolute;
+	top: 5px;
+	right: 5px;
+	width: 25px;
+	height: 25px;
+	padding: 0;
+	background: none;
+	border: none;
+	z-index: 1;
+}
+
+#prettymessageCopyBtn svg {
+	width: 100%;
+}
+
+#copyIcon {
+	fill: rgb(145, 152, 161);
+	opacity: 0.4;
+	transition: all 0.3s ease;
+}
+
+#copyIcon:hover {
+	opacity: 1;
+}
+
+#copySuccessIcon {
+	fill: rgb(63, 185, 80);
+	display: none;
+}

+ 1 - 0
css/privatebin.css

@@ -86,6 +86,7 @@ h3.title {
 #aboutbox a { color: #94a3b4; }
 
 #message, #cleartext, #prettymessage, #attachment, .replymessage {
+	position: relative;
 	clear: both;
 	color: #000;
 	background-color: #fff;

+ 3 - 1
i18n/ar.json

@@ -219,5 +219,7 @@
     "Yes, see it": "نعم، حمله",
     "Dark Mode": "الوضع الداكن",
     "Error compressing paste, due to missing WebAssembly support.": "Error compressing paste, due to missing WebAssembly support.",
-    "Error decompressing paste, your browser does not support WebAssembly. Please use another browser to view this paste.": "Error decompressing paste, your browser does not support WebAssembly. Please use another browser to view this paste."
+    "Error decompressing paste, your browser does not support WebAssembly. Please use another browser to view this paste.": "Error decompressing paste, your browser does not support WebAssembly. Please use another browser to view this paste.",
+    "Paste copied to clipboard": "Paste copied to clipboard",
+    "To copy paste press on the copy button or use the clipboard shortcut Ctrl+c/Cmd+c": "To copy paste press on the copy button or use the clipboard shortcut Ctrl+c/Cmd+c"
 }

+ 3 - 1
i18n/bg.json

@@ -219,5 +219,7 @@
     "Yes, see it": "Yes, see it",
     "Dark Mode": "Dark Mode",
     "Error compressing paste, due to missing WebAssembly support.": "Error compressing paste, due to missing WebAssembly support.",
-    "Error decompressing paste, your browser does not support WebAssembly. Please use another browser to view this paste.": "Error decompressing paste, your browser does not support WebAssembly. Please use another browser to view this paste."
+    "Error decompressing paste, your browser does not support WebAssembly. Please use another browser to view this paste.": "Error decompressing paste, your browser does not support WebAssembly. Please use another browser to view this paste.",
+    "Paste copied to clipboard": "Paste copied to clipboard",
+    "To copy paste press on the copy button or use the clipboard shortcut Ctrl+c/Cmd+c": "To copy paste press on the copy button or use the clipboard shortcut Ctrl+c/Cmd+c"
 }

+ 3 - 1
i18n/ca.json

@@ -219,5 +219,7 @@
     "Yes, see it": "Yes, see it",
     "Dark Mode": "Dark Mode",
     "Error compressing paste, due to missing WebAssembly support.": "Error de compressió de la nota, no hi ha suport de WebAssembly.",
-    "Error decompressing paste, your browser does not support WebAssembly. Please use another browser to view this paste.": "Error decompressing paste, your browser does not support WebAssembly. Please use another browser to view this paste."
+    "Error decompressing paste, your browser does not support WebAssembly. Please use another browser to view this paste.": "Error decompressing paste, your browser does not support WebAssembly. Please use another browser to view this paste.",
+    "Paste copied to clipboard": "Paste copied to clipboard",
+    "To copy paste press on the copy button or use the clipboard shortcut Ctrl+c/Cmd+c": "To copy paste press on the copy button or use the clipboard shortcut Ctrl+c/Cmd+c"
 }

+ 3 - 1
i18n/co.json

@@ -219,5 +219,7 @@
     "Yes, see it": "Iè, fighjallu",
     "Dark Mode": "Modu scuru",
     "Error compressing paste, due to missing WebAssembly support.": "Sbagliu durante a cumpressione di l’appiccicu, perchè WebAssembly ùn hè micca accettatu.",
-    "Error decompressing paste, your browser does not support WebAssembly. Please use another browser to view this paste.": "Sbagliu durante a scumpressione di l’appiccicu, perchè u vostru navigatore ùn accetteghja micca WebAssembly. Ci vole à impiegà un altru navigatore per affissà st’appiccicu."
+    "Error decompressing paste, your browser does not support WebAssembly. Please use another browser to view this paste.": "Sbagliu durante a scumpressione di l’appiccicu, perchè u vostru navigatore ùn accetteghja micca WebAssembly. Ci vole à impiegà un altru navigatore per affissà st’appiccicu.",
+    "Paste copied to clipboard": "Paste copied to clipboard",
+    "To copy paste press on the copy button or use the clipboard shortcut Ctrl+c/Cmd+c": "To copy paste press on the copy button or use the clipboard shortcut Ctrl+c/Cmd+c"
 }

+ 3 - 1
i18n/cs.json

@@ -219,5 +219,7 @@
     "Yes, see it": "Yes, see it",
     "Dark Mode": "Dark Mode",
     "Error compressing paste, due to missing WebAssembly support.": "Error compressing paste, due to missing WebAssembly support.",
-    "Error decompressing paste, your browser does not support WebAssembly. Please use another browser to view this paste.": "Error decompressing paste, your browser does not support WebAssembly. Please use another browser to view this paste."
+    "Error decompressing paste, your browser does not support WebAssembly. Please use another browser to view this paste.": "Error decompressing paste, your browser does not support WebAssembly. Please use another browser to view this paste.",
+    "Paste copied to clipboard": "Paste copied to clipboard",
+    "To copy paste press on the copy button or use the clipboard shortcut Ctrl+c/Cmd+c": "To copy paste press on the copy button or use the clipboard shortcut Ctrl+c/Cmd+c"
 }

+ 3 - 1
i18n/de.json

@@ -219,5 +219,7 @@
     "Yes, see it": "Ja, jetzt einsehen",
     "Dark Mode": "Nachtmodus",
     "Error compressing paste, due to missing WebAssembly support.": "Fehler beim Komprimieren des Textes, da WebAssembly-Unterstützung fehlt.",
-    "Error decompressing paste, your browser does not support WebAssembly. Please use another browser to view this paste.": "Fehler beim Dekomprimieren des Textes. Dein Browser unterstützt WebAssembly nicht. Bitte verwende einen anderen Browser, um diesen Text anzuzeigen."
+    "Error decompressing paste, your browser does not support WebAssembly. Please use another browser to view this paste.": "Fehler beim Dekomprimieren des Textes. Dein Browser unterstützt WebAssembly nicht. Bitte verwende einen anderen Browser, um diesen Text anzuzeigen.",
+    "Paste copied to clipboard": "Paste copied to clipboard",
+    "To copy paste press on the copy button or use the clipboard shortcut Ctrl+c/Cmd+c": "To copy paste press on the copy button or use the clipboard shortcut Ctrl+c/Cmd+c"
 }

+ 3 - 1
i18n/el.json

@@ -219,5 +219,7 @@
     "Yes, see it": "Ναι, δείτε το",
     "Dark Mode": "Σκοτεινό Θέμα",
     "Error compressing paste, due to missing WebAssembly support.": "Σφάλμα συμπίεσης επικόλλησης, λόγω έλλειψης υποστήριξης WebAssembly.",
-    "Error decompressing paste, your browser does not support WebAssembly. Please use another browser to view this paste.": "Σφάλμα αποσυμπίεσης της επικόλλησης, ο περιηγητής σας δεν υποστηρίζει WebAssembly. Παρακαλούμε χρησιμοποιήστε έναν άλλο περιηγητή για να δείτε αυτή την επικόλληση."
+    "Error decompressing paste, your browser does not support WebAssembly. Please use another browser to view this paste.": "Σφάλμα αποσυμπίεσης της επικόλλησης, ο περιηγητής σας δεν υποστηρίζει WebAssembly. Παρακαλούμε χρησιμοποιήστε έναν άλλο περιηγητή για να δείτε αυτή την επικόλληση.",
+    "Paste copied to clipboard": "Paste copied to clipboard",
+    "To copy paste press on the copy button or use the clipboard shortcut Ctrl+c/Cmd+c": "To copy paste press on the copy button or use the clipboard shortcut Ctrl+c/Cmd+c"
 }

+ 3 - 1
i18n/en.json

@@ -219,5 +219,7 @@
     "Yes, see it": "Yes, see it",
     "Dark Mode": "Dark Mode",
     "Error compressing paste, due to missing WebAssembly support.": "Error compressing paste, due to missing WebAssembly support.",
-    "Error decompressing paste, your browser does not support WebAssembly. Please use another browser to view this paste.": "Error decompressing paste, your browser does not support WebAssembly. Please use another browser to view this paste."
+    "Error decompressing paste, your browser does not support WebAssembly. Please use another browser to view this paste.": "Error decompressing paste, your browser does not support WebAssembly. Please use another browser to view this paste.",
+    "Paste copied to clipboard": "Paste copied to clipboard",
+    "To copy paste press on the copy button or use the clipboard shortcut Ctrl+c/Cmd+c": "To copy paste press on the copy button or use the clipboard shortcut Ctrl+c/Cmd+c"
 }

+ 3 - 1
i18n/es.json

@@ -219,5 +219,7 @@
     "Yes, see it": "Sí, verlo",
     "Dark Mode": "Modo nocturno",
     "Error compressing paste, due to missing WebAssembly support.": "Error compressing paste, due to missing WebAssembly support.",
-    "Error decompressing paste, your browser does not support WebAssembly. Please use another browser to view this paste.": "Error decompressing paste, your browser does not support WebAssembly. Please use another browser to view this paste."
+    "Error decompressing paste, your browser does not support WebAssembly. Please use another browser to view this paste.": "Error decompressing paste, your browser does not support WebAssembly. Please use another browser to view this paste.",
+    "Paste copied to clipboard": "Paste copied to clipboard",
+    "To copy paste press on the copy button or use the clipboard shortcut Ctrl+c/Cmd+c": "To copy paste press on the copy button or use the clipboard shortcut Ctrl+c/Cmd+c"
 }

+ 3 - 1
i18n/et.json

@@ -219,5 +219,7 @@
     "Yes, see it": "Yes, see it",
     "Dark Mode": "Tume režiim",
     "Error compressing paste, due to missing WebAssembly support.": "Error compressing paste, due to missing WebAssembly support.",
-    "Error decompressing paste, your browser does not support WebAssembly. Please use another browser to view this paste.": "Error decompressing paste, your browser does not support WebAssembly. Please use another browser to view this paste."
+    "Error decompressing paste, your browser does not support WebAssembly. Please use another browser to view this paste.": "Error decompressing paste, your browser does not support WebAssembly. Please use another browser to view this paste.",
+    "Paste copied to clipboard": "Paste copied to clipboard",
+    "To copy paste press on the copy button or use the clipboard shortcut Ctrl+c/Cmd+c": "To copy paste press on the copy button or use the clipboard shortcut Ctrl+c/Cmd+c"
 }

+ 3 - 1
i18n/fi.json

@@ -219,5 +219,7 @@
     "Yes, see it": "Kyllä, näet sen",
     "Dark Mode": "Tumma tila",
     "Error compressing paste, due to missing WebAssembly support.": "Error compressing paste, due to missing WebAssembly support.",
-    "Error decompressing paste, your browser does not support WebAssembly. Please use another browser to view this paste.": "Error decompressing paste, your browser does not support WebAssembly. Please use another browser to view this paste."
+    "Error decompressing paste, your browser does not support WebAssembly. Please use another browser to view this paste.": "Error decompressing paste, your browser does not support WebAssembly. Please use another browser to view this paste.",
+    "Paste copied to clipboard": "Paste copied to clipboard",
+    "To copy paste press on the copy button or use the clipboard shortcut Ctrl+c/Cmd+c": "To copy paste press on the copy button or use the clipboard shortcut Ctrl+c/Cmd+c"
 }

+ 3 - 1
i18n/fr.json

@@ -219,5 +219,7 @@
     "Yes, see it": "Oui, le voir",
     "Dark Mode": "Mode Sombre",
     "Error compressing paste, due to missing WebAssembly support.": "Erreur lors de la compression du paste, en raison du support de WebAssembly manquant.",
-    "Error decompressing paste, your browser does not support WebAssembly. Please use another browser to view this paste.": "Erreur lors de la décompression du paste, votre navigateur ne supporte pas WebAssembly. Veuillez utiliser un autre navigateur pour voir ce paste."
+    "Error decompressing paste, your browser does not support WebAssembly. Please use another browser to view this paste.": "Erreur lors de la décompression du paste, votre navigateur ne supporte pas WebAssembly. Veuillez utiliser un autre navigateur pour voir ce paste.",
+    "Paste copied to clipboard": "Paste copied to clipboard",
+    "To copy paste press on the copy button or use the clipboard shortcut Ctrl+c/Cmd+c": "To copy paste press on the copy button or use the clipboard shortcut Ctrl+c/Cmd+c"
 }

+ 3 - 1
i18n/he.json

@@ -219,5 +219,7 @@
     "Yes, see it": "Yes, see it",
     "Dark Mode": "Dark Mode",
     "Error compressing paste, due to missing WebAssembly support.": "Error compressing paste, due to missing WebAssembly support.",
-    "Error decompressing paste, your browser does not support WebAssembly. Please use another browser to view this paste.": "Error decompressing paste, your browser does not support WebAssembly. Please use another browser to view this paste."
+    "Error decompressing paste, your browser does not support WebAssembly. Please use another browser to view this paste.": "Error decompressing paste, your browser does not support WebAssembly. Please use another browser to view this paste.",
+    "Paste copied to clipboard": "Paste copied to clipboard",
+    "To copy paste press on the copy button or use the clipboard shortcut Ctrl+c/Cmd+c": "To copy paste press on the copy button or use the clipboard shortcut Ctrl+c/Cmd+c"
 }

+ 3 - 1
i18n/hi.json

@@ -219,5 +219,7 @@
     "Yes, see it": "Yes, see it",
     "Dark Mode": "Dark Mode",
     "Error compressing paste, due to missing WebAssembly support.": "Error compressing paste, due to missing WebAssembly support.",
-    "Error decompressing paste, your browser does not support WebAssembly. Please use another browser to view this paste.": "Error decompressing paste, your browser does not support WebAssembly. Please use another browser to view this paste."
+    "Error decompressing paste, your browser does not support WebAssembly. Please use another browser to view this paste.": "Error decompressing paste, your browser does not support WebAssembly. Please use another browser to view this paste.",
+    "Paste copied to clipboard": "Paste copied to clipboard",
+    "To copy paste press on the copy button or use the clipboard shortcut Ctrl+c/Cmd+c": "To copy paste press on the copy button or use the clipboard shortcut Ctrl+c/Cmd+c"
 }

+ 3 - 1
i18n/hu.json

@@ -219,5 +219,7 @@
     "Yes, see it": "Yes, see it",
     "Dark Mode": "Sötét mód",
     "Error compressing paste, due to missing WebAssembly support.": "Error compressing paste, due to missing WebAssembly support.",
-    "Error decompressing paste, your browser does not support WebAssembly. Please use another browser to view this paste.": "Error decompressing paste, your browser does not support WebAssembly. Please use another browser to view this paste."
+    "Error decompressing paste, your browser does not support WebAssembly. Please use another browser to view this paste.": "Error decompressing paste, your browser does not support WebAssembly. Please use another browser to view this paste.",
+    "Paste copied to clipboard": "Paste copied to clipboard",
+    "To copy paste press on the copy button or use the clipboard shortcut Ctrl+c/Cmd+c": "To copy paste press on the copy button or use the clipboard shortcut Ctrl+c/Cmd+c"
 }

+ 3 - 1
i18n/id.json

@@ -219,5 +219,7 @@
     "Yes, see it": "Yes, see it",
     "Dark Mode": "Mode Gelap",
     "Error compressing paste, due to missing WebAssembly support.": "Error compressing paste, due to missing WebAssembly support.",
-    "Error decompressing paste, your browser does not support WebAssembly. Please use another browser to view this paste.": "Error decompressing paste, your browser does not support WebAssembly. Please use another browser to view this paste."
+    "Error decompressing paste, your browser does not support WebAssembly. Please use another browser to view this paste.": "Error decompressing paste, your browser does not support WebAssembly. Please use another browser to view this paste.",
+    "Paste copied to clipboard": "Paste copied to clipboard",
+    "To copy paste press on the copy button or use the clipboard shortcut Ctrl+c/Cmd+c": "To copy paste press on the copy button or use the clipboard shortcut Ctrl+c/Cmd+c"
 }

+ 3 - 1
i18n/it.json

@@ -219,5 +219,7 @@
     "Yes, see it": "Sì, visualizzalo",
     "Dark Mode": "Tema Scuro",
     "Error compressing paste, due to missing WebAssembly support.": "Errore nella compressione dell messaggio, a causa del supporto WebAssembly mancante.",
-    "Error decompressing paste, your browser does not support WebAssembly. Please use another browser to view this paste.": "Errore nella decompressione dell messaggio, il tuo browser non supporta WebAssembly. Utilizza un altro browser per visualizzare questo messaggio."
+    "Error decompressing paste, your browser does not support WebAssembly. Please use another browser to view this paste.": "Errore nella decompressione dell messaggio, il tuo browser non supporta WebAssembly. Utilizza un altro browser per visualizzare questo messaggio.",
+    "Paste copied to clipboard": "Paste copied to clipboard",
+    "To copy paste press on the copy button or use the clipboard shortcut Ctrl+c/Cmd+c": "To copy paste press on the copy button or use the clipboard shortcut Ctrl+c/Cmd+c"
 }

+ 3 - 1
i18n/ja.json

@@ -219,5 +219,7 @@
     "Yes, see it": "はい、使用します",
     "Dark Mode": "ダークモード",
     "Error compressing paste, due to missing WebAssembly support.": "Error compressing paste, due to missing WebAssembly support.",
-    "Error decompressing paste, your browser does not support WebAssembly. Please use another browser to view this paste.": "Error decompressing paste, your browser does not support WebAssembly. Please use another browser to view this paste."
+    "Error decompressing paste, your browser does not support WebAssembly. Please use another browser to view this paste.": "Error decompressing paste, your browser does not support WebAssembly. Please use another browser to view this paste.",
+    "Paste copied to clipboard": "Paste copied to clipboard",
+    "To copy paste press on the copy button or use the clipboard shortcut Ctrl+c/Cmd+c": "To copy paste press on the copy button or use the clipboard shortcut Ctrl+c/Cmd+c"
 }

+ 3 - 1
i18n/jbo.json

@@ -219,5 +219,7 @@
     "Yes, see it": "Yes, see it",
     "Dark Mode": "Dark Mode",
     "Error compressing paste, due to missing WebAssembly support.": "Error compressing paste, due to missing WebAssembly support.",
-    "Error decompressing paste, your browser does not support WebAssembly. Please use another browser to view this paste.": "Error decompressing paste, your browser does not support WebAssembly. Please use another browser to view this paste."
+    "Error decompressing paste, your browser does not support WebAssembly. Please use another browser to view this paste.": "Error decompressing paste, your browser does not support WebAssembly. Please use another browser to view this paste.",
+    "Paste copied to clipboard": "Paste copied to clipboard",
+    "To copy paste press on the copy button or use the clipboard shortcut Ctrl+c/Cmd+c": "To copy paste press on the copy button or use the clipboard shortcut Ctrl+c/Cmd+c"
 }

+ 3 - 1
i18n/ko.json

@@ -219,5 +219,7 @@
     "Yes, see it": "Yes, see it",
     "Dark Mode": "Dark Mode",
     "Error compressing paste, due to missing WebAssembly support.": "Error compressing paste, due to missing WebAssembly support.",
-    "Error decompressing paste, your browser does not support WebAssembly. Please use another browser to view this paste.": "Error decompressing paste, your browser does not support WebAssembly. Please use another browser to view this paste."
+    "Error decompressing paste, your browser does not support WebAssembly. Please use another browser to view this paste.": "Error decompressing paste, your browser does not support WebAssembly. Please use another browser to view this paste.",
+    "Paste copied to clipboard": "Paste copied to clipboard",
+    "To copy paste press on the copy button or use the clipboard shortcut Ctrl+c/Cmd+c": "To copy paste press on the copy button or use the clipboard shortcut Ctrl+c/Cmd+c"
 }

+ 3 - 1
i18n/ku.json

@@ -219,5 +219,7 @@
     "Yes, see it": "Yes, see it",
     "Dark Mode": "جۆری ڕەش",
     "Error compressing paste, due to missing WebAssembly support.": "Error compressing paste, due to missing WebAssembly support.",
-    "Error decompressing paste, your browser does not support WebAssembly. Please use another browser to view this paste.": "Error decompressing paste, your browser does not support WebAssembly. Please use another browser to view this paste."
+    "Error decompressing paste, your browser does not support WebAssembly. Please use another browser to view this paste.": "Error decompressing paste, your browser does not support WebAssembly. Please use another browser to view this paste.",
+    "Paste copied to clipboard": "Paste copied to clipboard",
+    "To copy paste press on the copy button or use the clipboard shortcut Ctrl+c/Cmd+c": "To copy paste press on the copy button or use the clipboard shortcut Ctrl+c/Cmd+c"
 }

+ 3 - 1
i18n/la.json

@@ -219,5 +219,7 @@
     "Yes, see it": "Yes, see it",
     "Dark Mode": "Dark Mode",
     "Error compressing paste, due to missing WebAssembly support.": "Error compressing paste, due to missing WebAssembly support.",
-    "Error decompressing paste, your browser does not support WebAssembly. Please use another browser to view this paste.": "Error decompressing paste, your browser does not support WebAssembly. Please use another browser to view this paste."
+    "Error decompressing paste, your browser does not support WebAssembly. Please use another browser to view this paste.": "Error decompressing paste, your browser does not support WebAssembly. Please use another browser to view this paste.",
+    "Paste copied to clipboard": "Paste copied to clipboard",
+    "To copy paste press on the copy button or use the clipboard shortcut Ctrl+c/Cmd+c": "To copy paste press on the copy button or use the clipboard shortcut Ctrl+c/Cmd+c"
 }

+ 3 - 1
i18n/lt.json

@@ -219,5 +219,7 @@
     "Yes, see it": "Taip, pamatyti",
     "Dark Mode": "Tamsi veiksena",
     "Error compressing paste, due to missing WebAssembly support.": "Klaida glaudinant įdėjimą, nes trūksta WebAssembly palaikymo.",
-    "Error decompressing paste, your browser does not support WebAssembly. Please use another browser to view this paste.": "Klaida išglaudinant įdėjimą, jūsų naršyklė nepalaiko WebAssembly. Norėdami peržiūrėti šį įdėjimą, naudokite kitą naršyklę."
+    "Error decompressing paste, your browser does not support WebAssembly. Please use another browser to view this paste.": "Klaida išglaudinant įdėjimą, jūsų naršyklė nepalaiko WebAssembly. Norėdami peržiūrėti šį įdėjimą, naudokite kitą naršyklę.",
+    "Paste copied to clipboard": "Paste copied to clipboard",
+    "To copy paste press on the copy button or use the clipboard shortcut Ctrl+c/Cmd+c": "To copy paste press on the copy button or use the clipboard shortcut Ctrl+c/Cmd+c"
 }

+ 3 - 1
i18n/nl.json

@@ -219,5 +219,7 @@
     "Yes, see it": "Ja, tonen",
     "Dark Mode": "Donkere modus",
     "Error compressing paste, due to missing WebAssembly support.": "Fout bij het comprimeren van notitie door ontbrekende ondersteuning voor WebAssembly.",
-    "Error decompressing paste, your browser does not support WebAssembly. Please use another browser to view this paste.": "Fout bij het decomprimeren van de notitie, uw browser ondersteunt WebAssembly niet. Gebruik een andere browser om deze notitie te bekijken."
+    "Error decompressing paste, your browser does not support WebAssembly. Please use another browser to view this paste.": "Fout bij het decomprimeren van de notitie, uw browser ondersteunt WebAssembly niet. Gebruik een andere browser om deze notitie te bekijken.",
+    "Paste copied to clipboard": "Paste copied to clipboard",
+    "To copy paste press on the copy button or use the clipboard shortcut Ctrl+c/Cmd+c": "To copy paste press on the copy button or use the clipboard shortcut Ctrl+c/Cmd+c"
 }

+ 3 - 1
i18n/no.json

@@ -219,5 +219,7 @@
     "Yes, see it": "Ja, se det",
     "Dark Mode": "Mørk modus",
     "Error compressing paste, due to missing WebAssembly support.": "Error compressing paste, due to missing WebAssembly support.",
-    "Error decompressing paste, your browser does not support WebAssembly. Please use another browser to view this paste.": "Error decompressing paste, your browser does not support WebAssembly. Please use another browser to view this paste."
+    "Error decompressing paste, your browser does not support WebAssembly. Please use another browser to view this paste.": "Error decompressing paste, your browser does not support WebAssembly. Please use another browser to view this paste.",
+    "Paste copied to clipboard": "Paste copied to clipboard",
+    "To copy paste press on the copy button or use the clipboard shortcut Ctrl+c/Cmd+c": "To copy paste press on the copy button or use the clipboard shortcut Ctrl+c/Cmd+c"
 }

+ 3 - 1
i18n/oc.json

@@ -219,5 +219,7 @@
     "Yes, see it": "Yes, see it",
     "Dark Mode": "Dark Mode",
     "Error compressing paste, due to missing WebAssembly support.": "Error compressing paste, due to missing WebAssembly support.",
-    "Error decompressing paste, your browser does not support WebAssembly. Please use another browser to view this paste.": "Error decompressing paste, your browser does not support WebAssembly. Please use another browser to view this paste."
+    "Error decompressing paste, your browser does not support WebAssembly. Please use another browser to view this paste.": "Error decompressing paste, your browser does not support WebAssembly. Please use another browser to view this paste.",
+    "Paste copied to clipboard": "Paste copied to clipboard",
+    "To copy paste press on the copy button or use the clipboard shortcut Ctrl+c/Cmd+c": "To copy paste press on the copy button or use the clipboard shortcut Ctrl+c/Cmd+c"
 }

+ 3 - 1
i18n/pl.json

@@ -219,5 +219,7 @@
     "Yes, see it": "Yes, see it",
     "Dark Mode": "Ciemny motyw",
     "Error compressing paste, due to missing WebAssembly support.": "Error compressing paste, due to missing WebAssembly support.",
-    "Error decompressing paste, your browser does not support WebAssembly. Please use another browser to view this paste.": "Error decompressing paste, your browser does not support WebAssembly. Please use another browser to view this paste."
+    "Error decompressing paste, your browser does not support WebAssembly. Please use another browser to view this paste.": "Error decompressing paste, your browser does not support WebAssembly. Please use another browser to view this paste.",
+    "Paste copied to clipboard": "Paste copied to clipboard",
+    "To copy paste press on the copy button or use the clipboard shortcut Ctrl+c/Cmd+c": "To copy paste press on the copy button or use the clipboard shortcut Ctrl+c/Cmd+c"
 }

+ 3 - 1
i18n/pt.json

@@ -219,5 +219,7 @@
     "Yes, see it": "Sim, veja",
     "Dark Mode": "Modo Noturno",
     "Error compressing paste, due to missing WebAssembly support.": "Error compressing paste, due to missing WebAssembly support.",
-    "Error decompressing paste, your browser does not support WebAssembly. Please use another browser to view this paste.": "Error decompressing paste, your browser does not support WebAssembly. Please use another browser to view this paste."
+    "Error decompressing paste, your browser does not support WebAssembly. Please use another browser to view this paste.": "Error decompressing paste, your browser does not support WebAssembly. Please use another browser to view this paste.",
+    "Paste copied to clipboard": "Paste copied to clipboard",
+    "To copy paste press on the copy button or use the clipboard shortcut Ctrl+c/Cmd+c": "To copy paste press on the copy button or use the clipboard shortcut Ctrl+c/Cmd+c"
 }

+ 3 - 1
i18n/ro.json

@@ -219,5 +219,7 @@
     "Yes, see it": "Da, vezi",
     "Dark Mode": "Mod întunecat",
     "Error compressing paste, due to missing WebAssembly support.": "Eroare la compresia paste-ului din cauza incompatibilității cu WebAssembly.",
-    "Error decompressing paste, your browser does not support WebAssembly. Please use another browser to view this paste.": "Eroare la deschiderea paste-ului, browserul dvs. nu acceptă WebAssembly. Vă rugăm să utilizați un alt browser pentru a vedea acest paste."
+    "Error decompressing paste, your browser does not support WebAssembly. Please use another browser to view this paste.": "Eroare la deschiderea paste-ului, browserul dvs. nu acceptă WebAssembly. Vă rugăm să utilizați un alt browser pentru a vedea acest paste.",
+    "Paste copied to clipboard": "Paste copied to clipboard",
+    "To copy paste press on the copy button or use the clipboard shortcut Ctrl+c/Cmd+c": "To copy paste press on the copy button or use the clipboard shortcut Ctrl+c/Cmd+c"
 }

+ 3 - 1
i18n/ru.json

@@ -219,5 +219,7 @@
     "Yes, see it": "Да, загрузить",
     "Dark Mode": "Тёмная",
     "Error compressing paste, due to missing WebAssembly support.": "Error compressing paste, due to missing WebAssembly support.",
-    "Error decompressing paste, your browser does not support WebAssembly. Please use another browser to view this paste.": "Error decompressing paste, your browser does not support WebAssembly. Please use another browser to view this paste."
+    "Error decompressing paste, your browser does not support WebAssembly. Please use another browser to view this paste.": "Error decompressing paste, your browser does not support WebAssembly. Please use another browser to view this paste.",
+    "Paste copied to clipboard": "Запись скопирована в буфер обмена",
+    "To copy paste press on the copy button or use the clipboard shortcut Ctrl+c/Cmd+c": "Чтобы скопировать запись нажмите на кнопку скопирования или используйте комбинацию клавиш Ctrl+c/Cmd+c"
 }

+ 3 - 1
i18n/sk.json

@@ -219,5 +219,7 @@
     "Yes, see it": "Yes, see it",
     "Dark Mode": "Tmavý Režim",
     "Error compressing paste, due to missing WebAssembly support.": "Error compressing paste, due to missing WebAssembly support.",
-    "Error decompressing paste, your browser does not support WebAssembly. Please use another browser to view this paste.": "Error decompressing paste, your browser does not support WebAssembly. Please use another browser to view this paste."
+    "Error decompressing paste, your browser does not support WebAssembly. Please use another browser to view this paste.": "Error decompressing paste, your browser does not support WebAssembly. Please use another browser to view this paste.",
+    "Paste copied to clipboard": "Paste copied to clipboard",
+    "To copy paste press on the copy button or use the clipboard shortcut Ctrl+c/Cmd+c": "To copy paste press on the copy button or use the clipboard shortcut Ctrl+c/Cmd+c"
 }

+ 3 - 1
i18n/sl.json

@@ -219,5 +219,7 @@
     "Yes, see it": "Yes, see it",
     "Dark Mode": "Temni način",
     "Error compressing paste, due to missing WebAssembly support.": "Error compressing paste, due to missing WebAssembly support.",
-    "Error decompressing paste, your browser does not support WebAssembly. Please use another browser to view this paste.": "Error decompressing paste, your browser does not support WebAssembly. Please use another browser to view this paste."
+    "Error decompressing paste, your browser does not support WebAssembly. Please use another browser to view this paste.": "Error decompressing paste, your browser does not support WebAssembly. Please use another browser to view this paste.",
+    "Paste copied to clipboard": "Paste copied to clipboard",
+    "To copy paste press on the copy button or use the clipboard shortcut Ctrl+c/Cmd+c": "To copy paste press on the copy button or use the clipboard shortcut Ctrl+c/Cmd+c"
 }

+ 3 - 1
i18n/sv.json

@@ -219,5 +219,7 @@
     "Yes, see it": "Yes, see it",
     "Dark Mode": "Mörkt Läge",
     "Error compressing paste, due to missing WebAssembly support.": "Error compressing paste, due to missing WebAssembly support.",
-    "Error decompressing paste, your browser does not support WebAssembly. Please use another browser to view this paste.": "Error decompressing paste, your browser does not support WebAssembly. Please use another browser to view this paste."
+    "Error decompressing paste, your browser does not support WebAssembly. Please use another browser to view this paste.": "Error decompressing paste, your browser does not support WebAssembly. Please use another browser to view this paste.",
+    "Paste copied to clipboard": "Paste copied to clipboard",
+    "To copy paste press on the copy button or use the clipboard shortcut Ctrl+c/Cmd+c": "To copy paste press on the copy button or use the clipboard shortcut Ctrl+c/Cmd+c"
 }

+ 3 - 1
i18n/th.json

@@ -219,5 +219,7 @@
     "Yes, see it": "Yes, see it",
     "Dark Mode": "โหมดมืด",
     "Error compressing paste, due to missing WebAssembly support.": "Error compressing paste, due to missing WebAssembly support.",
-    "Error decompressing paste, your browser does not support WebAssembly. Please use another browser to view this paste.": "Error decompressing paste, your browser does not support WebAssembly. Please use another browser to view this paste."
+    "Error decompressing paste, your browser does not support WebAssembly. Please use another browser to view this paste.": "Error decompressing paste, your browser does not support WebAssembly. Please use another browser to view this paste.",
+    "Paste copied to clipboard": "Paste copied to clipboard",
+    "To copy paste press on the copy button or use the clipboard shortcut Ctrl+c/Cmd+c": "To copy paste press on the copy button or use the clipboard shortcut Ctrl+c/Cmd+c"
 }

+ 3 - 1
i18n/tr.json

@@ -219,5 +219,7 @@
     "Yes, see it": "Evet, görüyorum",
     "Dark Mode": "Koyu Mod",
     "Error compressing paste, due to missing WebAssembly support.": "Error compressing paste, due to missing WebAssembly support.",
-    "Error decompressing paste, your browser does not support WebAssembly. Please use another browser to view this paste.": "Error decompressing paste, your browser does not support WebAssembly. Please use another browser to view this paste."
+    "Error decompressing paste, your browser does not support WebAssembly. Please use another browser to view this paste.": "Error decompressing paste, your browser does not support WebAssembly. Please use another browser to view this paste.",
+    "Paste copied to clipboard": "Paste copied to clipboard",
+    "To copy paste press on the copy button or use the clipboard shortcut Ctrl+c/Cmd+c": "To copy paste press on the copy button or use the clipboard shortcut Ctrl+c/Cmd+c"
 }

+ 3 - 1
i18n/uk.json

@@ -219,5 +219,7 @@
     "Yes, see it": "Так, побачити",
     "Dark Mode": "Темний режим",
     "Error compressing paste, due to missing WebAssembly support.": "Помилка при стисканні допису, через відсутність підтримки WebAssembly сервера.",
-    "Error decompressing paste, your browser does not support WebAssembly. Please use another browser to view this paste.": "Помилка при розпакуванні допису, бо ваш браузер не підтримує WebAssembly. Будь ласка, відкрийте інший браузер для перегляду цього допису."
+    "Error decompressing paste, your browser does not support WebAssembly. Please use another browser to view this paste.": "Помилка при розпакуванні допису, бо ваш браузер не підтримує WebAssembly. Будь ласка, відкрийте інший браузер для перегляду цього допису.",
+    "Paste copied to clipboard": "Paste copied to clipboard",
+    "To copy paste press on the copy button or use the clipboard shortcut Ctrl+c/Cmd+c": "To copy paste press on the copy button or use the clipboard shortcut Ctrl+c/Cmd+c"
 }

+ 3 - 1
i18n/zh.json

@@ -219,5 +219,7 @@
     "Yes, see it": "是的,加载它",
     "Dark Mode": "暗黑模式",
     "Error compressing paste, due to missing WebAssembly support.": "Error compressing paste, due to missing WebAssembly support.",
-    "Error decompressing paste, your browser does not support WebAssembly. Please use another browser to view this paste.": "Error decompressing paste, your browser does not support WebAssembly. Please use another browser to view this paste."
+    "Error decompressing paste, your browser does not support WebAssembly. Please use another browser to view this paste.": "Error decompressing paste, your browser does not support WebAssembly. Please use another browser to view this paste.",
+    "Paste copied to clipboard": "Paste copied to clipboard",
+    "To copy paste press on the copy button or use the clipboard shortcut Ctrl+c/Cmd+c": "To copy paste press on the copy button or use the clipboard shortcut Ctrl+c/Cmd+c"
 }

+ 1 - 0
img/content-copy-icon.svg

@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="#e8eaed"><path d="M360-240q-33 0-56.5-23.5T280-320v-480q0-33 23.5-56.5T360-880h360q33 0 56.5 23.5T800-800v480q0 33-23.5 56.5T720-240H360Zm0-80h360v-480H360v480ZM200-80q-33 0-56.5-23.5T120-160v-560h80v560h440v80H200Zm160-240v-480 480Z"/></svg>

+ 138 - 0
js/privatebin.js

@@ -4901,6 +4901,8 @@ jQuery.PrivateBin = (function($, RawDeflate) {
 
             TopNav.showViewButtons();
 
+            CopyToClipboard.showKeyboardShortcutHint();
+
             // this cannot be grouped with showViewButtons due to remaining time calculation
             TopNav.showEmailButton();
 
@@ -5337,6 +5339,8 @@ jQuery.PrivateBin = (function($, RawDeflate) {
             // shows the remaining time (until) deletion
             PasteStatus.showRemainingTime(paste);
 
+            CopyToClipboard.showKeyboardShortcutHint();
+
             Promise.all(decryptionPromises)
                 .then(() => {
                     Alert.hideLoading();
@@ -5366,6 +5370,138 @@ jQuery.PrivateBin = (function($, RawDeflate) {
         return me;
     })();
 
+    /**
+     * 
+     * @name CopyToClipboard
+     * @class
+     */
+    const CopyToClipboard = (function () {
+        const me = {};
+
+        let copyButton = $("#prettymessageCopyBtn"),
+            copyIcon = $("#copyIcon"),
+            successIcon = $("#copySuccessIcon"),
+            shortcutHint = $("#copyShortcutHintText");
+
+        /**
+         * Handle copy to clipboard button click
+         * 
+         * @name CopyToClipboard.handleCopyButtonClick
+         * @private
+         * @function
+         */
+        function handleCopyButtonClick() {
+            $(copyButton).click(function() {
+                const text = PasteViewer.getText();
+                saveToClipboard(text);
+            });
+        };
+
+        /**
+         * Handle CTRL+C/CMD+C keyboard shortcut
+         * 
+         * @name CopyToClipboard.handleKeyboardShortcut
+         * @private
+         * @function
+         */
+        function handleKeyboardShortcut() {
+            $(document).bind('copy', function () {
+                if (!isUserSelectedTextToCopy()) {
+                    const text = PasteViewer.getText();
+                    saveToClipboard(text);
+                }
+            });
+        }
+
+        /**
+         * Check if user selected some text on the page to copy it
+         * 
+         * @name CopyToClipboard.isUserSelectedTextToCopy
+         * @private
+         * @function
+         * @returns {boolean}
+         */
+        function isUserSelectedTextToCopy() {
+            let text = "";
+        
+            if (window.getSelection) {
+                text = window.getSelection().toString();
+            } else if (document.selection && document.selection.type != "Control") {
+                text = document.selection.createRange().text;
+            }
+        
+            return text.length > 0;
+        }
+
+        /**
+         * Save text to the clipboard
+         * 
+         * @name CopyToClipboard.saveToClipboard
+         * @private
+         * @param {string} text
+         * @function
+         */
+        function saveToClipboard(text) {
+            navigator.clipboard.writeText(text);
+            toggleSuccessIcon();
+            showAlertMessage();
+        };
+
+        /**
+         * Show alert message after text copy
+         * 
+         * @name CopyToClipboard.showAlertMessage
+         * @private
+         * @function
+         */
+        function showAlertMessage() {
+            Alert.showStatus("Paste copied to clipboard");
+        }
+
+        /**
+         * Toogle success icon after copy
+         * 
+         * @name CopyToClipboard.toggleSuccessIcon
+         * @private
+         * @function
+         */
+        function toggleSuccessIcon() {
+            $(copyIcon).css("display", "none");
+            $(successIcon).css("display", "block");
+
+            setTimeout(function() {
+                $(copyIcon).css("display", "block");
+                $(successIcon).css("display", "none");
+            }, 1000);
+        };
+
+        /**
+         * Show keyboard shortcut hint
+         * 
+         * @name CopyToClipboard.showKeyboardShortcutHint
+         * @function
+         */
+        me.showKeyboardShortcutHint = function () {
+            I18n._(
+                shortcutHint,
+                'To copy paste press on the copy button or use the clipboard shortcut Ctrl+c/Cmd+c'
+            );
+        }
+
+        /**
+         * Initialize
+         * 
+         * @name CopyToClipboard.init
+         * @function
+         */
+        me.init = function() {
+            handleCopyButtonClick();
+            handleKeyboardShortcut();
+        }
+
+        return me;
+    })();
+
     /**
      * (controller) main PrivateBin logic
      *
@@ -5612,6 +5748,7 @@ jQuery.PrivateBin = (function($, RawDeflate) {
             Prompt.init();
             TopNav.init();
             UiHelper.init();
+            CopyToClipboard.init();
 
             // check for legacy browsers before going any further
             if (!Legacy.Check.getInit()) {
@@ -5668,6 +5805,7 @@ jQuery.PrivateBin = (function($, RawDeflate) {
         ServerInteraction: ServerInteraction,
         PasteEncrypter: PasteEncrypter,
         PasteDecrypter: PasteDecrypter,
+        CopyToClipboard: CopyToClipboard,
         Controller: Controller
     };
 })(jQuery, RawDeflate);

+ 1 - 1
lib/Configuration.php

@@ -108,7 +108,7 @@ class Configuration
             'js/kjua-0.9.0.js'       => 'sha512-CVn7af+vTMBd9RjoS4QM5fpLFEOtBCoB0zPtaqIDC7sF4F8qgUSRFQQpIyEDGsr6yrjbuOLzdf20tkHHmpaqwQ==',
             'js/legacy.js'           => 'sha512-LYos+qXHIRqFf5ZPNphvtTB0cgzHUizu2wwcOwcwz/VIpRv9lpcBgPYz4uq6jx0INwCAj6Fbnl5HoKiLufS2jg==',
             'js/prettify.js'         => 'sha512-puO0Ogy++IoA2Pb9IjSxV1n4+kQkKXYAEUtVzfZpQepyDPyXk8hokiYDS7ybMogYlyyEIwMLpZqVhCkARQWLMg==',
-            'js/privatebin.js'       => 'sha512-cbmXvtZ/5gZPFjQDzP3IEhUAIhFPAoM31gw2kRYCT5xOh8wv9gXeDqI/t798luRW1xdC4gaYodjEFCzrsZR4mA==',
+            'js/privatebin.js'       => 'sha512-9caF+XTVriuyh86qLZ26dHbL6PfyOnSAB6zC2IhP6V/lifBxi28aJK0tm/t+F0GSdFXprzY0k8Ld3fbkbR0YJg==',
             'js/purify-3.1.6.js'     => 'sha512-SDwfsqHZFhbcBo/6AN7Te4KoUkWHHw7TzyZCuRkkpl0o8oV4owT/lprznWWe9+qFtigb6MrF81K4CQRLN6be+A==',
             'js/rawinflate-0.3.js'   => 'sha512-g8uelGgJW9A/Z1tB6Izxab++oj5kdD7B4qC7DHwZkB6DGMXKyzx7v5mvap2HXueI2IIn08YlRYM56jwWdm2ucQ==',
             'js/showdown-2.1.0.js'   => 'sha512-WYXZgkTR0u/Y9SVIA4nTTOih0kXMEd8RRV6MLFdL6YU8ymhR528NLlYQt1nlJQbYz4EW+ZsS0fx1awhiQJme1Q==',

+ 9 - 0
tpl/bootstrap.php

@@ -572,7 +572,16 @@ endif;
 				<article class="row">
 					<div id="placeholder" class="col-md-12 hidden"><?php echo I18n::_('+++ no paste text +++'); ?></div>
 					<div id="attachmentPreview" class="col-md-12 text-center hidden"></div>
+					<h5 id="copyShortcutHint" class="col-md-12"><small id="copyShortcutHintText"></small></h5>
 					<div id="prettymessage" class="col-md-12 hidden">
+						<button id="prettymessageCopyBtn">
+							<svg xmlns="http://www.w3.org/2000/svg" id="copyIcon" viewBox="0 -960 960 960" fill="#e8eaed">
+								<path d="M360-240q-33 0-56.5-23.5T280-320v-480q0-33 23.5-56.5T360-880h360q33 0 56.5 23.5T800-800v480q0 33-23.5 56.5T720-240H360Zm0-80h360v-480H360v480ZM200-80q-33 0-56.5-23.5T120-160v-560h80v560h440v80H200Zm160-240v-480 480Z"/>
+							</svg>
+							<svg xmlns="http://www.w3.org/2000/svg" id="copySuccessIcon" viewBox="0 -960 960 960" fill="#e8eaed">
+								<path d="M382-240 154-468l57-57 171 171 367-367 57 57-424 424Z"/>
+							</svg>
+						</button>
 						<pre id="prettyprint" class="col-md-12 prettyprint linenums:1"></pre>
 					</div>
 					<div id="plaintext" class="col-md-12 hidden"></div>

+ 5 - 0
tpl/bootstrap5.php

@@ -426,7 +426,12 @@ endif;
 				<article>
 					<div id="placeholder" class="col-md-12 hidden"><?php echo I18n::_('+++ no paste text +++'); ?></div>
 					<div id="attachmentPreview" class="col-md-12 text-center hidden"></div>
+					<h6 id="copyShortcutHint" class="col-md-12"><small id="copyShortcutHintText"></small></h6>
 					<div id="prettymessage" class="card col-md-12 hidden">
+						<button id="prettymessageCopyBtn">
+							<svg xmlns="http://www.w3.org/2000/svg" id="copyIcon" viewBox="0 -960 960 960" fill="#e8eaed"><path d="M360-240q-33 0-56.5-23.5T280-320v-480q0-33 23.5-56.5T360-880h360q33 0 56.5 23.5T800-800v480q0 33-23.5 56.5T720-240H360Zm0-80h360v-480H360v480ZM200-80q-33 0-56.5-23.5T120-160v-560h80v560h440v80H200Zm160-240v-480 480Z"/></svg>
+							<svg xmlns="http://www.w3.org/2000/svg" id="copySuccessIcon" viewBox="0 -960 960 960" fill="#e8eaed"><path d="M382-240 154-468l57-57 171 171 367-367 57 57-424 424Z"/></svg>
+						</button>
 						<pre id="prettyprint" class="card-body col-md-12 prettyprint linenums:1"></pre>
 					</div>
 					<div id="plaintext" class="col-md-12 hidden"></div>