From c8ef4de20155b4bf83339e1c10c6ff8a4b034ed1 Mon Sep 17 00:00:00 2001 From: Brice Maron Date: Mon, 2 Jul 2012 15:24:26 +0200 Subject: [PATCH] Transform load of bookmart to GET request. Idempotent query --- ajax/updateList.php | 8 ++++---- css/bookmarks.css | 15 +++++++++------ js/bookmarks.js | 12 +++++++----- 3 files changed, 20 insertions(+), 15 deletions(-) diff --git a/ajax/updateList.php b/ajax/updateList.php index 6f4cd7d0..6deced84 100644 --- a/ajax/updateList.php +++ b/ajax/updateList.php @@ -30,17 +30,17 @@ require_once(OC_App::getAppPath('bookmarks').'/bookmarksHelper.php'); $req_type= isset($_GET['type']) ? $_GET['type'] : 'bookmark'; if($req_type == 'rel_tags') { - $tags = analyzeTagRequest(isset($_POST['tag']) ? $_POST['tag'] : ''); + $tags = analyzeTagRequest(isset($_GET['tag']) ? $_GET['tag'] : ''); $qtags = OC_Bookmarks_Bookmarks::findTags($tags); OCP\JSON::success(array('data' => $qtags)); } else { // type == bookmark - $filterTag = analyzeTagRequest(isset($_POST['tag']) ? $_POST['tag'] : ''); + $filterTag = analyzeTagRequest(isset($_GET['tag']) ? $_GET['tag'] : ''); - $offset = isset($_POST['page']) ? intval($_POST['page']) * 10 : 0; + $offset = isset($_GET['page']) ? intval($_GET['page']) * 10 : 0; - $sort = isset($_POST['sort']) ? ($_POST['sort']) : 'bookmarks_sorting_recent'; + $sort = isset($_GET['sort']) ? ($_GET['sort']) : 'bookmarks_sorting_recent'; if($sort == 'bookmarks_sorting_clicks') { $sqlSortColumn = 'clickcount'; } else { diff --git a/css/bookmarks.css b/css/bookmarks.css index f82274a9..3bd15ca3 100644 --- a/css/bookmarks.css +++ b/css/bookmarks.css @@ -80,9 +80,6 @@ margin-right: 0.8em; } -.bookmark_url { display: none; color: #999; } -.bookmark_single:hover .bookmark_url { display: inline; } - .bm_view_list .bookmark_tags { position: absolute; top: 0.5em; @@ -269,14 +266,20 @@ li:hover em { display : none; } width: 228px; height: 160px } - +.bookmark_desc{ + min-height: 1em; +} +/* .bm_view_img .bookmark_single:hover .bookmark_url{ - display:block; + display:block; } .bm_view_img .bookmark_single .bookmark_url{ - display:block; + display:block; } +.bookmark_single:hover .bookmark_url { display: inline; }*/ +.bookmark_url { display: none; } + .bm_view_img .bookmark_actions { bottom: 0.7em; display: block; diff --git a/js/bookmarks.js b/js/bookmarks.js index e8bc1f22..9663adc3 100644 --- a/js/bookmarks.js +++ b/js/bookmarks.js @@ -62,18 +62,19 @@ function updateTagsList(tag) { function filterTagsChanged() { $('#bookmarkFilterTag').val($('#tag_filter input:hidden').val()); - bookmarks_page = 0; $('.bookmarks_list').empty(); + bookmarks_page = 0; getBookmarks(); } function getBookmarks() { if(bookmarks_loading) { //have patience :) return; - } + } + bookmarks_loading = true; //Update Rel Tags $.ajax({ - type: 'POST', + type: 'GET', url: OC.filePath('bookmarks', 'ajax', 'updateList.php') + '&type=rel_tags', data: {tag: $('#bookmarkFilterTag').val(), page:bookmarks_page, sort:bookmarks_sorting }, success: function(tags){ @@ -88,9 +89,8 @@ function getBookmarks() { } }); - $.ajax({ - type: 'POST', + type: 'GET', url: OC.filePath('bookmarks', 'ajax', 'updateList.php') + '&type=bookmark', data: {tag: $('#bookmarkFilterTag').val(), page:bookmarks_page, sort:bookmarks_sorting }, success: function(bookmarks){ @@ -197,6 +197,7 @@ function updateBookmarksList(bookmark) { '

'+ '' + encodeEntities(bookmark.title) + '' + '

' + + '

'+ encodeEntities(bookmark.description) + '

' + '

' + encodeEntities(bookmark.url) + '

' + '' ); @@ -221,6 +222,7 @@ function updateBookmarksList(bookmark) { '' + encodeEntities(bookmark.title) + '' + '

' + '

' + encodeEntities(bookmark.url) + '

' + + '

'+ encodeEntities(bookmark.description) + '

' + '' ); $('div[data-id="'+ bookmark.id +'"]').data('record', bookmark);