mirror of
https://git.leinelab.org/Mal/mr-crocs-adventures.git
synced 2025-09-11 02:57:36 +02:00
Widgets implemented.
This commit is contained in:
35
tilorswift/js/menu/Widget.js
Normal file
35
tilorswift/js/menu/Widget.js
Normal file
@@ -0,0 +1,35 @@
|
||||
export default class Widget
|
||||
{
|
||||
constructor(title)
|
||||
{
|
||||
this.title = title;
|
||||
this.htmlElement = document.createElement('div');
|
||||
this.isActive = true;
|
||||
}
|
||||
|
||||
getTitle()
|
||||
{
|
||||
let htmlElementTitle = document.createElement('div');
|
||||
htmlElementTitle.classList.add('widget-title');
|
||||
htmlElementTitle.innerText = this.title;
|
||||
|
||||
return htmlElementTitle;
|
||||
}
|
||||
|
||||
enable()
|
||||
{
|
||||
this.isActive = true;
|
||||
this.htmlElement.classList.remove('widget-disabled');
|
||||
}
|
||||
|
||||
disable()
|
||||
{
|
||||
this.isActive = false;
|
||||
this.htmlElement.classList.add('widget-disabled');
|
||||
}
|
||||
|
||||
getElement()
|
||||
{
|
||||
return this.htmlElement;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user