author | Mahlon E. Smith <mahlon@martini.nu> |
Mon, 09 Feb 2015 09:20:01 -0800 | |
changeset 0 | 52d30e6014a0 |
permissions | -rw-r--r-- |
0
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2 |
var Y = global.Y; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4 |
// Main behavior. |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5 |
// |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6 |
$( window ).ready( function() { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7 |
Y.window.main = Y.gui.Window.get(); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8 |
setupWindowEvents(); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
9 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
10 |
$( 'button.info' ).click(function() { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
11 |
Y.yubiexec( 'ykinfo', ['-a'] ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
12 |
}); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
13 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
14 |
$( 'button.console' ).click(function() { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
15 |
Y.window.main.showDevTools(); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
16 |
}); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
17 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
18 |
Y.callback( 'ykinfo' ).add( function() { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
19 |
$( '.version' ).html( Y.keyinfo.version ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
20 |
$( '.serial' ).html( Y.keyinfo.serial ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
21 |
$( '.programming_sequence' ).html( Y.keyinfo.programming_sequence ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
22 |
$( '.slot1' ).html( Y.keyinfo.slot1_status ? 'Configured' : 'Clear' ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
23 |
$( '.slot2' ).html( 'Clear' ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
24 |
}); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
25 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
26 |
Y.callback( 'ykinfo-error' ).add( function(data) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
27 |
$( '#info' ).html( data.toString() ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
28 |
}); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
29 |
}); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
30 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
31 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
32 |
// Default event actions for the main window. |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
33 |
// |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
34 |
var setupWindowEvents = function() { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
35 |
// Shut down the application if the main window is closed. |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
36 |
Y.window.main.on( 'closed', function() { process.exit() }); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
37 |
Y.disableDragDrop( window ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
38 |
}; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
39 |