mirror of
https://github.com/JosunLP/BrowserExtensionTemplate.git
synced 2025-12-06 05:50:05 +00:00
improvements
This commit is contained in:
parent
9145b60898
commit
1d3600de32
10 changed files with 486 additions and 90 deletions
32
src/settings.ts
Normal file
32
src/settings.ts
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
import { Session } from "./classes/session.js";
|
||||
import { BasicButton } from "./components/button.js";
|
||||
|
||||
class Settings {
|
||||
|
||||
private session = Session.getInstance();
|
||||
|
||||
constructor() {
|
||||
this.renderSettings();
|
||||
}
|
||||
|
||||
private async renderSettings(): Promise<void> {
|
||||
const settings = <HTMLDivElement>document.getElementById('settings');
|
||||
const saveButton = new BasicButton('success', 'Save', 'saveSettings').render();
|
||||
settings.innerHTML = `
|
||||
<div class="form-group">
|
||||
<input type="text" class="form-control text-input" id="contentTest" placeholder="Enter content test" value="${this.session.contentTest}">
|
||||
<label for="contentTest">Content Test</label>
|
||||
</div>
|
||||
`;
|
||||
settings.innerHTML += saveButton;
|
||||
|
||||
const saveSettings = <HTMLButtonElement>document.getElementById('saveSettings');
|
||||
saveSettings.addEventListener('click', () => {
|
||||
this.session.contentTest = (<HTMLInputElement>document.getElementById('contentTest')).value;
|
||||
Session.save();
|
||||
Session.reloadSession();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
new Settings();
|
||||
Loading…
Add table
Add a link
Reference in a new issue