diff --git a/www/js/home.js b/www/js/home.js index 7036305..2a464bc 100644 --- a/www/js/home.js +++ b/www/js/home.js @@ -11,6 +11,14 @@ $(".view-main").on("ptr:refresh", ".ptr-content", function () { }); }); +$(".view-main").on("input change", "#searchbar-input", function () { + window.shuffleInstance.filter(function (element) { + var searchtext = $("#searchbar-input").val().toLowerCase(); + var notetext = $(".card-content", $(element)).text().toLowerCase(); + return (notetext.indexOf(searchtext) !== -1); + }); +}); + function loadCards(callback) { // Do it twice as a workaround for the stupid sync issue NOTES.sync(function () { diff --git a/www/js/main.js b/www/js/main.js index ab3d7cd..1706ae0 100644 --- a/www/js/main.js +++ b/www/js/main.js @@ -10,7 +10,12 @@ var app = new Framework7({ id: "com.netsyms.NotePostApp", init: true, initOnDeviceReady: false, - routes: routes + routes: routes, + on: { + searchbarSearch: function (sb, q) { + console.log(q); + } + } }); var mainView = app.views.create('.view-main', { diff --git a/www/pages/home.html b/www/pages/home.html index c4e696c..97a2afb 100644 --- a/www/pages/home.html +++ b/www/pages/home.html @@ -8,6 +8,10 @@
NotePost
+ + search_strong + search + refresh @@ -15,6 +19,17 @@ settings
+ +