mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-10-31 09:33:33 +03:00
Cleanup Nextcloud code and added mockup for Unified search
https://github.com/the-djmaze/snappymail/issues/96#issuecomment-1277586143
This commit is contained in:
parent
61770dd5c7
commit
d78cf50211
11 changed files with 148 additions and 111 deletions
|
|
@ -1,2 +0,0 @@
|
|||
|
||||
SnappyMailFormHelper('admin-form', 'admin.php');
|
||||
|
|
@ -1,2 +0,0 @@
|
|||
|
||||
SnappyMailFormHelper('personal-form', 'personal.php');
|
||||
|
|
@ -1,18 +0,0 @@
|
|||
document.addEventListener('readystatechange', () => {
|
||||
if (document.readyState === 'complete') {
|
||||
const
|
||||
buffer = 0, //was 5 but this was creating a white space of 5px at the bottom of the page
|
||||
ifr = document.getElementById('rliframe'),
|
||||
pageY = elem => elem.offsetParent ? (elem.offsetTop + pageY(elem.offsetParent)) : elem.offsetTop,
|
||||
resizeIframe = () => {
|
||||
var height = document.documentElement.clientHeight;
|
||||
height -= pageY(ifr) + buffer;
|
||||
height = (height < 0) ? 0 : height;
|
||||
ifr.style.height = height + 'px';
|
||||
};
|
||||
if (ifr) {
|
||||
ifr.onload = resizeIframe;
|
||||
window.onresize = resizeIframe;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
@ -8,7 +8,11 @@
|
|||
|
||||
// Do the following things once the document is fully loaded.
|
||||
document.onreadystatechange = () => {
|
||||
(document.readyState === 'complete') && watchIFrameTitle();
|
||||
if (document.readyState === 'complete') {
|
||||
watchIFrameTitle();
|
||||
let form = document.querySelector('form.snappymail');
|
||||
form && SnappyMailFormHelper(form);
|
||||
}
|
||||
};
|
||||
|
||||
// The SnappyMail application is already configured to modify the <title> element
|
||||
|
|
@ -43,12 +47,11 @@ function watchIFrameTitle() {
|
|||
observer.observe(target, config);
|
||||
}
|
||||
|
||||
function SnappyMailFormHelper(sID, sFetchFile, fCallback)
|
||||
function SnappyMailFormHelper(oForm)
|
||||
{
|
||||
try
|
||||
{
|
||||
var
|
||||
oForm = document.getElementById('mail-snappymail-' + sID),
|
||||
oSubmit = document.getElementById('snappymail-save-button'),
|
||||
sSubmitValue = oSubmit.textContent,
|
||||
oDesc = oForm.querySelector('.snappymail-result-desc')
|
||||
|
|
@ -64,7 +67,10 @@ function SnappyMailFormHelper(sID, sFetchFile, fCallback)
|
|||
oDesc.textContent = '';
|
||||
oSubmit.textContent = '...';
|
||||
|
||||
fetch(OC.filePath('snappymail', 'fetch', sFetchFile), {
|
||||
let data = new FormData(oForm);
|
||||
data.set('appname', 'snappymail');
|
||||
|
||||
fetch(OC.filePath('snappymail', 'fetch', oForm.getAttribute('action')), {
|
||||
mode: 'same-origin',
|
||||
cache: 'no-cache',
|
||||
redirect: 'error',
|
||||
|
|
@ -72,7 +78,7 @@ function SnappyMailFormHelper(sID, sFetchFile, fCallback)
|
|||
credentials: 'same-origin',
|
||||
method: 'POST',
|
||||
headers: {},
|
||||
body: new FormData(oForm)
|
||||
body: data
|
||||
})
|
||||
.then(response => response.json())
|
||||
.then(oData => {
|
||||
|
|
@ -90,7 +96,6 @@ function SnappyMailFormHelper(sID, sFetchFile, fCallback)
|
|||
oDesc.textContent = t('snappymail', 'Error');
|
||||
}
|
||||
}
|
||||
fCallback?.(bResult, oData);
|
||||
});
|
||||
|
||||
return false;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue