mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-07-13 03:27:39 +03:00
Replace some data-bind="click: function(){} with object functions to prevent eval()
This commit is contained in:
parent
95808ba377
commit
0d6499702d
17 changed files with 53 additions and 16 deletions
|
|
@ -51,6 +51,11 @@ export class AttachmentModel extends AbstractModel {
|
||||||
return attachment;
|
return attachment;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
toggleChecked(self, event) {
|
||||||
|
event.stopPropagation();
|
||||||
|
self.checked(!self.checked());
|
||||||
|
}
|
||||||
|
|
||||||
friendlySize() {
|
friendlySize() {
|
||||||
return FileInfo.friendlySize(this.estimatedSize) + (this.isLinked() ? ' 🔗' : '');
|
return FileInfo.friendlySize(this.estimatedSize) + (this.isLinked() ? ' 🔗' : '');
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -151,6 +151,10 @@ export class UserSettingsFolders /*extends AbstractViewSettings*/ {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
hideError() {
|
||||||
|
this.folderListError('');
|
||||||
|
}
|
||||||
|
|
||||||
toggleFolderKolabType(folder, event) {
|
toggleFolderKolabType(folder, event) {
|
||||||
let type = event.target.value;
|
let type = event.target.value;
|
||||||
// TODO: append '.default' ?
|
// TODO: append '.default' ?
|
||||||
|
|
|
||||||
|
|
@ -60,6 +60,10 @@ export class UserSettingsThemes /*extends AbstractViewSettings*/ {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setTheme(theme) {
|
||||||
|
ThemeStore.theme(theme.name);
|
||||||
|
}
|
||||||
|
|
||||||
onBuild() {
|
onBuild() {
|
||||||
const currentTheme = ThemeStore.theme();
|
const currentTheme = ThemeStore.theme();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -33,6 +33,10 @@ export class AdminLoginView extends AbstractViewLogin {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
hideError() {
|
||||||
|
this.submitError('');
|
||||||
|
}
|
||||||
|
|
||||||
submitCommand(self, event) {
|
submitCommand(self, event) {
|
||||||
let form = event.target.form,
|
let form = event.target.form,
|
||||||
data = new FormData(form),
|
data = new FormData(form),
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,10 @@ export class AccountPopupView extends AbstractViewPopup {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
hideError() {
|
||||||
|
this.submitError('');
|
||||||
|
}
|
||||||
|
|
||||||
submitForm(form) {
|
submitForm(form) {
|
||||||
if (!this.submitRequest() && form.reportValidity()) {
|
if (!this.submitRequest() && form.reportValidity()) {
|
||||||
const data = new FormData(form);
|
const data = new FormData(form);
|
||||||
|
|
|
||||||
|
|
@ -93,6 +93,10 @@ export class OpenPgpGeneratePopupView extends AbstractViewPopup {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
hideError() {
|
||||||
|
this.submitError('');
|
||||||
|
}
|
||||||
|
|
||||||
showError(e) {
|
showError(e) {
|
||||||
console.log(e);
|
console.log(e);
|
||||||
if (e?.message) {
|
if (e?.message) {
|
||||||
|
|
|
||||||
|
|
@ -35,6 +35,10 @@ export class PluginPopupView extends AbstractViewPopup {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
hideError() {
|
||||||
|
this.saveError('');
|
||||||
|
}
|
||||||
|
|
||||||
saveCommand() {
|
saveCommand() {
|
||||||
const oConfig = {
|
const oConfig = {
|
||||||
Id: this.id(),
|
Id: this.id(),
|
||||||
|
|
|
||||||
|
|
@ -88,6 +88,14 @@ export class LoginUserView extends AbstractViewLogin {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
hideError() {
|
||||||
|
this.submitError('');
|
||||||
|
}
|
||||||
|
|
||||||
|
toggleSignMe() {
|
||||||
|
this.signMe(!this.signMe());
|
||||||
|
}
|
||||||
|
|
||||||
submitCommand(self, event) {
|
submitCommand(self, event) {
|
||||||
const email = this.email().trim();
|
const email = this.email().trim();
|
||||||
this.email(email);
|
this.email(email);
|
||||||
|
|
|
||||||
|
|
@ -225,6 +225,10 @@ export class MailMessageView extends AbstractViewRight {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
toggleFullInfo() {
|
||||||
|
this.showFullInfo(!this.showFullInfo());
|
||||||
|
}
|
||||||
|
|
||||||
closeMessage() {
|
closeMessage() {
|
||||||
currentMessage(null);
|
currentMessage(null);
|
||||||
}
|
}
|
||||||
|
|
@ -393,9 +397,7 @@ export class MailMessageView extends AbstractViewRight {
|
||||||
|
|
||||||
// message information
|
// message information
|
||||||
registerShortcut('i', 'meta', [Scope.MessageList, Scope.MessageView], () => {
|
registerShortcut('i', 'meta', [Scope.MessageList, Scope.MessageView], () => {
|
||||||
if (currentMessage()) {
|
currentMessage() && this.toggleFullInfo();
|
||||||
this.showFullInfo(!this.showFullInfo());
|
|
||||||
}
|
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
<div class="descWrapper" data-i18n="TOP_PANEL/LABEL_ADMIN_PANEL"></div>
|
<div class="descWrapper" data-i18n="TOP_PANEL/LABEL_ADMIN_PANEL"></div>
|
||||||
<div class="alert" data-bind="hidden: !submitError()">
|
<div class="alert" data-bind="hidden: !submitError()">
|
||||||
<a href="#" class="close" data-bind="click: function () { submitError('') }">×</a>
|
<a href="#" class="close" data-bind="click: hideError">×</a>
|
||||||
<span data-bind="text: submitError"></span>
|
<span data-bind="text: submitError"></span>
|
||||||
</div>
|
</div>
|
||||||
<form action="#/" spellcheck="false" data-bind="submit: submitForm, css: {'errorAnimated': formError, 'submitting': submitRequest()}">
|
<form action="#/" spellcheck="false" data-bind="submit: submitForm, css: {'errorAnimated': formError, 'submitting': submitRequest()}">
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@
|
||||||
<form class="form-horizontal plugin-form" action="#/" spellcheck="false" onsubmit="return false;">
|
<form class="form-horizontal plugin-form" action="#/" spellcheck="false" onsubmit="return false;">
|
||||||
<div class="alert alert-info" data-bind="visible: !hasConfiguration()" data-i18n="POPUPS_PLUGIN/DESC_NOTHING_TO_CONFIGURE"></div>
|
<div class="alert alert-info" data-bind="visible: !hasConfiguration()" data-i18n="POPUPS_PLUGIN/DESC_NOTHING_TO_CONFIGURE"></div>
|
||||||
<div class="alert" data-bind="visible: '' !== saveError()">
|
<div class="alert" data-bind="visible: '' !== saveError()">
|
||||||
<a href="#" class="close" data-bind="click: function () { saveError('') }">×</a>
|
<a href="#" class="close" data-bind="click: hideError">×</a>
|
||||||
<span data-bind="text: saveError"></span>
|
<span data-bind="text: saveError"></span>
|
||||||
</div>
|
</div>
|
||||||
<div data-bind="foreach: config, visible: hasConfiguration">
|
<div data-bind="foreach: config, visible: hasConfiguration">
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
<div class="descWrapper" data-bind="visible: '' !== loadingDesc, text: loadingDesc"></div>
|
<div class="descWrapper" data-bind="visible: '' !== loadingDesc, text: loadingDesc"></div>
|
||||||
<div class="alert" data-bind="hidden: !submitError()" hidden="">
|
<div class="alert" data-bind="hidden: !submitError()" hidden="">
|
||||||
<a href="#" class="close" data-bind="click: function () { submitError('') }">×</a>
|
<a href="#" class="close" data-bind="click: hideError">×</a>
|
||||||
<span data-bind="text: submitError"></span>
|
<span data-bind="text: submitError"></span>
|
||||||
<p data-bind="visible: '' !== submitErrorAdditional()">
|
<p data-bind="visible: '' !== submitErrorAdditional()">
|
||||||
<span data-i18n="GLOBAL/SERVER_MESSAGE"></span>:
|
<span data-i18n="GLOBAL/SERVER_MESSAGE"></span>:
|
||||||
|
|
@ -25,7 +25,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div id="plugin-Login-BottomControlGroup"></div>
|
<div id="plugin-Login-BottomControlGroup"></div>
|
||||||
<div class="controls" style="display: flex">
|
<div class="controls" style="display: flex">
|
||||||
<div class="e-checkbox" tabindex="0" data-bind="click: function(){signMe(!signMe())}, onSpace: function(){signMe(!signMe())}">
|
<div class="e-checkbox" tabindex="0" data-bind="click: toggleSignMe, onSpace: toggleSignMe">
|
||||||
<i role="checkbox" class="fontastic" data-bind="text: signMe() ? '☑' : '☐'"></i>
|
<i role="checkbox" class="fontastic" data-bind="text: signMe() ? '☑' : '☐'"></i>
|
||||||
<span data-i18n="LOGIN/LABEL_SIGN_ME"></span>
|
<span data-i18n="LOGIN/LABEL_SIGN_ME"></span>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -123,7 +123,7 @@
|
||||||
|
|
||||||
<div class="messageItemHeader">
|
<div class="messageItemHeader">
|
||||||
<div class="subjectParent">
|
<div class="subjectParent">
|
||||||
<span class="infoParent g-ui-user-select-none fontastic" data-bind="click: function() { showFullInfo(!showFullInfo()); }">ℹ</span>
|
<span class="infoParent g-ui-user-select-none fontastic" data-bind="click: toggleFullInfo">ℹ</span>
|
||||||
<span class="flagParent g-ui-user-select-none flagOff fontastic" data-bind="text: message().isFlagged() ? '★' : '☆', css: {'flagOn': message().isFlagged(), 'flagOff': !message().isFlagged()}"></span>
|
<span class="flagParent g-ui-user-select-none flagOff fontastic" data-bind="text: message().isFlagged() ? '★' : '☆', css: {'flagOn': message().isFlagged(), 'flagOff': !message().isFlagged()}"></span>
|
||||||
<span class="subject" data-bind="text: message().subject, title: message().subject"></span>
|
<span class="subject" data-bind="text: message().subject, title: message().subject"></span>
|
||||||
<a href="#" class="close" data-bind="click: closeMessage" style="margin-top: -8px;">×</a>
|
<a href="#" class="close" data-bind="click: closeMessage" style="margin-top: -8px;">×</a>
|
||||||
|
|
@ -251,8 +251,7 @@
|
||||||
<div class="attachmentSize" data-bind="text: friendlySize()"></div>
|
<div class="attachmentSize" data-bind="text: friendlySize()"></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="checkboxAttachment fontastic"
|
<div class="checkboxAttachment fontastic"
|
||||||
data-bind="visible: download, text: checked() ? '☑' : '☐',
|
data-bind="visible: download, text: checked() ? '☑' : '☐', click: toggleChecked"></div>
|
||||||
click: function () { checked(!checked()); return false }"></div>
|
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
<!-- /ko -->
|
<!-- /ko -->
|
||||||
|
|
@ -261,8 +260,7 @@
|
||||||
<li class="attachmentItem" data-bind="attr: { 'title': fileName }, css: {'checked': checked}">
|
<li class="attachmentItem" data-bind="attr: { 'title': fileName }, css: {'checked': checked}">
|
||||||
<span class="attachmentName" data-bind="text: fileName"></span>
|
<span class="attachmentName" data-bind="text: fileName"></span>
|
||||||
<i class="checkboxAttachment fontastic"
|
<i class="checkboxAttachment fontastic"
|
||||||
data-bind="visible: download, text: checked() ? '☑' : '☐',
|
data-bind="visible: download, text: checked() ? '☑' : '☐', click: toggleChecked"></i>
|
||||||
click: function () { checked(!checked()); return false }"></i>
|
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
<!-- /ko -->
|
<!-- /ko -->
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@
|
||||||
</header>
|
</header>
|
||||||
<form id="accountform" class="modal-body form-horizontal" autocomplete="off" spellcheck="false" data-bind="submit: submitForm">
|
<form id="accountform" class="modal-body form-horizontal" autocomplete="off" spellcheck="false" data-bind="submit: submitForm">
|
||||||
<div class="alert" data-bind="visible: '' !== submitError()">
|
<div class="alert" data-bind="visible: '' !== submitError()">
|
||||||
<a href="#" class="close" data-bind="click: function () { submitError('') }">×</a>
|
<a href="#" class="close" data-bind="click: hideError">×</a>
|
||||||
<span data-bind="text: submitError"></span>
|
<span data-bind="text: submitError"></span>
|
||||||
<div data-bind="visible: submitErrorAdditional, text: submitErrorAdditional"></div>
|
<div data-bind="visible: submitErrorAdditional, text: submitErrorAdditional"></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
</header>
|
</header>
|
||||||
<form id="openpgp-generate" class="modal-body form-horizontal" autocomplete="off" spellcheck="false" data-bind="submit: submitForm">
|
<form id="openpgp-generate" class="modal-body form-horizontal" autocomplete="off" spellcheck="false" data-bind="submit: submitForm">
|
||||||
<div class="alert" data-bind="visible: '' !== submitError()">
|
<div class="alert" data-bind="visible: '' !== submitError()">
|
||||||
<a href="#" class="close" data-bind="click: function () { submitError('') }">×</a>
|
<a href="#" class="close" data-bind="click: hideError">×</a>
|
||||||
<span data-bind="text: submitError"></span>
|
<span data-bind="text: submitError"></span>
|
||||||
</div>
|
</div>
|
||||||
<!-- Disable stupid browser password autofill -->
|
<!-- Disable stupid browser password autofill -->
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,7 @@
|
||||||
<span data-i18n="SETTINGS_FOLDERS/TO_MANY_FOLDERS_DESC_2"></span>
|
<span data-i18n="SETTINGS_FOLDERS/TO_MANY_FOLDERS_DESC_2"></span>
|
||||||
</div>
|
</div>
|
||||||
<div class="alert folders-list-error" data-bind="visible: '' !== folderListError()">
|
<div class="alert folders-list-error" data-bind="visible: '' !== folderListError()">
|
||||||
<a href="#" class="close" data-bind="click: function () { folderListError(''); }">×</a>
|
<a href="#" class="close" data-bind="click: hideError">×</a>
|
||||||
<span data-bind="text: folderListError"></span>
|
<span data-bind="text: folderListError"></span>
|
||||||
</div>
|
</div>
|
||||||
<table class="table table-hover list-table" data-bind="i18nUpdate: folderList">
|
<table class="table table-hover list-table" data-bind="i18nUpdate: folderList">
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
<span data-bind="saveTrigger: themeTrigger"></span>
|
<span data-bind="saveTrigger: themeTrigger"></span>
|
||||||
</div>
|
</div>
|
||||||
<div data-bind="foreach: themesObjects">
|
<div data-bind="foreach: themesObjects">
|
||||||
<figure data-bind="click: function () { $root.theme(name); }, css: { 'selected': selected }">
|
<figure data-bind="click: $root.setTheme, css: { 'selected': selected }">
|
||||||
<figcaption data-bind="text: nameDisplay"></figcaption>
|
<figcaption data-bind="text: nameDisplay"></figcaption>
|
||||||
<img data-bind="attr: { 'src': themePreviewSrc }">
|
<img data-bind="attr: { 'src': themePreviewSrc }">
|
||||||
</figure>
|
</figure>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue