Browse Source

handle recursion as needed when finding background images. Some style tweaks and improvements.

sisyphus
Dustin Falgout 9 years ago
parent
commit
761c1dec75
  1. 23
      themes/antergos/css/style.css
  2. 45
      themes/antergos/js/greeter.js
  3. 4
      themes/antergos/js/mock.js

23
themes/antergos/css/style.css

@ -46,7 +46,7 @@
} }
::-webkit-scrollbar { ::-webkit-scrollbar {
width: 12px; width: 6px;
} }
::-webkit-scrollbar-track { ::-webkit-scrollbar-track {
@ -59,7 +59,7 @@
} }
::-webkit-scrollbar-thumb:hover { ::-webkit-scrollbar-thumb:hover {
background-color: #B3B3B3; background-color: #757575;
} }
.user-wrap2::-webkit-scrollbar { .user-wrap2::-webkit-scrollbar {
@ -120,6 +120,10 @@ a {
color: #F5F5F5; color: #F5F5F5;
} }
.bg-switch h3 {
color: #f5f5f5;
}
.bg-switch .bgs .bg { .bg-switch .bgs .bg {
text-align: center; text-align: center;
text-decoration: none; text-decoration: none;
@ -165,15 +169,14 @@ a {
} }
#bg-switch-wrapper { #bg-switch-wrapper {
margin-right: -250px; right: -250px;
right: 0;
width: 250px; width: 250px;
background: rgba(0, 0, 0, 0.5); background: rgba(0, 0, 0, 0.5);
position: fixed; position: fixed;
height: 100%; height: 100%;
overflow-y: auto; overflow-y: auto;
z-index: 1000; z-index: 1000;
transition: all 0.4s ease 0s; transition: right 0.8s cubic-bezier(0.77, 0, 0.175, 1);
} }
.bg-switch-container { .bg-switch-container {
@ -193,9 +196,8 @@ a {
} }
#bg-switch-wrapper.active { #bg-switch-wrapper.active {
right: 250px; right: 0px;
width: 250px; width: 250px;
transition: all 0.4s ease 0s;
overflow-x: hidden; overflow-x: hidden;
} }
@ -214,6 +216,8 @@ a {
background-size: cover !important; background-size: cover !important;
background-repeat: no-repeat !important; background-repeat: no-repeat !important;
background-position: center !important; background-position: center !important;
transition: left 0.8s cubic-bezier(0.77, 0, 0.175, 1);
} }
#user-target2 { #user-target2 {
@ -286,6 +290,11 @@ a {
right: 9px; right: 9px;
} }
.panel-heading img {
max-height: 30px;
width: auto;
}
.login-wrapper { .login-wrapper {
list-style-type: none; list-style-type: none;
display: table-row; display: table-row;

45
themes/antergos/js/greeter.js

@ -64,6 +64,7 @@ class AntergosThemeUtils {
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.$log_container = $('#logArea'); this.$log_container = $('#logArea');
this.recursion = 0;
if ( 'undefined' === typeof window.navigator.languages ) { if ( 'undefined' === typeof window.navigator.languages ) {
window.navigator.languages = [ window.navigator.language ]; window.navigator.languages = [ window.navigator.language ];
@ -144,16 +145,11 @@ class AntergosThemeUtils {
background_images_dir = config.get_str( 'branding', 'background_images' ) || ''; background_images_dir = config.get_str( 'branding', 'background_images' ) || '';
if ( background_images_dir ) { if ( background_images_dir ) {
background_images = greeterutil.dirlist( background_images_dir ) || []; background_images = greeterutil.dirlist( background_images_dir ) || [];
this.log(background_images);
} }
if ( background_images && background_images.length ) { if ( background_images && background_images.length ) {
var images = []; background_images = this.find_images( background_images );
for ( var file of background_images ) {
if ( file.match( /(png|PNG)|(jpg|JPEG)|(bmp|BMP)/ ) ) {
images.push( file );
}
}
background_images = images;
} }
} }
@ -163,6 +159,33 @@ class AntergosThemeUtils {
this.background_images = background_images; this.background_images = background_images;
this.background_images_dir = background_images_dir; this.background_images_dir = background_images_dir;
} }
find_images( dirlist ) {
var images = [],
subdirs = [];
for ( var file of dirlist ) {
if ( file.match( /(png|PNG)|(jpg|JPEG)|(bmp|BMP)/ ) ) {
images.push( file );
} else if ( ! file.match( /\w+\.\w+/ ) ) {
subdirs.push( file )
}
}
if ( subdirs.length && ! images.length && this.recursion < 3 ) {
this.recursion++;
for ( var dir of subdirs ) {
var list = config.dirlist( dir );
if ( null !== list && list.length ) {
images.push.apply( images, this.find_images( list ) );
}
}
}
return images;
}
} }
@ -185,7 +208,7 @@ class AntergosBackgroundManager {
this.current_background = _util.cache_get( 'background_manager', 'current_background' ); this.current_background = _util.cache_get( 'background_manager', 'current_background' );
if ( ! _util.background_images_dir.length || ! _util.background_images.length ) { if ( ! _util.background_images_dir.length || ! _util.background_images.length ) {
this.log( 'AntergosBackgroundManager: [ERROR] No background images detected.' ); _util.log( 'AntergosBackgroundManager: [ERROR] No background images detected.' );
$( '.header' ).fadeTo( 300, 0.5, function() { $( '.header' ).fadeTo( 300, 0.5, function() {
$( '.header' ).css( "background-image", 'url(img/fallback_bg.jpg)' ); $( '.header' ).css( "background-image", 'url(img/fallback_bg.jpg)' );
@ -690,15 +713,15 @@ class AntergosTheme {
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 ); _util.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 ); _util.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 ); _util.log( action );
break; break;
default: default:
break; break;

4
themes/antergos/js/mock.js

@ -251,6 +251,10 @@ if ( typeof lightdm == 'undefined' ) {
return branding[ key ]; return branding[ key ];
} }
}; };
config.get_bool = function( section, key ) {
return true;
};
greeterutil.dirlist = function( directory ) { greeterutil.dirlist = function( directory ) {
if ( '/usr/share/antergos/wallpapers' === directory ) { if ( '/usr/share/antergos/wallpapers' === directory ) {

Loading…
Cancel
Save