1
0
Fork 0
mirror of https://github.com/eosswedenorg/apt synced 2026-06-17 04:40:03 +02:00

move source js files (that should be bundled) from _scripts/ to assets/js/

This commit is contained in:
Henrik Hautakoski 2022-01-25 12:57:27 +01:00
parent f097ea57d7
commit 76623dfd2e
No known key found for this signature in database
GPG key ID: 608414D93E862CCD
4 changed files with 2 additions and 2 deletions

View file

@ -0,0 +1,36 @@
import pkg_idx from './pkg_idx'
// Alpine search component
export default () => ({
show: false,
query: "",
getResults() {
if (this.query.length < 1) {
return [];
}
var results = pkg_idx.search(this.query).slice(0, 10);
var list = results.map(function (item) {
return package_data.filter(function (v, i, arr) {
return v.id == item.ref;
})[0];
});
this.open();
return list;
},
toggle() {
this.show = ! this.show;
},
open() {
this.show = true;
},
close() {
this.show = false;
},
isOpen() {
return this.show;
}
})

View file

@ -0,0 +1,14 @@
import lunr from 'lunr'
// Package Search using Lunr
export default lunr(function () {
this.field('name');
this.field('version');
this.field('repo');
this.field('component');
package_data.forEach(function (pkg) {
this.add(pkg);
}, this);
})