working on window config and new showFooter

This commit is contained in:
Matteo Manzinello
2020-07-29 16:27:44 +02:00
parent cbec242435
commit b6c6f327db
12 changed files with 29 additions and 23 deletions
+1 -1
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long
+1
View File
@@ -73,6 +73,7 @@
<script>
window.mailgoConfig = {
dark: true,
showFooter: false,
};
</script>
+1 -1
View File
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+13 -8
View File
@@ -236,6 +236,12 @@ function toComment(sourceMap) {
__webpack_require__.r(__webpack_exports__);
// CONCATENATED MODULE: ../src/mailgo.ts
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
// i18n for mailgo
var i18n = __webpack_require__(0); // mailgo scss
@@ -290,8 +296,7 @@ var gmail, outlook, mailgo_open, telegram, wa, skype, call, copyMail, copyTel;
var mailgoInit = function mailgoInit() {
var _config, _config2;
console.log(config); // translations
// translations
var _ref = i18n,
translations = _ref.translations; // if a default language is defined use it
@@ -432,9 +437,9 @@ var mailgoInit = function mailgoInit() {
copyMail.classList.add("m-copy");
copyMail.classList.add("w-500");
copyMail.appendChild(createTextNode(strings.copy || defaultStrings.copy));
modalContent.appendChild(copyMail); // show mailgo.dev in footer only if showFooter == true
modalContent.appendChild(copyMail); // hide mailgo.dev in footer only if showFooter is defined and equal to false
if (typeof ((_config4 = config) === null || _config4 === void 0 ? void 0 : _config4.showFooter) === "undefined" || ((_config5 = config) === null || _config5 === void 0 ? void 0 : _config5.showFooter) === false) {
if (typeof ((_config4 = config) === null || _config4 === void 0 ? void 0 : _config4.showFooter) === "undefined" || ((_config5 = config) === null || _config5 === void 0 ? void 0 : _config5.showFooter) !== false) {
modalContent.appendChild(byElement());
} // add the modal at the end of the body
@@ -545,10 +550,10 @@ var mailgoInit = function mailgoInit() {
copyTel.classList.add("w-500");
copyTel.appendChild(createTextNode(strings.copy || defaultStrings.copy));
_modalContent.appendChild(copyTel); // show mailgo.dev in footer only if showFooter == true
_modalContent.appendChild(copyTel); // hide mailgo.dev in footer only if showFooter is defined and equal to false
if (typeof ((_config7 = config) === null || _config7 === void 0 ? void 0 : _config7.showFooter) === "undefined" || ((_config8 = config) === null || _config8 === void 0 ? void 0 : _config8.showFooter) === false) {
if (typeof ((_config7 = config) === null || _config7 === void 0 ? void 0 : _config7.showFooter) === "undefined" || ((_config8 = config) === null || _config8 === void 0 ? void 0 : _config8.showFooter) !== false) {
_modalContent.appendChild(byElement());
} // add the modal at the end of the body
@@ -1102,8 +1107,8 @@ var mailgoStyle = function mailgoStyle() {
function mailgo(mailgoConfig) {
var _ref2;
// set the global config if passed as parameter or keep it from window
config = mailgoConfig || ((_ref2 = window) === null || _ref2 === void 0 ? void 0 : _ref2.mailgoConfig); // if the window is defined...
// set the global config merging window mailgConfig and mailgoConfig passed as a parameter
config = _objectSpread(_objectSpread({}, mailgoConfig), ((_ref2 = window) === null || _ref2 === void 0 ? void 0 : _ref2.mailgoConfig) || null); // if the window is defined...
if (window && typeof window !== "undefined") {
var _config12;
+1 -1
View File
File diff suppressed because one or more lines are too long
+6 -6
View File
@@ -261,10 +261,10 @@ const mailgoInit = (): void => {
modalContent.appendChild(copyMail);
// show mailgo.dev in footer only if showFooter == true
// hide mailgo.dev in footer only if showFooter is defined and equal to false
if (
typeof config?.showFooter === "undefined" ||
config?.showFooter === false
config?.showFooter !== false
) {
modalContent.appendChild(byElement());
}
@@ -391,10 +391,10 @@ const mailgoInit = (): void => {
modalContent.appendChild(copyTel);
// show mailgo.dev in footer only if showFooter == true
// hide mailgo.dev in footer only if showFooter is defined and equal to false
if (
typeof config?.showFooter === "undefined" ||
config?.showFooter === false
config?.showFooter !== false
) {
modalContent.appendChild(byElement());
}
@@ -1035,8 +1035,8 @@ const mailgoStyle = (): void => {
// mailgo
function mailgo(mailgoConfig?: MailgoConfig): void {
// set the global config if passed as parameter or keep it from window
config = mailgoConfig || (window as any)?.mailgoConfig;
// set the global config merging window mailgConfig and mailgoConfig passed as a parameter
config = { ...mailgoConfig, ...((window as any)?.mailgoConfig || null) };
// if the window is defined...
if (window && typeof window !== "undefined") {