Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

litejs

Package Overview
Dependencies
Maintainers
1
Versions
213
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

litejs - npm Package Compare versions

Comparing version 0.0.4 to 0.0.5

55

litejs-src.js

@@ -1001,3 +1001,3 @@

/*
* @version 0.0.3
* @version 0.0.9
* @author Lauri Rooden - https://github.com/litejs/view-lite

@@ -1030,13 +1030,17 @@ * @license MIT License - http://lauri.rooden.ee/mit-license.txt

t.el = el
t.parent = parent
t.parent = typeof parent == 'string' ? View(parent) : parent
t.selector = selector
if (View.active == route) t.show()
},
getEl: function() {
var t = this
, type = typeof t.el
if (type == 'function') t.el = t.el()
else if (type == 'string') t.el = El(t.el)
return t.el
},
getContentEl: function() {
var t = this
, type = typeof t.el
if (type == "function") t.el = t.el()
else if (type == "string") t.el = El(t.el)
return t.selector && t.el.find(t.selector) || t.el
return t.selector && t.getEl().find(t.selector) || t.getEl()
},

@@ -1049,11 +1053,7 @@ load: function(opts) {

var t = this
, changed = View.active != t.route
View.active = t.route
if (t.el) {
t.getContentEl()
t.ping(opts)
if (!t.loaded) {
t.loaded=true
t.emit("load", opts)
}
t.emit("show", opts)
if (changed && View.active == t.route) t.emit('show', opts)
} else {

@@ -1063,16 +1063,21 @@ t.load(opts)

},
closeChild: function(opts){
close: function(opts){
var t = this
if (t.child) {
t.child.closeChild()
t.child.emit("close", opts)
t.getContentEl().removeChild(t.child.el)
}
t.active = false
t.parent.getContentEl().removeChild(t.getEl())
t.parent.child = null
t.emit('close', opts)
t.child && t.child.close()
},
ping: function(opts){
var t = this
, parent = t.parent && View(t.parent)
, parent = t.parent
t.active = true
if (parent) {
if (!parent.child || t.el.parentNode != parent.getContentEl()) {
parent.attatch(t)
if (parent.child != t) {
parent.child && parent.child.close()
parent.child = t
parent.getContentEl().appendChild(t.getEl())
}

@@ -1082,12 +1087,6 @@ parent.ping(opts)

t.emit("ping", opts)
},
attatch: function(child){
var t = this
t.closeChild()
t.child = child
t.getContentEl().appendChild(child.el)
}
}
Object.merge(View.prototype, Event.Emitter)
Object.merge(View.prototype, Event.Emitter)

@@ -1094,0 +1093,0 @@ function drawRoute(opts) {

function Nop(){}
!function(m,h){function k(d,e,a){d[e]||(d[e]=function(){return(d[e]=new Function("a,b,c,d",a)).apply(this,arguments)})}function f(l,e,a){var c=d.shift()||new XMLHttpRequest;c.open(l,e,!0!==a);!0!==a&&(c.onreadystatechange=function(){4==c.readyState&&(a&&a.call(c,200!=c.status&&c.status,c.responseText),c.onreadystatechange=a=Nop,d.push(c))});return c}function n(d,e){"string"==typeof d&&(d=[d]);for(var a=d.length,c=a,b=[];c--;)!function(g){f("GET",d[g],function(c,d){b[g]=d;--a||(execScript(b.join("/**/;")),e&&
e(),b=null)}).send()}(c)}var d=[];k(m,"XMLHttpRequest","return new ActiveXObject('MSXML2.XMLHTTP')");!m.execScript&&Function("d,Date","return(1,eval)('(Date)')===d")(Date,1)&&(m.execScript=eval);k(m,"execScript","d=document;b=d.body;c=d.createElement('script');c.text=a;b.insertBefore(c,b.firstChild)");Function.prototype.bind||h.unshift("up.js");n(h);f.load=n;m.xhr=f}(this,[]);function Nop(){}function True(){return!0}function False(){return!1}function This(){return this}
!function(m,h){function l(d,e,a){d[e]||(d[e]=function(){return(d[e]=new Function("a,b,c,d",a)).apply(this,arguments)})}function k(f,e,a){var c=d.shift()||new XMLHttpRequest;c.open(f,e,!0!==a);!0!==a&&(c.onreadystatechange=function(){4==c.readyState&&(a&&a.call(c,200!=c.status&&c.status,c.responseText),c.onreadystatechange=a=Nop,d.push(c))});return c}function n(d,e){"string"==typeof d&&(d=[d]);for(var a=d.length,c=a,b=[];c--;)!function(g){k("GET",d[g],function(c,d){b[g]=d;--a||(execScript(b.join("/**/;")),e&&
e(),b=null)}).send()}(c)}var d=[];l(m,"XMLHttpRequest","return new ActiveXObject('MSXML2.XMLHTTP')");!m.execScript&&Function("d,Date","return(1,eval)('(Date)')===d")(Date,1)&&(m.execScript=eval);l(m,"execScript","d=document;b=d.body;c=d.createElement('script');c.text=a;b.insertBefore(c,b.firstChild)");Function.prototype.bind||h.unshift("up.js");n(h);k.load=n;m.xhr=k}(this,[]);function Nop(){}function True(){return!0}function False(){return!1}function This(){return this}
function Init(){return this.init&&this.init.apply(this,arguments)||this}
!function(m){function h(a){if(h[a])return h[a];for(var c="_",b=a,g=a.split("->");1<g.length;)b=g.pop(),c=g.pop().match(/\w+/g)||"",g.length&&g.push("(function("+c+"){return("+b+")})");return h[a]=new Function(c,"return("+b+")")}var k=Array.prototype,f=Function.prototype,n=String.prototype,d=Object,l=f.call.bind(k.slice),e=[];f.construct=function(a){var c=a.length;return c?(e[c]||(e[c]=h("t a->new t(a["+Object.keys(l(a)).join("],a[")+"])")))(this,a):new this};f.partial=function(){var a=this,c=l(arguments);
return function(){return a.apply(this,k.concat.apply(c,arguments))}};f.byWords=function(a){var c=this;a|=0;return function(){var b=this,g=b,d=arguments;(d[a]||"").replace(/[-\w]+/g,function(e){d[a]=e;g=c.apply(b,d)});return g}};f.byKeyVal=function(){var a=this;return function(c){var b,g=l(arguments);if("object"==typeof c)for(b in c)g[0]=b,g[1]=c[b],b=a.apply(this,g);else b=a.apply(this,g);return b}};f.cache=function(a,c,b){var g=this,d=b||{},e=function(){var b=arguments,f=!!a||this instanceof e,l=
c?c(b,g):f+":"+b.length+":"+k.join.call(b);return l in d?d[l]:d[l]=f?g.construct(b):g.apply(this,b)};e.origin=g;e.cached=d;e.extend=function(){return g.extend.apply(g,arguments).cache(a,c,b)};e.prototype=g.prototype;return e};f.extend=function(){var a,c=this,b=0,g=function(){return c.apply(this,arguments)};g.prototype=Object.create(c.prototype);for(g.prototype.constructor=g;a=arguments[b++];)Object.merge(g.prototype,a);return g};f.ttl=function(a,c){var b=this,g=setTimeout(function(){a=0;c&&c()},a);
return function(){clearTimeout(g);a&&b.apply(null,arguments)}};f.once=function(a){var c,b,g=this;return function(){clearTimeout(c);b=arguments;c=setTimeout(function(){g.apply(null,b)},a)}};f.rate=function(a,c){var b,g,d=this,e=0;return function(){var f=+new Date;clearTimeout(b);f>e?(e=f+a,d.apply(null,arguments)):c&&(g=arguments,b=setTimeout(function(){d.apply(null,g)},e-f))}};d.each=function(a,c,b,g){if(a)for(g in a)a.hasOwnProperty(g)&&c.call(b,a[g],g,a)};d.merge=function(a){for(var c,b,g=1;b=arguments[g++];)for(c in b)b.hasOwnProperty(c)&&
(a[c]=b[c]);return a};d.zip=function(a,c){return a.fold(function(b,a,d){b[a]=c[d];return b},{})};k.remove=function(){for(var a=this.length,c=l(arguments),b=-1;a--;)~c.indexOf(this[a])&&this.splice(b=a,1);return b};k.each=k.forEach;k.fold=k.reduce;k.foldr=k.reduceRight;k.unique=k.filter.partial(function(a,c,b){return c==b.lastIndexOf(a)});!function(a){f[a]=n[a]=function(){var c=arguments,b=c[0];c[0]=this.fn();return k[a].apply(b,c)}}.byWords()("every filter each map fold foldr some");f.fn=This;n.fn=
!function(m){function h(a){if(h[a])return h[a];for(var c="_",b=a,g=a.split("->");1<g.length;)b=g.pop(),c=g.pop().match(/\w+/g)||"",g.length&&g.push("(function("+c+"){return("+b+")})");return h[a]=new Function(c,"return("+b+")")}var l=Array.prototype,k=Function.prototype,n=String.prototype,d=Object,f=k.call.bind(l.slice),e=[];k.construct=function(a){var c=a.length;return c?(e[c]||(e[c]=h("t a->new t(a["+Object.keys(f(a)).join("],a[")+"])")))(this,a):new this};k.partial=function(){var a=this,c=f(arguments);
return function(){return a.apply(this,l.concat.apply(c,arguments))}};k.byWords=function(a){var c=this;a|=0;return function(){var b=this,g=b,d=arguments;(d[a]||"").replace(/[-\w]+/g,function(e){d[a]=e;g=c.apply(b,d)});return g}};k.byKeyVal=function(){var a=this;return function(c){var b,g=f(arguments);if("object"==typeof c)for(b in c)g[0]=b,g[1]=c[b],b=a.apply(this,g);else b=a.apply(this,g);return b}};k.cache=function(a,c,b){var g=this,d=b||{},e=function(){var b=arguments,f=!!a||this instanceof e,k=
c?c(b,g):f+":"+b.length+":"+l.join.call(b);return k in d?d[k]:d[k]=f?g.construct(b):g.apply(this,b)};e.origin=g;e.cached=d;e.extend=function(){return g.extend.apply(g,arguments).cache(a,c,b)};e.prototype=g.prototype;return e};k.extend=function(){var a,c=this,b=0,g=function(){return c.apply(this,arguments)};g.prototype=Object.create(c.prototype);for(g.prototype.constructor=g;a=arguments[b++];)Object.merge(g.prototype,a);return g};k.ttl=function(a,c){var b=this,g=setTimeout(function(){a=0;c&&c()},a);
return function(){clearTimeout(g);a&&b.apply(null,arguments)}};k.once=function(a){var c,b,g=this;return function(){clearTimeout(c);b=arguments;c=setTimeout(function(){g.apply(null,b)},a)}};k.rate=function(a,c){var b,g,d=this,e=0;return function(){var f=+new Date;clearTimeout(b);f>e?(e=f+a,d.apply(null,arguments)):c&&(g=arguments,b=setTimeout(function(){d.apply(null,g)},e-f))}};d.each=function(a,c,b,g){if(a)for(g in a)a.hasOwnProperty(g)&&c.call(b,a[g],g,a)};d.merge=function(a){for(var c,b,g=1;b=arguments[g++];)for(c in b)b.hasOwnProperty(c)&&
(a[c]=b[c]);return a};d.zip=function(a,c){return a.fold(function(b,a,d){b[a]=c[d];return b},{})};l.remove=function(){for(var a=this.length,c=f(arguments),b=-1;a--;)~c.indexOf(this[a])&&this.splice(b=a,1);return b};l.each=l.forEach;l.fold=l.reduce;l.foldr=l.reduceRight;l.unique=l.filter.partial(function(a,c,b){return c==b.lastIndexOf(a)});!function(a){k[a]=n[a]=function(){var c=arguments,b=c[0];c[0]=this.fn();return l[a].apply(b,c)}}.byWords()("every filter each map fold foldr some");k.fn=This;n.fn=
function(){return h(this)};m.Fn=h}(this);
!function(m,h,k){function f(b,g){var c,e={};b=b.replace(a,function(b,a,g,c){e["."==a?(a="class",e[a]&&(g=e[a]+" "+g),a):"#"==a?"id":g]=c||g;return""})||"div";c=(d[b]||(d[b]=h.createElement(b))).cloneNode(!0).set(e);return l[b]&&l[b](c,g)||c.set(g)}function n(b,a,c){if(b)for(c in a=f[k],a)b[c]=a[c];return b}var d={},l={},e=(m.HTMLElement||m.Element||f)[k],a=/([.#:[])([-\w]+)(?:=([-\w]+)])?]?/g;e.append=function(b,a){if(b){if("string"==typeof b||"number"==typeof b)b=f.text(b);else if(!("nodeType"in
!function(m,h,l){function k(b,g){var c,e={};b=b.replace(a,function(b,a,g,c){e["."==a?(a="class",e[a]&&(g=e[a]+" "+g),a):"#"==a?"id":g]=c||g;return""})||"div";c=(d[b]||(d[b]=h.createElement(b))).cloneNode(!0).set(e);return f[b]&&f[b](c,g)||c.set(g)}function n(b,a,c){if(b)for(c in a=k[l],a)b[c]=a[c];return b}var d={},f={},e=(m.HTMLElement||m.Element||k)[l],a=/([.#:[])([-\w]+)(?:=([-\w]+)])?]?/g;e.append=function(b,a){if(b){if("string"==typeof b||"number"==typeof b)b=k.text(b);else if(!("nodeType"in
b)&&"length"in b){for(var c=b.length,d=0,e=h.createDocumentFragment();d<c;)this.append.call(e,b[d++]);b=e}b.nodeType&&this.insertBefore(b,(!0===a?this.firstChild:"number"==typeof a?this.childNodes[0>a?this.childNodes.length-a-2:a]:a)||null);b.append_hook&&b.append_hook()}return this};e.after=function(b,a){b.parentNode.append(this,a?b:b.nextSibling);return this};e.to=function(b,a){b.append(this,a);return this};e.hasClass=function(b){return RegExp("\\b"+b+"\\b").test(this.className)};e.addClass=function(b){this.className+=
""==this.className?b:this.hasClass(b)?"":" "+b;return this};e.rmClass=function(b){this.className=(" "+this.className+" ").replace(" "+b+" "," ").trim();return this};e.toggleClass=function(b,a){1==arguments.length&&(a=!this.hasClass(b));this[a?"addClass":"rmClass"](b);return a};e.empty=function(){for(var b;b=this.firstChild;)this.kill.call(b);return this};e.kill=function(){this.parentNode&&this.parentNode.removeChild(this);Event.removeAll&&Event.removeAll(this);this.kill_hook&&this.kill_hook();this.empty&&
this.empty();return this};e.on=function(b,a){Event.add(this,b,a);return this};e.non=function(b,a){Event.remove(this,b,a);return this};e.set=function(b){var a=typeof b,c;if(b)if("string"==a||"number"==a||b.nodeType||"length"in b)this.append(b);else for(a in b)c=b[a],"class"==a?this.addClass(c):"string"==typeof c?(this.setAttribute(a,c),"name"==a&&"\v"=="v"&&this.mergeAttributes(h.createElement("<INPUT name='"+a+"'/>"),!1)):c?this[a]=c:this.removeAttribute(a);return this};e._find=function(b){var c=
0,d=["_"];b=b.replace(a,function(a,b,c,g){d.push("."==b?"(' '+_.className+' ').indexOf(' "+c+" ')>-1":"#"==b?"_.id=='"+c+"'":"_.getAttribute('"+c+"')"+(g?"=='"+g+"'":""));return""})||"*";for(var e=this.getElementsByTagName(b),f=Function("_","return "+d.join("&&"));b=e[c++];)if(f(b))return b.to?b:n(b)};e.find=h.querySelector?function(b){return this.querySelector(b)}:e._find;if(e===f[k]){var c=h.createElement;h.createElement=function(b){return n(c(b))};n(h.body)}f[k]=e;f.get=function(b){"string"==typeof b&&
(b=h.getElementById(b));return b&&b.to?b:n(b)};f.cache=function(b,a,c){d[b]="string"==typeof a?f(a):a;c&&(l[b]=c)};f.cache.el=d;f.cache.fn=l;f.text=function(a){return h.createTextNode(a)};m.El=f}(this,document,"prototype");
!function(m){function h(a,c,b,d,f){f=c(b,d,f);b[a](n+("wheel"==d?e:d),f,!1);return k}var k=m.Event||(m.Event={}),f=120,n="",d="addEventListener",l="removeEventListener",e="onwheel"in m?"wheel":"onmousewheel"in m?"mousewheel":"DOMMouseScroll";m[d]||(n="on",d="attachEvent",l="detachEvent");k.Emitter={on:function(a,c,b){var d=this._e||(this._e={});(d[a]||(d[a]=[])).push([c,b]);return this},non:function(a,c){if(a){if(this._e&&this._e[a]&&c)for(var b=this._e[a],d=b.length;d--;)b[d][0]==c?b.splice(d,1):
delete this._e[a]}else delete this._e;return this},once:function(a,c,b){return this.on(a,c,b).on(a,this.non.bind(this,a,c))},emit:function(a){if(this._e&&this._e[a])for(var c=0,b=this._e[a],d=b.slice.call(arguments,1);a=b[c++];)a[0].apply(a[1]||this,d);return this}};k.add=h.bind(null,d,function(a,c,b){var d="wheel"==c?function(c){c||(c=m.event);var d=(c.wheelDelta||-c.detail||-c.deltaY)/f;if(0!=d){if(1>d&&-1<d){var e=(0>d?-1:1)/d,d=d*e;f/=e}b.call(a,c,d)}}:n?function(){b.call(a,m.event)}:b;d!=b&&
(d.origin=b);k.Emitter.on.call(a,c,d,a);return d});k.remove=h.bind(null,l,function(a,c,b){if(b&&a._e&&a._e[c]){c=a._e[c];for(var d=0;a=c[d];d++)if(a=a[0],a==b||a.origin==b)return c.splice(d,1),a}});k.stop=function(a){a.stopPropagation&&a.stopPropagation();a.preventDefault&&a.preventDefault();a.cancelBubble=a.cancel=!0;return a.returnValue=!1};k.removeAll=function(a,c,b,d,e){if(a._e)for(b in a._e)if(!c||b==c)for(d=a._e[b],e=d.length;e--;)k.remove(a,b,d[0])}}(this);
!function(m,h,k){function f(a){a=e?g.pathname.slice(e.length):(a||g).href.split("#")[1]||"";a=decodeURIComponent(a.replace(/\+/g," "));return a.replace(q,"")}function n(a,b){a=encodeURIComponent(a).replace(/%20/g,"+").replace(/%2F/gi,"/");if(e)k[b?"replaceState":"pushState"](null,null,e+a);else if(g[b?"replace":"assign"]("#"+a),c&&f()!==f(c.location))c.location[b?"replace":c.document.open().close(),"assign"]("#"+a);d()}function d(){a!=(a=f())&&l&&l(a)}var l,e,a,c,b,g=location,q=/^[#\/\!]+|[\s\/]+$/g,
p=!+"\v1"&&8>(h.documentMode||1);k.getUrl=f;k.setUrl=n;k.start=function(a,g){l||(g&&k.pushState?(e=g,m.onpopstate=d):"onhashchange"in m&&!p?m.onhashchange=d:(p&&(c=h.body.appendChild(h.createElement('<iframe class="hide" src="javascript:0" tabindex="-1" />')).contentWindow),b=f(),setInterval(function(){var a=f();c&&b===a&&(a=f(c.location));b!==a&&(b=a,c?n(a):d())},50)));l=a;d()}}(this,document,history);
!function(m){function h(){this.map={}}var k=/^:+|\?+$/g,f=/^$|\?$/;h.prototype={add:function(h,d){var l,e=0,a=h.replace(/\/+$/,"").split("/"),c={path:h,opts:"function"==typeof d?{next:d}:d||{}};for(h="";;++e){l=a[e]||"";f.test(l)&&(this.map[h]=this.map[h+"/"]=c);if(!l)break;l.match(k)&&((c.names||(c.names={}))[e]=l.replace(k,""),l=":?");h=h?h+"/"+l:l}},route:function(f,d){d="function"==typeof d?{next:d}:d||{};var h=this.map,e=h[f]||"";if(!e){for(var a=f.split("/"),c=0,b=a.length;c<b;++c){next=e?e+
"/"+a[c]:a[c];if(!h[next])if(next=e?e+"/:?":":?",h[next])(d.args||(d.args={}))[h[next].names[c]]=a[c];else break;e=next}e=h[e];a.slice(c).join("/")}e.opts.before&&e.opts.before.call(e,d);(d.next||e.opts.next).call(e,d);e.opts.after&&e.opts.after.call(e,d)}};m.Router=h}(this);
!function(m){function h(d,l,e,a){if(f[d])return f[d];if(!(this instanceof h))return new h(d,l,e,a);f[d]=this;n.add(d);l&&this.init.apply(this,arguments)}function k(d){h(this.path).show(d)}var f={},n=new Router;h.prototype={init:function(d,f,e,a){this.route=d;this.el=f;this.parent=e;this.selector=a;h.active==d&&this.show()},getContentEl:function(){var d=typeof this.el;"function"==d?this.el=this.el():"string"==d&&(this.el=El(this.el));return this.selector&&this.el.find(this.selector)||this.el},load:function(d){},
show:function(d){h.active=this.route;this.el?(this.getContentEl(),this.ping(d),this.loaded||(this.loaded=!0,this.emit("load",d)),this.emit("show",d)):this.load(d)},closeChild:function(d){this.child&&(this.child.closeChild(),this.child.emit("close",d),this.getContentEl().removeChild(this.child.el))},ping:function(d){var f=this.parent&&h(this.parent);f&&(f.child&&this.el.parentNode==f.getContentEl()||f.attatch(this),f.ping(d));this.emit("ping",d)},attatch:function(d){this.closeChild();this.child=d;
this.getContentEl().appendChild(d.el)}};Object.merge(h.prototype,Event.Emitter);n.add("",{before:function(d){d.next=function(){n.route(h["default"],k)}}});h.route=function(d){n.route(d,k)};m.View=h}(this);
0,d=["_"];b=b.replace(a,function(a,b,c,e){d.push("."==b?"(' '+_.className+' ').indexOf(' "+c+" ')>-1":"#"==b?"_.id=='"+c+"'":"_.getAttribute('"+c+"')"+(e?"=='"+e+"'":""));return""})||"*";for(var e=this.getElementsByTagName(b),f=Function("_","return "+d.join("&&"));b=e[c++];)if(f(b))return b.to?b:n(b)};e.find=h.querySelector?function(b){return this.querySelector(b)}:e._find;if(e===k[l]){var c=h.createElement;h.createElement=function(b){return n(c(b))};n(h.body)}k[l]=e;k.get=function(b){"string"==typeof b&&
(b=h.getElementById(b));return b&&b.to?b:n(b)};k.cache=function(b,a,c){d[b]="string"==typeof a?k(a):a;c&&(f[b]=c)};k.cache.el=d;k.cache.fn=f;k.text=function(a){return h.createTextNode(a)};m.El=k}(this,document,"prototype");
!function(m){function h(a,c,b,d,f){f=c(b,d,f);b[a](n+("wheel"==d?e:d),f,!1);return l}var l=m.Event||(m.Event={}),k=120,n="",d="addEventListener",f="removeEventListener",e="onwheel"in m?"wheel":"onmousewheel"in m?"mousewheel":"DOMMouseScroll";m[d]||(n="on",d="attachEvent",f="detachEvent");l.Emitter={on:function(a,c,b){var d=this._e||(this._e={});(d[a]||(d[a]=[])).push([c,b]);return this},non:function(a,c){if(a){if(this._e&&this._e[a]&&c)for(var b=this._e[a],d=b.length;d--;)b[d][0]==c?b.splice(d,1):
delete this._e[a]}else delete this._e;return this},once:function(a,c,b){return this.on(a,c,b).on(a,this.non.bind(this,a,c))},emit:function(a){if(this._e&&this._e[a])for(var c=0,b=this._e[a],d=b.slice.call(arguments,1);a=b[c++];)a[0].apply(a[1]||this,d);return this}};l.add=h.bind(null,d,function(a,c,b){var d="wheel"==c?function(c){c||(c=m.event);var d=(c.wheelDelta||-c.detail||-c.deltaY)/k;if(0!=d){if(1>d&&-1<d){var e=(0>d?-1:1)/d,d=d*e;k/=e}b.call(a,c,d)}}:n?function(){b.call(a,m.event)}:b;d!=b&&
(d.origin=b);l.Emitter.on.call(a,c,d,a);return d});l.remove=h.bind(null,f,function(a,c,b){if(b&&a._e&&a._e[c]){c=a._e[c];for(var d=0;a=c[d];d++)if(a=a[0],a==b||a.origin==b)return c.splice(d,1),a}});l.stop=function(a){a.stopPropagation&&a.stopPropagation();a.preventDefault&&a.preventDefault();a.cancelBubble=a.cancel=!0;return a.returnValue=!1};l.removeAll=function(a,c,b,d,e){if(a._e)for(b in a._e)if(!c||b==c)for(d=a._e[b],e=d.length;e--;)l.remove(a,b,d[0])}}(this);
!function(m,h,l){function k(a){a=e?g.pathname.slice(e.length):(a||g).href.split("#")[1]||"";a=decodeURIComponent(a.replace(/\+/g," "));return a.replace(q,"")}function n(a,b){a=encodeURIComponent(a).replace(/%20/g,"+").replace(/%2F/gi,"/");if(e)l[b?"replaceState":"pushState"](null,null,e+a);else if(g[b?"replace":"assign"]("#"+a),c&&k()!==k(c.location))c.location[b?"replace":c.document.open().close(),"assign"]("#"+a);d()}function d(){a!=(a=k())&&f&&f(a)}var f,e,a,c,b,g=location,q=/^[#\/\!]+|[\s\/]+$/g,
p=!+"\v1"&&8>(h.documentMode||1);l.getUrl=k;l.setUrl=n;l.start=function(a,g){f||(g&&l.pushState?(e=g,m.onpopstate=d):"onhashchange"in m&&!p?m.onhashchange=d:(p&&(c=h.body.appendChild(h.createElement('<iframe class="hide" src="javascript:0" tabindex="-1" />')).contentWindow),b=k(),setInterval(function(){var a=k();c&&b===a&&(a=k(c.location));b!==a&&(b=a,c?n(a):d())},50)));f=a;d()}}(this,document,history);
!function(m){function h(){this.map={}}var l=/^:+|\?+$/g,k=/^$|\?$/;h.prototype={add:function(h,d){var f,e=0,a=h.replace(/\/+$/,"").split("/"),c={path:h,opts:"function"==typeof d?{next:d}:d||{}};for(h="";;++e){f=a[e]||"";k.test(f)&&(this.map[h]=this.map[h+"/"]=c);if(!f)break;f.match(l)&&((c.names||(c.names={}))[e]=f.replace(l,""),f=":?");h=h?h+"/"+f:f}},route:function(h,d){d="function"==typeof d?{next:d}:d||{};var f=this.map,e=f[h]||"";if(!e){for(var a=h.split("/"),c=0,b=a.length;c<b;++c){next=e?e+
"/"+a[c]:a[c];if(!f[next])if(next=e?e+"/:?":":?",f[next])(d.args||(d.args={}))[f[next].names[c]]=a[c];else break;e=next}e=f[e];a.slice(c).join("/")}e.opts.before&&e.opts.before.call(e,d);(d.next||e.opts.next).call(e,d);e.opts.after&&e.opts.after.call(e,d)}};m.Router=h}(this);
!function(m){function h(d,f,e,a){if(k[d])return k[d];if(!(this instanceof h))return new h(d,f,e,a);k[d]=this;n.add(d);f&&this.init.apply(this,arguments)}function l(d){h(this.path).show(d)}var k={},n=new Router;h.prototype={init:function(d,f,e,a){this.route=d;this.el=f;this.parent="string"==typeof e?h(e):e;this.selector=a;h.active==d&&this.show()},getEl:function(){var d=typeof this.el;"function"==d?this.el=this.el():"string"==d&&(this.el=El(this.el));return this.el},getContentEl:function(){return this.selector&&
this.getEl().find(this.selector)||this.getEl()},load:function(d){},show:function(d){var f=h.active!=this.route;h.active=this.route;this.el?(this.ping(d),f&&h.active==this.route&&this.emit("show",d)):this.load(d)},close:function(d){this.active=!1;this.parent.getContentEl().removeChild(this.getEl());this.parent.child=null;this.emit("close",d);this.child&&this.child.close()},ping:function(d){var f=this.parent;this.active=!0;f&&(f.child!=this&&(f.child&&f.child.close(),f.child=this,f.getContentEl().appendChild(this.getEl())),
f.ping(d));this.emit("ping",d)}};Object.merge(h.prototype,Event.Emitter);n.add("",{before:function(d){d.next=function(){n.route(h["default"],l)}}});h.route=function(d){n.route(d,l)};m.View=h}(this);
{
"name": "litejs",
"version": "0.0.4",
"version": "0.0.5",
"license": "MIT",

@@ -5,0 +5,0 @@ "description": "EXPERIMENTAL! Single-page application",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc