diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..28e5452
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,3 @@
+dist
+node_modules
+.idea
\ No newline at end of file
diff --git a/index.html b/index.html
new file mode 100644
index 0000000..9e9ca13
--- /dev/null
+++ b/index.html
@@ -0,0 +1,109 @@
+
+
+
+
+
+ bookmeterplus Project
+
+
+
+
+
+
+
+
+
+
+ | # |
+ Uzytkownik |
+ Tytuł |
+ Autor |
+ Wydawca |
+ Stron |
+ Format |
+ Ocena |
+ ⚡ |
+ Link |
+
+
+
+
+
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+
+
+ link
+
+
+ |
+
+
+
+
+
+ |
+
+
+
+ |
+
+
+
+
+ |
+
+
+ |
+
+
+
+ |
+ |
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/package-lock.json b/package-lock.json
index 9ae78f5..c6057b8 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -9,6 +9,7 @@
"version": "1.0.0",
"license": "ISC",
"dependencies": {
+ "@alpinejs/persist": "^3.14.9",
"@tailwindcss/cli": "^4.1.11",
"alpinejs": "^3.14.9"
},
@@ -32,6 +33,12 @@
"url": "https://github.com/sponsors/sindresorhus"
}
},
+ "node_modules/@alpinejs/persist": {
+ "version": "3.14.9",
+ "resolved": "https://registry.npmjs.org/@alpinejs/persist/-/persist-3.14.9.tgz",
+ "integrity": "sha512-Td9hWEUtFFguYCRjXhq06sDultW21wXUnVro7YWJm+vjGu/nV/v3hepOXyYVjkGvH/F+zjx5UkzWXXzr3UiQ/w==",
+ "license": "MIT"
+ },
"node_modules/@ampproject/remapping": {
"version": "2.3.0",
"resolved": "https://registry.npmjs.org/@ampproject/remapping/-/remapping-2.3.0.tgz",
diff --git a/package.json b/package.json
index 42723b8..a832f00 100644
--- a/package.json
+++ b/package.json
@@ -17,6 +17,7 @@
"author": "",
"license": "ISC",
"dependencies": {
+ "@alpinejs/persist": "^3.14.9",
"@tailwindcss/cli": "^4.1.11",
"alpinejs": "^3.14.9"
},
diff --git a/src/main.js b/src/main.js
index c669b07..729531a 100644
--- a/src/main.js
+++ b/src/main.js
@@ -1,16 +1,25 @@
import './generated.css'
import Alpine from 'alpinejs'
+import persist from '@alpinejs/persist'
window.Alpine = Alpine;
-
+Alpine.plugin(persist)
Alpine.data('bookmeterList', () => ({
items: [],
filteredItems: [],
+ username: '',
+ publisher: '',
+ title: '',
+ author: '',
nameFilter: '',
async init() {
this.$watch('nameFilter', () => this.updateFilter());
+ this.$watch('username', () => this.updateFilter());
+ this.$watch('title', () => this.updateFilter());
+ this.$watch('author', () => this.updateFilter());
+ this.$watch('publisher', () => this.updateFilter());
let qp = new URLSearchParams(window.location.search);
if(qp.get('filter')) this.nameFilter = qp.get('filter');
@@ -19,7 +28,7 @@ Alpine.data('bookmeterList', () => ({
this.items = await res.json();
this.updateFilter();
},
- test(){
+ stats(){
return {
'pages_total': this.filteredItems.reduce((a, b) => a + b.book.pages, 0) || '-',
'likes_total': this.filteredItems.reduce((a, b) => a + b.likes, 0) || '-',
@@ -37,8 +46,16 @@ Alpine.data('bookmeterList', () => ({
let filter = this.nameFilter.toLowerCase();
this.filteredItems = this.items.filter(i => {
+
+ return (
+ (!this.username || i.username.toLowerCase().includes(this.username.toLowerCase())) &&
+ (!this.title || i.book.title.toLowerCase().includes(this.title.toLowerCase())) &&
+ (!this.author || i.book.author.toLowerCase().includes(this.author.toLowerCase())) &&
+ (!this.publisher || i.book.publisher.toLowerCase().includes(this.publisher.toLowerCase()))
+ );
if(filter.startsWith('@') && i.username.toLowerCase().includes(filter.substring(1))) return true;
- if (i.book.title.toLowerCase().includes(this.nameFilter.toLowerCase()) || i.book.author.toLowerCase().includes(this.nameFilter.toLowerCase())) return true;
+ if (i.username.toLowerCase().includes(filter) ||
+ i.book.title.toLowerCase().includes(filter) || i.book.author.toLowerCase().includes(filter) || i.book.publisher.toLowerCase().includes(filter)) return true;
return false;
});