@ -1,13 +1,3 @@
'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 ; } ; } ) ( ) ;
function _possibleConstructorReturn ( self , call ) { if ( ! self ) { throw new ReferenceError ( "this hasn't been initialised - super() hasn't been called" ) ; } return call && ( typeof call === "object" || typeof call === "function" ) ? call : self ; }
function _inherits ( subClass , superClass ) { if ( typeof superClass !== "function" && superClass !== null ) { throw new TypeError ( "Super expression must either be null or a function, not " + typeof superClass ) ; } subClass . prototype = Object . create ( superClass && superClass . prototype , { constructor : { value : subClass , enumerable : false , writable : true , configurable : true } } ) ; if ( superClass ) Object . setPrototypeOf ? Object . setPrototypeOf ( subClass , superClass ) : subClass . _ _proto _ _ = superClass ; }
function _classCallCheck ( instance , Constructor ) { if ( ! ( instance instanceof Constructor ) ) { throw new TypeError ( "Cannot call a class as a function" ) ; } }
/ *
*
* Copyright © 2015 - 2016 Antergos
@ -39,8 +29,8 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
/ * *
* This is used to access our classes from within jQuery callbacks .
* /
var _self = null ;
var _bg _self = null ;
let _self = null ;
let _bg _self = null ;
/ * *
* Capitalize a string .
@ -54,11 +44,9 @@ String.prototype.capitalize = function () {
/ * *
* This is the base class for the theme ' s components .
* /
class GreeterThemeComponent {
var GreeterThemeComponent = ( function ( ) {
function GreeterThemeComponent ( ) {
_classCallCheck ( this , GreeterThemeComponent ) ;
constructor ( ) {
this . debug = this . cache _get ( 'debug' , 'enabled' ) ;
this . lang = window . navigator . language . split ( '-' ) [ 0 ] . toLowerCase ( ) ;
this . translations = window . ant _translations ;
@ -75,14 +63,11 @@ var GreeterThemeComponent = (function () {
*
* @ param { string } text - To be added to the log .
* /
_createClass ( GreeterThemeComponent , [ {
key : 'log' ,
value : function log ( text ) {
log ( text ) {
if ( 'true' === this . debug ) {
console . log ( text ) ;
}
$ ( '#logArea' ) . append ( text + '<br/>' ) ;
$ ( '#logArea' ) . append ( ` ${ text } <br/> ` ) ;
}
/ * *
@ -91,41 +76,12 @@ var GreeterThemeComponent = (function () {
*
* @ param { ... string } key _parts - Strings that are combined to form the key .
* /
cache _get ( ... key _parts ) {
var key = ` ant ` ;
} , {
key : 'cache_get' ,
value : function cache _get ( ) {
var key = 'ant' ;
for ( var _len = arguments . length , key _parts = Array ( _len ) , _key = 0 ; _key < _len ; _key ++ ) {
key _parts [ _key ] = arguments [ _key ] ;
}
var _iteratorNormalCompletion = true ;
var _didIteratorError = false ;
var _iteratorError = undefined ;
try {
for ( var _iterator = key _parts [ Symbol . iterator ] ( ) , _step ; ! ( _iteratorNormalCompletion = ( _step = _iterator . next ( ) ) . done ) ; _iteratorNormalCompletion = true ) {
var part = _step . value ;
key += ':' + part ;
}
} catch ( err ) {
_didIteratorError = true ;
_iteratorError = err ;
} finally {
try {
if ( ! _iteratorNormalCompletion && _iterator . return ) {
_iterator . return ( ) ;
}
} finally {
if ( _didIteratorError ) {
throw _iteratorError ;
for ( var part of key _parts ) {
key += ` : ${ part } ` ;
}
}
}
return localStorage . getItem ( key ) ;
}
@ -136,52 +92,20 @@ var GreeterThemeComponent = (function () {
* @ param { string } value - The value to set .
* @ param { ... string } key _parts - Strings that are combined to form the key .
* /
cache _set ( value , ... key _parts ) {
var key = ` ant ` ;
} , {
key : 'cache_set' ,
value : function cache _set ( value ) {
var key = 'ant' ;
for ( var _len2 = arguments . length , key _parts = Array ( _len2 > 1 ? _len2 - 1 : 0 ) , _key2 = 1 ; _key2 < _len2 ; _key2 ++ ) {
key _parts [ _key2 - 1 ] = arguments [ _key2 ] ;
for ( var part of key _parts ) {
key += ` : ${ part } ` ;
}
var _iteratorNormalCompletion2 = true ;
var _didIteratorError2 = false ;
var _iteratorError2 = undefined ;
try {
for ( var _iterator2 = key _parts [ Symbol . iterator ] ( ) , _step2 ; ! ( _iteratorNormalCompletion2 = ( _step2 = _iterator2 . next ( ) ) . done ) ; _iteratorNormalCompletion2 = true ) {
var part = _step2 . value ;
key += ':' + part ;
}
} catch ( err ) {
_didIteratorError2 = true ;
_iteratorError2 = err ;
} finally {
try {
if ( ! _iteratorNormalCompletion2 && _iterator2 . return ) {
_iterator2 . return ( ) ;
}
} finally {
if ( _didIteratorError2 ) {
throw _iteratorError2 ;
}
}
}
return localStorage . setItem ( key , value ) ;
}
/ * *
* Get some values from ` lightdm-webkit2-greeter.conf ` and save them for later .
* /
} , {
key : 'init_config_values' ,
value : function init _config _values ( ) {
var logo = '' ,
init _config _values ( ) {
let logo = '' ,
user _image = '' ,
background _images = [ ] ,
background _images _dir = '' ;
@ -197,34 +121,12 @@ var GreeterThemeComponent = (function () {
}
if ( background _images . length ) {
var images = [ ] ;
var _iteratorNormalCompletion3 = true ;
var _didIteratorError3 = false ;
var _iteratorError3 = undefined ;
try {
for ( var _iterator3 = background _images [ Symbol . iterator ] ( ) , _step3 ; ! ( _iteratorNormalCompletion3 = ( _step3 = _iterator3 . next ( ) ) . done ) ; _iteratorNormalCompletion3 = true ) {
var file = _step3 . value ;
let images = [ ] ;
for ( var file of background _images ) {
if ( file . match ( /(png|PNG)|(jpg|JPEG)|(bmp|BMP)/ ) ) {
images . push ( file ) ;
}
}
} catch ( err ) {
_didIteratorError3 = true ;
_iteratorError3 = err ;
} finally {
try {
if ( ! _iteratorNormalCompletion3 && _iterator3 . return ) {
_iterator3 . return ( ) ;
}
} finally {
if ( _didIteratorError3 ) {
throw _iteratorError3 ;
}
}
}
background _images = images ;
}
}
@ -235,44 +137,33 @@ var GreeterThemeComponent = (function () {
this . background _images = background _images ;
this . background _images _dir = background _images _dir ;
}
} ] ) ;
return GreeterThemeComponent ;
} ) ( ) ;
}
/ * *
* This class handles the theme ' s background switcher .
* /
class AntergosBackgroundManager extends GreeterThemeComponent {
var AntergosBackgroundManager = ( function ( _GreeterThemeComponen ) {
_inherits ( AntergosBackgroundManager , _GreeterThemeComponen ) ;
function AntergosBackgroundManager ( ) {
var _ret ;
_classCallCheck ( this , AntergosBackgroundManager ) ;
var _this = _possibleConstructorReturn ( this , Object . getPrototypeOf ( AntergosBackgroundManager ) . call ( this ) ) ;
constructor ( ) {
super ( ) ;
if ( null === _bg _self ) {
_bg _self = _ this;
_bg _self = this ;
}
_ this. current _background = _ this. cache _get ( 'background_manager' , 'current_background' ) ;
this . current _background = this . cache _get ( 'background_manager' , 'current_background' ) ;
if ( ! _ this. background _images _dir . length || ! _ this. background _images . length ) {
_ this. log ( 'AntergosBackgroundManager: [ERROR] No background images detected.' ) ;
if ( ! this . background _images _dir . length || ! this . background _images . length ) {
this . log ( 'AntergosBackgroundManager: [ERROR] No background images detected.' ) ;
$ ( '.header' ) . fadeTo ( 300 , 0.5 , function ( ) {
$ ( '.header' ) . css ( "background" , '#000000' ) ;
} ) . fadeTo ( 300 , 1 ) ;
}
return _ret = _ bg _self , _possibleConstructorReturn ( _this , _ret ) ;
return _bg _self ;
}
_createClass ( AntergosBackgroundManager , [ {
key : 'initialize' ,
value : function initialize ( ) {
initialize ( ) {
if ( ! this . current _background ) {
// For backwards compatibility
if ( null !== localStorage . getItem ( 'bgsaved' ) && '0' === localStorage . getItem ( 'bgrandom' ) ) {
@ -289,7 +180,7 @@ var AntergosBackgroundManager = (function (_GreeterThemeComponen) {
if ( ! this . current _background ) {
// For current and future versions
var current _background = this . cache _get ( 'background_manager' , 'current_background' ) ,
let current _background = this . cache _get ( 'background_manager' , 'current_background' ) ,
random _background = this . cache _get ( 'background_manager' , 'random_background' ) ;
if ( 'true' === random _background || ! current _background ) {
@ -301,64 +192,39 @@ var AntergosBackgroundManager = (function (_GreeterThemeComponen) {
this . do _background ( ) ;
}
} , {
key : 'do_background' ,
value : function do _background ( ) {
do _background ( ) {
$ ( '.header' ) . fadeTo ( 300 , 0.5 , function ( ) {
var tpl = 'url(\'file://' + this . current _background + '\')' ;
let tpl = ` url('file:// ${ this . current _background } ') ` ;
$ ( '.header' ) . css ( "background-image" , tpl ) ;
} ) . fadeTo ( 300 , 1 ) ;
}
} , {
key : 'get_random_image' ,
value : function get _random _image ( ) {
var random _bg = undefined ;
get _random _image ( ) {
let random _bg ;
random _bg = Math . floor ( Math . random ( ) * this . background _images . length ) ;
return this . background _images [ random _bg ] ;
}
} , {
key : 'setup_background_thumbnails' ,
value : function setup _background _thumbnails ( ) {
if ( this . background _images . length ) {
var _iteratorNormalCompletion4 = true ;
var _didIteratorError4 = false ;
var _iteratorError4 = undefined ;
try {
for ( var _iterator4 = this . background _images [ Symbol . iterator ] ( ) , _step4 ; ! ( _iteratorNormalCompletion4 = ( _step4 = _iterator4 . next ( ) ) . done ) ; _iteratorNormalCompletion4 = true ) {
var image _file = _step4 . value ;
var $link = $ ( '<a href="#"><img>' ) ,
setup _background _thumbnails ( ) {
if ( this . background _images . length ) {
for ( var image _file of this . background _images ) {
let $link = $ ( '<a href="#"><img>' ) ,
$img _el = $link . children ( 'img' ) ,
tpl = 'file://' + image _file ;
tpl = ` file:// ${ image _file } ` ;
$link . addClass ( 'bg clearfix' ) . attr ( 'data-img' , tpl ) ;
$img _el . attr ( 'src' , tpl ) ;
$link . appendTo ( $ ( '.bgs' ) ) . click ( this . background _selected _handler ) ;
}
} catch ( err ) {
_didIteratorError4 = true ;
_iteratorError4 = err ;
} finally {
try {
if ( ! _iteratorNormalCompletion4 && _iterator4 . return ) {
_iterator4 . return ( ) ;
}
} finally {
if ( _didIteratorError4 ) {
throw _iteratorError4 ;
}
}
}
}
}
} , {
key : 'background_selected_handler' ,
value : function background _selected _handler ( event ) {
var img = $ ( this ) . attr ( 'data-img' ) ;
background _selected _handler ( event ) {
let img = $ ( this ) . attr ( 'data-img' ) ;
if ( 'random' === img ) {
this . cache _set ( 'true' , 'background_manager' , 'randmom_background' ) ;
@ -370,50 +236,38 @@ var AntergosBackgroundManager = (function (_GreeterThemeComponen) {
this . do _background ( ) ;
}
} ] ) ;
return AntergosBackgroundManager ;
} ) ( GreeterThemeComponent ) ;
}
/ * *
* This is the theme 's main class object. It contains almost all the theme' s logic .
* /
class AntergosTheme extends GreeterThemeComponent {
var AntergosTheme = ( function ( _GreeterThemeComponen2 ) {
_inherits ( AntergosTheme , _GreeterThemeComponen2 ) ;
function AntergosTheme ( ) {
var _ret2 ;
constructor ( ) {
super ( ) ;
if ( null === _self ) {
_self = this ;
}
this . tux = 'img/antergos-logo-user.png' ;
this . user _list _visible = false ;
this . auth _pending = false ;
this . selected _user = null ;
this . $user _list = $ ( '#user-list2' ) ;
this . $session _list = $ ( '#sessions' ) ;
this . $clock _container = $ ( '#collapseOne' ) ;
this . $clock = $ ( "#current_time" ) ;
this . $actions _container = $ ( "#actionsArea" ) ;
this . $msg _area _container = $ ( '#statusArea' ) ;
this . $msg _area = $ ( '#showMsg' ) ;
this . background _manager = new AntergosBackgroundManager ( ) ;
_classCallCheck ( this , AntergosTheme ) ;
this . background _manager . initialize ( ) ;
this . initialize ( ) ;
var _this2 = _possibleConstructorReturn ( this , Object . getPrototypeOf ( AntergosTheme ) . call ( this ) ) ;
return _self ;
}
if ( null === _self ) {
_self = _this2 ;
}
_this2 . tux = 'img/antergos-logo-user.png' ;
_this2 . user _list _visible = false ;
_this2 . auth _pending = false ;
_this2 . selected _user = null ;
_this2 . $user _list = $ ( '#user-list2' ) ;
_this2 . $session _list = $ ( '#sessions' ) ;
_this2 . $clock _container = $ ( '#collapseOne' ) ;
_this2 . $clock = $ ( "#current_time" ) ;
_this2 . $actions _container = $ ( "#actionsArea" ) ;
_this2 . $msg _area _container = $ ( '#statusArea' ) ;
_this2 . $msg _area = $ ( '#showMsg' ) ;
_this2 . background _manager = new AntergosBackgroundManager ( ) ;
_this2 . background _manager . initialize ( ) ;
_this2 . initialize ( ) ;
return _ret2 = _self , _possibleConstructorReturn ( _this2 , _ret2 ) ;
}
_createClass ( AntergosTheme , [ {
key : 'initialize' ,
value : function initialize ( ) {
initialize ( ) {
this . prepare _translations ( ) ;
this . do _static _translations ( ) ;
this . initialize _clock ( ) ;
@ -430,10 +284,7 @@ var AntergosTheme = (function (_GreeterThemeComponen2) {
* Register callbacks for the LDM Greeter as well as any others that haven ' t been registered
* elsewhere .
* /
} , {
key : 'register_callbacks' ,
value : function register _callbacks ( ) {
register _callbacks ( ) {
var events = 'shown.bs.collapse, hidden.bs.collapse' ;
this . $user _list . parents ( '.collapse' ) . on ( events , this . user _list _collapse _handler ) ;
@ -452,21 +303,11 @@ var AntergosTheme = (function (_GreeterThemeComponen2) {
/ * *
* Initialize the user list .
* /
} , {
key : 'prepare_user_list' ,
value : function prepare _user _list ( ) {
prepare _user _list ( ) {
var template ;
// Loop through the array of LightDMUser objects to create our user list.
var _iteratorNormalCompletion5 = true ;
var _didIteratorError5 = false ;
var _iteratorError5 = undefined ;
try {
for ( var _iterator5 = lightdm . users [ Symbol . iterator ] ( ) , _step5 ; ! ( _iteratorNormalCompletion5 = ( _step5 = _iterator5 . next ( ) ) . done ) ; _iteratorNormalCompletion5 = true ) {
var user = _step5 . value ;
for ( var user of lightdm . users ) {
var last _session = this . cache _get ( 'user' , user . name , 'session' ) ,
image _src = user . image . length ? user . image : this . user _image ;
@ -481,27 +322,18 @@ var AntergosTheme = (function (_GreeterThemeComponen2) {
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 = `
< a href = "#" id = "${ user.name }" class = "list-group-item ${ user.name }" data - session = "${ last_session }" >
< img src = "${ image_src }" class = "img-circle" alt = "${ user.display_name }" / >
< span > $ { user . display _name } < / s p a n >
< span class = "badge" > < i class = "fa fa-check" > < / i > < / s p a n >
< / a > ` ;
// Register event handler here so we don't have to iterate over the users again later.
$ ( template ) . appendTo ( this . $user _list ) . click ( this . start _authentication ) . on ( 'error.antergos' , this . user _image _error _handler ) ;
} // END for ( var user of lightdm.users )
} catch ( err ) {
_didIteratorError5 = true ;
_iteratorError5 = err ;
} finally {
try {
if ( ! _iteratorNormalCompletion5 && _iterator5 . return ) {
_iterator5 . return ( ) ;
}
} finally {
if ( _didIteratorError5 ) {
throw _iteratorError5 ;
}
}
}
if ( $ ( this . $user _list ) . children ( ) . length > 3 ) {
// Make the user list two columns instead of one.
@ -512,42 +344,21 @@ var AntergosTheme = (function (_GreeterThemeComponen2) {
/ * *
* Initialize the session selection dropdown .
* /
} , {
key : 'prepare_session_list' ,
value : function prepare _session _list ( ) {
prepare _session _list ( ) {
// Loop through the array of LightDMSession objects to create our session list.
var _iteratorNormalCompletion6 = true ;
var _didIteratorError6 = false ;
var _iteratorError6 = undefined ;
try {
for ( var _iterator6 = lightdm . sessions [ Symbol . iterator ] ( ) , _step6 ; ! ( _iteratorNormalCompletion6 = ( _step6 = _iterator6 . next ( ) ) . done ) ; _iteratorNormalCompletion6 = true ) {
var session = _step6 . value ;
for ( var session of lightdm . sessions ) {
var css _class = session . name . replace ( / /g , '' ) ,
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 = `
< li >
< a href = "#" data - session - id = "${ session.key }" class = "${ css_class }" > $ { session . name } < / a >
< / l i > ` ;
$ ( template ) . appendTo ( this . $session _list ) . click ( this . session _toggle _handler ) ;
} // END for (var session of lightdm.sessions)
} catch ( err ) {
_didIteratorError6 = true ;
_iteratorError6 = err ;
} finally {
try {
if ( ! _iteratorNormalCompletion6 && _iterator6 . return ) {
_iterator6 . return ( ) ;
}
} finally {
if ( _didIteratorError6 ) {
throw _iteratorError6 ;
}
}
}
$ ( '.dropdown-toggle' ) . dropdown ( ) ;
}
@ -555,10 +366,7 @@ var AntergosTheme = (function (_GreeterThemeComponen2) {
/ * *
* Initialize the system action buttons
* /
} , {
key : 'prepare_system_action_buttons' ,
value : function prepare _system _action _buttons ( ) {
prepare _system _action _buttons ( ) {
var actions = {
shutdown : "power-off" ,
hibernate : "asterisk" ,
@ -567,53 +375,32 @@ var AntergosTheme = (function (_GreeterThemeComponen2) {
} ,
template ;
var _iteratorNormalCompletion7 = true ;
var _didIteratorError7 = false ;
var _iteratorError7 = undefined ;
for ( var action of Object . keys ( actions ) ) {
var cmd = ` can_ ${ action } ` ;
try {
for ( var _iterator7 = Object . keys ( actions ) [ Symbol . iterator ] ( ) , _step7 ; ! ( _iteratorNormalCompletion7 = ( _step7 = _iterator7 . next ( ) ) . done ) ; _iteratorNormalCompletion7 = true ) {
var action = _step7 . value ;
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 = `
< a href = "#" id = "${ action }" class = "btn btn-default ${ action }" data - toggle = "tooltip" data - placement = "top" title = "${ action.capitalize() }" data - container = "body" >
< i class = "fa fa-${ actions[action] }" > < / i >
< / a > ` ;
if ( lightdm [ cmd ] ) {
$ ( template ) . appendTo ( $ ( this . $actions _container ) ) . click ( this . system _action _handler ) ;
}
} // END for (var [action, icon] of actions)
} catch ( err ) {
_didIteratorError7 = true ;
_iteratorError7 = err ;
} finally {
try {
if ( ! _iteratorNormalCompletion7 && _iterator7 . return ) {
_iterator7 . return ( ) ;
}
} finally {
if ( _didIteratorError7 ) {
throw _iteratorError7 ;
}
}
}
$ ( '[data-toggle=tooltip]' ) . tooltip ( ) ;
$ ( '.modal' ) . modal ( { show : false } ) ;
}
} , {
key : 'initialize_clock' ,
value : function initialize _clock ( ) {
var _this3 = this ;
initialize _clock ( ) {
var saved _format = this . cache _get ( 'clock' , 'time_format' ) ,
format = null !== saved _format ? saved _format : 'LT' ;
moment . locale ( window . navigator . languages ) ;
this . $clock . html ( moment ( ) . format ( format ) ) ;
setInterval ( function ( ) {
_this3 . $clock . html ( moment ( ) . format ( format ) ) ;
setInterval ( ( ) => {
this . $clock . html ( moment ( ) . format ( format ) ) ;
} , 60000 ) ;
}
@ -621,10 +408,7 @@ var AntergosTheme = (function (_GreeterThemeComponen2) {
* 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' ,
value : function show _user _list ( ) {
show _user _list ( ) {
if ( $ ( this . $clock _container ) . hasClass ( 'in' ) ) {
$ ( '#trigger' ) . trigger ( 'click' ) ;
}
@ -632,9 +416,8 @@ var AntergosTheme = (function (_GreeterThemeComponen2) {
$ ( this . $user _list ) . find ( 'a' ) . trigger ( 'click' , this ) ;
}
}
} , {
key : 'prepare_login_panel_header' ,
value : function prepare _login _panel _header ( ) {
prepare _login _panel _header ( ) {
var greeting = this . translations . greeting ? this . translations . greeting : 'Welcome!' ,
logo = '' !== this . logo ? this . logo : 'img/antergos.png' ;
@ -642,37 +425,15 @@ var AntergosTheme = (function (_GreeterThemeComponen2) {
$ ( '#hostname' ) . append ( lightdm . hostname ) ;
$ ( '[data-greeter-config="logo"]' ) . attr ( 'src' , logo ) ;
}
} , {
key : 'prepare_translations' ,
value : function prepare _translations ( ) {
if ( ! this . translations . hasOwnProperty ( this . lang ) ) {
var _iteratorNormalCompletion8 = true ;
var _didIteratorError8 = false ;
var _iteratorError8 = undefined ;
try {
for ( var _iterator8 = window . navigator . languages [ Symbol . iterator ] ( ) , _step8 ; ! ( _iteratorNormalCompletion8 = ( _step8 = _iterator8 . next ( ) ) . done ) ; _iteratorNormalCompletion8 = true ) {
var lang = _step8 . value ;
prepare _translations ( ) {
if ( ! this . translations . hasOwnProperty ( this . lang ) ) {
for ( var lang of window . navigator . languages ) {
if ( this . translations . hasOwnProperty ( lang ) ) {
this . lang = lang ;
break ;
}
}
} catch ( err ) {
_didIteratorError8 = true ;
_iteratorError8 = err ;
} finally {
try {
if ( ! _iteratorNormalCompletion8 && _iterator8 . return ) {
_iterator8 . return ( ) ;
}
} finally {
if ( _didIteratorError8 ) {
throw _iteratorError8 ;
}
}
}
}
if ( ! this . translations . hasOwnProperty ( this . lang ) ) {
this . lang = 'en' ;
@ -686,10 +447,7 @@ var AntergosTheme = (function (_GreeterThemeComponen2) {
* have the data - i18n attribute . This is for elements that are not generated
* dynamically ( they can be found in index . html ) .
* /
} , {
key : 'do_static_translations' ,
value : function do _static _translations ( ) {
do _static _translations ( ) {
$ ( '[data-i18n]' ) . each ( function ( ) {
var key = $ ( this ) . attr ( 'data-i18n' ) ,
html = $ ( this ) . html ( ) ,
@ -705,21 +463,18 @@ var AntergosTheme = (function (_GreeterThemeComponen2) {
*
* @ param { object } event - jQuery . Event object from 'click' event .
* /
} , {
key : 'start_authentication' ,
value : function start _authentication ( event ) {
start _authentication ( event ) {
var user _id = $ ( this ) . attr ( 'id' ) ,
selector = '.' + user _id ,
selector = ` . ${ user _id } ` ,
user _session = _self . cache _get ( 'user' , user _id , 'session' ) ;
if ( _self . auth _pending || null !== _self . selected _user ) {
lightdm . cancel _authentication ( ) ;
_self . log ( 'Authentication cancelled for ' + _self . selected _user ) ;
_self . log ( ` Authentication cancelled for ${ _self . selected _user } ` ) ;
_self . selected _user = null ;
}
_self . log ( 'Starting authentication for ' + user _id + '.' ) ;
_self . log ( ` Starting authentication for ${ user _id } . ` ) ;
_self . selected _user = user _id ;
// CSS hack to workaround webkit bug
@ -729,9 +484,9 @@ var AntergosTheme = (function (_GreeterThemeComponen2) {
$ ( selector ) . addClass ( 'hovered' ) . siblings ( ) . 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 ( ) ;
$ ( '#passwordArea' ) . show ( ) ;
@ -747,36 +502,12 @@ var AntergosTheme = (function (_GreeterThemeComponen2) {
*
* @ param { object } event - jQuery . Event object from 'click' event .
* /
} , {
key : 'cancel_authentication' ,
value : function cancel _authentication ( event ) {
cancel _authentication ( event ) {
var selectors = [ '#statusArea' , '#timerArea' , '#passwordArea' , '#session-list' ] ;
var _iteratorNormalCompletion9 = true ;
var _didIteratorError9 = false ;
var _iteratorError9 = undefined ;
try {
for ( var _iterator9 = selectors [ Symbol . iterator ] ( ) , _step9 ; ! ( _iteratorNormalCompletion9 = ( _step9 = _iterator9 . next ( ) ) . done ) ; _iteratorNormalCompletion9 = true ) {
var selector = _step9 . value ;
for ( var selector of selectors ) {
$ ( selector ) . hide ( ) ;
}
} catch ( err ) {
_didIteratorError9 = true ;
_iteratorError9 = err ;
} finally {
try {
if ( ! _iteratorNormalCompletion9 && _iterator9 . return ) {
_iterator9 . return ( ) ;
}
} finally {
if ( _didIteratorError9 ) {
throw _iteratorError9 ;
}
}
}
lightdm . cancel _authentication ( ) ;
@ -799,10 +530,7 @@ var AntergosTheme = (function (_GreeterThemeComponen2) {
* 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' ,
value : function authentication _complete ( ) {
authentication _complete ( ) {
var selected _session = $ ( '.selected' ) . attr ( 'data-session-id' ) ,
err _msg = _self . translations . auth _failed [ _self . lang ] ;
@ -820,25 +548,22 @@ var AntergosTheme = (function (_GreeterThemeComponen2) {
$ ( '#statusArea' ) . show ( ) ;
}
}
} , {
key : 'submit_password' ,
value : function submit _password ( event ) {
submit _password ( event ) {
lightdm . respond ( $ ( '#passwordField' ) . val ( ) ) ;
$ ( '#passwordArea' ) . hide ( ) ;
$ ( '#timerArea' ) . show ( ) ;
}
} , {
key : 'session_toggle_handler' ,
value : function session _toggle _handler ( event ) {
session _toggle _handler ( event ) {
var $session = $ ( this ) . children ( 'a' ) ,
session _name = $session . text ( ) ,
session _key = $session . attr ( 'data-session-id' ) ;
$session . parents ( '.btn-group' ) . find ( '.selected' ) . attr ( 'data-session-id' , session _key ) . html ( session _name ) ;
}
} , {
key : 'key_press_handler' ,
value : function key _press _handler ( event ) {
key _press _handler ( event ) {
var action ;
switch ( event . which ) {
case 13 :
@ -857,32 +582,27 @@ var AntergosTheme = (function (_GreeterThemeComponen2) {
break ;
}
}
} , {
key : 'system_action_handler' ,
value : function system _action _handler ( ) {
var _this4 = this ;
system _action _handler ( ) {
var action = $ ( this ) . attr ( 'id' ) ,
$modal = $ ( '.modal' ) ;
$modal . find ( '.btn-primary' ) . text ( _self . translations [ action ] ) . click ( action , function ( event ) {
$ ( _this4 ) . off ( 'click' ) ;
$modal . find ( '.btn-primary' ) . text ( _self . translations [ action ] ) . click ( action , event => {
$ ( this ) . off ( 'click' ) ;
lightdm [ event . data ] ( ) ;
} ) ;
$modal . find ( '.btn-default' ) . click ( function ( ) {
$ ( _this4 ) . next ( ) . off ( 'click' ) ;
$modal . find ( '.btn-default' ) . click ( ( ) => {
$ ( this ) . next ( ) . off ( 'click' ) ;
} ) ;
$modal . modal ( 'toggle' ) ;
}
} , {
key : 'user_list_collapse_handler' ,
value : function user _list _collapse _handler ( ) {
user _list _collapse _handler ( ) {
_self . user _list _visible = _self . $user _list . hasClass ( 'in' ) ? true : false ;
}
} , {
key : 'user_image_error_handler' ,
value : function user _image _error _handler ( event ) {
user _image _error _handler ( event ) {
$ ( this ) . off ( 'error.antergos' ) ;
$ ( this ) . attr ( 'src' , _self . tux ) ;
}
@ -893,10 +613,7 @@ var AntergosTheme = (function (_GreeterThemeComponen2) {
* @ param text
* @ param type
* /
} , {
key : 'show_prompt' ,
value : function show _prompt ( text , type ) {
show _prompt ( text , type ) {
if ( 'password' === type ) {
$ ( '#passwordField' ) . val ( "" ) ;
$ ( '#passwordArea' ) . show ( ) ;
@ -909,26 +626,19 @@ var AntergosTheme = (function (_GreeterThemeComponen2) {
*
* @ param text
* /
} , {
key : 'show_message' ,
value : function show _message ( text , type ) {
show _message ( text , type ) {
if ( text . length > 0 ) {
$ ( this . $msg _area ) . html ( text ) ;
$ ( '#passwordArea' ) . hide ( ) ;
$ ( this . $msg _area _container ) . show ( ) ;
}
}
} ] ) ;
return AntergosTheme ;
} ) ( GreeterThemeComponent ) ;
}
/ * *
* Initialize the theme once the window has loaded .
* /
$ ( window ) . load ( function ( ) {
$ ( window ) . load ( ( ) => {
_self = new AntergosTheme ( ) ;
} ) ;