js/main.js
changeset 0 52d30e6014a0
equal deleted inserted replaced
-1:000000000000 0:52d30e6014a0
       
     1 
       
     2 var Y = global.Y;
       
     3 
       
     4 // Main behavior.
       
     5 //
       
     6 $( window ).ready( function() {
       
     7 	Y.window.main = Y.gui.Window.get();
       
     8 	setupWindowEvents();
       
     9 
       
    10 	$( 'button.info' ).click(function() {
       
    11 		Y.yubiexec( 'ykinfo', ['-a'] );
       
    12    	});
       
    13 
       
    14 	$( 'button.console' ).click(function() {
       
    15 		Y.window.main.showDevTools();
       
    16    	});
       
    17 
       
    18 	Y.callback( 'ykinfo' ).add( function() {
       
    19 		$( '.version' ).html( Y.keyinfo.version );
       
    20 		$( '.serial' ).html( Y.keyinfo.serial );
       
    21 		$( '.programming_sequence' ).html( Y.keyinfo.programming_sequence );
       
    22 		$( '.slot1' ).html( Y.keyinfo.slot1_status ? 'Configured' : 'Clear' );
       
    23 		$( '.slot2' ).html( 'Clear' );
       
    24 	});
       
    25 
       
    26 	Y.callback( 'ykinfo-error' ).add( function(data) {
       
    27 		$( '#info' ).html( data.toString() );
       
    28 	});
       
    29 });
       
    30 
       
    31 
       
    32 // Default event actions for the main window.
       
    33 //
       
    34 var setupWindowEvents = function() {
       
    35 	// Shut down the application if the main window is closed.
       
    36 	Y.window.main.on( 'closed', function() { process.exit() });
       
    37 	Y.disableDragDrop( window );
       
    38 };
       
    39