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" href="mailto:matteo@manzinello.dev?cc=matteomanzinello@gmail.com&bcc=test"
>matteo@manzinello.dev</a >matteo@manzinello.dev</a
> >
<br />
<a class="dark" href="mailto:matteo@manzinello.dev"
>matteo@manzinello.dev dark mode</a
>
<h1>tel:</h1> <h1>tel:</h1>
<a href="#mailgo" data-tel="123456568" data-telegram="telegram">chiamami</a> <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 mailgoRender = function mailgoRender() {
var _config7;
var type = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : MAIL_TYPE; var type = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : MAIL_TYPE;
var mailgoElement = arguments.length > 1 ? arguments[1] : undefined; var mailgoElement = arguments.length > 1 ? arguments[1] : undefined;
@ -654,12 +656,16 @@ var mailgoRender = function mailgoRender() {
copyTel.addEventListener("click", function () { copyTel.addEventListener("click", function () {
return copy(tel); return copy(tel);
}); });
} // dark mode as class of the element } // if config.dark is set to true then all the modals will be in dark mode
// 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")) { if (!((_config7 = config) === null || _config7 === void 0 ? void 0 : _config7.dark)) {
enableDarkMode(type); // if the element contains dark as class enable dark mode
if (mailgoElement.classList.contains("dark")) {
enableDarkMode(type);
} else {
disableDarkMode(type);
}
} // show the mailgo } // 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)); copyTel.addEventListener("click", () => copy(tel));
} }
// dark mode as class of the element // if config.dark is set to true then all the modals will be in dark mode
// 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) {
if (mailgoElement.classList.contains("dark")) { // if the element contains dark as class enable dark mode
enableDarkMode(type); if (mailgoElement.classList.contains("dark")) {
enableDarkMode(type);
} else {
disableDarkMode(type);
}
} }
// show the mailgo // show the mailgo