mirror of https://github.com/zlatinb/muwire
add copy-to-clipboard ability for full id
parent
e542a50260
commit
db91c9171d
|
@ -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"),
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -17,6 +17,13 @@ Core core = (Core) application.getAttribute("core");
|
|||
<html>
|
||||
<head>
|
||||
<%@include file="css.jsi"%>
|
||||
<script src="js/util.js?<%=version%>" type="text/javascript"></script>
|
||||
<script>
|
||||
function copyFullId() {
|
||||
copyToClipboard("full-id")
|
||||
alert("Full Id Copied To Clipboard")
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body onload="initConnectionsCount();">
|
||||
<%@include file="header.jsi"%>
|
||||
|
@ -27,7 +34,8 @@ Core core = (Core) application.getAttribute("core");
|
|||
<section class="main foldermain">
|
||||
<p><%=Util._t("Your short MuWire id is {0}", core.getMe().getHumanReadableName())%></p>
|
||||
<p><%=Util._t("Your full MuWire id is")%></p>
|
||||
<p><pre class="fullId"><%=core.getMe().toBase64()%></pre></p>
|
||||
<p><textarea class="fullId" id="full-id" readOnly="true"><%=core.getMe().toBase64()%></textarea></p>
|
||||
<p><a href='#' onclick="window.copyFullId();return false;"><%=Util._t("Copy To Clipboard")%></a></p>
|
||||
</section>
|
||||
</body>
|
||||
</html>
|
||||
|
|
Loading…
Reference in New Issue