Running prettier
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Fabian Stamm
2020-08-07 16:16:39 +02:00
parent 77fedd2815
commit 51a8609880
87 changed files with 4000 additions and 2812 deletions

View File

@ -1,15 +1,15 @@
export function setCookie(cname, cvalue, exdate) {
var expires = exdate ? `;expires=${exdate}` : "";
document.cookie = `${cname}=${cvalue}${expires}`
document.cookie = `${cname}=${cvalue}${expires}`;
}
export function getCookie(cname) {
var name = cname + "=";
var decodedCookie = decodeURIComponent(document.cookie);
var ca = decodedCookie.split(';');
var ca = decodedCookie.split(";");
for (var i = 0; i < ca.length; i++) {
var c = ca[i];
while (c.charAt(0) == ' ') {
while (c.charAt(0) == " ") {
c = c.substring(1);
}
if (c.indexOf(name) == 0) {
@ -17,4 +17,4 @@ export function getCookie(cname) {
}
}
return "";
}
}

View File

@ -2,12 +2,11 @@ export default function fireEvent(element, event) {
if (document.createEventObject) {
// dispatch for IE
var evt = document.createEventObject();
return element.fireEvent('on' + event, evt)
}
else {
return element.fireEvent("on" + event, evt);
} else {
// dispatch for firefox + others
var evt = document.createEvent("HTMLEvents");
evt.initEvent(event, true, true); // event type,bubbling,cancelable
return !element.dispatchEvent(evt);
}
}
}

View File

@ -1,14 +1,18 @@
export default function getFormData(element) {
let data = {};
if (element.name !== undefined && element.name !== null && element.name !== "") {
if (
element.name !== undefined &&
element.name !== null &&
element.name !== ""
) {
if (typeof element.name === "string") {
if (element.type === "checkbox") data[element.name] = element.checked;
else data[element.name] = element.value;
}
}
element.childNodes.forEach(child => {
element.childNodes.forEach((child) => {
let res = getFormData(child);
data = Object.assign(data, res);
})
});
return data;
}
}

View File

@ -1,24 +1,24 @@
(() => {
const run = () => {
document.querySelectorAll(".floating>input").forEach(e => {
document.querySelectorAll(".floating>input").forEach((e) => {
function checkState() {
if (e.value !== "") {
if (e.classList.contains("used")) return;
e.classList.add("used")
e.classList.add("used");
} else {
if (e.classList.contains("used")) e.classList.remove("used")
if (e.classList.contains("used")) e.classList.remove("used");
}
}
e.addEventListener("change", () => checkState())
checkState()
})
}
e.addEventListener("change", () => checkState());
checkState();
});
};
run();
var mutationObserver = new MutationObserver(() => {
run()
run();
});
mutationObserver.observe(document.documentElement, {
@ -28,6 +28,6 @@
subtree: true,
});
window.Mutt
window.addEventListener("DOMNodeInserted", () => run())
})();
window.Mutt;
window.addEventListener("DOMNodeInserted", () => run());
})();

View File

@ -5,7 +5,7 @@
min-height: 45px;
}
.floating>input {
.floating > input {
font-size: 18px;
padding: 10px 10px 10px 5px;
appearance: none;
@ -19,13 +19,13 @@
border-bottom: 1px solid #757575;
}
.floating>input:focus {
.floating > input:focus {
outline: none;
}
/* Label */
.floating>label {
.floating > label {
color: #999;
font-size: 18px;
font-weight: normal;
@ -38,10 +38,10 @@
/* active */
.floating>input:focus~label,
.floating>input.used~label {
top: -.75em;
transform: scale(.75);
.floating > input:focus ~ label,
.floating > input.used ~ label {
top: -0.75em;
transform: scale(0.75);
left: -2px;
/* font-size: 14px; */
color: $primary;
@ -58,7 +58,7 @@
.bar:before,
.bar:after {
content: '';
content: "";
height: 2px;
width: 0;
bottom: 1px;
@ -77,8 +77,8 @@
/* active */
.floating>input:focus~.bar:before,
.floating>input:focus~.bar:after {
.floating > input:focus ~ .bar:before,
.floating > input:focus ~ .bar:after {
width: 50%;
}
@ -96,7 +96,7 @@
/* active */
.floating>input:focus~.highlight {
.floating > input:focus ~ .highlight {
animation: inputHighlighter 0.3s ease;
}
@ -110,4 +110,4 @@
width: 0;
background: transparent;
}
}
}

View File

@ -1,2 +1,2 @@
@import url("https://fonts.googleapis.com/css?family=Roboto:300,400,500,700|Material+Icons");
@import url("https://unpkg.com/bootstrap-material-design@4.1.1/dist/css/bootstrap-material-design.min.css");
@import url("https://unpkg.com/bootstrap-material-design@4.1.1/dist/css/bootstrap-material-design.min.css");

File diff suppressed because one or more lines are too long

View File

@ -1,16 +1,26 @@
export default function request(endpoint, method, data) {
var headers = new Headers();
headers.set('Content-Type', 'application/json');
headers.set("Content-Type", "application/json");
return fetch(endpoint, {
method: method,
body: JSON.stringify(data),
headers: headers,
credentials: "include"
}).then(async e => {
if (e.status !== 200) throw new Error(await e.text() || e.statusText);
return e.json()
}).then(e => {
if (e.error) return Promise.reject(new Error(typeof e.error === "string" ? e.error : JSON.stringify(e.error)));
return e;
credentials: "include",
})
}
.then(async (e) => {
if (e.status !== 200)
throw new Error((await e.text()) || e.statusText);
return e.json();
})
.then((e) => {
if (e.error)
return Promise.reject(
new Error(
typeof e.error === "string"
? e.error
: JSON.stringify(e.error)
)
);
return e;
});
}

File diff suppressed because one or more lines are too long

View File

@ -1,7 +1,7 @@
// $primary: #4a89dc;
$primary: #1E88E5;
$primary: #1e88e5;
$error: #ff2f00;
.btn-primary {
color: white !important;
background-color: $primary !important;
}
}