summaryrefslogtreecommitdiff
path: root/views/partials/bookmark-bookmarklet.php
diff options
context:
space:
mode:
authorAaron Parecki <aaron@parecki.com>2014-09-07 12:14:29 -0700
committerAaron Parecki <aaron@parecki.com>2014-09-07 12:14:29 -0700
commit766fdc0660175f47b0494837092ab329f88dccd7 (patch)
tree28dc6d44bcdacb289c953c392d6c1789e3ccccfe /views/partials/bookmark-bookmarklet.php
parent37c516216ef0321d63bdc1ba2683fb9b3e6b6e45 (diff)
don't include quotes if no text is selected
Diffstat (limited to 'views/partials/bookmark-bookmarklet.php')
-rw-r--r--views/partials/bookmark-bookmarklet.php2
1 files changed, 1 insertions, 1 deletions
diff --git a/views/partials/bookmark-bookmarklet.php b/views/partials/bookmark-bookmarklet.php
index ae6ce93..1cd82f7 100644
--- a/views/partials/bookmark-bookmarklet.php
+++ b/views/partials/bookmark-bookmarklet.php
@@ -1,5 +1,5 @@
javascript:(function(){
var t;try{t=((window.getSelection&&window.getSelection())||(document.getSelection&&document.getSelection())||(document.selection&&document.selection.createRange&&document.selection.createRange().text));}catch(e){t="";};
- window.location="<?= Config::$base_url ?>bookmark?url="+encodeURIComponent(window.location.href)+"&content="+encodeURIComponent('"'+t+'"')+"&name="+encodeURIComponent(document.title)+"&token=<?= $this->token ?>";
+ window.location="<?= Config::$base_url ?>bookmark?url="+encodeURIComponent(window.location.href)+"&content="+encodeURIComponent((t ? '"'+t+'"' : ''))+"&name="+encodeURIComponent(document.title)+"&token=<?= $this->token ?>";
})();