mirror of
https://github.com/JanGross/quicknotes.git
synced 2025-12-01 07:37:18 +01:00
Fix search on NC >= 14. Issue #17
This commit is contained in:
39
js/script.js
39
js/script.js
@@ -658,41 +658,30 @@ View.prototype = {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
var timeoutID = null;
|
function search (query) {
|
||||||
function filter (query) {
|
if (query) {
|
||||||
window.clearTimeout(timeoutID);
|
query = query.toLowerCase();
|
||||||
timeoutID = window.setTimeout(function() {
|
$('.notes-grid').isotope({
|
||||||
if (query) {
|
filter: function() {
|
||||||
query = query.toLowerCase();
|
|
||||||
$('.notes-grid').isotope({ filter: function() {
|
|
||||||
var title = $(this).find(".note-title").html().toLowerCase();
|
var title = $(this).find(".note-title").html().toLowerCase();
|
||||||
if (title.search(query) >= 0)
|
if (title.search(query) >= 0)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
var content = $(this).find(".note-content").html().toLowerCase();
|
var content = $(this).find(".note-content").html().toLowerCase();
|
||||||
if (content.search(query) >= 0)
|
if (content.search(query) >= 0)
|
||||||
return true;
|
return true;
|
||||||
return false;
|
|
||||||
}});
|
|
||||||
} else {
|
|
||||||
$('.notes-grid').isotope({ filter: '*'});
|
|
||||||
}
|
|
||||||
}, 500);
|
|
||||||
};
|
|
||||||
|
|
||||||
var SearchProxy = {
|
return false;
|
||||||
attach: function(search) {
|
}
|
||||||
search.setFilter('quicknotes', this.filterProxy);
|
});
|
||||||
},
|
} else {
|
||||||
filterProxy: function(query) {
|
$('.notes-grid').isotope({ filter: '*'});
|
||||||
filter(query);
|
|
||||||
},
|
|
||||||
setFilter: function(newFilter) {
|
|
||||||
filter = newFilter;
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
SearchProxy.setFilter(filter);
|
new OCA.Search(search, function() {
|
||||||
OC.Plugins.register('OCA.Search', SearchProxy);
|
search('');
|
||||||
|
});
|
||||||
|
|
||||||
var notes = new Notes(OC.generateUrl('/apps/quicknotes/notes'));
|
var notes = new Notes(OC.generateUrl('/apps/quicknotes/notes'));
|
||||||
var view = new View(notes);
|
var view = new View(notes);
|
||||||
|
|||||||
Reference in New Issue
Block a user