diff options
author | nodiscc <nodiscc@gmail.com> | 2014-08-11 00:04:51 +0200 |
---|---|---|
committer | nodiscc <nodiscc@gmail.com> | 2014-08-11 00:13:29 +0200 |
commit | a1795ddcf3d1dcef0ca213a5bfb75b8237dfb646 (patch) | |
tree | 45c3e66bba3f783f6c59b17f2d539061d44c8208 | |
parent | e411f7f9d7682256fdba017d409e8356c4644ab9 (diff) | |
download | Shaarli-a1795ddcf3d1dcef0ca213a5bfb75b8237dfb646.tar.gz Shaarli-a1795ddcf3d1dcef0ca213a5bfb75b8237dfb646.tar.zst Shaarli-a1795ddcf3d1dcef0ca213a5bfb75b8237dfb646.zip |
bookmarklet: use selected text as description when adding a new link
* Based on romnGit's work at https://github.com/sebsauvage/Shaarli/pull/104
* Fixes https://github.com/shaarli/Shaarli/issues/18
* Closes https://github.com/sebsauvage/Shaarli/pull/104
* Fixes https://github.com/sebsauvage/Shaarli/issues/53
* Fixes https://github.com/sebsauvage/Shaarli/issues/129
* Fixes https://github.com/sebsauvage/Shaarli/issues/33
-rw-r--r-- | index.php | 6 | ||||
-rw-r--r-- | tpl/tools.html | 2 |
2 files changed, 4 insertions, 4 deletions
@@ -425,7 +425,7 @@ if (isset($_POST['login'])) | |||
425 | session_regenerate_id(true); | 425 | session_regenerate_id(true); |
426 | } | 426 | } |
427 | // Optional redirect after login: | 427 | // Optional redirect after login: |
428 | if (isset($_GET['post'])) { header('Location: ?post='.urlencode($_GET['post']).(!empty($_GET['title'])?'&title='.urlencode($_GET['title']):'').(!empty($_GET['source'])?'&source='.urlencode($_GET['source']):'')); exit; } | 428 | if (isset($_GET['post'])) { header('Location: ?post='.urlencode($_GET['post']).(!empty($_GET['title'])?'&title='.urlencode($_GET['title']):'').(!empty($_GET['description'])?'&description='.urlencode($_GET['description']):'').(!empty($_GET['source'])?'&source='.urlencode($_GET['source']):'')); exit; } |
429 | if (isset($_POST['returnurl'])) | 429 | if (isset($_POST['returnurl'])) |
430 | { | 430 | { |
431 | if (endsWith($_POST['returnurl'],'?do=login')) { header('Location: ?'); exit; } // Prevent loops over login screen. | 431 | if (endsWith($_POST['returnurl'],'?do=login')) { header('Location: ?'); exit; } // Prevent loops over login screen. |
@@ -437,7 +437,7 @@ if (isset($_POST['login'])) | |||
437 | { | 437 | { |
438 | ban_loginFailed(); | 438 | ban_loginFailed(); |
439 | $redir = ''; | 439 | $redir = ''; |
440 | if (isset($_GET['post'])) { $redir = '&post='.urlencode($_GET['post']).(!empty($_GET['title'])?'&title='.urlencode($_GET['title']):'').(!empty($_GET['source'])?'&source='.urlencode($_GET['source']):''); } | 440 | if (isset($_GET['post'])) { $redir = '&post='.urlencode($_GET['post']).(!empty($_GET['title'])?'&title='.urlencode($_GET['title']):'').(!empty($_GET['description'])?'&description='.urlencode($_GET['description']):'').(!empty($_GET['source'])?'&source='.urlencode($_GET['source']):''); } |
441 | echo '<script language="JavaScript">alert("Wrong login/password.");document.location=\'?do=login'.$redir.'\';</script>'; // Redirect to login screen. | 441 | echo '<script language="JavaScript">alert("Wrong login/password.");document.location=\'?do=login'.$redir.'\';</script>'; // Redirect to login screen. |
442 | exit; | 442 | exit; |
443 | } | 443 | } |
@@ -1336,7 +1336,7 @@ function renderPage() | |||
1336 | // Show login screen, then redirect to ?post=... | 1336 | // Show login screen, then redirect to ?post=... |
1337 | if (isset($_GET['post'])) | 1337 | if (isset($_GET['post'])) |
1338 | { | 1338 | { |
1339 | header('Location: ?do=login&post='.urlencode($_GET['post']).(!empty($_GET['title'])?'&title='.urlencode($_GET['title']):'').(!empty($_GET['source'])?'&source='.urlencode($_GET['source']):'')); // Redirect to login page, then back to post link. | 1339 | header('Location: ?do=login&post='.urlencode($_GET['post']).(!empty($_GET['title'])?'&title='.urlencode($_GET['title']):'').(!empty($_GET['description'])?'&description='.urlencode($_GET['description']):'').(!empty($_GET['source'])?'&source='.urlencode($_GET['source']):'')); // Redirect to login page, then back to post link. |
1340 | exit; | 1340 | exit; |
1341 | } | 1341 | } |
1342 | $PAGE = new pageBuilder; | 1342 | $PAGE = new pageBuilder; |
diff --git a/tpl/tools.html b/tpl/tools.html index 48ecc97e..ba1c1e8e 100644 --- a/tpl/tools.html +++ b/tpl/tools.html | |||
@@ -10,7 +10,7 @@ | |||
10 | <a href="?do=changetag"><b>Rename/delete tags</b> <span>: Rename or delete a tag in all links</span></a><br><br> | 10 | <a href="?do=changetag"><b>Rename/delete tags</b> <span>: Rename or delete a tag in all links</span></a><br><br> |
11 | <a href="?do=import"><b>Import</b> <span>: Import Netscape html bookmarks (as exported from Firefox, Chrome, Opera, delicious...)</span></a> <br><br> | 11 | <a href="?do=import"><b>Import</b> <span>: Import Netscape html bookmarks (as exported from Firefox, Chrome, Opera, delicious...)</span></a> <br><br> |
12 | <a href="?do=export"><b>Export</b> <span>: Export Netscape html bookmarks (which can be imported in Firefox, Chrome, Opera, delicious...)</span></a><br><br> | 12 | <a href="?do=export"><b>Export</b> <span>: Export Netscape html bookmarks (which can be imported in Firefox, Chrome, Opera, delicious...)</span></a><br><br> |
13 | <a class="smallbutton" onclick="alert('Drag this link to your bookmarks toolbar, or right-click it and choose Bookmark This Link...');return false;" href="javascript:javascript:(function(){var%20url%20=%20location.href;var%20title%20=%20document.title%20||%20url;window.open('{$pageabsaddr}?post='%20+%20encodeURIComponent(url)+'&title='%20+%20encodeURIComponent(title)+'&source=bookmarklet','_blank','menubar=no,height=390,width=600,toolbar=no,scrollbars=no,status=no,dialog=1');})();"><b>Shaare link</b></a> <a href="#" style="clear:none;"><span>⇐ Drag this link to your bookmarks toolbar (or right-click it and choose Bookmark This Link....).<br> Then click "Shaare link" button in any page you want to share.</span></a><br><br> | 13 | <a class="smallbutton" onclick="alert('Drag this link to your bookmarks toolbar, or right-click it and choose Bookmark This Link...');return false;" href="javascript:javascript:(function(){var%20url%20=%20location.href;var%20title%20=%20document.title%20||%20url;window.open('{$pageabsaddr}?post='%20+%20encodeURIComponent(url)+'&title='%20+%20encodeURIComponent(title)+'&description='%20+%20encodeURIComponent(document.getSelection())+'&source=bookmarklet','_blank','menubar=no,height=390,width=600,toolbar=no,scrollbars=no,status=no,dialog=1');})();"><b>Shaare link</b></a> <a href="#" style="clear:none;"><span>⇐ Drag this link to your bookmarks toolbar (or right-click it and choose Bookmark This Link....).<br> Then click "Shaare link" button in any page you want to share.</span></a><br><br> |
14 | <div class="clear"></div> | 14 | <div class="clear"></div> |
15 | </div> | 15 | </div> |
16 | </div> | 16 | </div> |