Browse Source

Add note search

tags/v1.1.0
Skylar Ittner 9 months ago
parent
commit
e6fdbb893e
3 changed files with 29 additions and 1 deletions
  1. 8
    0
      www/js/home.js
  2. 6
    1
      www/js/main.js
  3. 15
    0
      www/pages/home.html

+ 8
- 0
www/js/home.js View File

@@ -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 () {

+ 6
- 1
www/js/main.js View File

@@ -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', {

+ 15
- 0
www/pages/home.html View File

@@ -8,6 +8,10 @@
<div class="title">NotePost</div>

<div class="right">
<a class="link icon-only searchbar-enable" data-searchbar="#searchbar">
<i class="icon f7-icons ios-only">search_strong</i>
<i class="icon material-icons md-only">search</i>
</a>
<a href="#" class="link icon-only" onclick="app.ptr.refresh()">
<i class="material-icons">refresh</i>
</a>
@@ -15,6 +19,17 @@
<i class="material-icons">settings</i>
</a>
</div>

<form class="searchbar searchbar-expandable searchbar-init" id="searchbar">
<div class="searchbar-inner">
<div class="searchbar-input-wrap">
<input type="search" placeholder="Search" id="searchbar-input"/>
<i class="searchbar-icon"></i>
<span class="input-clear-button"></span>
</div>
<span class="searchbar-disable-button">Cancel</span>
</div>
</form>
</div>
</div>


Loading…
Cancel
Save