Merge pull request #77 from simonlnu/master

CSS and JS tweaks
This commit is contained in:
Simon 2012-03-04 09:22:51 -08:00
commit c0ecd7a925
2 changed files with 32 additions and 29 deletions

View file

@ -104,34 +104,6 @@ function initEditor(cb) {
$(".jothidden").show(); $(".jothidden").show();
if (typeof cb!="undefined") { cb(); } if (typeof cb!="undefined") { cb(); }
// character count part deux
//
// get # of chars
var textlen = $('#profile-jot-text').val().length();
$('#character-counter').html(textlen);
$('#profile-jot-text').keyup(function() {
$('#character-counter').removeClass('jothidden');
if(textlen <= 140) {
$('#character-counter').removeClass('red');
$('#character-counter').removeClass('orange');
$('#character-counter').addClass('grey');
}
if((textlen > 140) && (textlen <= 420)) {
$('#character-counter').removeClass('grey');
$('#character-counter').removeClass('red');
$('#character-counter').addClass('orange');
}
if(textlen > 420) {
$('#character-counter').removeClass('grey');
$('#character-counter').removeClass('orange');
$('#character-counter').addClass('red');
}
// get new len
$('#character-counter').html($(this).val().length);
});
}); });
} }
}); });
@ -146,10 +118,38 @@ function initEditor(cb) {
} }
} }
function charCounter() {
// character count part deux
$('#profile-jot-text').keyup(function(event) {
var textlen = $(this).val().length();
var maxLen1 = 140;
var maxLen2 = 420;
$('#character-counter').removeClass('jothidden');
if(textlen <= maxLen1) {
$('#character-counter').removeClass('red');
$('#character-counter').removeClass('orange');
$('#character-counter').addClass('grey');
}
if((textlen > maxLen1) && (textlen <= maxLen2)) {
$('#character-counter').removeClass('grey');
$('#character-counter').removeClass('red');
$('#character-counter').addClass('orange');
}
if(textlen > maxLen2) {
$('#character-counter').removeClass('grey');
$('#character-counter').removeClass('orange');
$('#character-counter').addClass('red');
}
$('#character-counter').html($(this).val().length);
});
}
function enableOnUser(){ function enableOnUser(){
if (editor) return; if (editor) return;
$(this).val(""); $(this).val("");
initEditor(); initEditor();
charCounter();
} }
</script> </script>

View file

@ -918,9 +918,12 @@ aside #viewcontacts {
#acl-deny-text-end { #acl-deny-text-end {
clear: both; clear: both;
} }
#jot-title-desc, #profile-jot-desc { #jot-title-desc {
color: #cccccc; color: #cccccc;
} }
#profile-jot-desc {
color: #a00;
}
#jot-title-wrapper { #jot-title-wrapper {
margin-bottom: 5px; margin-bottom: 5px;
} }