Browse Source

several bug fixes and minor improvements to the default theme.

Fixes #73 Fixes #52
sisyphus
Dustin Falgout 8 years ago
parent
commit
6afd4d7668
  1. 81
      themes/antergos/css/style.css
  2. 35
      themes/antergos/index.html
  3. 148
      themes/antergos/js/greeter.js

81
themes/antergos/css/style.css

@ -30,11 +30,20 @@
@font-face { @font-face {
font-family: 'Open Sans'; font-family: 'Open Sans';
src: url('../../_vendor/fonts/TTF/OpenSans-Regular.ttf'); font-weight: 400;
font-style: normal;
src: local('Open Sans Regular'), local('Open Sans'), url('../../_vendor/fonts/TTF/OpenSans-Regular.ttf');
} }
@font-face { @font-face {
font-family: 'Open Sans Light'; font-family: 'Open Sans';
src: url('../../_vendor/fonts/TTF/OpenSans-Light.ttf'); font-weight: 300;
font-style: normal;
src: local('Open Sans Light'), local('Open Sans'), url('../../_vendor/fonts/TTF/OpenSans-Light.ttf');
}
body {
-webkit-font-smoothing: antialiased !important;
text-rendering: optimizeLegibility !important;
} }
*:focus { *:focus {
@ -204,7 +213,7 @@ a {
} }
.toggle { .toggle {
margin: 5px 20px 0 0; margin: 10px 20px 0 0;
} }
/* Full Page Image Header Area */ /* Full Page Image Header Area */
@ -218,7 +227,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); transition: left 0.8s, background-image 0.3s;
transition-timing-function: cubic-bezier(0.77, 0, 0.175, 1), linear;
} }
@ -243,8 +253,9 @@ a {
/* Clock Widget */ /* Clock Widget */
.time { .time {
font-family: "Open Sans Light", sans-serif; font-family: "Open Sans", sans-serif;
font-size: 96px; font-size: 96px;
font-weight: 300;
line-height: 1em; line-height: 1em;
text-decoration: none; text-decoration: none;
color: #3D73C5; color: #3D73C5;
@ -311,11 +322,26 @@ a {
min-height: 275px; min-height: 275px;
} }
#login {
opacity: 0;
transition: opacity 0.3s ease-in;
}
#panel-fix .panel-shadow, .panel-group, .panel-shadow { #panel-fix .panel-shadow, .panel-group, .panel-shadow {
box-shadow: none !important; box-shadow: none !important;
border: none !important; border: none !important;
} }
#collapseOne {
position: relative;
top: 5px;
}
#collapseTwo {
position: relative;
top: 15px;
}
.panel-default { .panel-default {
background-color: rgb(252, 247, 247); background-color: rgb(252, 247, 247);
} }
@ -588,3 +614,46 @@ a.list-group-item:focus:after, a.list-group-item:hover:after, a.list-group-item.
padding-left: 25px; padding-left: 25px;
padding-right: 25px; padding-right: 25px;
} }
#statusArea {
width: 360px;
position: relative;
top: 15px
}
.alert-danger {
background-color: #e51c23;
}
.alert {
border: none;
color: #fff;
font-size: 14.5px;
font-weight: 400;
padding-right: 35px;
padding-left: 35px;
}
.alert .close {
color: #fff;
}
.close {
font-size: 34px;
font-weight: 300;
line-height: 24px;
opacity: 0.6;
transition: all 0.2s;
}
.alert-dismissible .close {
position: relative;
top: -2px;
right: -21px;
}
.close:hover {
opacity: 1;
}

35
themes/antergos/index.html

