|
|
|
|
|
|
|
|
|
|
|
|
|
function togglePlatform(platformId) {
|
|
this.platformStates[platformId] = !this.platformStates[platformId];
|
|
|
|
|
|
localStorage.setItem('platformStates', JSON.stringify(this.platformStates));
|
|
}
|
|
|
|
|
|
function getPlatformKeyCount(platformId, filtered = false) {
|
|
if (filtered && this.searchTerm !== '') {
|
|
return this.apiKeys.filter(key =>
|
|
key.platform === platformId &&
|
|
this.matchesSearch(key.name, key.key)
|
|
).length;
|
|
}
|
|
return this.apiKeys.filter(key => key.platform === platformId).length;
|
|
}
|
|
|
|
|
|
function hasPlatformKeys(platformId) {
|
|
return this.getPlatformKeyCount(platformId) > 0;
|
|
}
|
|
|
|
|
|
function isPlatformVisible(platformId) {
|
|
return this.platformFilters[platformId] === true;
|
|
}
|
|
|
|
|
|
function getPlatforms() {
|
|
return JSON.parse(platformsData);
|
|
}
|
|
|
|
|
|
function getPlatformStyles() {
|
|
return JSON.parse(platformStylesData);
|
|
}
|
|
|
|
|
|
function getPlatformStyle(platformId) {
|
|
const styles = getPlatformStyles();
|
|
return styles[platformId] || {};
|
|
}
|
|
|
|
|
|
function togglePlatformFilter(platformId) {
|
|
this.platformFilters[platformId] = !this.platformFilters[platformId];
|
|
|
|
|
|
const platforms = this.getPlatforms();
|
|
this.allPlatformsSelected = platforms.every(platform =>
|
|
this.platformFilters[platform.id] === true
|
|
);
|
|
|
|
|
|
localStorage.setItem('platformFilters', JSON.stringify(this.platformFilters));
|
|
}
|
|
|
|
|
|
function toggleAllPlatformFilters() {
|
|
const newState = !this.allPlatformsSelected;
|
|
this.allPlatformsSelected = newState;
|
|
|
|
|
|
const platforms = this.getPlatforms();
|
|
platforms.forEach(platform => {
|
|
this.platformFilters[platform.id] = newState;
|
|
});
|
|
|
|
|
|
localStorage.setItem('platformFilters', JSON.stringify(this.platformFilters));
|
|
}
|
|
|