From a1795ddcf3d1dcef0ca213a5bfb75b8237dfb646 Mon Sep 17 00:00:00 2001 From: nodiscc Date: Mon, 11 Aug 2014 00:04:51 +0200 Subject: [PATCH] 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 --- index.php | 6 +++--- tpl/tools.html | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/index.php b/index.php index 5dd0353..24b93fa 100644 --- a/index.php +++ b/index.php @@ -425,7 +425,7 @@ if (isset($_POST['login'])) session_regenerate_id(true); } // Optional redirect after login: - 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; } + 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; } if (isset($_POST['returnurl'])) { if (endsWith($_POST['returnurl'],'?do=login')) { header('Location: ?'); exit; } // Prevent loops over login screen. @@ -437,7 +437,7 @@ if (isset($_POST['login'])) { ban_loginFailed(); $redir = ''; - if (isset($_GET['post'])) { $redir = '&post='.urlencode($_GET['post']).(!empty($_GET['title'])?'&title='.urlencode($_GET['title']):'').(!empty($_GET['source'])?'&source='.urlencode($_GET['source']):''); } + 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']):''); } echo ''; // Redirect to login screen. exit; } @@ -1336,7 +1336,7 @@ function renderPage() // Show login screen, then redirect to ?post=... if (isset($_GET['post'])) { - 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. + 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. exit; } $PAGE = new pageBuilder; diff --git a/tpl/tools.html b/tpl/tools.html index 48ecc97..ba1c1e8 100644 --- a/tpl/tools.html +++ b/tpl/tools.html @@ -10,7 +10,7 @@ Rename/delete tags : Rename or delete a tag in all links

Import : Import Netscape html bookmarks (as exported from Firefox, Chrome, Opera, delicious...)

Export : Export Netscape html bookmarks (which can be imported in Firefox, Chrome, Opera, delicious...)

- Shaare link ⇐ Drag this link to your bookmarks toolbar (or right-click it and choose Bookmark This Link....).
    Then click "Shaare link" button in any page you want to share.


+ Shaare link ⇐ Drag this link to your bookmarks toolbar (or right-click it and choose Bookmark This Link....).
    Then click "Shaare link" button in any page you want to share.