Re:Show HN: A TO-DO app that fits inside a single tweet
by franciscop on Monday December 21, 2020 @09:48AM
(#25495367)
Ah wow the :checked + * {text-decoration:line-through} is pretty smart! No need for JS in that case. Your reply inspired me for a new version:
https://twitter.com/FPresencia/status/1341037189409296384
https://jsfiddle.net/franciscop/6p9xwv7e/
<script>b=u("body").append(u("<input>").on("keyup",e=>{t=e.currentTarget;if(13==e.keyCode){b.append(`<p><label><input type="checkbox"> <span>`+t.value);t.value=''}})).append(u('<button>Clear').on('click',e=>u('p').remove()))</script><style>:checked+*{text-decoration:line-through}
Re:Show HN: A TO-DO app that fits inside a single tweet
by vukgr on Monday December 21, 2020 @09:03AM
(#25494998)
Am I missing something or did everyone forget <s> is a thing in html?
Re:Show HN: A TO-DO app that fits inside a single tweet
by franciscop on Monday December 21, 2020 @09:46AM
(#25495359)
Nope, could be made with <strike> as well, but swapping element tags takes more characters than toggling a class. In the case of UmbrellaJS I made a .wrap() method, but since there is no .unwrap() again it takes more than toggling classes.
> Starting HTML body should be empty except the <script>
Because you'll have no <script> tag. To fulfill this, you'll have to unnecessarily wrap the whole thing in script, like:
(277 chars, golfable even further, but I'm not going to replace button elements with something inappropriate.)