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}