Created
June 16, 2015 16:55
-
-
Save khanhicetea/f8c0f8403b268ff90f15 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Paste this code in to Console | |
var a = $('.braille-contest-code')[1]; | |
var items = $(a).find('.word'); | |
var m = []; | |
var map = { | |
0: 0, | |
1: 3, | |
2: 1, | |
3: 4, | |
4: 2, | |
5: 5 | |
}; | |
var j = 0; | |
var result = []; | |
for (var i = 0; i < items.length; i++) { | |
m.push([0, 0, 0, 0, 0, 0]); | |
tmp = $(items[i]).text().replace(/[^0.]/g, ''); | |
for (var k = 0; k < 6; k++) { | |
if (tmp[k] == '0') { | |
m[j][map[k]] = 1; | |
} | |
} | |
tmp = [] | |
for (var k = 0; k < 6; k++) { | |
if (m[j][k] == 1) { | |
tmp.push(k + 1); | |
} | |
} | |
result.push(tmp.join('-')); | |
j++; | |
} | |
console.log(result.join(" ")); | |
console.log("Goto http://www.dcode.fr/braille-alphabet to decode message :)"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment