VulpesOS/gaia/apps/operatorvariant/js/customizers/topsites_customizer.js
OverSu b38dea0597 Publish Vulpes Preview 15 sources for desktop, Android and Tundra
Share Gaia assets and adapters, keep private profiles and development documents local, and update both public READMEs.
2026-09-30 23:13:03 +02:00

39 lines
826 B
JavaScript
Executable file

/* global Customizer */
'use strict';
var TopSitesCustomizer = (function() {
Customizer.call(this, 'topsites', 'json');
this.set = function(topSiteConfig) {
if (!topSiteConfig ||
!topSiteConfig.topSites ||
!topSiteConfig.topSites.length) {
return;
}
this.getStore('places').then(store => {
topSiteConfig.topSites.forEach(site => {
store.get(site.url).then(place => {
if (!place) {
site.frecency = -1;
store.put(site, site.url);
}
});
});
});
};
this.getStore = function(name) {
return new Promise(resolve => {
navigator.getDataStores(name).then(stores => {
resolve(stores[0]);
});
});
};
});
var topSitesCustomizer = new TopSitesCustomizer();
topSitesCustomizer.init();