VulpesOS/gaia/apps/settings/js/panels/themes/layout_template.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

40 lines
1,010 B
JavaScript
Executable file

/**
* The template function for generating an UI element for a layout object.
*
* @module themes/layout_template
*/
define(function (require) {
'use strict';
return function th_layoutTemplate(theme, recycled) {
var container = null;
var label, radio;
var RADIO_GROUP = 'personalization.themesheader.value';
if (recycled) {
container = recycled;
radio = container.querySelector('gaia-radio');
label = container.querySelector('label');
} else {
container = document.createElement('li');
radio = document.createElement('gaia-radio');
label = document.createElement('label');
radio.name = RADIO_GROUP;
radio.value = theme.manifestURL;
radio.appendChild(label);
container.appendChild(radio);
}
label.textContent = theme.name;
radio.addEventListener('click', function(evt) {
if (evt.target.checked) {
return;
}
theme.onclick(theme.manifestURL);
});
return container;
};
});