css in js, gulp

This commit is contained in:
Matteo Manzinello 2019-05-02 21:32:30 +02:00
parent f017dfa686
commit edb2d43601
4 changed files with 5640 additions and 5 deletions

49
dist/mailgo.js vendored
View File

@ -1 +1,48 @@
!function(e){var n={};function t(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,t),o.l=!0,o.exports}t.m=e,t.c=n,t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{enumerable:!0,get:r})},t.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},t.t=function(e,n){if(1&n&&(e=t(e)),8&n)return e;if(4&n&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(t.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&n&&"string"!=typeof e)for(var o in e)t.d(r,o,function(n){return e[n]}.bind(null,o));return r},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,n){return Object.prototype.hasOwnProperty.call(e,n)},t.p="",t(t.s=0)}([function(e,n,t){"use strict";t.r(n);t(1);let r=document.querySelectorAll('a[href^="mailto:"]:not(.no-mailgo)');console.log("mailgo is WIP"),r.forEach(e=>{let n=document.createElement("div");n.className="mailgo-modal-container";let t=document.createElement("div");t.className="mailgo-modal",n.appendChild(t);let r=document.createTextNode("mailgo");t.appendChild(r),e.parentNode.insertBefore(n,e.nextSibling),e.addEventListener("click",e=>{e.preventDefault()},!1)})},function(e,n,t){(e.exports=t(2)(!1)).push([e.i,".mailgo-container {\n background: white;\n}\n",""])},function(e,n,t){"use strict";e.exports=function(e){var n=[];return n.toString=function(){return this.map(function(n){var t=function(e,n){var t=e[1]||"",r=e[3];if(!r)return t;if(n&&"function"==typeof btoa){var o=(u=r,"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(u))))+" */"),i=r.sources.map(function(e){return"/*# sourceURL="+r.sourceRoot+e+" */"});return[t].concat(i).concat([o]).join("\n")}var u;return[t].join("\n")}(n,e);return n[2]?"@media "+n[2]+"{"+t+"}":t}).join("")},n.i=function(e,t){"string"==typeof e&&(e=[[null,e,""]]);for(var r={},o=0;o<this.length;o++){var i=this[o][0];null!=i&&(r[i]=!0)}for(o=0;o<e.length;o++){var u=e[o];null!=u[0]&&r[u[0]]||(t&&!u[2]?u[2]=t:t&&(u[2]="("+u[2]+") and ("+t+")"),n.push(u))}},n}}]);
// Your CSS as text
var styles = `
.mailgo-modal-container {
background: white;
}
`;
let styleSheet = document.createElement("style");
styleSheet.type = "text/css";
styleSheet.innerText = styles;
document.head.appendChild(styleSheet);
// ottengo tutti i mailto contenuti nella pagina
let mailgos = document.querySelectorAll('a[href^="mailto:"]:not(.no-mailgo)');
console.log("mailgo is WIP");
// attivo mailgo su tutti gli elementi
mailgos.forEach(mailgo => {
let modalContainer = document.createElement("div");
modalContainer.className = "mailgo-modal-container";
let modal = document.createElement("div");
modal.className = "mailgo-modal";
modalContainer.appendChild(modal);
let modalContent = document.createTextNode("mailgo");
modal.appendChild(modalContent);
mailgo.parentNode.insertBefore(modalContainer, mailgo.nextSibling);
mailgo.addEventListener(
"click",
event => {
// blocco l'esecuzione normale del mailto:
event.preventDefault();
// mostro un alert
/*
let r = confirm("You have clicked mailto: " + mailto.href);
if (r === true) {
location.href = mailto.href;
}
*/
},
false
);
});

5581
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,3 +0,0 @@
.mailgo-container {
background: white;
}

View File

@ -1,4 +1,14 @@
import "./mailgo.css";
// Your CSS as text
var styles = `
.mailgo-modal-container {
background: white;
}
`;
let styleSheet = document.createElement("style");
styleSheet.type = "text/css";
styleSheet.innerText = styles;
document.head.appendChild(styleSheet);
// ottengo tutti i mailto contenuti nella pagina
let mailgos = document.querySelectorAll('a[href^="mailto:"]:not(.no-mailgo)');