From 52ec490ad447b4c45a481a3e671b2ee5af44f698 Mon Sep 17 00:00:00 2001 From: Shikiryu Date: Sun, 8 Mar 2015 00:53:42 +0100 Subject: [PATCH] Adding tags in bookmarklet, fix #127 --- js/bookmarklet.js | 15 +++++++++++++-- templates/addBookmarklet.php | 6 +++--- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/js/bookmarklet.js b/js/bookmarklet.js index 39adbc20..3b19fa9e 100644 --- a/js/bookmarklet.js +++ b/js/bookmarklet.js @@ -25,8 +25,12 @@ function updateLoadingAnimation() { $(function () { $(".submit").click(function () { increaseAjaxCallCount(); - var dataString = 'url=' + $("input#url").val() + '&description=' + - $("textarea#description").val() + '&title=' + $("input#title").val(); + var tags = ''; + $('.tagit-choice .tagit-label').each(function() { + tags += '&item[tags][]='+$(this).text(); + }); + var dataString = 'url=' + $("input#url").val() + '&description=' + + $("textarea#description").val() + '&title=' + $("input#title").val() + tags; $.ajax({ type: "POST", url: "bookmark", @@ -48,6 +52,13 @@ $(function () { }); return false; }); + $.get('tag', function(data) { + $('.tags').tagit({ + allowSpaces: true, + availableTags : data, + placeholderText: t('bookmark', 'Tags') + }); + }); }); function closeWindow() { diff --git a/templates/addBookmarklet.php b/templates/addBookmarklet.php index ce7c8992..0de385f1 100644 --- a/templates/addBookmarklet.php +++ b/templates/addBookmarklet.php @@ -35,9 +35,9 @@ $bookmarkExists = $_['bookmarkExists'];