Skip to content

Commit

Permalink
Updates:
Browse files Browse the repository at this point in the history
- tabs -> spaces
- js cleanup, remove inline style.
  • Loading branch information
stanistan committed Aug 29, 2012
1 parent 577931c commit ad3f6b8
Show file tree
Hide file tree
Showing 2 changed files with 103 additions and 112 deletions.
61 changes: 31 additions & 30 deletions config.php
@@ -1,34 +1,35 @@
<?
<?php

$seo_field_array=array(
'target'=>array(
'title'=>75,
'meta_description'=>55,
'h1'=>100,
'h1_blurb'=>300,
'footer_blurb'=>300
),
'extras'=>array(
'meta_subject'=>200,
'meta_title'=>75,
'meta_keywords'=>250,
//'ICBM'=>100,
//'geo-position'=>100,
//'geo-placename'=>100,
//'geo-region'=>100,
//'geography'=>100,
//'zipcode'=>25,
//'city'=>70,
//'state'=>2,
//'country'=>100,
//'author'=>100,
//'copyright'=>100
)
//'Open Graph'=>array(
// 'og:title'=>100,
// 'og:type'=>50,
// 'og:description'=>300,
// 'og:site_name'=>100
//)
'target'=>array(
'title'=>75,
'meta_description'=>55,
'h1'=>100,
'h1_blurb'=>300,
'footer_blurb'=>300
),
'extras'=>array(
'meta_subject'=>200,
'meta_title'=>75,
'meta_keywords'=>250,
//'ICBM'=>100,
//'geo-position'=>100,
//'geo-placename'=>100,
//'geo-region'=>100,
//'geography'=>100,
//'zipcode'=>25,
//'city'=>70,
//'state'=>2,
//'country'=>100,
//'author'=>100,
//'copyright'=>100
)
//'Open Graph'=>array(
// 'og:title'=>100,
// 'og:type'=>50,
// 'og:description'=>300,
// 'og:site_name'=>100
//)
);

$seo_textarea = array('h1_blurb','meta_description','meta_keywords','footer_blurb');
Expand Down
154 changes: 72 additions & 82 deletions pages/ajax/login-skybox/login-skybox.js
@@ -1,83 +1,73 @@

function forgotpw() {
$.skybox('/reset-password');
}

// login
$('#login_username:visible').livequery(function(){
$(this).focus();
});

var fields = ['button', 'message', 'password', 'form', 'username'],
uri = '/ajax/login-skybox/authenticate',
messages = {
'true' : 'You are being redirected to the requested page.',
'false': 'Incorrect Login. Please try again.'
},
redirectToPage = function() {

var uri = window.location.href;
if (location.hash.substring(0, 2) != '#/') {
uri = uri.substr(0, uri.indexOf('#'));
uri = removeParam('skybox', uri);
uri = removeParam('logout', uri);
} else {
uri = window.location.pathname;
}

window.location.href = uri;

};

$('#login_form:visible').die().live('submit', function() {

var $els = {}, i, data, message;

// get elements
for (i = 0; i < fields.length; i++) {
$els[fields[i]] = $('#login_' + fields[i]);
}

// hide message
$els.message.is(':visible') && $els.message.fadeTo('fast', 0.01);

// disable login button
$els.button.val('Authenticating...').attr('disabled', true);

data = $els.form.serialize();

$.post(uri, data, function(response) {

message = messages[response] || response;
$els.message.html(message);
if ($els.message.is(':visible')) $els.message.fadeTo('fast', 1);
else $els.message.slideDown('fast');

if (response == 'true') {

$els.message.css({
border: 0,
borderBottom: '1px solid',
borderTop: '1px solid',
textAlign: 'center',
background: 'black',
color: 'white',
fontWeight: 'bold',
fontSize: '16px'
});

setTimeout(redirectToPage, 500);

} else {

$els.password.val('');
$els.button.val('Sign In').attr('disabled', false);
if ($els.username.val() == '') $els.username.focus();
else $els.password.focus();

}

});

return false;
});
function forgotpw() {
$.skybox('/reset-password');
}

// login
$('#login_username:visible').livequery(function(){
$(this).focus();
});

var fields = ['button', 'message', 'password', 'form', 'username'],
uri = '/ajax/login-skybox/authenticate',
messages = {
'true' : 'You are being redirected to the requested page.',
'false': 'Incorrect Login. Please try again.'
},
redirectToPage = function() {

var uri = window.location.href;
if (location.hash.substring(0, 2) != '#/') {
uri = uri.substr(0, uri.indexOf('#'));
uri = removeParam('skybox', uri);
uri = removeParam('logout', uri);
} else {
uri = window.location.pathname;
}

window.location.href = uri;

};

$('#skybox').on('submit', '#login_form', function(e) {

e.preventDefault();

var $els = {}, i;

$.each(fields, function(i, item) {
$els[item] = $('#login_' + item);
});

if ($els.message.is(':visible')) {
$els.message.fadeTo('fast', 0.01);
}

$els.button.val('Authenticating...').attr('disabled', true);

sky.post(uri, $els.form.serialize(), function(re) {

$els.message.html(messages[re] || re);

if ($els.message.is(':visible')) {
$els.message.fadeTo('fast', 1);
} else {
$els.message.slideDown('fast');
}

if (re == 'true') {
$els.message.addClass('successful-login');
setTimeout(redirectToPage, 500);
} else {
$els.password.val('');
$els.button.val('Sign In').attr('disabled', false);
if ($els.username.val() === '') {
$els.username.focus();
} else {
$els.password.focus();
}
}

});

});

0 comments on commit ad3f6b8

Please sign in to comment.