diff options
author | Benjamin Neff <benjamin@coding4coffee.ch> | 2018-01-20 04:52:27 +0300 |
---|---|---|
committer | Dennis Schubert <mail@dennis-schubert.de> | 2018-02-02 01:33:36 +0300 |
commit | f23966ef876f923b244bf0fe40bd3e1c0ba058b2 (patch) | |
tree | 85c076b529d635aac427faecdd00be2dc987f825 | |
parent | a72feee8124da24c5ba583fa2a048e97731c3769 (diff) |
Make mobile bookmarklet work the same way as with desktop UI
This fixes that it fails when you call it without notes parameter.
closes #7698
-rw-r--r-- | Changelog.md | 1 | ||||
-rw-r--r-- | app/assets/javascripts/mobile/bookmarklet.js | 15 |
2 files changed, 11 insertions, 5 deletions
diff --git a/Changelog.md b/Changelog.md index 1dd215e90..1b5f7cce3 100644 --- a/Changelog.md +++ b/Changelog.md @@ -7,6 +7,7 @@ ## Bug fixes * Fix invite link on the contacts page when the user has no contacts [#7690](https://github.com/diaspora/diaspora/pull/7690) +* Fixed the mobile bookmarklet when called without parameters [#7698](https://github.com/diaspora/diaspora/pull/7698) ## Features * Check if redis is running in script/server [#7685](https://github.com/diaspora/diaspora/pull/7685) diff --git a/app/assets/javascripts/mobile/bookmarklet.js b/app/assets/javascripts/mobile/bookmarklet.js index 94822c2ef..f8a3ba12d 100644 --- a/app/assets/javascripts/mobile/bookmarklet.js +++ b/app/assets/javascripts/mobile/bookmarklet.js @@ -6,16 +6,21 @@ $(document).ready(function() { return params.content; } - var content = params.title + " - " + params.url; - if (params.notes.length > 0) { - content += " - " + params.notes; + var separator = "\n\n"; + var contents = "### " + params.title + separator; + if (params.notes) { + var notes = params.notes.toString().replace(/(?:\r\n|\r|\n)/g, "\n> "); + contents += "> " + notes + separator; } - return content; + contents += params.url; + return contents; } var content = publisherContent(gon.preloads.bookmarklet); if (content.length > 0) { - $("#status_message_text").val(content); + var textarea = $("#status_message_text"); + textarea.val(content); + autosize.update(textarea); } }); // @license-end |