mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-07-13 03:27:39 +03:00
CLeanup Nextcloud javascript code
This commit is contained in:
parent
a1cafb1d0c
commit
fd0a41cfaf
3 changed files with 23 additions and 28 deletions
|
|
@ -43,8 +43,8 @@
|
||||||
let template = document.getElementById('PopupsCompose');
|
let template = document.getElementById('PopupsCompose');
|
||||||
const uploadBtn = template.content.querySelector('#composeUploadButton');
|
const uploadBtn = template.content.querySelector('#composeUploadButton');
|
||||||
if (uploadBtn) {
|
if (uploadBtn) {
|
||||||
uploadBtn.after(Element.fromHTML('<a class="btn fontastic"'
|
uploadBtn.after(Element.fromHTML(`<a class="btn fontastic" data-bind="click: nextcloudAttach"
|
||||||
+ ' data-bind="click: nextcloudAttach" data-i18n="[title]NEXTCLOUD/ATTACH_FILES">◦◯◦</a>'));
|
data-i18n="[title]NEXTCLOUD/ATTACH_FILES">◦◯◦</a>`));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -69,18 +69,12 @@
|
||||||
|
|
||||||
view.nextcloudSaveICS = () => {
|
view.nextcloudSaveICS = () => {
|
||||||
let attachment = view.nextcloudICS();
|
let attachment = view.nextcloudICS();
|
||||||
attachment && rl.nextcloud.selectCalendar().then(href => {
|
attachment && rl.nextcloud.selectCalendar()
|
||||||
if (href) {
|
.then(href =>
|
||||||
fetch(attachment.linkDownload(), {
|
href && rl.fetch(attachment.linkDownload())
|
||||||
mode: 'same-origin',
|
.then(response => (response.status < 400) ? response.text() : Promise.reject(new Error({ response })))
|
||||||
cache: 'no-cache',
|
.then(text => rl.nextcloud.calendarPut(href, text))
|
||||||
redirect: 'error',
|
);
|
||||||
credentials: 'same-origin'
|
|
||||||
})
|
|
||||||
.then(response => (response.status < 400) ? response.text() : Promise.reject(new Error({ response })))
|
|
||||||
.then(text => rl.nextcloud.calendarPut(href, text));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -89,26 +83,27 @@
|
||||||
|
|
||||||
const attachmentsControls = template.content.querySelector('.attachmentsControls');
|
const attachmentsControls = template.content.querySelector('.attachmentsControls');
|
||||||
if (attachmentsControls) {
|
if (attachmentsControls) {
|
||||||
attachmentsControls.append(Element.fromHTML('<span>'
|
attachmentsControls.append(Element.fromHTML(`<span>
|
||||||
+ '<i class="fontastic iconcolor-red" data-bind="visible: saveNextcloudError">✖</i>'
|
<i class="fontastic iconcolor-red" data-bind="visible: saveNextcloudError">✖</i>
|
||||||
+ '<i class="fontastic" data-bind="visible: !saveNextcloudError(), css: {\'icon-spinner\': saveNextcloudLoading()}">💾</i>'
|
<i class="fontastic" data-bind="visible: !saveNextcloudError(),
|
||||||
+ '<span class="g-ui-link" data-bind="click: saveNextcloud" data-i18n="NEXTCLOUD/SAVE_ATTACHMENTS"></span>'
|
css: {'icon-spinner': saveNextcloudLoading()}">💾</i>
|
||||||
+ '</span>'));
|
<span class="g-ui-link" data-bind="click: saveNextcloud" data-i18n="NEXTCLOUD/SAVE_ATTACHMENTS"></span>
|
||||||
|
</span>`));
|
||||||
|
|
||||||
// https://github.com/nextcloud/calendar/issues/4684
|
// https://github.com/nextcloud/calendar/issues/4684
|
||||||
let cfg = rl.settings.get('Nextcloud');
|
let cfg = rl.settings.get('Nextcloud');
|
||||||
if (cfg.CalDAV) {
|
if (cfg.CalDAV) {
|
||||||
attachmentsControls.append(Element.fromHTML('<span data-bind="visible: nextcloudICS" data-icon="📅">'
|
attachmentsControls.append(Element.fromHTML(`<span data-bind="visible: nextcloudICS" data-icon="📅">
|
||||||
+ '<span class="g-ui-link" data-bind="click: nextcloudSaveICS" data-i18n="NEXTCLOUD/SAVE_ICS"></span>'
|
<span class="g-ui-link" data-bind="click: nextcloudSaveICS" data-i18n="NEXTCLOUD/SAVE_ICS"></span>
|
||||||
+ '</span>'));
|
</span>`));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const msgMenu = template.content.querySelector('#more-view-dropdown-id + menu');
|
const msgMenu = template.content.querySelector('#more-view-dropdown-id + menu');
|
||||||
if (msgMenu) {
|
if (msgMenu) {
|
||||||
msgMenu.append(Element.fromHTML('<li role="presentation">'
|
msgMenu.append(Element.fromHTML(`<li role="presentation">
|
||||||
+ '<a href="#" tabindex="-1" data-icon="📥" data-bind="click: nextcloudSaveMsg" data-i18n="NEXTCLOUD/SAVE_EML"></a>'
|
<a href="#" tabindex="-1" data-icon="📥" data-bind="click: nextcloudSaveMsg" data-i18n="NEXTCLOUD/SAVE_EML"></a>
|
||||||
+ '</li>'));
|
</li>`));
|
||||||
}
|
}
|
||||||
|
|
||||||
})(window.rl);
|
})(window.rl);
|
||||||
|
|
|
||||||
|
|
@ -32,9 +32,9 @@
|
||||||
|
|
||||||
const msgMenu = template.content.querySelector('#more-list-dropdown-id + menu [data-bind*="forwardCommand"]');
|
const msgMenu = template.content.querySelector('#more-list-dropdown-id + menu [data-bind*="forwardCommand"]');
|
||||||
if (msgMenu) {
|
if (msgMenu) {
|
||||||
msgMenu.after(Element.fromHTML('<li role="presentation" data-bind="css:{disabled:!messageList.hasChecked()}">'
|
msgMenu.after(Element.fromHTML(`<li role="presentation" data-bind="css:{disabled:!messageList.hasChecked()}">
|
||||||
+ '<a href="#" tabindex="-1" data-icon="📥" data-bind="click: nextcloudSaveMsgs" data-i18n="NEXTCLOUD/SAVE_EML"></a>'
|
<a href="#" tabindex="-1" data-icon="📥" data-bind="click: nextcloudSaveMsgs" data-i18n="NEXTCLOUD/SAVE_EML"></a>
|
||||||
+ '</li>'));
|
</li>`));
|
||||||
}
|
}
|
||||||
|
|
||||||
})(window.rl);
|
})(window.rl);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue