Commit a3eee606 authored by Arthur Verschaeve's avatar Arthur Verschaeve

Duel: remove count from clear completed button

Ref #1234
parent 5b886069
...@@ -19,5 +19,5 @@ ...@@ -19,5 +19,5 @@
--%> --%>
<button id="clear-completed" <button id="clear-completed"
if="<%= data.completed %>" if="<%= data.completed %>"
onclick="<%= todos.actions.clear_click %>">Clear completed (<%= data.completed %>)</button> onclick="<%= todos.actions.clear_click %>">Clear completed</button>
</footer> </footer>
(function(){function j(){var a=location.href.indexOf("examples/");return location.href.substr(0,a)}function i(a,c){if(!(this instanceof i))return new i(a,c);var b,e;if("object"!==typeof a)try{a=JSON.parse(a)}catch(n){return}if(c)b=c.template,e=c.framework;if(!b&&a.templates)b=a.templates.todomvc;if(!e&&document.querySelector("[data-framework]"))e=document.querySelector("[data-framework]").dataset.framework;if(b&&a[e])this.frameworkJSON=a[e],this.template=b,this.append()}var m=function(a){a.defaults= (function(){function i(){var a=location.href.indexOf("examples/");return location.href.substr(0,a)}function f(a,b){if(!(this instanceof f))return new f(a,b);var c,d;if("object"!==typeof a)try{a=JSON.parse(a)}catch(k){return}if(b)c=b.template,d=b.framework;if(!c&&a.templates)c=a.templates.todomvc;if(!d&&document.querySelector("[data-framework]"))d=document.querySelector("[data-framework]").dataset.framework;this.template=c;if(a.backend)this.frameworkJSON=a.backend,this.append({backend:!0});else if(a[d])this.frameworkJSON=
function(a){if(!a)return a;for(var b=1,c=arguments.length;b<c;b++){var e=arguments[b];if(e)for(var h in e)null==a[h]&&(a[h]=e[h])}return a};a.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var c=/(.)^/,b={"'":"'","\\":"\\","\r":"r","\n":"n","\t":"t","\u2028":"u2028","\u2029":"u2029"},e=/\\|'|\r|\n|\t|\u2028|\u2029/g;a.template=function(i,g,f){var k,f=a.defaults({},f,a.templateSettings),h=RegExp([(f.escape||c).source,(f.interpolate||c).source, a[d],this.append()}var m=function(a){a.defaults=function(a){if(!a)return a;for(var b=1,c=arguments.length;b<c;b++){var d=arguments[b];if(d)for(var j in d)null==a[j]&&(a[j]=d[j])}return a};a.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var b=/(.)^/,c={"'":"'","\\":"\\","\r":"r","\n":"n","\t":"t","\u2028":"u2028","\u2029":"u2029"},d=/\\|'|\r|\n|\t|\u2028|\u2029/g;a.template=function(k,h,g){var f,g=a.defaults({},g,a.templateSettings),j=RegExp([(g.escape||
(f.evaluate||c).source].join("|")+"|$","g"),j=0,d="__p+='";i.replace(h,function(a,c,f,g,h){d+=i.slice(j,h).replace(e,function(a){return"\\"+b[a]});c&&(d+="'+\n((__t=("+c+"))==null?'':_.escape(__t))+\n'");f&&(d+="'+\n((__t=("+f+"))==null?'':__t)+\n'");g&&(d+="';\n"+g+"\n__p+='");j=h+a.length;return a});d+="';\n";f.variable||(d="with(obj||{}){\n"+d+"}\n");d="var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};\n"+d+"return __p;\n";try{k=new Function(f.variable||"obj", b).source,(g.interpolate||b).source,(g.evaluate||b).source].join("|")+"|$","g"),i=0,e="__p+='";k.replace(j,function(a,b,h,f,g){e+=k.slice(i,g).replace(d,function(a){return"\\"+c[a]});b&&(e+="'+\n((__t=("+b+"))==null?'':_.escape(__t))+\n'");h&&(e+="'+\n((__t=("+h+"))==null?'':__t)+\n'");f&&(e+="';\n"+f+"\n__p+='");i=g+a.length;return a});e+="';\n";g.variable||(e="with(obj||{}){\n"+e+"}\n");e="var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};\n"+e+"return __p;\n";
"_",d)}catch(l){throw l.source=d,l;}if(g)return k(g,a);g=function(b){return k.call(this,b,a)};g.source="function("+(f.variable||"obj")+"){\n"+d+"}";return g};return a}({});if("todomvc.com"===location.hostname)window._gaq=[["_setAccount","UA-31081062-1"],["_trackPageview"]],function(a,c){var b=a.createElement(c),e=a.getElementsByTagName(c)[0];b.src="//www.google-analytics.com/ga.js";e.parentNode.insertBefore(b,e)}(document,"script");i.prototype.append=function(){var a=document.createElement("aside"); try{f=new Function(g.variable||"obj","_",e)}catch(l){throw l.source=e,l;}if(h)return f(h,a);h=function(b){return f.call(this,b,a)};h.source="function("+(g.variable||"obj")+"){\n"+e+"}";return h};return a}({});if("todomvc.com"===location.hostname)window._gaq=[["_setAccount","UA-31081062-1"],["_trackPageview"]],function(a,b){var c=a.createElement(b),d=a.getElementsByTagName(b)[0];c.src="//www.google-analytics.com/ga.js";d.parentNode.insertBefore(c,d)}(document,"script");f.prototype.append=function(a){var b=
a.innerHTML=m.template(this.template,this.frameworkJSON);a.className="learn";var c=a.querySelectorAll(".demo-link");Array.prototype.forEach.call(c,function(a){a.setAttribute("href",j()+a.getAttribute("href"))});document.body.className=(document.body.className+" learn-bar").trim();document.body.insertAdjacentHTML("afterBegin",a.outerHTML)};if("tastejs.github.io"===location.hostname)location.href=location.href.replace("tastejs.github.io/todomvc","todomvc.com");(function(a,c){if(!location.host)return console.info("Miss the info bar? Run TodoMVC from a server to avoid a cross-origin error."); document.createElement("aside");b.innerHTML=m.template(this.template,this.frameworkJSON);b.className="learn";if(a&&a.backend){var a=b.querySelector(".source-links"),c=a.firstElementChild,d=a.lastElementChild,f=d.getAttribute("href");d.setAttribute("href",f.substr(f.lastIndexOf("http")));a.innerHTML=c.outerHTML+d.outerHTML}else a=b.querySelectorAll(".demo-link"),Array.prototype.forEach.call(a,function(a){"http"!==a.getAttribute("href").substr(0,4)&&a.setAttribute("href",i()+a.getAttribute("href"))});
var b=new XMLHttpRequest;b.open("GET",j()+a,!0);b.send();b.onload=function(){200===b.status&&c&&c(b.responseText)}})("learn.json",i)})();/* document.body.className=(document.body.className+" learn-bar").trim();document.body.insertAdjacentHTML("afterBegin",b.outerHTML)};if("tastejs.github.io"===location.hostname)location.href=location.href.replace("tastejs.github.io/todomvc","todomvc.com");(function(a,b){if(!location.host)return console.info("Miss the info bar? Run TodoMVC from a server to avoid a cross-origin error.");var c=new XMLHttpRequest;c.open("GET",i()+a,!0);c.send();c.onload=function(){200===c.status&&b&&b(c.responseText)}})("learn.json",
f)})();/*
DUEL v0.8.2 http://duelengine.org DUEL v0.8.2 http://duelengine.org
Copyright (c)2006-2012 Stephen M. McKamey. Copyright (c)2006-2012 Stephen M. McKamey.
Licensed under The MIT License. Licensed under The MIT License.
...@@ -25,7 +26,7 @@ u=function(a){return n(a)&&n(a.getView)?a:J(a)};u.raw=function(a){return new x(a ...@@ -25,7 +26,7 @@ u=function(a){return n(a)&&n(a.getView)?a:J(a)};u.raw=function(a){return new x(a
colspan:"colSpan",cellpadding:"cellPadding",cellspacing:"cellSpacing",tabindex:"tabIndex",accesskey:"accessKey",hidefocus:"hideFocus",usemap:"useMap",maxlength:"maxLength",readonly:"readOnly",contenteditable:"contentEditable"},p={enctype:"encoding",onscroll:"DOMMouseScroll",checked:"defaultChecked"},N=/^[\r\n]+/,O=/[\r\n]+$/;q.prototype.toDOM=function(a,b){4===l(a)&&(a=m.getElementById(a));var c;try{b&&(c=a,a=null),c=I(c||t(this.value[0]),this.value)}catch(f){c=m.createTextNode("["+f+"]")}a&&a.parentNode&& colspan:"colSpan",cellpadding:"cellPadding",cellspacing:"cellSpacing",tabindex:"tabIndex",accesskey:"accessKey",hidefocus:"hideFocus",usemap:"useMap",maxlength:"maxLength",readonly:"readOnly",contenteditable:"contentEditable"},p={enctype:"encoding",onscroll:"DOMMouseScroll",checked:"defaultChecked"},N=/^[\r\n]+/,O=/[\r\n]+$/;q.prototype.toDOM=function(a,b){4===l(a)&&(a=m.getElementById(a));var c;try{b&&(c=a,a=null),c=I(c||t(this.value[0]),this.value)}catch(f){c=m.createTextNode("["+f+"]")}a&&a.parentNode&&
a.parentNode.replaceChild(c,a);return c};q.prototype.reload=function(){var a=m;try{var b=this.toDOM();a.replaceChild(b,a.documentElement);if(a.createStyleSheet){for(var c=b.firstChild;c&&"HEAD"!==(c.tagName||"");)c=c.nextSibling;for(var f=c&&c.firstChild;f;){if("LINK"===(f.tagName||""))f.href=f.href;f=f.nextSibling}}}catch(d){a=a.open("text/html"),a.write(this.toString()),a.close()}};return u}(document,window.ScriptEngineMajorVersion);var todos=todos||{}; a.parentNode.replaceChild(c,a);return c};q.prototype.reload=function(){var a=m;try{var b=this.toDOM();a.replaceChild(b,a.documentElement);if(a.createStyleSheet){for(var c=b.firstChild;c&&"HEAD"!==(c.tagName||"");)c=c.nextSibling;for(var f=c&&c.firstChild;f;){if("LINK"===(f.tagName||""))f.href=f.href;f=f.nextSibling}}}catch(d){a=a.open("text/html"),a.write(this.toString()),a.close()}};return u}(document,window.ScriptEngineMajorVersion);var todos=todos||{};
(function(h,e,g){function d(){var a="undefined"!==typeof JSON?JSON.stringify(b):b;e.setItem(g,a)}var b,e=e||function(){var a={};return{getItem:function(c){return a[c]},setItem:function(c,b){a[c]=b}}}(),f=e.getItem(g);b=f?"undefined"!==typeof JSON?JSON.parse(f):f:[];h.model={tasks:function(){return b},stats:function(){var a={};a.total=b.length;a.completed=b.filter(function(a){return a.completed}).length;a.active=a.total-a.completed;return a},add:function(a){a={id:((new Date).getTime()+Math.random()).toString(36), (function(h,e,g){function d(){var a="undefined"!==typeof JSON?JSON.stringify(b):b;e.setItem(g,a)}var b,e=e||function(){var a={};return{getItem:function(c){return a[c]},setItem:function(c,b){a[c]=b}}}(),f=e.getItem(g);b=f?"undefined"!==typeof JSON?JSON.parse(f):f:[];h.model={tasks:function(){return b},stats:function(){var a={};a.total=b.length;a.completed=b.filter(function(a){return a.completed}).length;a.active=a.total-a.completed;return a},add:function(a){a={id:((new Date).getTime()+Math.random()).toString(36),
title:a,completed:!1};b.push(a);d();return a},edit:function(a,c){b.filter(function(b){return b.id===a})[0].title=c;d()},toggle:function(a,c){b.filter(function(b){return b.id===a})[0].completed=c;d()},toggleAll:function(a){b.forEach(function(b){b.completed=a});d()},remove:function(a){b.forEach(function(c,d){c.id===a&&b.splice(d,1)});d()},expunge:function(){b.forEach(function(a,c){a.completed&&b.splice(c,1)});d()}}})(todos,window.localStorage,"todos-duel");var todos=todos||{};todos.views=todos.views||{};todos.views.Stats=duel([""," ",["$if",{test:function(a){return a.total}},["footer",{id:"footer"}," ",["span",{id:"todo-count"},["strong",function(a){return a.active}]," ",function(a){return 1===a.active?"item":"items"}," left"]," "," ",["$if",{test:function(a){return a.completed}},["button",{id:"clear-completed",onclick:function(){return todos.actions.clear_click}},"Clear completed (",function(a){return a.completed},")"]]]]]);var todos=todos||{};todos.views=todos.views||{}; title:a,completed:!1};b.push(a);d();return a},edit:function(a,c){b.filter(function(b){return b.id===a})[0].title=c;d()},toggle:function(a,c){b.filter(function(b){return b.id===a})[0].completed=c;d()},toggleAll:function(a){b.forEach(function(b){b.completed=a});d()},remove:function(a){b.forEach(function(c,d){c.id===a&&b.splice(d,1)});d()},expunge:function(){b.forEach(function(a,c){a.completed&&b.splice(c,1)});d()}}})(todos,window.localStorage,"todos-duel");var todos=todos||{};todos.views=todos.views||{};todos.views.Stats=duel([""," ",["$if",{test:function(a){return a.total}},["footer",{id:"footer"}," ",["span",{id:"todo-count"},["strong",function(a){return a.active}]," ",function(a){return 1===a.active?"item":"items"}," left"]," "," ",["$if",{test:function(a){return a.completed}},["button",{id:"clear-completed",onclick:function(){return todos.actions.clear_click}},"Clear completed"]]]]]);var todos=todos||{};todos.views=todos.views||{};
todos.views.Task=duel([""," ",["li",{"class":function(a){return a.completed?"completed":""}}," ",["div",{"class":"view"}," ",["input",{"class":"toggle",type:"checkbox",checked:function(a){return a.completed},onchange:function(a){return todos.actions.completed_change(a.id)}}]," ",["label",{ondblclick:function(a){return todos.actions.content_dblclick(a.id)}},function(a){return a.title}]," ",["button",{"class":"destroy",onclick:function(a){return todos.actions.remove_click(a.id)}}]," "]," ",["input", todos.views.Task=duel([""," ",["li",{"class":function(a){return a.completed?"completed":""}}," ",["div",{"class":"view"}," ",["input",{"class":"toggle",type:"checkbox",checked:function(a){return a.completed},onchange:function(a){return todos.actions.completed_change(a.id)}}]," ",["label",{ondblclick:function(a){return todos.actions.content_dblclick(a.id)}},function(a){return a.title}]," ",["button",{"class":"destroy",onclick:function(a){return todos.actions.remove_click(a.id)}}]," "]," ",["input",
{"class":"edit",type:"text",value:function(a){return a.title},onblur:function(a){return todos.actions.edit_blur(a.id)},onkeypress:function(a){return todos.actions.edit_keypress(a.id)}}]]]);var todos=todos||{};todos.views=todos.views||{};todos.views.Tasks=duel([""," ",["$if",{test:function(a){return a.tasks.length}},["section",{id:"main"}," ",["input",{id:"toggle-all",type:"checkbox",checked:function(a){return!a.stats.active},onchange:function(){return todos.actions.toggle_change}}]," ",["label",{"for":"toggle-all"},"Mark all as complete"]," ",["ul",{id:"todo-list"}," ",["$for",{each:function(a){return a.tasks}}," ",["$call",{view:function(){return todos.views.Task}}]]," "]]]]);var todos=todos||{};todos.views=todos.views||{};todos.views.TodoApp=duel(["section",{id:"todoapp"}," ",["header",{id:"header"}," ",["h1","todos"]," ",["input",{id:"new-todo",placeholder:"What needs to be done?",autofocus:null,onblur:function(){return todos.actions.add_blur},onkeypress:function(){return todos.actions.add_keypress}}]," "]," ",["$call",{view:function(){return todos.views.Tasks},data:function(a){return a}}]," ",["$call",{view:function(){return todos.views.Stats},data:function(a){return a.stats}}]]);var todos=todos||{}; {"class":"edit",type:"text",value:function(a){return a.title},onblur:function(a){return todos.actions.edit_blur(a.id)},onkeypress:function(a){return todos.actions.edit_keypress(a.id)}}]]]);var todos=todos||{};todos.views=todos.views||{};todos.views.Tasks=duel([""," ",["$if",{test:function(a){return a.tasks.length}},["section",{id:"main"}," ",["input",{id:"toggle-all",type:"checkbox",checked:function(a){return!a.stats.active},onchange:function(){return todos.actions.toggle_change}}]," ",["label",{"for":"toggle-all"},"Mark all as complete"]," ",["ul",{id:"todo-list"}," ",["$for",{each:function(a){return a.tasks}}," ",["$call",{view:function(){return todos.views.Task}}]]," "]]]]);var todos=todos||{};todos.views=todos.views||{};todos.views.TodoApp=duel(["section",{id:"todoapp"}," ",["header",{id:"header"}," ",["h1","todos"]," ",["input",{id:"new-todo",placeholder:"What needs to be done?",autofocus:null,onblur:function(){return todos.actions.add_blur},onkeypress:function(){return todos.actions.add_keypress}}]," "]," ",["$call",{view:function(){return todos.views.Tasks},data:function(a){return a}}]," ",["$call",{view:function(){return todos.views.Stats},data:function(a){return a.stats}}]]);var todos=todos||{};
(function(c,e){function f(a){var a=a||c.model.stats(),a=c.views.Stats(a).toDOM(),b=e.getElementById(i);b?b.parentNode.replaceChild(a,b):e.getElementById(g).appendChild(a)}function d(){var a={tasks:c.model.tasks(),stats:c.model.stats()},b=c.views.Tasks(a).toDOM(),d=e.getElementById(j);d?d.parentNode.replaceChild(b,d):e.getElementById(g).appendChild(b);f(a.stats)}function h(a){var b=(a.value||"").trim();a.value="";b&&(a=c.model.add(b),(b=e.getElementById(k))?(b.appendChild(c.views.Task(a).toDOM()),f()): (function(c,e){function f(a){var a=a||c.model.stats(),a=c.views.Stats(a).toDOM(),b=e.getElementById(i);b?b.parentNode.replaceChild(a,b):e.getElementById(g).appendChild(a)}function d(){var a={tasks:c.model.tasks(),stats:c.model.stats()},b=c.views.Tasks(a).toDOM(),d=e.getElementById(j);d?d.parentNode.replaceChild(b,d):e.getElementById(g).appendChild(b);f(a.stats)}function h(a){var b=(a.value||"").trim();a.value="";b&&(a=c.model.add(b),(b=e.getElementById(k))?(b.appendChild(c.views.Task(a).toDOM()),f()):
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
<p>Ported to <a href="http://duelengine.org">DUEL</a> by <a href="http://mck.me">Stephen McKamey</a></p> <p>Ported to <a href="http://duelengine.org">DUEL</a> by <a href="http://mck.me">Stephen McKamey</a></p>
<p>Part of <a href="http://todomvc.com">TodoMVC</a></p> <p>Part of <a href="http://todomvc.com">TodoMVC</a></p>
</footer> </footer>
<script src="./cdn/076f299127e53bed2f18338591152399d66267db.js"></script> <script src="./cdn/d10574a720ccdf2d2c810f0c45afb5f159264a1f.js"></script>
</body> </body>
</html> </html>
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment