diff -r 000000000000 -r 52d30e6014a0 js/main.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/js/main.js Mon Feb 09 09:20:01 2015 -0800 @@ -0,0 +1,39 @@ + +var Y = global.Y; + +// Main behavior. +// +$( window ).ready( function() { + Y.window.main = Y.gui.Window.get(); + setupWindowEvents(); + + $( 'button.info' ).click(function() { + Y.yubiexec( 'ykinfo', ['-a'] ); + }); + + $( 'button.console' ).click(function() { + Y.window.main.showDevTools(); + }); + + Y.callback( 'ykinfo' ).add( function() { + $( '.version' ).html( Y.keyinfo.version ); + $( '.serial' ).html( Y.keyinfo.serial ); + $( '.programming_sequence' ).html( Y.keyinfo.programming_sequence ); + $( '.slot1' ).html( Y.keyinfo.slot1_status ? 'Configured' : 'Clear' ); + $( '.slot2' ).html( 'Clear' ); + }); + + Y.callback( 'ykinfo-error' ).add( function(data) { + $( '#info' ).html( data.toString() ); + }); +}); + + +// Default event actions for the main window. +// +var setupWindowEvents = function() { + // Shut down the application if the main window is closed. + Y.window.main.on( 'closed', function() { process.exit() }); + Y.disableDragDrop( window ); +}; +