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. 29
      themes/antergos/index.html
  3. 134
      themes/antergos/js/greeter.js

81
themes/antergos/css/style.css

@ -30,11 +30,20 @@
@font-face {
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-family: 'Open Sans Light';
src: url('../../_vendor/fonts/TTF/OpenSans-Light.ttf');
font-family: 'Open Sans';
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 {
@ -204,7 +213,7 @@ a {
}
.toggle {
margin: 5px 20px 0 0;
margin: 10px 20px 0 0;
}
/* Full Page Image Header Area */
@ -218,7 +227,8 @@ a {
background-size: cover !important;
background-repeat: no-repeat !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 */
.time {
font-family: "Open Sans Light", sans-serif;
font-family: "Open Sans", sans-serif;
font-size: 96px;
font-weight: 300;
line-height: 1em;
text-decoration: none;
color: #3D73C5;
@ -311,11 +322,26 @@ a {
min-height: 275px;
}
#login {
opacity: 0;
transition: opacity 0.3s ease-in;
}
#panel-fix .panel-shadow, .panel-group, .panel-shadow {
box-shadow: none !important;
border: none !important;
}
#collapseOne {
position: relative;
top: 5px;
}
#collapseTwo {
position: relative;
top: 15px;
}
.panel-default {
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-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;
}

29
themes/antergos/index.html

