diff --git a/plugins/bookmarks-img.png b/images/bookmarks-img.png similarity index 100% rename from plugins/bookmarks-img.png rename to images/bookmarks-img.png diff --git a/images/icon-bookmark-map.png b/images/icon-bookmark-map.png new file mode 100644 index 00000000..b0151a7b Binary files /dev/null and b/images/icon-bookmark-map.png differ diff --git a/images/icon-bookmark.png b/images/icon-bookmark.png new file mode 100644 index 00000000..ed32f557 Binary files /dev/null and b/images/icon-bookmark.png differ diff --git a/plugins/bookmarks-css.css b/plugins/bookmarks-by-zaso.css similarity index 99% rename from plugins/bookmarks-css.css rename to plugins/bookmarks-by-zaso.css index caf8d354..fdb2e5f3 100644 --- a/plugins/bookmarks-css.css +++ b/plugins/bookmarks-by-zaso.css @@ -283,7 +283,7 @@ cursor:pointer; } #bkmrksTrigger, .bkmrksStar span, .portal-list-bookmark span { - background-image:url(@@INCLUDEIMAGE:plugins/bookmarks-img.png@@); + background-image:url(@@INCLUDEIMAGE:images/bookmarks-img.png@@); } .bkmrksStar span{ display:inline-block; diff --git a/plugins/bookmarks-by-zaso.user.js b/plugins/bookmarks-by-zaso.user.js index dfb7f098..930a96fc 100644 --- a/plugins/bookmarks-by-zaso.user.js +++ b/plugins/bookmarks-by-zaso.user.js @@ -479,6 +479,55 @@ console.log('Move Bookmarks '+type+' ID:'+idBkmrk+' from folder ID:'+oldFold+' to folder ID:'+newFold); } + window.plugin.bookmarks.onSearch = function(query) { + var term = query.term.toLowerCase(); + + $.each(plugin.bookmarks.bkmrksObj.maps, function(id, folder) { + $.each(folder.bkmrk, function(id, bookmark) { + if(bookmark.label.toLowerCase().indexOf(term) === -1) return; + + query.addResult({ + title: bookmark.label, + description: 'Map in folder "' + folder.label + '"', + icon: '@@INCLUDEIMAGE:images/icon-bookmark-map.png@@', + position: L.latLng(bookmark.latlng.split(",")), + zoom: bookmark.z, + onSelected: window.plugin.bookmarks.onSearchResultSelected, + }); + }); + }); + + $.each(plugin.bookmarks.bkmrksObj.portals, function(id, folder) { + $.each(folder.bkmrk, function(id, bookmark) { + if(bookmark.label.toLowerCase().indexOf(term) === -1) return; + + query.addResult({ + title: bookmark.label, + description: 'Bookmark in folder "' + folder.label + '"', + icon: '@@INCLUDEIMAGE:images/icon-bookmark.png@@', + position: L.latLng(bookmark.latlng.split(",")), + guid: bookmark.guid, + onSelected: window.plugin.bookmarks.onSearchResultSelected, + }); + }); + }); + }; + + window.plugin.bookmarks.onSearchResultSelected = function(result, event) { + if(result.guid) { // portal + var guid = result.guid; + if(event.type == 'dblclick') + zoomToAndShowPortal(guid, result.position); + else if(window.portals[guid]) + renderPortalDetails(guid); + else + window.selectPortalByLatLng(result.position); + } else if(result.zoom) { // map + map.setView(result.position, result.zoom); + } + return true; // prevent default behavior + }; + /***************************************************************************************************************************************************************/ // Saved the new sort of the folders (in the localStorage) @@ -1060,7 +1109,7 @@ /***************************************************************************************************************************************************************/ window.plugin.bookmarks.setupCSS = function() { - $('