forked from itorr/q.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
q.min.js
1 lines (1 loc) · 1.13 KB
/
q.min.js
1
var Q=function(b,a,l,h,g,d,m,c,j,k,f,o,i,n,e){o="onhashchange" in b;h=a.getElementsByTagName("body")[0];g="`";i=[];n="!";k=function(){if(o){b.onhashchange=k}if(g==location.hash){return}e.lash=d=location.hash.substring(n.length+1);m=d.split("/");var p=i.length;while(p--){if(c=d.match(i[p][0])){c[0]=i[p][1];m=c;break}}if(!e[m[0]]){location.hash="#"+n+j;e.lash=j;return}h.className="body-"+m[0];if(e.pop){e.pop.apply(b,m)}g=location.hash;e[m.shift()].apply(b,m)};e={lash:"",init:function(p){if(p.key!==undefined){n=p.key}j=p.index||"V";if(p.pop&&typeof p.pop=="function"){e.pop=p.pop}k();if(!o){setInterval(function(){if(g!=location.hash){k();g=location.hash}},100)}},reg:function(s,p){if(!s||!p){return}switch(typeof s){case"object":if(typeof p=="function"){var q="A"+(("8"+Math.random()).substring(3)*1).toString(16);e[q]=p;p=q}i.push([s,p]);break;case"string":if(typeof p=="function"){e[s]=p}else{if(typeof p=="string"&&e[p]){e[s]=e[p]}}break;indexault:return;break}},V:function(){console.log("Q.js 请设置框架默认页面");console.log("Q.js @卜卜口<http://i.mouto.org> 2014/12/28")},go:function(p){location.hash="#"+n+p}};return e}(this,document);