Skip to content

Instantly share code, notes, and snippets.

@plugnburn
Last active November 16, 2019 10:42
Show Gist options
  • Save plugnburn/4b2344db3e78ac37f021 to your computer and use it in GitHub Desktop.
Save plugnburn/4b2344db3e78ac37f021 to your computer and use it in GitHub Desktop.
ZenQRXT - all nano-goodness, combined

ZenQRXT - all nano-goodness, combined

This page aims to provide a downloadable bundle of four awesome nano-libraries that offer a complete client-side barebones stack: Zen.js, Q.js, R.js and XT.js. Please read about each library at its README page.

Using the bundle

Bundle size is 2641 bytes (1303 bytes gzipped). Download it right here or include it into your code:

<script src="//cdn.rawgit.com/plugnburn/4b2344db3e78ac37f021/raw/01bc9df10911654c432130fc56964fcd4d5777dd/zenqrxt.js"></script>

!function(p){var f=JSON,h=100,k=[],g=0,l={},m=function(a){for(var b=Object.keys(a).sort(),c={},d;d=b.shift();)c[d]=a[d];return f.stringify(c)},n=function(a,b){if((b=m(l))!==""+c)for(l=f.parse(b),a=0;a<g;a++)try{k[a].call(c)}catch(e){}setTimeout(n,h)},c=function(a){k.push(a);g||n();g++;return this};Object.defineProperties(c,{interval:{value:function(a){h=a;return this}},"import":{value:function(a,b){if(""+a===a)try{a=f.parse(a)}catch(e){}if(a)for(b in a)a.hasOwnProperty(b)&&(c[b]=a[b]);return this}},toString:{value:function(){return m(c)}},req:{value:function(a,b,e,d){d=new XMLHttpRequest;d.open(e?"POST":"GET",b,!0);d.onload=function(b){b=d.responseText;try{b=f.parse(b)}catch(e){}c[a]=b};d.send(e)}}});p.Zen=c}(this);!function(f,g,e){e=function(b){return function(e){function c(a,d,h){c.l=[].slice.call(e.querySelectorAll(b));if(a)for(h=c.l.slice();el=h.shift();)a(el);return c}c.val=function(a,d,b){for(b=c.l.slice();d=b.shift();){if(null==a)return"value"in d?d.value:d.innerHTML;"value"in d?(d.value=a,"select"===d.tagName.toLowerCase()&&(d.Q("option")(function(a){a.selected=!1}),d.Q('option[value="'+a+'"]')(function(a){a.selected=!0}))):d.innerHTML=a}return c};c.on=function(a,d,e){for(a=a.split(" ");e=a.shift();)f.addEventListener(e,function(a){a.target.closest(b)&&d.call(a.target,a)},!1);return c};return c}(this)};f.Q=e.bind(g);!function(b){b.Q=e;b.matches||(b.matches=b.matchesSelector||b.webkitMatchesSelector||b.mozMatchesSelector||b.msMatchesSelector||function(b,c){c=this;return[].some.call(g.querySelectorAll(b),function(a){return a===c})});b.closest=b.closest||function c(a){return this.parentNode?this.matches(a)?this:c.call(this.parentNode,a):null}}(f.Element.prototype)}(window,document);!function(g,h,c){h={};var k=function(a){a=g.location;c.go(a.pathname+a.search+a.hash,!0)};c=function(a,f,b){b={p:[],h:f};var d=a.replace(/\//g,"\\/"),e=a.match(/:([^/]+)/ig);if(null!=e)for(;f=e.shift();)b.p.push(f.slice(1)),d=d.replace(f,"([^/]+)");b.r=RegExp(d,"i");h[a]=b};c.go=function(a,f){var b,d,e,c;for(b in h)if(d=a.match((e=h[b]).r)){d.shift();b={};for(c=e.p.length;c;)b[e.p[--c]]=d.shift();f||g.history.pushState({},"",a);return e.h(b)}};g.R=c;g.addEventListener("popstate",k,!1);~["interactive","complete"].indexOf(document.readyState)?k():g.addEventListener("DOMContentLoaded",k,!1)}(this);!function(d){function f(e,b,c,a){for(;null!=(a=e.shift());)if(""+a===a||+a===a)b.appendChild(d.createTextNode(a));else if("[object Object]"===""+a)for(c in a)b.setAttribute(c,a[c]);else f(a,c=d.createElement(a.shift())),b.appendChild(c)}window.XT=function(e,b){f(e.slice(),b=d.createDocumentFragment());return b}}(document)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment