quialaboriosam
Version:
microbe.js - A modular JS library for DOM manipulation, and more
2 lines • 10.3 kB
JavaScript
/*! Microbe v0.4.15 | (c) 2014-2015 Sociomantic Labs | http://m.icro.be/license */
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var n;"undefined"!=typeof window?n=window:"undefined"!=typeof global?n=global:"undefined"!=typeof self&&(n=self),n.µ=e()}}(function(){return function e(n,t,o){function r(u,c){if(!t[u]){if(!n[u]){var s="function"==typeof require&&require;if(!c&&s)return s(u,!0);if(i)return i(u,!0);var f=new Error("Cannot find module '"+u+"'");throw f.code="MODULE_NOT_FOUND",f}var a=t[u]={exports:{}};n[u][0].call(a.exports,function(e){var t=n[u][1][e];return r(t?t:e)},a,a.exports,e,n,t,o)}return t[u].exports}for(var i="function"==typeof require&&require,u=0;u<o.length;u++)r(o[u]);return r}({1:[function(e,n,t){"use strict";var o="[object MicrobeRoot]",r="0.4.15-tool",i={get version(){return r},get type(){return o}};e("./modules/tools")(i),e("./modules/pageStyles")(i),n.exports=i},{"./modules/pageStyles":9,"./modules/tools":10}],2:[function(e,n,t){(function(e){function t(){for(;r.next;){r=r.next;var e=r.task;r.task=void 0;var n=r.domain;n&&(r.domain=void 0,n.enter());try{e()}catch(o){if(s)throw n&&n.exit(),setTimeout(t,0),n&&n.enter(),o;setTimeout(function(){throw o},0)}n&&n.exit()}u=!1}function o(n){i=i.next={task:n,domain:s&&e.domain,next:null},u||(u=!0,c())}var r={task:void 0,next:null},i=r,u=!1,c=void 0,s=!1;if("undefined"!=typeof e&&e.nextTick)s=!0,c=function(){e.nextTick(t)};else if("function"==typeof setImmediate)c="undefined"!=typeof window?setImmediate.bind(window,t):function(){setImmediate(t)};else if("undefined"!=typeof MessageChannel){var f=new MessageChannel;f.port1.onmessage=t,c=function(){f.port2.postMessage(0)}}else c=function(){setTimeout(t,0)};n.exports=o}).call(this,e("_process"))},{_process:3}],3:[function(e,n,t){function o(){}var r=n.exports={};r.nextTick=function(){var e="undefined"!=typeof window&&window.setImmediate,n="undefined"!=typeof window&&window.postMessage&&window.addEventListener;if(e)return function(e){return window.setImmediate(e)};if(n){var t=[];return window.addEventListener("message",function(e){var n=e.source;if((n===window||null===n)&&"process-tick"===e.data&&(e.stopPropagation(),t.length>0)){var o=t.shift();o()}},!0),function(e){t.push(e),window.postMessage("process-tick","*")}}return function(e){setTimeout(e,0)}}(),r.title="browser",r.browser=!0,r.env={},r.argv=[],r.on=o,r.addListener=o,r.once=o,r.off=o,r.removeListener=o,r.removeAllListeners=o,r.emit=o,r.binding=function(e){throw new Error("process.binding is not supported")},r.cwd=function(){return"/"},r.chdir=function(e){throw new Error("process.chdir is not supported")}},{}],4:[function(e,n,t){"use strict";n.exports=e("./lib/core.js"),e("./lib/done.js"),e("./lib/es6-extensions.js"),e("./lib/node-extensions.js")},{"./lib/core.js":5,"./lib/done.js":6,"./lib/es6-extensions.js":7,"./lib/node-extensions.js":8}],5:[function(e,n,t){"use strict";function o(e){function n(e){return null===s?void a.push(e):void u(function(){var n=s?e.onFulfilled:e.onRejected;if(null===n)return void(s?e.resolve:e.reject)(f);var t;try{t=n(f)}catch(o){return void e.reject(o)}e.resolve(t)})}function t(e){try{if(e===l)throw new TypeError("A promise cannot be resolved with itself.");if(e&&("object"==typeof e||"function"==typeof e)){var n=e.then;if("function"==typeof n)return void i(n.bind(e),t,o)}s=!0,f=e,c()}catch(r){o(r)}}function o(e){s=!1,f=e,c()}function c(){for(var e=0,t=a.length;t>e;e++)n(a[e]);a=null}if("object"!=typeof this)throw new TypeError("Promises must be constructed via new");if("function"!=typeof e)throw new TypeError("not a function");var s=null,f=null,a=[],l=this;this.then=function(e,t){return new l.constructor(function(o,i){n(new r(e,t,o,i))})},i(e,t,o)}function r(e,n,t,o){this.onFulfilled="function"==typeof e?e:null,this.onRejected="function"==typeof n?n:null,this.resolve=t,this.reject=o}function i(e,n,t){var o=!1;try{e(function(e){o||(o=!0,n(e))},function(e){o||(o=!0,t(e))})}catch(r){if(o)return;o=!0,t(r)}}var u=e("asap");n.exports=o},{asap:2}],6:[function(e,n,t){"use strict";var o=e("./core.js"),r=e("asap");n.exports=o,o.prototype.done=function(e,n){var t=arguments.length?this.then.apply(this,arguments):this;t.then(null,function(e){r(function(){throw e})})}},{"./core.js":5,asap:2}],7:[function(e,n,t){"use strict";function o(e){this.then=function(n){return"function"!=typeof n?this:new r(function(t,o){i(function(){try{t(n(e))}catch(r){o(r)}})})}}var r=e("./core.js"),i=e("asap");n.exports=r,o.prototype=r.prototype;var u=new o(!0),c=new o(!1),s=new o(null),f=new o(void 0),a=new o(0),l=new o("");r.resolve=function(e){if(e instanceof r)return e;if(null===e)return s;if(void 0===e)return f;if(e===!0)return u;if(e===!1)return c;if(0===e)return a;if(""===e)return l;if("object"==typeof e||"function"==typeof e)try{var n=e.then;if("function"==typeof n)return new r(n.bind(e))}catch(t){return new r(function(e,n){n(t)})}return new o(e)},r.all=function(e){var n=Array.prototype.slice.call(e);return new r(function(e,t){function o(i,u){try{if(u&&("object"==typeof u||"function"==typeof u)){var c=u.then;if("function"==typeof c)return void c.call(u,function(e){o(i,e)},t)}n[i]=u,0===--r&&e(n)}catch(s){t(s)}}if(0===n.length)return e([]);for(var r=n.length,i=0;i<n.length;i++)o(i,n[i])})},r.reject=function(e){return new r(function(n,t){t(e)})},r.race=function(e){return new r(function(n,t){e.forEach(function(e){r.resolve(e).then(n,t)})})},r.prototype["catch"]=function(e){return this.then(null,e)}},{"./core.js":5,asap:2}],8:[function(e,n,t){"use strict";var o=e("./core.js"),r=e("asap");n.exports=o,o.denodeify=function(e,n){return n=n||1/0,function(){var t=this,r=Array.prototype.slice.call(arguments);return new o(function(o,i){for(;r.length&&r.length>n;)r.pop();r.push(function(e,n){e?i(e):o(n)});var u=e.apply(t,r);!u||"object"!=typeof u&&"function"!=typeof u||"function"!=typeof u.then||o(u)})}},o.nodeify=function(e){return function(){var n=Array.prototype.slice.call(arguments),t="function"==typeof n[n.length-1]?n.pop():null,i=this;try{return e.apply(this,arguments).nodeify(t,i)}catch(u){if(null===t||"undefined"==typeof t)return new o(function(e,n){n(u)});r(function(){t.call(i,u)})}}},o.prototype.nodeify=function(e,n){return"function"!=typeof e?this:void this.then(function(t){r(function(){e.call(n,null,t)})},function(t){r(function(){e.call(n,t)})})}},{"./core.js":5,asap:2}],9:[function(e,n,t){n.exports=function(e){"use strict";e.insertStyle=function(n,t,o){var r=n.replace(/ /g,"-"),i=o?r+o.replace(/[\s:\/\[\]\(\)]+/g,"-"):r;o=o||"none";var u,c,s=function(){var e=document.createElement("style");return e.className="microbe--inserted--style__"+i,o&&"none"!==o&&e.setAttribute("media",o),document.head.appendChild(e),e},f=e.__customCSSRules[r];if(f&&f[o]){u=f[o].el;var a=f[o].obj;for(c in t)a[c]=t[c];t=a}else u=s();var l=n+"{";for(c in t)l+=c+" : "+t[c]+";";return l+="}",u.innerHTML=l,e.__customCSSRules[r]=e.__customCSSRules[r]||{},e.__customCSSRules[r][o]={el:u,obj:t},u},e.__customCSSRules={},e.removeStyle=function(n,t,o){o||"string"!=typeof t||"all"===t||(o=t,t=null),o=o||"none";var r=function(t,o){t.parentNode.removeChild(t),delete e.__customCSSRules[n][o]},i=e.__customCSSRules[n];if(!i)return!1;if("all"===t)for(var u in i)r(i[u].el,u);else{if(i=i[o],!i)return!1;if(e.isArray(t)&&!e.isEmpty(t)){for(var c=0,s=t.length;s>c;c++)i.obj[t[c]]&&delete i.obj[t[c]];e.isEmpty(i.obj)?r(i.el,o):e.insertStyle(n,i.obj,o)}else r(i.el,o)}return!0},e.removeStyles=function(n){return e.removeStyle(n,"all")}}},{}],10:[function(e,n,t){n.exports=function(n){"use strict";window.Promise=window.Promise||e("promise");var t=e("./types");n.capitalize=function(e){var t=n.isArray(e);e=t?e:[e];for(var o,r=[],i=0,u=e.length;u>i;i++){o=e[i].split(" ");for(var c=0,s=o.length;s>c;c++)o[c]=o[c][0].toUpperCase()+o[c].slice(1);r.push(o.join(" "))}return t?r:r[0]},n.capitalise=n.capitalize,n.debounce=function(e,n,t){var o;return function(){var r=this,i=arguments,u=function(){o=null,t||e.apply(r,i)},c=t&&!o;clearTimeout(o),o=setTimeout(u,n),c&&e.apply(r,i)}},n.extend=function(){var e=n.isObject,t=n.isArray,o=arguments[0]||{},r=1,i=arguments.length,u=!1;"boolean"==typeof o&&(u=o,o=arguments[r]||{},r++),"object"==typeof o||n.isFunction(o)||(o={}),r===i&&(o=this,r--);for(var c,s,f,a,l,p;i>r;r++)if(c=arguments[r],null!==c&&void 0!==c)for(s in c)f=o[s],a=c[s],o!==a&&(u&&a&&(e(a)||(l=t(a)))?(l?(l=!1,p=f&&t(f)?f:[]):p=f&&e(f)?f:{},o[s]=n.extend(u,p,a)):void 0!==a&&(o[s]=a));return o},n.core.extend=n.extend,n.identity=function(e){return e},n.isArray=Array.isArray,n.isEmpty=function(e){var n;for(n in e)return!1;return!0},n.isFunction=function(e){return"function"===n.type(e)},n.isObject=function(e){return"object"!==n.type(e)||e.nodeType||n.isWindow(e)?!1:!0},n.isUndefined=function(e,n){return n&&"object"!=typeof n?!0:n?!(e in n):void 0===e},n.isWindow=function(e){return null!==e&&e===e.window},n.merge=function(e,n,t){"boolean"==typeof n&&(t=n,n=null),n||(n=e,e=this);var o=e.length;if("number"==typeof o){for(var r=0,i=n.length;i>r;r++)t&&-1!==e.indexOf(n[r])||(e[o++]=n[r]);e.length=o}return e},n.core.merge=n.merge,n.noop=function(){},n.once=function(e,n){var t;return function(){return e&&(t=e.apply(n||this,arguments),e=null),t}},n.poll=function(e,n,t,o,r){var i=Number(new Date)+(o||2e3);r=r||100,function u(){if(e())try{n()}catch(o){throw"No argument given for success function"}else if(Number(new Date)<i)setTimeout(u,r);else try{t(new Error("timed out for "+e+": "+arguments))}catch(o){throw"No argument given for error function."}}()},n.toArray=function(e){return Array.prototype.slice.call(e||this)},n.core.toArray=n.toArray,n.type=function(e){if(null===e)return e+"";var n=t[Object.prototype.toString.call(e)];return n=n?n:t[e.toString()],n=n||typeof e,"object"===n&&e instanceof Promise&&(n="promise"),n},n.xyzzy=n.noop}},{"./types":11,promise:4}],11:[function(e,n,t){"use strict";n.exports={"[object Number]":"number","[object String]":"string","[object Function]":"function","[object Array]":"array","[object Date]":"date","[object RegExp]":"regExp","[object Error]":"error","[object Promise]":"promise","[object Microbe]":"microbe"}},{}]},{},[1])(1)});