Browse Source

more work on refactoring

sisyphus
Dustin Falgout 9 years ago
parent
commit
957faf30fc
  1. 42
      themes/antergos/js/greeter-compiled.js
  2. 2
      themes/antergos/js/greeter-compiled.js.map
  3. 34
      themes/antergos/js/greeter.js

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

@ -42,11 +42,6 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
var _self = null;
var _bg_self = null;
/**
* This is used so we don't ask the greeter for config values more than once.
*/
var _have_config_values = false;
/**
* Capitalize a string.
*
@ -187,16 +182,17 @@ var GreeterThemeComponent = (function () {
key: 'init_config_values',
value: function init_config_values() {
var logo = '',
background_images = '',
background_images = [],
background_images_dir = '';
if ('undefined' !== typeof config) {
if (this instanceof AntergosTheme) {
logo = config.get_str('branding', 'logo_image') || '';
} else if (this instanceof AntergosBackgroundManager) {
background_images = config.get_str('branding', 'background_images_array') || '';
background_images = background_images.length ? background_images.split(',') : [];
background_images_dir = config.get_str('branding', 'background_images') || '';
if (background_images_dir) {
background_images = greeterutil.dirlist(background_images_dir) || [];
}
}
}
@ -217,7 +213,7 @@ var AntergosBackgroundManager = (function (_GreeterThemeComponen) {
_inherits(AntergosBackgroundManager, _GreeterThemeComponen);
function AntergosBackgroundManager() {
var _ret;
var _ret2;
_classCallCheck(this, AntergosBackgroundManager);
@ -230,12 +226,18 @@ var AntergosBackgroundManager = (function (_GreeterThemeComponen) {
_this.current_background = _this.cache_get('background_config', 'current_background');
if (!_this.background_images_dir.length || !_this.background_images.length) {
var _ret;
_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);
}
_this.initialize();
return _ret = _bg_self, _possibleConstructorReturn(_this, _ret);
return _ret2 = _bg_self, _possibleConstructorReturn(_this, _ret2);
}
_createClass(AntergosBackgroundManager, [{
@ -260,7 +262,10 @@ var AntergosBackgroundManager = (function (_GreeterThemeComponen) {
var current_background = this.cache_get('background_manager', 'current_background'),
random_background = this.cache_get('background_manager', 'random_background');
if ('true' === random_background) {}
if ('true' === random_background || !current_background) {
current_background = this.get_random_image();
}
this.current_background = current_background;
}
$('.header').fadeTo(300, 0.5, function () {
@ -270,13 +275,11 @@ var AntergosBackgroundManager = (function (_GreeterThemeComponen) {
}, {
key: 'get_random_image',
value: function get_random_image() {
var background = undefined,
random_bg = undefined;
var random_bg = undefined;
if (this.background_images.length) {
random_bg = Math.floor(Math.random() * this.background_images.length);
background = this.background_images[random_bg];
}
random_bg = Math.floor(Math.random() * this.background_images.length);
return this.background_images[random_bg];
}
}, {
key: 'get_old_backgrounds',
@ -302,7 +305,7 @@ var AntergosTheme = (function (_GreeterThemeComponen2) {
_inherits(AntergosTheme, _GreeterThemeComponen2);
function AntergosTheme() {
var _ret2;
var _ret3;
_classCallCheck(this, AntergosTheme);
@ -325,7 +328,7 @@ var AntergosTheme = (function (_GreeterThemeComponen2) {
_this2.initialize();
return _ret2 = _self, _possibleConstructorReturn(_this2, _ret2);
return _ret3 = _self, _possibleConstructorReturn(_this2, _ret3);
}
_createClass(AntergosTheme, [{
@ -729,6 +732,7 @@ var AntergosTheme = (function (_GreeterThemeComponen2) {
if (lightdm.is_authenticated) {
// The user entered the correct password. Let's log them in.
$('body').fadeOut();
lightdm.login(lightdm.authentication_user, selected_session);
} else {
// The user did not enter the correct password. Show error message.

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

File diff suppressed because one or more lines are too long

34
themes/antergos/js/greeter.js

@ -33,11 +33,6 @@
let _self = null;
let _bg_self = null;
/**
* This is used so we don't ask the greeter for config values more than once.
*/
let _have_config_values = false;
/**
* Capitalize a string.
@ -53,8 +48,6 @@ String.prototype.capitalize = function() {
/**
* This class handles the theme's background switcher.
*/
@ -123,16 +116,17 @@ class GreeterThemeComponent {
* Get some values from `lightdm-webkit2-greeter.conf` and save them for later.
*/
init_config_values() {
let logo = '', background_images = '', background_images_dir = '';
let logo = '', background_images = [], background_images_dir = '';
if ( 'undefined' !== typeof config ) {
if ( this instanceof AntergosTheme ) {
logo = config.get_str( 'branding', 'logo_image' ) || '';
} else if ( this instanceof AntergosBackgroundManager ) {
background_images = config.get_str( 'branding', 'background_images_array' ) || '';
background_images = ( background_images.length ) ? background_images.split( ',' ) : [];
background_images_dir = config.get_str( 'branding', 'background_images' ) || '';
if (background_images_dir) {
background_images = greeterutil.dirlist(background_images_dir) || [];
}
}
}
@ -163,6 +157,10 @@ class AntergosBackgroundManager extends GreeterThemeComponent {
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 _bg_self;
}
this.initialize();
@ -191,9 +189,10 @@ class AntergosBackgroundManager extends GreeterThemeComponent {
let current_background = this.cache_get('background_manager', 'current_background' ),
random_background = this.cache_get('background_manager', 'random_background' );
if ( 'true' === random_background ) {
if ( 'true' === random_background || ! current_background ) {
current_background = this.get_random_image();
}
this.current_background = current_background;
}
$( '.header' ).fadeTo( 300, 0.5, function() {
@ -203,13 +202,11 @@ class AntergosBackgroundManager extends GreeterThemeComponent {
get_random_image() {
let background, random_bg;
let random_bg;
if ( this.background_images.length ) {
random_bg = Math.floor( Math.random() * this.background_images.length );
background = this.background_images[ random_bg ];
}
random_bg = Math.floor( Math.random() * this.background_images.length );
return this.background_images[ random_bg ];
}
@ -231,8 +228,6 @@ class AntergosBackgroundManager extends GreeterThemeComponent {
/**
* This is the theme's main class object. It contains almost all the theme's logic.
*/
@ -547,6 +542,7 @@ class AntergosTheme extends GreeterThemeComponent {
if ( lightdm.is_authenticated ) {
// The user entered the correct password. Let's log them in.
$('body').fadeOut();
lightdm.login( lightdm.authentication_user, selected_session );
} else {
// The user did not enter the correct password. Show error message.

Loading…
Cancel
Save