From d10266ce48d7e4ce03d3ff953c835949756972be Mon Sep 17 00:00:00 2001 From: Leo Horie Date: Wed, 12 Nov 2014 23:00:56 -0500 Subject: [PATCH] commit min and map files --- mithril.min.js | 8 ++++++++ mithril.min.js.map | 1 + 2 files changed, 9 insertions(+) create mode 100644 mithril.min.js create mode 100644 mithril.min.js.map diff --git a/mithril.min.js b/mithril.min.js new file mode 100644 index 00000000..3e683d9f --- /dev/null +++ b/mithril.min.js @@ -0,0 +1,8 @@ +/* +Mithril v0.1.23 +http://github.com/lhorie/mithril.js +(c) Leo Horie +License: MIT +*/ +Mithril=m=new function a(b,c){function d(){for(var a,b=[].slice.call(arguments),c=(!(null==b[1]||H.call(b[1])!=D||"tag"in b[1]||"subtree"in b[1])),d=c?b[1]:{},e=("class"in d?"class":"className"),f={tag:"div",attrs:{}},g=[];a=I.exec(b[0]);)if(""==a[1]&&a[2])f.tag=a[2];else if("#"==a[1])f.attrs.id=a[2];else if("."==a[1])g.push(a[2]);else if("["==a[3][0]){var h=J.exec(a[3]);f.attrs[h[1]]=h[3]||(h[2]?"":!0)}g.length>0&&(f.attrs[e]=g.join(" "));var i=c?b[2]:b[1];f.children=H.call(i)==E?i:b.slice(c?2:1);for(var j in d)f.attrs[j]=j==e?(f.attrs[j]||"")+" "+d[j]:d[j];return f}function e(a,d,h,k,l,m,n,o,p,q,r){if(null==l&&(l=""),"retain"===l.subtree)return m;var s=H.call(m),t=H.call(l);if(null==m||s!=t){if(null!=m)if(h&&h.nodes){var u=o-k,v=u+(t==E?l:m.nodes).length;g(h.nodes.slice(u,v),h.slice(u,v))}else m.nodes&&g(m.nodes,m);m=new l.constructor,m.tag&&(m={}),m.nodes=[]}if(t==E){l=j(l);for(var w=[],x=m.length===l.length,y=0,z=1,A=2,B=3,C={},I=[],J=!1,L=0;L\s*[^<]/g)||[]).length:H.call(U)==E?U.length:1,m[T++]=U)}if(!x){for(var L=0;L0?e(V,l.tag,c,c,l.children,m.children,!0,0,l.attrs.contenteditable?V:p,q,r):l.children,nodes:[V]},m.children&&!m.children.nodes&&(m.children.nodes=[]),"select"==l.tag&&l.attrs.value&&f(V,l.tag,{value:l.attrs.value},{},q),a.insertBefore(V,a.childNodes[o]||null)):(V=m.nodes[0],W.length&&f(V,l.tag,l.attrs,m.attrs,q),m.children=e(V,l.tag,c,c,l.children,m.children,!1,0,l.attrs.contenteditable?V:p,q,r),m.nodes.intact=!0,n===!0&&null!=V&&a.insertBefore(V,a.childNodes[o]||null)),typeof l.attrs.config==G){var Y=m.configContext=m.configContext||{},Z=function(a,b){return function(){return a.attrs.config.apply(a,b)}};r.push(Z(l,[V,!X,Y,m]))}}else if(typeof t!=G){var w;0===m.nodes.length?(l.$trusted?w=i(a,o,l):(w=[b.document.createTextNode(l)],a.nodeName.match(K)||a.insertBefore(w[0],a.childNodes[o]||null)),m="string number boolean".indexOf(typeof l)>-1?new l.constructor(l):l,m.nodes=w):m.valueOf()!==l.valueOf()||n===!0?(w=m.nodes,p&&p===b.document.activeElement||(l.$trusted?(g(w,m),w=i(a,o,l)):"textarea"===d?a.value=l:p?p.innerHTML=l:((1==w[0].nodeType||w.length>1)&&(g(m.nodes,m),w=[b.document.createTextNode(l)]),a.insertBefore(w[0],a.childNodes[o]||null),w[0].nodeValue=l)),m=new l.constructor(l),m.nodes=w):m.nodes.intact=!0}return m}function f(a,b,c,d,e){for(var f in c){var g=c[f],h=d[f];if(f in d&&h===g)"value"===f&&"input"===b&&a.value!==g&&(a.value=g);else{d[f]=g;try{if("config"===f)continue;if(typeof g==G&&0==f.indexOf("on"))a[f]=k(g,a);else if("style"===f&&null!=g&&H.call(g)==D){for(var i in g)(null==h||h[i]!==g[i])&&(a.style[i]=g[i]);for(var i in h)i in g||(a.style[i]="")}else null!=e?"href"===f?a.setAttributeNS("http://www.w3.org/1999/xlink","href",g):"className"===f?a.setAttribute("class",g):a.setAttribute(f,g):f in a&&"list"!=f&&"style"!=f&&"form"!=f?a[f]=g:a.setAttribute(f,g)}catch(j){if(j.message.indexOf("Invalid argument")<0)throw j}}}return d}function g(a,b){for(var c=a.length-1;c>-1;c--)a[c]&&a[c].parentNode&&(a[c].parentNode.removeChild(a[c]),b=[].concat(b),b[c]&&h(b[c]));0!=a.length&&(a.length=0)}function h(a){if(a.configContext&&typeof a.configContext.onunload==G&&a.configContext.onunload(),a.children)if(H.call(a.children)==E)for(var b=0;bb?M.push(a)-1:b}function m(a){var b=function(){return arguments.length&&(a=arguments[0]),a};return b.toJSON=function(){return a},b}function n(){for(var a=d.redraw.strategy(),b=0;b=200&&d.status<300?a.onload({type:"load",target:d}):a.onerror({type:"error",target:d}))},a.serialize==JSON.stringify&&a.data&&"GET"!=a.method&&d.setRequestHeader("Content-Type","application/json; charset=utf-8"),a.deserialize==JSON.parse&&d.setRequestHeader("Accept","application/json, text/*"),typeof a.config==G){var e=a.config(d,a);null!=e&&(d=e)}if(a.data&&H.call(a.data)!=F&&a.data.constructor!=b.FormData)throw"Request data should be either be a string or FormData. Check the `serialize` option in `m.request`";return d.send("GET"!=a.method&&a.data?a.data:""),d}var f="mithril_callback_"+(new Date).getTime()+"_"+Math.round(1e16*Math.random()).toString(36),g=b.document.createElement("script");b[f]=function(d){b.document.body.removeChild(g),a.onload({type:"load",target:{responseText:d}}),b[f]=c},g.onerror=function(){return b.document.body.removeChild(g),a.onerror({type:"error",target:{status:500,responseText:JSON.stringify({error:"Error making jsonp request"})}}),b[f]=c,!1},g.onload=function(){return!1},g.src=a.url+(a.url.indexOf("?")>0?"&":"?")+(a.callbackKey?a.callbackKey:"callback")+"="+f+"&"+s(a.data||{}),b.document.body.appendChild(g)}function A(a,b,c){if("GET"==a.method&&"jsonp"!=a.dataType){var d=a.url.indexOf("?")<0?"?":"&",e=s(b);a.url=a.url+(e?d+e:"")}else a.data=c(b);return a}function B(a,b){var c=a.match(/:[a-z]\w+/gi);if(c&&b)for(var d=0;dc&&(c=P.length);var e=!1;if(R[c]&&typeof R[c].onunload==G){var f={preventDefault:function(){e=!0}};R[c].onunload(f)}if(!e){d.redraw.strategy("all"),d.startComputation(),P[c]=a;var g=O=b,h=new b.controller;return g==O&&(R[c]=h,Q[c]=b),d.endComputation(),R[c]}},d.redraw=function(a){var c=b.cancelAnimationFrame||b.clearTimeout,d=b.requestAnimationFrame||b.setTimeout;S&&a!==!0?(new Date-T>V||d==b.requestAnimationFrame)&&(S>0&&c(S),S=d(n,V)):(n(),S=d(function(){S=null},V))},d.redraw.strategy=d.prop();var W=0;d.startComputation=function(){W++},d.endComputation=function(){W=Math.max(W-1,0),0==W&&d.redraw()},d.withAttr=function(a,b){return function(c){c=c||event;var d=c.currentTarget||this;b(a in d?d[a]:d.getAttribute(a))}};var X,Y={pathname:"",hash:"#",search:"?"},Z=function(){},$={};return d.route=function(){if(0===arguments.length)return X;if(3===arguments.length&&H.call(arguments[1])==F){var a=arguments[0],c=arguments[1],e=arguments[2];Z=function(b){var f=X=o(b);p(a,e,f)||d.route(c,!0)};var f="hash"==d.route.mode?"onhashchange":"onpopstate";b[f]=function(){X!=o(b.location[d.route.mode])&&Z(b.location[d.route.mode])},U=r,b[f]()}else if(arguments[0].addEventListener){{var g=arguments[0];arguments[1],arguments[2]}g.href=("pathname"!==d.route.mode?b.location.pathname:"")+Y[d.route.mode]+this.attrs.href,g.removeEventListener("click",q),g.addEventListener("click",q)}else if(H.call(arguments[0])==F){X=arguments[0];var h=null!=arguments[1]&&H.call(arguments[1])==D?s(arguments[1]):null;h&&(X+=(-1===X.indexOf("?")?"?":"&")+h);var i=(3==arguments.length?arguments[2]:arguments[1])===!0;b.history.pushState?(U=function(){b.history[i?"replaceState":"pushState"](null,b.document.title,Y[d.route.mode]+X),r()},Z(Y[d.route.mode]+X)):b.location[d.route.mode]=X}},d.route.param=function(a){return $[a]},d.route.mode="search",d.deferred=function(){var a=new x;return a.promise=w(a.promise),a},d.deferred.onerror=function(a){if("[object Error]"==H.call(a)&&!a.constructor.toString().match(/ Error/))throw a},d.sync=function(a){function b(a,b){return function(d){return g[a]=d,b||(c="reject"),0==--f&&(e.promise(g),e[c](g)),d}}var c="resolve",e=d.deferred(),f=a.length,g=new Array(f);if(a.length>0)for(var h=0;h