A lot of things
This commit is contained in:
@@ -14,20 +14,15 @@ export default function settings() {
|
||||
*/
|
||||
xfUrls: {},
|
||||
|
||||
/**
|
||||
* @type {number[]}
|
||||
*/
|
||||
entriesPerPage: [ 12, 30, 48 ],
|
||||
|
||||
/**
|
||||
* @type {string}
|
||||
*/
|
||||
currentTheme: Cookies.get("theme") ?? 'default',
|
||||
currentTheme: 'default',
|
||||
|
||||
/**
|
||||
* @type {number}
|
||||
* @type {list|null}
|
||||
*/
|
||||
currentEntriesPerPage: Cookies.get("entries_per_page") ?? 30,
|
||||
currentActivityFilters: null,
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -43,7 +38,7 @@ export default function settings() {
|
||||
this.currentTheme = newTheme;
|
||||
document.documentElement.classList.toggle('light-mode', this.currentTheme === 'alternate');
|
||||
|
||||
Cookies.set('theme', this.currentTheme, { expires: 365, path: '/', domain: window.getConfig('session-domain') } );
|
||||
// Cookies.set('theme', this.currentTheme, { expires: 365, path: '/', domain: window.getConfig('session-domain') } );
|
||||
this.syncXF();
|
||||
},
|
||||
|
||||
@@ -62,22 +57,48 @@ export default function settings() {
|
||||
this.themeChanged(this.currentTheme === 'default' ? 'alternate' : 'default');
|
||||
},
|
||||
|
||||
/**
|
||||
*
|
||||
* @param n
|
||||
*/
|
||||
entriesPerPageChanged( n ){
|
||||
if( !this.entriesPerPage.includes(n) )
|
||||
return;
|
||||
|
||||
this.entriesPerPage = n;
|
||||
Cookies.set('entries_per_page', this.entriesPerPage, { expires: 365, path: '/', domain: window.getConfig('session-domain') } );
|
||||
if( window.Livewire ){
|
||||
Livewire.dispatch('entriesPerPageChanged', {n});
|
||||
}
|
||||
},
|
||||
|
||||
open(){ this.start = !this.start; },
|
||||
close(){ this.start = false; },
|
||||
|
||||
async toggleActivityFilter( type ){
|
||||
|
||||
if( this.currentActivityFilters === null )
|
||||
return;
|
||||
|
||||
const i = this.currentActivityFilters.indexOf( type );
|
||||
if( i !== -1 && this.currentActivityFilters.length === 1)
|
||||
return;
|
||||
|
||||
if( i === -1 )
|
||||
this.currentActivityFilters.push( type );
|
||||
else
|
||||
this.currentActivityFilters.splice( i, 1 );
|
||||
|
||||
Cookies.set( 'activity_filters', JSON.stringify(this.currentActivityFilters), { expires: 365, path: '/', domain: window.getConfig('session-domain') } );
|
||||
await this.syncTimeline();
|
||||
},
|
||||
|
||||
async syncTimeline(){
|
||||
|
||||
const tl = document.getElementById('activity-timeline');
|
||||
if( !tl )
|
||||
return;
|
||||
|
||||
tl.style.opacity = 0.5;
|
||||
|
||||
const params = this.currentActivityFilters.join(',');
|
||||
const response = await fetch(`/api/dynamic/activity/feed?filters=${params}`);
|
||||
const data = await response.json();
|
||||
|
||||
if( !data.html )
|
||||
return;
|
||||
|
||||
tl.innerHTML = data.html;
|
||||
tl.style.opacity = 1;
|
||||
|
||||
refreshIcons(tl);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user