-
Notifications
You must be signed in to change notification settings - Fork 47
Expand file tree
/
Copy pathsolve.js
More file actions
36 lines (27 loc) · 899 Bytes
/
solve.js
File metadata and controls
36 lines (27 loc) · 899 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
// Just paste this script onto the homepage
// Courtesy of Joseph (MISC)
const mouseover = new Event('mouseover')
// activate all the dots
document.querySelectorAll("#logo circle").forEach((c) => c.dispatchEvent(mouseover))
// getting all the dots
var dots = Array(...document.querySelectorAll('#logo circle'))
// sort dots by y pos, then x pos
function sort_lr_tb(a, b) {
ax = a.cx.baseVal.value
bx = b.cx.baseVal.value
ay = a.cy.baseVal.value
by = b.cy.baseVal.value
if(ax == bx) return ay - by
return ax - bx
}
var sorted_dots = dots.sort(sort_lr_tb)
var zero_fill = sorted_dots[0].style.fill
// get binary
var out = sorted_dots.map(x => x.style.fill == zero_fill ? '0' : '1').join('')
// decode ascii
var decoded = ''
for(var i = 0; i < out.length; i += 8) {
var c = parseInt(out.substr(i, 8), 2)
decoded += String.fromCharCode(c)
}
console.log(decoded)