login as its own js file. accounted for the autofil state
This commit is contained in:
parent
0e72a91d1b
commit
666fb76bfc
3 changed files with 54 additions and 44 deletions
|
|
@ -3,54 +3,12 @@
|
||||||
-# the COPYRIGHT file.
|
-# the COPYRIGHT file.
|
||||||
|
|
||||||
= content_for :head do
|
= content_for :head do
|
||||||
|
= include_javascripts :login
|
||||||
|
|
||||||
:css
|
:css
|
||||||
header{ display:none; }
|
header{ display:none; }
|
||||||
footer{ position: absolute; bottom: 6px; }
|
footer{ position: absolute; bottom: 6px; }
|
||||||
|
|
||||||
:javascript
|
|
||||||
jQuery.fn.center = function () {
|
|
||||||
this.css("position","absolute");
|
|
||||||
this.css("top", ( $(window).height() - this.height() ) / 2+$(window).scrollTop() + "px");
|
|
||||||
this.css("left", ( $(window).width() - this.width() ) / 2+$(window).scrollLeft() + "px");
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
$(document).ready( function(){
|
|
||||||
|
|
||||||
var username = $("#user_username"),
|
|
||||||
password = $("#user_password"),
|
|
||||||
forgotPass = $("#forgot_password_link"),
|
|
||||||
controls = $("#controls");
|
|
||||||
|
|
||||||
$("#login").center();
|
|
||||||
$(window).resize(function(){
|
|
||||||
$("#login").center();
|
|
||||||
});
|
|
||||||
|
|
||||||
username.focus();
|
|
||||||
$("form").submit(function(){
|
|
||||||
$('#asterisk').addClass('rideSpinners');
|
|
||||||
forgotPass.addClass('hidden');
|
|
||||||
controls.addClass('hidden');
|
|
||||||
});
|
|
||||||
|
|
||||||
$(document).keydown(function(){
|
|
||||||
if($('#user_username').val() != "" && $('#user_password').val() != ""){
|
|
||||||
controls.removeClass('hidden');
|
|
||||||
}else{
|
|
||||||
controls.addClass('hidden');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
password
|
|
||||||
.focus(function(){
|
|
||||||
forgotPass.removeClass('hidden');
|
|
||||||
})
|
|
||||||
.blur(function(){
|
|
||||||
forgotPass.addClass('hidden');
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
.container{:style => 'text-align:center;'}
|
.container{:style => 'text-align:center;'}
|
||||||
#login
|
#login
|
||||||
%p
|
%p
|
||||||
|
|
|
||||||
|
|
@ -37,6 +37,8 @@ javascripts:
|
||||||
- public/javascripts/stream.js
|
- public/javascripts/stream.js
|
||||||
- public/javascripts/content-updater.js
|
- public/javascripts/content-updater.js
|
||||||
- public/javascripts/search.js
|
- public/javascripts/search.js
|
||||||
|
login:
|
||||||
|
- public/javascripts/login.js
|
||||||
mobile:
|
mobile:
|
||||||
- public/javascripts/vendor/jquery152.min.js
|
- public/javascripts/vendor/jquery152.min.js
|
||||||
- public/javascripts/custom-mobile-scripting.js
|
- public/javascripts/custom-mobile-scripting.js
|
||||||
|
|
|
||||||
50
public/javascripts/login.js
Normal file
50
public/javascripts/login.js
Normal file
|
|
@ -0,0 +1,50 @@
|
||||||
|
jQuery.fn.center = function () {
|
||||||
|
this.css("position","absolute");
|
||||||
|
this.css("top", ( $(window).height() - this.height() ) / 2+$(window).scrollTop() + "px");
|
||||||
|
this.css("left", ( $(window).width() - this.width() ) / 2+$(window).scrollLeft() + "px");
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
$(document).ready( function(){
|
||||||
|
var username = $("#user_username"),
|
||||||
|
password = $("#user_password"),
|
||||||
|
forgotPass = $("#forgot_password_link"),
|
||||||
|
controls = $("#controls");
|
||||||
|
|
||||||
|
var contentFilled = function(){
|
||||||
|
return($('#user_username').val() != "" && $('#user_password').val() != "");
|
||||||
|
}
|
||||||
|
|
||||||
|
$("#login").center();
|
||||||
|
$(window).resize(function(){
|
||||||
|
$("#login").center();
|
||||||
|
});
|
||||||
|
|
||||||
|
username.focus();
|
||||||
|
$("form").submit(function(){
|
||||||
|
$('#asterisk').addClass('rideSpinners');
|
||||||
|
forgotPass.addClass('hidden');
|
||||||
|
controls.addClass('hidden');
|
||||||
|
});
|
||||||
|
|
||||||
|
$(document).keydown(function(){
|
||||||
|
if(contentFilled()){
|
||||||
|
controls.removeClass('hidden');
|
||||||
|
}else{
|
||||||
|
controls.addClass('hidden');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
if(contentFilled()){
|
||||||
|
controls.removeClass('hidden');
|
||||||
|
}
|
||||||
|
|
||||||
|
password
|
||||||
|
.focus(function(){
|
||||||
|
forgotPass.removeClass('hidden');
|
||||||
|
})
|
||||||
|
.blur(function(){
|
||||||
|
forgotPass.addClass('hidden');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
Loading…
Reference in a new issue