2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-01-31 12:49:34 +00:00

fhemweb.js: tell the user if the copy text was truncated (Forum #129858)

git-svn-id: https://svn.fhem.de/fhem/trunk@26801 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig 2022-12-06 17:05:16 +00:00
parent b9d32307a8
commit f78cdc4495

View File

@ -1001,16 +1001,17 @@ FW_detLink()
} else if(cmd == "forumCopy") { } else if(cmd == "forumCopy") {
FW_cmd(FW_root+"?cmd=list -r -i "+dev+"&XHR=1", function(data) { FW_cmd(FW_root+"?cmd=list -r -i "+dev+"&XHR=1", function(data) {
var ta = document.createElement("textarea"); var ta = document.createElement("textarea"), at="";
if(data.length > 50*1000) { if(data.length > 50*1000) {
data = data.substr(0,50*1000)+ data = data.substr(0,50*1000)+
"\n# ... truncated to 50k, original length "+data.length; "\n# ... truncated to 50k, original length "+data.length;
at = "<br><br>Text truncated to 50k due to forum restrictions.";
} }
ta.value = '[code]'+data+'[/code]'; ta.value = '[code]'+data+'[/code]';
document.body.appendChild(ta); document.body.appendChild(ta);
ta.select(); ta.select();
if(document.execCommand('copy')) if(document.execCommand('copy'))
FW_okDialog('"forum ready" definition copied to the clipboard.'); FW_okDialog('"forum ready" definition copied to the clipboard.'+at);
else else
FW_okDialog('Could not copy'); FW_okDialog('Could not copy');
document.body.removeChild(ta); document.body.removeChild(ta);