diff --git a/include/conversation.php b/include/conversation.php index 4573f44a4..4a05c916b 100644 --- a/include/conversation.php +++ b/include/conversation.php @@ -1083,9 +1083,7 @@ function status_editor(App $a, $x, $notes_cid = 0, $popup = false) '$geotag' => $geotag, '$nickname' => $x['nickname'], '$ispublic' => L10n::t('Visible to everybody'), - '$linkurl' => L10n::t('Please enter a link URL:'), - '$vidurl' => L10n::t("Please enter a video link/URL:"), - '$audurl' => L10n::t("Please enter an audio link/URL:"), + '$linkurl' => L10n::t('Please enter a image/video/audio/webpage URL:'), '$term' => L10n::t('Tag term:'), '$fileas' => L10n::t('Save to Folder:'), '$whereareu' => L10n::t('Where are you right now?'), @@ -1129,12 +1127,14 @@ function status_editor(App $a, $x, $notes_cid = 0, $popup = false) '$shortupload' => L10n::t('upload photo'), '$attach' => L10n::t('Attach file'), '$shortattach' => L10n::t('attach file'), - '$weblink' => L10n::t('Insert web link'), - '$shortweblink' => L10n::t('web link'), - '$video' => L10n::t('Insert video link'), - '$shortvideo' => L10n::t('video link'), - '$audio' => L10n::t('Insert audio link'), - '$shortaudio' => L10n::t('audio link'), + '$edbold' => L10n::t('Bold'), + '$editalic' => L10n::t('Italic'), + '$eduline' => L10n::t('Underline'), + '$edquote' => L10n::t('Quote'), + '$edcode' => L10n::t('Code'), + '$edimg' => L10n::t('Image'), + '$edurl' => L10n::t('Link'), + '$edattach' => L10n::t('Link or Media'), '$setloc' => L10n::t('Set your location'), '$shortsetloc' => L10n::t('set location'), '$noloc' => L10n::t('Clear browser location'), diff --git a/mod/parse_url.php b/mod/parse_url.php index a14379e70..f35c584fe 100644 --- a/mod/parse_url.php +++ b/mod/parse_url.php @@ -93,6 +93,7 @@ function parse_url_content(App $a) } } + $template = '[bookmark=%s]%s[/bookmark]%s'; $arr = ['url' => $url, 'text' => '']; @@ -124,6 +125,12 @@ function parse_url_content(App $a) unset($siteinfo['keywords']); + // Bypass attachment if parse url for a comment + if (!empty($_GET['noAttachment'])) { + echo $br . '[url=' . $url . ']' . $siteinfo['title'] . '[/url]'; + exit(); + } + // Format it as BBCode attachment $info = add_page_info_data($siteinfo); diff --git a/src/Object/Post.php b/src/Object/Post.php index 85d7a3b8c..e8bc29ac0 100644 --- a/src/Object/Post.php +++ b/src/Object/Post.php @@ -806,7 +806,8 @@ class Post extends BaseObject '$edcode' => L10n::t('Code'), '$edimg' => L10n::t('Image'), '$edurl' => L10n::t('Link'), - '$edvideo' => L10n::t('Video'), + '$edattach' => L10n::t('Link or Media'), + '$prompttext' => L10n::t('Please enter a image/video/audio/webpage URL:'), '$preview' => ((Feature::isEnabled($conv->getProfileOwner(), 'preview')) ? L10n::t('Preview') : ''), '$indent' => $indent, '$sourceapp' => L10n::t($a->sourcename), diff --git a/view/js/main.js b/view/js/main.js index 7e726248d..b2c469a6d 100644 --- a/view/js/main.js +++ b/view/js/main.js @@ -24,7 +24,7 @@ function openClose(theID) { } function openMenu(theID) { - var el = document.getElementById(theID) + var el = document.getElementById(theID); if (el) { el.style.display = "block"; diff --git a/view/theme/frio/js/textedit.js b/view/theme/frio/js/textedit.js index ad5f95023..bf68d0f5d 100644 --- a/view/theme/frio/js/textedit.js +++ b/view/theme/frio/js/textedit.js @@ -2,6 +2,47 @@ * @brief The file contains functions for text editing and commenting */ +function commentGetLink(id, prompttext) { + reply = prompt(prompttext); + if(reply && reply.length) { + reply = bin2hex(reply); + $.get('parse_url?noAttachment=1&binurl=' + reply, function(data) { + addCommentText(data, id); + }); + } +} + +function addCommentText(data, id) { + // get the textfield + var textfield = document.getElementById("comment-edit-text-" + id); + // check if the textfield does have the default-value + commentOpenUI(textfield, id); + // save already existent content + var currentText = $("#comment-edit-text-" + id).val(); + //insert the data as new value + textfield.value = currentText + data; + autosize.update($("#comment-edit-text-" + id)); +} + +function commentLinkDrop(event, id) { + var reply = event.dataTransfer.getData("text/uri-list"); + event.target.textContent = reply; + event.preventDefault(); + if (reply && reply.length) { + reply = bin2hex(reply); + $.get('parse_url?noAttachment=1&binurl=' + reply, function(data) { + addCommentText(data, id); + }); + } +} + +function commentLinkDropper(event) { + var linkFound = event.dataTransfer.types.contains("text/uri-list"); + if (linkFound) { + event.preventDefault(); + } +} + function insertFormatting(BBcode, id) { var tmpStr = $("#comment-edit-text-" + id).val(); diff --git a/view/theme/frio/templates/comment_item.tpl b/view/theme/frio/templates/comment_item.tpl index 8d90394d5..4ef5f2caa 100644 --- a/view/theme/frio/templates/comment_item.tpl +++ b/view/theme/frio/templates/comment_item.tpl @@ -43,11 +43,10 @@