Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion src/freenet/clients/http/QueueToadlet.java
Original file line number Diff line number Diff line change
Expand Up @@ -1979,7 +1979,11 @@ private HTMLNode createSizeCell(long dataSize, boolean confirmed, boolean advanc
private HTMLNode createKeyCell(FreenetURI uri, boolean addSlash) {
HTMLNode keyCell = new HTMLNode("td", "class", "request-key");
if (uri != null) {
keyCell.addChild("span", "class", "key_is").addChild("a", "href", '/' + uri.toString() + (addSlash ? "/" : ""), uri.toShortString() + (addSlash ? "/" : ""));
keyCell.addChild("span", "class", "key_is")
.addChild("a",
new String[]{"class", "data-copytext", "data-copytitle", "href"},
new String[]{"copy-to-clipboard", uri.toString(), l10n("copyToClipboardTitle"), '/' + uri.toString() + (addSlash ? "/" : "")},
uri.toShortString() + (addSlash ? "/" : ""));
} else {
keyCell.addChild("span", "class", "key_unknown", l10n("unknown"));
}
Expand Down Expand Up @@ -2115,6 +2119,9 @@ private HTMLNode createRequestTable(PageMaker pageMaker, ToadletContext ctx, Lis

HTMLNode formDiv = new HTMLNode("div", "class", "request-table-form");
HTMLNode form = ctx.addFormChild(formDiv, path(), "request-table-form-"+id+(advancedModeEnabled?"-advanced":"-simple"));
if (core.getNode().isFProxyJavascriptEnabled()) {
form.addChild("script", new String[] {"type", "src"}, new String[] {"text/javascript", "/static/js/clipboard.js"});
}
Comment thread
ArneBab marked this conversation as resolved.

createRequestTableButtons(form, pageMaker, ctx, mimeType, hasFriends, advancedModeEnabled, priorityClasses, true, queueType);

Expand Down
9 changes: 9 additions & 0 deletions src/freenet/clients/http/staticfiles/color.css
Original file line number Diff line number Diff line change
Expand Up @@ -431,3 +431,12 @@ div#statusbar div.separator {
}


.copy-to-clipboard-element {
user-select: none; /* do not copy this text */
cursor: pointer; /* this is an action */
}
.copy-to-clipboard-element:active {
color: red;
font-weight: bold;
}

25 changes: 25 additions & 0 deletions src/freenet/clients/http/staticfiles/js/clipboard.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// @license magnet:?xt=urn:btih:1f739d935676111cfff4b4693e3816e664797050&dn=gpl-3.0.txt GPL-v3-or-Later
if (typeof(document.addCopyKeyFieldToFinishedTransfers) === 'undefined') {
function addCopyKeyFieldToFinishedTransfers () {
if (navigator.clipboard) {
var matching = document.getElementsByClassName('copy-to-clipboard');
for (var matchingElement of matching) {
// must use const to avoid the weird scoping of var replacing all text with the last element
// const for declaration is usable in IE11+.
const text = matchingElement.dataset.copytext;
if (text) {
var toClipboard = document.createElement('span');
// SVG image thanks to bertm!
toClipboard.innerHTML = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" style="height: 1em; width: 1em; margin-inline-start: .5ex; vertical-align: middle;"><path stroke="currentColor" stroke-width="2" d="M 2 16 v -12 a 2 2 0 0 1 2 -2 h 12 M 9 7 h 10 a 2 2 0 0 1 2 2 v 10 a 2 2 0 0 1 -2 2 h -10 a 2 2 0 0 1 -2 -2 v -10 a 2 2 0 0 1 2 -2" fill="none"></path></svg>';
toClipboard.classList.add('copy-to-clipboard-element');
toClipboard.setAttribute('title', matchingElement.dataset.copytitle);
toClipboard.onclick = () => navigator.clipboard.writeText(text);
matchingElement.after(toClipboard);
}
}
}
}
document.addCopyKeyFieldToFinishedTransfers = addCopyKeyFieldToFinishedTransfers;
document.addEventListener('DOMContentLoaded', addCopyKeyFieldToFinishedTransfers);
}
// @license-end
10 changes: 10 additions & 0 deletions src/freenet/clients/http/staticfiles/themes/boxed/color.css
Comment thread
ArneBab marked this conversation as resolved.
Original file line number Diff line number Diff line change
Expand Up @@ -260,3 +260,13 @@ div#statusbar div.separator {
background-color: black;
}


.copy-to-clipboard-element {
user-select: none; /* do not copy this text */
cursor: pointer; /* this is an action */
}
.copy-to-clipboard-element:active {
color: red;
font-weight: bold;
}

10 changes: 10 additions & 0 deletions src/freenet/clients/http/staticfiles/themes/clean/color.css
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,13 @@
/*
* Statusbar
*/

.copy-to-clipboard-element {
user-select: none; /* do not copy this text */
cursor: pointer; /* this is an action */
}
.copy-to-clipboard-element:active {
color: red;
font-weight: bold;
}

10 changes: 10 additions & 0 deletions src/freenet/clients/http/staticfiles/themes/grayandblue/color.css
Original file line number Diff line number Diff line change
Expand Up @@ -289,3 +289,13 @@ tr.priority6, td.priority6 {
background-color: transparent !important;
}


.copy-to-clipboard-element {
user-select: none; /* do not copy this text */
cursor: pointer; /* this is an action */
}
.copy-to-clipboard-element:active {
color: red;
font-weight: bold;
}

10 changes: 10 additions & 0 deletions src/freenet/clients/http/staticfiles/themes/sky/color.css
Original file line number Diff line number Diff line change
Expand Up @@ -229,3 +229,13 @@ table.queue span.progress_fraction_finalized {
#statusbar div.separator {
background-color: #d0d0f0;
}

.copy-to-clipboard-element {
user-select: none; /* do not copy this text */
cursor: pointer; /* this is an action */
}
.copy-to-clipboard-element:active {
color: red;
font-weight: bold;
}

10 changes: 10 additions & 0 deletions src/freenet/clients/http/staticfiles/themes/winterfacey/theme.css
Original file line number Diff line number Diff line change
Expand Up @@ -1482,6 +1482,16 @@ body[id*="Sone"] {
}


.copy-to-clipboard-element {
user-select: none; /* do not copy this text */
cursor: pointer; /* this is an action */
}
.copy-to-clipboard-element:active {
color: red;
font-weight: bold;
}



/** Media query **/
@media (max-width: 1500px) {
Expand Down
1 change: 1 addition & 0 deletions src/freenet/l10n/freenet.l10n.en.properties
Original file line number Diff line number Diff line change
Expand Up @@ -1645,6 +1645,7 @@ QueueToadlet.UinProgress=Uploads in progress (${size})
QueueToadlet.cancelSelected=Cancel
QueueToadlet.compatModeLabel=Compatibility mode
QueueToadlet.compatibilityMode=Compatibility mode
QueueToadlet.copyToClipboardTitle=Copy to Clipboard
QueueToadlet.change=Change
QueueToadlet.changeDownloadPriorities=Change priority of downloads
QueueToadlet.changeUploadPriorities=Change priority of uploads
Expand Down