@ -47,10 +47,10 @@ String.prototype.capitalize = function() {
/ * *
* This is the base class for the theme ' s components .
* This should be the base class for all the theme 's components. However, webkit' s
* support of extending ( subclassing ) ES6 classes is not stable enough to use .
* For now we simply bind this class to a global variable for use in our other classes .
* /
class AntergosThemeUtils {
@ -60,9 +60,10 @@ class AntergosThemeUtils {
}
_util = this ;
this . debug = tru e;
this . debug = fals e;
this . lang = window . navigator . language . split ( '-' ) [ 0 ] . toLowerCase ( ) ;
this . translations = window . ant _translations ;
this . $log _container = $ ( '#logArea' ) ;
if ( 'undefined' === typeof window . navigator . languages ) {
window . navigator . languages = [ window . navigator . language ] ;
@ -136,6 +137,8 @@ class AntergosThemeUtils {
logo = config . get _str ( 'branding' , 'logo' ) || '' ;
user _image = config . get _str ( 'branding' , 'user_image' ) || '' ;
this . debug = config . get _str ( 'greeter' , 'debug_mode' ) ;
this . debug = ( null !== this . debug ) ? this . debug : false ;
background _images _dir = config . get _str ( 'branding' , 'background_images' ) || '' ;
@ -194,6 +197,9 @@ class AntergosBackgroundManager {
}
/ * *
* Determine which background image should be displayed and apply it .
* /
initialize ( ) {
if ( ! this . current _background ) {
// For backwards compatibility
@ -229,6 +235,9 @@ class AntergosBackgroundManager {
}
/ * *
* Set the background image to the value of ` this.current_background `
* /
do _background ( ) {
$ ( '.header' ) . fadeTo ( 300 , 0.5 , function ( ) {
var tpl = ` url( ${ _bg _self . current _background } ) ` ;
@ -237,6 +246,11 @@ class AntergosBackgroundManager {
}
/ * *
* Get a random background image from our images array .
*
* @ returns str The absolute path to a background image .
* /
get _random _image ( ) {
var random _bg ;
@ -245,6 +259,10 @@ class AntergosBackgroundManager {
return _util . background _images [ random _bg ] ;
}
/ * *
* Setup the background switcher widget .
* /
setup _background _thumbnails ( ) {
if ( _util . background _images . length ) {
$ ( '[data-img="random"]' ) . click ( this . background _selected _handler ) ;
@ -263,6 +281,11 @@ class AntergosBackgroundManager {
}
/ * *
* Handle background image selected event .
*
* @ param event jQuery event object .
* /
background _selected _handler ( event ) {
var img = $ ( this ) . attr ( 'data-img' ) ;
@ -284,7 +307,7 @@ class AntergosBackgroundManager {
/ * *
* 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 most of the theme' s logic .
* /
class AntergosTheme {
@ -314,6 +337,10 @@ class AntergosTheme {
return _self ;
}
/ * *
* Initialize the theme .
* /
initialize ( ) {
this . prepare _translations ( ) ;
this . do _static _translations ( ) ;
@ -328,8 +355,8 @@ class AntergosTheme {
/ * *
* Register callbacks for the LDM Greeter 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 ( ) {
var events = 'shown.bs.collapse, hidden.bs.collapse' ;
@ -338,6 +365,7 @@ class AntergosTheme {
$ ( document ) . keydown ( this . key _press _handler ) ;
$ ( '.cancel_auth' ) . click ( this . cancel _authentication ) ;
$ ( '.submit_passwd' ) . click ( this . submit _password ) ;
$ ( '[data-i18n="debug_log"]' ) . click ( this . show _log _handler ) ;
window . show _prompt = this . show _prompt ;
window . show _message = this . show _message ;
@ -442,6 +470,11 @@ class AntergosTheme {
$ ( '.modal' ) . modal ( { show : false } ) ;
}
/ * *
* Setup the clock widget .
* /
initialize _clock ( ) {
var saved _format = _util . cache _get ( 'clock' , 'time_format' ) ,
format = ( null !== saved _format ) ? saved _format : 'LT' ;
@ -584,7 +617,7 @@ class AntergosTheme {
/ * *
* Called when the user attempts to authenticate ( inpu ts password ) .
* Called when the user attempts to authenticate ( subm its 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 .
* /
@ -608,12 +641,14 @@ class AntergosTheme {
}
}
submit _password ( event ) {
lightdm . respond ( $ ( '#passwordField' ) . val ( ) ) ;
$ ( '#passwordArea' ) . hide ( ) ;
$ ( '#timerArea' ) . show ( ) ;
}
session _toggle _handler ( event ) {
var $session = $ ( this ) . children ( 'a' ) ,
session _name = $session . text ( ) ,
@ -622,6 +657,7 @@ class AntergosTheme {
$session . parents ( '.btn-group' ) . find ( '.selected' ) . attr ( 'data-session-id' , session _key ) . html ( session _name ) ;
}
key _press _handler ( event ) {
var action ;
switch ( event . which ) {
@ -642,6 +678,7 @@ class AntergosTheme {
}
}
system _action _handler ( ) {
var action = $ ( this ) . attr ( 'id' ) ,
$modal = $ ( '.modal' ) ;
@ -669,8 +706,17 @@ class AntergosTheme {
}
show _log _handler ( event ) {
if ( _util . $log _container . is ( ':visible' ) ) {
_util . $log _container . hide ( ) ;
} else {
_util . $log _container . show ( ) ;
}
}
/ * *
* LightDM Callback - Show password prompt to user .
* LightDM Callback - Show prompt to user .
*
* @ param text
* @ param type