Skip to content

Commit f7a1c17

Browse files
committed
218 by corruptio
1 parent 11e862b commit f7a1c17

File tree

3 files changed

+31
-7
lines changed

3 files changed

+31
-7
lines changed

commented.html

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<script>
2+
(
3+
o = b => {
4+
for(j in a){
5+
for(i in a){
6+
y = a[i] + -~j,
7+
b ?
8+
document.write(
9+
[["<p>"][i]] + "<input onfocus=value=[o[id]] onblur=o[id]=value;o() id=" + y + ">"
10+
)
11+
:
12+
eval(
13+
y + (".value" + o[y]).replace(/[A-Z]\d/g, " +$&.value")
14+
)
15+
}
16+
}
17+
}
18+
)(
19+
a = "ABCD"
20+
)
21+
</script>

index.html

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44
<mark style="background:#fe5;padding: 3px;">2017-09-28: <b>Hello Hacker News!</b> Wanna discover 100+ more golfed apps & games like this one? <a href="https://gist.github.com/xem/206db44adbdd09bac424">click here!</a></mark>
55
<br>
66
<h1>Sheet</h1>
7-
<h3>A 219b spreadsheet app in HTML/JS</h3>
7+
<h3>A 218b spreadsheet app in HTML/JS</h3>
88
Inspired by <a href="http://aem1k.com/sheet/">aem1k.com/sheet</a>
99
<br>
10-
Golfed by xem, subzey, p01, rlauck, aemkei
10+
Golfed by xem, subzey, p01, rlauck, aemkei, odensc, corruptio
1111
<br>
1212
<a href="https://github.com/xem/ama/issues/14">Related AMA answer</a>
1313
<br>
@@ -17,18 +17,21 @@ <h3>A 219b spreadsheet app in HTML/JS</h3>
1717
<br>
1818
<br>
1919
<pre style=text-align:left;font-family:courier;width:780px;margin:auto;background:#def;padding:15px;border-radius:10px>
20-
&lt;script>(o=b=>{for(j in a)for(i in a)y=a[i]+-~j,b?document.write([["&lt;p>"][
21-
i]]+"&lt;input onfocus=value=[o[id]] onblur=o[id]=value;o() id=${y}>"):eval(
22-
y+(".value"+o[y]).replace(/[A-Z]\d/g," +$&.value"))})(a="ABCD")&lt;/script>
20+
&lt;script>(o=b=>{for(j in a)for(i in a)y=a[i]+j,b?document.write(
21+
`&lt;${i*j?'input':'p'} onfocus=value=[o[id]] onblur=o[id]=value;o() id=${y}>`
22+
):eval(y+(".value"+o[y]).replace(/[A-Z]\d/g," +$&.value"))})(a="_ABCD")&lt;/script>
2323
</pre>
2424
<br>
25+
<br>
2526
<b>Demo:</b>
2627
<br>
28+
(with extra placeholders)
29+
<br>
2730
<br>
2831
Cells can contain text, numbers or formulas.
2932
<br>
3033
Formulas start with =. Example: "=A1+8*B2".
31-
<br><script>function o(b){for(j in a)for(i in a)y=a[i]+-~j,b?document.write([["<br>"][i]]+"<input onfocus=value=[o[id]] onblur=o[id]=value;o() id="+y+" placeholder="+y+">"):eval("top[y].value"+(""+o[y]).replace(/[A-G]\d/g," +$&.value"))}o(a="ABCDE")</script><br>
34+
<br><script>function o(b){for(j in a)for(i in a)y=a[i]+-~j,b?document.write([["<br>"][i]]+"<input onfocus=value=[o[id]] onblur=o[id]=value;o() id="+y+" placeholder="+y+">"):eval("top[y].value"+(""+o[y]).replace(/[A-G]\d/g," +$&.value"))}o(a="ABCD")</script><br>
3235
<br>
3336
<br>
3437
<b>Source:</b>

xem.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
<script>(o=b=>{for(j in a)for(i in a)y=a[i]+-~j,b?document.write([["<p>"][i]]+`<input onfocus=value=[o[id]] onblur=o[id]=value;o() id=${y}>`):eval(y+(".value"+o[y]).replace(/[A-Z]\d/g," +$&.value"))})(a="ABCD")</script>
1+
<script>(o=b=>{for(j in a)for(i in a)y=a[i]+j,b?document.write(`<${i*j?'input':'p'} onfocus=value=[o[id]] onblur=o[id]=value;o() id=${y}>`):eval(y+(".value"+o[y]).replace(/[A-Z]\d/g," +$&.value"))})(a="_ABCD")</script>

0 commit comments

Comments
 (0)