From db91c9171daf85582fb40c4afb4e64f45009c9cc Mon Sep 17 00:00:00 2001 From: Zlatin Balevsky Date: Thu, 19 Mar 2020 19:19:47 +0000 Subject: [PATCH] add copy-to-clipboard ability for full id --- webui/src/main/java/com/muwire/webui/Util.java | 1 + webui/src/main/js/util.js | 7 +++++++ webui/src/main/webapp/AboutMe.jsp | 10 +++++++++- 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/webui/src/main/java/com/muwire/webui/Util.java b/webui/src/main/java/com/muwire/webui/Util.java index 084792f3..25ab524a 100644 --- a/webui/src/main/java/com/muwire/webui/Util.java +++ b/webui/src/main/java/com/muwire/webui/Util.java @@ -41,6 +41,7 @@ public class Util { _x("Certify"), _x("Clear Finished"), _x("Comment"), + _x("Copy To Clipbaord"), _x("Default settings for new feeds"), _x("Details for {0}"), _x("Distrusted"), diff --git a/webui/src/main/js/util.js b/webui/src/main/js/util.js index 5a0edf5d..3abf2fe7 100644 --- a/webui/src/main/js/util.js +++ b/webui/src/main/js/util.js @@ -6,6 +6,13 @@ function rfc3986EncodeURIComponent (str) { return encodeURIComponent(str).replace(/[!'()*]/g, escape); } +function copyToClipboard(id) { + var copyText = document.getElementById(id) + copyText.select() + copyText.setSelectionRange(0,99999) // because W3Schools says so + document.execCommand("copy") +} + /** * * Base64 encode / decode diff --git a/webui/src/main/webapp/AboutMe.jsp b/webui/src/main/webapp/AboutMe.jsp index 46958d12..007def7d 100644 --- a/webui/src/main/webapp/AboutMe.jsp +++ b/webui/src/main/webapp/AboutMe.jsp @@ -17,6 +17,13 @@ Core core = (Core) application.getAttribute("core"); <%@include file="css.jsi"%> + + <%@include file="header.jsi"%> @@ -27,7 +34,8 @@ Core core = (Core) application.getAttribute("core");

<%=Util._t("Your short MuWire id is {0}", core.getMe().getHumanReadableName())%>

<%=Util._t("Your full MuWire id is")%>

-

<%=core.getMe().toBase64()%>

+

+

<%=Util._t("Copy To Clipboard")%>