Browse Source

...

sisyphus
Dustin Falgout 9 years ago
parent
commit
0d4c638783
  1. 481
      themes/antergos/js/greeter-compiled.js
  2. 2
      themes/antergos/js/greeter-compiled.js.map
  3. 1
      themes/antergos/js/greeter.js

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

@ -1,34 +1,8 @@
'use strict'; 'use strict';
var _createClass = (function() { 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 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 ) { function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
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" );
}
}
/* /*
* *
@ -68,39 +42,39 @@ var _self = null;
* *
* @returns {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);
}; };
/** /**
* This is the theme's main class object. It contains almost all the theme's logic. * 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 ) { if (null !== _self) {
return _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;
this.selected_user = null; this.selected_user = null;
this.$user_list = $( '#user-list2' ); this.$user_list = $('#user-list2');
this.$session_list = $( '#sessions' ); this.$session_list = $('#sessions');
this.$clock_container = $( '#collapseOne' ); this.$clock_container = $('#collapseOne');
this.$clock = $( "#current_time" ); this.$clock = $("#current_time");
this.$actions_container = $( "#actionsArea" ); this.$actions_container = $("#actionsArea");
this.$msg_area_container = $( '#statusArea' ); this.$msg_area_container = $('#statusArea');
this.$msg_area = $( '#showMsg' ); this.$msg_area = $('#showMsg');
this.lang = window.navigator.language.split( '-' )[ 0 ].toLowerCase(); this.lang = window.navigator.language.split('-')[0].toLowerCase();
this.translations = window.ant_translations; this.translations = window.ant_translations;
this.initialize(); this.initialize();
} }
_createClass( AntergosTheme, [ { _createClass(AntergosTheme, [{
key: 'initialize', key: 'initialize',
value: function initialize() { value: function initialize() {
this.initialize_clock(); this.initialize_clock();
@ -113,34 +87,34 @@ var AntergosTheme = (function() {
} }
/** /**
* Add text to the debug log element (accessible from the login screen). * Add text to the debug log element (accessible from the login screen).
* *
* @param {string} text - To be added to the log. * @param {string} text - To be added to the log.
*/ */
}, { }, {
key: 'log', key: 'log',
value: function log( text ) { value: function log(text) {
if ( 'true' === this.debug || true ) { if ('true' === this.debug || true) {
$( '#logArea' ).append( text + '<br/>' ); $('#logArea').append(text + '<br/>');
} }
} }
/** /**
* Get a key's value from localStorage. Keys can have two or more parts. * Get a key's value from localStorage. Keys can have two or more parts.
* For example: "ant:user:john:session". * For example: "ant:user:john:session".
* *
* @param {...string} key_parts - Strings that are combined to form the key. * @param {...string} key_parts - Strings that are combined to form the key.
*/ */
}, { }, {
key: 'cache_get', key: 'cache_get',
value: function cache_get() { value: function cache_get() {
var key = 'ant', var key = 'ant',
index = 0; index = 0;
for ( var _len = arguments.length, key_parts = Array( _len ), _key = 0; _key < _len; _key ++ ) { for (var _len = arguments.length, key_parts = Array(_len), _key = 0; _key < _len; _key++) {
key_parts[ _key ] = arguments[ _key ]; key_parts[_key] = arguments[_key];
} }
var _iteratorNormalCompletion = true; var _iteratorNormalCompletion = true;
@ -148,46 +122,46 @@ var AntergosTheme = (function() {
var _iteratorError = undefined; var _iteratorError = undefined;
try { try {
for ( var _iterator = key_parts[ Symbol.iterator ](), _step; ! (_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true ) { for (var _iterator = key_parts[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
var part = _step.value; var part = _step.value;
key += ':' + part; key += ':' + part;
index += 1; index += 1;
} }
} catch ( err ) { } catch (err) {
_didIteratorError = true; _didIteratorError = true;
_iteratorError = err; _iteratorError = err;
} finally { } finally {
try { try {
if ( ! _iteratorNormalCompletion && _iterator.return ) { if (!_iteratorNormalCompletion && _iterator.return) {
_iterator.return(); _iterator.return();
} }
} finally { } finally {
if ( _didIteratorError ) { if (_didIteratorError) {
throw _iteratorError; throw _iteratorError;
} }
} }
} }
return localStorage.getItem( key ); return localStorage.getItem(key);
} }
/** /**
* Set a key's value in localStorage. Keys can have two or more parts. * Set a key's value in localStorage. Keys can have two or more parts.
* For example: "ant:user:john:session". * For example: "ant:user:john:session".
* *
* @param {string} value - The value to set. * @param {string} value - The value to set.
* @param {...string} key_parts - Strings that are combined to form the key. * @param {...string} key_parts - Strings that are combined to form the key.
*/ */
}, { }, {
key: 'cache_set', key: 'cache_set',
value: function cache_set( value ) { value: function cache_set(value) {
var key = 'ant', var key = 'ant',
index = 0; index = 0;
for ( var _len2 = arguments.length, key_parts = Array( _len2 > 1 ? _len2 - 1 : 0 ), _key2 = 1; _key2 < _len2; _key2 ++ ) { for (var _len2 = arguments.length, key_parts = Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
key_parts[ _key2 - 1 ] = arguments[ _key2 ]; key_parts[_key2 - 1] = arguments[_key2];
} }
var _iteratorNormalCompletion2 = true; var _iteratorNormalCompletion2 = true;
@ -195,41 +169,41 @@ var AntergosTheme = (function() {
var _iteratorError2 = undefined; var _iteratorError2 = undefined;
try { try {
for ( var _iterator2 = key_parts[ Symbol.iterator ](), _step2; ! (_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true ) { for (var _iterator2 = key_parts[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
var part = _step2.value; var part = _step2.value;
key += ':' + part; key += ':' + part;
index += 1; index += 1;
} }
} catch ( err ) { } catch (err) {
_didIteratorError2 = true; _didIteratorError2 = true;
_iteratorError2 = err; _iteratorError2 = err;
} finally { } finally {
try { try {
if ( ! _iteratorNormalCompletion2 && _iterator2.return ) { if (!_iteratorNormalCompletion2 && _iterator2.return) {
_iterator2.return(); _iterator2.return();
} }
} finally { } finally {
if ( _didIteratorError2 ) { if (_didIteratorError2) {
throw _iteratorError2; throw _iteratorError2;
} }
} }
} }
return localStorage.setItem( key, value ); return localStorage.setItem(key, value);
} }
/** /**
* Register callbacks for the LDM Greeter as well as any others that haven't been * Register callbacks for the LDM Greeter as well as any others that haven't been registered
* registered elsewhere. * elsewhere.
*/ */
}, { }, {
key: 'register_callbacks', key: 'register_callbacks',
value: function register_callbacks() { value: function register_callbacks() {
$( document ).keydown( this.key_press_handler ); $(document).keydown(this.key_press_handler);
$( '.cancel_auth' ).click( this.cancel_authentication ); $('.cancel_auth').click(this.cancel_authentication);
$( '.submit_passwd' ).click( 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;
@ -238,14 +212,14 @@ var AntergosTheme = (function() {
} }
/** /**
* Initialize the user list. * Initialize the user list.
*/ */
}, { }, {
key: 'prepare_user_list', key: 'prepare_user_list',
value: function prepare_user_list() { value: function prepare_user_list() {
var tux = 'img/antergos-logo-user.png', var tux = 'img/antergos-logo-user.png',
template; template;
// Loop through the array of LightDMUser objects to create our user list. // Loop through the array of LightDMUser objects to create our user list.
var _iteratorNormalCompletion3 = true; var _iteratorNormalCompletion3 = true;
@ -253,55 +227,54 @@ var AntergosTheme = (function() {
var _iteratorError3 = undefined; var _iteratorError3 = undefined;
try { try {
for ( var _iterator3 = lightdm.users[ Symbol.iterator ](), _step3; ! (_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true ) { for (var _iterator3 = lightdm.users[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) {
var user = _step3.value; var user = _step3.value;
var last_session = this.cache_get( 'user', user.name, 'session' ), var last_session = this.cache_get('user', user.name, 'session'),
image_src = user.image.length ? user.image : tux; image_src = user.image.length ? user.image : tux;
if ( null === last_session ) { if (null === last_session) {
// 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 // This user has never logged in before let's enable the system's default
// default session. // 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');
} }
this.log( 'Last session for ' + user.name + ' was: ' + last_session ); this.log('Last session for ' + user.name + ' was: ' + last_session);
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 // Register event handler here so we don't have to iterate over the users again later.
// again later. $(template).appendTo(this.$user_list).click(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 )
} catch ( err ) { } catch (err) {
_didIteratorError3 = true; _didIteratorError3 = true;
_iteratorError3 = err; _iteratorError3 = err;
} finally { } finally {
try { try {
if ( ! _iteratorNormalCompletion3 && _iterator3.return ) { if (!_iteratorNormalCompletion3 && _iterator3.return) {
_iterator3.return(); _iterator3.return();
} }
} finally { } finally {
if ( _didIteratorError3 ) { if (_didIteratorError3) {
throw _iteratorError3; throw _iteratorError3;
} }
} }
} }
if ( $( this.$user_list ).children().length > 3 ) { if ($(this.$user_list).children().length > 3) {
// Make the user list two columns instead of one. // Make the user list two columns instead of one.
$( this.$user_list ).css( 'column-count', '2' ).parent().css( 'max-width', '85%' ); $(this.$user_list).css('column-count', '2').parent().css('max-width', '85%');
} }
} }
/** /**
* Initialize the session selection dropdown. * Initialize the session selection dropdown.
*/ */
}, { }, {
key: 'prepare_session_list', key: 'prepare_session_list',
@ -312,95 +285,95 @@ var AntergosTheme = (function() {
var _iteratorError4 = undefined; var _iteratorError4 = undefined;
try { try {
for ( var _iterator4 = lightdm.sessions[ Symbol.iterator ](), _step4; ! (_iteratorNormalCompletion4 = (_step4 = _iterator4.next()).done); _iteratorNormalCompletion4 = true ) { for (var _iterator4 = lightdm.sessions[Symbol.iterator](), _step4; !(_iteratorNormalCompletion4 = (_step4 = _iterator4.next()).done); _iteratorNormalCompletion4 = true) {
var session = _step4.value; var session = _step4.value;
var css_class = session.name.replace( / /g, '' ), var css_class = session.name.replace(/ /g, ''),
template; template;
this.log( 'Adding ' + session.name + ' to the session list...' ); this.log('Adding ' + session.name + ' to the session list...');
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.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;
_iteratorError4 = err; _iteratorError4 = err;
} finally { } finally {
try { try {
if ( ! _iteratorNormalCompletion4 && _iterator4.return ) { if (!_iteratorNormalCompletion4 && _iterator4.return) {
_iterator4.return(); _iterator4.return();
} }
} finally { } finally {
if ( _didIteratorError4 ) { if (_didIteratorError4) {
throw _iteratorError4; throw _iteratorError4;
} }
} }
} }
$( '.dropdown-toggle' ).dropdown(); $('.dropdown-toggle').dropdown();
} }
/** /**
* Initialize the system action buttons * Initialize the system action buttons
*/ */
}, { }, {
key: 'prepare_system_action_buttons', key: 'prepare_system_action_buttons',
value: function prepare_system_action_buttons() { value: function prepare_system_action_buttons() {
var actions = { var actions = {
shutdown: "power-off", shutdown: "power-off",
hibernate: "asterisk", hibernate: "asterisk",
suspend: "arrow-down", suspend: "arrow-down",
restart: "refresh" restart: "refresh"
}, },
template; template;
var _iteratorNormalCompletion5 = true; var _iteratorNormalCompletion5 = true;
var _didIteratorError5 = false; var _didIteratorError5 = false;
var _iteratorError5 = undefined; var _iteratorError5 = undefined;
try { try {
for ( var _iterator5 = Object.keys( actions )[ Symbol.iterator ](), _step5; ! (_iteratorNormalCompletion5 = (_step5 = _iterator5.next()).done); _iteratorNormalCompletion5 = true ) { for (var _iterator5 = Object.keys(actions)[Symbol.iterator](), _step5; !(_iteratorNormalCompletion5 = (_step5 = _iterator5.next()).done); _iteratorNormalCompletion5 = true) {
var action = _step5.value; var action = _step5.value;
var cmd = 'can_' + action; var cmd = 'can_' + 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>';
if ( lightdm[ cmd ] ) { if (lightdm[cmd]) {
$( template ).appendTo( $( this.$actions_container ) ).click( action, function( event ) { $(template).appendTo($(this.$actions_container)).click(action, function (event) {
lightdm[ event.data ](); lightdm[event.data]();
} ); });
} }
} // END for (var [action, icon] of actions) } // END for (var [action, icon] of actions)
} catch ( err ) { } catch (err) {
_didIteratorError5 = true; _didIteratorError5 = true;
_iteratorError5 = err; _iteratorError5 = err;
} finally { } finally {
try { try {
if ( ! _iteratorNormalCompletion5 && _iterator5.return ) { if (!_iteratorNormalCompletion5 && _iterator5.return) {
_iterator5.return(); _iterator5.return();
} }
} finally { } finally {
if ( _didIteratorError5 ) { if (_didIteratorError5) {
throw _iteratorError5; throw _iteratorError5;
} }
} }
} }
$( '[data-toggle=tooltip]' ).tooltip(); $('[data-toggle=tooltip]').tooltip();
} }
}, { }, {
key: 'initialize_clock', key: 'initialize_clock',
value: function initialize_clock() { value: function initialize_clock() {
var _this = this; var _this = this;
var saved_format = this.cache_get( 'clock', 'time_format' ), var saved_format = this.cache_get('clock', 'time_format'),
format = null !== saved_format ? saved_format : 'LT', format = null !== saved_format ? saved_format : 'LT',
detected_language = 'en'; detected_language = 'en';
window.navigator.languages = typeof window.navigator.languages !== 'undefined' ? window.navigator.languages : [ window.navigator.language ]; window.navigator.languages = typeof window.navigator.languages !== 'undefined' ? window.navigator.languages : [window.navigator.language];
// Workaround for moment.js bug: https://github.com/moment/moment/issues/2856 // Workaround for moment.js bug: https://github.com/moment/moment/issues/2856
var _iteratorNormalCompletion6 = true; var _iteratorNormalCompletion6 = true;
@ -408,57 +381,57 @@ var AntergosTheme = (function() {
var _iteratorError6 = undefined; var _iteratorError6 = undefined;
try { try {
for ( var _iterator6 = window.navigator.languages[ Symbol.iterator ](), _step6; ! (_iteratorNormalCompletion6 = (_step6 = _iterator6.next()).done); _iteratorNormalCompletion6 = true ) { for (var _iterator6 = window.navigator.languages[Symbol.iterator](), _step6; !(_iteratorNormalCompletion6 = (_step6 = _iterator6.next()).done); _iteratorNormalCompletion6 = true) {
var lang = _step6.value; var lang = _step6.value;
try { try {
detected_language = lang.split( '-' )[ 0 ].toLowerCase(); detected_language = lang.split('-')[0].toLowerCase();
break; break;
} catch ( err ) { } catch (err) {
this.log( String( err ) ); this.log(String(err));
} }
} }
} catch ( err ) { } catch (err) {
_didIteratorError6 = true; _didIteratorError6 = true;
_iteratorError6 = err; _iteratorError6 = err;
} finally { } finally {
try { try {
if ( ! _iteratorNormalCompletion6 && _iterator6.return ) { if (!_iteratorNormalCompletion6 && _iterator6.return) {
_iterator6.return(); _iterator6.return();
} }
} finally { } finally {
if ( _didIteratorError6 ) { if (_didIteratorError6) {
throw _iteratorError6; throw _iteratorError6;
} }
} }
} }
if ( null === detected_language ) { if (null === detected_language) {
detected_language = 'en'; detected_language = 'en';
} }
moment.locale( detected_language ); moment.locale(detected_language);
this.$clock.html( moment().format( format ) ); this.$clock.html(moment().format(format));
setInterval( function() { setInterval(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 * 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. * 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() {
if ( $( this.$clock_container ).hasClass( 'in' ) ) { if ($(this.$clock_container).hasClass('in')) {
$( '#trigger' ).trigger( 'click' ); $('#trigger').trigger('click');
this.user_list_visible = true; this.user_list_visible = true;
} }
if ( $( this.$user_list ).length <= 1 ) { if ($(this.$user_list).length <= 1) {
$( this.$user_list ).find( 'a' ).trigger( 'click', this ); $(this.$user_list).find('a').trigger('click', this);
} }
} }
}, { }, {
@ -466,8 +439,8 @@ var AntergosTheme = (function() {
value: function prepare_login_panel_header() { value: function prepare_login_panel_header() {
var greeting = null; var greeting = null;
if ( this.translations.hasOwnProperty( this.lang ) ) { if (this.translations.hasOwnProperty(this.lang)) {
greeting = this.translations[ this.lang ]; greeting = this.translations[this.lang];
} else { } else {
var _iteratorNormalCompletion7 = true; var _iteratorNormalCompletion7 = true;
var _didIteratorError7 = false; var _didIteratorError7 = false;
@ -475,24 +448,24 @@ var AntergosTheme = (function() {
try { try {
for ( var _iterator7 = window.navigator.languages[ Symbol.iterator ](), _step7; ! (_iteratorNormalCompletion7 = (_step7 = _iterator7.next()).done); _iteratorNormalCompletion7 = true ) { for (var _iterator7 = window.navigator.languages[Symbol.iterator](), _step7; !(_iteratorNormalCompletion7 = (_step7 = _iterator7.next()).done); _iteratorNormalCompletion7 = true) {
var lang = _step7.value; var lang = _step7.value;
if ( this.translations.hasOwnProperty( lang ) ) { if (this.translations.hasOwnProperty(lang)) {
greeting = this.translations[ lang ]; greeting = this.translations[lang];
break; break;
} }
} }
} catch ( err ) { } catch (err) {
_didIteratorError7 = true; _didIteratorError7 = true;
_iteratorError7 = err; _iteratorError7 = err;
} finally { } finally {
try { try {
if ( ! _iteratorNormalCompletion7 && _iterator7.return ) { if (!_iteratorNormalCompletion7 && _iterator7.return) {
_iterator7.return(); _iterator7.return();
} }
} finally { } finally {
if ( _didIteratorError7 ) { if (_didIteratorError7) {
throw _iteratorError7; throw _iteratorError7;
} }
} }
@ -501,83 +474,83 @@ 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. * Start the authentication process for the selected user.
* *
* @param {object} event - jQuery.Event object from 'click' event. * @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,
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);
$( '#session-list' ).removeClass( 'hidden' ).show(); $('#session-list').removeClass('hidden').show();
$( '#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. * Cancel the pending authentication.
* *
* @param {object} event - jQuery.Event object from 'click' event. * @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 selectors = [ '#statusArea', '#timerArea', '#passwordArea', '#session-list' ]; var selectors = ['#statusArea', '#timerArea', '#passwordArea', '#session-list'];
var _iteratorNormalCompletion8 = true; var _iteratorNormalCompletion8 = true;
var _didIteratorError8 = false; var _didIteratorError8 = false;
var _iteratorError8 = undefined; var _iteratorError8 = undefined;
try { try {
for ( var _iterator8 = selectors[ Symbol.iterator ](), _step8; ! (_iteratorNormalCompletion8 = (_step8 = _iterator8.next()).done); _iteratorNormalCompletion8 = true ) { for (var _iterator8 = selectors[Symbol.iterator](), _step8; !(_iteratorNormalCompletion8 = (_step8 = _iterator8.next()).done); _iteratorNormalCompletion8 = true) {
var selector = _step8.value; var selector = _step8.value;
$( selector ).hide(); $(selector).hide();
} }
} catch ( err ) { } catch (err) {
_didIteratorError8 = true; _didIteratorError8 = true;
_iteratorError8 = err; _iteratorError8 = err;
} finally { } finally {
try { try {
if ( ! _iteratorNormalCompletion8 && _iterator8.return ) { if (!_iteratorNormalCompletion8 && _iterator8.return) {
_iterator8.return(); _iterator8.return();
} }
} finally { } finally {
if ( _didIteratorError8 ) { if (_didIteratorError8) {
throw _iteratorError8; throw _iteratorError8;
} }
} }
@ -585,76 +558,76 @@ 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.selected_user = null;
_self.auth_pending = false; _self.auth_pending = false;
} }
/** /**
* Called when the user attempts to authenticate (inputs password). * Called when the user attempts to authenticate (inputs password).
* We check to see if the user successfully authenticated and if so tell the LDM * 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. * Greeter to log them in with the session they selected.
*/ */
}, { }, {
key: 'authentication_complete', key: 'authentication_complete',
value: function authentication_complete() { value: function authentication_complete() {
var selected_session = $( '.selected' ).attr( 'data-session-id' ); var selected_session = $('.selected').attr('data-session-id');
_self.auth_pending = false; _self.auth_pending = false;
_self.cache_set( selected_session, 'user', lightdm.authentication_user, 'session' ); _self.cache_set(selected_session, 'user', lightdm.authentication_user, 'session');
$( '#timerArea' ).hide(); $('#timerArea').hide();
if ( lightdm.is_authenticated ) { if (lightdm.is_authenticated) {
// The user entered the correct password. Let's log them in. // 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. // The user did not enter the correct password. Show error message.
$( '#statusArea' ).show(); $('#statusArea').show();
} }
} }
}, { }, {
key: 'submit_password', key: 'submit_password',
value: function submit_password( event ) { value: function submit_password(event) {
lightdm.provide_secret( $( '#passwordField' ).val() ); lightdm.provide_secret($('#passwordField').val());
$( '#passwordArea' ).hide(); $('#passwordArea').hide();
$( '#timerArea' ).show(); $('#timerArea').show();
} }
}, { }, {
key: 'session_toggle_handler', key: 'session_toggle_handler',
value: function session_toggle_handler( event ) { value: function session_toggle_handler(event) {
var $session = $( this ).children( 'a' ), var $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');
$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 action; var 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;
@ -662,48 +635,48 @@ var AntergosTheme = (function() {
} }
/** /**
* User image on('error') handler. * User image on('error') handler.
*/ */
}, { }, {
key: 'image_not_found', key: 'image_not_found',
value: function image_not_found( source ) { value: function image_not_found(source) {
source.onerror = ""; source.onerror = "";
source.src = 'img/antergos-logo-user.png'; source.src = 'img/antergos-logo-user.png';
return true; return true;
} }
/** /**
* LightDM Callback - Show password prompt to user. * LightDM Callback - Show password prompt to user.
* *
* @param text * @param text
*/ */
}, { }, {
key: 'show_prompt', key: 'show_prompt',
value: function show_prompt( text ) { value: function show_prompt(text) {
$( '#passwordField' ).val( "" ); $('#passwordField').val("");
$( '#passwordArea' ).show(); $('#passwordArea').show();
$( '#passwordField' ).focus(); $('#passwordField').focus();
} }
/** /**
* LightDM Callback - Show message to user. * LightDM Callback - Show message to user.
* *
* @param msg * @param msg
*/ */
}, { }, {
key: 'show_message', key: 'show_message',
value: function show_message( msg ) { value: function show_message(msg) {
if ( msg.length > 0 ) { if (msg.length > 0) {
$( this.$msg_area ).html( msg ); $(this.$msg_area).html(msg);
$( '#passwordArea' ).hide(); $('#passwordArea').hide();
$( this.$msg_area_container ).show(); $(this.$msg_area_container).show();
} }
} }
} ] ); }]);
return AntergosTheme; return AntergosTheme;
})(); })();
@ -712,8 +685,8 @@ var AntergosTheme = (function() {
* Initialize the theme once the window has loaded. * Initialize the theme once the window has loaded.
*/ */
$( window ).load( function() { $(window).load(function () {
_self = new AntergosTheme(); _self = new AntergosTheme();
} ); });
//# sourceMappingURL=greeter-compiled.js.map //# sourceMappingURL=greeter-compiled.js.map

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

File diff suppressed because one or more lines are too long

1
themes/antergos/js/greeter.js

@ -26,6 +26,7 @@
* 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. * This is used to access our main class from within jQuery callbacks.
*/ */

Loading…
Cancel
Save