created dark mode (both dark.min.js or class = dark), as issue #41

This commit is contained in:
Matteo Manzinello 2020-07-16 20:25:29 +02:00
parent 00965a58a3
commit 36857577b9
8 changed files with 27 additions and 13 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

2
dist/mailgo.min.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -39,6 +39,10 @@
href="mailto:matteo@manzinello.dev?cc=matteomanzinello@gmail.com&bcc=test"
>matteo@manzinello.dev</a
>
<br />
<a class="dark" href="mailto:matteo@manzinello.dev"
>matteo@manzinello.dev dark mode</a
>
<h1>tel:</h1>
<a href="#mailgo" data-tel="123456568" data-telegram="telegram">chiamami</a>

View File

@ -556,6 +556,8 @@ var mailgo_mailgoInit = function mailgoInit(mailgoConfig) {
var mailgoRender = function mailgoRender() {
var _config7;
var type = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : MAIL_TYPE;
var mailgoElement = arguments.length > 1 ? arguments[1] : undefined;
@ -654,12 +656,16 @@ var mailgoRender = function mailgoRender() {
copyTel.addEventListener("click", function () {
return copy(tel);
});
} // dark mode as class of the element
// check only if is present to set the dark mode, because if the dark mode is set in config it have not to be disabled
} // if config.dark is set to true then all the modals will be in dark mode
if (mailgoElement.classList.contains("dark")) {
enableDarkMode(type);
if (!((_config7 = config) === null || _config7 === void 0 ? void 0 : _config7.dark)) {
// if the element contains dark as class enable dark mode
if (mailgoElement.classList.contains("dark")) {
enableDarkMode(type);
} else {
disableDarkMode(type);
}
} // show the mailgo

File diff suppressed because one or more lines are too long

View File

@ -551,10 +551,14 @@ const mailgoRender = (
copyTel.addEventListener("click", () => copy(tel));
}
// dark mode as class of the element
// check only if is present to set the dark mode, because if the dark mode is set in config it have not to be disabled
if (mailgoElement.classList.contains("dark")) {
enableDarkMode(type);
// if config.dark is set to true then all the modals will be in dark mode
if (!config?.dark) {
// if the element contains dark as class enable dark mode
if (mailgoElement.classList.contains("dark")) {
enableDarkMode(type);
} else {
disableDarkMode(type);
}
}
// show the mailgo