diff --git a/dist/js/marka.js b/dist/js/marka.js index d63be05..78635a3 100644 --- a/dist/js/marka.js +++ b/dist/js/marka.js @@ -7,8 +7,7 @@ * Released under the MIT license * https://github.com/fians/marka/blob/master/LICENSE */ - -;(function(window) { +(function() { 'use strict'; // Blocks needed to create the icon @@ -371,6 +370,13 @@ return this; }; - window.Marka = Marka; + // UMD wrapper that works with window, node.js, and AMD modules + if (typeof module !== 'undefined' && module.exports) { + module.exports = Marka; + } else if (typeof define === 'function' && define.amd) { + define(Marka); + } else if (window) { + window.Marka = Marka; + } -})(window); \ No newline at end of file +})(); \ No newline at end of file diff --git a/dist/js/marka.min.js b/dist/js/marka.min.js index 135b0be..9da4289 100644 --- a/dist/js/marka.min.js +++ b/dist/js/marka.min.js @@ -6,5 +6,5 @@ * Released under the MIT license * https://github.com/fians/marka/blob/master/LICENSE */ -!function(a){"use strict";function b(a,b){return Array.prototype.forEach.call(a,b)}function c(a){return"object"==typeof HTMLElement?a instanceof HTMLElement:a&&"object"==typeof a&&null!==a&&1===a.nodeType&&"string"==typeof a.nodeName}function d(a,b){a.setAttribute("data-color",b);var c=a.getAttribute("data-icon"),d=a.children.length,e=[];if(g[c].hasOwnProperty("invert"))switch(g[c].invert){case"last":e=[d-1];break;case"last-two":e=[d-2,d-1];break;default:e=g[c].invert}for(var f=0;d>f;f++){var h=b;-1!==e.indexOf(f)&&(h=a.getAttribute("data-bg")),a.children[f].setAttribute("style","background-color:"+h)}}function e(b){var c=b.parentNode,d="rgba(0, 0, 0, 0)";do if(d=a.getComputedStyle(c).backgroundColor,c=c.parentNode,"rgba(0, 0, 0, 0)"!==d)break;while("tagName"in c);("rgba(0, 0, 0, 0)"===d||"transparent"===d)&&(d="rgb(255, 255, 255)"),b.setAttribute("data-bg",d)}function f(a){if(this.elements=[],"string"==typeof a&&(this.elements=document.querySelectorAll(a)),c(a)&&this.elements.push(a),a instanceof Array)for(var d=0;dh)for(var i=0;ig;g++){var h=b;-1!==e.indexOf(g)&&(h=a.getAttribute("data-bg")),a.children[g].setAttribute("style","background-color:"+h)}}function d(a){var b=a.parentNode,c="rgba(0, 0, 0, 0)";do if(c=window.getComputedStyle(b).backgroundColor,b=b.parentNode,"rgba(0, 0, 0, 0)"!==c)break;while("tagName"in b);("rgba(0, 0, 0, 0)"===c||"transparent"===c)&&(c="rgb(255, 255, 255)"),a.setAttribute("data-bg",c)}function e(c){if(this.elements=[],"string"==typeof c&&(this.elements=document.querySelectorAll(c)),b(c)&&this.elements.push(c),c instanceof Array)for(var e=0;eh)for(var i=0;i