mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-29 13:38:44 +02:00
poc form SDK (extends to form)
This commit is contained in:
48
js/DI/app.js
Normal file
48
js/DI/app.js
Normal file
@@ -0,0 +1,48 @@
|
||||
/**
|
||||
* Application handling.
|
||||
*
|
||||
* @returns {{init: init}}
|
||||
* @constructor
|
||||
*/
|
||||
const App = function(){
|
||||
|
||||
// dom selectors
|
||||
const aSelectors = {
|
||||
darkModeButton: '#dark_mode'
|
||||
};
|
||||
|
||||
/**
|
||||
* init.
|
||||
*
|
||||
*/
|
||||
function init(){
|
||||
|
||||
$(aSelectors.darkModeButton).on('click', function(){
|
||||
$('body').attr('data-bs-theme', this.ariaPressed === 'true' ? 'dark' : 'light');
|
||||
});
|
||||
|
||||
if (window.matchMedia('(prefers-color-scheme: dark)').matches) {
|
||||
$('body').attr('data-bs-theme', 'dark');
|
||||
$(aSelectors.darkModeButton).attr('aria-pressed', 'true');
|
||||
$(aSelectors.darkModeButton).toggleClass('active', true);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return {
|
||||
init
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user