| | |
| | | class FrontendVotes { |
| | | constructor() { |
| | | // Initialize DataStore for queue persistence |
| | | this.store = new window.jvbStore({ |
| | | name: 'favourites', |
| | | endpoint: 'favourites', |
| | | useIndexedDB: true, |
| | | TTL: Infinity, |
| | | showLoading: false |
| | | }); |
| | | this.store = window.jvbStore.register('votes', |
| | | { |
| | | endpoint: 'votes', |
| | | useIndexedDB: true, |
| | | TTL: 6 * 60 * 1000, |
| | | showLoading: false |
| | | }); |
| | | } |
| | | |
| | | handleVote(button) { |
| | | if (!jvbSettings.currentUser) { |
| | | if (!window.auth.getUser()) { |
| | | window.location.href = jvbSettings.redirect + '&action=register&type=vote'; |
| | | return; |
| | | } |
| | |
| | | } |
| | | |
| | | isFavourited(content, id){ |
| | | if(!jvbSettings.currentUser){ |
| | | if(!window.auth.getUser()){ |
| | | return false; |
| | | } |
| | | let item = this.store.getItem(id); |
| | |
| | | } |
| | | } |
| | | window.jvbVotes = false; |
| | | if (jvbSettings.currentUser !== '') { |
| | | if (window.auth.getUser() !== '') { |
| | | window.jvbVotes = new FrontendFavourites(); |
| | | } |
| | | |