1 Star 0 Fork 0

bit212/TechDocs

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
app.js 8.90 KB
一键复制 编辑 原始数据 按行查看 历史
Tsutomu Kawamura 提交于 10年前 . CSS preprocess
!function t(e,n,o){function i(u,a){if(!n[u]){if(!e[u]){var c="function"==typeof require&&require;if(!a&&c)return c(u,!0);if(r)return r(u,!0);var f=new Error("Cannot find module '"+u+"'");throw f.code="MODULE_NOT_FOUND",f}var s=n[u]={exports:{}};e[u][0].call(s.exports,function(t){var n=e[u][1][t];return i(n?n:t)},s,s.exports,t,e,n,o)}return n[u].exports}for(var r="function"==typeof require&&require,u=0;u<o.length;u++)i(o[u]);return i}({1:[function(t){var e=t("riot"),n=t("./lib/ajax-get");t("../components/app.tag"),t("../components/logo.tag"),t("../components/item.tag"),t("../components/footnote.tag"),URL="/index.json",n(URL,function(t){e.mount("app",{title:"TechDocs",items:JSON.parse(t),urls:{github:"https://github.com/TechDocs/TechDocs"}})})},{"../components/app.tag":3,"../components/footnote.tag":4,"../components/item.tag":5,"../components/logo.tag":6,"./lib/ajax-get":7,riot:2}],2:[function(t,e,n){!function(){function t(t){var e={val:t},n=t.split(/\s+in\s+/);return n[1]&&(e.val="{ "+n[1],n=n[0].slice(1).trim().split(/,\s*/),e.key=n[0],e.pos=n[1]),e}function o(e,n,o){l(e,"each");var i,r=e.outerHTML,a=e.previousSibling,c=e.parentNode,f=[],s=[];o=t(o),n.one("update",function(){c.removeChild(e)}).one("mount",function(){m(c)||(c=n.root)}).on("update",function(){var t=y(o.val,n);if(t){if(!Array.isArray(t)){var e=JSON.stringify(t);if(e==i)return;i=e,s.map(function(t){t.unmount()}),s=f=[],t=Object.keys(t).map(function(e){var n={};return n[o.key]=e,n[o.pos]=t[e],n})}v(f,t).map(function(t){var e=f.indexOf(t),n=s[e];n&&(n.unmount(),f.splice(e,1),s.splice(e,1))});var l=c.childNodes,p=Array.prototype.indexOf.call(l,a);v(t,f).map(function(e){var a=t.indexOf(e);if(!i&&o.key){var f={};f[o.key]=e,f[o.pos]=a,e=f}var d=new u({tmpl:r},{before:l[p+1+a],parent:n,root:c,loop:!0,item:e});s.splice(a,0,d)}),f=t.slice()}})}function i(t,e){h(t,function(t){1==t.nodeType&&s(t.attributes,function(n){/^(name|id)$/.test(n.name)&&(e[n.value]=t)})})}function r(t,e,n){function i(t,e,o){if(y(e)||o){var i={dom:t,expr:e};n.push(p(i,o||{}))}}h(t,function(t){var n=t.nodeType;if(3==n&&"STYLE"!=t.parentNode.tagName&&i(t,t.nodeValue),1==n){var r=t.getAttribute("each");if(r)return o(t,e,r),!1;var a=w[t.tagName.toLowerCase()];return a?(a=new u(a,{root:t,parent:e}),!1):void s(t.attributes,function(e){var n=e.name,o=e.value,r=n.split("__")[1];return i(t,o,{attr:r||n,bool:r}),r?(l(t,n),!1):void 0})}})}function u(t,e){function n(){Object.keys(c).map(function(t){w[t]=y(c[t],h||u)})}function o(){for(;j.firstChild;)v?(k=j.firstChild,b.insertBefore(j.firstChild,e.before||null)):b.appendChild(j.firstChild);m(b)||(u.root=b=h.root),u.trigger("mount"),h&&h.on("update",u.update).one("unmount",u.unmount)}var u=g.observable(this),a=[],c={},h=e.parent,v=e.loop,b=e.root,w=e.opts,x=e.item;if(v||!b.riot){b.riot=1,w=w||{},p(this,{parent:h,root:b,opts:w,children:[]}),p(this,x),s(b.attributes,function(t){var e=t.name,n=t.value;return c[e]=n,n.indexOf("{")>=0?(l(b,e),!1):void 0}),n(),h&&h.children.push(this);var k,j=d(t.tmpl);i(j,this),this.update=function(t){p(u,t),p(u,x),u.trigger("update"),n(),f(a,u,x),u.trigger("updated")},this.unmount=function(){if(v)b.removeChild(k);else{var t=b.parentNode;t&&t.removeChild(b)}if(h){var e=h.children;e.splice(e.indexOf(u),1)}u.trigger("unmount"),h&&h.off("update",u.update),mounted=!1},t.fn&&t.fn.call(this,w),r(j,this,a),this.update(),o()}}function a(t,e,n,o,i){n[t]=function(t){t=t||window.event,t.which=t.which||t.charCode||t.keyCode,t.target=t.target||t.srcElement,t.currentTarget=n,t.item=i,e.call(o,t)!==!0&&(t.preventDefault&&t.preventDefault(),t.returnValue=!1),o.update()}}function c(t,e,n){t&&(t.insertBefore(n,e),t.removeChild(e))}function f(t,e,n){s(t,function(t){var o=t.dom,i=t.attr,r=y(t.expr,e);if(null==r&&(r=""),t.value!==r){if(t.value=r,!i)return o.nodeValue=r;if((!r&&t.bool||/obj|func/.test(typeof r))&&l(o,i),"function"==typeof r)a(i,r,o,e,n);else if("if"==i){l(o,i);var u=t.stub;r?u&&c(u.parentNode,u,o):(u=t.stub=u||document.createTextNode(""),c(o.parentNode,o,u))}else if(/^(show|hide)$/.test(i))l(o,i),"hide"==i&&(r=!r),o.style.display=r?"":"none";else{if(t.bool){if(o[i]=r,!r)return;r=i}o.setAttribute(i,r)}}})}function s(t,e){for(var n=0;n<(t||[]).length;n++)e(t[n],n)===!1&&n--}function l(t,e){t.removeAttribute(e)}function p(t,e){return e&&Object.keys(e).map(function(n){t[n]=e[n]}),t}function d(t){var e=t.trim().slice(1,3).toLowerCase(),n=/td|th/.test(e)?"tr":"tr"==e?"tbody":"div";return el=document.createElement(n),el.stub=!0,el.innerHTML=t,el}function h(t,e){for(t=e(t)===!1?t.nextSibling:t.firstChild;t;)h(t,e),t=t.nextSibling}function v(t,e){return t.filter(function(t){return e.indexOf(t)<0})}function m(t){var e=t.parentNode,n=window.HTMLDocument;return e&&!(n&&e instanceof n)}var g={version:"v2.0.8",settings:{}};g.observable=function(t){t=t||{};var e={};return t.on=function(n,o){return"function"==typeof o&&n.replace(/\S+/g,function(t,n){(e[t]=e[t]||[]).push(o),o.typed=n>0}),t},t.off=function(n,o){if("*"==n)e={};else if(o)for(var i,r=e[n],u=0;i=r&&r[u];++u)i==o&&(r.splice(u,1),u--);else n.replace(/\S+/g,function(t){e[t]=[]});return t},t.one=function(e,n){return n&&(n.one=1),t.on(e,n)},t.trigger=function(n){for(var o,i=[].slice.call(arguments,1),r=e[n]||[],u=0;o=r[u];++u)o.busy||(o.busy=1,o.apply(t,o.typed?[n].concat(i):i),o.one?(r.splice(u,1),u--):r[u]!==o&&u--,o.busy=0);return t},t},function(t,e){function n(){return r.hash.slice(1)}function o(t){return t.split("/")}function i(t){t.type&&(t=n()),t!=a&&(u.trigger.apply(null,["H"].concat(o(t))),a=t)}if(this.top){var r=location,u=t.observable(),a=n(),c=window,f=t.route=function(t){t[0]?(r.hash=t,i(t)):u.on("H",t)};f.exec=function(t){t.apply(null,o(n()))},f.parser=function(t){o=t},c.addEventListener?c.addEventListener(e,i,!1):c.attachEvent("on"+e,i)}}(g,"hashchange");var y=function(){function t(t,n){return n=(t||i.join("")).replace(o(/\\{/),"").replace(o(/\\}/),"").split(r),new Function("d","return "+(n[0]||n[2]||n[3]?"["+n.map(function(t,n){return n%2?e(t,1):'"'+t.replace(/\n/g,"\\n").replace(/"/g,'\\"')+'"'}).join(",")+'].join("")':e(n[1])).replace(/\uFFF0/g,i[0]).replace(/\uFFF1/g,i[1]))}function e(t,e){return t=t.replace(/\n/g," ").replace(o(/^[{ ]+|[ }]+$|\/\*.+?\*\//g),""),/^\s*[\w-"']+ *:/.test(t)?"["+t.replace(/\W*([\w-]+)\W*:([^,]+)/g,function(t,o,i){return i.replace(/\w[^,|& ]*/g,function(t){return n(t,e)})+'?"'+o+'":"",'})+'].join(" ")':n(t,e)}function n(t,e){return"(function(v){try{v="+(t.replace(a,function(t,e,n){return n?"(d."+n+"===undefined?window."+n+":d."+n+")":t})||"x")+"}finally{return "+(e?'!v&&v!==0?"":v':"v")+"}}).call(d)"}function o(t){return RegExp(t.source.split("{").join("\\"+i[0]).split("}").join("\\"+i[1]),t.global?"g":"")}var i,r,u={},a=/("|').+?[^\\]\1|\.\w*|\w*:|\b(?:(?:new|typeof|in|instanceof) |(?:this|true|false|null|undefined)\b|function *\()|([a-z_]\w*)/gi;return function(e,n){var a=g.settings.brackets||"{ }";return a!=i&&(i=a.split(" "),r=o(/({[\s\S]*?})/)),n?e&&(u[e]=u[e]||t(e))(n):r.test(e)}}(),b=[],w={};g.tag=function(t,e,n){w[t]={name:t,tmpl:e,fn:n}};var x=g.mountTo=function(t,e,n){var o,i=w[e];return i&&(o=new u(i,{root:t,opts:n})),o?(b.push(o),o.on("unmount",function(){b.splice(b.indexOf(o),1)})):void 0};g.mount=function(t,e){"*"==t&&(t=Object.keys(w).join(", "));var n=[];return s(document.querySelectorAll(t),function(t){var o=t.tagName.toLowerCase(),i=x(t,o,e);i&&n.push(i)}),n},g.update=function(){return b.map(function(t){t.update()}),b},"object"==typeof n?e.exports=g:"function"==typeof define&&define.amd?define(function(){return g}):this.riot=g}()},{}],3:[function(t){var e=t("riot");e.tag("app",'<logo title="{ opts.title }"></logo> <form> <input type="search" value="{ keyword }" onkeyup="{ keyup }" placeholder="search"> </form> <item each="{ filtered }" url="{ url }" language="{ language }" title="{ title }"></item> <p if="{ more }">and { count - MAX } more documents</p> <footnote urls="{ opts.urls }"></footnote>',function(t){MAX=20,this.init=function(){this.keyword="",this.items=t.items,this.filtered=[],this.count=0,this.more=!1,this.search()}.bind(this),this.keyup=function(t){this.keyword=t.target.value.trim().toLowerCase(),this.search()}.bind(this),this.search=function(){filtered=this.items.filter(this.filter),this.count=filtered.length,this.more=filtered.length>MAX,this.filtered=filtered.slice(0,MAX)}.bind(this),this.filter=function(t){return!this.keyword.length||t.id.replace(/\-\w\w$/,"").match(this.keyword)}.bind(this),this.init()})},{riot:2}],4:[function(t){var e=t("riot");e.tag("footnote",'<p>TechDocs Project - <a href="{ opts.urls.github }">GitHub</a></p>',function(){})},{riot:2}],5:[function(t){var e=t("riot");e.tag("item",'<a href="{ opts.url }"> <span class="language">{ opts.language }</span> { opts.title } </a>',function(){})},{riot:2}],6:[function(t){var e=t("riot");e.tag("logo","<h1>{ opts.title }</h1>",function(){})},{riot:2}],7:[function(t,e){e.exports=function(t,e){var n=new XMLHttpRequest;n.onreadystatechange=function(){4==n.readyState&&200==n.status&&e(n.responseText)},n.open("GET",t,!0),n.send("")}},{}]},{},[1]);
//# sourceMappingURL=app.js.map
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Python
1
https://gitee.com/bit212/TechDocs.git
git@gitee.com:bit212/TechDocs.git
bit212
TechDocs
TechDocs
css-preprocess

搜索帮助