added a new possibility to enable mailgo, with the attribute mailgo in the a element
This commit is contained in:
parent
e735733099
commit
ec515f6a06
7
dist/mailgo.js
vendored
7
dist/mailgo.js
vendored
@ -308,18 +308,17 @@ mailgoCheckRender = event => {
|
|||||||
// check if the id=mailgo exists in the body
|
// check if the id=mailgo exists in the body
|
||||||
if (!document.body.contains(getE("mailgo"))) return;
|
if (!document.body.contains(getE("mailgo"))) return;
|
||||||
|
|
||||||
console.log(e.href.toLowerCase());
|
|
||||||
|
|
||||||
if (
|
if (
|
||||||
// first case: it is an <a> element with "mailto:..." in href and no no-mailgo in classList
|
// first case: it is an <a> element with "mailto:..." in href and no no-mailgo in classList
|
||||||
(e.href &&
|
(e.href &&
|
||||||
e.href.toLowerCase().startsWith(MAILTO) &&
|
e.href.toLowerCase().startsWith(MAILTO) &&
|
||||||
!e.classList.contains("no-mailgo")) ||
|
!e.classList.contains("no-mailgo")) ||
|
||||||
// second case: the href=#mailgo
|
// second case: the href=#mailgo
|
||||||
// TODO FIX here
|
|
||||||
(e.href && e.getAttribute("href").toLowerCase() === "#mailgo") ||
|
(e.href && e.getAttribute("href").toLowerCase() === "#mailgo") ||
|
||||||
// third case: the classList contains mailgo
|
// third case: the classList contains mailgo
|
||||||
e.classList.contains("mailgo")
|
e.classList.contains("mailgo") ||
|
||||||
|
// fourth case: exists the attribute mailgo in the <a> element
|
||||||
|
!!e.getAttribute("mailgo")
|
||||||
) {
|
) {
|
||||||
// stop the normal execution of the element click
|
// stop the normal execution of the element click
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
2
dist/mailgo.min.js
vendored
2
dist/mailgo.min.js
vendored
File diff suppressed because one or more lines are too long
@ -316,7 +316,9 @@ mailgoCheckRender = event => {
|
|||||||
// second case: the href=#mailgo
|
// second case: the href=#mailgo
|
||||||
(e.href && e.getAttribute("href").toLowerCase() === "#mailgo") ||
|
(e.href && e.getAttribute("href").toLowerCase() === "#mailgo") ||
|
||||||
// third case: the classList contains mailgo
|
// third case: the classList contains mailgo
|
||||||
e.classList.contains("mailgo")
|
e.classList.contains("mailgo") ||
|
||||||
|
// fourth case: exists the attribute mailgo in the <a> element
|
||||||
|
!!e.getAttribute("mailgo")
|
||||||
) {
|
) {
|
||||||
// stop the normal execution of the element click
|
// stop the normal execution of the element click
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user