Created
March 18, 2016 08:17
-
-
Save DBJDBJ/be9fa1051eea76dce8c6 to your computer and use it in GitHub Desktop.
dbj MICROLIB minified
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if("object"==typeof dbj){var msg="dbj core object must be defined only once and only in here";throw console&&console.error&&console.error(msg),"function"==typeof alert&&alert(msg),msg}!function(r,t){"function"!=typeof String.format&&(String.prototype.format=function(){var r=arguments;return this.replace(/\{(\d|\d\d)\}/g,function(e){var n=1*e.match(/\d+/)[0];return r[n]!==t?r[n]:""===r[n]?"":e})});var e={GLOBAL:function(){var t=Object.prototype.toString;Object.prototype.hasOwnProperty;"function"!=typeof window.roleof&&(r.roleof=function(r){return t.call(r).match(/\w+/g)[1]}),"function"!=typeof window.isArray&&(r.isArray=function(r){return"Array"===roleof(r)}),"function"!=typeof window.isObject&&(r.isObject=function(r){return"Object"===roleof(r)}),"function"!=typeof window.isFunction&&(r.isObject=function(r){return"Function"===roleof(r)})}(),keep_inside:function(){var r=[0,1];return function(t,e){if(e&&(r=e.sort()),t-=0,isNaN(t))throw new Error(255,"dbj.keep_inside() received NaN value.");return t>r[1]?r[1]:t<r[0]?r[0]:t}}(),err2str:function(r){return"Error"!=roleof(r)?""+r:"Error Code: {0} Facility Code: {1}, Error Message: {2}, Error Name: {3}".format(65535&r.number,r.number>>16&8191,r.message,r.name)},createXHR:function(){var r=[function(){return new XMLHttpRequest},function(){return new ActiveXObject("Msxml2.XMLHTTP")},function(){return new ActiveXObject("Msxml3.XMLHTTP")},function(){return new ActiveXObject("Microsoft.XMLHTTP")}];return e.createXHR=function(){for(var t=r.length;t--;)try{return r[t]()}catch(e){}throw"dbj.createXMLHTTPObject() failed ?"},e.createXHR()},$:function(r,t){return(t||document).querySelector(r)},$$:function(r,t){return(t||document).querySelectorAll(r)},later:function(r,t,e){var n=e?[].slice.call(arguments,3):[].slice.call(arguments,1);r||(r=this||window);var o=setTimeout(function(){clearTimeout(o),o=null,delete o;try{t.apply(r,n)}catch(e){throw e.message}},e||1)},console:{group:function(){console.group("dbj MICROLIB")},group_end:function(){console.groupEnd()}},assert:function(r){if(!r)throw e.later(e,function(){var t=console?console.error:alert;t("dbj.assert failed for: "+r+", msg: "+r.message)}),new Error(255,"dbj.assert("+r+"), rendered to false")},print:function(){var r=[].slice.call(arguments);e.later(e,function(){this.console.group();for(var t=0;t<r.length;t++)console.log(r[t]);this.console.group_end()})},evil:function(r){"use strict";var t="evil_"+ +new Date;return function(r){return(1,eval)("top['"+t+"'] = ("+r+")"),top[t]}}(),num:function(r){return r-0},round:function(r,t){var e=Math.pow(10,t),n=r*e,o=Math.round(n);return o/e},toUint32:function(r){return r>>>0},toInt32:function(r){return r>>0},seed:function(){return Math.random()*(new Date-0)>>>0}},n={empty:"00000000-0000-0000-0000-000000000000",make:function(){return n.four()+n.four()+"-"+n.four()+"-"+n.four()+"-"+n.four()+"-"+n.four()+n.four()+n.four()},four:function(){return(65536*(1+Math.random())|0).toString(16).substring(1).toUpperCase()}};e.GUID=function(){return n.make()}}(this,void 0); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment