file_share.html 32 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647
  1. <html>
  2. <head>
  3. <title locale="title/title">File Share</title>
  4. <link rel="stylesheet" href="../../script/semantic/semantic.min.css">
  5. <script src="../../script/jquery.min.js"></script>
  6. <script src="../../script/semantic/semantic.min.js"></script>
  7. <script src="../../script/ao_module.js"></script>
  8. <script type="text/javascript" src="../../script/applocale.js"></script>
  9. <script type="text/javascript" src="../../script/qrcode.min.js"></script>
  10. <meta charset="UTF-8">
  11. <meta name="viewport" content="width=device-width, initial-scale=1.0 user-scalable=no">
  12. <style>
  13. body:not(.darkTheme){
  14. background: rgba(255,255,255,01) !important;
  15. }
  16. body.darkTheme{
  17. background-color: #242330 !important;
  18. }
  19. .sub.header.darkTheme{
  20. color: rgba(255, 255, 255, 0.623) !important;
  21. }
  22. .darkTheme:not(a){
  23. color: #eeeeee;
  24. }
  25. .yellow.message.darkTheme{
  26. box-shadow: none !important;
  27. border: 0px solid transparent !important;
  28. background-color: #5e550e !important;
  29. }
  30. .dropDown.darkTheme:not(.icon){
  31. background-color: #413f57 !important;
  32. border: 1px solid white;
  33. }
  34. .dropdown.darkThem .ui.label{
  35. color: rgb(175, 175, 175);
  36. background-color: #2f2d3d !important;
  37. }
  38. .dropdown.darkThem .ui.label:hover{
  39. color: white;
  40. opacity: 0.8;
  41. }
  42. </style>
  43. </head>
  44. <body>
  45. <div id="main" class="ui stackable grid">
  46. <div class="eight wide column">
  47. <div style="width: 100%;" class="qrcode" align="center">
  48. <div style="display: block; margin-left: auto; margin-right: auto;" align="center">
  49. <div id="qrcode" style="border: 10px solid white; background-color: white;">
  50. <h1><br><i class="ui loading spinner icon"></i><br></h1>
  51. </div>
  52. </div>
  53. <div style="width: 80%; text-align: center;">
  54. <a id="sharelink" href="" target="_blank" style="margin-top:8px; font-size: 120%; padding-left: 20px; padding-right: 20px; word-break: break-all; overflow-wrap: anywhere;"></a>
  55. </div>
  56. </div>
  57. </div>
  58. <div id="shareSettingOptions" class="eight wide column" style="padding-left: 12px; display:none;">
  59. <div class="ui header whiteTheme">
  60. <span locale="share/setting/title">Share Settings</span>
  61. <div class="sub header whiteTheme" locale="share/setting/subtitle">Change who can see this file</div>
  62. </div>
  63. <div id="shareSettingForm" class="ui form">
  64. <div class="field">
  65. <label><p class="whiteTheme" locale="share/setting/options">Visable options:</p></label>
  66. <div class="ui checkboxes">
  67. <div class="ui radio checkbox">
  68. <input id="anyone" type="radio" class="shareoption" name="shareopt" value="anyone" onchange="updateSharePermission(this);">
  69. <label for="anyone">
  70. <div class="ui header">
  71. <div class="content whiteTheme">
  72. <i class="globe icon"></i> <span locale="share/setting/anyoneWithLink">Anyone with the link</span>
  73. <div class="sub header whiteTheme" locale="share/setting/anyoneWithLink/desc">Anyone who has the link can access this file</div>
  74. </div>
  75. </div>
  76. </label>
  77. </div>
  78. <br><br>
  79. <div class="ui radio checkbox">
  80. <input id="signedin" type="radio" class="shareoption" value="signedin" name="shareopt" onchange="updateSharePermission(this);">
  81. <label for="signedin">
  82. <div class="ui header">
  83. <div class="content whiteTheme">
  84. <i class="user circle outline icon"></i> <span locale="share/setting/anyoneSignedIn">Anyone signed in</span>
  85. <div class="sub header whiteTheme" locale="share/setting/anyoneSignedIn/desc">Anyone who has signed in can access this file</div>
  86. </div>
  87. </div>
  88. </label>
  89. </div>
  90. <br><br>
  91. <div class="ui radio checkbox">
  92. <input id="samegroup" type="radio" class="shareoption" value="samegroup" name="shareopt" onchange="updateSharePermission(this);">
  93. <label for="samegroup">
  94. <div class="ui header">
  95. <div class="content whiteTheme">
  96. <i class="users icon"></i> <span locale="share/setting/sameGroup">Users in the same group</span>
  97. <div class="sub header whiteTheme" locale="share/setting/sameGroup/desc">Anyone who is in the same group as you do</div>
  98. </div>
  99. </div>
  100. </label>
  101. </div>
  102. <br><br>
  103. <div class="ui accordion" id="advanceShare">
  104. <div class="title">
  105. <i class="dropdown icon"></i>
  106. <span locale="share/setting/advance/title">Advance Share Options</span>
  107. </div>
  108. <div class="content">
  109. <div class="ui radio checkbox">
  110. <input id="users" type="radio" class="shareoption" value="users" name="shareopt" onchange="updateSharePermission(this);">
  111. <label for="users">
  112. <div class="ui header">
  113. <div class="content whiteTheme">
  114. <i class="clipboard check icon"></i> <span locale="share/setting/advance/users">Selected Users</span>
  115. <div class="sub header whiteTheme" locale="share/setting/advance/usersDesc">Selected users with matching user name</div>
  116. </div>
  117. </div>
  118. </label>
  119. </div>
  120. <div id="userselector">
  121. <p style="margin-top: 1em;" locale="share/setting/advance/usersInstruct"">Select target users from the list below</p>
  122. <select id="targetUsersList" class="ui fluid search dropdown" multiple="">
  123. <option value="">Users</option>
  124. </select>
  125. <div id="noUserWarning" class="ui yellow message" style="display:none;">
  126. <i class="caret up icon"></i> <span locale="share/setting/advance/addUserToSave">Add at least one target share user to save changes</span>
  127. </div>
  128. </div>
  129. <div class="ui radio checkbox" style="margin-top: 1em;">
  130. <input id="groups" type="radio" class="shareoption" value="groups" name="shareopt" onchange="updateSharePermission(this);">
  131. <label for="groups">
  132. <div class="ui header">
  133. <div class="content whiteTheme">
  134. <i class="sitemap icon"></i> <span locale="share/setting/advance/groups">Selected Groups</span>
  135. <div class="sub header whiteTheme" locale="share/setting/advance/groupsDesc">All the users that has access to any one of the selected group(s)</div>
  136. </div>
  137. </div>
  138. </label>
  139. </div>
  140. <div id="groupselector">
  141. <p style="margin-top: 1em;" locale="share/setting/advance/groupsInstruct">Select target groups from the list below</p>
  142. <select id="targetGroupList" class="ui fluid search dropdown" multiple="">
  143. <option value="">Groups</option>
  144. </select>
  145. <div id="noGroupWarning" class="ui yellow message" style="display:none;">
  146. <i class="caret up icon"></i> <span locale="share/setting/advance/addGroupToSave">Add at least one target share group to save changes</span>
  147. </div>
  148. </div>
  149. </div>
  150. </div>
  151. <br><br>
  152. <div id="udpateNotification" style="display:none; position: fixed; bottom: 1em; right: 1em;" class="ui green inverted segment">
  153. <i class=" checkmark icon"></i> <span locale="share/setting/updated">Share Setting Updated</span>
  154. </div>
  155. </div>
  156. </div>
  157. </div>
  158. </div>
  159. </div>
  160. <div class="ui divider actionButton"></div>
  161. <div class="actionButton" style="width: 100%; padding-right: 12px;" align="right">
  162. <div class="ui button popupbuttons whiteTheme allowHover" onclick="copyLinkToClipboard(this)">
  163. <i class="copy icon"></i> <span locale="button/copy">Copy</span>
  164. </div>
  165. <div id="sharingRemoveBtn" class="ui red button popupbuttons negative whiteTheme allowHover" onclick="removeSharing()">
  166. <i class="remove icon"></i> <span locale="button/remove">Remove</span>
  167. </div>
  168. </div>
  169. <script>
  170. /*
  171. Usage: Pass in file descriptor to start share a file
  172. var fd = encodeURIComponent(JSON.stringify({
  173. filename: "test.txt",
  174. filepath: "user:/Desktop/test.txt"
  175. })
  176. );
  177. window.open("file_share.html#" + fd);
  178. If you want to preset a file sharing mode (aka your module handle the share mode picking),
  179. Pass in with the "shareMode" paramter. Example fd as follow:
  180. {
  181. filename: "test.txt",
  182. filepath: "user:/Desktop/test.txt",
  183. shareMode: "signedin"
  184. }
  185. To remove a share, pass in "remove" for the share mode
  186. Supported Share Mode keywords {anyone/signedin/samegroup/remove}
  187. Other supported flags
  188. {
  189. QRCode: {true/false} //Show or Hide the QR Code and link
  190. ActionButtons: {true/false} //Show or Hide the action button on the bottom
  191. }
  192. */
  193. var shareCurrentEditingUUID = "";
  194. var shareingFileData = {};
  195. var darkTheme = false;
  196. var initialized = false;
  197. var fileSharingURL = "";
  198. var relpath = "../../";
  199. function applyDarkThemeMode(){
  200. $(".whiteTheme").removeClass("whiteTheme").addClass("darkTheme");
  201. $("*:not(button)").addClass("darkTheme");
  202. $("body").addClass("darkTheme");
  203. $(".ui.button").addClass("inverted");
  204. darkTheme = true;
  205. }
  206. function removeQRCodeInDarkTheme(){
  207. if (darkTheme){
  208. $("#qrcode").css({
  209. "border":"0px solid transparent",
  210. "background-color":"#242330",
  211. })
  212. }
  213. }
  214. if ($(parent) && $(parent.document).find("body").hasClass("darkTheme")){
  215. //Switch to darkTheme mode immediately
  216. applyDarkThemeMode();
  217. }
  218. PageReady();
  219. function PageReady(){
  220. if (initialized){
  221. return;
  222. }
  223. //Load User & Group List
  224. $.get(relpath + "../system/users/list", function(data){
  225. var groups = {};
  226. $("#targetUsersList").html(`<option value="">Users</option>`);
  227. data.forEach(user => {
  228. $("#targetUsersList").append(`<option value="${user[0]}">${user[0]}</option>`);
  229. var userGroups = user[1];
  230. userGroups.forEach(thisGroup => {
  231. groups[thisGroup] = true;
  232. });
  233. });
  234. $("#targetGroupList").html(`<option value="">Groups</option>`);
  235. for (var [key, value] of Object.entries(groups)) {
  236. $("#targetGroupList").append(`<option value="${key}">${key}</option>`);
  237. }
  238. //Initiate the share details
  239. initFileDetails(shareingFileData, function(shareUUID){
  240. //Set the mode of share if it is defined
  241. if (shareingFileData.shareMode !== undefined && shareingFileData.shareMode == "remove"){
  242. //Remove the share UUID
  243. removeSharing();
  244. return;
  245. }
  246. if (shareingFileData.shareMode !== undefined){
  247. //As the share mode is defined by the caller, hide the setting interface
  248. $("#shareSettingOptions").hide();
  249. $("#sharelink").parent().css({
  250. "width": "100%",
  251. "text-align": "left",
  252. });
  253. $.ajax({
  254. url: relpath + "../system/file_system/share/edit",
  255. data: {uuid: shareCurrentEditingUUID, mode: shareingFileData.shareMode},
  256. success: function(data){
  257. if (data.error !== undefined){
  258. alert(data.error);
  259. return;
  260. }
  261. //Update the checkbox
  262. $(".shareoption").each(function(){
  263. if ($(this)[0].value != shareingFileData.shareMode){
  264. $(this)[0].checked = false;
  265. }else{
  266. $(this)[0].checked = true;
  267. }
  268. });
  269. }
  270. });
  271. }else{
  272. //Default: show the setting to allow user adjustment
  273. $("#main").css({
  274. "margin-top":"0em",
  275. "padding": "4px"
  276. });
  277. $("#shareSettingOptions").show();
  278. }
  279. $(".accordion").accordion();
  280. });
  281. });
  282. //Load theme style
  283. $.get(relpath + "../system/file_system/preference?key=file_explorer/theme",function(data){
  284. if (data == "darkTheme"){
  285. applyDarkThemeMode();
  286. }
  287. });
  288. initialized = true;
  289. //Do localization
  290. applocale.init(relpath + "../SystemAO/locale/file_share.json", function(){
  291. applocale.translate();
  292. });
  293. $(".checkbox").checkbox();
  294. $(".dropdown").dropdown();
  295. var inputFile = ao_module_loadInputFiles();
  296. if (inputFile == null){
  297. //No file selected
  298. $(".shareoption").parent().addClass("disabled");
  299. $("#qrcode").html(`<h1>No File</h1>`);
  300. $("#sharelink").text(``);
  301. $("#sharingRemoveBtn").addClass("disabled");
  302. return
  303. }
  304. //Make sure one file is choicen each time
  305. inputFile = inputFile[0];
  306. console.log("inputFile", inputFile);
  307. shareingFileData = inputFile;
  308. //Filter out the nessary display flags
  309. if (shareingFileData.QRCode !== undefined && shareingFileData.QRCode == false){
  310. $(".qrcode").hide();
  311. $("#shareSettingOptions").attr("class", "sixteen wide column");
  312. $("#shareSettingOptions").css("padding", "1em");
  313. $(".eight.wide").hide();
  314. }
  315. if (shareingFileData.ActionButtons !== undefined && shareingFileData.ActionButtons == false){
  316. $(".actionButton").hide();
  317. }
  318. }
  319. function initFileDetails(shareingFileData, callback=undefined){
  320. $.ajax({
  321. url: relpath + "../system/file_system/share/new",
  322. data: {path: shareingFileData.filepath},
  323. success: function(data){
  324. if (data.error !== undefined){
  325. alert(data.error);
  326. }else{
  327. console.log(data);
  328. updateShareLinkInfo(data.UUID);
  329. shareCurrentEditingUUID = data.UUID;
  330. $(".shareoption").each(function(){
  331. if ($(this)[0].value != data.Permission){
  332. $(this)[0].checked = false;
  333. }else{
  334. $(this)[0].checked = true;
  335. if (data.Permission == "users"){
  336. $("#advanceShare").accordion("open", 0);
  337. $("#targetUsersList").dropdown("set selected", data.Accessibles);
  338. $("#targetUsersList").parent().removeClass("disabled");
  339. $("#targetGroupList").parent().addClass("disabled");
  340. }else if (data.Permission == "groups"){
  341. $("#advanceShare").accordion("open", 0);
  342. $("#targetGroupList").dropdown("set selected", data.Accessibles);
  343. $("#targetUsersList").parent().addClass("disabled");
  344. $("#targetGroupList").parent().removeClass("disabled");
  345. }else{
  346. $("#targetGroupList").parent().addClass("disabled");
  347. $("#targetUsersList").parent().addClass("disabled");
  348. }
  349. }
  350. });
  351. $("#targetUsersList").on("change", function(evt){
  352. updateSharePermissionByType("users");
  353. });
  354. $("#targetGroupList").on("change", function(evt){
  355. updateSharePermissionByType("groups");
  356. });
  357. //If the file is from desktop, set share icon
  358. if (ao_module_virtualDesktop == true){
  359. var fileDir = shareingFileData.filepath.split("/");
  360. fileDir.pop();
  361. fileDir = fileDir.join("/");
  362. if (fileDir == "user:/Desktop"){
  363. //Remove share icon
  364. parent.setFileShareIndicator(shareingFileData.filename);
  365. }
  366. }
  367. if (callback != undefined){
  368. callback(data.UUID)
  369. }
  370. }
  371. }
  372. });
  373. }
  374. function removeSharing(){
  375. if (shareCurrentEditingUUID == ""){
  376. return
  377. }
  378. //The target file to remove
  379. $.ajax({
  380. url: relpath + "../system/file_system/share/delete",
  381. data: {uuid: shareCurrentEditingUUID},
  382. success: function(data){
  383. if (data.error !== undefined){
  384. alert(data.error);
  385. }else{
  386. //Removed!
  387. $(".button").addClass('disabled');
  388. $(".checkbox").addClass("disabled");
  389. $("#sharelink").text("");
  390. $("#sharelink").attr("href", "#");
  391. $("#qrcode").html(`<br><br><h1><i class="green checkmark icon"></i> ${applocale.getString("message/removed", "Share Removed")}</h1>`);
  392. removeQRCodeInDarkTheme();
  393. //If the file is located on desktop and it is web desktop mode
  394. if (ao_module_virtualDesktop == true){
  395. var fileDir = shareingFileData.filepath.split("/");
  396. fileDir.pop();
  397. fileDir = fileDir.join("/");
  398. if (fileDir == "user:/Desktop"){
  399. //Remove share icon
  400. parent.removeFileShareIndicator(shareingFileData.filename);
  401. }
  402. }
  403. }
  404. }
  405. });
  406. }
  407. function updateSharePermission(object){
  408. var newPermission = $(object).attr('value');
  409. updateSharePermissionByType(newPermission);
  410. }
  411. function updateSharePermissionByType(newPermission){
  412. if (newPermission == "users"){
  413. //Build the user list
  414. $("#targetUsersList").parent().removeClass("disabled");
  415. $("#targetGroupList").parent().addClass("disabled");
  416. var selectedUsers = $("#targetUsersList").val();
  417. $("#noGroupWarning").slideUp("fast");
  418. if (selectedUsers.length == 0){
  419. //Show tips message
  420. $("#noUserWarning").slideDown("fast");
  421. return;
  422. }else{
  423. $("#noUserWarning").slideUp("fast");
  424. }
  425. //Rewrite it to permission handling description
  426. newPermission = "users:" + selectedUsers.join(",");
  427. }else if (newPermission == "groups"){
  428. //Build the group list
  429. $("#targetUsersList").parent().addClass("disabled");
  430. $("#targetGroupList").parent().removeClass("disabled");
  431. var selectedGroups = $("#targetGroupList").val();
  432. $("#noUserWarning").slideUp("fast");
  433. if (selectedGroups.length == 0){
  434. //Show tips message
  435. $("#noGroupWarning").slideDown("fast");
  436. return;
  437. }else{
  438. $("#noGroupWarning").slideUp("fast");
  439. }
  440. //Rewrite it to permission handling description
  441. newPermission = "groups:" + selectedGroups.join(",");
  442. }
  443. $.ajax({
  444. url: relpath + "../system/file_system/share/edit",
  445. data: {uuid: shareCurrentEditingUUID, mode: newPermission},
  446. success: function(data){
  447. if (data.error !== undefined){
  448. alert(data.error);
  449. return;
  450. }
  451. $("#udpateNotification").stop().finish().fadeIn("fast").delay(3000).fadeOut("fast");
  452. }
  453. });
  454. }
  455. function updateShareLinkInfo(uuid){
  456. $("#qrcode").html("");
  457. let protocol = "https://";
  458. if (location.protocol !== 'https:') {
  459. protocol = "http://";
  460. }
  461. var port = ":" + window.location.port;
  462. if (window.location.port == ""){
  463. port = "";
  464. }
  465. var shareURL = protocol + window.location.hostname + port + "/share/" + uuid;
  466. shareCurrentEditingUUID = uuid;
  467. fileSharingURL = shareURL;
  468. new QRCode(document.getElementById("qrcode"), shareURL);
  469. $("#sharelink").text(shareURL);
  470. $("#sharelink").attr("href", shareURL)
  471. }
  472. /*
  473. Dynamic Script Loader
  474. This is a really experimental implementation of importing a script from anywhere
  475. under the ArozOS web root. This section of code must be written in plain JS to make sure
  476. it works without jQuery and other libraries.
  477. This function try to load jQuery and ao_module from the script folder.
  478. Also loading the semantic js and the css main body
  479. */
  480. /*
  481. //The possible location for desktop.system, standard webapp module, SystemAO interfaces and iui sub-interfaces
  482. let possibleLocations = ["script/", "../script/", "../../script/", "../../../script/"];
  483. let loopCount = Math.min(possibleLocations.length, JSON.parse(JSON.stringify(window.location.toString())).split("/").length - 3);
  484. function tryLoad(relpath, filename, successCallback=undefined){
  485. var request = new XMLHttpRequest();
  486. request.open('GET', relpath + filename, true);
  487. request.onreadystatechange = function(){
  488. if (request.readyState === 4){
  489. if (request.status == 200 || request.status == 304) {
  490. if (typeof(successCallback) != "undefined"){
  491. successCallback(relpath, filename);
  492. }
  493. }
  494. }
  495. };
  496. request.send();
  497. }
  498. function injectOtherJavaScriptLibrary(relpath){
  499. //Check if ao_module is loaded
  500. if (typeof(ao_module_virtualDesktop) == "undefined"){
  501. var script = document.createElement('script');
  502. script.setAttribute('src', relpath + "ao_module.js");
  503. document.getElementsByTagName('head')[0].appendChild(script);
  504. }else{
  505. //This routine already run
  506. return;
  507. }
  508. //Inject QR Code library
  509. var script = document.createElement('script');
  510. script.setAttribute('src', relpath + "qrcode.min.js");
  511. document.getElementsByTagName('head')[0].appendChild(script);
  512. //Inject applocale
  513. script = document.createElement('script');
  514. script.setAttribute('src', relpath + "applocale.js");
  515. document.getElementsByTagName('head')[0].appendChild(script);
  516. //Inject semmantic css and js anyway
  517. var head = document.getElementsByTagName('head')[0];
  518. var link = document.createElement('link');
  519. link.id = "semantic";
  520. link.rel = 'stylesheet';
  521. link.type = 'text/css';
  522. link.href = relpath + 'semantic/semantic.min.css';
  523. link.media = 'all';
  524. head.appendChild(link);
  525. var script = document.createElement('script');
  526. script.setAttribute('src', relpath + "semantic/semantic.min.js");
  527. document.getElementsByTagName('head')[0].appendChild(script);
  528. setTimeout(function(){
  529. PageReady();
  530. }, 1000);
  531. }
  532. //Load jQuery first
  533. if (typeof(window.jQuery) == "undefined"){
  534. //jQuery not found. Load it
  535. for (var i = 0; i < loopCount; i++){
  536. var relpath = possibleLocations[i];
  537. tryLoad(relpath, "jquery.min.js", function(relpath, filename){
  538. //Generate the jquery script element
  539. var script = document.createElement('script');
  540. script.setAttribute('src', relpath + filename);
  541. document.getElementsByTagName('head')[0].appendChild(script);
  542. doAfterJqueryLoaded(function(){
  543. injectOtherJavaScriptLibrary(relpath);
  544. });
  545. });
  546. }
  547. }else{
  548. //jQuery exists. Load ao_module
  549. injectOtherJavaScriptLibrary();
  550. }
  551. function doAfterJqueryLoaded(callback){
  552. setTimeout(function(){
  553. //Wait until it is loaded
  554. if (typeof(window.jQuery) == "undefined"){
  555. doAfterJqueryLoaded(callback);
  556. return
  557. }else{
  558. callback();
  559. }
  560. }), 300;
  561. }
  562. */
  563. function copyLinkToClipboard(btn){
  564. //Copy text
  565. const area = document.createElement('textarea');
  566. document.body.appendChild(area);
  567. area.value = fileSharingURL;
  568. area.select();
  569. document.execCommand('copy');
  570. document.body.removeChild(area);
  571. //Do visual feedback
  572. let oldContent = $(btn).html();
  573. $(btn).html(`<i class="green checkmark icon"></i> ${applocale.getString("button/copied","Copied!")}`);
  574. setTimeout(function(){
  575. $(btn).html(oldContent);
  576. }, 3000);
  577. }
  578. </script>
  579. </body>
  580. </html>