mirror of
https://github.com/LBRYFoundation/pool.git
synced 2025-08-23 17:37:25 +00:00
38 lines
No EOL
1.2 KiB
JavaScript
38 lines
No EOL
1.2 KiB
JavaScript
jQuery.fn.uniform = function(settings) {
|
|
settings = jQuery.extend({
|
|
valid_class : 'valid',
|
|
invalid_class : 'invalid',
|
|
focused_class : 'focused',
|
|
holder_class : 'ctrlHolder',
|
|
field_selector : 'input, select, textarea'
|
|
}, settings);
|
|
|
|
return this.each(function() {
|
|
var form = jQuery(this);
|
|
alert('uni-form.js');
|
|
|
|
// Focus specific control holder
|
|
var focusControlHolder = function(element) {
|
|
var parent= $(element).parents().filter('.'+settings.holder_class);
|
|
if(parent) {
|
|
if(parent[0] && (parent[0].className.indexOf(settings.holder_class) >= 0)) {
|
|
parent.addClass(settings.focused_class);
|
|
return;
|
|
} // if
|
|
} // if
|
|
};
|
|
|
|
// Select form fields and attach them higlighter functionality
|
|
form.find(settings.field_selector).focus(function() {
|
|
form.find('.' + settings.focused_class).removeClass(settings.focused_class);
|
|
focusControlHolder(jQuery(this));
|
|
}).blur(function() {
|
|
form.find('.' + settings.focused_class).removeClass(settings.focused_class);
|
|
});
|
|
});
|
|
};
|
|
|
|
// Auto set on page load...
|
|
//$(function() {
|
|
// jQuery('form.uniForm').uniform();
|
|
//});
|