diff options
author | Aaron Parecki <aaron@parecki.com> | 2014-09-07 12:14:29 -0700 |
---|---|---|
committer | Aaron Parecki <aaron@parecki.com> | 2014-09-07 12:14:29 -0700 |
commit | 766fdc0660175f47b0494837092ab329f88dccd7 (patch) | |
tree | 28dc6d44bcdacb289c953c392d6c1789e3ccccfe | |
parent | 37c516216ef0321d63bdc1ba2683fb9b3e6b6e45 (diff) |
don't include quotes if no text is selected
-rw-r--r-- | views/partials/bookmark-bookmarklet.php | 2 |
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 ?>"; })(); |