@ -174,16 +174,9 @@
</div>
<!-- Status Area -->
<div id="statusArea" class="status">
<table border="0" align="center">
<tr>
<td>
<div class="alert alert-danger fade in">
<div class="alert alert-dismissible 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>
@ -235,20 +228,20 @@
<!-- Custom JavaScript for the BG Switcher & Clock Toggle -->
<script>
// TODO: Move this stuff into greeter.js
$( "#bg-switch-close" ).click( function( e ) {
e.preventDefault();
$( "#bg-switch-wrapper" ).toggleClass( "active" );
$( this ).hide();
$( "#bg-switch-toggle" ).show();
$('#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-toggle" ).click( function( e ) {
$( "#bg-switch-close, #bg-switch-toggle" ).click( function( e ) {
e.preventDefault();
$( "#bg-switch-wrapper" ).toggleClass( "active" );
$( this ).hide();
$( "#bg-switch-close" ).show();
$('#bg-switch-wrapper').toggleClass( "active" );
} );
$( '#collapseTwo' ).on( 'shown.bs.collapse', function() {
$( '#collapseTwo a' ).filter( ':not(.dropdown-menu *)' ).each( function( index ) {
var i = index + 1;

134
themes/antergos/js/greeter.js

@ -280,51 +280,53 @@ class AntergosBackgroundManager {
/**
* Determine which background image should be displayed and apply it.
*/
initialize() {
if ( ! this.current_background && 'localStorage' === _util.cache_backend ) {
initialize( deferred ) {
if ( ! _bg_self.current_background && 'localStorage' === _util.cache_backend ) {
// For backwards compatibility
if ( null !== localStorage.getItem( 'bgsaved' ) && '0' === localStorage.getItem( 'bgrandom' ) ) {
this.current_background = localStorage.getItem( 'bgsaved' );
_util.cache_set( this.current_background, 'background_manager', 'current_background' );
_bg_self.current_background = localStorage.getItem( 'bgsaved' );
_util.cache_set( _bg_self.current_background, 'background_manager', 'current_background' );
localStorage.removeItem( 'bgrandom' );
localStorage.removeItem( 'bgsaved' );
} else {
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' );
localStorage.removeItem( 'bgrandom' );
}
}
}
if ( ! this.current_background ) {
if ( ! _bg_self.current_background ) {
// For current and future versions
let current_background = _util.cache_get( 'background_manager', 'current_background' ),
random_background = _util.cache_get( 'background_manager', 'random_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' );
}
this.current_background = current_background;
_util.cache_set( this.current_background, 'background_manager', 'current_background' );
_bg_self.current_background = 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`
*/
do_background() {
$( '.header' ).fadeTo( 300, 0.5, function() {
var bg = _bg_self.current_background,
do_background( deferred = null ) {
let bg = _bg_self.current_background,
tpl = (bg.indexOf('url(') > -1) ? bg : `url(${_bg_self.current_background})`;
$( '.header' ).css( "background-image", tpl );
} ).fadeTo( 300, 1 );
if (null !== deferred) {
deferred.resolve();
}
}
@ -433,15 +435,16 @@ class AntergosTheme {
this.$user_list = $( '#user-list2' );
this.$session_list = $( '#sessions' );
this.$clock_container = $( '#collapseOne' );
this.$clock = $( "#current_time" );
this.$actions_container = $( "#actionsArea" );
this.$clock = $( '#current_time' );
this.$actions_container = $( '#actionsArea' );
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.initialize();
this.initialize();
let init_bg = $.Deferred(this.background_manager.initialize);
init_bg.then(() => this.initialize());
return _self;
}
@ -455,9 +458,12 @@ class AntergosTheme {
this.do_static_translations();
this.initialize_clock();
this.prepare_login_panel_header();
this.prepare_system_action_buttons();
$('#login').css('opacity', '1');
this.prepare_user_list();
this.prepare_session_list();
this.prepare_system_action_buttons();
this.register_callbacks();
this.background_manager.setup_background_thumbnails();
}
@ -468,13 +474,12 @@ class AntergosTheme {
* been registered elsewhere.
*/
register_callbacks() {
var events = 'shown.bs.collapse, hidden.bs.collapse';
this.$user_list.parents( '.collapse' ).on( events, this.user_list_collapse_handler );
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 );
$( 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 );
$( '.cancel_auth:not(.alert .cancel_auth)' ).on('click', this.cancel_authentication );
$( '.submit_passwd' ).on('click', this.submit_password );
$('[data-i18n="debug_log"]').on('click', this.show_log_handler );
window.show_prompt = this.show_prompt;
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
* display the user list by pressing Enter or Spacebar.
*/
show_user_list() {
if ( $( this.$clock_container ).hasClass( 'in' ) ) {
show_user_list( shown = false ) {
let delay = 0;
if ( _self.$clock_container.hasClass( 'in' ) ) {
$( '#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,6 +727,19 @@ class AntergosTheme {
_util.log( 'Cancelled authentication.' );
_self.selected_user = null;
_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%' );
@ -721,9 +747,7 @@ class AntergosTheme {
$( '.hovered' ).removeClass( 'hovered' ).siblings().show();
$( '.fa-toggle-down' ).show();
_self.selected_user = null;
_self.auth_pending = false;
}
}
@ -735,7 +759,7 @@ class AntergosTheme {
*/
authentication_complete() {
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;
_util.cache_set( selected_session, 'user', lightdm.authentication_user, 'session' );
@ -749,8 +773,7 @@ class AntergosTheme {
} );
} else {
// The user did not enter the correct password. Show error message.
$('#showMsg').text(err_msg);
$( '#statusArea' ).show();
_self.show_message(err_msg, 'error');
}
}
@ -775,20 +798,25 @@ class AntergosTheme {
key_press_handler( event ) {
var action;
let action = null;
switch ( event.which ) {
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;
case 27:
action = _self.auth_pending ? _self.cancel_authentication() : 0;
action = _self.auth_pending ? _self.cancel_authentication : 0;
break;
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;
default:
break;
}
if ( action instanceof Function ) {
action();
}
}
@ -810,8 +838,9 @@ class AntergosTheme {
}
user_list_collapse_handler() {
_self.user_list_visible = _self.$user_list.hasClass( 'in' );
user_list_collapse_handler( event ) {
_self.user_list_visible = $(event.target).hasClass( 'in' );
_self.show_user_list(_self.user_list_visible);
}
@ -851,11 +880,24 @@ class AntergosTheme {
* @param type
*/
show_message( text, type ) {
if ( text.length > 0 ) {
$( this.$msg_area ).html( text );
$( '#passwordArea' ).hide();
$( this.$msg_area_container ).show();
if (! text.length ) {
_util.log('show_message() called without a message to show!');
return;
}
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