1 // @license magnet:?xt=urn:btih:0b31508aeb0634b347b8270c7bee4d411b5d4109&dn=agpl-3.0.txt AGPLv3-or-later
2 // We append the linkPreview to a global Variable to make linkPreview
3 // accessable on other places. Note: search on other places before you
4 // delete or move the variable.
8 * Insert a link into friendica jot.
12 function jotGetLink() {
13 var currentText = $("#profile-jot-text").val();
14 var noAttachment = "";
15 reply = prompt(aStr.linkurl);
16 if (reply && reply.length) {
17 // There should be only one attachment per post.
18 // So we need to remove the old one.
19 $("#jot-attachment-preview").empty();
20 $("#profile-rotator").show();
21 if (currentText.includes("[attachment") && currentText.includes("[/attachment]")) {
22 noAttachment = "&noAttachment=1";
25 // We use the linkPreview library to have a preview
26 // of the attachments.
27 if (typeof linkPreview === "object") {
28 linkPreview.crawlText(reply + noAttachment);
30 // Fallback: insert the attachment bbcode directly into the textarea
31 // if the attachment live preview isn't available
33 $.get("parseurl?binurl=" + bin2hex(reply) + noAttachment, function (data) {
35 $("#profile-rotator").hide();
38 autosize.update($("#profile-jot-text"));