Created
November 30, 2015 14:14
-
-
Save Hikari9/9004bb85477cbce06df3 to your computer and use it in GitHub Desktop.
Radio button clicker for http://www.32x8.com/circuits6
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
| // run this in the k-map solver site in http://www.32x8.com/circuits6 to choose radio buttons | |
| index = 3; | |
| tags = document.getElementsByTagName('input'); | |
| radio = {}; | |
| // find radio tags | |
| for (i in tags) { | |
| if (tags[i].type == 'radio' && tags[i].name.substring(0, 2) == 'in') { | |
| value = parseInt(tags[i].name.substring(2)); | |
| if (!radio[value]) radio[value] = {}; | |
| radio[value][tags[i].id] = tags[i]; | |
| } | |
| } | |
| // put conversion booleans, 'x' for don't care | |
| alufn = [ | |
| 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', | |
| 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', | |
| 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', | |
| 0b000000, 0b000000, 'x', 'x', 'x', 'x', 'x', 'x', | |
| 0b000000, 0b000001, 'x', 'x', 0b110011, 0b110101, 0b110111, 'x', | |
| 0b011000, 0b011110, 0b010110, 'x', 0b100000, 0b100001, 0b100011, 'x', | |
| 0b000000, 0b000001, 'x', 'x', 0b110011, 0b110101, 0b110111, 'x', | |
| 0b011000, 0b011110, 0b010110, 'x', 0b100000, 0b100001, 0b100011, 'x', | |
| ] | |
| for (key in radio) { | |
| if (alufn[key] == 'x') | |
| radio[key]['dc'].checked = true; | |
| else if (alufn[key] & (1 << index)) | |
| radio[key]['rt'].checked = true; | |
| else | |
| radio[key]['left'].checked = true; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment