Browse Source

cleanup a few things that I missed earlier.

sisyphus
Dustin Falgout 9 years ago
parent
commit
16f2cc29fd
  1. 4
      themes/antergos/css/style.css
  2. 159
      themes/antergos/js/greeter-compiled.js
  3. 2
      themes/antergos/js/greeter-compiled.js.map
  4. 121
      themes/antergos/js/greeter.js

4
themes/antergos/css/style.css

@ -511,8 +511,8 @@ input.password.form-control:focus {
a.list-group-item:focus, a.list-group-item:hover, a.list-group-item.hovered { a.list-group-item:focus, a.list-group-item:hover, a.list-group-item.hovered {
position: relative; position: relative;
-webkit-box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3), 0 0 10px rgba(0, 0, 0, 0.1) inset; -webkit-box-shadow: 0 1px 0px rgba(0, 0, 0, 0.1), 0 0 1px rgba(0, 0, 0, 0.1) inset;
box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3), 0 0 10px rgba(0, 0, 0, 0.1) inset; box-shadow: 0 1px 0px rgba(0, 0, 0, 0.1), 0 0 1px rgba(0, 0, 0, 0.1) inset;
outline: none; outline: none;
margin: 0px 0; margin: 0px 0;
background: #FFFFFF; background: #FFFFFF;

159
themes/antergos/js/greeter-compiled.js

@ -1,8 +1,34 @@
'use strict'; 'use strict';
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); var _createClass = (function() {
function defineProperties( target, props ) {
for ( var i = 0; i < props.length; i ++ ) {
var descriptor = props[ i ];
descriptor.enumerable = descriptor.enumerable || false;
descriptor.configurable = true;
if ( "value" in descriptor ) {
descriptor.writable = true;
}
Object.defineProperty( target, descriptor.key, descriptor );
}
}
return function( Constructor, protoProps, staticProps ) {
if ( protoProps ) {
defineProperties( Constructor.prototype, protoProps );
}
if ( staticProps ) {
defineProperties( Constructor, staticProps );
}
return Constructor;
};
})();
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _classCallCheck( instance, Constructor ) {
if ( ! (instance instanceof Constructor) ) {
throw new TypeError( "Cannot call a class as a function" );
}
}
/* /*
* *
@ -32,16 +58,31 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
/**
* This is used to access our main class from within jQuery callbacks.
*/
var _self = null;
/**
* Capitalize a string.
*
* @returns {string}
*/
String.prototype.capitalize = function() { String.prototype.capitalize = function() {
return this.charAt( 0 ).toUpperCase() + this.slice( 1 ); return this.charAt( 0 ).toUpperCase() + this.slice( 1 );
}; };
var _self; /**
* This is the theme's main class object. It contains almost all the theme's logic.
*/
var AntergosTheme = (function() { var AntergosTheme = (function() {
function AntergosTheme() { function AntergosTheme() {
_classCallCheck( this, AntergosTheme ); _classCallCheck( this, AntergosTheme );
if ( null !== _self ) {
return _self;
}
this.debug = this.cache_get( 'debug', 'enabled' ); this.debug = this.cache_get( 'debug', 'enabled' );
this.user_list_visible = false; this.user_list_visible = false;
this.auth_pending = false; this.auth_pending = false;
@ -179,15 +220,16 @@ var AntergosTheme = (function () {
} }
/** /**
* Register callbacks for LightDM as well as any others that haven't been registered elsewhere. * Register callbacks for the LDM Greeter as well as any others that haven't been
* registered elsewhere.
*/ */
}, { }, {
key: 'register_callbacks', key: 'register_callbacks',
value: function register_callbacks() { value: function register_callbacks() {
$(document).keydown(this, this.key_press_handler); $( document ).keydown( this.key_press_handler );
$('.cancel_auth').click(this, this.cancel_authentication); $( '.cancel_auth' ).click( this.cancel_authentication );
$('.submit_passwd').click(this, this.submit_password); $( '.submit_passwd' ).click( this.submit_password );
window.show_prompt = this.show_prompt; window.show_prompt = this.show_prompt;
window.show_message = this.show_message; window.show_message = this.show_message;
window.start_authentication = this.start_authentication; window.start_authentication = this.start_authentication;
@ -221,8 +263,8 @@ var AntergosTheme = (function () {
// For backwards compatibility // For backwards compatibility
last_session = localStorage.getItem( user.name ); last_session = localStorage.getItem( user.name );
if ( null === last_session ) { if ( null === last_session ) {
// This user has never logged in before let's enable the system's default // This user has never logged in before let's enable the system's
// session. // default session.
last_session = lightdm.default_session; last_session = lightdm.default_session;
} }
this.cache_set( last_session, 'user', user.name, 'session' ); this.cache_set( last_session, 'user', user.name, 'session' );
@ -232,8 +274,9 @@ var AntergosTheme = (function () {
template = '\n\t\t\t\t<a href="#" id="' + user.name + '" class="list-group-item ' + user.name + '" data-session="' + last_session + '">\n\t\t\t\t\t<img src="' + image_src + '" class="img-circle" alt="' + user.display_name + '" />\n\t\t\t\t\t<span>' + user.display_name + '</span>\n\t\t\t\t\t<span class="badge"><i class="fa fa-check"></i></span>\n\t\t\t\t</a>'; template = '\n\t\t\t\t<a href="#" id="' + user.name + '" class="list-group-item ' + user.name + '" data-session="' + last_session + '">\n\t\t\t\t\t<img src="' + image_src + '" class="img-circle" alt="' + user.display_name + '" />\n\t\t\t\t\t<span>' + user.display_name + '</span>\n\t\t\t\t\t<span class="badge"><i class="fa fa-check"></i></span>\n\t\t\t\t</a>';
// Register event handler here so we don't have to iterate over the users again later. // Register event handler here so we don't have to iterate over the users
$(template).appendTo(this.$user_list).click(this, this.start_authentication).children('img').on('error', this.image_not_found); // again later.
$( template ).appendTo( this.$user_list ).click( this.start_authentication ).children( 'img' ).on( 'error', this.image_not_found );
} // END for ( var user of lightdm.users ) } // END for ( var user of lightdm.users )
} catch ( err ) { } catch ( err ) {
_didIteratorError3 = true; _didIteratorError3 = true;
@ -279,7 +322,7 @@ var AntergosTheme = (function () {
template = '\n\t\t\t\t<li>\n\t\t\t\t\t<a href="#" data-session-id="' + session.key + '" class="' + css_class + '">' + session.name + '</a>\n\t\t\t\t</li>'; template = '\n\t\t\t\t<li>\n\t\t\t\t\t<a href="#" data-session-id="' + session.key + '" class="' + css_class + '">' + session.name + '</a>\n\t\t\t\t</li>';
$(template).appendTo(this.$session_list).click(this, this.session_toggle_handler); $( template ).appendTo( this.$session_list ).click( this.session_toggle_handler );
} // END for (var session of lightdm.sessions) } // END for (var session of lightdm.sessions)
} catch ( err ) { } catch ( err ) {
_didIteratorError4 = true; _didIteratorError4 = true;
@ -323,7 +366,6 @@ var AntergosTheme = (function () {
var action = _step5.value; var action = _step5.value;
var cmd = 'can_' + action; var cmd = 'can_' + action;
console.log(action);
template = '\n\t\t\t\t<a href="#" id="' + action + '" class="btn btn-default ' + action + '" data-toggle="tooltip" data-placement="top" title="' + action.capitalize() + '" data-container="body">\n\t\t\t\t\t<i class="fa fa-' + actions[ action ] + '"></i>\n\t\t\t\t</a>'; template = '\n\t\t\t\t<a href="#" id="' + action + '" class="btn btn-default ' + action + '" data-toggle="tooltip" data-placement="top" title="' + action.capitalize() + '" data-container="body">\n\t\t\t\t\t<i class="fa fa-' + actions[ action ] + '"></i>\n\t\t\t\t</a>';
@ -402,6 +444,12 @@ var AntergosTheme = (function () {
_this.$clock.html( moment().format( format ) ); _this.$clock.html( moment().format( format ) );
}, 60000 ); }, 60000 );
} }
/**
* Show the user list if its not already shown. This is used to allow the user to
* display the user list by pressing Enter or Spacebar.
*/
}, { }, {
key: 'show_user_list', key: 'show_user_list',
value: function show_user_list() { value: function show_user_list() {
@ -449,38 +497,44 @@ var AntergosTheme = (function () {
} }
} }
} }
}
greeting = null === greeting ? 'Welcome!' : greeting; greeting = null === greeting ? 'Welcome!' : greeting;
}
$('.welcome').text(greeting);
$( '.welcome' ).text( greeting );
$( '#hostname' ).append( lightdm.hostname ); $( '#hostname' ).append( lightdm.hostname );
} }
/**
* Start the authentication process for the selected user.
*
* @param {object} event - jQuery.Event object from 'click' event.
*/
}, { }, {
key: 'start_authentication', key: 'start_authentication',
value: function start_authentication( event ) { value: function start_authentication( event ) {
var user_id = $( this ).attr( 'id' ), var user_id = $( this ).attr( 'id' ),
selector = '.' + user_id, selector = '.' + user_id,
self = event.data, user_session = _self.cache_get( 'user', user_id, 'session' );
user_session = self.cache_get('user', user_id, 'session');
if (self.auth_pending || null !== self.selected_user) { if ( _self.auth_pending || null !== _self.selected_user ) {
lightdm.cancel_authentication(); lightdm.cancel_authentication();
self.log('Authentication cancelled for ' + self.selected_user); _self.log( 'Authentication cancelled for ' + _self.selected_user );
self.selected_user = null; _self.selected_user = null;
} }
self.log('Starting authentication for ' + user_id + '.'); _self.log( 'Starting authentication for ' + user_id + '.' );
self.selected_user = user_id; _self.selected_user = user_id;
// CSS hack to workaround webkit bug // CSS hack to workaround webkit bug
if ($(self.$user_list).children().length > 3) { if ( $( _self.$user_list ).children().length > 3 ) {
$(self.$user_list).css('column-count', 'initial').parent().css('max-width', '50%'); $( _self.$user_list ).css( 'column-count', 'initial' ).parent().css( 'max-width', '50%' );
} }
$( selector ).addClass( 'hovered' ).siblings().hide(); $( selector ).addClass( 'hovered' ).siblings().hide();
$( '.fa-toggle-down' ).hide(); $( '.fa-toggle-down' ).hide();
self.log('Session for ' + user_id + ' is ' + user_session); _self.log( 'Session for ' + user_id + ' is ' + user_session );
$( '[data-session-id="' + user_session + '"]' ).parent().trigger( 'click', this ); $( '[data-session-id="' + user_session + '"]' ).parent().trigger( 'click', this );
@ -488,15 +542,21 @@ var AntergosTheme = (function () {
$( '#passwordArea' ).show(); $( '#passwordArea' ).show();
$( '.dropdown-toggle' ).dropdown(); $( '.dropdown-toggle' ).dropdown();
self.auth_pending = true; _self.auth_pending = true;
lightdm.start_authentication( user_id ); lightdm.start_authentication( user_id );
} }
/**
* Cancel the pending authentication.
*
* @param {object} event - jQuery.Event object from 'click' event.
*/
}, { }, {
key: 'cancel_authentication', key: 'cancel_authentication',
value: function cancel_authentication( event ) { value: function cancel_authentication( event ) {
var self = event.data, var selectors = [ '#statusArea', '#timerArea', '#passwordArea', '#session-list' ];
selectors = ['#statusArea', '#timerArea', '#passwordArea', '#session-list'];
var _iteratorNormalCompletion8 = true; var _iteratorNormalCompletion8 = true;
var _didIteratorError8 = false; var _didIteratorError8 = false;
@ -525,18 +585,26 @@ var AntergosTheme = (function () {
lightdm.cancel_authentication(); lightdm.cancel_authentication();
self.log('Cancelled authentication.'); _self.log( 'Cancelled authentication.' );
// CSS hack to work-around webkit bug // CSS hack to work-around webkit bug
if ($(self.$user_list).children().length > 3) { if ( $( _self.$user_list ).children().length > 3 ) {
$(self.$user_list).css('column-count', '2').parent().css('max-width', '85%'); $( _self.$user_list ).css( 'column-count', '2' ).parent().css( 'max-width', '85%' );
} }
$( '.hovered' ).removeClass( 'hovered' ).siblings().show(); $( '.hovered' ).removeClass( 'hovered' ).siblings().show();
$( '.fa-toggle-down' ).show(); $( '.fa-toggle-down' ).show();
self.selected_user = null;
self.auth_pending = false; _self.selected_user = null;
_self.auth_pending = false;
} }
/**
* Called when the user attempts to authenticate (inputs password).
* We check to see if the user successfully authenticated and if so tell the LDM
* Greeter to log them in with the session they selected.
*/
}, { }, {
key: 'authentication_complete', key: 'authentication_complete',
value: function authentication_complete() { value: function authentication_complete() {
@ -548,8 +616,10 @@ var AntergosTheme = (function () {
$( '#timerArea' ).hide(); $( '#timerArea' ).hide();
if ( lightdm.is_authenticated ) { if ( lightdm.is_authenticated ) {
// The user entered the correct password. Let's log them in.
lightdm.login( lightdm.authentication_user, selected_session ); lightdm.login( lightdm.authentication_user, selected_session );
} else { } else {
// The user did not enter the correct password. Show error message.
$( '#statusArea' ).show(); $( '#statusArea' ).show();
} }
} }
@ -563,31 +633,28 @@ var AntergosTheme = (function () {
}, { }, {
key: 'session_toggle_handler', key: 'session_toggle_handler',
value: function session_toggle_handler( event ) { value: function session_toggle_handler( event ) {
var self = event.data, var $session = $( this ).children( 'a' ),
$session = $(this).children('a'),
session_name = $session.text(), session_name = $session.text(),
session_key = $session.attr( 'data-session-id' ); session_key = $session.attr( 'data-session-id' );
console.log($session);
$session.parents( '.btn-group' ).find( '.selected' ).attr( 'data-session-id', session_key ).html( session_name ); $session.parents( '.btn-group' ).find( '.selected' ).attr( 'data-session-id', session_key ).html( session_name );
} }
}, { }, {
key: 'key_press_handler', key: 'key_press_handler',
value: function key_press_handler( event ) { value: function key_press_handler( event ) {
var self = event.data, var action;
action;
switch ( event.which ) { switch ( event.which ) {
case 13: case 13:
action = self.auth_pending ? self.submit_password() : !self.user_list_visible ? self.show_user_list() : 0; action = _self.auth_pending ? _self.submit_password() : ! _self.user_list_visible ? _self.show_user_list() : 0;
self.log(action); _self.log( action );
break; break;
case 27: case 27:
action = self.auth_pending ? self.cancel_authentication() : 0; action = _self.auth_pending ? _self.cancel_authentication() : 0;
self.log(action); _self.log( action );
break; break;
case 32: case 32:
action = !self.user_list_visible && !self.auth_pending ? self.show_user_list() : 0; action = ! _self.user_list_visible && ! _self.auth_pending ? _self.show_user_list() : 0;
self.log(action); _self.log( action );
break; break;
default: default:
break; break;
@ -641,6 +708,10 @@ var AntergosTheme = (function () {
return AntergosTheme; return AntergosTheme;
})(); })();
/**
* Initialize the theme once the window has loaded.
*/
$( window ).load( function() { $( window ).load( function() {
_self = new AntergosTheme(); _self = new AntergosTheme();
} ); } );

2
themes/antergos/js/greeter-compiled.js.map

File diff suppressed because one or more lines are too long

121
themes/antergos/js/greeter.js

@ -26,17 +26,31 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
/**
* This is used to access our main class from within jQuery callbacks.
*/
var _self = null;
/**
* Capitalize a string.
*
* @returns {string}
*/
String.prototype.capitalize = function() { String.prototype.capitalize = function() {
return this.charAt( 0 ).toUpperCase() + this.slice( 1 ); return this.charAt( 0 ).toUpperCase() + this.slice( 1 );
}; };
var _self;
/**
* This is the theme's main class object. It contains almost all the theme's logic.
*/
class AntergosTheme { class AntergosTheme {
constructor() { constructor() {
if (null !== _self) {
return _self;
}
this.debug = this.cache_get( 'debug', 'enabled' ); this.debug = this.cache_get( 'debug', 'enabled' );
this.user_list_visible = false; this.user_list_visible = false;
this.auth_pending = false; this.auth_pending = false;
@ -111,12 +125,13 @@ class AntergosTheme {
} }
/** /**
* Register callbacks for LightDM as well as any others that haven't been registered elsewhere. * Register callbacks for the LDM Greeter as well as any others that haven't been registered
* elsewhere.
*/ */
register_callbacks() { register_callbacks() {
$( document ).keydown( this, this.key_press_handler); $( document ).keydown( this.key_press_handler );
$('.cancel_auth').click(this, this.cancel_authentication); $( '.cancel_auth' ).click( this.cancel_authentication );
$('.submit_passwd').click(this, this.submit_password); $( '.submit_passwd' ).click( this.submit_password );
window.show_prompt = this.show_prompt; window.show_prompt = this.show_prompt;
window.show_message = this.show_message; window.show_message = this.show_message;
window.start_authentication = this.start_authentication; window.start_authentication = this.start_authentication;
@ -157,7 +172,7 @@ class AntergosTheme {
</a>`; </a>`;
// Register event handler here so we don't have to iterate over the users again later. // Register event handler here so we don't have to iterate over the users again later.
$( template ).appendTo( this.$user_list ).click( this, this.start_authentication ).children( 'img' ).on( 'error', this.image_not_found ); $( template ).appendTo( this.$user_list ).click( this.start_authentication ).children( 'img' ).on( 'error', this.image_not_found );
} // END for ( var user of lightdm.users ) } // END for ( var user of lightdm.users )
@ -184,7 +199,7 @@ class AntergosTheme {
<a href="#" data-session-id="${session.key}" class="${css_class}">${session.name}</a> <a href="#" data-session-id="${session.key}" class="${css_class}">${session.name}</a>
</li>`; </li>`;
$( template ).appendTo( this.$session_list ).click( this, this.session_toggle_handler ); $( template ).appendTo( this.$session_list ).click( this.session_toggle_handler );
} // END for (var session of lightdm.sessions) } // END for (var session of lightdm.sessions)
@ -205,7 +220,6 @@ class AntergosTheme {
for ( var action of Object.keys( actions ) ) { for ( var action of Object.keys( actions ) ) {
var cmd = `can_${action}`; var cmd = `can_${action}`;
console.log( action );
template = ` template = `
<a href="#" id="${action}" class="btn btn-default ${action}" data-toggle="tooltip" data-placement="top" title="${action.capitalize()}" data-container="body"> <a href="#" id="${action}" class="btn btn-default ${action}" data-toggle="tooltip" data-placement="top" title="${action.capitalize()}" data-container="body">
@ -250,6 +264,11 @@ class AntergosTheme {
}, 60000 ); }, 60000 );
} }
/**
* Show the user list if its not already shown. This is used to allow the user to
* display the user list by pressing Enter or Spacebar.
*/
show_user_list() { show_user_list() {
if ( $( this.$clock_container ).hasClass( 'in' ) ) { if ( $( this.$clock_container ).hasClass( 'in' ) ) {
$( '#trigger' ).trigger( 'click' ); $( '#trigger' ).trigger( 'click' );
@ -274,37 +293,42 @@ class AntergosTheme {
break; break;
} }
} }
}
greeting = (null === greeting) ? 'Welcome!' : greeting; greeting = (null === greeting) ? 'Welcome!' : greeting;
}
$( '.welcome' ).text( greeting );
$( '.welcome' ).text( greeting );
$( '#hostname' ).append( lightdm.hostname ); $( '#hostname' ).append( lightdm.hostname );
} }
/**
* Start the authentication process for the selected user.
*
* @param {object} event - jQuery.Event object from 'click' event.
*/
start_authentication( event ) { start_authentication( event ) {
var user_id = $( this ).attr( 'id' ), var user_id = $( this ).attr( 'id' ),
selector = `.${user_id}`, selector = `.${user_id}`,
self = event.data, user_session = _self.cache_get( 'user', user_id, 'session' );
user_session = self.cache_get( 'user', user_id, 'session' );
if ( self.auth_pending || null !== self.selected_user ) { if ( _self.auth_pending || null !== _self.selected_user ) {
lightdm.cancel_authentication(); lightdm.cancel_authentication();
self.log( `Authentication cancelled for ${self.selected_user}` ); _self.log( `Authentication cancelled for ${_self.selected_user}` );
self.selected_user = null; _self.selected_user = null;
} }
self.log( `Starting authentication for ${user_id}.` ); _self.log( `Starting authentication for ${user_id}.` );
self.selected_user = user_id; _self.selected_user = user_id;
// CSS hack to workaround webkit bug // CSS hack to workaround webkit bug
if ( $( self.$user_list ).children().length > 3 ) { if ( $( _self.$user_list ).children().length > 3 ) {
$( self.$user_list ).css( 'column-count', 'initial' ).parent().css( 'max-width', '50%' ); $( _self.$user_list ).css( 'column-count', 'initial' ).parent().css( 'max-width', '50%' );
} }
$( selector ).addClass( 'hovered' ).siblings().hide(); $( selector ).addClass( 'hovered' ).siblings().hide();
$( '.fa-toggle-down' ).hide(); $( '.fa-toggle-down' ).hide();
self.log( `Session for ${user_id} is ${user_session}` ); _self.log( `Session for ${user_id} is ${user_session}` );
$( `[data-session-id="${user_session}"]` ).parent().trigger( 'click', this ); $( `[data-session-id="${user_session}"]` ).parent().trigger( 'click', this );
@ -312,14 +336,19 @@ class AntergosTheme {
$( '#passwordArea' ).show(); $( '#passwordArea' ).show();
$( '.dropdown-toggle' ).dropdown(); $( '.dropdown-toggle' ).dropdown();
self.auth_pending = true; _self.auth_pending = true;
lightdm.start_authentication( user_id ); lightdm.start_authentication( user_id );
} }
/**
* Cancel the pending authentication.
*
* @param {object} event - jQuery.Event object from 'click' event.
*/
cancel_authentication( event ) { cancel_authentication( event ) {
var self = event.data, var selectors = [ '#statusArea', '#timerArea', '#passwordArea', '#session-list' ];
selectors = [ '#statusArea', '#timerArea', '#passwordArea', '#session-list' ];
for ( var selector of selectors ) { for ( var selector of selectors ) {
$( selector ).hide(); $( selector ).hide();
@ -327,20 +356,27 @@ class AntergosTheme {
lightdm.cancel_authentication(); lightdm.cancel_authentication();
self.log( 'Cancelled authentication.' ); _self.log( 'Cancelled authentication.' );
// CSS hack to work-around webkit bug // CSS hack to work-around webkit bug
if ( $( self.$user_list ).children().length > 3 ) { if ( $( _self.$user_list ).children().length > 3 ) {
$( self.$user_list ).css( 'column-count', '2' ).parent().css( 'max-width', '85%' ); $( _self.$user_list ).css( 'column-count', '2' ).parent().css( 'max-width', '85%' );
} }
$( '.hovered' ).removeClass( 'hovered' ).siblings().show(); $( '.hovered' ).removeClass( 'hovered' ).siblings().show();
$( '.fa-toggle-down' ).show(); $( '.fa-toggle-down' ).show();
self.selected_user = null;
self.auth_pending = false; _self.selected_user = null;
_self.auth_pending = false;
} }
/**
* Called when the user attempts to authenticate (inputs password).
* We check to see if the user successfully authenticated and if so tell the LDM
* Greeter to log them in with the session they selected.
*/
authentication_complete() { authentication_complete() {
var selected_session = $( '.selected' ).attr( 'data-session-id' ); var selected_session = $( '.selected' ).attr( 'data-session-id' );
@ -350,8 +386,10 @@ class AntergosTheme {
$( '#timerArea' ).hide(); $( '#timerArea' ).hide();
if ( lightdm.is_authenticated ) { if ( lightdm.is_authenticated ) {
// The user entered the correct password. Let's log them in.
lightdm.login( lightdm.authentication_user, selected_session ); lightdm.login( lightdm.authentication_user, selected_session );
} else { } else {
// The user did not enter the correct password. Show error message.
$( '#statusArea' ).show(); $( '#statusArea' ).show();
} }
} }
@ -363,30 +401,27 @@ class AntergosTheme {
} }
session_toggle_handler( event ) { session_toggle_handler( event ) {
var self = event.data, var $session = $( this ).children( 'a' ),
$session = $(this).children('a'),
session_name = $session.text(), session_name = $session.text(),
session_key = $session.attr( 'data-session-id' ); session_key = $session.attr( 'data-session-id' );
console.log($session);
$session.parents( '.btn-group' ).find( '.selected' ).attr( 'data-session-id', session_key ).html( session_name ); $session.parents( '.btn-group' ).find( '.selected' ).attr( 'data-session-id', session_key ).html( session_name );
} }
key_press_handler( event ) { key_press_handler( event ) {
var self = event.data, var action;
action;
switch ( event.which ) { switch ( event.which ) {
case 13: case 13:
action = self.auth_pending ? self.submit_password() : ! self.user_list_visible ? self.show_user_list() : 0; action = _self.auth_pending ? _self.submit_password() : ! _self.user_list_visible ? _self.show_user_list() : 0;
self.log( action ); _self.log( action );
break; break;
case 27: case 27:
action = self.auth_pending ? self.cancel_authentication() : 0; action = _self.auth_pending ? _self.cancel_authentication() : 0;
self.log( action ); _self.log( action );
break; break;
case 32: case 32:
action = (! self.user_list_visible && ! self.auth_pending) ? self.show_user_list() : 0; action = (! _self.user_list_visible && ! _self.auth_pending) ? _self.show_user_list() : 0;
self.log( action ); _self.log( action );
break; break;
default: default:
break; break;
@ -428,7 +463,11 @@ class AntergosTheme {
} }
} }
$( window ).load( function() {
/**
* Initialize the theme once the window has loaded.
*/
$( window ).load( () => {
_self = new AntergosTheme(); _self = new AntergosTheme();
} ); } );

Loading…
Cancel
Save