Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Updated minified version.

  • Loading branch information...
commit cf47e5c1c4e338897a7b56e348c1ceab31adf899 1 parent ddf4c7d
Remy Bach authored

Showing 1 changed file with 1 addition and 1 deletion. Show diff stats Hide diff stats

  1. +1 1  jquery.superLabels.min.js
2  jquery.superLabels.min.js
@@ -7,4 +7,4 @@
7 7 * Description:
8 8 * This plugin allows you to display your form labels on top of your form fields, saving you space on your page.
9 9 */
10   -(function(d){var c={baseZindex:0,duration:500,easingIn:(d.easing.def?'easeInOutCubic':false),easingOut:(d.easing.def?'easeInOutCubic':false),fadeDuration:250,labelLeft:0,labelTop:0,noAnimate:false,opacity:0.5,slide:true,wrapSelector:false};var j=['text','search','url','tel','email','password'];var g=['input','textarea','select'];d.fn.superLabels=function(f){if(this.length===0)return false;if(isNaN(f.labelLeft))f.labelLeft=Number(f.labelLeft.replace(/\D+/,''));if(isNaN(f.labelTop))f.labelTop=Number(f.labelTop.replace(/\D+/,''));d.extend(c,f||{});var h=this;if(this.length===1&&this[0].tagName.match(/form/i)){h=d(g.join(','),this)}return h.each(function(){var a=d(this);if((a[0].tagName.toLowerCase()==='input'&&d.inArray(a.attr('type'),j))===-1&&d.inArray(a[0].tagName.toLowerCase(),g)!==-1){return true}var b=_1(this);var e=a.attr('placeholder');if(e){var i=d(''+e+'');if(b.length===0){b=i;a.prev(b)}else{b.replaceWith(i)}a.removeAttr('placeholder')}if(b.length===0){return true}_2(a,b);if(!this.tagName.match(/select/i)){a.focus(_3);a.blur(_4);a.keyup(_5);b.click(function(){a.focus()})}})};_1=function(a){var b=d(a).siblings('label');if(b.length===0){if(c.wrapSelector){b=d(a).parents(c.wrapSelector).find('label')}else{_6=a.id||a.name;b=d('[for="'+_6+'"]')}}return b};_2=function(a,b){if(a[0].tagName.match(/select/i)){var e=a.find('[selected]').length===0?' selected':'';a.prepend('');b.css('display','none')}else{a.css({zIndex:c.baseZindex+1}).addClass('sl_field');b.css({left:_0(a)?c.labelLeft:d(a).width()-b.width(),opacity:_0(a)?1:0,position:'absolute',top:c.labelTop,zIndex:c.baseZindex+2}).addClass('sl_label')}};_3=function(){if(_0(this)){var a=c.duration;var b=_1(this);var e={opacity:0};if(c.noAnimate){b.hide();return false}if(c.slide){e.left=d(this).width()-b.width();e.opacity=c.opacity}else{a=c.fadeDuration}b.animate(e,a,c.easingOut)}};_4=function(){if(_0(this)){var a=c.duration;var b=_1(this);var e={opacity:1};if(c.noAnimate){b.show();return false}if(c.slide){e.left=c.labelLeft}else{a=c.fadeDuration}b.animate(e,a,c.easingOut)}};_5=function(){var a=_1(this);var b=0;if((_0(this)&&a.css('opacity')>0)||(!_0(this)&&a.css('opacity')===0)){return false}if(_0(this)&&a.css('opacity')!==0){if(c.noAnimate){a.show();return false}b=c.opacity}a.animate({opacity:b},c.fadeDuration,c.easingOut)};_0=function(a){return d(a).val()===''}})(jQuery);
  10 +(function(a){var b={baseZindex:0,duration:500,easingIn:a.easing.def?"easeInOutCubic":false,easingOut:a.easing.def?"easeInOutCubic":false,fadeDuration:250,labelLeft:0,labelTop:0,noAnimate:false,opacity:.5,slide:true,wrapSelector:false};var c=["text","search","url","tel","email","password","number"];var d=["input","textarea","select"];a.fn.superLabels=function(e){if(this.length===0)return false;if(e&&e.labelLeft&&isNaN(e.labelLeft))e.labelLeft=Number(e.labelLeft.replace(/\D+/,""));if(e&&e.labelTop&&isNaN(e.labelTop))e.labelTop=Number(e.labelTop.replace(/\D+/,""));a.extend(b,e||{});var f=this;if(this.length===1&&this[0].tagName.match(/form/i)){f=a(d.join(","),this)}return f.each(function(){var b=a(this);if((b[0].tagName.toLowerCase()==="input"&&a.inArray(b.attr("type"),c))===-1&&a.inArray(b[0].tagName.toLowerCase(),d)!==-1){_info("Doh! The following "+this.tagName.toLowerCase()+", is not supported.",this);return true}var e=_getLabel(this);var f=b.attr("placeholder");if(f){var g=a('<label for="'+(b.attr("id")||b.attr("name"))+'">'+f+"</label>");if(e.length===0){e=g;b.prev(e)}else{e.replaceWith(g)}b.removeAttr("placeholder")}if(e.length===0){return true}_prepLabel(b,e);if(!this.tagName.match(/select/i)){b.focus(_focus);b.blur(_blur);b.change(_blur);b.bind("propertychange",_blur);b.keyup(_keyup);e.click(function(){b.focus()})}})};_getLabel=function(c){var d=a(c).siblings("label");if(d.length===0){if(b.wrapSelector){d=a(c).parents(b.wrapSelector).find("label")}else{_for=c.id||c.name;d=a('[for="'+_for+'"]')}}return d};_prepLabel=function(c,d){if(c[0].tagName.match(/select/i)){var e=c.find("[selected]").length===0?" selected":"";c.prepend('<option value="" disabled'+e+' rel="label">'+d.html()+"</option>");d.css("display","none")}else{c.css({zIndex:b.baseZindex+1}).addClass("sl_field");d.css({left:_noVal(c)?b.labelLeft:a(c).width()-d.width(),opacity:_noVal(c)?1:0,position:"absolute",top:b.labelTop,zIndex:b.baseZindex+2}).addClass("sl_label")}};_focus=function(){if(_noVal(this)){var c=b.duration;var d=_getLabel(this);var e={opacity:0};if(b.noAnimate){d.hide();return false}if(b.slide){e.left=a(this).width()-d.width();e.opacity=b.opacity}else{c=b.fadeDuration}d.animate(e,c,b.easingOut)}};_blur=function(){if(_noVal(this)){var a=b.duration;var c=_getLabel(this);var d={opacity:1};if(b.noAnimate){c.show();return false}if(b.slide){d.left=b.labelLeft}else{a=b.fadeDuration}c.animate(d,a,b.easingOut)}};_keyup=function(){if(b.noAnimate)return false;var a=_getLabel(this);var c=0;if(_noVal(this)&&a.css("opacity")>0||!_noVal(this)&&a.css("opacity")===0){return false}if(_noVal(this)&&a.css("opacity")!==0){c=b.opacity}a.animate({opacity:c},b.fadeDuration,b.easingOut)};_noVal=function(b){return a(b).val()===""}})(jQuery)

0 comments on commit cf47e5c

Please sign in to comment.
Something went wrong with that request. Please try again.