Exclude external dependencies jQuery and js-cookie from the bunde; use npm run build for bundling a production build; fix deprecated warnings.
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Manuel Friedli 2019-05-06 02:03:44 +02:00
parent 174e0d9af2
commit 3c986d645a
8 changed files with 57 additions and 378 deletions

View file

@ -182,8 +182,7 @@ export class Uhr {
e.after(controlpanel);
controlpanel.hide();
const configlink = $(`<a class="uhr-configlink" id="uhr-configlink${this.widgetInstance.uuid}"></a>`);
// FIXME deprecated!?
configlink.on('click', () => this.toggleConfigScreen());
configlink.on({click: () => this.toggleConfigScreen()});
e.after(configlink);
}
};
@ -191,8 +190,7 @@ export class Uhr {
private wireFunctionality(): void {
// on/off switch
const toggleSwitch = $(`#uhr-onoffswitch-checkbox${this.widgetInstance.uuid}`);
// FIXME deprecated!?
toggleSwitch.on('click', () => this.toggle());
toggleSwitch.on({click: () => this.toggle()});
let status = this.getCookie('uhr-status');
if (status === undefined || this.widgetInstance.options.force) {
status = this.widgetInstance.options.status;
@ -206,12 +204,13 @@ export class Uhr {
// time mode switch
const modeSwitch = $(`#uhr-modeswitch-checkbox${this.widgetInstance.uuid}`);
// FIXME deprecated!?
modeSwitch.on('click', () => {
if (this.widgetInstance.options.mode === 'seconds') {
this.setMode('normal');
} else {
this.setMode('seconds');
modeSwitch.on({
click: () => {
if (this.widgetInstance.options.mode === 'seconds') {
this.setMode('normal');
} else {
this.setMode('seconds');
}
}
});
@ -228,10 +227,11 @@ export class Uhr {
// language chooser
const languageChooser = $(`#uhr-languagechooser${this.widgetInstance.uuid}`);
// FIXME deprecated!?
languageChooser.on('change', () => {
const languageKey = $(`#uhr-languagechooser${this.widgetInstance.uuid}`).val() as string;
this.setLanguage(languageKey);
languageChooser.on({
change: () => {
const languageKey = $(`#uhr-languagechooser${this.widgetInstance.uuid}`).val() as string;
this.setLanguage(languageKey);
}
});
let selectedLayout = this.getCookie('uhr-language');
if (selectedLayout === undefined || this.widgetInstance.options.force) {
@ -254,10 +254,11 @@ export class Uhr {
// theme chooser
const themeChooser = $(`#uhr-themechooser${this.widgetInstance.uuid}`);
// FIXME deprecated!?
themeChooser.on('change', () => {
const themeKey = $(`#uhr-themechooser${this.widgetInstance.uuid}`).val() as string;
this.setTheme(themeKey);
themeChooser.on({
change: () => {
const themeKey = $(`#uhr-themechooser${this.widgetInstance.uuid}`).val() as string;
this.setTheme(themeKey);
}
});
let selectedTheme = this.getCookie('uhr-theme');
if (selectedTheme === undefined || this.widgetInstance.options.force) {
@ -273,17 +274,18 @@ export class Uhr {
this.widgetInstance.options.theme = '';
this.setTheme(selectedTheme);
if (this.widgetInstance.options.autoresize) {
// FIXME deprecated!?
$(window).on('resize', () => {
const $e = this.widgetInstance.element;
const $parent = $e.parent();
const $window = $(window);
const parentWidth = $parent.width();
const parentHeight = $parent.height();
const windowWidth = $window.width();
const windowHeight = $window.height();
const size = `${Math.min(parentWidth, parentHeight, windowWidth, windowHeight)}px`;
this.setWidth(size);
$(window).on({
resize: () => {
const $e: JQuery<HTMLElement> = this.widgetInstance.element;
const $parent: JQuery<HTMLElement> = $e.parent();
const $window: JQuery<Window> = $(window);
const parentWidth: number = $parent.width();
const parentHeight: number = $parent.height();
const windowWidth: number = $window.width();
const windowHeight: number = $window.height();
const size: string = `${Math.min(parentWidth, parentHeight, windowWidth, windowHeight)}px`;
this.setWidth(size);
}
});
}
}