@ -174,16 +174,9 @@
</div> </div>
<!-- Status Area --> <!-- Status Area -->
<div id="statusArea" class="status"> <div id="statusArea" class="status">
<table border="0" align="center"> <div class="alert alert-dismissible alert-danger fade in">
<tr> <button type="button" class="close cancel_auth" data-dismiss="alert" aria-hidden="true">&nbsp;&times;</button>
<td> </div>
<div class="alert alert-danger fade in">
<button type="button" class="close cancel_auth" data-dismiss="alert" aria-hidden="true">&nbsp;&times;</button>
<p id="showMsg"></p>
</div>
</td>
</tr>
</table>
</div> </div>
</div> </div>
@ -235,19 +228,19 @@
<!-- Custom JavaScript for the BG Switcher & Clock Toggle --> <!-- Custom JavaScript for the BG Switcher & Clock Toggle -->
<script> <script>
// TODO: Move this stuff into greeter.js // TODO: Move this stuff into greeter.js
$( "#bg-switch-close" ).click( function( e ) { $('#bg-switch-wrapper').on('transitionend', function() {
if ( $(this).hasClass('active') ) {
$('#bg-switch-toggle').hide(0);
$('#bg-switch-close').show(0);
} else {
$('#bg-switch-close').hide(100);
$('#bg-switch-toggle').show(100);
}
});
$( "#bg-switch-close, #bg-switch-toggle" ).click( function( e ) {
e.preventDefault(); e.preventDefault();
$( "#bg-switch-wrapper" ).toggleClass( "active" ); $('#bg-switch-wrapper').toggleClass( "active" );
$( this ).hide();
$( "#bg-switch-toggle" ).show();
} ); } );
$( "#bg-switch-toggle" ).click( function( e ) {
e.preventDefault();
$( "#bg-switch-wrapper" ).toggleClass( "active" );
$( this ).hide();
$( "#bg-switch-close" ).show();
} );
$( '#collapseTwo' ).on( 'shown.bs.collapse', function() { $( '#collapseTwo' ).on( 'shown.bs.collapse', function() {
$( '#collapseTwo a' ).filter( ':not(.dropdown-menu *)' ).each( function( index ) { $( '#collapseTwo a' ).filter( ':not(.dropdown-menu *)' ).each( function( index ) {

148
themes/antergos/js/greeter.js

@ -280,51 +280,53 @@ class AntergosBackgroundManager {
/** /**
* Determine which background image should be displayed and apply it. * Determine which background image should be displayed and apply it.
*/ */
initialize() { initialize( deferred ) {
if ( ! this.current_background && 'localStorage' === _util.cache_backend ) { if ( ! _bg_self.current_background && 'localStorage' === _util.cache_backend ) {
// For backwards compatibility // For backwards compatibility
if ( null !== localStorage.getItem( 'bgsaved' ) && '0' === localStorage.getItem( 'bgrandom' ) ) { if ( null !== localStorage.getItem( 'bgsaved' ) && '0' === localStorage.getItem( 'bgrandom' ) ) {
this.current_background = localStorage.getItem( 'bgsaved' ); _bg_self.current_background = localStorage.getItem( 'bgsaved' );
_util.cache_set( this.current_background, 'background_manager', 'current_background' ); _util.cache_set( _bg_self.current_background, 'background_manager', 'current_background' );
localStorage.removeItem( 'bgrandom' ); localStorage.removeItem( 'bgrandom' );
localStorage.removeItem( 'bgsaved' ); localStorage.removeItem( 'bgsaved' );
} else { } else {
if ( '1' === localStorage.getItem( 'bgrandom' ) ) { if ( '1' === localStorage.getItem( 'bgrandom' ) ) {
this.current_background = this.get_random_image(); _bg_self.current_background = _bg_self.get_random_image();
_util.cache_set( 'true', 'background_manager', 'random_background' ); _util.cache_set( 'true', 'background_manager', 'random_background' );
localStorage.removeItem( 'bgrandom' ); localStorage.removeItem( 'bgrandom' );
} }
} }
} }
if ( ! this.current_background ) { if ( ! _bg_self.current_background ) {
// For current and future versions // For current and future versions
let current_background = _util.cache_get( 'background_manager', 'current_background' ), let current_background = _util.cache_get( 'background_manager', 'current_background' ),
random_background = _util.cache_get( 'background_manager', 'random_background' ); random_background = _util.cache_get( 'background_manager', 'random_background' );
if ( 'true' === random_background || ! current_background ) { if ( 'true' === random_background || ! current_background ) {
current_background = this.get_random_image(); current_background = _bg_self.get_random_image();
_util.cache_set( 'true', 'background_manager', 'random_background' ); _util.cache_set( 'true', 'background_manager', 'random_background' );
} }
this.current_background = current_background; _bg_self.current_background = current_background;
_util.cache_set( this.current_background, 'background_manager', 'current_background' ); _util.cache_set( _bg_self.current_background, 'background_manager', 'current_background' );
} }
this.do_background(); _bg_self.do_background(deferred);
} }
/** /**
* Set the background image to the value of `this.current_background` * Set the background image to the value of `this.current_background`
*/ */
do_background() { do_background( deferred = null ) {
$( '.header' ).fadeTo( 300, 0.5, function() { let bg = _bg_self.current_background,
var bg = _bg_self.current_background, tpl = (bg.indexOf('url(') > -1) ? bg : `url(${_bg_self.current_background})`;
tpl = (bg.indexOf('url(') > -1) ? bg : `url(${_bg_self.current_background})`;
$( '.header' ).css( "background-image", tpl );
$( '.header' ).css( "background-image", tpl ); if (null !== deferred) {
} ).fadeTo( 300, 1 ); deferred.resolve();
}
} }
@ -433,15 +435,16 @@ class AntergosTheme {
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.$alert_msg_tpl = this.$msg_area_container.children('.alert-dismissible').clone();
this.background_manager = new AntergosBackgroundManager(); this.background_manager = new AntergosBackgroundManager();
this.background_manager.initialize();
this.initialize(); let init_bg = $.Deferred(this.background_manager.initialize);
init_bg.then(() => this.initialize());
return _self; return _self;
} }
@ -455,9 +458,12 @@ class AntergosTheme {
this.do_static_translations(); this.do_static_translations();
this.initialize_clock(); this.initialize_clock();
this.prepare_login_panel_header(); this.prepare_login_panel_header();
this.prepare_system_action_buttons();
$('#login').css('opacity', '1');
this.prepare_user_list(); this.prepare_user_list();
this.prepare_session_list(); this.prepare_session_list();
this.prepare_system_action_buttons();
this.register_callbacks(); this.register_callbacks();
this.background_manager.setup_background_thumbnails(); this.background_manager.setup_background_thumbnails();
} }
@ -468,13 +474,12 @@ class AntergosTheme {
* been registered elsewhere. * been registered elsewhere.
*/ */
register_callbacks() { register_callbacks() {
var events = 'shown.bs.collapse, hidden.bs.collapse'; this.$user_list.parents( '.collapse' ).on( 'shown.bs.collapse', this.user_list_collapse_handler );
this.$user_list.parents( '.collapse' ).on( ' hidden.bs.collapse', this.user_list_collapse_handler );
this.$user_list.parents( '.collapse' ).on( events, this.user_list_collapse_handler );
$( document ).keydown( this.key_press_handler ); $( document ).keydown( this.key_press_handler );
$( '.cancel_auth' ).click( this.cancel_authentication ); $( '.cancel_auth:not(.alert .cancel_auth)' ).on('click', this.cancel_authentication );
$( '.submit_passwd' ).click( this.submit_password ); $( '.submit_passwd' ).on('click', this.submit_password );
$('[data-i18n="debug_log"]').click( this.show_log_handler ); $('[data-i18n="debug_log"]').on('click', this.show_log_handler );
window.show_prompt = this.show_prompt; window.show_prompt = this.show_prompt;
window.show_message = this.show_message; window.show_message = this.show_message;
@ -603,12 +608,20 @@ class AntergosTheme {
* 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.
*/ */
show_user_list() { show_user_list( shown = false ) {
if ( $( this.$clock_container ).hasClass( 'in' ) ) { let delay = 0;
if ( _self.$clock_container.hasClass( 'in' ) ) {
$( '#trigger' ).trigger( 'click' ); $( '#trigger' ).trigger( 'click' );
delay = 500;
} else if ( false === shown ) {
return;
} }
if ( $( this.$user_list ).children().length <= 1 ) {
$( this.$user_list ).find( 'a' ).trigger( 'click', this ); if ( _self.$user_list.children().length <= 1 ) {
setTimeout(() => {
_self.$user_list.find( 'a' ).trigger( 'click', _self );
}, delay);
} }
} }
@ -714,17 +727,28 @@ class AntergosTheme {
_util.log( 'Cancelled authentication.' ); _util.log( 'Cancelled authentication.' );
if ( $( _self.$user_list ).children().length > 3 ) {
// Make the user list two columns instead of one.
$( _self.$user_list ).css( 'column-count', '2' ).parent().css( 'max-width', '85%' );
}
$( '.hovered' ).removeClass( 'hovered' ).siblings().show();
$( '.fa-toggle-down' ).show();
_self.selected_user = null; _self.selected_user = null;
_self.auth_pending = false; _self.auth_pending = false;
console.log($(event.target));
if ( $(event.target).hasClass('alert') ) {
/* We were triggered by the authentication failed message being dismissed.
* Keep the same account selected so user can retry without re-selecting an account.
*/
$( '#collapseTwo .user-wrap2' ).show(() => {
$( '.list-group-item.hovered' ).trigger('click');
});
} else {
if ( $( _self.$user_list ).children().length > 3 ) {
// Make the user list two columns instead of one.
$( _self.$user_list ).css( 'column-count', '2' ).parent().css( 'max-width', '85%' );
}
$( '.hovered' ).removeClass( 'hovered' ).siblings().show();
$( '.fa-toggle-down' ).show();
}
} }
@ -735,7 +759,7 @@ class AntergosTheme {
*/ */
authentication_complete() { authentication_complete() {
var selected_session = $( '.selected' ).attr( 'data-session-id' ), var selected_session = $( '.selected' ).attr( 'data-session-id' ),
err_msg = _util.translations.auth_failed[ _self.lang ]; err_msg = _util.translations.auth_failed;
_self.auth_pending = false; _self.auth_pending = false;
_util.cache_set( selected_session, 'user', lightdm.authentication_user, 'session' ); _util.cache_set( selected_session, 'user', lightdm.authentication_user, 'session' );
@ -749,8 +773,7 @@ class AntergosTheme {
} ); } );
} else { } else {
// The user did not enter the correct password. Show error message. // The user did not enter the correct password. Show error message.
$('#showMsg').text(err_msg); _self.show_message(err_msg, 'error');
$( '#statusArea' ).show();
} }
} }
@ -775,20 +798,25 @@ class AntergosTheme {
key_press_handler( event ) { key_press_handler( event ) {
var action; let action = null;
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;
break; break;
case 27: case 27:
action = _self.auth_pending ? _self.cancel_authentication() : 0; action = _self.auth_pending ? _self.cancel_authentication : 0;
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;
break; break;
default: default:
break; break;
} }
if ( action instanceof Function ) {
action();
}
} }
@ -810,8 +838,9 @@ class AntergosTheme {
} }
user_list_collapse_handler() { user_list_collapse_handler( event ) {
_self.user_list_visible = _self.$user_list.hasClass( 'in' ); _self.user_list_visible = $(event.target).hasClass( 'in' );
_self.show_user_list(_self.user_list_visible);
} }
@ -851,11 +880,24 @@ class AntergosTheme {
* @param type * @param type
*/ */
show_message( text, type ) { show_message( text, type ) {
if ( text.length > 0 ) { if (! text.length ) {
$( this.$msg_area ).html( text ); _util.log('show_message() called without a message to show!');
$( '#passwordArea' ).hide(); return;
$( this.$msg_area_container ).show(); }
let $msg_container = this.$msg_area_container.children('.alert-dismissible');
if (! $msg_container.length ) {
$msg_container = this.$alert_msg_tpl.clone();
$msg_container.appendTo( this.$msg_area_container );
} }
$msg_container.on('closed.bs.alert', _self.cancel_authentication);
$msg_container.html( $msg_container.html() + text );
$( '#collapseTwo .user-wrap2' ).hide();
this.$msg_area_container.show();
} }
} }

Loading…
Cancel
Save