From 566055f4e6df44729e0d0bf85827e29974f870a3 Mon Sep 17 00:00:00 2001 From: Brice Maron Date: Tue, 31 Jul 2012 20:48:11 +0000 Subject: [PATCH] manage placeholder for shot provider --- js/bookmarks.js | 19 +++++++++++++++++-- templates/list.php | 2 ++ 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/js/bookmarks.js b/js/bookmarks.js index 82b369e7..ddd5f166 100644 --- a/js/bookmarks.js +++ b/js/bookmarks.js @@ -27,6 +27,19 @@ $(document).ready(function() { switchView(); }); + +var formatString = (function() { + var replacer = function(context) { + return function(s, name) { + return context[name]; + }; + }; + + return function(input, context) { + return input.replace(/\{(\w+)\}/g, replacer(context)); + }; +})(); + function clickSideBar() { $.post(OC.filePath('bookmarks', 'ajax', 'changescreen.php'), {sidebar: $('#leftcontent').is(':visible')}); toggleSideBar(); @@ -217,9 +230,10 @@ function updateBookmarksList(bookmark) { if(bookmark.title == '') bookmark.title = bookmark.url; if(bookmark_view == 'image') { //View in images + service_url = formatString(shot_provider, {url: encodeEntities(bookmark.url), title: bookmark.title, width: 200}); $('.bookmarks_list').append( '
' + - '

'+ + '

'+ '

' + '' + '' + @@ -346,4 +360,5 @@ function deleteTag(event){ }); } }); -} \ No newline at end of file +} + diff --git a/templates/list.php b/templates/list.php index 6f302581..bb429566 100644 --- a/templates/list.php +++ b/templates/list.php @@ -62,6 +62,8 @@ var fullTags = ; var init_view = ''; var init_sidebar = ''; + var shot_provider = ''; + //http://api.thumbalizr.com/?width={width}&url={url}