2018-07-07 00:48:14 +00:00
|
|
|
/* global $, Whisper, i18n */
|
|
|
|
|
2019-11-07 21:36:16 +00:00
|
|
|
$(document).on('keydown', e => {
|
2018-07-07 00:48:14 +00:00
|
|
|
'use strict';
|
|
|
|
|
2018-07-03 22:33:50 +00:00
|
|
|
if (e.keyCode === 27) {
|
|
|
|
window.closePermissionsPopup();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
const $body = $(document.body);
|
2019-05-16 22:32:38 +00:00
|
|
|
|
|
|
|
async function applyTheme() {
|
|
|
|
'use strict';
|
|
|
|
|
|
|
|
const theme = await window.getThemeSetting();
|
|
|
|
$body.removeClass('light-theme');
|
|
|
|
$body.removeClass('dark-theme');
|
|
|
|
$body.addClass(`${theme === 'system' ? window.systemTheme : theme}-theme`);
|
|
|
|
}
|
|
|
|
|
|
|
|
applyTheme();
|
|
|
|
|
|
|
|
window.subscribeToSystemThemeChange(() => {
|
|
|
|
'use strict';
|
|
|
|
|
|
|
|
applyTheme();
|
|
|
|
});
|
2018-07-03 22:33:50 +00:00
|
|
|
|
|
|
|
window.view = new Whisper.ConfirmationDialogView({
|
|
|
|
message: i18n('audioPermissionNeeded'),
|
|
|
|
okText: i18n('allowAccess'),
|
|
|
|
resolve: () => {
|
2018-07-07 00:48:14 +00:00
|
|
|
'use strict';
|
|
|
|
|
2018-07-03 22:33:50 +00:00
|
|
|
window.setMediaPermissions(true);
|
|
|
|
window.closePermissionsPopup();
|
|
|
|
},
|
|
|
|
reject: window.closePermissionsPopup,
|
|
|
|
});
|
|
|
|
|
|
|
|
window.view.$el.appendTo($body);
|