From cdb6e7f3bf98eed46a28fa106af9ba7833448aef Mon Sep 17 00:00:00 2001 From: Nathan Vonnahme Date: Thu, 9 Feb 2012 09:13:02 -0900 Subject: [PATCH 01/56] I want to see a working demo, not just read about it, you know? Nice idea and implementation BTW. --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index a30b642..3cc5846 100644 --- a/README.md +++ b/README.md @@ -8,6 +8,10 @@ This method only really works for the following: input[type="text"], input[type= ☨ Uses the easing plugin if available. +## SHOW ME TEH DEMO + +See [my Get In Touch page](http://remy.bach.me.uk/get-in-touch/) for a work-in-progress demo. + ## Usage You need to make sure that the element containing both the field and the label has `position:relative;`. Other than that, the plugin should have enough flexibility to handle most of your needs. From 10b7bce58c69aa0a9ebf19a6aed29bdddd1ef4d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Bach?= Date: Thu, 9 Feb 2012 21:35:18 +0000 Subject: [PATCH 02/56] Update the Demo section. --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 3cc5846..dbc094e 100644 --- a/README.md +++ b/README.md @@ -8,9 +8,9 @@ This method only really works for the following: input[type="text"], input[type= ☨ Uses the easing plugin if available. -## SHOW ME TEH DEMO +## Demo -See [my Get In Touch page](http://remy.bach.me.uk/get-in-touch/) for a work-in-progress demo. +If you want to see a kind of demo of how it works, check out the [‘get in touch’](http://remy.bach.me.uk/get-in-touch/) page on my site which uses a version I’m working on that has a tooltip feature rolled in as well. ## Usage From 3a5874df35ba68cf353541d2d9ec0c419ae9b012 Mon Sep 17 00:00:00 2001 From: Remy Bach Date: Sun, 12 Feb 2012 17:56:54 +0000 Subject: [PATCH 03/56] Fix bug where non elements stopped working. --- jquery.superLabels.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jquery.superLabels.js b/jquery.superLabels.js index 43715ec..a6d5b9e 100644 --- a/jquery.superLabels.js +++ b/jquery.superLabels.js @@ -45,7 +45,7 @@ var _field = $(this); // Don't even bother going further if this isn't one of the accepted input field types or elements. - if ($.inArray(_field.attr('type'), acceptedInputTypes) === -1 && $.inArray(_field[0].tagName.toLowerCase(), acceptedElements) !== -1) { + if ((_field[0].tagName.toLowerCase() === 'input' && $.inArray(_field.attr('type'), acceptedInputTypes)) === -1 && $.inArray(_field[0].tagName.toLowerCase(), acceptedElements) !== -1) { _info('Doh! The following '+this.tagName.toLowerCase()+', is not supported.', this); return true; // Equivalent to continue in a normal for loop. } From 6aa249e60f0230ccd809e4929c5af51925ca307b Mon Sep 17 00:00:00 2001 From: Remy Bach Date: Sun, 12 Feb 2012 18:32:37 +0000 Subject: [PATCH 04/56] Link to new Demo (one that _actually_ uses this version and not the older one I currently use on my site) --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index dbc094e..f49a434 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ This method only really works for the following: input[type="text"], input[type= ## Demo -If you want to see a kind of demo of how it works, check out the [‘get in touch’](http://remy.bach.me.uk/get-in-touch/) page on my site which uses a version I’m working on that has a tooltip feature rolled in as well. +Here's a (very) [simple demo](http://remy.bach.me.uk/superlabels_demo/) of Super Labels in action. ## Usage From ede27af6ebfcd72e30a9325ddcefbb24fa33b5b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Bach?= Date: Mon, 5 Mar 2012 10:28:44 +0000 Subject: [PATCH 05/56] Add a noAnimate option that will just hide/show the label (identical in function to a normal HTML5 placeholder) --- jquery.superLabels.js | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/jquery.superLabels.js b/jquery.superLabels.js index a6d5b9e..7c7fecd 100644 --- a/jquery.superLabels.js +++ b/jquery.superLabels.js @@ -17,6 +17,7 @@ fadeDuration:250, // Duration of animation when it's fade only. labelLeft:0, // The distance from the left for the label. labelTop:0, // The distance from the top for the label. + noAnimate:false, // Whether or not to animate (slide and fade) the label. If true, we'll just hide it. opacity:0.5, // The opacity to fade the label to. slide:true, // Whether or not to slide the label across the input field. wrapSelector:false // The selector for the element you have wrapping each field. @@ -140,6 +141,11 @@ var _duration = defaults.duration; var _label = _getLabel(this); var _to ={ opacity:0 }; + + if (defaults.noAnimate) { + _label.hide(); + return false; + } if (defaults.slide) { _to.left = $(this).width()-_label.width(); @@ -154,7 +160,13 @@ _blur = function() { if (_noVal(this) ) { var _duration = defaults.duration; + var _label = _getLabel(this); var _to ={ opacity:1 }; + + if (defaults.noAnimate) { + _label.show(); + return false; + } if (defaults.slide) { _to.left = defaults.labelLeft; @@ -162,7 +174,7 @@ _duration = defaults.fadeDuration; } - _getLabel(this).animate(_to, _duration, defaults.easingOut); + _label.animate(_to, _duration, defaults.easingOut); } }; _keyup = function() { @@ -174,11 +186,17 @@ return false; } + // If the field is empty and the label isn't showing, make it show up again. if (_noVal(this) && !_label.css('opacity') == 0) { + if (defaults.noAnimate) { + _label.show(); + return false; + } + _o = defaults.opacity; } - + _label.animate({ opacity:_o }, defaults.fadeDuration, defaults.easingOut); }; From 8d78f1cc599ed0be48385fe0335b07c41be58248 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Bach?= Date: Mon, 5 Mar 2012 10:32:36 +0000 Subject: [PATCH 06/56] Add new noAnimate option! --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index f49a434..371376f 100644 --- a/README.md +++ b/README.md @@ -41,6 +41,8 @@ There are quite a number of options you can pass the plugin additional to the tw * `easingIn` - The easing in function to use for the slide. _(default: 'easeInOutCubic')_ * `easingOut` - The easing out function to use for the slide. _(default: 'easeInOutCubic')_ * `fadeDuration` - Duration of animation when it's fade only. _(default: 250)_ +* `noAnimate` - Whether or not to animate. If set to true, will function the same as a normal placeholder. _(default:false)_ + * This is a 'just in case' option that can/should be used when there are performance issues with animating. * `opacity` - The opacity to fade the label to. _(default: 0.5)_ * `labelLeft` - The distance from the left for the label. _(default: 0)_ * `labelTop` - The distance from the top for the label. _(default: 0)_ From d6f8f611399da1864626f3aa213eeb7b513b9d2e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Bach?= Date: Mon, 5 Mar 2012 10:51:32 +0000 Subject: [PATCH 07/56] Don't bother trying to show the label again on keyup if noAnimate is true. --- jquery.superLabels.js | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/jquery.superLabels.js b/jquery.superLabels.js index 7c7fecd..6974125 100644 --- a/jquery.superLabels.js +++ b/jquery.superLabels.js @@ -178,6 +178,8 @@ } }; _keyup = function() { + if (defaults.noAnimate) return false; // We don't need any keyup checking done if we're not animating (the label would be in the way while trying to type). + var _label = _getLabel(this); var _o = 0; @@ -189,11 +191,6 @@ // If the field is empty and the label isn't showing, make it show up again. if (_noVal(this) && !_label.css('opacity') == 0) { - if (defaults.noAnimate) { - _label.show(); - return false; - } - _o = defaults.opacity; } From 06ba617c97d7d189fb5bbef467f23cd0fbd8bc3a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Bach?= Date: Mon, 5 Mar 2012 10:54:53 +0000 Subject: [PATCH 08/56] Pedantic update to the ordering of the options. --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 371376f..e839752 100644 --- a/README.md +++ b/README.md @@ -41,11 +41,11 @@ There are quite a number of options you can pass the plugin additional to the tw * `easingIn` - The easing in function to use for the slide. _(default: 'easeInOutCubic')_ * `easingOut` - The easing out function to use for the slide. _(default: 'easeInOutCubic')_ * `fadeDuration` - Duration of animation when it's fade only. _(default: 250)_ +* `labelLeft` - The distance from the left for the label. _(default: 0)_ +* `labelTop` - The distance from the top for the label. _(default: 0)_ * `noAnimate` - Whether or not to animate. If set to true, will function the same as a normal placeholder. _(default:false)_ * This is a 'just in case' option that can/should be used when there are performance issues with animating. * `opacity` - The opacity to fade the label to. _(default: 0.5)_ -* `labelLeft` - The distance from the left for the label. _(default: 0)_ -* `labelTop` - The distance from the top for the label. _(default: 0)_ * `slide` - Whether or not to slide the label across the input field. _(default: true)_ * `wrapSelector` - The selector for the element you have wrapping each field. _(default: false)_ * This is used to find the label - use as a last resort. Rather make sure the field and label are next to each other in your markup, or failing that, that your labels use the `for` attribute that point to the field's `name` or `id`. From fc1091dfe48ccf6acd19f09692164a2ffaef45c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Bach?= Date: Thu, 15 Mar 2012 13:16:03 +0000 Subject: [PATCH 09/56] Remove any NaNs from the left and top positions (so you could pass in '5px' for example) --- jquery.superLabels.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/jquery.superLabels.js b/jquery.superLabels.js index 6974125..e225f59 100644 --- a/jquery.superLabels.js +++ b/jquery.superLabels.js @@ -29,6 +29,10 @@ $.fn.superLabels = function(options) { // If this has been run on an empty set of elements, pop out. if (this.length === 0) return false; + + // Remove any NaNs from the left and top positions (so you could pass in 5px for example) + options.labelLeft = Number(options.labelLeft.replace(/\D+/, '')); + options.labelTop = Number(options.labelTop.replace(/\D+/, '')); // If options were passed in, merge them with the defaults. $.extend(defaults, options || {}); From 02710c36bbac672d99b777915a21e0123e98973c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Bach?= Date: Thu, 15 Mar 2012 13:18:16 +0000 Subject: [PATCH 10/56] Update the labelLeft and labelTop description to mention ability to pass values with 'px'. --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index e839752..c34b253 100644 --- a/README.md +++ b/README.md @@ -42,7 +42,9 @@ There are quite a number of options you can pass the plugin additional to the tw * `easingOut` - The easing out function to use for the slide. _(default: 'easeInOutCubic')_ * `fadeDuration` - Duration of animation when it's fade only. _(default: 250)_ * `labelLeft` - The distance from the left for the label. _(default: 0)_ + * You can pass in 'px' if you're the pedantic type. For example: `labelLeft:'5px'` * `labelTop` - The distance from the top for the label. _(default: 0)_ + * As above: `labelTop:'5px'` * `noAnimate` - Whether or not to animate. If set to true, will function the same as a normal placeholder. _(default:false)_ * This is a 'just in case' option that can/should be used when there are performance issues with animating. * `opacity` - The opacity to fade the label to. _(default: 0.5)_ From 3a49b36424ce9e627d7a9522f98d27186ef2f6c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Bach?= Date: Thu, 15 Mar 2012 13:32:36 +0000 Subject: [PATCH 11/56] Doh! Actually check whether labelLeft or labelTop are NOT numbers before trying to pull out the numbers. --- jquery.superLabels.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/jquery.superLabels.js b/jquery.superLabels.js index e225f59..38848ec 100644 --- a/jquery.superLabels.js +++ b/jquery.superLabels.js @@ -30,9 +30,11 @@ // If this has been run on an empty set of elements, pop out. if (this.length === 0) return false; - // Remove any NaNs from the left and top positions (so you could pass in 5px for example) - options.labelLeft = Number(options.labelLeft.replace(/\D+/, '')); - options.labelTop = Number(options.labelTop.replace(/\D+/, '')); + // Remove any NaNs from the positions (if present) + if (isNaN(options.labelLeft)) + options.labelLeft = Number(options.labelLeft.replace(/\D+/, '')); + if (isNaN(options.labelTop)) + options.labelTop = Number(options.labelTop.replace(/\D+/, '')); // If options were passed in, merge them with the defaults. $.extend(defaults, options || {}); From 3e1eddb09fa5871d28a8a7e4f8e8f626266b4214 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Bach?= Date: Mon, 19 Mar 2012 23:05:21 +0000 Subject: [PATCH 12/56] Bug fix on the new 'passing in px' functionality. --- jquery.superLabels.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/jquery.superLabels.js b/jquery.superLabels.js index 38848ec..2e6efa6 100644 --- a/jquery.superLabels.js +++ b/jquery.superLabels.js @@ -31,9 +31,9 @@ if (this.length === 0) return false; // Remove any NaNs from the positions (if present) - if (isNaN(options.labelLeft)) + if (options && options.labelLeft && isNaN(options.labelLeft)) options.labelLeft = Number(options.labelLeft.replace(/\D+/, '')); - if (isNaN(options.labelTop)) + if (options && options.labelTop && isNaN(options.labelTop)) options.labelTop = Number(options.labelTop.replace(/\D+/, '')); // If options were passed in, merge them with the defaults. From 793b840ce856898e193bec9a23890c20462a912e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Bach?= Date: Wed, 28 Mar 2012 12:20:13 +0200 Subject: [PATCH 13/56] Include the 'number' input type. --- jquery.superLabels.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jquery.superLabels.js b/jquery.superLabels.js index 2e6efa6..085f646 100644 --- a/jquery.superLabels.js +++ b/jquery.superLabels.js @@ -23,7 +23,7 @@ wrapSelector:false // The selector for the element you have wrapping each field. }; - var acceptedInputTypes = ['text', 'search', 'url', 'tel', 'email', 'password']; + var acceptedInputTypes = ['text', 'search', 'url', 'tel', 'email', 'password', 'number']; var acceptedElements = ['input', 'textarea', 'select']; $.fn.superLabels = function(options) { From 291b972e1d175c1526be60abdfb9039864e5752b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Bach?= Date: Wed, 28 Mar 2012 13:49:44 +0200 Subject: [PATCH 14/56] Add input[type="number"] to the supported input types. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index c34b253..cee1e47 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ This plugin was born out of the need to use the label-over-field method for forms I was working on. There are other plugins out there that do pretty much the same thing, but none of them had the - for lack of a better word - sexiness that I was looking for. This implementation makes the label slide across the field☨ when gaining focus and fade out when a value is entered. -This method only really works for the following: input[type="text"], input[type="search"], input[type="url"], input[type="tel"], input[type="email"], input[type="password"], textarea, and even on select fields. +This method only really works for the following: input[type="text"], input[type="search"], input[type="url"], input[type="tel"], input[type="email"], input[type="password"], input[type="number"], textarea, and finally there's select field support thrown in too. ☨ Uses the easing plugin if available. From 1358b69e102f97d88cdf289fd679469df5d30709 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Bach?= Date: Mon, 2 Apr 2012 18:19:51 +0200 Subject: [PATCH 15/56] Fix bug where the labels weren't showing up again after having been pre-filled. --- jquery.superLabels.js | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/jquery.superLabels.js b/jquery.superLabels.js index 085f646..e9e6a01 100644 --- a/jquery.superLabels.js +++ b/jquery.superLabels.js @@ -128,12 +128,10 @@ _label.css('display','none'); } else { - // If the field already has a value, then hide the label. - if (!_noVal(_field)) _label.hide(); - _field.css({ zIndex:defaults.baseZindex+1 }).addClass('sl_field'); _label.css({ - left:defaults.labelLeft, + left:_noVal(_field) ? defaults.labelLeft : $(_field).width()-_label.width(), + opacity:_noVal(_field) ? 1 : 0, position:'absolute', top:defaults.labelTop, zIndex:defaults.baseZindex+2 @@ -190,13 +188,13 @@ var _o = 0; // Let's check whether there's even a need to animate anything first. - if ((_noVal(this) && _label.css('opacity') > 0) || (!_noVal(this) && _label.css('opacity') == 0 )) { + if ((_noVal(this) && _label.css('opacity') > 0) || (!_noVal(this) && _label.css('opacity') === 0 )) { return false; } // If the field is empty and the label isn't showing, make it show up again. - if (_noVal(this) && !_label.css('opacity') == 0) { + if (_noVal(this) && _label.css('opacity') !== 0) { _o = defaults.opacity; } From 74d7d12c0a220ddfa08d019cac80c7fc9339f91b Mon Sep 17 00:00:00 2001 From: Remy Bach Date: Wed, 4 Apr 2012 13:26:14 +0100 Subject: [PATCH 16/56] Version bump. --- jquery.superLabels.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jquery.superLabels.js b/jquery.superLabels.js index e9e6a01..7c46949 100644 --- a/jquery.superLabels.js +++ b/jquery.superLabels.js @@ -1,7 +1,7 @@ /* * Title: jQuery Super Labels Plugin - Give your forms a helping of awesome! * Author: Rémy Bach - * Version: 1.0 + * Version: 1.0.1 * License: http://remybach.mit-license.org * Url: http://github.com/remybach/jQuery.superLabels * Description: From 7da00469594881cc3561c7f25a4e48f420afd293 Mon Sep 17 00:00:00 2001 From: Remy Bach Date: Wed, 4 Apr 2012 13:27:20 +0100 Subject: [PATCH 17/56] Add minified version. --- README.md | 1 + jquery.superLabels.min.js | 10 ++++++++++ 2 files changed, 11 insertions(+) create mode 100644 jquery.superLabels.min.js diff --git a/README.md b/README.md index cee1e47..7ac44d4 100644 --- a/README.md +++ b/README.md @@ -37,6 +37,7 @@ There are quite a number of options you can pass the plugin additional to the tw * `baseZindex` - The base z-index which we display on top of. _(default: 0)_ * `debug` - Whether or not to show console messages. _(default: false)_ + * Note: this is not available in the minified version. * `duration` - Time of the slide in milliseconds. _(default: 500)_ * `easingIn` - The easing in function to use for the slide. _(default: 'easeInOutCubic')_ * `easingOut` - The easing out function to use for the slide. _(default: 'easeInOutCubic')_ diff --git a/jquery.superLabels.min.js b/jquery.superLabels.min.js new file mode 100644 index 0000000..a316844 --- /dev/null +++ b/jquery.superLabels.min.js @@ -0,0 +1,10 @@ +/* + * Title: jQuery Super Labels Plugin - Give your forms a helping of awesome! + * Author: Rémy Bach + * Version: 1.0.1 + * License: http://remybach.mit-license.org + * Url: http://github.com/remybach/jQuery.superLabels + * Description: + * This plugin allows you to display your form labels on top of your form fields, saving you space on your page. + */ +(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); \ No newline at end of file From ddf4c7d7cbcc535db7604d6e376efa1e7acfd016 Mon Sep 17 00:00:00 2001 From: Remy Bach Date: Mon, 16 Apr 2012 10:14:24 +0100 Subject: [PATCH 18/56] Make the field change functionality a bit more comprehensive. Includes checking for the 'onpropertychange' event (props to @davatron5000 for that one). --- jquery.superLabels.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/jquery.superLabels.js b/jquery.superLabels.js index 7c46949..91e52e1 100644 --- a/jquery.superLabels.js +++ b/jquery.superLabels.js @@ -89,6 +89,8 @@ _field.focus(_focus); // What happens when we leave the field. _field.blur(_blur); + _field.change(_blur); + _field.bind('propertychange', _blur); // Check for when the user is typing _field.keyup(_keyup); // Make sure the field gets focus when the label is clicked on (for those people who don't use the 'for' attribute and deserve a kick to the face). From cf47e5c1c4e338897a7b56e348c1ceab31adf899 Mon Sep 17 00:00:00 2001 From: Remy Bach Date: Mon, 16 Apr 2012 10:15:08 +0100 Subject: [PATCH 19/56] Updated minified version. --- jquery.superLabels.min.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jquery.superLabels.min.js b/jquery.superLabels.min.js index a316844..55ed021 100644 --- a/jquery.superLabels.min.js +++ b/jquery.superLabels.min.js @@ -7,4 +7,4 @@ * Description: * This plugin allows you to display your form labels on top of your form fields, saving you space on your page. */ -(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); \ No newline at end of file +(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('");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('");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) \ No newline at end of file From 13150ce23e7512580138f9ea0ddcb7c5e208b2da Mon Sep 17 00:00:00 2001 From: Remy Bach Date: Fri, 20 Apr 2012 16:37:04 +0100 Subject: [PATCH 20/56] Fix call to undefined _info function. --- jquery.superLabels.min.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jquery.superLabels.min.js b/jquery.superLabels.min.js index 55ed021..bf11922 100644 --- a/jquery.superLabels.min.js +++ b/jquery.superLabels.min.js @@ -7,4 +7,4 @@ * Description: * This plugin allows you to display your form labels on top of your form fields, saving you space on your page. */ -(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('");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('");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) \ No newline at end of file +(function(c){var d={baseZindex:0,duration:500,easingIn:(c.easing.def?"easeInOutCubic":false),easingOut:(c.easing.def?"easeInOutCubic":false),fadeDuration:250,labelLeft:0,labelTop:0,noAnimate:false,opacity:0.5,slide:true,wrapSelector:false};var a=["text","search","url","tel","email","password","number"];var b=["input","textarea","select"];c.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+/,""))}c.extend(d,e||{});var f=this;if(this.length===1&&this[0].tagName.match(/form/i)){f=c(b.join(","),this)}return f.each(function(){var i=c(this);if((i[0].tagName.toLowerCase()==="input"&&c.inArray(i.attr("type"),a))===-1&&c.inArray(i[0].tagName.toLowerCase(),b)!==-1){return true}var j=_getLabel(this);var h=i.attr("placeholder");if(h){var g=c('");if(j.length===0){j=g;i.prev(j)}else{j.replaceWith(g)}i.removeAttr("placeholder")}if(j.length===0){return true}_prepLabel(i,j);if(!this.tagName.match(/select/i)){i.focus(_focus);i.blur(_blur);i.change(_blur);i.bind("propertychange",_blur);i.keyup(_keyup);j.click(function(){i.focus()})}})};_getLabel=function(e){var f=c(e).siblings("label");if(f.length===0){if(d.wrapSelector){f=c(e).parents(d.wrapSelector).find("label")}else{_for=e.id||e.name;f=c('[for="'+_for+'"]')}}return f};_prepLabel=function(e,g){if(e[0].tagName.match(/select/i)){var f=e.find("[selected]").length===0?" selected":"";e.prepend('");g.css("display","none")}else{e.css({zIndex:d.baseZindex+1}).addClass("sl_field");g.css({left:_noVal(e)?d.labelLeft:c(e).width()-g.width(),opacity:_noVal(e)?1:0,position:"absolute",top:d.labelTop,zIndex:d.baseZindex+2}).addClass("sl_label")}};_focus=function(){if(_noVal(this)){var g=d.duration;var f=_getLabel(this);var e={opacity:0};if(d.noAnimate){f.hide();return false}if(d.slide){e.left=c(this).width()-f.width();e.opacity=d.opacity}else{g=d.fadeDuration}f.animate(e,g,d.easingOut)}};_blur=function(){if(_noVal(this)){var g=d.duration;var f=_getLabel(this);var e={opacity:1};if(d.noAnimate){f.show();return false}if(d.slide){e.left=d.labelLeft}else{g=d.fadeDuration}f.animate(e,g,d.easingOut)}};_keyup=function(){if(d.noAnimate){return false}var f=_getLabel(this);var e=0;if((_noVal(this)&&f.css("opacity")>0)||(!_noVal(this)&&f.css("opacity")===0)){return false}if(_noVal(this)&&f.css("opacity")!==0){e=d.opacity}f.animate({opacity:e},d.fadeDuration,d.easingOut)};_noVal=function(e){return c(e).val()===""}})(jQuery); \ No newline at end of file From 559a9339a8aebb08075bf6314643adbd6c69b9de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Bach?= Date: Wed, 23 May 2012 21:18:10 +0200 Subject: [PATCH 21/56] Add note about loading superLabels *after* DOM ready. --- README.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 7ac44d4..2025583 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,10 @@ You need to make sure that the element containing both the field and the label h The quickest and easiest way to use this plugin is as follows: - $('form').superLabels(); + // Don't forget to do this *after* the DOM has loaded. + jQuery(function($) { + $('form').superLabels(); + }); Running the plugin on a form will automatically apply the magic to the accepted fields listed above. From a5f2841927a4023740facb267d310057b1f5d18e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Bach?= Date: Wed, 23 May 2012 21:19:09 +0200 Subject: [PATCH 22/56] Safety ; (sigh) --- jquery.superLabels.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jquery.superLabels.js b/jquery.superLabels.js index 91e52e1..f17f72b 100644 --- a/jquery.superLabels.js +++ b/jquery.superLabels.js @@ -7,7 +7,7 @@ * Description: * This plugin allows you to display your form labels on top of your form fields, saving you space on your page. */ -(function($) { +;(function($) { var defaults = { baseZindex:0, // The base z-index which we display on top of. debug:false, From c46f3b5756eb63e62d29bdf6dc9cd2d29bc105e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Bach?= Date: Wed, 23 May 2012 21:19:27 +0200 Subject: [PATCH 23/56] Safety ; (sigh) --- jquery.superLabels.min.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jquery.superLabels.min.js b/jquery.superLabels.min.js index bf11922..8f64a77 100644 --- a/jquery.superLabels.min.js +++ b/jquery.superLabels.min.js @@ -7,4 +7,4 @@ * Description: * This plugin allows you to display your form labels on top of your form fields, saving you space on your page. */ -(function(c){var d={baseZindex:0,duration:500,easingIn:(c.easing.def?"easeInOutCubic":false),easingOut:(c.easing.def?"easeInOutCubic":false),fadeDuration:250,labelLeft:0,labelTop:0,noAnimate:false,opacity:0.5,slide:true,wrapSelector:false};var a=["text","search","url","tel","email","password","number"];var b=["input","textarea","select"];c.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+/,""))}c.extend(d,e||{});var f=this;if(this.length===1&&this[0].tagName.match(/form/i)){f=c(b.join(","),this)}return f.each(function(){var i=c(this);if((i[0].tagName.toLowerCase()==="input"&&c.inArray(i.attr("type"),a))===-1&&c.inArray(i[0].tagName.toLowerCase(),b)!==-1){return true}var j=_getLabel(this);var h=i.attr("placeholder");if(h){var g=c('");if(j.length===0){j=g;i.prev(j)}else{j.replaceWith(g)}i.removeAttr("placeholder")}if(j.length===0){return true}_prepLabel(i,j);if(!this.tagName.match(/select/i)){i.focus(_focus);i.blur(_blur);i.change(_blur);i.bind("propertychange",_blur);i.keyup(_keyup);j.click(function(){i.focus()})}})};_getLabel=function(e){var f=c(e).siblings("label");if(f.length===0){if(d.wrapSelector){f=c(e).parents(d.wrapSelector).find("label")}else{_for=e.id||e.name;f=c('[for="'+_for+'"]')}}return f};_prepLabel=function(e,g){if(e[0].tagName.match(/select/i)){var f=e.find("[selected]").length===0?" selected":"";e.prepend('");g.css("display","none")}else{e.css({zIndex:d.baseZindex+1}).addClass("sl_field");g.css({left:_noVal(e)?d.labelLeft:c(e).width()-g.width(),opacity:_noVal(e)?1:0,position:"absolute",top:d.labelTop,zIndex:d.baseZindex+2}).addClass("sl_label")}};_focus=function(){if(_noVal(this)){var g=d.duration;var f=_getLabel(this);var e={opacity:0};if(d.noAnimate){f.hide();return false}if(d.slide){e.left=c(this).width()-f.width();e.opacity=d.opacity}else{g=d.fadeDuration}f.animate(e,g,d.easingOut)}};_blur=function(){if(_noVal(this)){var g=d.duration;var f=_getLabel(this);var e={opacity:1};if(d.noAnimate){f.show();return false}if(d.slide){e.left=d.labelLeft}else{g=d.fadeDuration}f.animate(e,g,d.easingOut)}};_keyup=function(){if(d.noAnimate){return false}var f=_getLabel(this);var e=0;if((_noVal(this)&&f.css("opacity")>0)||(!_noVal(this)&&f.css("opacity")===0)){return false}if(_noVal(this)&&f.css("opacity")!==0){e=d.opacity}f.animate({opacity:e},d.fadeDuration,d.easingOut)};_noVal=function(e){return c(e).val()===""}})(jQuery); \ No newline at end of file +;(function(c){var d={baseZindex:0,duration:500,easingIn:(c.easing.def?"easeInOutCubic":false),easingOut:(c.easing.def?"easeInOutCubic":false),fadeDuration:250,labelLeft:0,labelTop:0,noAnimate:false,opacity:0.5,slide:true,wrapSelector:false};var a=["text","search","url","tel","email","password","number"];var b=["input","textarea","select"];c.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+/,""))}c.extend(d,e||{});var f=this;if(this.length===1&&this[0].tagName.match(/form/i)){f=c(b.join(","),this)}return f.each(function(){var i=c(this);if((i[0].tagName.toLowerCase()==="input"&&c.inArray(i.attr("type"),a))===-1&&c.inArray(i[0].tagName.toLowerCase(),b)!==-1){return true}var j=_getLabel(this);var h=i.attr("placeholder");if(h){var g=c('");if(j.length===0){j=g;i.prev(j)}else{j.replaceWith(g)}i.removeAttr("placeholder")}if(j.length===0){return true}_prepLabel(i,j);if(!this.tagName.match(/select/i)){i.focus(_focus);i.blur(_blur);i.change(_blur);i.bind("propertychange",_blur);i.keyup(_keyup);j.click(function(){i.focus()})}})};_getLabel=function(e){var f=c(e).siblings("label");if(f.length===0){if(d.wrapSelector){f=c(e).parents(d.wrapSelector).find("label")}else{_for=e.id||e.name;f=c('[for="'+_for+'"]')}}return f};_prepLabel=function(e,g){if(e[0].tagName.match(/select/i)){var f=e.find("[selected]").length===0?" selected":"";e.prepend('");g.css("display","none")}else{e.css({zIndex:d.baseZindex+1}).addClass("sl_field");g.css({left:_noVal(e)?d.labelLeft:c(e).width()-g.width(),opacity:_noVal(e)?1:0,position:"absolute",top:d.labelTop,zIndex:d.baseZindex+2}).addClass("sl_label")}};_focus=function(){if(_noVal(this)){var g=d.duration;var f=_getLabel(this);var e={opacity:0};if(d.noAnimate){f.hide();return false}if(d.slide){e.left=c(this).width()-f.width();e.opacity=d.opacity}else{g=d.fadeDuration}f.animate(e,g,d.easingOut)}};_blur=function(){if(_noVal(this)){var g=d.duration;var f=_getLabel(this);var e={opacity:1};if(d.noAnimate){f.show();return false}if(d.slide){e.left=d.labelLeft}else{g=d.fadeDuration}f.animate(e,g,d.easingOut)}};_keyup=function(){if(d.noAnimate){return false}var f=_getLabel(this);var e=0;if((_noVal(this)&&f.css("opacity")>0)||(!_noVal(this)&&f.css("opacity")===0)){return false}if(_noVal(this)&&f.css("opacity")!==0){e=d.opacity}f.animate({opacity:e},d.fadeDuration,d.easingOut)};_noVal=function(e){return c(e).val()===""}})(jQuery); \ No newline at end of file From 5735aafdddce91370ed5870fea2743446abfa74c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Bach?= Date: Sat, 30 Jun 2012 13:59:38 +0200 Subject: [PATCH 24/56] Add links to bug reports regarding the auto fill issue. (One filed for Chrome and another found for Firefox) --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 2025583..fb8b53d 100644 --- a/README.md +++ b/README.md @@ -60,7 +60,7 @@ There are quite a number of options you can pass the plugin additional to the tw Below I'll list any bugs that I'm aware of and will try to get around to fixing as soon as I can. -* Auto filling of form fields that is performed by some browsers causes a visual bug. Currently the label stays visible and positioned on top of the field while the field has a value. +* Auto filling of form fields that is performed by some browsers causes a visual bug. Currently the label stays visible and positioned on top of the field while the field has a value. I've submitted a bug report for Chrome [here](https://code.google.com/p/chromium/issues/detail?id=135307), and have found a bug report for Firefox [here](https://bugzilla.mozilla.org/show_bug.cgi?id=184761). #### License From af1c9140d9d445eced77e672029c5a4e11930c16 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Bach?= Date: Sun, 1 Jul 2012 09:54:07 +0200 Subject: [PATCH 25/56] Fix the autofill bug in chrome + version bump! (Woooooooooo) --- jquery.superLabels.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/jquery.superLabels.js b/jquery.superLabels.js index f17f72b..6db9bac 100644 --- a/jquery.superLabels.js +++ b/jquery.superLabels.js @@ -1,7 +1,7 @@ /* * Title: jQuery Super Labels Plugin - Give your forms a helping of awesome! * Author: Rémy Bach - * Version: 1.0.1 + * Version: 1.0.2 * License: http://remybach.mit-license.org * Url: http://github.com/remybach/jQuery.superLabels * Description: @@ -90,6 +90,8 @@ // What happens when we leave the field. _field.blur(_blur); _field.change(_blur); + // Autofil bug fixes + _field.bind('input', _keyup); // For the currently selected field. _field.bind('propertychange', _blur); // Check for when the user is typing _field.keyup(_keyup); @@ -164,7 +166,7 @@ } }; _blur = function() { - if (_noVal(this) ) { + if (_noVal(this)) { var _duration = defaults.duration; var _label = _getLabel(this); var _to ={ opacity:1 }; @@ -181,6 +183,9 @@ } _label.animate(_to, _duration, defaults.easingOut); + } else { + // If there is a value, and the label is visible, fire our _keyup function so as to hide it. (this semi-fixes the autofill bug) + _keyup.apply(this); } }; _keyup = function() { From 62fc36e271aa354c38c3f19410c97ff9de857485 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Bach?= Date: Sun, 1 Jul 2012 09:55:03 +0200 Subject: [PATCH 26/56] Updated minified version with Chrome autofill fix. --- jquery.superLabels.min.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/jquery.superLabels.min.js b/jquery.superLabels.min.js index 8f64a77..dbea4ef 100644 --- a/jquery.superLabels.min.js +++ b/jquery.superLabels.min.js @@ -1,10 +1,10 @@ /* - * Title: jQuery Super Labels Plugin - Give your forms a helping of awesome! - * Author: Rémy Bach - * Version: 1.0.1 + * Title: jQuery Super Labels Plugin - Give your forms a helping of awesome! + * Author: Rémy Bach + * Version: 1.0.2 * License: http://remybach.mit-license.org * Url: http://github.com/remybach/jQuery.superLabels * Description: * This plugin allows you to display your form labels on top of your form fields, saving you space on your page. */ -;(function(c){var d={baseZindex:0,duration:500,easingIn:(c.easing.def?"easeInOutCubic":false),easingOut:(c.easing.def?"easeInOutCubic":false),fadeDuration:250,labelLeft:0,labelTop:0,noAnimate:false,opacity:0.5,slide:true,wrapSelector:false};var a=["text","search","url","tel","email","password","number"];var b=["input","textarea","select"];c.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+/,""))}c.extend(d,e||{});var f=this;if(this.length===1&&this[0].tagName.match(/form/i)){f=c(b.join(","),this)}return f.each(function(){var i=c(this);if((i[0].tagName.toLowerCase()==="input"&&c.inArray(i.attr("type"),a))===-1&&c.inArray(i[0].tagName.toLowerCase(),b)!==-1){return true}var j=_getLabel(this);var h=i.attr("placeholder");if(h){var g=c('");if(j.length===0){j=g;i.prev(j)}else{j.replaceWith(g)}i.removeAttr("placeholder")}if(j.length===0){return true}_prepLabel(i,j);if(!this.tagName.match(/select/i)){i.focus(_focus);i.blur(_blur);i.change(_blur);i.bind("propertychange",_blur);i.keyup(_keyup);j.click(function(){i.focus()})}})};_getLabel=function(e){var f=c(e).siblings("label");if(f.length===0){if(d.wrapSelector){f=c(e).parents(d.wrapSelector).find("label")}else{_for=e.id||e.name;f=c('[for="'+_for+'"]')}}return f};_prepLabel=function(e,g){if(e[0].tagName.match(/select/i)){var f=e.find("[selected]").length===0?" selected":"";e.prepend('");g.css("display","none")}else{e.css({zIndex:d.baseZindex+1}).addClass("sl_field");g.css({left:_noVal(e)?d.labelLeft:c(e).width()-g.width(),opacity:_noVal(e)?1:0,position:"absolute",top:d.labelTop,zIndex:d.baseZindex+2}).addClass("sl_label")}};_focus=function(){if(_noVal(this)){var g=d.duration;var f=_getLabel(this);var e={opacity:0};if(d.noAnimate){f.hide();return false}if(d.slide){e.left=c(this).width()-f.width();e.opacity=d.opacity}else{g=d.fadeDuration}f.animate(e,g,d.easingOut)}};_blur=function(){if(_noVal(this)){var g=d.duration;var f=_getLabel(this);var e={opacity:1};if(d.noAnimate){f.show();return false}if(d.slide){e.left=d.labelLeft}else{g=d.fadeDuration}f.animate(e,g,d.easingOut)}};_keyup=function(){if(d.noAnimate){return false}var f=_getLabel(this);var e=0;if((_noVal(this)&&f.css("opacity")>0)||(!_noVal(this)&&f.css("opacity")===0)){return false}if(_noVal(this)&&f.css("opacity")!==0){e=d.opacity}f.animate({opacity:e},d.fadeDuration,d.easingOut)};_noVal=function(e){return c(e).val()===""}})(jQuery); \ No newline at end of file +;(function(c){var d={baseZindex:0,duration:500,easingIn:(c.easing.def?"easeInOutCubic":false),easingOut:(c.easing.def?"easeInOutCubic":false),fadeDuration:250,labelLeft:0,labelTop:0,noAnimate:false,opacity:0.5,slide:true,wrapSelector:false};var a=["text","search","url","tel","email","password","number"];var b=["input","textarea","select"];c.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+/,""))}c.extend(d,e||{});var f=this;if(this.length===1&&this[0].tagName.match(/form/i)){f=c(b.join(","),this)}return f.each(function(){var i=c(this);if((i[0].tagName.toLowerCase()==="input"&&c.inArray(i.attr("type"),a))===-1&&c.inArray(i[0].tagName.toLowerCase(),b)!==-1){return true}var j=_getLabel(this);var h=i.attr("placeholder");if(h){var g=c('");if(j.length===0){j=g;i.prev(j)}else{j.replaceWith(g)}i.removeAttr("placeholder")}if(j.length===0){return true}_prepLabel(i,j);if(!this.tagName.match(/select/i)){i.focus(_focus);i.blur(_blur);i.change(_blur);i.bind("input",_keyup);i.bind("propertychange",_blur);i.keyup(_keyup);j.click(function(){i.focus()})}})};_getLabel=function(e){var f=c(e).siblings("label");if(f.length===0){if(d.wrapSelector){f=c(e).parents(d.wrapSelector).find("label")}else{_for=e.id||e.name;f=c('[for="'+_for+'"]')}}return f};_prepLabel=function(e,g){if(e[0].tagName.match(/select/i)){var f=e.find("[selected]").length===0?" selected":"";e.prepend('");g.css("display","none")}else{e.css({zIndex:d.baseZindex+1}).addClass("sl_field");g.css({left:_noVal(e)?d.labelLeft:c(e).width()-g.width(),opacity:_noVal(e)?1:0,position:"absolute",top:d.labelTop,zIndex:d.baseZindex+2}).addClass("sl_label")}};_focus=function(){if(_noVal(this)){var g=d.duration;var f=_getLabel(this);var e={opacity:0};if(d.noAnimate){f.hide();return false}if(d.slide){e.left=c(this).width()-f.width();e.opacity=d.opacity}else{g=d.fadeDuration}f.animate(e,g,d.easingOut)}};_blur=function(){if(_noVal(this)){var g=d.duration;var f=_getLabel(this);var e={opacity:1};if(d.noAnimate){f.show();return false}if(d.slide){e.left=d.labelLeft}else{g=d.fadeDuration}f.animate(e,g,d.easingOut)}else{_keyup.apply(this)}};_keyup=function(){if(d.noAnimate){return false}var f=_getLabel(this);var e=0;if((_noVal(this)&&f.css("opacity")>0)||(!_noVal(this)&&f.css("opacity")===0)){return false}if(_noVal(this)&&f.css("opacity")!==0){e=d.opacity}f.animate({opacity:e},d.fadeDuration,d.easingOut)};_noVal=function(e){return c(e).val()===""}})(jQuery); \ No newline at end of file From a07920e8266cdcca7e571a551ced6ee6fac0b18b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Bach?= Date: Sun, 1 Jul 2012 09:56:12 +0200 Subject: [PATCH 27/56] Remove mention of chrome bug report. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index fb8b53d..e0a67d4 100644 --- a/README.md +++ b/README.md @@ -60,7 +60,7 @@ There are quite a number of options you can pass the plugin additional to the tw Below I'll list any bugs that I'm aware of and will try to get around to fixing as soon as I can. -* Auto filling of form fields that is performed by some browsers causes a visual bug. Currently the label stays visible and positioned on top of the field while the field has a value. I've submitted a bug report for Chrome [here](https://code.google.com/p/chromium/issues/detail?id=135307), and have found a bug report for Firefox [here](https://bugzilla.mozilla.org/show_bug.cgi?id=184761). +* Auto filling of form fields that is performed by some browsers (other than Chrome) causes a visual bug. Currently the label stays visible and positioned on top of the field while the field has a value. I've found a bug report for Firefox [here](https://bugzilla.mozilla.org/show_bug.cgi?id=184761). #### License From f696ff90c00858329a8eb3648a5abf7e858dbf4c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Bach?= Date: Fri, 10 Aug 2012 11:54:35 +0200 Subject: [PATCH 28/56] Add note about ability to select individual fields --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index e0a67d4..89d8054 100644 --- a/README.md +++ b/README.md @@ -34,6 +34,10 @@ If you find that you need to position the labels slightly differently, pass in ` labelTop:5 }); +Lastly, you can choose to ONLY apply superLabels to specific fields if you wish by selecting them instead of the form as follows: + + $('input.foo, textarea.bar, select.baz').superLabels(); + #### Advanced There are quite a number of options you can pass the plugin additional to the two I mentioned above: From 4f1e48eb0d432376668e4e1731952992b7b8670b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Bach?= Date: Wed, 15 Aug 2012 15:08:16 +0200 Subject: [PATCH 29/56] You can now pass more than one form! MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `$('.form1, .form2').superLabels();` now works as well as a mixture of forms and labels as follows:     $('.form1, .form2 input').superLabels(); --- jquery.superLabels.js | 47 ++++++++++++++++++++++++++----------------- 1 file changed, 29 insertions(+), 18 deletions(-) diff --git a/jquery.superLabels.js b/jquery.superLabels.js index 6db9bac..28d69ff 100644 --- a/jquery.superLabels.js +++ b/jquery.superLabels.js @@ -1,7 +1,7 @@ /* * Title: jQuery Super Labels Plugin - Give your forms a helping of awesome! * Author: Rémy Bach - * Version: 1.0.2 + * Version: 1.1.0 * License: http://remybach.mit-license.org * Url: http://github.com/remybach/jQuery.superLabels * Description: @@ -27,6 +27,8 @@ var acceptedElements = ['input', 'textarea', 'select']; $.fn.superLabels = function(options) { + var _fields = []; + // If this has been run on an empty set of elements, pop out. if (this.length === 0) return false; @@ -35,22 +37,31 @@ options.labelLeft = Number(options.labelLeft.replace(/\D+/, '')); if (options && options.labelTop && isNaN(options.labelTop)) options.labelTop = Number(options.labelTop.replace(/\D+/, '')); - + // If options were passed in, merge them with the defaults. $.extend(defaults, options || {}); if (!$.easing.def) { _info('Easing plugin not found - using standard jQuery animations.'); } - var _fields = this; - - // Check for whether the user has just passed in the form. If so, we need to fetch all the accepted fields, etc.. - if (this.length === 1 && this[0].tagName.match(/form/i)) { + // Check for whether the user has just passed in the form. If so, we need to fetch all the accepted fields. + if (this.length === 1 && /form/i.test(this[0].tagName)) { _fields = $(acceptedElements.join(','), this); + } else if (this.length > 1) { // we need to extrapolate these fields + this.each(function() { + if (/form/i.test(this.tagName)) { // if this is a form merge the accepted elements into the _fields array. + $.merge(_fields, $(acceptedElements.join(','), this)); + } else { + // This is a normal field, so just dump this one in. + _fields.push(this); + } + }); + } else { // If all else fails, assume the user passed in the fields individually + _fields = this; } // Do our magic on each form field. - return _fields.each(function() { + return $(_fields).each(function() { var _field = $(this); - + // Don't even bother going further if this isn't one of the accepted input field types or elements. if ((_field[0].tagName.toLowerCase() === 'input' && $.inArray(_field.attr('type'), acceptedInputTypes)) === -1 && $.inArray(_field[0].tagName.toLowerCase(), acceptedElements) !== -1) { _info('Doh! The following '+this.tagName.toLowerCase()+', is not supported.', this); @@ -73,7 +84,7 @@ } _field.removeAttr('placeholder'); } - + // Make sure this form field has a label if (_label.length === 0) { _info('Doh! The following '+this.tagName.toLowerCase()+' has no related label.', this); @@ -82,7 +93,7 @@ // Position the labels above the form fields. Note:We do this here and not in the CSS for the purposes of progressive enhancement. _prepLabel(_field, _label); - + // Select boxes don't need to have any fancy label stuff done. if (!this.tagName.match(/select/i)) { // What happens when we enter the field @@ -127,7 +138,7 @@ // before the page has loaded), so I'm going to assume that if the form is prefilled or values are remembered // between page loads, then the [selected attribute will be used. var _selected = _field.find('[selected]').length === 0 ? ' selected' : ''; - + _field.prepend(''); _label.css('display','none'); @@ -154,14 +165,14 @@ _label.hide(); return false; } - + if (defaults.slide) { _to.left = $(this).width()-_label.width(); _to.opacity = defaults.opacity; } else { _duration = defaults.fadeDuration; } - + _label.animate(_to, _duration, defaults.easingOut); } }; @@ -175,13 +186,13 @@ _label.show(); return false; } - + if (defaults.slide) { _to.left = defaults.labelLeft; } else { _duration = defaults.fadeDuration; } - + _label.animate(_to, _duration, defaults.easingOut); } else { // If there is a value, and the label is visible, fire our _keyup function so as to hide it. (this semi-fixes the autofill bug) @@ -190,10 +201,10 @@ }; _keyup = function() { if (defaults.noAnimate) return false; // We don't need any keyup checking done if we're not animating (the label would be in the way while trying to type). - + var _label = _getLabel(this); var _o = 0; - + // Let's check whether there's even a need to animate anything first. if ((_noVal(this) && _label.css('opacity') > 0) || (!_noVal(this) && _label.css('opacity') === 0 )) { return false; @@ -211,7 +222,7 @@ /*===== Utility Functions =====*/ // Tell us whether the form field has a value. _noVal = function(_el) { return $(_el).val() === ''; }; - + // Console Functions (We need these to make sure this only displays when the console exists.) _log = function() { if (defaults.debug && console && console.log) console.log.apply(console, arguments); }; _info = function() { if (defaults.debug && console && console.info) console.info.apply(console, arguments); }; From bea3ae5f2a532dfc30d6e5a1d127b5657f19625a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Bach?= Date: Wed, 15 Aug 2012 15:10:08 +0200 Subject: [PATCH 30/56] You can now pass more than one form! --- jquery.superLabels.min.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/jquery.superLabels.min.js b/jquery.superLabels.min.js index dbea4ef..06c0502 100644 --- a/jquery.superLabels.min.js +++ b/jquery.superLabels.min.js @@ -1,10 +1,10 @@ /* * Title: jQuery Super Labels Plugin - Give your forms a helping of awesome! - * Author: Rémy Bach - * Version: 1.0.2 + * Author: Rémy Bach + * Version: 1.1.0 * License: http://remybach.mit-license.org * Url: http://github.com/remybach/jQuery.superLabels * Description: * This plugin allows you to display your form labels on top of your form fields, saving you space on your page. */ -;(function(c){var d={baseZindex:0,duration:500,easingIn:(c.easing.def?"easeInOutCubic":false),easingOut:(c.easing.def?"easeInOutCubic":false),fadeDuration:250,labelLeft:0,labelTop:0,noAnimate:false,opacity:0.5,slide:true,wrapSelector:false};var a=["text","search","url","tel","email","password","number"];var b=["input","textarea","select"];c.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+/,""))}c.extend(d,e||{});var f=this;if(this.length===1&&this[0].tagName.match(/form/i)){f=c(b.join(","),this)}return f.each(function(){var i=c(this);if((i[0].tagName.toLowerCase()==="input"&&c.inArray(i.attr("type"),a))===-1&&c.inArray(i[0].tagName.toLowerCase(),b)!==-1){return true}var j=_getLabel(this);var h=i.attr("placeholder");if(h){var g=c('");if(j.length===0){j=g;i.prev(j)}else{j.replaceWith(g)}i.removeAttr("placeholder")}if(j.length===0){return true}_prepLabel(i,j);if(!this.tagName.match(/select/i)){i.focus(_focus);i.blur(_blur);i.change(_blur);i.bind("input",_keyup);i.bind("propertychange",_blur);i.keyup(_keyup);j.click(function(){i.focus()})}})};_getLabel=function(e){var f=c(e).siblings("label");if(f.length===0){if(d.wrapSelector){f=c(e).parents(d.wrapSelector).find("label")}else{_for=e.id||e.name;f=c('[for="'+_for+'"]')}}return f};_prepLabel=function(e,g){if(e[0].tagName.match(/select/i)){var f=e.find("[selected]").length===0?" selected":"";e.prepend('");g.css("display","none")}else{e.css({zIndex:d.baseZindex+1}).addClass("sl_field");g.css({left:_noVal(e)?d.labelLeft:c(e).width()-g.width(),opacity:_noVal(e)?1:0,position:"absolute",top:d.labelTop,zIndex:d.baseZindex+2}).addClass("sl_label")}};_focus=function(){if(_noVal(this)){var g=d.duration;var f=_getLabel(this);var e={opacity:0};if(d.noAnimate){f.hide();return false}if(d.slide){e.left=c(this).width()-f.width();e.opacity=d.opacity}else{g=d.fadeDuration}f.animate(e,g,d.easingOut)}};_blur=function(){if(_noVal(this)){var g=d.duration;var f=_getLabel(this);var e={opacity:1};if(d.noAnimate){f.show();return false}if(d.slide){e.left=d.labelLeft}else{g=d.fadeDuration}f.animate(e,g,d.easingOut)}else{_keyup.apply(this)}};_keyup=function(){if(d.noAnimate){return false}var f=_getLabel(this);var e=0;if((_noVal(this)&&f.css("opacity")>0)||(!_noVal(this)&&f.css("opacity")===0)){return false}if(_noVal(this)&&f.css("opacity")!==0){e=d.opacity}f.animate({opacity:e},d.fadeDuration,d.easingOut)};_noVal=function(e){return c(e).val()===""}})(jQuery); \ No newline at end of file +(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){var f=[];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||{});if(this.length===1&&/form/i.test(this[0].tagName)){f=a(d.join(","),this)}else if(this.length>1){this.each(function(){if(/form/i.test(this.tagName)){a.merge(f,a(d.join(","),this))}else{f.push(this)}})}else{f=this}return a(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){return true}var e=_getLabel(this);var f=b.attr("placeholder");if(f){var g=a('");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("input",_keyup);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('");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)}else{_keyup.apply(this)}};_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) \ No newline at end of file From 48d8b5954e01cca82d2775dfa14bba6a5844eb9a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Bach?= Date: Wed, 15 Aug 2012 15:49:08 +0200 Subject: [PATCH 31/56] Fix the way placeholder works. If there is a placeholder but NO label, the placeholder becomes the label. If there is a placeholder AND a label, the placeholder becomes the title of the label (and thus shows up when you hover on the label). --- jquery.superLabels.js | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/jquery.superLabels.js b/jquery.superLabels.js index 28d69ff..c91c65e 100644 --- a/jquery.superLabels.js +++ b/jquery.superLabels.js @@ -1,7 +1,7 @@ /* * Title: jQuery Super Labels Plugin - Give your forms a helping of awesome! * Author: Rémy Bach - * Version: 1.1.0 + * Version: 1.1.1 * License: http://remybach.mit-license.org * Url: http://github.com/remybach/jQuery.superLabels * Description: @@ -71,16 +71,20 @@ var _label = _getLabel(this); var _placeholder = _field.attr('placeholder'); - // Check for the placeholder attribute first. + // If there's a placeholder if (_placeholder) { - var _placeholderLabel = $(''); - - // If there isn't a label for this field, create one, otherwise replace the existing one with the placeholder one. + // but NO label, make a label using the placeholder if (_label.length === 0) { + var _placeholderLabel = ''; + _placeholderLabel+= ''; + _placeholderLabel = $(_placeholderLabel); + + // If there isn't a label for this field, create one, otherwise replace the existing one with the placeholder one. _label = _placeholderLabel; - _field.prev(_label); + _field.before(_label); } else { - _label.replaceWith(_placeholderLabel); + // Otherwise, just give the label a title with the placeholder + _label.attr('title', _placeholder); } _field.removeAttr('placeholder'); } From 842de28d1adaa75a8a87a41c79de1539d55e879e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Bach?= Date: Wed, 15 Aug 2012 15:50:23 +0200 Subject: [PATCH 32/56] Fix the way placeholder works. --- jquery.superLabels.min.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/jquery.superLabels.min.js b/jquery.superLabels.min.js index 06c0502..5991a77 100644 --- a/jquery.superLabels.min.js +++ b/jquery.superLabels.min.js @@ -1,10 +1,10 @@ /* * Title: jQuery Super Labels Plugin - Give your forms a helping of awesome! * Author: Rémy Bach - * Version: 1.1.0 + * Version: 1.1.1 * License: http://remybach.mit-license.org * Url: http://github.com/remybach/jQuery.superLabels * Description: * This plugin allows you to display your form labels on top of your form fields, saving you space on your page. */ -(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){var f=[];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||{});if(this.length===1&&/form/i.test(this[0].tagName)){f=a(d.join(","),this)}else if(this.length>1){this.each(function(){if(/form/i.test(this.tagName)){a.merge(f,a(d.join(","),this))}else{f.push(this)}})}else{f=this}return a(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){return true}var e=_getLabel(this);var f=b.attr("placeholder");if(f){var g=a('");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("input",_keyup);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('");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)}else{_keyup.apply(this)}};_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) \ No newline at end of file +(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){var f=[];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||{});if(this.length===1&&/form/i.test(this[0].tagName)){f=a(d.join(","),this)}else if(this.length>1){this.each(function(){if(/form/i.test(this.tagName)){a.merge(f,a(d.join(","),this))}else{f.push(this)}})}else{f=this}return a(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){return true}var e=_getLabel(this);var f=b.attr("placeholder");if(f){if(e.length===0){var g='";g+="";g=a(g);e=g;b.before(e)}else{e.attr("title",f)}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("input",_keyup);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('");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)}else{_keyup.apply(this)}};_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) \ No newline at end of file From 92cfac76df442f18ba0a96bec3d69d36b152fe01 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Bach?= Date: Wed, 15 Aug 2012 16:00:46 +0200 Subject: [PATCH 33/56] Update with info about placeholders. --- README.md | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 89d8054..65ec207 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ You need to make sure that the element containing both the field and the label h The quickest and easiest way to use this plugin is as follows: - // Don't forget to do this *after* the DOM has loaded. + // Don't forget to do this *after* the DOM has loaded. jQuery(function($) { $('form').superLabels(); }); @@ -60,7 +60,16 @@ There are quite a number of options you can pass the plugin additional to the tw * `wrapSelector` - The selector for the element you have wrapping each field. _(default: false)_ * This is used to find the label - use as a last resort. Rather make sure the field and label are next to each other in your markup, or failing that, that your labels use the `for` attribute that point to the field's `name` or `id`. -#### Known Bugs +## Concerning placeholders + +According to [the spec](http://www.w3.org/wiki/HTML/Elements/input/text) placeholders are meant to be used to represent "a short hint (a word or short phrase) intended to aid the user with data entry." *NOT* as a replacement for labels. + +The way superLabels uses placeholders (as of version 1.1.1) is as follows: + +* If there is a label AND a placeholder for the field, the placeholder becomes the label's title so that it shows up when you hover over the label. +* If there is JUST the placeholder, it becomes the label for the field. + +##Known Bugs Below I'll list any bugs that I'm aware of and will try to get around to fixing as soon as I can. @@ -68,4 +77,4 @@ Below I'll list any bugs that I'm aware of and will try to get around to fixing #### License -MIT License - [http://remybach.mit-license.org/](http://remybach.mit-license.org/ 'Link through to read my License.') +MIT License - [http://remybach.mit-license.org/](http://remybach.mit-license.org/ 'Link through to read my License.') \ No newline at end of file From 428287a58bce4036a6599ed9e173844e0a45ea8b Mon Sep 17 00:00:00 2001 From: Francisc Romano Date: Sat, 29 Sep 2012 02:11:31 +0300 Subject: [PATCH 34/56] Fixed label animation from queuing up. --- jquery.superLabels.js | 6 +++--- jquery.superLabels.min.js | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/jquery.superLabels.js b/jquery.superLabels.js index c91c65e..0d1b3b3 100644 --- a/jquery.superLabels.js +++ b/jquery.superLabels.js @@ -177,7 +177,7 @@ _duration = defaults.fadeDuration; } - _label.animate(_to, _duration, defaults.easingOut); + _label.stop(true,false).animate(_to, _duration, defaults.easingOut); } }; _blur = function() { @@ -197,7 +197,7 @@ _duration = defaults.fadeDuration; } - _label.animate(_to, _duration, defaults.easingOut); + _label.stop(true,false).animate(_to, _duration, defaults.easingOut); } else { // If there is a value, and the label is visible, fire our _keyup function so as to hide it. (this semi-fixes the autofill bug) _keyup.apply(this); @@ -220,7 +220,7 @@ _o = defaults.opacity; } - _label.animate({ opacity:_o }, defaults.fadeDuration, defaults.easingOut); + _label.stop(true,false).animate({ opacity:_o }, defaults.fadeDuration, defaults.easingOut); }; /*===== Utility Functions =====*/ diff --git a/jquery.superLabels.min.js b/jquery.superLabels.min.js index 5991a77..dbcd3cb 100644 --- a/jquery.superLabels.min.js +++ b/jquery.superLabels.min.js @@ -7,4 +7,4 @@ * Description: * This plugin allows you to display your form labels on top of your form fields, saving you space on your page. */ -(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){var f=[];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||{});if(this.length===1&&/form/i.test(this[0].tagName)){f=a(d.join(","),this)}else if(this.length>1){this.each(function(){if(/form/i.test(this.tagName)){a.merge(f,a(d.join(","),this))}else{f.push(this)}})}else{f=this}return a(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){return true}var e=_getLabel(this);var f=b.attr("placeholder");if(f){if(e.length===0){var g='";g+="";g=a(g);e=g;b.before(e)}else{e.attr("title",f)}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("input",_keyup);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('");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)}else{_keyup.apply(this)}};_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) \ No newline at end of file +(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){var f=[];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||{});if(this.length===1&&/form/i.test(this[0].tagName)){f=a(d.join(","),this)}else if(this.length>1){this.each(function(){if(/form/i.test(this.tagName)){a.merge(f,a(d.join(","),this))}else{f.push(this)}})}else{f=this}return a(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){return true}var e=_getLabel(this);var f=b.attr("placeholder");if(f){if(e.length===0){var g='";g+="";g=a(g);e=g;b.before(e)}else{e.attr("title",f)}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("input",_keyup);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('");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.stop(true,false).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.stop(true,false).animate(d,a,b.easingOut)}else{_keyup.apply(this)}};_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.stop(true,false).animate({opacity:c},b.fadeDuration,b.easingOut)};_noVal=function(b){return a(b).val()===""}})(jQuery) \ No newline at end of file From 891eb3fea2d00d451a1a98d06440b74b427d0b2c Mon Sep 17 00:00:00 2001 From: Remy Bach Date: Tue, 6 Nov 2012 00:24:09 +0000 Subject: [PATCH 35/56] Add in a character count option to only fade label *after* a given number of characters --- README.md | 7 +++++++ jquery.superLabels.js | 34 +++++++++++++++++++++++++++++----- jquery.superLabels.min.js | 6 +++--- 3 files changed, 39 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 65ec207..5370085 100644 --- a/README.md +++ b/README.md @@ -60,6 +60,13 @@ There are quite a number of options you can pass the plugin additional to the tw * `wrapSelector` - The selector for the element you have wrapping each field. _(default: false)_ * This is used to find the label - use as a last resort. Rather make sure the field and label are next to each other in your markup, or failing that, that your labels use the `for` attribute that point to the field's `name` or `id`. +Last, but not least, you can choose to only fade out the label *after* a certain number of characters have been typed (as of version 1.1.2). You can make use of this by adding a `data-sl-char-limit` with the number of characters you wish for any given field (simply leave it out if you don't want to use this) + +For example, to make the label fade out only *after* 20 characters have been typed in the field: + + + + ## Concerning placeholders According to [the spec](http://www.w3.org/wiki/HTML/Elements/input/text) placeholders are meant to be used to represent "a short hint (a word or short phrase) intended to aid the user with data entry." *NOT* as a replacement for labels. diff --git a/jquery.superLabels.js b/jquery.superLabels.js index 0d1b3b3..69f4063 100644 --- a/jquery.superLabels.js +++ b/jquery.superLabels.js @@ -1,7 +1,7 @@ /* * Title: jQuery Super Labels Plugin - Give your forms a helping of awesome! * Author: Rémy Bach - * Version: 1.1.1 + * Version: 1.1.2 * License: http://remybach.mit-license.org * Url: http://github.com/remybach/jQuery.superLabels * Description: @@ -136,6 +136,8 @@ // Position the label. _prepLabel = function(_field, _label) { + var opacity = 0; + // Handle drop down list labels differently if (_field[0].tagName.match(/select/i)) { // Checking whether the field has a value doesn't work (the browser just seems to select the first ");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.stop(true,false).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.stop(true,false).animate(d,a,b.easingOut)}else{_keyup.apply(this)}};_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.stop(true,false).animate({opacity:c},b.fadeDuration,b.easingOut)};_noVal=function(b){return a(b).val()===""}})(jQuery) \ No newline at end of file +(function(e){var t={baseZindex:0,duration:500,easingIn:e.easing.def?"easeInOutCubic":false,easingOut:e.easing.def?"easeInOutCubic":false,fadeDuration:250,labelLeft:0,labelTop:0,noAnimate:false,opacity:.5,slide:true,wrapSelector:false};var n=["text","search","url","tel","email","password","number"];var r=["input","textarea","select"];e.fn.superLabels=function(i){var s=[];if(this.length===0)return false;if(i&&i.labelLeft&&isNaN(i.labelLeft))i.labelLeft=Number(i.labelLeft.replace(/\D+/,""));if(i&&i.labelTop&&isNaN(i.labelTop))i.labelTop=Number(i.labelTop.replace(/\D+/,""));e.extend(t,i||{});if(this.length===1&&/form/i.test(this[0].tagName)){s=e(r.join(","),this)}else if(this.length>1){this.each(function(){if(/form/i.test(this.tagName)){e.merge(s,e(r.join(","),this))}else{s.push(this)}})}else{s=this}return e(s).each(function(){var t=e(this);if((t[0].tagName.toLowerCase()==="input"&&e.inArray(t.attr("type"),n))===-1&&e.inArray(t[0].tagName.toLowerCase(),r)!==-1){return true}var i=_getLabel(this);var s=t.attr("placeholder");if(s){if(i.length===0){var o='";o+="";o=e(o);i=o;t.before(i)}else{i.attr("title",s)}t.removeAttr("placeholder")}if(i.length===0){return true}_prepLabel(t,i);if(!this.tagName.match(/select/i)){t.focus(_focus);t.blur(_blur);t.change(_blur);t.bind("input",_keyup);t.bind("propertychange",_blur);t.keyup(_keyup);i.click(function(){t.focus()})}})};_getLabel=function(n){var r=e(n).siblings("label");if(r.length===0){if(t.wrapSelector){r=e(n).parents(t.wrapSelector).find("label")}else{_for=n.id||n.name;r=e('[for="'+_for+'"]')}}return r};_prepLabel=function(n,r){var i=0;if(n[0].tagName.match(/select/i)){var s=n.find("[selected]").length===0?" selected":"";n.prepend('");r.css("display","none")}else{if(_noVal(n)){i=1}else if(_withinCharCount(n)){i=t.opacity}n.css({zIndex:t.baseZindex+1}).addClass("sl_field");r.css({left:_noVal(n)?t.labelLeft:e(n).width()-r.width(),opacity:i,position:"absolute",top:t.labelTop,zIndex:t.baseZindex+2}).addClass("sl_label")}};_focus=function(){if(_noVal(this)){var n=t.duration;var r=_getLabel(this);var i={opacity:0};if(t.noAnimate){r.hide();return false}if(t.slide){i.left=e(this).width()-r.width();i.opacity=t.opacity}else{n=t.fadeDuration}r.stop(true,false).animate(i,n,t.easingOut)}};_blur=function(){if(_noVal(this)){var e=t.duration;var n=_getLabel(this);var r={opacity:1};if(t.noAnimate){n.show();return false}if(t.slide){r.left=t.labelLeft}else{e=t.fadeDuration}n.stop(true,false).animate(r,e,t.easingOut)}else{_keyup.apply(this)}};_keyup=function(){if(t.noAnimate)return false;var e=_getLabel(this);var n=0;if(_noVal(this)&&e.css("opacity")>0||!_noVal(this)&&e.css("opacity")===0){return false}if(_noVal(this)&&e.css("opacity")!==0||_withinCharCount(this)){n=t.opacity}e.stop(true,false).animate({opacity:n},t.fadeDuration,t.easingOut)};_noVal=function(t){return e(t).val()===""};_withinCharCount=function(t){var n=e(t).data("slCharLimit");if(!n||typeof n!=="number"){return false}t=t.length?t[0]:t;return n&&t.value&&t.value.length<=n}})(jQuery) \ No newline at end of file From c7087bde205b7e7d1f4361b968e67855717d74e8 Mon Sep 17 00:00:00 2001 From: Remy Bach Date: Wed, 7 Nov 2012 00:13:29 +0000 Subject: [PATCH 36/56] Add in auto character limit approximation option. --- README.md | 15 ++++++-- jquery.superLabels.js | 74 ++++++++++++++++++++++++++++----------- jquery.superLabels.min.js | 4 +-- 3 files changed, 67 insertions(+), 26 deletions(-) diff --git a/README.md b/README.md index 5370085..7bdceb9 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ Here's a (very) [simple demo](http://remy.bach.me.uk/superlabels_demo/) of Super You need to make sure that the element containing both the field and the label has `position:relative;`. Other than that, the plugin should have enough flexibility to handle most of your needs. -#### Basic +### Basic The quickest and easiest way to use this plugin is as follows: @@ -38,10 +38,11 @@ Lastly, you can choose to ONLY apply superLabels to specific fields if you wish $('input.foo, textarea.bar, select.baz').superLabels(); -#### Advanced +### Advanced There are quite a number of options you can pass the plugin additional to the two I mentioned above: +* `autoCharLimit` - Whether to automatically attempt to determine the number of characters after which to fade the label out or not (see below for more on this). _(default: false)_ * `baseZindex` - The base z-index which we display on top of. _(default: 0)_ * `debug` - Whether or not to show console messages. _(default: false)_ * Note: this is not available in the minified version. @@ -60,13 +61,21 @@ There are quite a number of options you can pass the plugin additional to the tw * `wrapSelector` - The selector for the element you have wrapping each field. _(default: false)_ * This is used to find the label - use as a last resort. Rather make sure the field and label are next to each other in your markup, or failing that, that your labels use the `for` attribute that point to the field's `name` or `id`. -Last, but not least, you can choose to only fade out the label *after* a certain number of characters have been typed (as of version 1.1.2). You can make use of this by adding a `data-sl-char-limit` with the number of characters you wish for any given field (simply leave it out if you don't want to use this) +#### "Character Limit" + +Last, but not least, you can choose to only fade out the label *after* a certain number of characters have been typed. You can make use of this by adding a `data-sl-char-limit` (as of version 1.1.2) with the number of characters you wish for any given field (simply leave it out if you don't want to use this). For example, to make the label fade out only *after* 20 characters have been typed in the field: +As of version 1.1.3, you can now choose to let superLabels do the heavy lifting for you and let it automatically try to guess the character length☨. You can do this by using the above `autoCharLimit` option, _or_ by setting the `data-sl-char-limit` to `auto` for a given field. + +The `autoCharLimit` option will be overridden by whatever is specified in the `data-sl-char-limit` attribute for that given element. + +☨ Note that this is only an approximation. Unless a mono-spaced font is used, there isn't a method of figuring out _exactly_ what length the characters are that _isn't_ expensive in terms of performance. + ## Concerning placeholders According to [the spec](http://www.w3.org/wiki/HTML/Elements/input/text) placeholders are meant to be used to represent "a short hint (a word or short phrase) intended to aid the user with data entry." *NOT* as a replacement for labels. diff --git a/jquery.superLabels.js b/jquery.superLabels.js index 69f4063..647b7c8 100644 --- a/jquery.superLabels.js +++ b/jquery.superLabels.js @@ -1,7 +1,7 @@ /* * Title: jQuery Super Labels Plugin - Give your forms a helping of awesome! * Author: Rémy Bach - * Version: 1.1.2 + * Version: 1.1.3 * License: http://remybach.mit-license.org * Url: http://github.com/remybach/jQuery.superLabels * Description: @@ -9,6 +9,7 @@ */ ;(function($) { var defaults = { + autoCharLimit:false, // Whether to automatically attempt to determine the number of characters after which to fade the label out or not. baseZindex:0, // The base z-index which we display on top of. debug:false, duration:500, // Time of the slide in milliseconds. @@ -40,8 +41,7 @@ // If options were passed in, merge them with the defaults. $.extend(defaults, options || {}); - if (!$.easing.def) { _info('Easing plugin not found - using standard jQuery animations.'); } - + // Check for whether the user has just passed in the form. If so, we need to fetch all the accepted fields. if (this.length === 1 && /form/i.test(this[0].tagName)) { _fields = $(acceptedElements.join(','), this); @@ -64,7 +64,6 @@ // Don't even bother going further if this isn't one of the accepted input field types or elements. if ((_field[0].tagName.toLowerCase() === 'input' && $.inArray(_field.attr('type'), acceptedInputTypes)) === -1 && $.inArray(_field[0].tagName.toLowerCase(), acceptedElements) !== -1) { - _info('Doh! The following '+this.tagName.toLowerCase()+', is not supported.', this); return true; // Equivalent to continue in a normal for loop. } @@ -91,7 +90,6 @@ // Make sure this form field has a label if (_label.length === 0) { - _info('Doh! The following '+this.tagName.toLowerCase()+' has no related label.', this); return true; } @@ -136,7 +134,9 @@ // Position the label. _prepLabel = function(_field, _label) { - var opacity = 0; + var _charLimit, + _charLimitAttr = _field.data('slCharLimit'), + _opacity = 0; // Handle drop down list labels differently if (_field[0].tagName.match(/select/i)) { @@ -149,18 +149,24 @@ _label.css('display','none'); } else { + // If we need to figure out the length automatically (and this field isn't specifically excluded), + // or if this field is specifically requesting this functionality. + if (_charLimitAttr === 'auto' || (defaults.autoCharLimit && isNaN(_charLimitAttr))) { + _approximateChars(_field, _label); + } + // If the field is empty, make the label fully opaque. if (_noVal(_field)) { - opacity = 1; - // Otherwise, if the field is not empty, but below the character count (if any), use the passed in option. - } else if (_withinCharCount(_field)) { - opacity = defaults.opacity; + _opacity = 1; + // Otherwise, if the field is not empty, but below the character limit (if any), use the passed in option. + } else if (_withinCharLimit(_field)) { + _opacity = defaults._opacity; } _field.css({ zIndex:defaults.baseZindex+1 }).addClass('sl_field'); _label.css({ left:_noVal(_field) ? defaults.labelLeft : $(_field).width()-_label.width(), - opacity:opacity, + opacity:_opacity, position:'absolute', top:defaults.labelTop, zIndex:defaults.baseZindex+2 @@ -225,7 +231,7 @@ } // If the field is empty and the label isn't showing, make it show up again. - if ( (_noVal(this) && _label.css('opacity') !== 0) || _withinCharCount(this) ) { + if ( (_noVal(this) && _label.css('opacity') !== 0) || _withinCharLimit(this) ) { _o = defaults.opacity; } @@ -235,12 +241,12 @@ /*===== Utility Functions =====*/ // Tell us whether the form field has a value. _noVal = function(_el) { return $(_el).val() === ''; }; - // Tell us whether the form field meets a given character count (if necessary) - _withinCharCount = function(_el) { - var count = $(_el).data('slCharLimit'); + // Tell us whether the form field meets a given character limit (if necessary) + _withinCharLimit = function(_el) { + var _limit = $(_el).data('slCharLimit'); // Stop here if there's no need to check for number of characters. - if (!count || typeof count !== 'number') { + if (!_limit || typeof _limit !== 'number') { return false; } @@ -248,11 +254,37 @@ // jQuery object-like Array, thus: grab the DOM element from it. _el = _el.length ? _el[0] : _el; - return count && _el.value && _el.value.length <= count; + return _limit && _el.value && _el.value.length <= _limit; }; + // Attempt to automatically set up the character limit and attach it to the field. + _approximateChars = function(_field, _label) { + var _available, + _charLen, + _chars = '1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ' + _properties = ["font-family", "font-size", "font-weight", "letter-spacing", "line-height", "text-shadow", "text-transform"], + _tmp = $('
'+_chars+'
'); + + // Loop through each of the defined properties so that we can get the font looking the same size. + // I know this isn't too great for performance, but for now I don't know of a better way to do this. + // If you do know of a better way, please hit me with a pull request. + $.each(_properties, function(i, _prop) { + _tmp.css(_prop, _field.css(_prop)); + }); - // Console Functions (We need these to make sure this only displays when the console exists.) - _log = function() { if (defaults.debug && console && console.log) console.log.apply(console, arguments); }; - _info = function() { if (defaults.debug && console && console.info) console.info.apply(console, arguments); }; - _error = function() { if (defaults.debug && console && console.error) console.error.apply(console, arguments); }; + _tmp.css({ + 'position':'absolute', // so it's out of the document flow. + 'visibility':'hidden' // so that it's not visible, but still takes up space in the DOM so we can grab the width + }); + + $('body').append(_tmp); + // Get the average length *per character* + _charLen = Math.round(_tmp.width() / _chars.length); + // Remove our temporary div from the DOM. + _tmp.remove(); + + _available = _field.width() - _label.width(); + + // Set the data-sl-char-limit attribute for this field to our approximated value. + _field.data('slCharLimit', Math.floor(_available / _charLen)); + }; })(jQuery); \ No newline at end of file diff --git a/jquery.superLabels.min.js b/jquery.superLabels.min.js index f4c0042..a15b3ff 100644 --- a/jquery.superLabels.min.js +++ b/jquery.superLabels.min.js @@ -1,10 +1,10 @@ /* * Title: jQuery Super Labels Plugin - Give your forms a helping of awesome! * Author: Rémy Bach - * Version: 1.1.2 + * Version: 1.1.3 * License: http://remybach.mit-license.org * Url: http://github.com/remybach/jQuery.superLabels * Description: * This plugin allows you to display your form labels on top of your form fields, saving you space on your page. */ -(function(e){var t={baseZindex:0,duration:500,easingIn:e.easing.def?"easeInOutCubic":false,easingOut:e.easing.def?"easeInOutCubic":false,fadeDuration:250,labelLeft:0,labelTop:0,noAnimate:false,opacity:.5,slide:true,wrapSelector:false};var n=["text","search","url","tel","email","password","number"];var r=["input","textarea","select"];e.fn.superLabels=function(i){var s=[];if(this.length===0)return false;if(i&&i.labelLeft&&isNaN(i.labelLeft))i.labelLeft=Number(i.labelLeft.replace(/\D+/,""));if(i&&i.labelTop&&isNaN(i.labelTop))i.labelTop=Number(i.labelTop.replace(/\D+/,""));e.extend(t,i||{});if(this.length===1&&/form/i.test(this[0].tagName)){s=e(r.join(","),this)}else if(this.length>1){this.each(function(){if(/form/i.test(this.tagName)){e.merge(s,e(r.join(","),this))}else{s.push(this)}})}else{s=this}return e(s).each(function(){var t=e(this);if((t[0].tagName.toLowerCase()==="input"&&e.inArray(t.attr("type"),n))===-1&&e.inArray(t[0].tagName.toLowerCase(),r)!==-1){return true}var i=_getLabel(this);var s=t.attr("placeholder");if(s){if(i.length===0){var o='";o+="";o=e(o);i=o;t.before(i)}else{i.attr("title",s)}t.removeAttr("placeholder")}if(i.length===0){return true}_prepLabel(t,i);if(!this.tagName.match(/select/i)){t.focus(_focus);t.blur(_blur);t.change(_blur);t.bind("input",_keyup);t.bind("propertychange",_blur);t.keyup(_keyup);i.click(function(){t.focus()})}})};_getLabel=function(n){var r=e(n).siblings("label");if(r.length===0){if(t.wrapSelector){r=e(n).parents(t.wrapSelector).find("label")}else{_for=n.id||n.name;r=e('[for="'+_for+'"]')}}return r};_prepLabel=function(n,r){var i=0;if(n[0].tagName.match(/select/i)){var s=n.find("[selected]").length===0?" selected":"";n.prepend('");r.css("display","none")}else{if(_noVal(n)){i=1}else if(_withinCharCount(n)){i=t.opacity}n.css({zIndex:t.baseZindex+1}).addClass("sl_field");r.css({left:_noVal(n)?t.labelLeft:e(n).width()-r.width(),opacity:i,position:"absolute",top:t.labelTop,zIndex:t.baseZindex+2}).addClass("sl_label")}};_focus=function(){if(_noVal(this)){var n=t.duration;var r=_getLabel(this);var i={opacity:0};if(t.noAnimate){r.hide();return false}if(t.slide){i.left=e(this).width()-r.width();i.opacity=t.opacity}else{n=t.fadeDuration}r.stop(true,false).animate(i,n,t.easingOut)}};_blur=function(){if(_noVal(this)){var e=t.duration;var n=_getLabel(this);var r={opacity:1};if(t.noAnimate){n.show();return false}if(t.slide){r.left=t.labelLeft}else{e=t.fadeDuration}n.stop(true,false).animate(r,e,t.easingOut)}else{_keyup.apply(this)}};_keyup=function(){if(t.noAnimate)return false;var e=_getLabel(this);var n=0;if(_noVal(this)&&e.css("opacity")>0||!_noVal(this)&&e.css("opacity")===0){return false}if(_noVal(this)&&e.css("opacity")!==0||_withinCharCount(this)){n=t.opacity}e.stop(true,false).animate({opacity:n},t.fadeDuration,t.easingOut)};_noVal=function(t){return e(t).val()===""};_withinCharCount=function(t){var n=e(t).data("slCharLimit");if(!n||typeof n!=="number"){return false}t=t.length?t[0]:t;return n&&t.value&&t.value.length<=n}})(jQuery) \ No newline at end of file +(function(e){var t={autoCharLimit:false,baseZindex:0,debug:false,duration:500,easingIn:e.easing.def?"easeInOutCubic":false,easingOut:e.easing.def?"easeInOutCubic":false,fadeDuration:250,labelLeft:0,labelTop:0,noAnimate:false,opacity:.5,slide:true,wrapSelector:false};var n=["text","search","url","tel","email","password","number"];var r=["input","textarea","select"];e.fn.superLabels=function(i){var s=[];if(this.length===0)return false;if(i&&i.labelLeft&&isNaN(i.labelLeft))i.labelLeft=Number(i.labelLeft.replace(/\D+/,""));if(i&&i.labelTop&&isNaN(i.labelTop))i.labelTop=Number(i.labelTop.replace(/\D+/,""));e.extend(t,i||{});if(this.length===1&&/form/i.test(this[0].tagName)){s=e(r.join(","),this)}else if(this.length>1){this.each(function(){if(/form/i.test(this.tagName)){e.merge(s,e(r.join(","),this))}else{s.push(this)}})}else{s=this}return e(s).each(function(){var t=e(this);if((t[0].tagName.toLowerCase()==="input"&&e.inArray(t.attr("type"),n))===-1&&e.inArray(t[0].tagName.toLowerCase(),r)!==-1){return true}var i=_getLabel(this);var s=t.attr("placeholder");if(s){if(i.length===0){var o='";o+="";o=e(o);i=o;t.before(i)}else{i.attr("title",s)}t.removeAttr("placeholder")}if(i.length===0){return true}_prepLabel(t,i);if(!this.tagName.match(/select/i)){t.focus(_focus);t.blur(_blur);t.change(_blur);t.bind("input",_keyup);t.bind("propertychange",_blur);t.keyup(_keyup);i.click(function(){t.focus()})}})};_getLabel=function(n){var r=e(n).siblings("label");if(r.length===0){if(t.wrapSelector){r=e(n).parents(t.wrapSelector).find("label")}else{_for=n.id||n.name;r=e('[for="'+_for+'"]')}}return r};_prepLabel=function(n,r){var i,s=n.data("slCharLimit"),o=0;if(n[0].tagName.match(/select/i)){var u=n.find("[selected]").length===0?" selected":"";n.prepend('");r.css("display","none")}else{if(s==="auto"||t.autoCharLimit&&isNaN(s)){_approximateChars(n,r)}if(_noVal(n)){o=1}else if(_withinCharLimit(n)){o=t._opacity}n.css({zIndex:t.baseZindex+1}).addClass("sl_field");r.css({left:_noVal(n)?t.labelLeft:e(n).width()-r.width(),opacity:o,position:"absolute",top:t.labelTop,zIndex:t.baseZindex+2}).addClass("sl_label")}};_focus=function(){if(_noVal(this)){var n=t.duration;var r=_getLabel(this);var i={opacity:0};if(t.noAnimate){r.hide();return false}if(t.slide){i.left=e(this).width()-r.width();i.opacity=t.opacity}else{n=t.fadeDuration}r.stop(true,false).animate(i,n,t.easingOut)}};_blur=function(){if(_noVal(this)){var e=t.duration;var n=_getLabel(this);var r={opacity:1};if(t.noAnimate){n.show();return false}if(t.slide){r.left=t.labelLeft}else{e=t.fadeDuration}n.stop(true,false).animate(r,e,t.easingOut)}else{_keyup.apply(this)}};_keyup=function(){if(t.noAnimate)return false;var e=_getLabel(this);var n=0;if(_noVal(this)&&e.css("opacity")>0||!_noVal(this)&&e.css("opacity")===0){return false}if(_noVal(this)&&e.css("opacity")!==0||_withinCharLimit(this)){n=t.opacity}e.stop(true,false).animate({opacity:n},t.fadeDuration,t.easingOut)};_noVal=function(t){return e(t).val()===""};_withinCharLimit=function(t){var n=e(t).data("slCharLimit");if(!n||typeof n!=="number"){return false}t=t.length?t[0]:t;return n&&t.value&&t.value.length<=n};_approximateChars=function(t,n){var r,i,s="1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";_properties=["font-family","font-size","font-weight","letter-spacing","line-height","text-shadow","text-transform"],_tmp=e("
"+s+"
");e.each(_properties,function(e,n){_tmp.css(n,t.css(n))});_tmp.css({position:"absolute",visibility:"hidden"});e("body").append(_tmp);i=Math.round(_tmp.width()/s.length);_tmp.remove();r=t.width()-n.width();t.data("slCharLimit",Math.floor(r/i))}})(jQuery) \ No newline at end of file From f87055741acb7f44226c519163a6b869070246bf Mon Sep 17 00:00:00 2001 From: Remy Bach Date: Wed, 7 Nov 2012 00:18:14 +0000 Subject: [PATCH 37/56] Version number bump to 1.2.0 --- README.md | 2 +- jquery.superLabels.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 7bdceb9..065c944 100644 --- a/README.md +++ b/README.md @@ -70,7 +70,7 @@ For example, to make the label fade out only *after* 20 characters have been typ -As of version 1.1.3, you can now choose to let superLabels do the heavy lifting for you and let it automatically try to guess the character length☨. You can do this by using the above `autoCharLimit` option, _or_ by setting the `data-sl-char-limit` to `auto` for a given field. +As of version 1.2.0, you can now choose to let superLabels do the heavy lifting for you and let it automatically try to guess the character length☨. You can do this by using the above `autoCharLimit` option, _or_ by setting the `data-sl-char-limit` to `auto` for a given field. The `autoCharLimit` option will be overridden by whatever is specified in the `data-sl-char-limit` attribute for that given element. diff --git a/jquery.superLabels.js b/jquery.superLabels.js index 647b7c8..6430dbb 100644 --- a/jquery.superLabels.js +++ b/jquery.superLabels.js @@ -1,7 +1,7 @@ /* * Title: jQuery Super Labels Plugin - Give your forms a helping of awesome! * Author: Rémy Bach - * Version: 1.1.3 + * Version: 1.2.0 * License: http://remybach.mit-license.org * Url: http://github.com/remybach/jQuery.superLabels * Description: From cf1ef104b2b8af95c14d6bc0886fc2813bf718c7 Mon Sep 17 00:00:00 2001 From: Remy Bach Date: Wed, 7 Nov 2012 08:55:06 +0000 Subject: [PATCH 38/56] Append the temporary div to the field's parent. It was appending to the body before, but that won't have played nicely with em/rem/vh/vw, etc. --- jquery.superLabels.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/jquery.superLabels.js b/jquery.superLabels.js index 6430dbb..5212416 100644 --- a/jquery.superLabels.js +++ b/jquery.superLabels.js @@ -1,7 +1,7 @@ /* * Title: jQuery Super Labels Plugin - Give your forms a helping of awesome! * Author: Rémy Bach - * Version: 1.2.0 + * Version: 1.2.1 * License: http://remybach.mit-license.org * Url: http://github.com/remybach/jQuery.superLabels * Description: @@ -276,12 +276,14 @@ 'visibility':'hidden' // so that it's not visible, but still takes up space in the DOM so we can grab the width }); - $('body').append(_tmp); + // Append this to the parent so that it can correctly replicate the style of the field. + _field.parent().append(_tmp); // Get the average length *per character* _charLen = Math.round(_tmp.width() / _chars.length); // Remove our temporary div from the DOM. _tmp.remove(); + // Figure out how much room we have to work with here. _available = _field.width() - _label.width(); // Set the data-sl-char-limit attribute for this field to our approximated value. From 74b8fc20c1571eab47c29948d7c0ea1d0f3a5180 Mon Sep 17 00:00:00 2001 From: Remy Bach Date: Wed, 7 Nov 2012 08:59:53 +0000 Subject: [PATCH 39/56] Improve the coding standards used internally. --- jquery.superLabels.js | 88 +++++++++++++++++++++++++------------------ 1 file changed, 51 insertions(+), 37 deletions(-) diff --git a/jquery.superLabels.js b/jquery.superLabels.js index 5212416..afb0613 100644 --- a/jquery.superLabels.js +++ b/jquery.superLabels.js @@ -9,35 +9,36 @@ */ ;(function($) { var defaults = { - autoCharLimit:false, // Whether to automatically attempt to determine the number of characters after which to fade the label out or not. - baseZindex:0, // The base z-index which we display on top of. - debug:false, - duration:500, // Time of the slide in milliseconds. - easingIn:($.easing.def ? 'easeInOutCubic' : false), // The easing in function to use for the slide. - easingOut:($.easing.def ? 'easeInOutCubic' : false), // The easing out function to use for the slide. - fadeDuration:250, // Duration of animation when it's fade only. - labelLeft:0, // The distance from the left for the label. - labelTop:0, // The distance from the top for the label. - noAnimate:false, // Whether or not to animate (slide and fade) the label. If true, we'll just hide it. - opacity:0.5, // The opacity to fade the label to. - slide:true, // Whether or not to slide the label across the input field. - wrapSelector:false // The selector for the element you have wrapping each field. - }; - - var acceptedInputTypes = ['text', 'search', 'url', 'tel', 'email', 'password', 'number']; - var acceptedElements = ['input', 'textarea', 'select']; + autoCharLimit:false, // Whether to automatically attempt to determine the number of characters after which to fade the label out or not. + baseZindex:0, // The base z-index which we display on top of. + debug:false, + duration:500, // Time of the slide in milliseconds. + easingIn:($.easing && $.easing.def ? 'easeInOutCubic' : false), // The easing in function to use for the slide. + easingOut:($.easing && $.easing.def ? 'easeInOutCubic' : false), // The easing out function to use for the slide. + fadeDuration:250, // Duration of animation when it's fade only. + labelLeft:0, // The distance from the left for the label. + labelTop:0, // The distance from the top for the label. + noAnimate:false, // Whether or not to animate (slide and fade) the label. If true, we'll just hide it. + opacity:0.5, // The opacity to fade the label to. + slide:true, // Whether or not to slide the label across the input field. + wrapSelector:false // The selector for the element you have wrapping each field. + }, + acceptedInputTypes = ['text', 'search', 'url', 'tel', 'email', 'password', 'number'], + acceptedElements = ['input', 'textarea', 'select']; $.fn.superLabels = function(options) { var _fields = []; // If this has been run on an empty set of elements, pop out. - if (this.length === 0) return false; + if (this.length === 0) { return false; } // Remove any NaNs from the positions (if present) - if (options && options.labelLeft && isNaN(options.labelLeft)) + if (options && options.labelLeft && isNaN(options.labelLeft)) { options.labelLeft = Number(options.labelLeft.replace(/\D+/, '')); - if (options && options.labelTop && isNaN(options.labelTop)) + } + if (options && options.labelTop && isNaN(options.labelTop)) { options.labelTop = Number(options.labelTop.replace(/\D+/, '')); + } // If options were passed in, merge them with the defaults. $.extend(defaults, options || {}); @@ -60,21 +61,24 @@ // Do our magic on each form field. return $(_fields).each(function() { - var _field = $(this); + var _field = $(this), + _label, + _placeholder = _field.attr('placeholder'), + _placeholderLabel; // Don't even bother going further if this isn't one of the accepted input field types or elements. if ((_field[0].tagName.toLowerCase() === 'input' && $.inArray(_field.attr('type'), acceptedInputTypes)) === -1 && $.inArray(_field[0].tagName.toLowerCase(), acceptedElements) !== -1) { return true; // Equivalent to continue in a normal for loop. } - var _label = _getLabel(this); - var _placeholder = _field.attr('placeholder'); + // Get the label associated to this field. + _label = _getLabel(this); // If there's a placeholder if (_placeholder) { // but NO label, make a label using the placeholder if (_label.length === 0) { - var _placeholderLabel = ''; + _placeholderLabel = ''; _placeholderLabel+= ''; _placeholderLabel = $(_placeholderLabel); @@ -136,14 +140,15 @@ _prepLabel = function(_field, _label) { var _charLimit, _charLimitAttr = _field.data('slCharLimit'), - _opacity = 0; + _opacity = 0, + _selected; // Handle drop down list labels differently if (_field[0].tagName.match(/select/i)) { // Checking whether the field has a value doesn't work (the browser just seems to select the first '); @@ -176,10 +181,12 @@ // The event handlers for the form fields. _focus = function() { + var _duration = defaults.duration, + _label, + _to = { opacity:0 }; + if (_noVal(this)) { - var _duration = defaults.duration; - var _label = _getLabel(this); - var _to ={ opacity:0 }; + _label = _getLabel(this); if (defaults.noAnimate) { _label.hide(); @@ -197,10 +204,12 @@ } }; _blur = function() { + var _duration = defaults.duration, + _label, + _to ={ opacity:1 }; + if (_noVal(this)) { - var _duration = defaults.duration; - var _label = _getLabel(this); - var _to ={ opacity:1 }; + _label = _getLabel(this); if (defaults.noAnimate) { _label.show(); @@ -220,10 +229,14 @@ } }; _keyup = function() { - if (defaults.noAnimate) return false; // We don't need any keyup checking done if we're not animating (the label would be in the way while trying to type). + var _label, + _o = 0; + + if (defaults.noAnimate) { + return false; // We don't need any keyup checking done if we're not animating (the label would be in the way while trying to type). + } - var _label = _getLabel(this); - var _o = 0; + _label = _getLabel(this); // Let's check whether there's even a need to animate anything first. if ((_noVal(this) && _label.css('opacity') > 0) || (!_noVal(this) && _label.css('opacity') === 0 )) { @@ -231,7 +244,7 @@ } // If the field is empty and the label isn't showing, make it show up again. - if ( (_noVal(this) && _label.css('opacity') !== 0) || _withinCharLimit(this) ) { + if ((_noVal(this) && _label.css('opacity') !== 0) || _withinCharLimit(this)) { _o = defaults.opacity; } @@ -251,12 +264,13 @@ } // If this has a length property, we can assume this element is part of a - // jQuery object-like Array, thus: grab the DOM element from it. + // jQuery object-like Array, thus: grab the DOM element from it (there should only be 1). _el = _el.length ? _el[0] : _el; return _limit && _el.value && _el.value.length <= _limit; }; // Attempt to automatically set up the character limit and attach it to the field. + // This will only run once per field on page load. _approximateChars = function(_field, _label) { var _available, _charLen, From 9075dda8fe0e750dcd91387c636a84689d59e0c4 Mon Sep 17 00:00:00 2001 From: Remy Bach Date: Wed, 7 Nov 2012 09:06:06 +0000 Subject: [PATCH 40/56] Add basic demo. --- demo/css/bootstrap.min.css | 727 ++++++++++++++++++++++++++++++ demo/css/prism.css | 152 +++++++ demo/css/style.css | 52 +++ demo/index.html | 84 ++++ demo/scripts/jquery-1.7.1.min.js | 4 + demo/scripts/jquery.easing.1.3.js | 205 +++++++++ demo/scripts/prism.js | 501 ++++++++++++++++++++ 7 files changed, 1725 insertions(+) create mode 100755 demo/css/bootstrap.min.css create mode 100644 demo/css/prism.css create mode 100755 demo/css/style.css create mode 100755 demo/index.html create mode 100755 demo/scripts/jquery-1.7.1.min.js create mode 100755 demo/scripts/jquery.easing.1.3.js create mode 100644 demo/scripts/prism.js diff --git a/demo/css/bootstrap.min.css b/demo/css/bootstrap.min.css new file mode 100755 index 0000000..f0b9523 --- /dev/null +++ b/demo/css/bootstrap.min.css @@ -0,0 +1,727 @@ +/*! + * Bootstrap v2.0.4 + * + * Copyright 2012 Twitter, Inc + * Licensed under the Apache License v2.0 + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Designed and built with all the love in the world @twitter by @mdo and @fat. + */ +.clearfix{*zoom:1;}.clearfix:before,.clearfix:after{display:table;content:"";} +.clearfix:after{clear:both;} +.hide-text{font:0/0 a;color:transparent;text-shadow:none;background-color:transparent;border:0;} +.input-block-level{display:block;width:100%;min-height:28px;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;-ms-box-sizing:border-box;box-sizing:border-box;} +article,aside,details,figcaption,figure,footer,header,hgroup,nav,section{display:block;} +audio,canvas,video{display:inline-block;*display:inline;*zoom:1;} +audio:not([controls]){display:none;} +html{font-size:100%;-webkit-text-size-adjust:100%;-ms-text-size-adjust:100%;} +a:focus{outline:thin dotted #333;outline:5px auto -webkit-focus-ring-color;outline-offset:-2px;} +a:hover,a:active{outline:0;} +sub,sup{position:relative;font-size:75%;line-height:0;vertical-align:baseline;} +sup{top:-0.5em;} +sub{bottom:-0.25em;} +img{max-width:100%;vertical-align:middle;border:0;-ms-interpolation-mode:bicubic;} +#map_canvas img{max-width:none;} +button,input,select,textarea{margin:0;font-size:100%;vertical-align:middle;} +button,input{*overflow:visible;line-height:normal;} +button::-moz-focus-inner,input::-moz-focus-inner{padding:0;border:0;} +button,input[type="button"],input[type="reset"],input[type="submit"]{cursor:pointer;-webkit-appearance:button;} +input[type="search"]{-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;-webkit-appearance:textfield;} +input[type="search"]::-webkit-search-decoration,input[type="search"]::-webkit-search-cancel-button{-webkit-appearance:none;} +textarea{overflow:auto;vertical-align:top;} +body{margin:0;font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;font-size:13px;line-height:18px;color:#333333;background-color:#ffffff;} +a{color:#0088cc;text-decoration:none;} +a:hover{color:#005580;text-decoration:underline;} +.row{margin-left:-20px;*zoom:1;}.row:before,.row:after{display:table;content:"";} +.row:after{clear:both;} +[class*="span"]{float:left;margin-left:20px;} +.container,.navbar-fixed-top .container,.navbar-fixed-bottom .container{width:940px;} +.span12{width:940px;} +.span11{width:860px;} +.span10{width:780px;} +.span9{width:700px;} +.span8{width:620px;} +.span7{width:540px;} +.span6{width:460px;} +.span5{width:380px;} +.span4{width:300px;} +.span3{width:220px;} +.span2{width:140px;} +.span1{width:60px;} +.offset12{margin-left:980px;} +.offset11{margin-left:900px;} +.offset10{margin-left:820px;} +.offset9{margin-left:740px;} +.offset8{margin-left:660px;} +.offset7{margin-left:580px;} +.offset6{margin-left:500px;} +.offset5{margin-left:420px;} +.offset4{margin-left:340px;} +.offset3{margin-left:260px;} +.offset2{margin-left:180px;} +.offset1{margin-left:100px;} +.row-fluid{width:100%;*zoom:1;}.row-fluid:before,.row-fluid:after{display:table;content:"";} +.row-fluid:after{clear:both;} +.row-fluid [class*="span"]{display:block;width:100%;min-height:28px;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;-ms-box-sizing:border-box;box-sizing:border-box;float:left;margin-left:2.127659574%;*margin-left:2.0744680846382977%;} +.row-fluid [class*="span"]:first-child{margin-left:0;} +.row-fluid .span12{width:99.99999998999999%;*width:99.94680850063828%;} +.row-fluid .span11{width:91.489361693%;*width:91.4361702036383%;} +.row-fluid .span10{width:82.97872339599999%;*width:82.92553190663828%;} +.row-fluid .span9{width:74.468085099%;*width:74.4148936096383%;} +.row-fluid .span8{width:65.95744680199999%;*width:65.90425531263828%;} +.row-fluid .span7{width:57.446808505%;*width:57.3936170156383%;} +.row-fluid .span6{width:48.93617020799999%;*width:48.88297871863829%;} +.row-fluid .span5{width:40.425531911%;*width:40.3723404216383%;} +.row-fluid .span4{width:31.914893614%;*width:31.8617021246383%;} +.row-fluid .span3{width:23.404255317%;*width:23.3510638276383%;} +.row-fluid .span2{width:14.89361702%;*width:14.8404255306383%;} +.row-fluid .span1{width:6.382978723%;*width:6.329787233638298%;} +.container{margin-right:auto;margin-left:auto;*zoom:1;}.container:before,.container:after{display:table;content:"";} +.container:after{clear:both;} +.container-fluid{padding-right:20px;padding-left:20px;*zoom:1;}.container-fluid:before,.container-fluid:after{display:table;content:"";} +.container-fluid:after{clear:both;} +p{margin:0 0 9px;}p small{font-size:11px;color:#999999;} +.lead{margin-bottom:18px;font-size:20px;font-weight:200;line-height:27px;} +h1,h2,h3,h4,h5,h6{margin:0;font-family:inherit;font-weight:bold;color:inherit;text-rendering:optimizelegibility;}h1 small,h2 small,h3 small,h4 small,h5 small,h6 small{font-weight:normal;color:#999999;} +h1{font-size:30px;line-height:36px;}h1 small{font-size:18px;} +h2{font-size:24px;line-height:36px;}h2 small{font-size:18px;} +h3{font-size:18px;line-height:27px;}h3 small{font-size:14px;} +h4,h5,h6{line-height:18px;} +h4{font-size:14px;}h4 small{font-size:12px;} +h5{font-size:12px;} +h6{font-size:11px;color:#999999;text-transform:uppercase;} +.page-header{padding-bottom:17px;margin:18px 0;border-bottom:1px solid #eeeeee;} +.page-header h1{line-height:1;} +ul,ol{padding:0;margin:0 0 9px 25px;} +ul ul,ul ol,ol ol,ol ul{margin-bottom:0;} +ul{list-style:disc;} +ol{list-style:decimal;} +li{line-height:18px;} +ul.unstyled,ol.unstyled{margin-left:0;list-style:none;} +dl{margin-bottom:18px;} +dt,dd{line-height:18px;} +dt{font-weight:bold;line-height:17px;} +dd{margin-left:9px;} +.dl-horizontal dt{float:left;width:120px;clear:left;text-align:right;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;} +.dl-horizontal dd{margin-left:130px;} +hr{margin:18px 0;border:0;border-top:1px solid #eeeeee;border-bottom:1px solid #ffffff;} +strong{font-weight:bold;} +em{font-style:italic;} +.muted{color:#999999;} +abbr[title]{cursor:help;border-bottom:1px dotted #999999;} +abbr.initialism{font-size:90%;text-transform:uppercase;} +blockquote{padding:0 0 0 15px;margin:0 0 18px;border-left:5px solid #eeeeee;}blockquote p{margin-bottom:0;font-size:16px;font-weight:300;line-height:22.5px;} +blockquote small{display:block;line-height:18px;color:#999999;}blockquote small:before{content:'\2014 \00A0';} +blockquote.pull-right{float:right;padding-right:15px;padding-left:0;border-right:5px solid #eeeeee;border-left:0;}blockquote.pull-right p,blockquote.pull-right small{text-align:right;} +q:before,q:after,blockquote:before,blockquote:after{content:"";} +address{display:block;margin-bottom:18px;font-style:normal;line-height:18px;} +small{font-size:100%;} +cite{font-style:normal;} +code,pre{padding:0 3px 2px;font-family:Menlo,Monaco,Consolas,"Courier New",monospace;font-size:12px;color:#333333;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px;} +code{padding:2px 4px;color:#d14;background-color:#f7f7f9;border:1px solid #e1e1e8;} +pre{display:block;padding:8.5px;margin:0 0 9px;font-size:12.025px;line-height:18px;word-break:break-all;word-wrap:break-word;white-space:pre;white-space:pre-wrap;background-color:#f5f5f5;border:1px solid #ccc;border:1px solid rgba(0, 0, 0, 0.15);-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;}pre.prettyprint{margin-bottom:18px;} +pre code{padding:0;color:inherit;background-color:transparent;border:0;} +.pre-scrollable{max-height:340px;overflow-y:scroll;} +.label,.badge{font-size:10.998px;font-weight:bold;line-height:14px;color:#ffffff;vertical-align:baseline;white-space:nowrap;text-shadow:0 -1px 0 rgba(0, 0, 0, 0.25);background-color:#999999;} +.label{padding:1px 4px 2px;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px;} +.badge{padding:1px 9px 2px;-webkit-border-radius:9px;-moz-border-radius:9px;border-radius:9px;} +a.label:hover,a.badge:hover{color:#ffffff;text-decoration:none;cursor:pointer;} +.label-important,.badge-important{background-color:#b94a48;} +.label-important[href],.badge-important[href]{background-color:#953b39;} +.label-warning,.badge-warning{background-color:#f89406;} +.label-warning[href],.badge-warning[href]{background-color:#c67605;} +.label-success,.badge-success{background-color:#468847;} +.label-success[href],.badge-success[href]{background-color:#356635;} +.label-info,.badge-info{background-color:#3a87ad;} +.label-info[href],.badge-info[href]{background-color:#2d6987;} +.label-inverse,.badge-inverse{background-color:#333333;} +.label-inverse[href],.badge-inverse[href]{background-color:#1a1a1a;} +table{max-width:100%;background-color:transparent;border-collapse:collapse;border-spacing:0;} +.table{width:100%;margin-bottom:18px;}.table th,.table td{padding:8px;line-height:18px;text-align:left;vertical-align:top;border-top:1px solid #dddddd;} +.table th{font-weight:bold;} +.table thead th{vertical-align:bottom;} +.table caption+thead tr:first-child th,.table caption+thead tr:first-child td,.table colgroup+thead tr:first-child th,.table colgroup+thead tr:first-child td,.table thead:first-child tr:first-child th,.table thead:first-child tr:first-child td{border-top:0;} +.table tbody+tbody{border-top:2px solid #dddddd;} +.table-condensed th,.table-condensed td{padding:4px 5px;} +.table-bordered{border:1px solid #dddddd;border-collapse:separate;*border-collapse:collapsed;border-left:0;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;}.table-bordered th,.table-bordered td{border-left:1px solid #dddddd;} +.table-bordered caption+thead tr:first-child th,.table-bordered caption+tbody tr:first-child th,.table-bordered caption+tbody tr:first-child td,.table-bordered colgroup+thead tr:first-child th,.table-bordered colgroup+tbody tr:first-child th,.table-bordered colgroup+tbody tr:first-child td,.table-bordered thead:first-child tr:first-child th,.table-bordered tbody:first-child tr:first-child th,.table-bordered tbody:first-child tr:first-child td{border-top:0;} +.table-bordered thead:first-child tr:first-child th:first-child,.table-bordered tbody:first-child tr:first-child td:first-child{-webkit-border-top-left-radius:4px;border-top-left-radius:4px;-moz-border-radius-topleft:4px;} +.table-bordered thead:first-child tr:first-child th:last-child,.table-bordered tbody:first-child tr:first-child td:last-child{-webkit-border-top-right-radius:4px;border-top-right-radius:4px;-moz-border-radius-topright:4px;} +.table-bordered thead:last-child tr:last-child th:first-child,.table-bordered tbody:last-child tr:last-child td:first-child{-webkit-border-radius:0 0 0 4px;-moz-border-radius:0 0 0 4px;border-radius:0 0 0 4px;-webkit-border-bottom-left-radius:4px;border-bottom-left-radius:4px;-moz-border-radius-bottomleft:4px;} +.table-bordered thead:last-child tr:last-child th:last-child,.table-bordered tbody:last-child tr:last-child td:last-child{-webkit-border-bottom-right-radius:4px;border-bottom-right-radius:4px;-moz-border-radius-bottomright:4px;} +.table-striped tbody tr:nth-child(odd) td,.table-striped tbody tr:nth-child(odd) th{background-color:#f9f9f9;} +.table tbody tr:hover td,.table tbody tr:hover th{background-color:#f5f5f5;} +table .span1{float:none;width:44px;margin-left:0;} +table .span2{float:none;width:124px;margin-left:0;} +table .span3{float:none;width:204px;margin-left:0;} +table .span4{float:none;width:284px;margin-left:0;} +table .span5{float:none;width:364px;margin-left:0;} +table .span6{float:none;width:444px;margin-left:0;} +table .span7{float:none;width:524px;margin-left:0;} +table .span8{float:none;width:604px;margin-left:0;} +table .span9{float:none;width:684px;margin-left:0;} +table .span10{float:none;width:764px;margin-left:0;} +table .span11{float:none;width:844px;margin-left:0;} +table .span12{float:none;width:924px;margin-left:0;} +table .span13{float:none;width:1004px;margin-left:0;} +table .span14{float:none;width:1084px;margin-left:0;} +table .span15{float:none;width:1164px;margin-left:0;} +table .span16{float:none;width:1244px;margin-left:0;} +table .span17{float:none;width:1324px;margin-left:0;} +table .span18{float:none;width:1404px;margin-left:0;} +table .span19{float:none;width:1484px;margin-left:0;} +table .span20{float:none;width:1564px;margin-left:0;} +table .span21{float:none;width:1644px;margin-left:0;} +table .span22{float:none;width:1724px;margin-left:0;} +table .span23{float:none;width:1804px;margin-left:0;} +table .span24{float:none;width:1884px;margin-left:0;} +form{margin:0 0 18px;} +fieldset{padding:0;margin:0;border:0;} +legend{display:block;width:100%;padding:0;margin-bottom:27px;font-size:19.5px;line-height:36px;color:#333333;border:0;border-bottom:1px solid #e5e5e5;}legend small{font-size:13.5px;color:#999999;} +label,input,button,select,textarea{font-size:13px;font-weight:normal;line-height:18px;} +input,button,select,textarea{font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;} +label{display:block;margin-bottom:5px;} +select,textarea,input[type="text"],input[type="password"],input[type="datetime"],input[type="datetime-local"],input[type="date"],input[type="month"],input[type="time"],input[type="week"],input[type="number"],input[type="email"],input[type="url"],input[type="search"],input[type="tel"],input[type="color"],.uneditable-input{display:inline-block;height:18px;padding:4px;margin-bottom:9px;font-size:13px;line-height:18px;color:#555555;} +input,textarea{width:210px;} +textarea{height:auto;} +textarea,input[type="text"],input[type="password"],input[type="datetime"],input[type="datetime-local"],input[type="date"],input[type="month"],input[type="time"],input[type="week"],input[type="number"],input[type="email"],input[type="url"],input[type="search"],input[type="tel"],input[type="color"],.uneditable-input{background-color:#ffffff;border:1px solid #cccccc;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px;-webkit-box-shadow:inset 0 1px 1px rgba(0, 0, 0, 0.075);-moz-box-shadow:inset 0 1px 1px rgba(0, 0, 0, 0.075);box-shadow:inset 0 1px 1px rgba(0, 0, 0, 0.075);-webkit-transition:border linear 0.2s,box-shadow linear 0.2s;-moz-transition:border linear 0.2s,box-shadow linear 0.2s;-ms-transition:border linear 0.2s,box-shadow linear 0.2s;-o-transition:border linear 0.2s,box-shadow linear 0.2s;transition:border linear 0.2s,box-shadow linear 0.2s;}textarea:focus,input[type="text"]:focus,input[type="password"]:focus,input[type="datetime"]:focus,input[type="datetime-local"]:focus,input[type="date"]:focus,input[type="month"]:focus,input[type="time"]:focus,input[type="week"]:focus,input[type="number"]:focus,input[type="email"]:focus,input[type="url"]:focus,input[type="search"]:focus,input[type="tel"]:focus,input[type="color"]:focus,.uneditable-input:focus{border-color:rgba(82, 168, 236, 0.8);outline:0;outline:thin dotted \9;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px rgba(82,168,236,.6);-moz-box-shadow:inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px rgba(82,168,236,.6);box-shadow:inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px rgba(82,168,236,.6);} +input[type="radio"],input[type="checkbox"]{margin:3px 0;*margin-top:0;line-height:normal;cursor:pointer;} +input[type="submit"],input[type="reset"],input[type="button"],input[type="radio"],input[type="checkbox"]{width:auto;} +.uneditable-textarea{width:auto;height:auto;} +select,input[type="file"]{height:28px;*margin-top:4px;line-height:28px;} +select{width:220px;border:1px solid #bbb;} +select[multiple],select[size]{height:auto;} +select:focus,input[type="file"]:focus,input[type="radio"]:focus,input[type="checkbox"]:focus{outline:thin dotted #333;outline:5px auto -webkit-focus-ring-color;outline-offset:-2px;} +.radio,.checkbox{min-height:18px;padding-left:18px;} +.radio input[type="radio"],.checkbox input[type="checkbox"]{float:left;margin-left:-18px;} +.controls>.radio:first-child,.controls>.checkbox:first-child{padding-top:5px;} +.radio.inline,.checkbox.inline{display:inline-block;padding-top:5px;margin-bottom:0;vertical-align:middle;} +.radio.inline+.radio.inline,.checkbox.inline+.checkbox.inline{margin-left:10px;} +.input-mini{width:60px;} +.input-small{width:90px;} +.input-medium{width:150px;} +.input-large{width:210px;} +.input-xlarge{width:270px;} +.input-xxlarge{width:530px;} +input[class*="span"],select[class*="span"],textarea[class*="span"],.uneditable-input[class*="span"],.row-fluid input[class*="span"],.row-fluid select[class*="span"],.row-fluid textarea[class*="span"],.row-fluid .uneditable-input[class*="span"]{float:none;margin-left:0;} +.input-append input[class*="span"],.input-append .uneditable-input[class*="span"],.input-prepend input[class*="span"],.input-prepend .uneditable-input[class*="span"],.row-fluid .input-prepend [class*="span"],.row-fluid .input-append [class*="span"]{display:inline-block;} +input,textarea,.uneditable-input{margin-left:0;} +input.span12, textarea.span12, .uneditable-input.span12{width:930px;} +input.span11, textarea.span11, .uneditable-input.span11{width:850px;} +input.span10, textarea.span10, .uneditable-input.span10{width:770px;} +input.span9, textarea.span9, .uneditable-input.span9{width:690px;} +input.span8, textarea.span8, .uneditable-input.span8{width:610px;} +input.span7, textarea.span7, .uneditable-input.span7{width:530px;} +input.span6, textarea.span6, .uneditable-input.span6{width:450px;} +input.span5, textarea.span5, .uneditable-input.span5{width:370px;} +input.span4, textarea.span4, .uneditable-input.span4{width:290px;} +input.span3, textarea.span3, .uneditable-input.span3{width:210px;} +input.span2, textarea.span2, .uneditable-input.span2{width:130px;} +input.span1, textarea.span1, .uneditable-input.span1{width:50px;} +input[disabled],select[disabled],textarea[disabled],input[readonly],select[readonly],textarea[readonly]{cursor:not-allowed;background-color:#eeeeee;border-color:#ddd;} +input[type="radio"][disabled],input[type="checkbox"][disabled],input[type="radio"][readonly],input[type="checkbox"][readonly]{background-color:transparent;} +.control-group.warning>label,.control-group.warning .help-block,.control-group.warning .help-inline{color:#c09853;} +.control-group.warning .checkbox,.control-group.warning .radio,.control-group.warning input,.control-group.warning select,.control-group.warning textarea{color:#c09853;border-color:#c09853;}.control-group.warning .checkbox:focus,.control-group.warning .radio:focus,.control-group.warning input:focus,.control-group.warning select:focus,.control-group.warning textarea:focus{border-color:#a47e3c;-webkit-box-shadow:0 0 6px #dbc59e;-moz-box-shadow:0 0 6px #dbc59e;box-shadow:0 0 6px #dbc59e;} +.control-group.warning .input-prepend .add-on,.control-group.warning .input-append .add-on{color:#c09853;background-color:#fcf8e3;border-color:#c09853;} +.control-group.error>label,.control-group.error .help-block,.control-group.error .help-inline{color:#b94a48;} +.control-group.error .checkbox,.control-group.error .radio,.control-group.error input,.control-group.error select,.control-group.error textarea{color:#b94a48;border-color:#b94a48;}.control-group.error .checkbox:focus,.control-group.error .radio:focus,.control-group.error input:focus,.control-group.error select:focus,.control-group.error textarea:focus{border-color:#953b39;-webkit-box-shadow:0 0 6px #d59392;-moz-box-shadow:0 0 6px #d59392;box-shadow:0 0 6px #d59392;} +.control-group.error .input-prepend .add-on,.control-group.error .input-append .add-on{color:#b94a48;background-color:#f2dede;border-color:#b94a48;} +.control-group.success>label,.control-group.success .help-block,.control-group.success .help-inline{color:#468847;} +.control-group.success .checkbox,.control-group.success .radio,.control-group.success input,.control-group.success select,.control-group.success textarea{color:#468847;border-color:#468847;}.control-group.success .checkbox:focus,.control-group.success .radio:focus,.control-group.success input:focus,.control-group.success select:focus,.control-group.success textarea:focus{border-color:#356635;-webkit-box-shadow:0 0 6px #7aba7b;-moz-box-shadow:0 0 6px #7aba7b;box-shadow:0 0 6px #7aba7b;} +.control-group.success .input-prepend .add-on,.control-group.success .input-append .add-on{color:#468847;background-color:#dff0d8;border-color:#468847;} +input:focus:required:invalid,textarea:focus:required:invalid,select:focus:required:invalid{color:#b94a48;border-color:#ee5f5b;}input:focus:required:invalid:focus,textarea:focus:required:invalid:focus,select:focus:required:invalid:focus{border-color:#e9322d;-webkit-box-shadow:0 0 6px #f8b9b7;-moz-box-shadow:0 0 6px #f8b9b7;box-shadow:0 0 6px #f8b9b7;} +.form-actions{padding:17px 20px 18px;margin-top:18px;margin-bottom:18px;background-color:#f5f5f5;border-top:1px solid #e5e5e5;*zoom:1;}.form-actions:before,.form-actions:after{display:table;content:"";} +.form-actions:after{clear:both;} +.uneditable-input{overflow:hidden;white-space:nowrap;cursor:not-allowed;background-color:#ffffff;border-color:#eee;-webkit-box-shadow:inset 0 1px 2px rgba(0, 0, 0, 0.025);-moz-box-shadow:inset 0 1px 2px rgba(0, 0, 0, 0.025);box-shadow:inset 0 1px 2px rgba(0, 0, 0, 0.025);} +:-moz-placeholder{color:#999999;} +:-ms-input-placeholder{color:#999999;} +::-webkit-input-placeholder{color:#999999;} +.help-block,.help-inline{color:#555555;} +.help-block{display:block;margin-bottom:9px;} +.help-inline{display:inline-block;*display:inline;*zoom:1;vertical-align:middle;padding-left:5px;} +.input-prepend,.input-append{margin-bottom:5px;}.input-prepend input,.input-append input,.input-prepend select,.input-append select,.input-prepend .uneditable-input,.input-append .uneditable-input{position:relative;margin-bottom:0;*margin-left:0;vertical-align:middle;-webkit-border-radius:0 3px 3px 0;-moz-border-radius:0 3px 3px 0;border-radius:0 3px 3px 0;}.input-prepend input:focus,.input-append input:focus,.input-prepend select:focus,.input-append select:focus,.input-prepend .uneditable-input:focus,.input-append .uneditable-input:focus{z-index:2;} +.input-prepend .uneditable-input,.input-append .uneditable-input{border-left-color:#ccc;} +.input-prepend .add-on,.input-append .add-on{display:inline-block;width:auto;height:18px;min-width:16px;padding:4px 5px;font-weight:normal;line-height:18px;text-align:center;text-shadow:0 1px 0 #ffffff;vertical-align:middle;background-color:#eeeeee;border:1px solid #ccc;} +.input-prepend .add-on,.input-append .add-on,.input-prepend .btn,.input-append .btn{margin-left:-1px;-webkit-border-radius:0;-moz-border-radius:0;border-radius:0;} +.input-prepend .active,.input-append .active{background-color:#a9dba9;border-color:#46a546;} +.input-prepend .add-on,.input-prepend .btn{margin-right:-1px;} +.input-prepend .add-on:first-child,.input-prepend .btn:first-child{-webkit-border-radius:3px 0 0 3px;-moz-border-radius:3px 0 0 3px;border-radius:3px 0 0 3px;} +.input-append input,.input-append select,.input-append .uneditable-input{-webkit-border-radius:3px 0 0 3px;-moz-border-radius:3px 0 0 3px;border-radius:3px 0 0 3px;} +.input-append .uneditable-input{border-right-color:#ccc;border-left-color:#eee;} +.input-append .add-on:last-child,.input-append .btn:last-child{-webkit-border-radius:0 3px 3px 0;-moz-border-radius:0 3px 3px 0;border-radius:0 3px 3px 0;} +.input-prepend.input-append input,.input-prepend.input-append select,.input-prepend.input-append .uneditable-input{-webkit-border-radius:0;-moz-border-radius:0;border-radius:0;} +.input-prepend.input-append .add-on:first-child,.input-prepend.input-append .btn:first-child{margin-right:-1px;-webkit-border-radius:3px 0 0 3px;-moz-border-radius:3px 0 0 3px;border-radius:3px 0 0 3px;} +.input-prepend.input-append .add-on:last-child,.input-prepend.input-append .btn:last-child{margin-left:-1px;-webkit-border-radius:0 3px 3px 0;-moz-border-radius:0 3px 3px 0;border-radius:0 3px 3px 0;} +.search-query{padding-right:14px;padding-right:4px \9;padding-left:14px;padding-left:4px \9;margin-bottom:0;-webkit-border-radius:14px;-moz-border-radius:14px;border-radius:14px;} +.form-search input,.form-inline input,.form-horizontal input,.form-search textarea,.form-inline textarea,.form-horizontal textarea,.form-search select,.form-inline select,.form-horizontal select,.form-search .help-inline,.form-inline .help-inline,.form-horizontal .help-inline,.form-search .uneditable-input,.form-inline .uneditable-input,.form-horizontal .uneditable-input,.form-search .input-prepend,.form-inline .input-prepend,.form-horizontal .input-prepend,.form-search .input-append,.form-inline .input-append,.form-horizontal .input-append{display:inline-block;*display:inline;*zoom:1;margin-bottom:0;} +.form-search .hide,.form-inline .hide,.form-horizontal .hide{display:none;} +.form-search label,.form-inline label{display:inline-block;} +.form-search .input-append,.form-inline .input-append,.form-search .input-prepend,.form-inline .input-prepend{margin-bottom:0;} +.form-search .radio,.form-search .checkbox,.form-inline .radio,.form-inline .checkbox{padding-left:0;margin-bottom:0;vertical-align:middle;} +.form-search .radio input[type="radio"],.form-search .checkbox input[type="checkbox"],.form-inline .radio input[type="radio"],.form-inline .checkbox input[type="checkbox"]{float:left;margin-right:3px;margin-left:0;} +.control-group{margin-bottom:9px;} +legend+.control-group{margin-top:18px;-webkit-margin-top-collapse:separate;} +.form-horizontal .control-group{margin-bottom:18px;*zoom:1;}.form-horizontal .control-group:before,.form-horizontal .control-group:after{display:table;content:"";} +.form-horizontal .control-group:after{clear:both;} +.form-horizontal .control-label{float:left;width:140px;padding-top:5px;text-align:right;} +.form-horizontal .controls{*display:inline-block;*padding-left:20px;margin-left:160px;*margin-left:0;}.form-horizontal .controls:first-child{*padding-left:160px;} +.form-horizontal .help-block{margin-top:9px;margin-bottom:0;} +.form-horizontal .form-actions{padding-left:160px;} +.btn{display:inline-block;*display:inline;*zoom:1;padding:4px 10px 4px;margin-bottom:0;font-size:13px;line-height:18px;*line-height:20px;color:#333333;text-align:center;text-shadow:0 1px 1px rgba(255, 255, 255, 0.75);vertical-align:middle;cursor:pointer;background-color:#f5f5f5;background-image:-moz-linear-gradient(top, #ffffff, #e6e6e6);background-image:-ms-linear-gradient(top, #ffffff, #e6e6e6);background-image:-webkit-gradient(linear, 0 0, 0 100%, from(#ffffff), to(#e6e6e6));background-image:-webkit-linear-gradient(top, #ffffff, #e6e6e6);background-image:-o-linear-gradient(top, #ffffff, #e6e6e6);background-image:linear-gradient(top, #ffffff, #e6e6e6);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffff', endColorstr='#e6e6e6', GradientType=0);border-color:#e6e6e6 #e6e6e6 #bfbfbf;border-color:rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);*background-color:#e6e6e6;filter:progid:DXImageTransform.Microsoft.gradient(enabled = false);border:1px solid #cccccc;*border:0;border-bottom-color:#b3b3b3;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;*margin-left:.3em;-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,.2), 0 1px 2px rgba(0,0,0,.05);-moz-box-shadow:inset 0 1px 0 rgba(255,255,255,.2), 0 1px 2px rgba(0,0,0,.05);box-shadow:inset 0 1px 0 rgba(255,255,255,.2), 0 1px 2px rgba(0,0,0,.05);}.btn:hover,.btn:active,.btn.active,.btn.disabled,.btn[disabled]{background-color:#e6e6e6;*background-color:#d9d9d9;} +.btn:active,.btn.active{background-color:#cccccc \9;} +.btn:first-child{*margin-left:0;} +.btn:hover{color:#333333;text-decoration:none;background-color:#e6e6e6;*background-color:#d9d9d9;background-position:0 -15px;-webkit-transition:background-position 0.1s linear;-moz-transition:background-position 0.1s linear;-ms-transition:background-position 0.1s linear;-o-transition:background-position 0.1s linear;transition:background-position 0.1s linear;} +.btn:focus{outline:thin dotted #333;outline:5px auto -webkit-focus-ring-color;outline-offset:-2px;} +.btn.active,.btn:active{background-color:#e6e6e6;background-color:#d9d9d9 \9;background-image:none;outline:0;-webkit-box-shadow:inset 0 2px 4px rgba(0,0,0,.15), 0 1px 2px rgba(0,0,0,.05);-moz-box-shadow:inset 0 2px 4px rgba(0,0,0,.15), 0 1px 2px rgba(0,0,0,.05);box-shadow:inset 0 2px 4px rgba(0,0,0,.15), 0 1px 2px rgba(0,0,0,.05);} +.btn.disabled,.btn[disabled]{cursor:default;background-color:#e6e6e6;background-image:none;opacity:0.65;filter:alpha(opacity=65);-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none;} +.btn-large{padding:9px 14px;font-size:15px;line-height:normal;-webkit-border-radius:5px;-moz-border-radius:5px;border-radius:5px;} +.btn-large [class^="icon-"]{margin-top:1px;} +.btn-small{padding:5px 9px;font-size:11px;line-height:16px;} +.btn-small [class^="icon-"]{margin-top:-1px;} +.btn-mini{padding:2px 6px;font-size:11px;line-height:14px;} +.btn-primary,.btn-primary:hover,.btn-warning,.btn-warning:hover,.btn-danger,.btn-danger:hover,.btn-success,.btn-success:hover,.btn-info,.btn-info:hover,.btn-inverse,.btn-inverse:hover{color:#ffffff;text-shadow:0 -1px 0 rgba(0, 0, 0, 0.25);} +.btn-primary.active,.btn-warning.active,.btn-danger.active,.btn-success.active,.btn-info.active,.btn-inverse.active{color:rgba(255, 255, 255, 0.75);} +.btn{border-color:#ccc;border-color:rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);} +.btn-primary{background-color:#0074cc;background-image:-moz-linear-gradient(top, #0088cc, #0055cc);background-image:-ms-linear-gradient(top, #0088cc, #0055cc);background-image:-webkit-gradient(linear, 0 0, 0 100%, from(#0088cc), to(#0055cc));background-image:-webkit-linear-gradient(top, #0088cc, #0055cc);background-image:-o-linear-gradient(top, #0088cc, #0055cc);background-image:linear-gradient(top, #0088cc, #0055cc);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#0088cc', endColorstr='#0055cc', GradientType=0);border-color:#0055cc #0055cc #003580;border-color:rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);*background-color:#0055cc;filter:progid:DXImageTransform.Microsoft.gradient(enabled = false);}.btn-primary:hover,.btn-primary:active,.btn-primary.active,.btn-primary.disabled,.btn-primary[disabled]{background-color:#0055cc;*background-color:#004ab3;} +.btn-primary:active,.btn-primary.active{background-color:#004099 \9;} +.btn-warning{background-color:#faa732;background-image:-moz-linear-gradient(top, #fbb450, #f89406);background-image:-ms-linear-gradient(top, #fbb450, #f89406);background-image:-webkit-gradient(linear, 0 0, 0 100%, from(#fbb450), to(#f89406));background-image:-webkit-linear-gradient(top, #fbb450, #f89406);background-image:-o-linear-gradient(top, #fbb450, #f89406);background-image:linear-gradient(top, #fbb450, #f89406);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fbb450', endColorstr='#f89406', GradientType=0);border-color:#f89406 #f89406 #ad6704;border-color:rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);*background-color:#f89406;filter:progid:DXImageTransform.Microsoft.gradient(enabled = false);}.btn-warning:hover,.btn-warning:active,.btn-warning.active,.btn-warning.disabled,.btn-warning[disabled]{background-color:#f89406;*background-color:#df8505;} +.btn-warning:active,.btn-warning.active{background-color:#c67605 \9;} +.btn-danger{background-color:#da4f49;background-image:-moz-linear-gradient(top, #ee5f5b, #bd362f);background-image:-ms-linear-gradient(top, #ee5f5b, #bd362f);background-image:-webkit-gradient(linear, 0 0, 0 100%, from(#ee5f5b), to(#bd362f));background-image:-webkit-linear-gradient(top, #ee5f5b, #bd362f);background-image:-o-linear-gradient(top, #ee5f5b, #bd362f);background-image:linear-gradient(top, #ee5f5b, #bd362f);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ee5f5b', endColorstr='#bd362f', GradientType=0);border-color:#bd362f #bd362f #802420;border-color:rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);*background-color:#bd362f;filter:progid:DXImageTransform.Microsoft.gradient(enabled = false);}.btn-danger:hover,.btn-danger:active,.btn-danger.active,.btn-danger.disabled,.btn-danger[disabled]{background-color:#bd362f;*background-color:#a9302a;} +.btn-danger:active,.btn-danger.active{background-color:#942a25 \9;} +.btn-success{background-color:#5bb75b;background-image:-moz-linear-gradient(top, #62c462, #51a351);background-image:-ms-linear-gradient(top, #62c462, #51a351);background-image:-webkit-gradient(linear, 0 0, 0 100%, from(#62c462), to(#51a351));background-image:-webkit-linear-gradient(top, #62c462, #51a351);background-image:-o-linear-gradient(top, #62c462, #51a351);background-image:linear-gradient(top, #62c462, #51a351);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#62c462', endColorstr='#51a351', GradientType=0);border-color:#51a351 #51a351 #387038;border-color:rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);*background-color:#51a351;filter:progid:DXImageTransform.Microsoft.gradient(enabled = false);}.btn-success:hover,.btn-success:active,.btn-success.active,.btn-success.disabled,.btn-success[disabled]{background-color:#51a351;*background-color:#499249;} +.btn-success:active,.btn-success.active{background-color:#408140 \9;} +.btn-info{background-color:#49afcd;background-image:-moz-linear-gradient(top, #5bc0de, #2f96b4);background-image:-ms-linear-gradient(top, #5bc0de, #2f96b4);background-image:-webkit-gradient(linear, 0 0, 0 100%, from(#5bc0de), to(#2f96b4));background-image:-webkit-linear-gradient(top, #5bc0de, #2f96b4);background-image:-o-linear-gradient(top, #5bc0de, #2f96b4);background-image:linear-gradient(top, #5bc0de, #2f96b4);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#5bc0de', endColorstr='#2f96b4', GradientType=0);border-color:#2f96b4 #2f96b4 #1f6377;border-color:rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);*background-color:#2f96b4;filter:progid:DXImageTransform.Microsoft.gradient(enabled = false);}.btn-info:hover,.btn-info:active,.btn-info.active,.btn-info.disabled,.btn-info[disabled]{background-color:#2f96b4;*background-color:#2a85a0;} +.btn-info:active,.btn-info.active{background-color:#24748c \9;} +.btn-inverse{background-color:#414141;background-image:-moz-linear-gradient(top, #555555, #222222);background-image:-ms-linear-gradient(top, #555555, #222222);background-image:-webkit-gradient(linear, 0 0, 0 100%, from(#555555), to(#222222));background-image:-webkit-linear-gradient(top, #555555, #222222);background-image:-o-linear-gradient(top, #555555, #222222);background-image:linear-gradient(top, #555555, #222222);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#555555', endColorstr='#222222', GradientType=0);border-color:#222222 #222222 #000000;border-color:rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);*background-color:#222222;filter:progid:DXImageTransform.Microsoft.gradient(enabled = false);}.btn-inverse:hover,.btn-inverse:active,.btn-inverse.active,.btn-inverse.disabled,.btn-inverse[disabled]{background-color:#222222;*background-color:#151515;} +.btn-inverse:active,.btn-inverse.active{background-color:#080808 \9;} +button.btn,input[type="submit"].btn{*padding-top:2px;*padding-bottom:2px;}button.btn::-moz-focus-inner,input[type="submit"].btn::-moz-focus-inner{padding:0;border:0;} +button.btn.btn-large,input[type="submit"].btn.btn-large{*padding-top:7px;*padding-bottom:7px;} +button.btn.btn-small,input[type="submit"].btn.btn-small{*padding-top:3px;*padding-bottom:3px;} +button.btn.btn-mini,input[type="submit"].btn.btn-mini{*padding-top:1px;*padding-bottom:1px;} +[class^="icon-"],[class*=" icon-"]{display:inline-block;width:14px;height:14px;*margin-right:.3em;line-height:14px;vertical-align:text-top;background-image:url("../img/glyphicons-halflings.png");background-position:14px 14px;background-repeat:no-repeat;}[class^="icon-"]:last-child,[class*=" icon-"]:last-child{*margin-left:0;} +.icon-white{background-image:url("../img/glyphicons-halflings-white.png");} +.icon-glass{background-position:0 0;} +.icon-music{background-position:-24px 0;} +.icon-search{background-position:-48px 0;} +.icon-envelope{background-position:-72px 0;} +.icon-heart{background-position:-96px 0;} +.icon-star{background-position:-120px 0;} +.icon-star-empty{background-position:-144px 0;} +.icon-user{background-position:-168px 0;} +.icon-film{background-position:-192px 0;} +.icon-th-large{background-position:-216px 0;} +.icon-th{background-position:-240px 0;} +.icon-th-list{background-position:-264px 0;} +.icon-ok{background-position:-288px 0;} +.icon-remove{background-position:-312px 0;} +.icon-zoom-in{background-position:-336px 0;} +.icon-zoom-out{background-position:-360px 0;} +.icon-off{background-position:-384px 0;} +.icon-signal{background-position:-408px 0;} +.icon-cog{background-position:-432px 0;} +.icon-trash{background-position:-456px 0;} +.icon-home{background-position:0 -24px;} +.icon-file{background-position:-24px -24px;} +.icon-time{background-position:-48px -24px;} +.icon-road{background-position:-72px -24px;} +.icon-download-alt{background-position:-96px -24px;} +.icon-download{background-position:-120px -24px;} +.icon-upload{background-position:-144px -24px;} +.icon-inbox{background-position:-168px -24px;} +.icon-play-circle{background-position:-192px -24px;} +.icon-repeat{background-position:-216px -24px;} +.icon-refresh{background-position:-240px -24px;} +.icon-list-alt{background-position:-264px -24px;} +.icon-lock{background-position:-287px -24px;} +.icon-flag{background-position:-312px -24px;} +.icon-headphones{background-position:-336px -24px;} +.icon-volume-off{background-position:-360px -24px;} +.icon-volume-down{background-position:-384px -24px;} +.icon-volume-up{background-position:-408px -24px;} +.icon-qrcode{background-position:-432px -24px;} +.icon-barcode{background-position:-456px -24px;} +.icon-tag{background-position:0 -48px;} +.icon-tags{background-position:-25px -48px;} +.icon-book{background-position:-48px -48px;} +.icon-bookmark{background-position:-72px -48px;} +.icon-print{background-position:-96px -48px;} +.icon-camera{background-position:-120px -48px;} +.icon-font{background-position:-144px -48px;} +.icon-bold{background-position:-167px -48px;} +.icon-italic{background-position:-192px -48px;} +.icon-text-height{background-position:-216px -48px;} +.icon-text-width{background-position:-240px -48px;} +.icon-align-left{background-position:-264px -48px;} +.icon-align-center{background-position:-288px -48px;} +.icon-align-right{background-position:-312px -48px;} +.icon-align-justify{background-position:-336px -48px;} +.icon-list{background-position:-360px -48px;} +.icon-indent-left{background-position:-384px -48px;} +.icon-indent-right{background-position:-408px -48px;} +.icon-facetime-video{background-position:-432px -48px;} +.icon-picture{background-position:-456px -48px;} +.icon-pencil{background-position:0 -72px;} +.icon-map-marker{background-position:-24px -72px;} +.icon-adjust{background-position:-48px -72px;} +.icon-tint{background-position:-72px -72px;} +.icon-edit{background-position:-96px -72px;} +.icon-share{background-position:-120px -72px;} +.icon-check{background-position:-144px -72px;} +.icon-move{background-position:-168px -72px;} +.icon-step-backward{background-position:-192px -72px;} +.icon-fast-backward{background-position:-216px -72px;} +.icon-backward{background-position:-240px -72px;} +.icon-play{background-position:-264px -72px;} +.icon-pause{background-position:-288px -72px;} +.icon-stop{background-position:-312px -72px;} +.icon-forward{background-position:-336px -72px;} +.icon-fast-forward{background-position:-360px -72px;} +.icon-step-forward{background-position:-384px -72px;} +.icon-eject{background-position:-408px -72px;} +.icon-chevron-left{background-position:-432px -72px;} +.icon-chevron-right{background-position:-456px -72px;} +.icon-plus-sign{background-position:0 -96px;} +.icon-minus-sign{background-position:-24px -96px;} +.icon-remove-sign{background-position:-48px -96px;} +.icon-ok-sign{background-position:-72px -96px;} +.icon-question-sign{background-position:-96px -96px;} +.icon-info-sign{background-position:-120px -96px;} +.icon-screenshot{background-position:-144px -96px;} +.icon-remove-circle{background-position:-168px -96px;} +.icon-ok-circle{background-position:-192px -96px;} +.icon-ban-circle{background-position:-216px -96px;} +.icon-arrow-left{background-position:-240px -96px;} +.icon-arrow-right{background-position:-264px -96px;} +.icon-arrow-up{background-position:-289px -96px;} +.icon-arrow-down{background-position:-312px -96px;} +.icon-share-alt{background-position:-336px -96px;} +.icon-resize-full{background-position:-360px -96px;} +.icon-resize-small{background-position:-384px -96px;} +.icon-plus{background-position:-408px -96px;} +.icon-minus{background-position:-433px -96px;} +.icon-asterisk{background-position:-456px -96px;} +.icon-exclamation-sign{background-position:0 -120px;} +.icon-gift{background-position:-24px -120px;} +.icon-leaf{background-position:-48px -120px;} +.icon-fire{background-position:-72px -120px;} +.icon-eye-open{background-position:-96px -120px;} +.icon-eye-close{background-position:-120px -120px;} +.icon-warning-sign{background-position:-144px -120px;} +.icon-plane{background-position:-168px -120px;} +.icon-calendar{background-position:-192px -120px;} +.icon-random{background-position:-216px -120px;} +.icon-comment{background-position:-240px -120px;} +.icon-magnet{background-position:-264px -120px;} +.icon-chevron-up{background-position:-288px -120px;} +.icon-chevron-down{background-position:-313px -119px;} +.icon-retweet{background-position:-336px -120px;} +.icon-shopping-cart{background-position:-360px -120px;} +.icon-folder-close{background-position:-384px -120px;} +.icon-folder-open{background-position:-408px -120px;} +.icon-resize-vertical{background-position:-432px -119px;} +.icon-resize-horizontal{background-position:-456px -118px;} +.icon-hdd{background-position:0 -144px;} +.icon-bullhorn{background-position:-24px -144px;} +.icon-bell{background-position:-48px -144px;} +.icon-certificate{background-position:-72px -144px;} +.icon-thumbs-up{background-position:-96px -144px;} +.icon-thumbs-down{background-position:-120px -144px;} +.icon-hand-right{background-position:-144px -144px;} +.icon-hand-left{background-position:-168px -144px;} +.icon-hand-up{background-position:-192px -144px;} +.icon-hand-down{background-position:-216px -144px;} +.icon-circle-arrow-right{background-position:-240px -144px;} +.icon-circle-arrow-left{background-position:-264px -144px;} +.icon-circle-arrow-up{background-position:-288px -144px;} +.icon-circle-arrow-down{background-position:-312px -144px;} +.icon-globe{background-position:-336px -144px;} +.icon-wrench{background-position:-360px -144px;} +.icon-tasks{background-position:-384px -144px;} +.icon-filter{background-position:-408px -144px;} +.icon-briefcase{background-position:-432px -144px;} +.icon-fullscreen{background-position:-456px -144px;} +.btn-group{position:relative;*zoom:1;*margin-left:.3em;}.btn-group:before,.btn-group:after{display:table;content:"";} +.btn-group:after{clear:both;} +.btn-group:first-child{*margin-left:0;} +.btn-group+.btn-group{margin-left:5px;} +.btn-toolbar{margin-top:9px;margin-bottom:9px;}.btn-toolbar .btn-group{display:inline-block;*display:inline;*zoom:1;} +.btn-group>.btn{position:relative;float:left;margin-left:-1px;-webkit-border-radius:0;-moz-border-radius:0;border-radius:0;} +.btn-group>.btn:first-child{margin-left:0;-webkit-border-top-left-radius:4px;-moz-border-radius-topleft:4px;border-top-left-radius:4px;-webkit-border-bottom-left-radius:4px;-moz-border-radius-bottomleft:4px;border-bottom-left-radius:4px;} +.btn-group>.btn:last-child,.btn-group>.dropdown-toggle{-webkit-border-top-right-radius:4px;-moz-border-radius-topright:4px;border-top-right-radius:4px;-webkit-border-bottom-right-radius:4px;-moz-border-radius-bottomright:4px;border-bottom-right-radius:4px;} +.btn-group>.btn.large:first-child{margin-left:0;-webkit-border-top-left-radius:6px;-moz-border-radius-topleft:6px;border-top-left-radius:6px;-webkit-border-bottom-left-radius:6px;-moz-border-radius-bottomleft:6px;border-bottom-left-radius:6px;} +.btn-group>.btn.large:last-child,.btn-group>.large.dropdown-toggle{-webkit-border-top-right-radius:6px;-moz-border-radius-topright:6px;border-top-right-radius:6px;-webkit-border-bottom-right-radius:6px;-moz-border-radius-bottomright:6px;border-bottom-right-radius:6px;} +.btn-group>.btn:hover,.btn-group>.btn:focus,.btn-group>.btn:active,.btn-group>.btn.active{z-index:2;} +.btn-group .dropdown-toggle:active,.btn-group.open .dropdown-toggle{outline:0;} +.btn-group>.dropdown-toggle{padding-left:8px;padding-right:8px;-webkit-box-shadow:inset 1px 0 0 rgba(255,255,255,.125), inset 0 1px 0 rgba(255,255,255,.2), 0 1px 2px rgba(0,0,0,.05);-moz-box-shadow:inset 1px 0 0 rgba(255,255,255,.125), inset 0 1px 0 rgba(255,255,255,.2), 0 1px 2px rgba(0,0,0,.05);box-shadow:inset 1px 0 0 rgba(255,255,255,.125), inset 0 1px 0 rgba(255,255,255,.2), 0 1px 2px rgba(0,0,0,.05);*padding-top:4px;*padding-bottom:4px;} +.btn-group>.btn-mini.dropdown-toggle{padding-left:5px;padding-right:5px;} +.btn-group>.btn-small.dropdown-toggle{*padding-top:4px;*padding-bottom:4px;} +.btn-group>.btn-large.dropdown-toggle{padding-left:12px;padding-right:12px;} +.btn-group.open .dropdown-toggle{background-image:none;-webkit-box-shadow:inset 0 2px 4px rgba(0,0,0,.15), 0 1px 2px rgba(0,0,0,.05);-moz-box-shadow:inset 0 2px 4px rgba(0,0,0,.15), 0 1px 2px rgba(0,0,0,.05);box-shadow:inset 0 2px 4px rgba(0,0,0,.15), 0 1px 2px rgba(0,0,0,.05);} +.btn-group.open .btn.dropdown-toggle{background-color:#e6e6e6;} +.btn-group.open .btn-primary.dropdown-toggle{background-color:#0055cc;} +.btn-group.open .btn-warning.dropdown-toggle{background-color:#f89406;} +.btn-group.open .btn-danger.dropdown-toggle{background-color:#bd362f;} +.btn-group.open .btn-success.dropdown-toggle{background-color:#51a351;} +.btn-group.open .btn-info.dropdown-toggle{background-color:#2f96b4;} +.btn-group.open .btn-inverse.dropdown-toggle{background-color:#222222;} +.btn .caret{margin-top:7px;margin-left:0;} +.btn:hover .caret,.open.btn-group .caret{opacity:1;filter:alpha(opacity=100);} +.btn-mini .caret{margin-top:5px;} +.btn-small .caret{margin-top:6px;} +.btn-large .caret{margin-top:6px;border-left-width:5px;border-right-width:5px;border-top-width:5px;} +.dropup .btn-large .caret{border-bottom:5px solid #000000;border-top:0;} +.btn-primary .caret,.btn-warning .caret,.btn-danger .caret,.btn-info .caret,.btn-success .caret,.btn-inverse .caret{border-top-color:#ffffff;border-bottom-color:#ffffff;opacity:0.75;filter:alpha(opacity=75);} +.nav{margin-left:0;margin-bottom:18px;list-style:none;} +.nav>li>a{display:block;} +.nav>li>a:hover{text-decoration:none;background-color:#eeeeee;} +.nav>.pull-right{float:right;} +.nav .nav-header{display:block;padding:3px 15px;font-size:11px;font-weight:bold;line-height:18px;color:#999999;text-shadow:0 1px 0 rgba(255, 255, 255, 0.5);text-transform:uppercase;} +.nav li+.nav-header{margin-top:9px;} +.nav-list{padding-left:15px;padding-right:15px;margin-bottom:0;} +.nav-list>li>a,.nav-list .nav-header{margin-left:-15px;margin-right:-15px;text-shadow:0 1px 0 rgba(255, 255, 255, 0.5);} +.nav-list>li>a{padding:3px 15px;} +.nav-list>.active>a,.nav-list>.active>a:hover{color:#ffffff;text-shadow:0 -1px 0 rgba(0, 0, 0, 0.2);background-color:#0088cc;} +.nav-list [class^="icon-"]{margin-right:2px;} +.nav-list .divider{*width:100%;height:1px;margin:8px 1px;*margin:-5px 0 5px;overflow:hidden;background-color:#e5e5e5;border-bottom:1px solid #ffffff;} +.nav-tabs,.nav-pills{*zoom:1;}.nav-tabs:before,.nav-pills:before,.nav-tabs:after,.nav-pills:after{display:table;content:"";} +.nav-tabs:after,.nav-pills:after{clear:both;} +.nav-tabs>li,.nav-pills>li{float:left;} +.nav-tabs>li>a,.nav-pills>li>a{padding-right:12px;padding-left:12px;margin-right:2px;line-height:14px;} +.nav-tabs{border-bottom:1px solid #ddd;} +.nav-tabs>li{margin-bottom:-1px;} +.nav-tabs>li>a{padding-top:8px;padding-bottom:8px;line-height:18px;border:1px solid transparent;-webkit-border-radius:4px 4px 0 0;-moz-border-radius:4px 4px 0 0;border-radius:4px 4px 0 0;}.nav-tabs>li>a:hover{border-color:#eeeeee #eeeeee #dddddd;} +.nav-tabs>.active>a,.nav-tabs>.active>a:hover{color:#555555;background-color:#ffffff;border:1px solid #ddd;border-bottom-color:transparent;cursor:default;} +.nav-pills>li>a{padding-top:8px;padding-bottom:8px;margin-top:2px;margin-bottom:2px;-webkit-border-radius:5px;-moz-border-radius:5px;border-radius:5px;} +.nav-pills>.active>a,.nav-pills>.active>a:hover{color:#ffffff;background-color:#0088cc;} +.nav-stacked>li{float:none;} +.nav-stacked>li>a{margin-right:0;} +.nav-tabs.nav-stacked{border-bottom:0;} +.nav-tabs.nav-stacked>li>a{border:1px solid #ddd;-webkit-border-radius:0;-moz-border-radius:0;border-radius:0;} +.nav-tabs.nav-stacked>li:first-child>a{-webkit-border-radius:4px 4px 0 0;-moz-border-radius:4px 4px 0 0;border-radius:4px 4px 0 0;} +.nav-tabs.nav-stacked>li:last-child>a{-webkit-border-radius:0 0 4px 4px;-moz-border-radius:0 0 4px 4px;border-radius:0 0 4px 4px;} +.nav-tabs.nav-stacked>li>a:hover{border-color:#ddd;z-index:2;} +.nav-pills.nav-stacked>li>a{margin-bottom:3px;} +.nav-pills.nav-stacked>li:last-child>a{margin-bottom:1px;} +.nav-tabs .dropdown-menu{-webkit-border-radius:0 0 5px 5px;-moz-border-radius:0 0 5px 5px;border-radius:0 0 5px 5px;} +.nav-pills .dropdown-menu{-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;} +.nav-tabs .dropdown-toggle .caret,.nav-pills .dropdown-toggle .caret{border-top-color:#0088cc;border-bottom-color:#0088cc;margin-top:6px;} +.nav-tabs .dropdown-toggle:hover .caret,.nav-pills .dropdown-toggle:hover .caret{border-top-color:#005580;border-bottom-color:#005580;} +.nav-tabs .active .dropdown-toggle .caret,.nav-pills .active .dropdown-toggle .caret{border-top-color:#333333;border-bottom-color:#333333;} +.nav>.dropdown.active>a:hover{color:#000000;cursor:pointer;} +.nav-tabs .open .dropdown-toggle,.nav-pills .open .dropdown-toggle,.nav>li.dropdown.open.active>a:hover{color:#ffffff;background-color:#999999;border-color:#999999;} +.nav li.dropdown.open .caret,.nav li.dropdown.open.active .caret,.nav li.dropdown.open a:hover .caret{border-top-color:#ffffff;border-bottom-color:#ffffff;opacity:1;filter:alpha(opacity=100);} +.tabs-stacked .open>a:hover{border-color:#999999;} +.tabbable{*zoom:1;}.tabbable:before,.tabbable:after{display:table;content:"";} +.tabbable:after{clear:both;} +.tab-content{overflow:auto;} +.tabs-below>.nav-tabs,.tabs-right>.nav-tabs,.tabs-left>.nav-tabs{border-bottom:0;} +.tab-content>.tab-pane,.pill-content>.pill-pane{display:none;} +.tab-content>.active,.pill-content>.active{display:block;} +.tabs-below>.nav-tabs{border-top:1px solid #ddd;} +.tabs-below>.nav-tabs>li{margin-top:-1px;margin-bottom:0;} +.tabs-below>.nav-tabs>li>a{-webkit-border-radius:0 0 4px 4px;-moz-border-radius:0 0 4px 4px;border-radius:0 0 4px 4px;}.tabs-below>.nav-tabs>li>a:hover{border-bottom-color:transparent;border-top-color:#ddd;} +.tabs-below>.nav-tabs>.active>a,.tabs-below>.nav-tabs>.active>a:hover{border-color:transparent #ddd #ddd #ddd;} +.tabs-left>.nav-tabs>li,.tabs-right>.nav-tabs>li{float:none;} +.tabs-left>.nav-tabs>li>a,.tabs-right>.nav-tabs>li>a{min-width:74px;margin-right:0;margin-bottom:3px;} +.tabs-left>.nav-tabs{float:left;margin-right:19px;border-right:1px solid #ddd;} +.tabs-left>.nav-tabs>li>a{margin-right:-1px;-webkit-border-radius:4px 0 0 4px;-moz-border-radius:4px 0 0 4px;border-radius:4px 0 0 4px;} +.tabs-left>.nav-tabs>li>a:hover{border-color:#eeeeee #dddddd #eeeeee #eeeeee;} +.tabs-left>.nav-tabs .active>a,.tabs-left>.nav-tabs .active>a:hover{border-color:#ddd transparent #ddd #ddd;*border-right-color:#ffffff;} +.tabs-right>.nav-tabs{float:right;margin-left:19px;border-left:1px solid #ddd;} +.tabs-right>.nav-tabs>li>a{margin-left:-1px;-webkit-border-radius:0 4px 4px 0;-moz-border-radius:0 4px 4px 0;border-radius:0 4px 4px 0;} +.tabs-right>.nav-tabs>li>a:hover{border-color:#eeeeee #eeeeee #eeeeee #dddddd;} +.tabs-right>.nav-tabs .active>a,.tabs-right>.nav-tabs .active>a:hover{border-color:#ddd #ddd #ddd transparent;*border-left-color:#ffffff;} +.navbar{*position:relative;*z-index:2;overflow:visible;margin-bottom:18px;} +.navbar-inner{min-height:40px;padding-left:20px;padding-right:20px;background-color:#2c2c2c;background-image:-moz-linear-gradient(top, #333333, #222222);background-image:-ms-linear-gradient(top, #333333, #222222);background-image:-webkit-gradient(linear, 0 0, 0 100%, from(#333333), to(#222222));background-image:-webkit-linear-gradient(top, #333333, #222222);background-image:-o-linear-gradient(top, #333333, #222222);background-image:linear-gradient(top, #333333, #222222);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#333333', endColorstr='#222222', GradientType=0);-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;-webkit-box-shadow:0 1px 3px rgba(0,0,0,.25), inset 0 -1px 0 rgba(0,0,0,.1);-moz-box-shadow:0 1px 3px rgba(0,0,0,.25), inset 0 -1px 0 rgba(0,0,0,.1);box-shadow:0 1px 3px rgba(0,0,0,.25), inset 0 -1px 0 rgba(0,0,0,.1);} +.navbar .container{width:auto;} +.nav-collapse.collapse{height:auto;} +.navbar{color:#999999;}.navbar .brand:hover{text-decoration:none;} +.navbar .brand{float:left;display:block;padding:8px 20px 12px;margin-left:-20px;font-size:20px;font-weight:200;line-height:1;color:#999999;} +.navbar .navbar-text{margin-bottom:0;line-height:40px;} +.navbar .navbar-link{color:#999999;}.navbar .navbar-link:hover{color:#ffffff;} +.navbar .btn,.navbar .btn-group{margin-top:5px;} +.navbar .btn-group .btn{margin:0;} +.navbar-form{margin-bottom:0;*zoom:1;}.navbar-form:before,.navbar-form:after{display:table;content:"";} +.navbar-form:after{clear:both;} +.navbar-form input,.navbar-form select,.navbar-form .radio,.navbar-form .checkbox{margin-top:5px;} +.navbar-form input,.navbar-form select{display:inline-block;margin-bottom:0;} +.navbar-form input[type="image"],.navbar-form input[type="checkbox"],.navbar-form input[type="radio"]{margin-top:3px;} +.navbar-form .input-append,.navbar-form .input-prepend{margin-top:6px;white-space:nowrap;}.navbar-form .input-append input,.navbar-form .input-prepend input{margin-top:0;} +.navbar-search{position:relative;float:left;margin-top:6px;margin-bottom:0;}.navbar-search .search-query{padding:4px 9px;font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;font-size:13px;font-weight:normal;line-height:1;color:#ffffff;background-color:#626262;border:1px solid #151515;-webkit-box-shadow:inset 0 1px 2px rgba(0,0,0,.1), 0 1px 0 rgba(255,255,255,.15);-moz-box-shadow:inset 0 1px 2px rgba(0,0,0,.1), 0 1px 0 rgba(255,255,255,.15);box-shadow:inset 0 1px 2px rgba(0,0,0,.1), 0 1px 0 rgba(255,255,255,.15);-webkit-transition:none;-moz-transition:none;-ms-transition:none;-o-transition:none;transition:none;}.navbar-search .search-query:-moz-placeholder{color:#cccccc;} +.navbar-search .search-query:-ms-input-placeholder{color:#cccccc;} +.navbar-search .search-query::-webkit-input-placeholder{color:#cccccc;} +.navbar-search .search-query:focus,.navbar-search .search-query.focused{padding:5px 10px;color:#333333;text-shadow:0 1px 0 #ffffff;background-color:#ffffff;border:0;-webkit-box-shadow:0 0 3px rgba(0, 0, 0, 0.15);-moz-box-shadow:0 0 3px rgba(0, 0, 0, 0.15);box-shadow:0 0 3px rgba(0, 0, 0, 0.15);outline:0;} +.navbar-fixed-top,.navbar-fixed-bottom{position:fixed;right:0;left:0;z-index:1030;margin-bottom:0;} +.navbar-fixed-top .navbar-inner,.navbar-fixed-bottom .navbar-inner{padding-left:0;padding-right:0;-webkit-border-radius:0;-moz-border-radius:0;border-radius:0;} +.navbar-fixed-top .container,.navbar-fixed-bottom .container{width:940px;} +.navbar-fixed-top{top:0;} +.navbar-fixed-bottom{bottom:0;} +.navbar .nav{position:relative;left:0;display:block;float:left;margin:0 10px 0 0;} +.navbar .nav.pull-right{float:right;} +.navbar .nav>li{display:block;float:left;} +.navbar .nav>li>a{float:none;padding:9px 10px 11px;line-height:19px;color:#999999;text-decoration:none;text-shadow:0 -1px 0 rgba(0, 0, 0, 0.25);} +.navbar .btn{display:inline-block;padding:4px 10px 4px;margin:5px 5px 6px;line-height:18px;} +.navbar .btn-group{margin:0;padding:5px 5px 6px;} +.navbar .nav>li>a:hover{background-color:transparent;color:#ffffff;text-decoration:none;} +.navbar .nav .active>a,.navbar .nav .active>a:hover{color:#ffffff;text-decoration:none;background-color:#222222;} +.navbar .divider-vertical{height:40px;width:1px;margin:0 9px;overflow:hidden;background-color:#222222;border-right:1px solid #333333;} +.navbar .nav.pull-right{margin-left:10px;margin-right:0;} +.navbar .btn-navbar{display:none;float:right;padding:7px 10px;margin-left:5px;margin-right:5px;background-color:#2c2c2c;background-image:-moz-linear-gradient(top, #333333, #222222);background-image:-ms-linear-gradient(top, #333333, #222222);background-image:-webkit-gradient(linear, 0 0, 0 100%, from(#333333), to(#222222));background-image:-webkit-linear-gradient(top, #333333, #222222);background-image:-o-linear-gradient(top, #333333, #222222);background-image:linear-gradient(top, #333333, #222222);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#333333', endColorstr='#222222', GradientType=0);border-color:#222222 #222222 #000000;border-color:rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);*background-color:#222222;filter:progid:DXImageTransform.Microsoft.gradient(enabled = false);-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,.1), 0 1px 0 rgba(255,255,255,.075);-moz-box-shadow:inset 0 1px 0 rgba(255,255,255,.1), 0 1px 0 rgba(255,255,255,.075);box-shadow:inset 0 1px 0 rgba(255,255,255,.1), 0 1px 0 rgba(255,255,255,.075);}.navbar .btn-navbar:hover,.navbar .btn-navbar:active,.navbar .btn-navbar.active,.navbar .btn-navbar.disabled,.navbar .btn-navbar[disabled]{background-color:#222222;*background-color:#151515;} +.navbar .btn-navbar:active,.navbar .btn-navbar.active{background-color:#080808 \9;} +.navbar .btn-navbar .icon-bar{display:block;width:18px;height:2px;background-color:#f5f5f5;-webkit-border-radius:1px;-moz-border-radius:1px;border-radius:1px;-webkit-box-shadow:0 1px 0 rgba(0, 0, 0, 0.25);-moz-box-shadow:0 1px 0 rgba(0, 0, 0, 0.25);box-shadow:0 1px 0 rgba(0, 0, 0, 0.25);} +.btn-navbar .icon-bar+.icon-bar{margin-top:3px;} +.navbar .dropdown-menu:before{content:'';display:inline-block;border-left:7px solid transparent;border-right:7px solid transparent;border-bottom:7px solid #ccc;border-bottom-color:rgba(0, 0, 0, 0.2);position:absolute;top:-7px;left:9px;} +.navbar .dropdown-menu:after{content:'';display:inline-block;border-left:6px solid transparent;border-right:6px solid transparent;border-bottom:6px solid #ffffff;position:absolute;top:-6px;left:10px;} +.navbar-fixed-bottom .dropdown-menu:before{border-top:7px solid #ccc;border-top-color:rgba(0, 0, 0, 0.2);border-bottom:0;bottom:-7px;top:auto;} +.navbar-fixed-bottom .dropdown-menu:after{border-top:6px solid #ffffff;border-bottom:0;bottom:-6px;top:auto;} +.navbar .nav li.dropdown .dropdown-toggle .caret,.navbar .nav li.dropdown.open .caret{border-top-color:#ffffff;border-bottom-color:#ffffff;} +.navbar .nav li.dropdown.active .caret{opacity:1;filter:alpha(opacity=100);} +.navbar .nav li.dropdown.open>.dropdown-toggle,.navbar .nav li.dropdown.active>.dropdown-toggle,.navbar .nav li.dropdown.open.active>.dropdown-toggle{background-color:transparent;} +.navbar .nav li.dropdown.active>.dropdown-toggle:hover{color:#ffffff;} +.navbar .pull-right .dropdown-menu,.navbar .dropdown-menu.pull-right{left:auto;right:0;}.navbar .pull-right .dropdown-menu:before,.navbar .dropdown-menu.pull-right:before{left:auto;right:12px;} +.navbar .pull-right .dropdown-menu:after,.navbar .dropdown-menu.pull-right:after{left:auto;right:13px;} +.breadcrumb{padding:7px 14px;margin:0 0 18px;list-style:none;background-color:#fbfbfb;background-image:-moz-linear-gradient(top, #ffffff, #f5f5f5);background-image:-ms-linear-gradient(top, #ffffff, #f5f5f5);background-image:-webkit-gradient(linear, 0 0, 0 100%, from(#ffffff), to(#f5f5f5));background-image:-webkit-linear-gradient(top, #ffffff, #f5f5f5);background-image:-o-linear-gradient(top, #ffffff, #f5f5f5);background-image:linear-gradient(top, #ffffff, #f5f5f5);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffff', endColorstr='#f5f5f5', GradientType=0);border:1px solid #ddd;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px;-webkit-box-shadow:inset 0 1px 0 #ffffff;-moz-box-shadow:inset 0 1px 0 #ffffff;box-shadow:inset 0 1px 0 #ffffff;}.breadcrumb li{display:inline-block;*display:inline;*zoom:1;text-shadow:0 1px 0 #ffffff;} +.breadcrumb .divider{padding:0 5px;color:#999999;} +.breadcrumb .active a{color:#333333;} +.pagination{height:36px;margin:18px 0;} +.pagination ul{display:inline-block;*display:inline;*zoom:1;margin-left:0;margin-bottom:0;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px;-webkit-box-shadow:0 1px 2px rgba(0, 0, 0, 0.05);-moz-box-shadow:0 1px 2px rgba(0, 0, 0, 0.05);box-shadow:0 1px 2px rgba(0, 0, 0, 0.05);} +.pagination li{display:inline;} +.pagination a{float:left;padding:0 14px;line-height:34px;text-decoration:none;border:1px solid #ddd;border-left-width:0;} +.pagination a:hover,.pagination .active a{background-color:#f5f5f5;} +.pagination .active a{color:#999999;cursor:default;} +.pagination .disabled span,.pagination .disabled a,.pagination .disabled a:hover{color:#999999;background-color:transparent;cursor:default;} +.pagination li:first-child a{border-left-width:1px;-webkit-border-radius:3px 0 0 3px;-moz-border-radius:3px 0 0 3px;border-radius:3px 0 0 3px;} +.pagination li:last-child a{-webkit-border-radius:0 3px 3px 0;-moz-border-radius:0 3px 3px 0;border-radius:0 3px 3px 0;} +.pagination-centered{text-align:center;} +.pagination-right{text-align:right;} +.pager{margin-left:0;margin-bottom:18px;list-style:none;text-align:center;*zoom:1;}.pager:before,.pager:after{display:table;content:"";} +.pager:after{clear:both;} +.pager li{display:inline;} +.pager a{display:inline-block;padding:5px 14px;background-color:#fff;border:1px solid #ddd;-webkit-border-radius:15px;-moz-border-radius:15px;border-radius:15px;} +.pager a:hover{text-decoration:none;background-color:#f5f5f5;} +.pager .next a{float:right;} +.pager .previous a{float:left;} +.pager .disabled a,.pager .disabled a:hover{color:#999999;background-color:#fff;cursor:default;} +.thumbnails{margin-left:-20px;list-style:none;*zoom:1;}.thumbnails:before,.thumbnails:after{display:table;content:"";} +.thumbnails:after{clear:both;} +.row-fluid .thumbnails{margin-left:0;} +.thumbnails>li{float:left;margin-bottom:18px;margin-left:20px;} +.thumbnail{display:block;padding:4px;line-height:1;border:1px solid #ddd;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;-webkit-box-shadow:0 1px 1px rgba(0, 0, 0, 0.075);-moz-box-shadow:0 1px 1px rgba(0, 0, 0, 0.075);box-shadow:0 1px 1px rgba(0, 0, 0, 0.075);} +a.thumbnail:hover{border-color:#0088cc;-webkit-box-shadow:0 1px 4px rgba(0, 105, 214, 0.25);-moz-box-shadow:0 1px 4px rgba(0, 105, 214, 0.25);box-shadow:0 1px 4px rgba(0, 105, 214, 0.25);} +.thumbnail>img{display:block;max-width:100%;margin-left:auto;margin-right:auto;} +.thumbnail .caption{padding:9px;} +.alert{padding:8px 35px 8px 14px;margin-bottom:18px;text-shadow:0 1px 0 rgba(255, 255, 255, 0.5);background-color:#fcf8e3;border:1px solid #fbeed5;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;color:#c09853;} +.alert-heading{color:inherit;} +.alert .close{position:relative;top:-2px;right:-21px;line-height:18px;} +.alert-success{background-color:#dff0d8;border-color:#d6e9c6;color:#468847;} +.alert-danger,.alert-error{background-color:#f2dede;border-color:#eed3d7;color:#b94a48;} +.alert-info{background-color:#d9edf7;border-color:#bce8f1;color:#3a87ad;} +.alert-block{padding-top:14px;padding-bottom:14px;} +.alert-block>p,.alert-block>ul{margin-bottom:0;} +.alert-block p+p{margin-top:5px;} +@-webkit-keyframes progress-bar-stripes{from{background-position:40px 0;} to{background-position:0 0;}}@-moz-keyframes progress-bar-stripes{from{background-position:40px 0;} to{background-position:0 0;}}@-ms-keyframes progress-bar-stripes{from{background-position:40px 0;} to{background-position:0 0;}}@-o-keyframes progress-bar-stripes{from{background-position:0 0;} to{background-position:40px 0;}}@keyframes progress-bar-stripes{from{background-position:40px 0;} to{background-position:0 0;}}.progress{overflow:hidden;height:18px;margin-bottom:18px;background-color:#f7f7f7;background-image:-moz-linear-gradient(top, #f5f5f5, #f9f9f9);background-image:-ms-linear-gradient(top, #f5f5f5, #f9f9f9);background-image:-webkit-gradient(linear, 0 0, 0 100%, from(#f5f5f5), to(#f9f9f9));background-image:-webkit-linear-gradient(top, #f5f5f5, #f9f9f9);background-image:-o-linear-gradient(top, #f5f5f5, #f9f9f9);background-image:linear-gradient(top, #f5f5f5, #f9f9f9);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#f5f5f5', endColorstr='#f9f9f9', GradientType=0);-webkit-box-shadow:inset 0 1px 2px rgba(0, 0, 0, 0.1);-moz-box-shadow:inset 0 1px 2px rgba(0, 0, 0, 0.1);box-shadow:inset 0 1px 2px rgba(0, 0, 0, 0.1);-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;} +.progress .bar{width:0%;height:18px;color:#ffffff;font-size:12px;text-align:center;text-shadow:0 -1px 0 rgba(0, 0, 0, 0.25);background-color:#0e90d2;background-image:-moz-linear-gradient(top, #149bdf, #0480be);background-image:-ms-linear-gradient(top, #149bdf, #0480be);background-image:-webkit-gradient(linear, 0 0, 0 100%, from(#149bdf), to(#0480be));background-image:-webkit-linear-gradient(top, #149bdf, #0480be);background-image:-o-linear-gradient(top, #149bdf, #0480be);background-image:linear-gradient(top, #149bdf, #0480be);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#149bdf', endColorstr='#0480be', GradientType=0);-webkit-box-shadow:inset 0 -1px 0 rgba(0, 0, 0, 0.15);-moz-box-shadow:inset 0 -1px 0 rgba(0, 0, 0, 0.15);box-shadow:inset 0 -1px 0 rgba(0, 0, 0, 0.15);-webkit-box-sizing:border-box;-moz-box-sizing:border-box;-ms-box-sizing:border-box;box-sizing:border-box;-webkit-transition:width 0.6s ease;-moz-transition:width 0.6s ease;-ms-transition:width 0.6s ease;-o-transition:width 0.6s ease;transition:width 0.6s ease;} +.progress-striped .bar{background-color:#149bdf;background-image:-webkit-gradient(linear, 0 100%, 100% 0, color-stop(0.25, rgba(255, 255, 255, 0.15)), color-stop(0.25, transparent), color-stop(0.5, transparent), color-stop(0.5, rgba(255, 255, 255, 0.15)), color-stop(0.75, rgba(255, 255, 255, 0.15)), color-stop(0.75, transparent), to(transparent));background-image:-webkit-linear-gradient(-45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);background-image:-moz-linear-gradient(-45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);background-image:-ms-linear-gradient(-45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);background-image:-o-linear-gradient(-45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);background-image:linear-gradient(-45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);-webkit-background-size:40px 40px;-moz-background-size:40px 40px;-o-background-size:40px 40px;background-size:40px 40px;} +.progress.active .bar{-webkit-animation:progress-bar-stripes 2s linear infinite;-moz-animation:progress-bar-stripes 2s linear infinite;-ms-animation:progress-bar-stripes 2s linear infinite;-o-animation:progress-bar-stripes 2s linear infinite;animation:progress-bar-stripes 2s linear infinite;} +.progress-danger .bar{background-color:#dd514c;background-image:-moz-linear-gradient(top, #ee5f5b, #c43c35);background-image:-ms-linear-gradient(top, #ee5f5b, #c43c35);background-image:-webkit-gradient(linear, 0 0, 0 100%, from(#ee5f5b), to(#c43c35));background-image:-webkit-linear-gradient(top, #ee5f5b, #c43c35);background-image:-o-linear-gradient(top, #ee5f5b, #c43c35);background-image:linear-gradient(top, #ee5f5b, #c43c35);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ee5f5b', endColorstr='#c43c35', GradientType=0);} +.progress-danger.progress-striped .bar{background-color:#ee5f5b;background-image:-webkit-gradient(linear, 0 100%, 100% 0, color-stop(0.25, rgba(255, 255, 255, 0.15)), color-stop(0.25, transparent), color-stop(0.5, transparent), color-stop(0.5, rgba(255, 255, 255, 0.15)), color-stop(0.75, rgba(255, 255, 255, 0.15)), color-stop(0.75, transparent), to(transparent));background-image:-webkit-linear-gradient(-45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);background-image:-moz-linear-gradient(-45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);background-image:-ms-linear-gradient(-45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);background-image:-o-linear-gradient(-45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);background-image:linear-gradient(-45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);} +.progress-success .bar{background-color:#5eb95e;background-image:-moz-linear-gradient(top, #62c462, #57a957);background-image:-ms-linear-gradient(top, #62c462, #57a957);background-image:-webkit-gradient(linear, 0 0, 0 100%, from(#62c462), to(#57a957));background-image:-webkit-linear-gradient(top, #62c462, #57a957);background-image:-o-linear-gradient(top, #62c462, #57a957);background-image:linear-gradient(top, #62c462, #57a957);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#62c462', endColorstr='#57a957', GradientType=0);} +.progress-success.progress-striped .bar{background-color:#62c462;background-image:-webkit-gradient(linear, 0 100%, 100% 0, color-stop(0.25, rgba(255, 255, 255, 0.15)), color-stop(0.25, transparent), color-stop(0.5, transparent), color-stop(0.5, rgba(255, 255, 255, 0.15)), color-stop(0.75, rgba(255, 255, 255, 0.15)), color-stop(0.75, transparent), to(transparent));background-image:-webkit-linear-gradient(-45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);background-image:-moz-linear-gradient(-45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);background-image:-ms-linear-gradient(-45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);background-image:-o-linear-gradient(-45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);background-image:linear-gradient(-45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);} +.progress-info .bar{background-color:#4bb1cf;background-image:-moz-linear-gradient(top, #5bc0de, #339bb9);background-image:-ms-linear-gradient(top, #5bc0de, #339bb9);background-image:-webkit-gradient(linear, 0 0, 0 100%, from(#5bc0de), to(#339bb9));background-image:-webkit-linear-gradient(top, #5bc0de, #339bb9);background-image:-o-linear-gradient(top, #5bc0de, #339bb9);background-image:linear-gradient(top, #5bc0de, #339bb9);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#5bc0de', endColorstr='#339bb9', GradientType=0);} +.progress-info.progress-striped .bar{background-color:#5bc0de;background-image:-webkit-gradient(linear, 0 100%, 100% 0, color-stop(0.25, rgba(255, 255, 255, 0.15)), color-stop(0.25, transparent), color-stop(0.5, transparent), color-stop(0.5, rgba(255, 255, 255, 0.15)), color-stop(0.75, rgba(255, 255, 255, 0.15)), color-stop(0.75, transparent), to(transparent));background-image:-webkit-linear-gradient(-45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);background-image:-moz-linear-gradient(-45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);background-image:-ms-linear-gradient(-45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);background-image:-o-linear-gradient(-45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);background-image:linear-gradient(-45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);} +.progress-warning .bar{background-color:#faa732;background-image:-moz-linear-gradient(top, #fbb450, #f89406);background-image:-ms-linear-gradient(top, #fbb450, #f89406);background-image:-webkit-gradient(linear, 0 0, 0 100%, from(#fbb450), to(#f89406));background-image:-webkit-linear-gradient(top, #fbb450, #f89406);background-image:-o-linear-gradient(top, #fbb450, #f89406);background-image:linear-gradient(top, #fbb450, #f89406);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fbb450', endColorstr='#f89406', GradientType=0);} +.progress-warning.progress-striped .bar{background-color:#fbb450;background-image:-webkit-gradient(linear, 0 100%, 100% 0, color-stop(0.25, rgba(255, 255, 255, 0.15)), color-stop(0.25, transparent), color-stop(0.5, transparent), color-stop(0.5, rgba(255, 255, 255, 0.15)), color-stop(0.75, rgba(255, 255, 255, 0.15)), color-stop(0.75, transparent), to(transparent));background-image:-webkit-linear-gradient(-45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);background-image:-moz-linear-gradient(-45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);background-image:-ms-linear-gradient(-45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);background-image:-o-linear-gradient(-45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);background-image:linear-gradient(-45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);} +.hero-unit{padding:60px;margin-bottom:30px;background-color:#eeeeee;-webkit-border-radius:6px;-moz-border-radius:6px;border-radius:6px;}.hero-unit h1{margin-bottom:0;font-size:60px;line-height:1;color:inherit;letter-spacing:-1px;} +.hero-unit p{font-size:18px;font-weight:200;line-height:27px;color:inherit;} +.tooltip{position:absolute;z-index:1020;display:block;visibility:visible;padding:5px;font-size:11px;opacity:0;filter:alpha(opacity=0);}.tooltip.in{opacity:0.8;filter:alpha(opacity=80);} +.tooltip.top{margin-top:-2px;} +.tooltip.right{margin-left:2px;} +.tooltip.bottom{margin-top:2px;} +.tooltip.left{margin-left:-2px;} +.tooltip.top .tooltip-arrow{bottom:0;left:50%;margin-left:-5px;border-left:5px solid transparent;border-right:5px solid transparent;border-top:5px solid #000000;} +.tooltip.left .tooltip-arrow{top:50%;right:0;margin-top:-5px;border-top:5px solid transparent;border-bottom:5px solid transparent;border-left:5px solid #000000;} +.tooltip.bottom .tooltip-arrow{top:0;left:50%;margin-left:-5px;border-left:5px solid transparent;border-right:5px solid transparent;border-bottom:5px solid #000000;} +.tooltip.right .tooltip-arrow{top:50%;left:0;margin-top:-5px;border-top:5px solid transparent;border-bottom:5px solid transparent;border-right:5px solid #000000;} +.tooltip-inner{max-width:200px;padding:3px 8px;color:#ffffff;text-align:center;text-decoration:none;background-color:#000000;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;} +.tooltip-arrow{position:absolute;width:0;height:0;} +.popover{position:absolute;top:0;left:0;z-index:1010;display:none;padding:5px;}.popover.top{margin-top:-5px;} +.popover.right{margin-left:5px;} +.popover.bottom{margin-top:5px;} +.popover.left{margin-left:-5px;} +.popover.top .arrow{bottom:0;left:50%;margin-left:-5px;border-left:5px solid transparent;border-right:5px solid transparent;border-top:5px solid #000000;} +.popover.right .arrow{top:50%;left:0;margin-top:-5px;border-top:5px solid transparent;border-bottom:5px solid transparent;border-right:5px solid #000000;} +.popover.bottom .arrow{top:0;left:50%;margin-left:-5px;border-left:5px solid transparent;border-right:5px solid transparent;border-bottom:5px solid #000000;} +.popover.left .arrow{top:50%;right:0;margin-top:-5px;border-top:5px solid transparent;border-bottom:5px solid transparent;border-left:5px solid #000000;} +.popover .arrow{position:absolute;width:0;height:0;} +.popover-inner{padding:3px;width:280px;overflow:hidden;background:#000000;background:rgba(0, 0, 0, 0.8);-webkit-border-radius:6px;-moz-border-radius:6px;border-radius:6px;-webkit-box-shadow:0 3px 7px rgba(0, 0, 0, 0.3);-moz-box-shadow:0 3px 7px rgba(0, 0, 0, 0.3);box-shadow:0 3px 7px rgba(0, 0, 0, 0.3);} +.popover-title{padding:9px 15px;line-height:1;background-color:#f5f5f5;border-bottom:1px solid #eee;-webkit-border-radius:3px 3px 0 0;-moz-border-radius:3px 3px 0 0;border-radius:3px 3px 0 0;} +.popover-content{padding:14px;background-color:#ffffff;-webkit-border-radius:0 0 3px 3px;-moz-border-radius:0 0 3px 3px;border-radius:0 0 3px 3px;-webkit-background-clip:padding-box;-moz-background-clip:padding-box;background-clip:padding-box;}.popover-content p,.popover-content ul,.popover-content ol{margin-bottom:0;} +.modal-open .dropdown-menu{z-index:2050;} +.modal-open .dropdown.open{*z-index:2050;} +.modal-open .popover{z-index:2060;} +.modal-open .tooltip{z-index:2070;} +.modal-backdrop{position:fixed;top:0;right:0;bottom:0;left:0;z-index:1040;background-color:#000000;}.modal-backdrop.fade{opacity:0;} +.modal-backdrop,.modal-backdrop.fade.in{opacity:0.8;filter:alpha(opacity=80);} +.modal{position:fixed;top:50%;left:50%;z-index:1050;overflow:auto;width:560px;margin:-250px 0 0 -280px;background-color:#ffffff;border:1px solid #999;border:1px solid rgba(0, 0, 0, 0.3);*border:1px solid #999;-webkit-border-radius:6px;-moz-border-radius:6px;border-radius:6px;-webkit-box-shadow:0 3px 7px rgba(0, 0, 0, 0.3);-moz-box-shadow:0 3px 7px rgba(0, 0, 0, 0.3);box-shadow:0 3px 7px rgba(0, 0, 0, 0.3);-webkit-background-clip:padding-box;-moz-background-clip:padding-box;background-clip:padding-box;}.modal.fade{-webkit-transition:opacity .3s linear, top .3s ease-out;-moz-transition:opacity .3s linear, top .3s ease-out;-ms-transition:opacity .3s linear, top .3s ease-out;-o-transition:opacity .3s linear, top .3s ease-out;transition:opacity .3s linear, top .3s ease-out;top:-25%;} +.modal.fade.in{top:50%;} +.modal-header{padding:9px 15px;border-bottom:1px solid #eee;}.modal-header .close{margin-top:2px;} +.modal-body{overflow-y:auto;max-height:400px;padding:15px;} +.modal-form{margin-bottom:0;} +.modal-footer{padding:14px 15px 15px;margin-bottom:0;text-align:right;background-color:#f5f5f5;border-top:1px solid #ddd;-webkit-border-radius:0 0 6px 6px;-moz-border-radius:0 0 6px 6px;border-radius:0 0 6px 6px;-webkit-box-shadow:inset 0 1px 0 #ffffff;-moz-box-shadow:inset 0 1px 0 #ffffff;box-shadow:inset 0 1px 0 #ffffff;*zoom:1;}.modal-footer:before,.modal-footer:after{display:table;content:"";} +.modal-footer:after{clear:both;} +.modal-footer .btn+.btn{margin-left:5px;margin-bottom:0;} +.modal-footer .btn-group .btn+.btn{margin-left:-1px;} +.dropup,.dropdown{position:relative;} +.dropdown-toggle{*margin-bottom:-3px;} +.dropdown-toggle:active,.open .dropdown-toggle{outline:0;} +.caret{display:inline-block;width:0;height:0;vertical-align:top;border-top:4px solid #000000;border-right:4px solid transparent;border-left:4px solid transparent;content:"";opacity:0.3;filter:alpha(opacity=30);} +.dropdown .caret{margin-top:8px;margin-left:2px;} +.dropdown:hover .caret,.open .caret{opacity:1;filter:alpha(opacity=100);} +.dropdown-menu{position:absolute;top:100%;left:0;z-index:1000;display:none;float:left;min-width:160px;padding:4px 0;margin:1px 0 0;list-style:none;background-color:#ffffff;border:1px solid #ccc;border:1px solid rgba(0, 0, 0, 0.2);*border-right-width:2px;*border-bottom-width:2px;-webkit-border-radius:5px;-moz-border-radius:5px;border-radius:5px;-webkit-box-shadow:0 5px 10px rgba(0, 0, 0, 0.2);-moz-box-shadow:0 5px 10px rgba(0, 0, 0, 0.2);box-shadow:0 5px 10px rgba(0, 0, 0, 0.2);-webkit-background-clip:padding-box;-moz-background-clip:padding;background-clip:padding-box;}.dropdown-menu.pull-right{right:0;left:auto;} +.dropdown-menu .divider{*width:100%;height:1px;margin:8px 1px;*margin:-5px 0 5px;overflow:hidden;background-color:#e5e5e5;border-bottom:1px solid #ffffff;} +.dropdown-menu a{display:block;padding:3px 15px;clear:both;font-weight:normal;line-height:18px;color:#333333;white-space:nowrap;} +.dropdown-menu li>a:hover,.dropdown-menu .active>a,.dropdown-menu .active>a:hover{color:#ffffff;text-decoration:none;background-color:#0088cc;} +.open{*z-index:1000;}.open >.dropdown-menu{display:block;} +.pull-right>.dropdown-menu{right:0;left:auto;} +.dropup .caret,.navbar-fixed-bottom .dropdown .caret{border-top:0;border-bottom:4px solid #000000;content:"\2191";} +.dropup .dropdown-menu,.navbar-fixed-bottom .dropdown .dropdown-menu{top:auto;bottom:100%;margin-bottom:1px;} +.typeahead{margin-top:2px;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;} +.accordion{margin-bottom:18px;} +.accordion-group{margin-bottom:2px;border:1px solid #e5e5e5;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;} +.accordion-heading{border-bottom:0;} +.accordion-heading .accordion-toggle{display:block;padding:8px 15px;} +.accordion-toggle{cursor:pointer;} +.accordion-inner{padding:9px 15px;border-top:1px solid #e5e5e5;} +.carousel{position:relative;margin-bottom:18px;line-height:1;} +.carousel-inner{overflow:hidden;width:100%;position:relative;} +.carousel .item{display:none;position:relative;-webkit-transition:0.6s ease-in-out left;-moz-transition:0.6s ease-in-out left;-ms-transition:0.6s ease-in-out left;-o-transition:0.6s ease-in-out left;transition:0.6s ease-in-out left;} +.carousel .item>img{display:block;line-height:1;} +.carousel .active,.carousel .next,.carousel .prev{display:block;} +.carousel .active{left:0;} +.carousel .next,.carousel .prev{position:absolute;top:0;width:100%;} +.carousel .next{left:100%;} +.carousel .prev{left:-100%;} +.carousel .next.left,.carousel .prev.right{left:0;} +.carousel .active.left{left:-100%;} +.carousel .active.right{left:100%;} +.carousel-control{position:absolute;top:40%;left:15px;width:40px;height:40px;margin-top:-20px;font-size:60px;font-weight:100;line-height:30px;color:#ffffff;text-align:center;background:#222222;border:3px solid #ffffff;-webkit-border-radius:23px;-moz-border-radius:23px;border-radius:23px;opacity:0.5;filter:alpha(opacity=50);}.carousel-control.right{left:auto;right:15px;} +.carousel-control:hover{color:#ffffff;text-decoration:none;opacity:0.9;filter:alpha(opacity=90);} +.carousel-caption{position:absolute;left:0;right:0;bottom:0;padding:10px 15px 5px;background:#333333;background:rgba(0, 0, 0, 0.75);} +.carousel-caption h4,.carousel-caption p{color:#ffffff;} +.well{min-height:20px;padding:19px;margin-bottom:20px;background-color:#f5f5f5;border:1px solid #eee;border:1px solid rgba(0, 0, 0, 0.05);-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;-webkit-box-shadow:inset 0 1px 1px rgba(0, 0, 0, 0.05);-moz-box-shadow:inset 0 1px 1px rgba(0, 0, 0, 0.05);box-shadow:inset 0 1px 1px rgba(0, 0, 0, 0.05);}.well blockquote{border-color:#ddd;border-color:rgba(0, 0, 0, 0.15);} +.well-large{padding:24px;-webkit-border-radius:6px;-moz-border-radius:6px;border-radius:6px;} +.well-small{padding:9px;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px;} +.close{float:right;font-size:20px;font-weight:bold;line-height:18px;color:#000000;text-shadow:0 1px 0 #ffffff;opacity:0.2;filter:alpha(opacity=20);}.close:hover{color:#000000;text-decoration:none;cursor:pointer;opacity:0.4;filter:alpha(opacity=40);} +button.close{padding:0;cursor:pointer;background:transparent;border:0;-webkit-appearance:none;} +.pull-right{float:right;} +.pull-left{float:left;} +.hide{display:none;} +.show{display:block;} +.invisible{visibility:hidden;} +.fade{opacity:0;-webkit-transition:opacity 0.15s linear;-moz-transition:opacity 0.15s linear;-ms-transition:opacity 0.15s linear;-o-transition:opacity 0.15s linear;transition:opacity 0.15s linear;}.fade.in{opacity:1;} +.collapse{position:relative;height:0;overflow:hidden;-webkit-transition:height 0.35s ease;-moz-transition:height 0.35s ease;-ms-transition:height 0.35s ease;-o-transition:height 0.35s ease;transition:height 0.35s ease;}.collapse.in{height:auto;} +.hidden{display:none;visibility:hidden;} +.visible-phone{display:none !important;} +.visible-tablet{display:none !important;} +.hidden-desktop{display:none !important;} +@media (max-width:767px){.visible-phone{display:inherit !important;} .hidden-phone{display:none !important;} .hidden-desktop{display:inherit !important;} .visible-desktop{display:none !important;}}@media (min-width:768px) and (max-width:979px){.visible-tablet{display:inherit !important;} .hidden-tablet{display:none !important;} .hidden-desktop{display:inherit !important;} .visible-desktop{display:none !important ;}}@media (max-width:480px){.nav-collapse{-webkit-transform:translate3d(0, 0, 0);} .page-header h1 small{display:block;line-height:18px;} input[type="checkbox"],input[type="radio"]{border:1px solid #ccc;} .form-horizontal .control-group>label{float:none;width:auto;padding-top:0;text-align:left;} .form-horizontal .controls{margin-left:0;} .form-horizontal .control-list{padding-top:0;} .form-horizontal .form-actions{padding-left:10px;padding-right:10px;} .modal{position:absolute;top:10px;left:10px;right:10px;width:auto;margin:0;}.modal.fade.in{top:auto;} .modal-header .close{padding:10px;margin:-10px;} .carousel-caption{position:static;}}@media (max-width:767px){body{padding-left:20px;padding-right:20px;} .navbar-fixed-top,.navbar-fixed-bottom{margin-left:-20px;margin-right:-20px;} .container-fluid{padding:0;} .dl-horizontal dt{float:none;clear:none;width:auto;text-align:left;} .dl-horizontal dd{margin-left:0;} .container{width:auto;} .row-fluid{width:100%;} .row,.thumbnails{margin-left:0;} [class*="span"],.row-fluid [class*="span"]{float:none;display:block;width:auto;margin-left:0;} .input-large,.input-xlarge,.input-xxlarge,input[class*="span"],select[class*="span"],textarea[class*="span"],.uneditable-input{display:block;width:100%;min-height:28px;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;-ms-box-sizing:border-box;box-sizing:border-box;} .input-prepend input,.input-append input,.input-prepend input[class*="span"],.input-append input[class*="span"]{display:inline-block;width:auto;}}@media (min-width:768px) and (max-width:979px){.row{margin-left:-20px;*zoom:1;}.row:before,.row:after{display:table;content:"";} .row:after{clear:both;} [class*="span"]{float:left;margin-left:20px;} .container,.navbar-fixed-top .container,.navbar-fixed-bottom .container{width:724px;} .span12{width:724px;} .span11{width:662px;} .span10{width:600px;} .span9{width:538px;} .span8{width:476px;} .span7{width:414px;} .span6{width:352px;} .span5{width:290px;} .span4{width:228px;} .span3{width:166px;} .span2{width:104px;} .span1{width:42px;} .offset12{margin-left:764px;} .offset11{margin-left:702px;} .offset10{margin-left:640px;} .offset9{margin-left:578px;} .offset8{margin-left:516px;} .offset7{margin-left:454px;} .offset6{margin-left:392px;} .offset5{margin-left:330px;} .offset4{margin-left:268px;} .offset3{margin-left:206px;} .offset2{margin-left:144px;} .offset1{margin-left:82px;} .row-fluid{width:100%;*zoom:1;}.row-fluid:before,.row-fluid:after{display:table;content:"";} .row-fluid:after{clear:both;} .row-fluid [class*="span"]{display:block;width:100%;min-height:28px;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;-ms-box-sizing:border-box;box-sizing:border-box;float:left;margin-left:2.762430939%;*margin-left:2.709239449638298%;} .row-fluid [class*="span"]:first-child{margin-left:0;} .row-fluid .span12{width:99.999999993%;*width:99.9468085036383%;} .row-fluid .span11{width:91.436464082%;*width:91.38327259263829%;} .row-fluid .span10{width:82.87292817100001%;*width:82.8197366816383%;} .row-fluid .span9{width:74.30939226%;*width:74.25620077063829%;} .row-fluid .span8{width:65.74585634900001%;*width:65.6926648596383%;} .row-fluid .span7{width:57.182320438000005%;*width:57.129128948638304%;} .row-fluid .span6{width:48.618784527%;*width:48.5655930376383%;} .row-fluid .span5{width:40.055248616%;*width:40.0020571266383%;} .row-fluid .span4{width:31.491712705%;*width:31.4385212156383%;} .row-fluid .span3{width:22.928176794%;*width:22.874985304638297%;} .row-fluid .span2{width:14.364640883%;*width:14.311449393638298%;} .row-fluid .span1{width:5.801104972%;*width:5.747913482638298%;} input,textarea,.uneditable-input{margin-left:0;} input.span12, textarea.span12, .uneditable-input.span12{width:714px;} input.span11, textarea.span11, .uneditable-input.span11{width:652px;} input.span10, textarea.span10, .uneditable-input.span10{width:590px;} input.span9, textarea.span9, .uneditable-input.span9{width:528px;} input.span8, textarea.span8, .uneditable-input.span8{width:466px;} input.span7, textarea.span7, .uneditable-input.span7{width:404px;} input.span6, textarea.span6, .uneditable-input.span6{width:342px;} input.span5, textarea.span5, .uneditable-input.span5{width:280px;} input.span4, textarea.span4, .uneditable-input.span4{width:218px;} input.span3, textarea.span3, .uneditable-input.span3{width:156px;} input.span2, textarea.span2, .uneditable-input.span2{width:94px;} input.span1, textarea.span1, .uneditable-input.span1{width:32px;}}@media (min-width:1200px){.row{margin-left:-30px;*zoom:1;}.row:before,.row:after{display:table;content:"";} .row:after{clear:both;} [class*="span"]{float:left;margin-left:30px;} .container,.navbar-fixed-top .container,.navbar-fixed-bottom .container{width:1170px;} .span12{width:1170px;} .span11{width:1070px;} .span10{width:970px;} .span9{width:870px;} .span8{width:770px;} .span7{width:670px;} .span6{width:570px;} .span5{width:470px;} .span4{width:370px;} .span3{width:270px;} .span2{width:170px;} .span1{width:70px;} .offset12{margin-left:1230px;} .offset11{margin-left:1130px;} .offset10{margin-left:1030px;} .offset9{margin-left:930px;} .offset8{margin-left:830px;} .offset7{margin-left:730px;} .offset6{margin-left:630px;} .offset5{margin-left:530px;} .offset4{margin-left:430px;} .offset3{margin-left:330px;} .offset2{margin-left:230px;} .offset1{margin-left:130px;} .row-fluid{width:100%;*zoom:1;}.row-fluid:before,.row-fluid:after{display:table;content:"";} .row-fluid:after{clear:both;} .row-fluid [class*="span"]{display:block;width:100%;min-height:28px;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;-ms-box-sizing:border-box;box-sizing:border-box;float:left;margin-left:2.564102564%;*margin-left:2.510911074638298%;} .row-fluid [class*="span"]:first-child{margin-left:0;} .row-fluid .span12{width:100%;*width:99.94680851063829%;} .row-fluid .span11{width:91.45299145300001%;*width:91.3997999636383%;} .row-fluid .span10{width:82.905982906%;*width:82.8527914166383%;} .row-fluid .span9{width:74.358974359%;*width:74.30578286963829%;} .row-fluid .span8{width:65.81196581200001%;*width:65.7587743226383%;} .row-fluid .span7{width:57.264957265%;*width:57.2117657756383%;} .row-fluid .span6{width:48.717948718%;*width:48.6647572286383%;} .row-fluid .span5{width:40.170940171000005%;*width:40.117748681638304%;} .row-fluid .span4{width:31.623931624%;*width:31.5707401346383%;} .row-fluid .span3{width:23.076923077%;*width:23.0237315876383%;} .row-fluid .span2{width:14.529914530000001%;*width:14.4767230406383%;} .row-fluid .span1{width:5.982905983%;*width:5.929714493638298%;} input,textarea,.uneditable-input{margin-left:0;} input.span12, textarea.span12, .uneditable-input.span12{width:1160px;} input.span11, textarea.span11, .uneditable-input.span11{width:1060px;} input.span10, textarea.span10, .uneditable-input.span10{width:960px;} input.span9, textarea.span9, .uneditable-input.span9{width:860px;} input.span8, textarea.span8, .uneditable-input.span8{width:760px;} input.span7, textarea.span7, .uneditable-input.span7{width:660px;} input.span6, textarea.span6, .uneditable-input.span6{width:560px;} input.span5, textarea.span5, .uneditable-input.span5{width:460px;} input.span4, textarea.span4, .uneditable-input.span4{width:360px;} input.span3, textarea.span3, .uneditable-input.span3{width:260px;} input.span2, textarea.span2, .uneditable-input.span2{width:160px;} input.span1, textarea.span1, .uneditable-input.span1{width:60px;} .thumbnails{margin-left:-30px;} .thumbnails>li{margin-left:30px;} .row-fluid .thumbnails{margin-left:0;}}@media (max-width:979px){body{padding-top:0;} .navbar-fixed-top,.navbar-fixed-bottom{position:static;} .navbar-fixed-top{margin-bottom:18px;} .navbar-fixed-bottom{margin-top:18px;} .navbar-fixed-top .navbar-inner,.navbar-fixed-bottom .navbar-inner{padding:5px;} .navbar .container{width:auto;padding:0;} .navbar .brand{padding-left:10px;padding-right:10px;margin:0 0 0 -5px;} .nav-collapse{clear:both;} .nav-collapse .nav{float:none;margin:0 0 9px;} .nav-collapse .nav>li{float:none;} .nav-collapse .nav>li>a{margin-bottom:2px;} .nav-collapse .nav>.divider-vertical{display:none;} .nav-collapse .nav .nav-header{color:#999999;text-shadow:none;} .nav-collapse .nav>li>a,.nav-collapse .dropdown-menu a{padding:6px 15px;font-weight:bold;color:#999999;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px;} .nav-collapse .btn{padding:4px 10px 4px;font-weight:normal;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;} .nav-collapse .dropdown-menu li+li a{margin-bottom:2px;} .nav-collapse .nav>li>a:hover,.nav-collapse .dropdown-menu a:hover{background-color:#222222;} .nav-collapse.in .btn-group{margin-top:5px;padding:0;} .nav-collapse .dropdown-menu{position:static;top:auto;left:auto;float:none;display:block;max-width:none;margin:0 15px;padding:0;background-color:transparent;border:none;-webkit-border-radius:0;-moz-border-radius:0;border-radius:0;-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none;} .nav-collapse .dropdown-menu:before,.nav-collapse .dropdown-menu:after{display:none;} .nav-collapse .dropdown-menu .divider{display:none;} .nav-collapse .navbar-form,.nav-collapse .navbar-search{float:none;padding:9px 15px;margin:9px 0;border-top:1px solid #222222;border-bottom:1px solid #222222;-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,.1), 0 1px 0 rgba(255,255,255,.1);-moz-box-shadow:inset 0 1px 0 rgba(255,255,255,.1), 0 1px 0 rgba(255,255,255,.1);box-shadow:inset 0 1px 0 rgba(255,255,255,.1), 0 1px 0 rgba(255,255,255,.1);} .navbar .nav-collapse .nav.pull-right{float:none;margin-left:0;} .nav-collapse,.nav-collapse.collapse{overflow:hidden;height:0;} .navbar .btn-navbar{display:block;} .navbar-static .navbar-inner{padding-left:10px;padding-right:10px;}}@media (min-width:980px){.nav-collapse.collapse{height:auto !important;overflow:visible !important;}} diff --git a/demo/css/prism.css b/demo/css/prism.css new file mode 100644 index 0000000..b62c46a --- /dev/null +++ b/demo/css/prism.css @@ -0,0 +1,152 @@ +/** + * prism.js Twilight theme + * Based (more or less) on the Twilight theme originally of Textmate fame. + * @author Remy Bach + */ +code[class*="language-"], +pre[class*="language-"] { + color: white; + direction: ltr; + font-family: Consolas, Monaco, 'Andale Mono', monospace; + text-align: left; + text-shadow: 0 -.1em .2em black; + white-space: pre; + word-spacing: normal; + + -moz-tab-size: 4; + -o-tab-size: 4; + tab-size: 4; + + -webkit-hyphens: none; + -moz-hyphens: none; + -ms-hyphens: none; + hyphens: none; +} + +pre[class*="language-"], +:not(pre) > code[class*="language-"] { + background:hsl(0,0%,22%); +} + +/* Code blocks */ +pre[class*="language-"] { + border-radius: .5em; + border: .3em solid hsl(0,0%,33%); + box-shadow: 1px 1px .5em black inset; + margin: .5em 0; + overflow: auto; + padding: 1em; +} + +/* Inline code */ +:not(pre) > code[class*="language-"] { + border-radius: .3em; + border: .13em solid hsl(0,0%,33%); + box-shadow: 1px 1px .3em -.1em black inset; + padding: .15em .2em .05em; +} + +.token.comment, +.token.prolog, +.token.doctype, +.token.cdata { + color: hsl(0,0%,47%); +} + +.token.punctuation { + opacity: .7; +} + +.namespace { + opacity: .7; +} + +.token.tag, +.token.boolean, +.token.number { + color: hsl(15, 60%, 61%); +} + +.token.keyword, +.token.property, +.token.selector { + color:hsl(53, 89%, 79%); +} +.token.attr-name, +.token.string, +.token.operator, +.token.entity, +.token.url, +.language-css .token.string, +.style .token.string { + color:hsl(76, 21%, 52%); +} + +.token.atrule, +.token.attr-value { + color: hsl(32, 33%, 50%); +} + + +.token.regex, +.token.important { + color: hsl(42, 75%, 65%); +} + +.token.important { + font-weight: bold; +} + +.token.entity { + cursor: help; +} +pre[data-line] { + padding: 1em 0 1em 3em; + position: relative; +} + +/* Make the tokens sit above the line highlight so the colours don't look faded. */ +.token { + position:relative; + z-index:1; +} +.line-highlight { + background: -moz-linear-gradient(left, hsl(0, 0%, 33%,.1) 70%, hsl(0, 0%, 33%,0)); + background: -o-linear-gradient(left, hsl(0, 0%, 33%,.1) 70%, hsl(0, 0%, 33%,0)); + background: -webkit-linear-gradient(left, hsl(0, 0%, 33%,.1) 70%, hsl(0, 0%, 33%,0)); + background: hsla(0, 0%, 33%, 0.25); + background: linear-gradient(left, hsl(0, 0%, 33%,.1) 70%, hsl(0, 0%, 33%,0)); + border-bottom:1px dashed hsl(0, 0%, 33%); + border-top:1px dashed hsl(0, 0%, 33%); + left: 0; + line-height: inherit; + margin-top: 0.75em; /* Same as .prism’s padding-top */ + padding: inherit 0; + pointer-events: none; + position: absolute; + right: 0; + white-space: pre; + z-index:0; +} +.line-highlight:before, +.line-highlight[data-end]:after { + background-color: hsl(215, 15%, 59%); + border-radius: 999px; + box-shadow: 0 1px white; + color: hsl(24, 20%, 95%); + content: attr(data-start); + font: bold 65%/1.5 sans-serif; + left: .6em; + min-width: 1em; + padding: 0 .5em; + position: absolute; + text-align: center; + text-shadow: none; + top: .4em; + vertical-align: .3em; +} +.line-highlight[data-end]:after { + bottom: .4em; + content: attr(data-end); + top: auto; +} \ No newline at end of file diff --git a/demo/css/style.css b/demo/css/style.css new file mode 100755 index 0000000..6a86f34 --- /dev/null +++ b/demo/css/style.css @@ -0,0 +1,52 @@ +body { + font-family:Ubuntu,Helvetica,Arial,sans; + padding:10px; +} +pre, code { + font-family:"Ubuntu Mono","Courier New",sans; +} +h1 { + margin-bottom:20px; +} +ul { + margin-bottom:0; + margin-left:0; +} +li { + list-style:none; + position:relative; +} +input, textarea { width:98%; } +select { + margin-bottom:0; + width:100%; +} +form { margin-bottom:0; } +/* Reset this from what's set by bootstrap */ +label { display:inline; } + +.container { + position:relative; +} +.fork { + border:0; + position:absolute; + right:0; + top:0; + z-index:2; +} +.bordered { + border:1px solid #777; + border:1px solid rgba(0, 0, 0, 0.2); + margin-bottom:20px; + min-height:20px; + padding:19px; + + -webkit-border-radius:4px; + -moz-border-radius:4px; + border-radius:4px; + + -webkit-box-shadow:inset 0 1px 1px rgba(0, 0, 0, 0.05); + -moz-box-shadow:inset 0 1px 1px rgba(0, 0, 0, 0.05); + box-shadow:inset 0 1px 1px rgba(0, 0, 0, 0.05); +} \ No newline at end of file diff --git a/demo/index.html b/demo/index.html new file mode 100755 index 0000000..1135099 --- /dev/null +++ b/demo/index.html @@ -0,0 +1,84 @@ + + + + jQuery Super Labels Plugin + + + + + + + + + + + + + + + + + Fork me on GitHub + +
+ +
+
+

jQuery Super Labels Demo

+
+
+
+
+
$(function() {
+	// Test comment
+	$('form').superLabels({
+		labelLeft:5,
+		labelTop:5
+	});
+});
+
+ +
+
+
    +
  • + + +
  • +
  • + + +
  • +
  • + + +
  • +
+
+
+
+
+ + + \ No newline at end of file diff --git a/demo/scripts/jquery-1.7.1.min.js b/demo/scripts/jquery-1.7.1.min.js new file mode 100755 index 0000000..8305ef3 --- /dev/null +++ b/demo/scripts/jquery-1.7.1.min.js @@ -0,0 +1,4 @@ +/*! jQuery v1.7.1 jquery.com | jquery.org/license */ +(function(a,b){function cy(a){return f.isWindow(a)?a:a.nodeType===9?a.defaultView||a.parentWindow:!1}function cv(a){if(!ck[a]){var b=c.body,d=f("<"+a+">").appendTo(b),e=d.css("display");d.remove();if(e==="none"||e===""){cl||(cl=c.createElement("iframe"),cl.frameBorder=cl.width=cl.height=0),b.appendChild(cl);if(!cm||!cl.createElement)cm=(cl.contentWindow||cl.contentDocument).document,cm.write((c.compatMode==="CSS1Compat"?"":"")+""),cm.close();d=cm.createElement(a),cm.body.appendChild(d),e=f.css(d,"display"),b.removeChild(cl)}ck[a]=e}return ck[a]}function cu(a,b){var c={};f.each(cq.concat.apply([],cq.slice(0,b)),function(){c[this]=a});return c}function ct(){cr=b}function cs(){setTimeout(ct,0);return cr=f.now()}function cj(){try{return new a.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}}function ci(){try{return new a.XMLHttpRequest}catch(b){}}function cc(a,c){a.dataFilter&&(c=a.dataFilter(c,a.dataType));var d=a.dataTypes,e={},g,h,i=d.length,j,k=d[0],l,m,n,o,p;for(g=1;g0){if(c!=="border")for(;g=0===c})}function S(a){return!a||!a.parentNode||a.parentNode.nodeType===11}function K(){return!0}function J(){return!1}function n(a,b,c){var d=b+"defer",e=b+"queue",g=b+"mark",h=f._data(a,d);h&&(c==="queue"||!f._data(a,e))&&(c==="mark"||!f._data(a,g))&&setTimeout(function(){!f._data(a,e)&&!f._data(a,g)&&(f.removeData(a,d,!0),h.fire())},0)}function m(a){for(var b in a){if(b==="data"&&f.isEmptyObject(a[b]))continue;if(b!=="toJSON")return!1}return!0}function l(a,c,d){if(d===b&&a.nodeType===1){var e="data-"+c.replace(k,"-$1").toLowerCase();d=a.getAttribute(e);if(typeof d=="string"){try{d=d==="true"?!0:d==="false"?!1:d==="null"?null:f.isNumeric(d)?parseFloat(d):j.test(d)?f.parseJSON(d):d}catch(g){}f.data(a,c,d)}else d=b}return d}function h(a){var b=g[a]={},c,d;a=a.split(/\s+/);for(c=0,d=a.length;c)[^>]*$|#([\w\-]*)$)/,j=/\S/,k=/^\s+/,l=/\s+$/,m=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,n=/^[\],:{}\s]*$/,o=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,p=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,q=/(?:^|:|,)(?:\s*\[)+/g,r=/(webkit)[ \/]([\w.]+)/,s=/(opera)(?:.*version)?[ \/]([\w.]+)/,t=/(msie) ([\w.]+)/,u=/(mozilla)(?:.*? rv:([\w.]+))?/,v=/-([a-z]|[0-9])/ig,w=/^-ms-/,x=function(a,b){return(b+"").toUpperCase()},y=d.userAgent,z,A,B,C=Object.prototype.toString,D=Object.prototype.hasOwnProperty,E=Array.prototype.push,F=Array.prototype.slice,G=String.prototype.trim,H=Array.prototype.indexOf,I={};e.fn=e.prototype={constructor:e,init:function(a,d,f){var g,h,j,k;if(!a)return this;if(a.nodeType){this.context=this[0]=a,this.length=1;return this}if(a==="body"&&!d&&c.body){this.context=c,this[0]=c.body,this.selector=a,this.length=1;return this}if(typeof a=="string"){a.charAt(0)!=="<"||a.charAt(a.length-1)!==">"||a.length<3?g=i.exec(a):g=[null,a,null];if(g&&(g[1]||!d)){if(g[1]){d=d instanceof e?d[0]:d,k=d?d.ownerDocument||d:c,j=m.exec(a),j?e.isPlainObject(d)?(a=[c.createElement(j[1])],e.fn.attr.call(a,d,!0)):a=[k.createElement(j[1])]:(j=e.buildFragment([g[1]],[k]),a=(j.cacheable?e.clone(j.fragment):j.fragment).childNodes);return e.merge(this,a)}h=c.getElementById(g[2]);if(h&&h.parentNode){if(h.id!==g[2])return f.find(a);this.length=1,this[0]=h}this.context=c,this.selector=a;return this}return!d||d.jquery?(d||f).find(a):this.constructor(d).find(a)}if(e.isFunction(a))return f.ready(a);a.selector!==b&&(this.selector=a.selector,this.context=a.context);return e.makeArray(a,this)},selector:"",jquery:"1.7.1",length:0,size:function(){return this.length},toArray:function(){return F.call(this,0)},get:function(a){return a==null?this.toArray():a<0?this[this.length+a]:this[a]},pushStack:function(a,b,c){var d=this.constructor();e.isArray(a)?E.apply(d,a):e.merge(d,a),d.prevObject=this,d.context=this.context,b==="find"?d.selector=this.selector+(this.selector?" ":"")+c:b&&(d.selector=this.selector+"."+b+"("+c+")");return d},each:function(a,b){return e.each(this,a,b)},ready:function(a){e.bindReady(),A.add(a);return this},eq:function(a){a=+a;return a===-1?this.slice(a):this.slice(a,a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(F.apply(this,arguments),"slice",F.call(arguments).join(","))},map:function(a){return this.pushStack(e.map(this,function(b,c){return a.call(b,c,b)}))},end:function(){return this.prevObject||this.constructor(null)},push:E,sort:[].sort,splice:[].splice},e.fn.init.prototype=e.fn,e.extend=e.fn.extend=function(){var a,c,d,f,g,h,i=arguments[0]||{},j=1,k=arguments.length,l=!1;typeof i=="boolean"&&(l=i,i=arguments[1]||{},j=2),typeof i!="object"&&!e.isFunction(i)&&(i={}),k===j&&(i=this,--j);for(;j0)return;A.fireWith(c,[e]),e.fn.trigger&&e(c).trigger("ready").off("ready")}},bindReady:function(){if(!A){A=e.Callbacks("once memory");if(c.readyState==="complete")return setTimeout(e.ready,1);if(c.addEventListener)c.addEventListener("DOMContentLoaded",B,!1),a.addEventListener("load",e.ready,!1);else if(c.attachEvent){c.attachEvent("onreadystatechange",B),a.attachEvent("onload",e.ready);var b=!1;try{b=a.frameElement==null}catch(d){}c.documentElement.doScroll&&b&&J()}}},isFunction:function(a){return e.type(a)==="function"},isArray:Array.isArray||function(a){return e.type(a)==="array"},isWindow:function(a){return a&&typeof a=="object"&&"setInterval"in a},isNumeric:function(a){return!isNaN(parseFloat(a))&&isFinite(a)},type:function(a){return a==null?String(a):I[C.call(a)]||"object"},isPlainObject:function(a){if(!a||e.type(a)!=="object"||a.nodeType||e.isWindow(a))return!1;try{if(a.constructor&&!D.call(a,"constructor")&&!D.call(a.constructor.prototype,"isPrototypeOf"))return!1}catch(c){return!1}var d;for(d in a);return d===b||D.call(a,d)},isEmptyObject:function(a){for(var b in a)return!1;return!0},error:function(a){throw new Error(a)},parseJSON:function(b){if(typeof b!="string"||!b)return null;b=e.trim(b);if(a.JSON&&a.JSON.parse)return a.JSON.parse(b);if(n.test(b.replace(o,"@").replace(p,"]").replace(q,"")))return(new Function("return "+b))();e.error("Invalid JSON: "+b)},parseXML:function(c){var d,f;try{a.DOMParser?(f=new DOMParser,d=f.parseFromString(c,"text/xml")):(d=new ActiveXObject("Microsoft.XMLDOM"),d.async="false",d.loadXML(c))}catch(g){d=b}(!d||!d.documentElement||d.getElementsByTagName("parsererror").length)&&e.error("Invalid XML: "+c);return d},noop:function(){},globalEval:function(b){b&&j.test(b)&&(a.execScript||function(b){a.eval.call(a,b)})(b)},camelCase:function(a){return a.replace(w,"ms-").replace(v,x)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toUpperCase()===b.toUpperCase()},each:function(a,c,d){var f,g=0,h=a.length,i=h===b||e.isFunction(a);if(d){if(i){for(f in a)if(c.apply(a[f],d)===!1)break}else for(;g0&&a[0]&&a[j-1]||j===0||e.isArray(a));if(k)for(;i1?i.call(arguments,0):b,j.notifyWith(k,e)}}function l(a){return function(c){b[a]=arguments.length>1?i.call(arguments,0):c,--g||j.resolveWith(j,b)}}var b=i.call(arguments,0),c=0,d=b.length,e=Array(d),g=d,h=d,j=d<=1&&a&&f.isFunction(a.promise)?a:f.Deferred(),k=j.promise();if(d>1){for(;c
a",d=q.getElementsByTagName("*"),e=q.getElementsByTagName("a")[0];if(!d||!d.length||!e)return{};g=c.createElement("select"),h=g.appendChild(c.createElement("option")),i=q.getElementsByTagName("input")[0],b={leadingWhitespace:q.firstChild.nodeType===3,tbody:!q.getElementsByTagName("tbody").length,htmlSerialize:!!q.getElementsByTagName("link").length,style:/top/.test(e.getAttribute("style")),hrefNormalized:e.getAttribute("href")==="/a",opacity:/^0.55/.test(e.style.opacity),cssFloat:!!e.style.cssFloat,checkOn:i.value==="on",optSelected:h.selected,getSetAttribute:q.className!=="t",enctype:!!c.createElement("form").enctype,html5Clone:c.createElement("nav").cloneNode(!0).outerHTML!=="<:nav>",submitBubbles:!0,changeBubbles:!0,focusinBubbles:!1,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0},i.checked=!0,b.noCloneChecked=i.cloneNode(!0).checked,g.disabled=!0,b.optDisabled=!h.disabled;try{delete q.test}catch(s){b.deleteExpando=!1}!q.addEventListener&&q.attachEvent&&q.fireEvent&&(q.attachEvent("onclick",function(){b.noCloneEvent=!1}),q.cloneNode(!0).fireEvent("onclick")),i=c.createElement("input"),i.value="t",i.setAttribute("type","radio"),b.radioValue=i.value==="t",i.setAttribute("checked","checked"),q.appendChild(i),k=c.createDocumentFragment(),k.appendChild(q.lastChild),b.checkClone=k.cloneNode(!0).cloneNode(!0).lastChild.checked,b.appendChecked=i.checked,k.removeChild(i),k.appendChild(q),q.innerHTML="",a.getComputedStyle&&(j=c.createElement("div"),j.style.width="0",j.style.marginRight="0",q.style.width="2px",q.appendChild(j),b.reliableMarginRight=(parseInt((a.getComputedStyle(j,null)||{marginRight:0}).marginRight,10)||0)===0);if(q.attachEvent)for(o in{submit:1,change:1,focusin:1})n="on"+o,p=n in q,p||(q.setAttribute(n,"return;"),p=typeof q[n]=="function"),b[o+"Bubbles"]=p;k.removeChild(q),k=g=h=j=q=i=null,f(function(){var a,d,e,g,h,i,j,k,m,n,o,r=c.getElementsByTagName("body")[0];!r||(j=1,k="position:absolute;top:0;left:0;width:1px;height:1px;margin:0;",m="visibility:hidden;border:0;",n="style='"+k+"border:5px solid #000;padding:0;'",o="
"+""+"
",a=c.createElement("div"),a.style.cssText=m+"width:0;height:0;position:static;top:0;margin-top:"+j+"px",r.insertBefore(a,r.firstChild),q=c.createElement("div"),a.appendChild(q),q.innerHTML="
t
",l=q.getElementsByTagName("td"),p=l[0].offsetHeight===0,l[0].style.display="",l[1].style.display="none",b.reliableHiddenOffsets=p&&l[0].offsetHeight===0,q.innerHTML="",q.style.width=q.style.paddingLeft="1px",f.boxModel=b.boxModel=q.offsetWidth===2,typeof q.style.zoom!="undefined"&&(q.style.display="inline",q.style.zoom=1,b.inlineBlockNeedsLayout=q.offsetWidth===2,q.style.display="",q.innerHTML="
",b.shrinkWrapBlocks=q.offsetWidth!==2),q.style.cssText=k+m,q.innerHTML=o,d=q.firstChild,e=d.firstChild,h=d.nextSibling.firstChild.firstChild,i={doesNotAddBorder:e.offsetTop!==5,doesAddBorderForTableAndCells:h.offsetTop===5},e.style.position="fixed",e.style.top="20px",i.fixedPosition=e.offsetTop===20||e.offsetTop===15,e.style.position=e.style.top="",d.style.overflow="hidden",d.style.position="relative",i.subtractsBorderForOverflowNotVisible=e.offsetTop===-5,i.doesNotIncludeMarginInBodyOffset=r.offsetTop!==j,r.removeChild(a),q=a=null,f.extend(b,i))});return b}();var j=/^(?:\{.*\}|\[.*\])$/,k=/([A-Z])/g;f.extend({cache:{},uuid:0,expando:"jQuery"+(f.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(a){a=a.nodeType?f.cache[a[f.expando]]:a[f.expando];return!!a&&!m(a)},data:function(a,c,d,e){if(!!f.acceptData(a)){var g,h,i,j=f.expando,k=typeof c=="string",l=a.nodeType,m=l?f.cache:a,n=l?a[j]:a[j]&&j,o=c==="events";if((!n||!m[n]||!o&&!e&&!m[n].data)&&k&&d===b)return;n||(l?a[j]=n=++f.uuid:n=j),m[n]||(m[n]={},l||(m[n].toJSON=f.noop));if(typeof c=="object"||typeof c=="function")e?m[n]=f.extend(m[n],c):m[n].data=f.extend(m[n].data,c);g=h=m[n],e||(h.data||(h.data={}),h=h.data),d!==b&&(h[f.camelCase(c)]=d);if(o&&!h[c])return g.events;k?(i=h[c],i==null&&(i=h[f.camelCase(c)])):i=h;return i}},removeData:function(a,b,c){if(!!f.acceptData(a)){var d,e,g,h=f.expando,i=a.nodeType,j=i?f.cache:a,k=i?a[h]:h;if(!j[k])return;if(b){d=c?j[k]:j[k].data;if(d){f.isArray(b)||(b in d?b=[b]:(b=f.camelCase(b),b in d?b=[b]:b=b.split(" ")));for(e=0,g=b.length;e-1)return!0;return!1},val:function(a){var c,d,e,g=this[0];{if(!!arguments.length){e=f.isFunction(a);return this.each(function(d){var g=f(this),h;if(this.nodeType===1){e?h=a.call(this,d,g.val()):h=a,h==null?h="":typeof h=="number"?h+="":f.isArray(h)&&(h=f.map(h,function(a){return a==null?"":a+""})),c=f.valHooks[this.nodeName.toLowerCase()]||f.valHooks[this.type];if(!c||!("set"in c)||c.set(this,h,"value")===b)this.value=h}})}if(g){c=f.valHooks[g.nodeName.toLowerCase()]||f.valHooks[g.type];if(c&&"get"in c&&(d=c.get(g,"value"))!==b)return d;d=g.value;return typeof d=="string"?d.replace(q,""):d==null?"":d}}}}),f.extend({valHooks:{option:{get:function(a){var b=a.attributes.value;return!b||b.specified?a.value:a.text}},select:{get:function(a){var b,c,d,e,g=a.selectedIndex,h=[],i=a.options,j=a.type==="select-one";if(g<0)return null;c=j?g:0,d=j?g+1:i.length;for(;c=0}),c.length||(a.selectedIndex=-1);return c}}},attrFn:{val:!0,css:!0,html:!0,text:!0,data:!0,width:!0,height:!0,offset:!0},attr:function(a,c,d,e){var g,h,i,j=a.nodeType;if(!!a&&j!==3&&j!==8&&j!==2){if(e&&c in f.attrFn)return f(a)[c](d);if(typeof a.getAttribute=="undefined")return f.prop(a,c,d);i=j!==1||!f.isXMLDoc(a),i&&(c=c.toLowerCase(),h=f.attrHooks[c]||(u.test(c)?x:w));if(d!==b){if(d===null){f.removeAttr(a,c);return}if(h&&"set"in h&&i&&(g=h.set(a,d,c))!==b)return g;a.setAttribute(c,""+d);return d}if(h&&"get"in h&&i&&(g=h.get(a,c))!==null)return g;g=a.getAttribute(c);return g===null?b:g}},removeAttr:function(a,b){var c,d,e,g,h=0;if(b&&a.nodeType===1){d=b.toLowerCase().split(p),g=d.length;for(;h=0}})});var z=/^(?:textarea|input|select)$/i,A=/^([^\.]*)?(?:\.(.+))?$/,B=/\bhover(\.\S+)?\b/,C=/^key/,D=/^(?:mouse|contextmenu)|click/,E=/^(?:focusinfocus|focusoutblur)$/,F=/^(\w*)(?:#([\w\-]+))?(?:\.([\w\-]+))?$/,G=function(a){var b=F.exec(a);b&&(b[1]=(b[1]||"").toLowerCase(),b[3]=b[3]&&new RegExp("(?:^|\\s)"+b[3]+"(?:\\s|$)"));return b},H=function(a,b){var c=a.attributes||{};return(!b[1]||a.nodeName.toLowerCase()===b[1])&&(!b[2]||(c.id||{}).value===b[2])&&(!b[3]||b[3].test((c["class"]||{}).value))},I=function(a){return f.event.special.hover?a:a.replace(B,"mouseenter$1 mouseleave$1")}; +f.event={add:function(a,c,d,e,g){var h,i,j,k,l,m,n,o,p,q,r,s;if(!(a.nodeType===3||a.nodeType===8||!c||!d||!(h=f._data(a)))){d.handler&&(p=d,d=p.handler),d.guid||(d.guid=f.guid++),j=h.events,j||(h.events=j={}),i=h.handle,i||(h.handle=i=function(a){return typeof f!="undefined"&&(!a||f.event.triggered!==a.type)?f.event.dispatch.apply(i.elem,arguments):b},i.elem=a),c=f.trim(I(c)).split(" ");for(k=0;k=0&&(h=h.slice(0,-1),k=!0),h.indexOf(".")>=0&&(i=h.split("."),h=i.shift(),i.sort());if((!e||f.event.customEvent[h])&&!f.event.global[h])return;c=typeof c=="object"?c[f.expando]?c:new f.Event(h,c):new f.Event(h),c.type=h,c.isTrigger=!0,c.exclusive=k,c.namespace=i.join("."),c.namespace_re=c.namespace?new RegExp("(^|\\.)"+i.join("\\.(?:.*\\.)?")+"(\\.|$)"):null,o=h.indexOf(":")<0?"on"+h:"";if(!e){j=f.cache;for(l in j)j[l].events&&j[l].events[h]&&f.event.trigger(c,d,j[l].handle.elem,!0);return}c.result=b,c.target||(c.target=e),d=d!=null?f.makeArray(d):[],d.unshift(c),p=f.event.special[h]||{};if(p.trigger&&p.trigger.apply(e,d)===!1)return;r=[[e,p.bindType||h]];if(!g&&!p.noBubble&&!f.isWindow(e)){s=p.delegateType||h,m=E.test(s+h)?e:e.parentNode,n=null;for(;m;m=m.parentNode)r.push([m,s]),n=m;n&&n===e.ownerDocument&&r.push([n.defaultView||n.parentWindow||a,s])}for(l=0;le&&i.push({elem:this,matches:d.slice(e)});for(j=0;j0?this.on(b,null,a,c):this.trigger(b)},f.attrFn&&(f.attrFn[b]=!0),C.test(b)&&(f.event.fixHooks[b]=f.event.keyHooks),D.test(b)&&(f.event.fixHooks[b]=f.event.mouseHooks)}),function(){function x(a,b,c,e,f,g){for(var h=0,i=e.length;h0){k=j;break}}j=j[a]}e[h]=k}}}function w(a,b,c,e,f,g){for(var h=0,i=e.length;h+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,d="sizcache"+(Math.random()+"").replace(".",""),e=0,g=Object.prototype.toString,h=!1,i=!0,j=/\\/g,k=/\r\n/g,l=/\W/;[0,0].sort(function(){i=!1;return 0});var m=function(b,d,e,f){e=e||[],d=d||c;var h=d;if(d.nodeType!==1&&d.nodeType!==9)return[];if(!b||typeof b!="string")return e;var i,j,k,l,n,q,r,t,u=!0,v=m.isXML(d),w=[],x=b;do{a.exec(""),i=a.exec(x);if(i){x=i[3],w.push(i[1]);if(i[2]){l=i[3];break}}}while(i);if(w.length>1&&p.exec(b))if(w.length===2&&o.relative[w[0]])j=y(w[0]+w[1],d,f);else{j=o.relative[w[0]]?[d]:m(w.shift(),d);while(w.length)b=w.shift(),o.relative[b]&&(b+=w.shift()),j=y(b,j,f)}else{!f&&w.length>1&&d.nodeType===9&&!v&&o.match.ID.test(w[0])&&!o.match.ID.test(w[w.length-1])&&(n=m.find(w.shift(),d,v),d=n.expr?m.filter(n.expr,n.set)[0]:n.set[0]);if(d){n=f?{expr:w.pop(),set:s(f)}:m.find(w.pop(),w.length===1&&(w[0]==="~"||w[0]==="+")&&d.parentNode?d.parentNode:d,v),j=n.expr?m.filter(n.expr,n.set):n.set,w.length>0?k=s(j):u=!1;while(w.length)q=w.pop(),r=q,o.relative[q]?r=w.pop():q="",r==null&&(r=d),o.relative[q](k,r,v)}else k=w=[]}k||(k=j),k||m.error(q||b);if(g.call(k)==="[object Array]")if(!u)e.push.apply(e,k);else if(d&&d.nodeType===1)for(t=0;k[t]!=null;t++)k[t]&&(k[t]===!0||k[t].nodeType===1&&m.contains(d,k[t]))&&e.push(j[t]);else for(t=0;k[t]!=null;t++)k[t]&&k[t].nodeType===1&&e.push(j[t]);else s(k,e);l&&(m(l,h,e,f),m.uniqueSort(e));return e};m.uniqueSort=function(a){if(u){h=i,a.sort(u);if(h)for(var b=1;b0},m.find=function(a,b,c){var d,e,f,g,h,i;if(!a)return[];for(e=0,f=o.order.length;e":function(a,b){var c,d=typeof b=="string",e=0,f=a.length;if(d&&!l.test(b)){b=b.toLowerCase();for(;e=0)?c||d.push(h):c&&(b[g]=!1));return!1},ID:function(a){return a[1].replace(j,"")},TAG:function(a,b){return a[1].replace(j,"").toLowerCase()},CHILD:function(a){if(a[1]==="nth"){a[2]||m.error(a[0]),a[2]=a[2].replace(/^\+|\s*/g,"");var b=/(-?)(\d*)(?:n([+\-]?\d*))?/.exec(a[2]==="even"&&"2n"||a[2]==="odd"&&"2n+1"||!/\D/.test(a[2])&&"0n+"+a[2]||a[2]);a[2]=b[1]+(b[2]||1)-0,a[3]=b[3]-0}else a[2]&&m.error(a[0]);a[0]=e++;return a},ATTR:function(a,b,c,d,e,f){var g=a[1]=a[1].replace(j,"");!f&&o.attrMap[g]&&(a[1]=o.attrMap[g]),a[4]=(a[4]||a[5]||"").replace(j,""),a[2]==="~="&&(a[4]=" "+a[4]+" ");return a},PSEUDO:function(b,c,d,e,f){if(b[1]==="not")if((a.exec(b[3])||"").length>1||/^\w/.test(b[3]))b[3]=m(b[3],null,null,c);else{var g=m.filter(b[3],c,d,!0^f);d||e.push.apply(e,g);return!1}else if(o.match.POS.test(b[0])||o.match.CHILD.test(b[0]))return!0;return b},POS:function(a){a.unshift(!0);return a}},filters:{enabled:function(a){return a.disabled===!1&&a.type!=="hidden"},disabled:function(a){return a.disabled===!0},checked:function(a){return a.checked===!0},selected:function(a){a.parentNode&&a.parentNode.selectedIndex;return a.selected===!0},parent:function(a){return!!a.firstChild},empty:function(a){return!a.firstChild},has:function(a,b,c){return!!m(c[3],a).length},header:function(a){return/h\d/i.test(a.nodeName)},text:function(a){var b=a.getAttribute("type"),c=a.type;return a.nodeName.toLowerCase()==="input"&&"text"===c&&(b===c||b===null)},radio:function(a){return a.nodeName.toLowerCase()==="input"&&"radio"===a.type},checkbox:function(a){return a.nodeName.toLowerCase()==="input"&&"checkbox"===a.type},file:function(a){return a.nodeName.toLowerCase()==="input"&&"file"===a.type},password:function(a){return a.nodeName.toLowerCase()==="input"&&"password"===a.type},submit:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"submit"===a.type},image:function(a){return a.nodeName.toLowerCase()==="input"&&"image"===a.type},reset:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"reset"===a.type},button:function(a){var b=a.nodeName.toLowerCase();return b==="input"&&"button"===a.type||b==="button"},input:function(a){return/input|select|textarea|button/i.test(a.nodeName)},focus:function(a){return a===a.ownerDocument.activeElement}},setFilters:{first:function(a,b){return b===0},last:function(a,b,c,d){return b===d.length-1},even:function(a,b){return b%2===0},odd:function(a,b){return b%2===1},lt:function(a,b,c){return bc[3]-0},nth:function(a,b,c){return c[3]-0===b},eq:function(a,b,c){return c[3]-0===b}},filter:{PSEUDO:function(a,b,c,d){var e=b[1],f=o.filters[e];if(f)return f(a,c,b,d);if(e==="contains")return(a.textContent||a.innerText||n([a])||"").indexOf(b[3])>=0;if(e==="not"){var g=b[3];for(var h=0,i=g.length;h=0}},ID:function(a,b){return a.nodeType===1&&a.getAttribute("id")===b},TAG:function(a,b){return b==="*"&&a.nodeType===1||!!a.nodeName&&a.nodeName.toLowerCase()===b},CLASS:function(a,b){return(" "+(a.className||a.getAttribute("class"))+" ").indexOf(b)>-1},ATTR:function(a,b){var c=b[1],d=m.attr?m.attr(a,c):o.attrHandle[c]?o.attrHandle[c](a):a[c]!=null?a[c]:a.getAttribute(c),e=d+"",f=b[2],g=b[4];return d==null?f==="!=":!f&&m.attr?d!=null:f==="="?e===g:f==="*="?e.indexOf(g)>=0:f==="~="?(" "+e+" ").indexOf(g)>=0:g?f==="!="?e!==g:f==="^="?e.indexOf(g)===0:f==="$="?e.substr(e.length-g.length)===g:f==="|="?e===g||e.substr(0,g.length+1)===g+"-":!1:e&&d!==!1},POS:function(a,b,c,d){var e=b[2],f=o.setFilters[e];if(f)return f(a,c,b,d)}}},p=o.match.POS,q=function(a,b){return"\\"+(b-0+1)};for(var r in o.match)o.match[r]=new RegExp(o.match[r].source+/(?![^\[]*\])(?![^\(]*\))/.source),o.leftMatch[r]=new RegExp(/(^(?:.|\r|\n)*?)/.source+o.match[r].source.replace(/\\(\d+)/g,q));var s=function(a,b){a=Array.prototype.slice.call(a,0);if(b){b.push.apply(b,a);return b}return a};try{Array.prototype.slice.call(c.documentElement.childNodes,0)[0].nodeType}catch(t){s=function(a,b){var c=0,d=b||[];if(g.call(a)==="[object Array]")Array.prototype.push.apply(d,a);else if(typeof a.length=="number")for(var e=a.length;c",e.insertBefore(a,e.firstChild),c.getElementById(d)&&(o.find.ID=function(a,c,d){if(typeof c.getElementById!="undefined"&&!d){var e=c.getElementById(a[1]);return e?e.id===a[1]||typeof e.getAttributeNode!="undefined"&&e.getAttributeNode("id").nodeValue===a[1]?[e]:b:[]}},o.filter.ID=function(a,b){var c=typeof a.getAttributeNode!="undefined"&&a.getAttributeNode("id");return a.nodeType===1&&c&&c.nodeValue===b}),e.removeChild(a),e=a=null}(),function(){var a=c.createElement("div");a.appendChild(c.createComment("")),a.getElementsByTagName("*").length>0&&(o.find.TAG=function(a,b){var c=b.getElementsByTagName(a[1]);if(a[1]==="*"){var d=[];for(var e=0;c[e];e++)c[e].nodeType===1&&d.push(c[e]);c=d}return c}),a.innerHTML="",a.firstChild&&typeof a.firstChild.getAttribute!="undefined"&&a.firstChild.getAttribute("href")!=="#"&&(o.attrHandle.href=function(a){return a.getAttribute("href",2)}),a=null}(),c.querySelectorAll&&function(){var a=m,b=c.createElement("div"),d="__sizzle__";b.innerHTML="

";if(!b.querySelectorAll||b.querySelectorAll(".TEST").length!==0){m=function(b,e,f,g){e=e||c;if(!g&&!m.isXML(e)){var h=/^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec(b);if(h&&(e.nodeType===1||e.nodeType===9)){if(h[1])return s(e.getElementsByTagName(b),f);if(h[2]&&o.find.CLASS&&e.getElementsByClassName)return s(e.getElementsByClassName(h[2]),f)}if(e.nodeType===9){if(b==="body"&&e.body)return s([e.body],f);if(h&&h[3]){var i=e.getElementById(h[3]);if(!i||!i.parentNode)return s([],f);if(i.id===h[3])return s([i],f)}try{return s(e.querySelectorAll(b),f)}catch(j){}}else if(e.nodeType===1&&e.nodeName.toLowerCase()!=="object"){var k=e,l=e.getAttribute("id"),n=l||d,p=e.parentNode,q=/^\s*[+~]/.test(b);l?n=n.replace(/'/g,"\\$&"):e.setAttribute("id",n),q&&p&&(e=e.parentNode);try{if(!q||p)return s(e.querySelectorAll("[id='"+n+"'] "+b),f)}catch(r){}finally{l||k.removeAttribute("id")}}}return a(b,e,f,g)};for(var e in a)m[e]=a[e];b=null}}(),function(){var a=c.documentElement,b=a.matchesSelector||a.mozMatchesSelector||a.webkitMatchesSelector||a.msMatchesSelector;if(b){var d=!b.call(c.createElement("div"),"div"),e=!1;try{b.call(c.documentElement,"[test!='']:sizzle")}catch(f){e=!0}m.matchesSelector=function(a,c){c=c.replace(/\=\s*([^'"\]]*)\s*\]/g,"='$1']");if(!m.isXML(a))try{if(e||!o.match.PSEUDO.test(c)&&!/!=/.test(c)){var f=b.call(a,c);if(f||!d||a.document&&a.document.nodeType!==11)return f}}catch(g){}return m(c,null,null,[a]).length>0}}}(),function(){var a=c.createElement("div");a.innerHTML="
";if(!!a.getElementsByClassName&&a.getElementsByClassName("e").length!==0){a.lastChild.className="e";if(a.getElementsByClassName("e").length===1)return;o.order.splice(1,0,"CLASS"),o.find.CLASS=function(a,b,c){if(typeof b.getElementsByClassName!="undefined"&&!c)return b.getElementsByClassName(a[1])},a=null}}(),c.documentElement.contains?m.contains=function(a,b){return a!==b&&(a.contains?a.contains(b):!0)}:c.documentElement.compareDocumentPosition?m.contains=function(a,b){return!!(a.compareDocumentPosition(b)&16)}:m.contains=function(){return!1},m.isXML=function(a){var b=(a?a.ownerDocument||a:0).documentElement;return b?b.nodeName!=="HTML":!1};var y=function(a,b,c){var d,e=[],f="",g=b.nodeType?[b]:b;while(d=o.match.PSEUDO.exec(a))f+=d[0],a=a.replace(o.match.PSEUDO,"");a=o.relative[a]?a+"*":a;for(var h=0,i=g.length;h0)for(h=g;h=0:f.filter(a,this).length>0:this.filter(a).length>0)},closest:function(a,b){var c=[],d,e,g=this[0];if(f.isArray(a)){var h=1;while(g&&g.ownerDocument&&g!==b){for(d=0;d-1:f.find.matchesSelector(g,a)){c.push(g);break}g=g.parentNode;if(!g||!g.ownerDocument||g===b||g.nodeType===11)break}}c=c.length>1?f.unique(c):c;return this.pushStack(c,"closest",a)},index:function(a){if(!a)return this[0]&&this[0].parentNode?this.prevAll().length:-1;if(typeof a=="string")return f.inArray(this[0],f(a));return f.inArray(a.jquery?a[0]:a,this)},add:function(a,b){var c=typeof a=="string"?f(a,b):f.makeArray(a&&a.nodeType?[a]:a),d=f.merge(this.get(),c);return this.pushStack(S(c[0])||S(d[0])?d:f.unique(d))},andSelf:function(){return this.add(this.prevObject)}}),f.each({parent:function(a){var b=a.parentNode;return b&&b.nodeType!==11?b:null},parents:function(a){return f.dir(a,"parentNode")},parentsUntil:function(a,b,c){return f.dir(a,"parentNode",c)},next:function(a){return f.nth(a,2,"nextSibling")},prev:function(a){return f.nth(a,2,"previousSibling")},nextAll:function(a){return f.dir(a,"nextSibling")},prevAll:function(a){return f.dir(a,"previousSibling")},nextUntil:function(a,b,c){return f.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return f.dir(a,"previousSibling",c)},siblings:function(a){return f.sibling(a.parentNode.firstChild,a)},children:function(a){return f.sibling(a.firstChild)},contents:function(a){return f.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:f.makeArray(a.childNodes)}},function(a,b){f.fn[a]=function(c,d){var e=f.map(this,b,c);L.test(a)||(d=c),d&&typeof d=="string"&&(e=f.filter(d,e)),e=this.length>1&&!R[a]?f.unique(e):e,(this.length>1||N.test(d))&&M.test(a)&&(e=e.reverse());return this.pushStack(e,a,P.call(arguments).join(","))}}),f.extend({filter:function(a,b,c){c&&(a=":not("+a+")");return b.length===1?f.find.matchesSelector(b[0],a)?[b[0]]:[]:f.find.matches(a,b)},dir:function(a,c,d){var e=[],g=a[c];while(g&&g.nodeType!==9&&(d===b||g.nodeType!==1||!f(g).is(d)))g.nodeType===1&&e.push(g),g=g[c];return e},nth:function(a,b,c,d){b=b||1;var e=0;for(;a;a=a[c])if(a.nodeType===1&&++e===b)break;return a},sibling:function(a,b){var c=[];for(;a;a=a.nextSibling)a.nodeType===1&&a!==b&&c.push(a);return c}});var V="abbr|article|aside|audio|canvas|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",W=/ jQuery\d+="(?:\d+|null)"/g,X=/^\s+/,Y=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,Z=/<([\w:]+)/,$=/<(?:"+V+")","i"),bd=/checked\s*(?:[^=]|=\s*.checked.)/i,be=/\/(java|ecma)script/i,bf=/^\s*",""],legend:[1,"
","
"],thead:[1,"","
"],tr:[2,"","
"],td:[3,"","
"],col:[2,"","
"],area:[1,"",""],_default:[0,"",""]},bh=U(c);bg.optgroup=bg.option,bg.tbody=bg.tfoot=bg.colgroup=bg.caption=bg.thead,bg.th=bg.td,f.support.htmlSerialize||(bg._default=[1,"div
","
"]),f.fn.extend({text:function(a){if(f.isFunction(a))return this.each(function(b){var c=f(this);c.text(a.call(this,b,c.text()))});if(typeof a!="object"&&a!==b)return this.empty().append((this[0]&&this[0].ownerDocument||c).createTextNode(a));return f.text(this)},wrapAll:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapAll(a.call(this,b))});if(this[0]){var b=f(a,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstChild&&a.firstChild.nodeType===1)a=a.firstChild;return a}).append(this)}return this},wrapInner:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapInner(a.call(this,b))});return this.each(function(){var b=f(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){var b=f.isFunction(a);return this.each(function(c){f(this).wrapAll(b?a.call(this,c):a)})},unwrap:function(){return this.parent().each(function(){f.nodeName(this,"body")||f(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.appendChild(a)})},prepend:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this)});if(arguments.length){var a=f.clean(arguments);a.push.apply(a,this.toArray());return this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this.nextSibling)});if(arguments.length){var a=this.pushStack(this,"after",arguments);a.push.apply(a,f.clean(arguments));return a}},remove:function(a,b){for(var c=0,d;(d=this[c])!=null;c++)if(!a||f.filter(a,[d]).length)!b&&d.nodeType===1&&(f.cleanData(d.getElementsByTagName("*")),f.cleanData([d])),d.parentNode&&d.parentNode.removeChild(d);return this},empty:function() +{for(var a=0,b;(b=this[a])!=null;a++){b.nodeType===1&&f.cleanData(b.getElementsByTagName("*"));while(b.firstChild)b.removeChild(b.firstChild)}return this},clone:function(a,b){a=a==null?!1:a,b=b==null?a:b;return this.map(function(){return f.clone(this,a,b)})},html:function(a){if(a===b)return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(W,""):null;if(typeof a=="string"&&!ba.test(a)&&(f.support.leadingWhitespace||!X.test(a))&&!bg[(Z.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(Y,"<$1>");try{for(var c=0,d=this.length;c1&&l0?this.clone(!0):this).get();f(e[h])[b](j),d=d.concat(j)}return this.pushStack(d,a,e.selector)}}),f.extend({clone:function(a,b,c){var d,e,g,h=f.support.html5Clone||!bc.test("<"+a.nodeName)?a.cloneNode(!0):bo(a);if((!f.support.noCloneEvent||!f.support.noCloneChecked)&&(a.nodeType===1||a.nodeType===11)&&!f.isXMLDoc(a)){bk(a,h),d=bl(a),e=bl(h);for(g=0;d[g];++g)e[g]&&bk(d[g],e[g])}if(b){bj(a,h);if(c){d=bl(a),e=bl(h);for(g=0;d[g];++g)bj(d[g],e[g])}}d=e=null;return h},clean:function(a,b,d,e){var g;b=b||c,typeof b.createElement=="undefined"&&(b=b.ownerDocument||b[0]&&b[0].ownerDocument||c);var h=[],i;for(var j=0,k;(k=a[j])!=null;j++){typeof k=="number"&&(k+="");if(!k)continue;if(typeof k=="string")if(!_.test(k))k=b.createTextNode(k);else{k=k.replace(Y,"<$1>");var l=(Z.exec(k)||["",""])[1].toLowerCase(),m=bg[l]||bg._default,n=m[0],o=b.createElement("div");b===c?bh.appendChild(o):U(b).appendChild(o),o.innerHTML=m[1]+k+m[2];while(n--)o=o.lastChild;if(!f.support.tbody){var p=$.test(k),q=l==="table"&&!p?o.firstChild&&o.firstChild.childNodes:m[1]===""&&!p?o.childNodes:[];for(i=q.length-1;i>=0;--i)f.nodeName(q[i],"tbody")&&!q[i].childNodes.length&&q[i].parentNode.removeChild(q[i])}!f.support.leadingWhitespace&&X.test(k)&&o.insertBefore(b.createTextNode(X.exec(k)[0]),o.firstChild),k=o.childNodes}var r;if(!f.support.appendChecked)if(k[0]&&typeof (r=k.length)=="number")for(i=0;i=0)return b+"px"}}}),f.support.opacity||(f.cssHooks.opacity={get:function(a,b){return br.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?parseFloat(RegExp.$1)/100+"":b?"1":""},set:function(a,b){var c=a.style,d=a.currentStyle,e=f.isNumeric(b)?"alpha(opacity="+b*100+")":"",g=d&&d.filter||c.filter||"";c.zoom=1;if(b>=1&&f.trim(g.replace(bq,""))===""){c.removeAttribute("filter");if(d&&!d.filter)return}c.filter=bq.test(g)?g.replace(bq,e):g+" "+e}}),f(function(){f.support.reliableMarginRight||(f.cssHooks.marginRight={get:function(a,b){var c;f.swap(a,{display:"inline-block"},function(){b?c=bz(a,"margin-right","marginRight"):c=a.style.marginRight});return c}})}),c.defaultView&&c.defaultView.getComputedStyle&&(bA=function(a,b){var c,d,e;b=b.replace(bs,"-$1").toLowerCase(),(d=a.ownerDocument.defaultView)&&(e=d.getComputedStyle(a,null))&&(c=e.getPropertyValue(b),c===""&&!f.contains(a.ownerDocument.documentElement,a)&&(c=f.style(a,b)));return c}),c.documentElement.currentStyle&&(bB=function(a,b){var c,d,e,f=a.currentStyle&&a.currentStyle[b],g=a.style;f===null&&g&&(e=g[b])&&(f=e),!bt.test(f)&&bu.test(f)&&(c=g.left,d=a.runtimeStyle&&a.runtimeStyle.left,d&&(a.runtimeStyle.left=a.currentStyle.left),g.left=b==="fontSize"?"1em":f||0,f=g.pixelLeft+"px",g.left=c,d&&(a.runtimeStyle.left=d));return f===""?"auto":f}),bz=bA||bB,f.expr&&f.expr.filters&&(f.expr.filters.hidden=function(a){var b=a.offsetWidth,c=a.offsetHeight;return b===0&&c===0||!f.support.reliableHiddenOffsets&&(a.style&&a.style.display||f.css(a,"display"))==="none"},f.expr.filters.visible=function(a){return!f.expr.filters.hidden(a)});var bD=/%20/g,bE=/\[\]$/,bF=/\r?\n/g,bG=/#.*$/,bH=/^(.*?):[ \t]*([^\r\n]*)\r?$/mg,bI=/^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,bJ=/^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/,bK=/^(?:GET|HEAD)$/,bL=/^\/\//,bM=/\?/,bN=/<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,bO=/^(?:select|textarea)/i,bP=/\s+/,bQ=/([?&])_=[^&]*/,bR=/^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+))?)?/,bS=f.fn.load,bT={},bU={},bV,bW,bX=["*/"]+["*"];try{bV=e.href}catch(bY){bV=c.createElement("a"),bV.href="",bV=bV.href}bW=bR.exec(bV.toLowerCase())||[],f.fn.extend({load:function(a,c,d){if(typeof a!="string"&&bS)return bS.apply(this,arguments);if(!this.length)return this;var e=a.indexOf(" ");if(e>=0){var g=a.slice(e,a.length);a=a.slice(0,e)}var h="GET";c&&(f.isFunction(c)?(d=c,c=b):typeof c=="object"&&(c=f.param(c,f.ajaxSettings.traditional),h="POST"));var i=this;f.ajax({url:a,type:h,dataType:"html",data:c,complete:function(a,b,c){c=a.responseText,a.isResolved()&&(a.done(function(a){c=a}),i.html(g?f("
").append(c.replace(bN,"")).find(g):c)),d&&i.each(d,[c,b,a])}});return this},serialize:function(){return f.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?f.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||bO.test(this.nodeName)||bI.test(this.type))}).map(function(a,b){var c=f(this).val();return c==null?null:f.isArray(c)?f.map(c,function(a,c){return{name:b.name,value:a.replace(bF,"\r\n")}}):{name:b.name,value:c.replace(bF,"\r\n")}}).get()}}),f.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(a,b){f.fn[b]=function(a){return this.on(b,a)}}),f.each(["get","post"],function(a,c){f[c]=function(a,d,e,g){f.isFunction(d)&&(g=g||e,e=d,d=b);return f.ajax({type:c,url:a,data:d,success:e,dataType:g})}}),f.extend({getScript:function(a,c){return f.get(a,b,c,"script")},getJSON:function(a,b,c){return f.get(a,b,c,"json")},ajaxSetup:function(a,b){b?b_(a,f.ajaxSettings):(b=a,a=f.ajaxSettings),b_(a,b);return a},ajaxSettings:{url:bV,isLocal:bJ.test(bW[1]),global:!0,type:"GET",contentType:"application/x-www-form-urlencoded",processData:!0,async:!0,accepts:{xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":bX},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":a.String,"text html":!0,"text json":f.parseJSON,"text xml":f.parseXML},flatOptions:{context:!0,url:!0}},ajaxPrefilter:bZ(bT),ajaxTransport:bZ(bU),ajax:function(a,c){function w(a,c,l,m){if(s!==2){s=2,q&&clearTimeout(q),p=b,n=m||"",v.readyState=a>0?4:0;var o,r,u,w=c,x=l?cb(d,v,l):b,y,z;if(a>=200&&a<300||a===304){if(d.ifModified){if(y=v.getResponseHeader("Last-Modified"))f.lastModified[k]=y;if(z=v.getResponseHeader("Etag"))f.etag[k]=z}if(a===304)w="notmodified",o=!0;else try{r=cc(d,x),w="success",o=!0}catch(A){w="parsererror",u=A}}else{u=w;if(!w||a)w="error",a<0&&(a=0)}v.status=a,v.statusText=""+(c||w),o?h.resolveWith(e,[r,w,v]):h.rejectWith(e,[v,w,u]),v.statusCode(j),j=b,t&&g.trigger("ajax"+(o?"Success":"Error"),[v,d,o?r:u]),i.fireWith(e,[v,w]),t&&(g.trigger("ajaxComplete",[v,d]),--f.active||f.event.trigger("ajaxStop"))}}typeof a=="object"&&(c=a,a=b),c=c||{};var d=f.ajaxSetup({},c),e=d.context||d,g=e!==d&&(e.nodeType||e instanceof f)?f(e):f.event,h=f.Deferred(),i=f.Callbacks("once memory"),j=d.statusCode||{},k,l={},m={},n,o,p,q,r,s=0,t,u,v={readyState:0,setRequestHeader:function(a,b){if(!s){var c=a.toLowerCase();a=m[c]=m[c]||a,l[a]=b}return this},getAllResponseHeaders:function(){return s===2?n:null},getResponseHeader:function(a){var c;if(s===2){if(!o){o={};while(c=bH.exec(n))o[c[1].toLowerCase()]=c[2]}c=o[a.toLowerCase()]}return c===b?null:c},overrideMimeType:function(a){s||(d.mimeType=a);return this},abort:function(a){a=a||"abort",p&&p.abort(a),w(0,a);return this}};h.promise(v),v.success=v.done,v.error=v.fail,v.complete=i.add,v.statusCode=function(a){if(a){var b;if(s<2)for(b in a)j[b]=[j[b],a[b]];else b=a[v.status],v.then(b,b)}return this},d.url=((a||d.url)+"").replace(bG,"").replace(bL,bW[1]+"//"),d.dataTypes=f.trim(d.dataType||"*").toLowerCase().split(bP),d.crossDomain==null&&(r=bR.exec(d.url.toLowerCase()),d.crossDomain=!(!r||r[1]==bW[1]&&r[2]==bW[2]&&(r[3]||(r[1]==="http:"?80:443))==(bW[3]||(bW[1]==="http:"?80:443)))),d.data&&d.processData&&typeof d.data!="string"&&(d.data=f.param(d.data,d.traditional)),b$(bT,d,c,v);if(s===2)return!1;t=d.global,d.type=d.type.toUpperCase(),d.hasContent=!bK.test(d.type),t&&f.active++===0&&f.event.trigger("ajaxStart");if(!d.hasContent){d.data&&(d.url+=(bM.test(d.url)?"&":"?")+d.data,delete d.data),k=d.url;if(d.cache===!1){var x=f.now(),y=d.url.replace(bQ,"$1_="+x);d.url=y+(y===d.url?(bM.test(d.url)?"&":"?")+"_="+x:"")}}(d.data&&d.hasContent&&d.contentType!==!1||c.contentType)&&v.setRequestHeader("Content-Type",d.contentType),d.ifModified&&(k=k||d.url,f.lastModified[k]&&v.setRequestHeader("If-Modified-Since",f.lastModified[k]),f.etag[k]&&v.setRequestHeader("If-None-Match",f.etag[k])),v.setRequestHeader("Accept",d.dataTypes[0]&&d.accepts[d.dataTypes[0]]?d.accepts[d.dataTypes[0]]+(d.dataTypes[0]!=="*"?", "+bX+"; q=0.01":""):d.accepts["*"]);for(u in d.headers)v.setRequestHeader(u,d.headers[u]);if(d.beforeSend&&(d.beforeSend.call(e,v,d)===!1||s===2)){v.abort();return!1}for(u in{success:1,error:1,complete:1})v[u](d[u]);p=b$(bU,d,c,v);if(!p)w(-1,"No Transport");else{v.readyState=1,t&&g.trigger("ajaxSend",[v,d]),d.async&&d.timeout>0&&(q=setTimeout(function(){v.abort("timeout")},d.timeout));try{s=1,p.send(l,w)}catch(z){if(s<2)w(-1,z);else throw z}}return v},param:function(a,c){var d=[],e=function(a,b){b=f.isFunction(b)?b():b,d[d.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};c===b&&(c=f.ajaxSettings.traditional);if(f.isArray(a)||a.jquery&&!f.isPlainObject(a))f.each(a,function(){e(this.name,this.value)});else for(var g in a)ca(g,a[g],c,e);return d.join("&").replace(bD,"+")}}),f.extend({active:0,lastModified:{},etag:{}});var cd=f.now(),ce=/(\=)\?(&|$)|\?\?/i;f.ajaxSetup({jsonp:"callback",jsonpCallback:function(){return f.expando+"_"+cd++}}),f.ajaxPrefilter("json jsonp",function(b,c,d){var e=b.contentType==="application/x-www-form-urlencoded"&&typeof b.data=="string";if(b.dataTypes[0]==="jsonp"||b.jsonp!==!1&&(ce.test(b.url)||e&&ce.test(b.data))){var g,h=b.jsonpCallback=f.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,i=a[h],j=b.url,k=b.data,l="$1"+h+"$2";b.jsonp!==!1&&(j=j.replace(ce,l),b.url===j&&(e&&(k=k.replace(ce,l)),b.data===k&&(j+=(/\?/.test(j)?"&":"?")+b.jsonp+"="+h))),b.url=j,b.data=k,a[h]=function(a){g=[a]},d.always(function(){a[h]=i,g&&f.isFunction(i)&&a[h](g[0])}),b.converters["script json"]=function(){g||f.error(h+" was not called");return g[0]},b.dataTypes[0]="json";return"script"}}),f.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/javascript|ecmascript/},converters:{"text script":function(a){f.globalEval(a);return a}}}),f.ajaxPrefilter("script",function(a){a.cache===b&&(a.cache=!1),a.crossDomain&&(a.type="GET",a.global=!1)}),f.ajaxTransport("script",function(a){if(a.crossDomain){var d,e=c.head||c.getElementsByTagName("head")[0]||c.documentElement;return{send:function(f,g){d=c.createElement("script"),d.async="async",a.scriptCharset&&(d.charset=a.scriptCharset),d.src=a.url,d.onload=d.onreadystatechange=function(a,c){if(c||!d.readyState||/loaded|complete/.test(d.readyState))d.onload=d.onreadystatechange=null,e&&d.parentNode&&e.removeChild(d),d=b,c||g(200,"success")},e.insertBefore(d,e.firstChild)},abort:function(){d&&d.onload(0,1)}}}});var cf=a.ActiveXObject?function(){for(var a in ch)ch[a](0,1)}:!1,cg=0,ch;f.ajaxSettings.xhr=a.ActiveXObject?function(){return!this.isLocal&&ci()||cj()}:ci,function(a){f.extend(f.support,{ajax:!!a,cors:!!a&&"withCredentials"in a})}(f.ajaxSettings.xhr()),f.support.ajax&&f.ajaxTransport(function(c){if(!c.crossDomain||f.support.cors){var d;return{send:function(e,g){var h=c.xhr(),i,j;c.username?h.open(c.type,c.url,c.async,c.username,c.password):h.open(c.type,c.url,c.async);if(c.xhrFields)for(j in c.xhrFields)h[j]=c.xhrFields[j];c.mimeType&&h.overrideMimeType&&h.overrideMimeType(c.mimeType),!c.crossDomain&&!e["X-Requested-With"]&&(e["X-Requested-With"]="XMLHttpRequest");try{for(j in e)h.setRequestHeader(j,e[j])}catch(k){}h.send(c.hasContent&&c.data||null),d=function(a,e){var j,k,l,m,n;try{if(d&&(e||h.readyState===4)){d=b,i&&(h.onreadystatechange=f.noop,cf&&delete ch[i]);if(e)h.readyState!==4&&h.abort();else{j=h.status,l=h.getAllResponseHeaders(),m={},n=h.responseXML,n&&n.documentElement&&(m.xml=n),m.text=h.responseText;try{k=h.statusText}catch(o){k=""}!j&&c.isLocal&&!c.crossDomain?j=m.text?200:404:j===1223&&(j=204)}}}catch(p){e||g(-1,p)}m&&g(j,k,m,l)},!c.async||h.readyState===4?d():(i=++cg,cf&&(ch||(ch={},f(a).unload(cf)),ch[i]=d),h.onreadystatechange=d)},abort:function(){d&&d(0,1)}}}});var ck={},cl,cm,cn=/^(?:toggle|show|hide)$/,co=/^([+\-]=)?([\d+.\-]+)([a-z%]*)$/i,cp,cq=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]],cr;f.fn.extend({show:function(a,b,c){var d,e;if(a||a===0)return this.animate(cu("show",3),a,b,c);for(var g=0,h=this.length;g=i.duration+this.startTime){this.now=this.end,this.pos=this.state=1,this.update(),i.animatedProperties[this.prop]=!0;for(b in i.animatedProperties)i.animatedProperties[b]!==!0&&(g=!1);if(g){i.overflow!=null&&!f.support.shrinkWrapBlocks&&f.each(["","X","Y"],function(a,b){h.style["overflow"+b]=i.overflow[a]}),i.hide&&f(h).hide();if(i.hide||i.show)for(b in i.animatedProperties)f.style(h,b,i.orig[b]),f.removeData(h,"fxshow"+b,!0),f.removeData(h,"toggle"+b,!0);d=i.complete,d&&(i.complete=!1,d.call(h))}return!1}i.duration==Infinity?this.now=e:(c=e-this.startTime,this.state=c/i.duration,this.pos=f.easing[i.animatedProperties[this.prop]](this.state,c,0,1,i.duration),this.now=this.start+(this.end-this.start)*this.pos),this.update();return!0}},f.extend(f.fx,{tick:function(){var a,b=f.timers,c=0;for(;c-1,k={},l={},m,n;j?(l=e.position(),m=l.top,n=l.left):(m=parseFloat(h)||0,n=parseFloat(i)||0),f.isFunction(b)&&(b=b.call(a,c,g)),b.top!=null&&(k.top=b.top-g.top+m),b.left!=null&&(k.left=b.left-g.left+n),"using"in b?b.using.call(a,k):e.css(k)}},f.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),c=this.offset(),d=cx.test(b[0].nodeName)?{top:0,left:0}:b.offset();c.top-=parseFloat(f.css(a,"marginTop"))||0,c.left-=parseFloat(f.css(a,"marginLeft"))||0,d.top+=parseFloat(f.css(b[0],"borderTopWidth"))||0,d.left+=parseFloat(f.css(b[0],"borderLeftWidth"))||0;return{top:c.top-d.top,left:c.left-d.left}},offsetParent:function(){return this.map(function(){var a=this.offsetParent||c.body;while(a&&!cx.test(a.nodeName)&&f.css(a,"position")==="static")a=a.offsetParent;return a})}}),f.each(["Left","Top"],function(a,c){var d="scroll"+c;f.fn[d]=function(c){var e,g;if(c===b){e=this[0];if(!e)return null;g=cy(e);return g?"pageXOffset"in g?g[a?"pageYOffset":"pageXOffset"]:f.support.boxModel&&g.document.documentElement[d]||g.document.body[d]:e[d]}return this.each(function(){g=cy(this),g?g.scrollTo(a?f(g).scrollLeft():c,a?c:f(g).scrollTop()):this[d]=c})}}),f.each(["Height","Width"],function(a,c){var d=c.toLowerCase();f.fn["inner"+c]=function(){var a=this[0];return a?a.style?parseFloat(f.css(a,d,"padding")):this[d]():null},f.fn["outer"+c]=function(a){var b=this[0];return b?b.style?parseFloat(f.css(b,d,a?"margin":"border")):this[d]():null},f.fn[d]=function(a){var e=this[0];if(!e)return a==null?null:this;if(f.isFunction(a))return this.each(function(b){var c=f(this);c[d](a.call(this,b,c[d]()))});if(f.isWindow(e)){var g=e.document.documentElement["client"+c],h=e.document.body;return e.document.compatMode==="CSS1Compat"&&g||h&&h["client"+c]||g}if(e.nodeType===9)return Math.max(e.documentElement["client"+c],e.body["scroll"+c],e.documentElement["scroll"+c],e.body["offset"+c],e.documentElement["offset"+c]);if(a===b){var i=f.css(e,d),j=parseFloat(i);return f.isNumeric(j)?j:i}return this.css(d,typeof a=="string"?a:a+"px")}}),a.jQuery=a.$=f,typeof define=="function"&&define.amd&&define.amd.jQuery&&define("jquery",[],function(){return f})})(window); \ No newline at end of file diff --git a/demo/scripts/jquery.easing.1.3.js b/demo/scripts/jquery.easing.1.3.js new file mode 100755 index 0000000..d65948d --- /dev/null +++ b/demo/scripts/jquery.easing.1.3.js @@ -0,0 +1,205 @@ +/* + * jQuery Easing v1.3 - http://gsgd.co.uk/sandbox/jquery/easing/ + * + * Uses the built in easing capabilities added In jQuery 1.1 + * to offer multiple easing options + * + * TERMS OF USE - jQuery Easing + * + * Open source under the BSD License. + * + * Copyright © 2008 George McGinley Smith + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * Neither the name of the author nor the names of contributors may be used to endorse + * or promote products derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + * +*/ + +// t: current time, b: begInnIng value, c: change In value, d: duration +jQuery.easing['jswing'] = jQuery.easing['swing']; + +jQuery.extend( jQuery.easing, +{ + def: 'easeOutQuad', + swing: function (x, t, b, c, d) { + //alert(jQuery.easing.default); + return jQuery.easing[jQuery.easing.def](x, t, b, c, d); + }, + easeInQuad: function (x, t, b, c, d) { + return c*(t/=d)*t + b; + }, + easeOutQuad: function (x, t, b, c, d) { + return -c *(t/=d)*(t-2) + b; + }, + easeInOutQuad: function (x, t, b, c, d) { + if ((t/=d/2) < 1) return c/2*t*t + b; + return -c/2 * ((--t)*(t-2) - 1) + b; + }, + easeInCubic: function (x, t, b, c, d) { + return c*(t/=d)*t*t + b; + }, + easeOutCubic: function (x, t, b, c, d) { + return c*((t=t/d-1)*t*t + 1) + b; + }, + easeInOutCubic: function (x, t, b, c, d) { + if ((t/=d/2) < 1) return c/2*t*t*t + b; + return c/2*((t-=2)*t*t + 2) + b; + }, + easeInQuart: function (x, t, b, c, d) { + return c*(t/=d)*t*t*t + b; + }, + easeOutQuart: function (x, t, b, c, d) { + return -c * ((t=t/d-1)*t*t*t - 1) + b; + }, + easeInOutQuart: function (x, t, b, c, d) { + if ((t/=d/2) < 1) return c/2*t*t*t*t + b; + return -c/2 * ((t-=2)*t*t*t - 2) + b; + }, + easeInQuint: function (x, t, b, c, d) { + return c*(t/=d)*t*t*t*t + b; + }, + easeOutQuint: function (x, t, b, c, d) { + return c*((t=t/d-1)*t*t*t*t + 1) + b; + }, + easeInOutQuint: function (x, t, b, c, d) { + if ((t/=d/2) < 1) return c/2*t*t*t*t*t + b; + return c/2*((t-=2)*t*t*t*t + 2) + b; + }, + easeInSine: function (x, t, b, c, d) { + return -c * Math.cos(t/d * (Math.PI/2)) + c + b; + }, + easeOutSine: function (x, t, b, c, d) { + return c * Math.sin(t/d * (Math.PI/2)) + b; + }, + easeInOutSine: function (x, t, b, c, d) { + return -c/2 * (Math.cos(Math.PI*t/d) - 1) + b; + }, + easeInExpo: function (x, t, b, c, d) { + return (t==0) ? b : c * Math.pow(2, 10 * (t/d - 1)) + b; + }, + easeOutExpo: function (x, t, b, c, d) { + return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b; + }, + easeInOutExpo: function (x, t, b, c, d) { + if (t==0) return b; + if (t==d) return b+c; + if ((t/=d/2) < 1) return c/2 * Math.pow(2, 10 * (t - 1)) + b; + return c/2 * (-Math.pow(2, -10 * --t) + 2) + b; + }, + easeInCirc: function (x, t, b, c, d) { + return -c * (Math.sqrt(1 - (t/=d)*t) - 1) + b; + }, + easeOutCirc: function (x, t, b, c, d) { + return c * Math.sqrt(1 - (t=t/d-1)*t) + b; + }, + easeInOutCirc: function (x, t, b, c, d) { + if ((t/=d/2) < 1) return -c/2 * (Math.sqrt(1 - t*t) - 1) + b; + return c/2 * (Math.sqrt(1 - (t-=2)*t) + 1) + b; + }, + easeInElastic: function (x, t, b, c, d) { + var s=1.70158;var p=0;var a=c; + if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3; + if (a < Math.abs(c)) { a=c; var s=p/4; } + else var s = p/(2*Math.PI) * Math.asin (c/a); + return -(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b; + }, + easeOutElastic: function (x, t, b, c, d) { + var s=1.70158;var p=0;var a=c; + if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3; + if (a < Math.abs(c)) { a=c; var s=p/4; } + else var s = p/(2*Math.PI) * Math.asin (c/a); + return a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b; + }, + easeInOutElastic: function (x, t, b, c, d) { + var s=1.70158;var p=0;var a=c; + if (t==0) return b; if ((t/=d/2)==2) return b+c; if (!p) p=d*(.3*1.5); + if (a < Math.abs(c)) { a=c; var s=p/4; } + else var s = p/(2*Math.PI) * Math.asin (c/a); + if (t < 1) return -.5*(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b; + return a*Math.pow(2,-10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )*.5 + c + b; + }, + easeInBack: function (x, t, b, c, d, s) { + if (s == undefined) s = 1.70158; + return c*(t/=d)*t*((s+1)*t - s) + b; + }, + easeOutBack: function (x, t, b, c, d, s) { + if (s == undefined) s = 1.70158; + return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b; + }, + easeInOutBack: function (x, t, b, c, d, s) { + if (s == undefined) s = 1.70158; + if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b; + return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b; + }, + easeInBounce: function (x, t, b, c, d) { + return c - jQuery.easing.easeOutBounce (x, d-t, 0, c, d) + b; + }, + easeOutBounce: function (x, t, b, c, d) { + if ((t/=d) < (1/2.75)) { + return c*(7.5625*t*t) + b; + } else if (t < (2/2.75)) { + return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b; + } else if (t < (2.5/2.75)) { + return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b; + } else { + return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b; + } + }, + easeInOutBounce: function (x, t, b, c, d) { + if (t < d/2) return jQuery.easing.easeInBounce (x, t*2, 0, c, d) * .5 + b; + return jQuery.easing.easeOutBounce (x, t*2-d, 0, c, d) * .5 + c*.5 + b; + } +}); + +/* + * + * TERMS OF USE - EASING EQUATIONS + * + * Open source under the BSD License. + * + * Copyright © 2001 Robert Penner + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * Neither the name of the author nor the names of contributors may be used to endorse + * or promote products derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ \ No newline at end of file diff --git a/demo/scripts/prism.js b/demo/scripts/prism.js new file mode 100644 index 0000000..253198b --- /dev/null +++ b/demo/scripts/prism.js @@ -0,0 +1,501 @@ +/** + * Prism: Lightweight, robust, elegant syntax highlighting + * MIT license http://www.opensource.org/licenses/mit-license.php/ + * @author Lea Verou http://lea.verou.me + */ + +(function(){ + +// Private helper vars +var lang = /\blang(?:uage)?-(?!\*)(\w+)\b/i; + +var _ = self.Prism = { + languages: { + insertBefore: function (inside, before, insert, root) { + root = root || _.languages; + var grammar = root[inside]; + var ret = {}; + + for (var token in grammar) { + + if (grammar.hasOwnProperty(token)) { + + if (token == before) { + + for (var newToken in insert) { + + if (insert.hasOwnProperty(newToken)) { + ret[newToken] = insert[newToken]; + } + } + } + + ret[token] = grammar[token]; + } + } + + return root[inside] = ret; + }, + + DFS: function(o, callback) { + for (var i in o) { + callback.call(o, i, o[i]); + + if (Object.prototype.toString.call(o) === '[object Object]') { + _.languages.DFS(o[i], callback); + } + } + } + }, + + highlightAll: function(async, callback) { + var elements = document.querySelectorAll('code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code'); + + for (var i=0, element; element = elements[i++];) { + _.highlightElement(element, async === true, callback); + } + }, + + highlightElement: function(element, async, callback) { + // Find language + var language, grammar, parent = element; + + while (parent && !lang.test(parent.className)) { + parent = parent.parentNode; + } + + if (parent) { + language = (parent.className.match(lang) || [,''])[1]; + grammar = _.languages[language]; + } + + if (!grammar) { + return; + } + + // Set language on the element, if not present + element.className = element.className.replace(lang, '').replace(/\s+/g, ' ') + ' language-' + language; + + // Set language on the parent, for styling + parent = element.parentNode; + + if (/pre/i.test(parent.nodeName)) { + parent.className = parent.className.replace(lang, '').replace(/\s+/g, ' ') + ' language-' + language; + } + + var code = element.textContent.trim(); + + if(!code) { + return; + } + + code = code.replace(/&/g, '&').replace(//g, '>').replace(/\u00a0/g, ' '); + //console.time(code.slice(0,50)); + + var env = { + element: element, + language: language, + grammar: grammar, + code: code + }; + + _.hooks.run('before-highlight', env); + + if (async && self.Worker) { + var worker = new Worker(_.filename); + + worker.onmessage = function(evt) { + env.highlightedCode = Token.stringify(JSON.parse(evt.data)); + env.element.innerHTML = env.highlightedCode; + + callback && callback.call(env.element); + //console.timeEnd(code.slice(0,50)); + _.hooks.run('after-highlight', env); + }; + + worker.postMessage(JSON.stringify({ + language: env.language, + code: env.code + })); + } + else { + env.highlightedCode = _.highlight(env.code, env.grammar) + env.element.innerHTML = env.highlightedCode; + + callback && callback.call(element); + + _.hooks.run('after-highlight', env); + //console.timeEnd(code.slice(0,50)); + } + }, + + highlight: function (text, grammar) { + return Token.stringify(_.tokenize(text, grammar)); + }, + + tokenize: function(text, grammar) { + var Token = _.Token; + + var strarr = [text]; + + var rest = grammar.rest; + + if (rest) { + for (var token in rest) { + grammar[token] = rest[token]; + } + + delete grammar.rest; + } + + tokenloop: for (var token in grammar) { + if(!grammar.hasOwnProperty(token) || !grammar[token]) { + continue; + } + + var pattern = grammar[token], + inside = pattern.inside, + lookbehind = !!pattern.lookbehind || 0; + + pattern = pattern.pattern || pattern; + + for (var i=0; i text.length) { + // Something went terribly wrong, ABORT, ABORT! + break tokenloop; + } + + if (str instanceof Token) { + continue; + } + + pattern.lastIndex = 0; + + var match = pattern.exec(str); + + if (match) { + if(lookbehind) { + lookbehind = match[1].length; + } + + var from = match.index - 1 + lookbehind, + match = match[0].slice(lookbehind), + len = match.length, + to = from + len, + before = str.slice(0, from + 1), + after = str.slice(to + 1); + + var args = [i, 1]; + + if (before) { + args.push(before); + } + + var wrapped = new Token(token, inside? _.tokenize(match, inside) : match); + + args.push(wrapped); + + if (after) { + args.push(after); + } + + Array.prototype.splice.apply(strarr, args); + } + } + } + + return strarr; + }, + + hooks: { + all: {}, + + add: function (name, callback) { + var hooks = _.hooks.all; + + hooks[name] = hooks[name] || []; + + hooks[name].push(callback); + }, + + run: function (name, env) { + var callbacks = _.hooks.all[name]; + + if (!callbacks || !callbacks.length) { + return; + } + + for (var i=0, callback; callback = callbacks[i++];) { + callback(env); + } + } + } +}; + +var Token = _.Token = function(type, content) { + this.type = type; + this.content = content; +}; + +Token.stringify = function(o) { + if (typeof o == 'string') { + return o; + } + + if (Object.prototype.toString.call(o) == '[object Array]') { + for (var i=0; i<' + env.tag + ' class="' + env.classes.join(' ') + '" ' + attributes + '>' + env.content + ''; + +}; + +if (!self.document) { + // In worker + self.addEventListener('message', function(evt) { + var message = JSON.parse(evt.data), + lang = message.language, + code = message.code; + + self.postMessage(JSON.stringify(_.tokenize(code, _.languages[lang]))); + self.close(); + }, false); + + return; +} + +// Get current script and highlight +var script = document.getElementsByTagName('script'); + +script = script[script.length - 1]; + +if (script) { + _.filename = script.src; + + if (document.addEventListener && !script.hasAttribute('data-manual')) { + document.addEventListener('DOMContentLoaded', _.highlightAll); + } +} + +})(); +Prism.languages.markup = { + 'comment': /<!--[\w\W]*?--(>|>)/g, + 'prolog': /<\?.+?\?>/, + 'doctype': /<!DOCTYPE.+?>/, + 'cdata': /<!\[CDATA\[[\w\W]+?]]>/i, + 'tag': { + pattern: /<\/?[\w:-]+\s*[\w\W]*?>/gi, + inside: { + 'tag': { + pattern: /^<\/?[\w:-]+/i, + inside: { + 'punctuation': /^<\/?/, + 'namespace': /^[\w-]+?:/ + } + }, + 'attr-value': { + pattern: /=(('|")[\w\W]*?(\2)|[^\s>]+)/gi, + inside: { + 'punctuation': /=/g + } + }, + 'punctuation': /\/?>/g, + 'attr-name': { + pattern: /[\w:-]+/g, + inside: { + 'namespace': /^[\w-]+?:/ + } + } + + } + }, + 'entity': /&#?[\da-z]{1,8};/gi +}; + +// Plugin to make entity title show the real entity, idea by Roman Komarov +Prism.hooks.add('wrap', function(env) { + + if (env.type === 'entity') { + env.attributes['title'] = env.content.replace(/&/, '&'); + } +}); +Prism.languages.css = { + 'comment': /\/\*[\w\W]*?\*\//g, + 'atrule': /@[\w-]+?(\s+[^;{]+)?(?=\s*{|\s*;)/gi, + 'url': /url\((["']?).*?\1\)/gi, + 'selector': /[^\{\}\s][^\{\}]*(?=\s*\{)/g, + 'property': /(\b|\B)[a-z-]+(?=\s*:)/ig, + 'string': /("|')(\\?.)*?\1/g, + 'important': /\B!important\b/gi, + 'ignore': /&(lt|gt|amp);/gi, + 'punctuation': /[\{\};:]/g +}; + +if (Prism.languages.markup) { + Prism.languages.insertBefore('markup', 'tag', { + 'style': { + pattern: /(<|<)style[\w\W]*?(>|>)[\w\W]*?(<|<)\/style(>|>)/ig, + inside: { + 'tag': { + pattern: /(<|<)style[\w\W]*?(>|>)|(<|<)\/style(>|>)/ig, + inside: Prism.languages.markup.tag.inside + }, + rest: Prism.languages.css + } + } + }); +} +Prism.languages.javascript = { + 'comment': { + pattern: /(^|[^\\])(\/\*[\w\W]*?\*\/|\/\/.*?(\r?\n|$))/g, + lookbehind: true + }, + 'string': /("|')(\\?.)*?\1/g, + 'regex': { + pattern: /(^|[^/])\/(?!\/)(\[.+?]|\\.|[^/\r\n])+\/[gim]{0,3}(?=\s*($|[\r\n,.;})]))/g, + lookbehind: true + }, + 'keyword': /\b(var|let|if|else|while|do|for|return|in|instanceof|function|new|with|typeof|try|catch|finally|null|break|continue)\b/g, + 'boolean': /\b(true|false)\b/g, + 'number': /\b-?(0x)?\d*\.?\d+\b/g, + 'operator': /[-+]{1,2}|!|=?<|=?>|={1,2}|(&){1,2}|\|?\||\?|\*|\//g, + 'ignore': /&(lt|gt|amp);/gi, + 'punctuation': /[{}[\];(),.:]/g +}; + +if (Prism.languages.markup) { + Prism.languages.insertBefore('markup', 'tag', { + 'script': { + pattern: /(<|<)script[\w\W]*?(>|>)[\w\W]*?(<|<)\/script(>|>)/ig, + inside: { + 'tag': { + pattern: /(<|<)script[\w\W]*?(>|>)|(<|<)\/script(>|>)/ig, + inside: Prism.languages.markup.tag.inside + }, + rest: Prism.languages.javascript + } + } + }); +} +(function(){ + +if(!window.Prism) { + return; +} + +function $$(expr, con) { + return Array.prototype.slice.call((con || document).querySelectorAll(expr)); +} + +var CRLF = crlf = /\r?\n|\r/g; + +function highlightLines(pre, lines, classes) { + var ranges = lines.replace(/\s+/g, '').split(','), + offset = +pre.getAttribute('data-line-offset') || 0; + + var lineHeight = parseFloat(getComputedStyle(pre).lineHeight); + + for (var i=0, range; range = ranges[i++];) { + range = range.split('-'); + + var start = +range[0], + end = +range[1] || start; + + var line = document.createElement('div'); + + line.textContent = Array(end - start + 2).join(' \r\n'); + line.className = (classes || '') + ' line-highlight'; + line.setAttribute('data-start', start); + + if(end > start) { + line.setAttribute('data-end', end); + } + + line.style.top = (start - offset - 1) * lineHeight + 'px'; + + (pre.querySelector('code') || pre).appendChild(line); + } +} + +function applyHash() { + var hash = location.hash.slice(1); + + // Remove pre-existing temporary lines + $$('.temporary.line-highlight').forEach(function (line) { + line.parentNode.removeChild(line); + }); + + var range = (hash.match(/\.([\d,-]+)$/) || [,''])[1]; + + if (!range || document.getElementById(hash)) { + return; + } + + var id = hash.slice(0, hash.lastIndexOf('.')), + pre = document.getElementById(id); + + if (!pre) { + return; + } + + if (!pre.hasAttribute('data-line')) { + pre.setAttribute('data-line', ''); + } + + highlightLines(pre, range, 'temporary '); + + document.querySelector('.temporary.line-highlight').scrollIntoView(); +} + +var fakeTimer = 0; // Hack to limit the number of times applyHash() runs + +Prism.hooks.add('after-highlight', function(env) { + var pre = env.element.parentNode; + var lines = pre && pre.getAttribute('data-line'); + + if (!pre || !lines || !/pre/i.test(pre.nodeName)) { + return; + } + + clearTimeout(fakeTimer); + + $$('.line-highlight', pre).forEach(function (line) { + line.parentNode.removeChild(line); + }); + + highlightLines(pre, lines); + + fakeTimer = setTimeout(applyHash, 1); +}); + +addEventListener('hashchange', applyHash); + +})(); From 1b2e31e29f1efed25dcf45992944266d26c1afc9 Mon Sep 17 00:00:00 2001 From: Remy Bach Date: Wed, 7 Nov 2012 21:57:47 +0000 Subject: [PATCH 41/56] Make the defaults/options specific to each superLabels instance. --- jquery.superLabels.js | 77 ++++++++++++++++++++++++--------------- jquery.superLabels.min.js | 4 +- 2 files changed, 50 insertions(+), 31 deletions(-) diff --git a/jquery.superLabels.js b/jquery.superLabels.js index afb0613..dd5da70 100644 --- a/jquery.superLabels.js +++ b/jquery.superLabels.js @@ -1,7 +1,7 @@ /* * Title: jQuery Super Labels Plugin - Give your forms a helping of awesome! * Author: Rémy Bach - * Version: 1.2.1 + * Version: 1.2.2 * License: http://remybach.mit-license.org * Url: http://github.com/remybach/jQuery.superLabels * Description: @@ -27,7 +27,8 @@ acceptedElements = ['input', 'textarea', 'select']; $.fn.superLabels = function(options) { - var _fields = []; + var _fields = [], + _newDefaults; // If this has been run on an empty set of elements, pop out. if (this.length === 0) { return false; } @@ -40,9 +41,15 @@ options.labelTop = Number(options.labelTop.replace(/\D+/, '')); } + // Make a copy of the defaults. + _newDefaults = $.extend({}, defaults); // If options were passed in, merge them with the defaults. - $.extend(defaults, options || {}); - + // Store them on each element so that they don't get overwritten by subsequent calls + // to superLabels. + $(this).data('slDefaults', $.extend(_newDefaults, options || {})).addClass('sl-defaults'); + + if (!$.easing.def) { _info('Easing plugin not found - using standard jQuery animations.'); } + // Check for whether the user has just passed in the form. If so, we need to fetch all the accepted fields. if (this.length === 1 && /form/i.test(this[0].tagName)) { _fields = $(acceptedElements.join(','), this); @@ -68,6 +75,7 @@ // Don't even bother going further if this isn't one of the accepted input field types or elements. if ((_field[0].tagName.toLowerCase() === 'input' && $.inArray(_field.attr('type'), acceptedInputTypes)) === -1 && $.inArray(_field[0].tagName.toLowerCase(), acceptedElements) !== -1) { + _info('Doh! The following '+this.tagName.toLowerCase()+', is not supported.', this); return true; // Equivalent to continue in a normal for loop. } @@ -94,6 +102,7 @@ // Make sure this form field has a label if (_label.length === 0) { + _info('Doh! The following '+this.tagName.toLowerCase()+' has no related label.', this); return true; } @@ -121,12 +130,13 @@ /*========== Private Functions ==========*/ // Get the label for a given field. _getLabel = function(_field) { - var _label = $(_field).siblings('label'); + var _defaults = $(_field).closest('.sl-defaults').data('slDefaults'), + _label = $(_field).siblings('label'); if (_label.length === 0) { // If a selector is present for the wrapping element, use that, otherwise, proceed to use more traditional methods. - if (defaults.wrapSelector) { - _label = $(_field).parents(defaults.wrapSelector).find('label'); + if (_defaults.wrapSelector) { + _label = $(_field).parents(_defaults.wrapSelector).find('label'); } else { _for = _field.id || _field.name; _label = $('[for="'+_for+'"]'); @@ -140,6 +150,7 @@ _prepLabel = function(_field, _label) { var _charLimit, _charLimitAttr = _field.data('slCharLimit'), + _defaults = $(_field).closest('.sl-defaults').data('slDefaults'), _opacity = 0, _selected; @@ -156,7 +167,7 @@ } else { // If we need to figure out the length automatically (and this field isn't specifically excluded), // or if this field is specifically requesting this functionality. - if (_charLimitAttr === 'auto' || (defaults.autoCharLimit && isNaN(_charLimitAttr))) { + if (_charLimitAttr === 'auto' || (_defaults.autoCharLimit && isNaN(_charLimitAttr))) { _approximateChars(_field, _label); } @@ -165,74 +176,77 @@ _opacity = 1; // Otherwise, if the field is not empty, but below the character limit (if any), use the passed in option. } else if (_withinCharLimit(_field)) { - _opacity = defaults._opacity; + _opacity = _defaults._opacity; } - _field.css({ zIndex:defaults.baseZindex+1 }).addClass('sl_field'); + _field.css({ zIndex:_defaults.baseZindex+1 }).addClass('sl_field'); _label.css({ - left:_noVal(_field) ? defaults.labelLeft : $(_field).width()-_label.width(), + left:_noVal(_field) ? _defaults.labelLeft : $(_field).width()-_label.width(), opacity:_opacity, position:'absolute', - top:defaults.labelTop, - zIndex:defaults.baseZindex+2 + top:_defaults.labelTop, + zIndex:_defaults.baseZindex+2 }).addClass('sl_label'); } }; // The event handlers for the form fields. _focus = function() { - var _duration = defaults.duration, + var _defaults = $(this).closest('.sl-defaults').data('slDefaults'), + _duration = _defaults.duration, _label, _to = { opacity:0 }; if (_noVal(this)) { _label = _getLabel(this); - if (defaults.noAnimate) { + if (_defaults.noAnimate) { _label.hide(); return false; } - if (defaults.slide) { + if (_defaults.slide) { _to.left = $(this).width()-_label.width(); - _to.opacity = defaults.opacity; + _to.opacity = _defaults.opacity; } else { - _duration = defaults.fadeDuration; + _duration = _defaults.fadeDuration; } - _label.stop(true,false).animate(_to, _duration, defaults.easingOut); + _label.stop(true,false).animate(_to, _duration, _defaults.easingOut); } }; _blur = function() { - var _duration = defaults.duration, + var _defaults = $(this).closest('.sl-defaults').data('slDefaults'), + _duration = _defaults.duration, _label, _to ={ opacity:1 }; if (_noVal(this)) { _label = _getLabel(this); - if (defaults.noAnimate) { + if (_defaults.noAnimate) { _label.show(); return false; } - if (defaults.slide) { - _to.left = defaults.labelLeft; + if (_defaults.slide) { + _to.left = _defaults.labelLeft; } else { - _duration = defaults.fadeDuration; + _duration = _defaults.fadeDuration; } - _label.stop(true,false).animate(_to, _duration, defaults.easingOut); + _label.stop(true,false).animate(_to, _duration, _defaults.easingOut); } else { // If there is a value, and the label is visible, fire our _keyup function so as to hide it. (this semi-fixes the autofill bug) _keyup.apply(this); } }; _keyup = function() { - var _label, + var _defaults = $(this).closest('.sl-defaults').data('slDefaults'), + _label, _o = 0; - if (defaults.noAnimate) { + if (_defaults.noAnimate) { return false; // We don't need any keyup checking done if we're not animating (the label would be in the way while trying to type). } @@ -245,10 +259,10 @@ // If the field is empty and the label isn't showing, make it show up again. if ((_noVal(this) && _label.css('opacity') !== 0) || _withinCharLimit(this)) { - _o = defaults.opacity; + _o = _defaults.opacity; } - _label.stop(true,false).animate({ opacity:_o }, defaults.fadeDuration, defaults.easingOut); + _label.stop(true,false).animate({ opacity:_o }, _defaults.fadeDuration, _defaults.easingOut); }; /*===== Utility Functions =====*/ @@ -303,4 +317,9 @@ // Set the data-sl-char-limit attribute for this field to our approximated value. _field.data('slCharLimit', Math.floor(_available / _charLen)); }; + + // Console Functions (We need these to make sure this only displays when the console exists.) + _log = function() { if (defaults.debug && console && console.log) console.log.apply(console, arguments); }; + _info = function() { if (defaults.debug && console && console.info) console.info.apply(console, arguments); }; + _error = function() { if (defaults.debug && console && console.error) console.error.apply(console, arguments); }; })(jQuery); \ No newline at end of file diff --git a/jquery.superLabels.min.js b/jquery.superLabels.min.js index a15b3ff..f52b44a 100644 --- a/jquery.superLabels.min.js +++ b/jquery.superLabels.min.js @@ -1,10 +1,10 @@ /* * Title: jQuery Super Labels Plugin - Give your forms a helping of awesome! * Author: Rémy Bach - * Version: 1.1.3 + * Version: 1.2.2 * License: http://remybach.mit-license.org * Url: http://github.com/remybach/jQuery.superLabels * Description: * This plugin allows you to display your form labels on top of your form fields, saving you space on your page. */ -(function(e){var t={autoCharLimit:false,baseZindex:0,debug:false,duration:500,easingIn:e.easing.def?"easeInOutCubic":false,easingOut:e.easing.def?"easeInOutCubic":false,fadeDuration:250,labelLeft:0,labelTop:0,noAnimate:false,opacity:.5,slide:true,wrapSelector:false};var n=["text","search","url","tel","email","password","number"];var r=["input","textarea","select"];e.fn.superLabels=function(i){var s=[];if(this.length===0)return false;if(i&&i.labelLeft&&isNaN(i.labelLeft))i.labelLeft=Number(i.labelLeft.replace(/\D+/,""));if(i&&i.labelTop&&isNaN(i.labelTop))i.labelTop=Number(i.labelTop.replace(/\D+/,""));e.extend(t,i||{});if(this.length===1&&/form/i.test(this[0].tagName)){s=e(r.join(","),this)}else if(this.length>1){this.each(function(){if(/form/i.test(this.tagName)){e.merge(s,e(r.join(","),this))}else{s.push(this)}})}else{s=this}return e(s).each(function(){var t=e(this);if((t[0].tagName.toLowerCase()==="input"&&e.inArray(t.attr("type"),n))===-1&&e.inArray(t[0].tagName.toLowerCase(),r)!==-1){return true}var i=_getLabel(this);var s=t.attr("placeholder");if(s){if(i.length===0){var o='";o+="";o=e(o);i=o;t.before(i)}else{i.attr("title",s)}t.removeAttr("placeholder")}if(i.length===0){return true}_prepLabel(t,i);if(!this.tagName.match(/select/i)){t.focus(_focus);t.blur(_blur);t.change(_blur);t.bind("input",_keyup);t.bind("propertychange",_blur);t.keyup(_keyup);i.click(function(){t.focus()})}})};_getLabel=function(n){var r=e(n).siblings("label");if(r.length===0){if(t.wrapSelector){r=e(n).parents(t.wrapSelector).find("label")}else{_for=n.id||n.name;r=e('[for="'+_for+'"]')}}return r};_prepLabel=function(n,r){var i,s=n.data("slCharLimit"),o=0;if(n[0].tagName.match(/select/i)){var u=n.find("[selected]").length===0?" selected":"";n.prepend('");r.css("display","none")}else{if(s==="auto"||t.autoCharLimit&&isNaN(s)){_approximateChars(n,r)}if(_noVal(n)){o=1}else if(_withinCharLimit(n)){o=t._opacity}n.css({zIndex:t.baseZindex+1}).addClass("sl_field");r.css({left:_noVal(n)?t.labelLeft:e(n).width()-r.width(),opacity:o,position:"absolute",top:t.labelTop,zIndex:t.baseZindex+2}).addClass("sl_label")}};_focus=function(){if(_noVal(this)){var n=t.duration;var r=_getLabel(this);var i={opacity:0};if(t.noAnimate){r.hide();return false}if(t.slide){i.left=e(this).width()-r.width();i.opacity=t.opacity}else{n=t.fadeDuration}r.stop(true,false).animate(i,n,t.easingOut)}};_blur=function(){if(_noVal(this)){var e=t.duration;var n=_getLabel(this);var r={opacity:1};if(t.noAnimate){n.show();return false}if(t.slide){r.left=t.labelLeft}else{e=t.fadeDuration}n.stop(true,false).animate(r,e,t.easingOut)}else{_keyup.apply(this)}};_keyup=function(){if(t.noAnimate)return false;var e=_getLabel(this);var n=0;if(_noVal(this)&&e.css("opacity")>0||!_noVal(this)&&e.css("opacity")===0){return false}if(_noVal(this)&&e.css("opacity")!==0||_withinCharLimit(this)){n=t.opacity}e.stop(true,false).animate({opacity:n},t.fadeDuration,t.easingOut)};_noVal=function(t){return e(t).val()===""};_withinCharLimit=function(t){var n=e(t).data("slCharLimit");if(!n||typeof n!=="number"){return false}t=t.length?t[0]:t;return n&&t.value&&t.value.length<=n};_approximateChars=function(t,n){var r,i,s="1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";_properties=["font-family","font-size","font-weight","letter-spacing","line-height","text-shadow","text-transform"],_tmp=e("
"+s+"
");e.each(_properties,function(e,n){_tmp.css(n,t.css(n))});_tmp.css({position:"absolute",visibility:"hidden"});e("body").append(_tmp);i=Math.round(_tmp.width()/s.length);_tmp.remove();r=t.width()-n.width();t.data("slCharLimit",Math.floor(r/i))}})(jQuery) \ No newline at end of file +(function(e){var t={autoCharLimit:false,baseZindex:0,duration:500,easingIn:e.easing&&e.easing.def?"easeInOutCubic":false,easingOut:e.easing&&e.easing.def?"easeInOutCubic":false,fadeDuration:250,labelLeft:0,labelTop:0,noAnimate:false,opacity:.5,slide:true,wrapSelector:false},n=["text","search","url","tel","email","password","number"],r=["input","textarea","select"];e.fn.superLabels=function(i){var s=[],o;if(this.length===0){return false}if(i&&i.labelLeft&&isNaN(i.labelLeft)){i.labelLeft=Number(i.labelLeft.replace(/\D+/,""))}if(i&&i.labelTop&&isNaN(i.labelTop)){i.labelTop=Number(i.labelTop.replace(/\D+/,""))}o=e.extend({},t);e(this).data("slDefaults",e.extend(o,i||{})).addClass("sl-defaults");if(this.length===1&&/form/i.test(this[0].tagName)){s=e(r.join(","),this)}else if(this.length>1){this.each(function(){if(/form/i.test(this.tagName)){e.merge(s,e(r.join(","),this))}else{s.push(this)}})}else{s=this}return e(s).each(function(){var t=e(this),i,s=t.attr("placeholder"),o;if((t[0].tagName.toLowerCase()==="input"&&e.inArray(t.attr("type"),n))===-1&&e.inArray(t[0].tagName.toLowerCase(),r)!==-1){return true}i=_getLabel(this);if(s){if(i.length===0){o='";o+="";o=e(o);i=o;t.before(i)}else{i.attr("title",s)}t.removeAttr("placeholder")}if(i.length===0){return true}_prepLabel(t,i);if(!this.tagName.match(/select/i)){t.focus(_focus);t.blur(_blur);t.change(_blur);t.bind("input",_keyup);t.bind("propertychange",_blur);t.keyup(_keyup);i.click(function(){t.focus()})}})};_getLabel=function(t){var n=e(t).closest(".sl-defaults").data("slDefaults"),r=e(t).siblings("label");if(r.length===0){if(n.wrapSelector){r=e(t).parents(n.wrapSelector).find("label")}else{_for=t.id||t.name;r=e('[for="'+_for+'"]')}}return r};_prepLabel=function(t,n){var r,i=t.data("slCharLimit"),s=e(t).closest(".sl-defaults").data("slDefaults"),o=0,u;if(t[0].tagName.match(/select/i)){u=t.find("[selected]").length===0?" selected":"";t.prepend('");n.css("display","none")}else{if(i==="auto"||s.autoCharLimit&&isNaN(i)){_approximateChars(t,n)}if(_noVal(t)){o=1}else if(_withinCharLimit(t)){o=s._opacity}t.css({zIndex:s.baseZindex+1}).addClass("sl_field");n.css({left:_noVal(t)?s.labelLeft:e(t).width()-n.width(),opacity:o,position:"absolute",top:s.labelTop,zIndex:s.baseZindex+2}).addClass("sl_label")}};_focus=function(){var t=e(this).closest(".sl-defaults").data("slDefaults"),n=t.duration,r,i={opacity:0};if(_noVal(this)){r=_getLabel(this);if(t.noAnimate){r.hide();return false}if(t.slide){i.left=e(this).width()-r.width();i.opacity=t.opacity}else{n=t.fadeDuration}r.stop(true,false).animate(i,n,t.easingOut)}};_blur=function(){var t=e(this).closest(".sl-defaults").data("slDefaults"),n=t.duration,r,i={opacity:1};if(_noVal(this)){r=_getLabel(this);if(t.noAnimate){r.show();return false}if(t.slide){i.left=t.labelLeft}else{n=t.fadeDuration}r.stop(true,false).animate(i,n,t.easingOut)}else{_keyup.apply(this)}};_keyup=function(){var t=e(this).closest(".sl-defaults").data("slDefaults"),n,r=0;if(t.noAnimate){return false}n=_getLabel(this);if(_noVal(this)&&n.css("opacity")>0||!_noVal(this)&&n.css("opacity")===0){return false}if(_noVal(this)&&n.css("opacity")!==0||_withinCharLimit(this)){r=t.opacity}n.stop(true,false).animate({opacity:r},t.fadeDuration,t.easingOut)};_noVal=function(t){return e(t).val()===""};_withinCharLimit=function(t){var n=e(t).data("slCharLimit");if(!n||typeof n!=="number"){return false}t=t.length?t[0]:t;return n&&t.value&&t.value.length<=n};_approximateChars=function(t,n){var r,i,s="1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";_properties=["font-family","font-size","font-weight","letter-spacing","line-height","text-shadow","text-transform"],_tmp=e("
"+s+"
");e.each(_properties,function(e,n){_tmp.css(n,t.css(n))});_tmp.css({position:"absolute",visibility:"hidden"});t.parent().append(_tmp);i=Math.round(_tmp.width()/s.length);_tmp.remove();r=t.width()-n.width();t.data("slCharLimit",Math.floor(r/i))}})(jQuery) \ No newline at end of file From e56404d12ac4d5d628603731f13961e869cdb77d Mon Sep 17 00:00:00 2001 From: Remy Bach Date: Thu, 8 Nov 2012 01:45:07 +0000 Subject: [PATCH 42/56] A more comprehensive and functional demo. --- README.md | 2 +- demo/css/prism.css | 18 +++ demo/css/style.css | 58 ++++++++++ demo/index.html | 262 +++++++++++++++++++++++++++++++++++++++---- demo/scripts/demo.js | 44 ++++++++ 5 files changed, 359 insertions(+), 25 deletions(-) create mode 100644 demo/scripts/demo.js diff --git a/README.md b/README.md index 065c944..ecd2b1d 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ This method only really works for the following: input[type="text"], input[type= ## Demo -Here's a (very) [simple demo](http://remy.bach.me.uk/superlabels_demo/) of Super Labels in action. +A demo of some of the functionality can be found on my site [here](http://remy.bach.me.uk/superlabels_demo/), but is also included in the repository in the `demo` folder. ## Usage diff --git a/demo/css/prism.css b/demo/css/prism.css index b62c46a..9566a5a 100644 --- a/demo/css/prism.css +++ b/demo/css/prism.css @@ -105,6 +105,24 @@ pre[data-line] { position: relative; } +/* Markup */ +.language-markup .token.tag, +.language-markup .token.attr-name, +.language-markup .token.punctuation { + color: hsl(38, 50%, 61%); +} +.language-markup .token.attr-value { + color: hsl(76, 21%, 52%); +} + +/* Text Selection colour */ +::selection { + background: hsla(0,0%,93%,0.15); +} +::-moz-selection { + background: hsla(0,0%,93%,0.15); +} + /* Make the tokens sit above the line highlight so the colours don't look faded. */ .token { position:relative; diff --git a/demo/css/style.css b/demo/css/style.css index 6a86f34..6f0e346 100755 --- a/demo/css/style.css +++ b/demo/css/style.css @@ -25,6 +25,12 @@ form { margin-bottom:0; } /* Reset this from what's set by bootstrap */ label { display:inline; } +section > .span6:not(.intro) { + border-top:1px dashed #777; + margin-top:20px; + padding-top:20px; +} + .container { position:relative; } @@ -49,4 +55,56 @@ label { display:inline; } -webkit-box-shadow:inset 0 1px 1px rgba(0, 0, 0, 0.05); -moz-box-shadow:inset 0 1px 1px rgba(0, 0, 0, 0.05); box-shadow:inset 0 1px 1px rgba(0, 0, 0, 0.05); +} + +/* Tweakable Section */ +.tweakable-container { + position:relative; +} +.tweakable-container pre, +.tweakable-container pre * { + pointer-events:none; +} +.tweakable-container pre { + position:relative; + z-index:1; +} +.tweakable-container input, +.tweakable-container select { + cursor:pointer; + font-size:12px; + height:8px; + position:absolute; + width:100px; + z-index:0; +} +.tweakable-container input:focus { + cursor:text; +} +.tweakable-container select:focus { + cursor:default; +} +.tweakable-container select { + height:auto; + width:150px; +} +.tweakable-container .duration { + left:130px; + top:50px; +} +.tweakable-container .fadeDuration { + left:158px; + top:105px; +} +.tweakable-container .opacity { + left:123px; + top:122px; +} +.tweakable-container .easingIn { + left:130px; + top:66px; +} +.tweakable-container .easingOut { + left:135px; + top:83px; } \ No newline at end of file diff --git a/demo/index.html b/demo/index.html index 1135099..c0796a3 100755 --- a/demo/index.html +++ b/demo/index.html @@ -9,19 +9,6 @@ - - - - - - @@ -29,23 +16,163 @@
-
-
-

jQuery Super Labels Demo

+
+
+
+

jQuery Super Labels Demo

+

All of the below use the following form unless otherwise specified.

+
+ +
<form action="" method="POST">
+	<ul>
+		<li>
+			<label for="text-input">Name</label>
+			<input type="text" name="text-input" value="" />
+		</li>
+		<li>
+			<label for="textarea">Message</label>
+			<textarea rows="2" cols="20" name="textarea"></textarea>
+		</li>
+		<li>
+			<label for="select">Why is the sky blue?</label>
+			<select rows="2" cols="20" name="select">
+				<option value="1">It's painted blue.</option>
+				<option value="2">Why not?</option>
+				<option value="3">Rayleigh scattering.</option>
+			</select>
+		</li>
+	</ul>
+</form>
-
-
+ + +
+
+

Basic Example

+
+
$(function() {
-	// Test comment
 	$('form').superLabels({
 		labelLeft:5,
 		labelTop:5
 	});
 });
-
- + +
+
    +
  • + + +
  • +
  • + + +
  • +
  • + + +
  • +
+ +
+ + +
+
+

Tweakable Example

+

Simply click on the values below for the items you want to edit, change the values and click out of the field again.

+
+ +
+
$(function() {
+	$('form').superLabels({
+		duration:500,
+		easingIn:'easeInOutCubic',
+		easingOut:'easeInOutCubic',
+		fadeDuration:250,
+		opacity:0.5
+	});
+});
+ + + + + + +
+
  • @@ -66,9 +193,96 @@

    jQuery Super Labels Demo

-
-
-
+ + + +
+
+
+

Character Limit Example

+
+ +
$(function() {
+	$('form').superLabels({
+		autoCharLimit:true
+	});
+});
+ +

Note that in this example, the "Name" field overrides the auto flag set above and is set to hide the label after 5 characters:

+ +
<li>
+		<label for="text-input">Name</label>
+		<input type="text" name="text-input" value="" data-sl-char-limit="5" />
+	</li>
+ +
+
    +
  • + + +
  • +
  • + + +
  • +
  • + + +
  • +
+ +
+
+ +
+
+
+

Placeholder Example

+

This example uses a form with only the "Name" fields to show the placeholder functionality.

+

Hover over the label on the second field to see what superLabels does with the placeholder attribute.

+
+ +
<form action="" method="POST">
+	<ul>
+		<li>
+			<label for="text-input">Name</label>
+			<input type="text" name="text-input" value="" />
+		</li>
+		<li>
+			<label for="text-input">Name with placeholder</label>
+			<input type="text" name="text-input" value="" placeholder="Your name" />
+		</li>
+	</ul>
+</form>
+ +
+
    +
  • + + +
  • +
  • + + +
  • +
+ +
+
+ + + + + + + + + + var _gaq = _gaq || []; _gaq.push(['_setAccount', 'UA-26356246-2']); diff --git a/demo/scripts/demo.js b/demo/scripts/demo.js new file mode 100644 index 0000000..5fdb125 --- /dev/null +++ b/demo/scripts/demo.js @@ -0,0 +1,44 @@ +jQuery(function($) { + var tweakableConf = { + duration:500, + easingIn:'easeInOutCubic', + easingOut:'easeInOutCubic', + fadeDuration:250, + labelLeft:5, + labelTop:5, + opacity:0.5 + }; + + $('.basic form, .placeholder form').superLabels({ + labelLeft:5, + labelTop:5 + }); + + $('.tweakable form').superLabels(tweakableConf); + $('.tweakable-container input, .tweakable-container select').focus(function() { + $(this).css('zIndex', 2); + }).blur(function() { + $(this).css('zIndex', 0); + }).change(function() { + var identifier = $(this).data('token'), + num = $(this).data('tokenNum'), + token = $('.tweakable-container .token.'+identifier).get(num), + val = this.value; + + if (isNaN(val)) { + token.innerHTML = val; + tweakableConf[this.className] = val; + } else { + token.innerHTML = Number(val); + tweakableConf[this.className] = Number(val); + } + + $('.tweakable form').superLabels(tweakableConf); + }); + + $('.charLimit form').superLabels({ + autoCharLimit:true, + labelLeft:5, + labelTop:5 + }); +}); \ No newline at end of file From e40823120d1b98cd36397c9e0c5aa5b3f22538f8 Mon Sep 17 00:00:00 2001 From: Remy Bach Date: Thu, 8 Nov 2012 20:42:12 +0000 Subject: [PATCH 43/56] Increase the width of the demo to display the forms a little better. --- demo/css/style.css | 2 +- demo/index.html | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/demo/css/style.css b/demo/css/style.css index 6f0e346..c52766a 100755 --- a/demo/css/style.css +++ b/demo/css/style.css @@ -25,7 +25,7 @@ form { margin-bottom:0; } /* Reset this from what's set by bootstrap */ label { display:inline; } -section > .span6:not(.intro) { +section > .span8:not(.intro) { border-top:1px dashed #777; margin-top:20px; padding-top:20px; diff --git a/demo/index.html b/demo/index.html index c0796a3..3d2e314 100755 --- a/demo/index.html +++ b/demo/index.html @@ -17,7 +17,7 @@
-
+

jQuery Super Labels Demo

All of the below use the following form unless otherwise specified.

@@ -47,7 +47,7 @@

jQuery Super Labels Demo

-
+

Basic Example

@@ -83,7 +83,7 @@

Basic Example

-
+

Tweakable Example

Simply click on the values below for the items you want to edit, change the values and click out of the field again.

@@ -197,7 +197,7 @@

Tweakable Example

-
+

Character Limit Example

@@ -239,7 +239,7 @@

Character Limit Example

-
+

Placeholder Example

This example uses a form with only the "Name" fields to show the placeholder functionality.

From 7dbb819386487d911eb19a3d716ff8e93bb330b1 Mon Sep 17 00:00:00 2001 From: Remy Bach Date: Thu, 8 Nov 2012 21:52:00 +0000 Subject: [PATCH 44/56] Upgrade the version number to 2.0 now that we have a decent demo, new features, and bug fixes. --- jquery.superLabels.js | 2 +- jquery.superLabels.min.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/jquery.superLabels.js b/jquery.superLabels.js index dd5da70..5c9ddea 100644 --- a/jquery.superLabels.js +++ b/jquery.superLabels.js @@ -1,7 +1,7 @@ /* * Title: jQuery Super Labels Plugin - Give your forms a helping of awesome! * Author: Rémy Bach - * Version: 1.2.2 + * Version: 2.0 * License: http://remybach.mit-license.org * Url: http://github.com/remybach/jQuery.superLabels * Description: diff --git a/jquery.superLabels.min.js b/jquery.superLabels.min.js index f52b44a..7b1f847 100644 --- a/jquery.superLabels.min.js +++ b/jquery.superLabels.min.js @@ -1,7 +1,7 @@ /* * Title: jQuery Super Labels Plugin - Give your forms a helping of awesome! * Author: Rémy Bach - * Version: 1.2.2 + * Version: 2.0 * License: http://remybach.mit-license.org * Url: http://github.com/remybach/jQuery.superLabels * Description: From eb3eac5d56eea69b7c717878ff48685c5d754908 Mon Sep 17 00:00:00 2001 From: Remy Bach Date: Thu, 8 Nov 2012 22:16:08 +0000 Subject: [PATCH 45/56] Add a seen-on.md file to track places where super labels is used. --- README.md | 4 ++++ seen-on.md | 0 2 files changed, 4 insertions(+) create mode 100644 seen-on.md diff --git a/README.md b/README.md index ecd2b1d..0c29f0a 100644 --- a/README.md +++ b/README.md @@ -8,6 +8,10 @@ This method only really works for the following: input[type="text"], input[type= ☨ Uses the easing plugin if available. +## Who's using it? + +[Here](https://github.com/remybach/jQuery.superLabels/blob/master/seen-on.md) is a list of sites that use Super Labels. If you've used this plugin and would like to add your site to the list either fork the project, update the file, and submit a pull request or [let me know](http://remy.bach.me.uk/get-in-touch) through my website. + ## Demo A demo of some of the functionality can be found on my site [here](http://remy.bach.me.uk/superlabels_demo/), but is also included in the repository in the `demo` folder. diff --git a/seen-on.md b/seen-on.md new file mode 100644 index 0000000..e69de29 From 7c73b0b54a64c2444b7059c3957ad595a777e7ff Mon Sep 17 00:00:00 2001 From: Remy Bach Date: Thu, 8 Nov 2012 23:53:20 +0000 Subject: [PATCH 46/56] Initial sites for the seen-on.md file --- seen-on.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/seen-on.md b/seen-on.md index e69de29..fbc5249 100644 --- a/seen-on.md +++ b/seen-on.md @@ -0,0 +1,2 @@ +* [http://www.biscuiteers.com](http://www.biscuiteers.com) +* [http://www.yeovalley.co.uk](http://www.yeovalley.co.uk) \ No newline at end of file From eabbeeb0bb15cfb15df839a23e8004c5160b0aff Mon Sep 17 00:00:00 2001 From: Remy Bach Date: Wed, 14 Nov 2012 10:38:55 +0000 Subject: [PATCH 47/56] Update the prism theme (more accurate twilight colouring) --- demo/css/prism.css | 56 ++++++++++++++++++++++++---------------------- 1 file changed, 29 insertions(+), 27 deletions(-) diff --git a/demo/css/prism.css b/demo/css/prism.css index 9566a5a..9128617 100644 --- a/demo/css/prism.css +++ b/demo/css/prism.css @@ -25,23 +25,29 @@ pre[class*="language-"] { pre[class*="language-"], :not(pre) > code[class*="language-"] { - background:hsl(0,0%,22%); + background:hsl(0, 0%, 8%); /* #141414 */ } /* Code blocks */ pre[class*="language-"] { border-radius: .5em; - border: .3em solid hsl(0,0%,33%); + border: .3em solid hsl(0,0%,33%); /* #282A2B */ box-shadow: 1px 1px .5em black inset; margin: .5em 0; overflow: auto; padding: 1em; } +pre[class*="language-"]::selection { /* Safari */ + background:hsl(200, 4%, 16%); /* #282A2B */ +} +pre[class*="language-"]::selection { /* Firefox */ + background:hsl(200, 4%, 16%); /* #282A2B */ +} /* Inline code */ :not(pre) > code[class*="language-"] { border-radius: .3em; - border: .13em solid hsl(0,0%,33%); + border: .13em solid hsl(0,0%,33%); /* #545454 */ box-shadow: 1px 1px .3em -.1em black inset; padding: .15em .2em .05em; } @@ -50,7 +56,7 @@ pre[class*="language-"] { .token.prolog, .token.doctype, .token.cdata { - color: hsl(0,0%,47%); + color: hsl(0, 0%, 47%); /* #777777 */ } .token.punctuation { @@ -64,33 +70,32 @@ pre[class*="language-"] { .token.tag, .token.boolean, .token.number { - color: hsl(15, 60%, 61%); + color: hsl(14, 58%, 55%); /* #CF6A4C */ } .token.keyword, .token.property, .token.selector { - color:hsl(53, 89%, 79%); + color:hsl(53, 89%, 79%); /* #F9EE98 */ } .token.attr-name, +.token.attr-value, .token.string, .token.operator, .token.entity, .token.url, .language-css .token.string, .style .token.string { - color:hsl(76, 21%, 52%); + color:hsl(76, 21%, 52%); /* #8F9D6A */ } -.token.atrule, -.token.attr-value { - color: hsl(32, 33%, 50%); +.token.atrule { + color:hsl(218, 22%, 55%); /* #7587A6 */ } - .token.regex, .token.important { - color: hsl(42, 75%, 65%); + color: hsl(42, 75%, 65%); /* #E9C062 */ } .token.important { @@ -109,18 +114,15 @@ pre[data-line] { .language-markup .token.tag, .language-markup .token.attr-name, .language-markup .token.punctuation { - color: hsl(38, 50%, 61%); -} -.language-markup .token.attr-value { - color: hsl(76, 21%, 52%); + color: hsl(33, 33%, 52%); /* #AC885B */ } /* Text Selection colour */ ::selection { - background: hsla(0,0%,93%,0.15); + background: hsla(0,0%,93%,0.15); /* #EDEDED */ } ::-moz-selection { - background: hsla(0,0%,93%,0.15); + background: hsla(0,0%,93%,0.15); /* #EDEDED */ } /* Make the tokens sit above the line highlight so the colours don't look faded. */ @@ -129,13 +131,13 @@ pre[data-line] { z-index:1; } .line-highlight { - background: -moz-linear-gradient(left, hsl(0, 0%, 33%,.1) 70%, hsl(0, 0%, 33%,0)); - background: -o-linear-gradient(left, hsl(0, 0%, 33%,.1) 70%, hsl(0, 0%, 33%,0)); - background: -webkit-linear-gradient(left, hsl(0, 0%, 33%,.1) 70%, hsl(0, 0%, 33%,0)); - background: hsla(0, 0%, 33%, 0.25); - background: linear-gradient(left, hsl(0, 0%, 33%,.1) 70%, hsl(0, 0%, 33%,0)); - border-bottom:1px dashed hsl(0, 0%, 33%); - border-top:1px dashed hsl(0, 0%, 33%); + background: -moz-linear-gradient(left, hsl(0, 0%, 33%,.1) 70%, hsl(0, 0%, 33%,0)); /* #545454 */ + background: -o-linear-gradient(left, hsl(0, 0%, 33%,.1) 70%, hsl(0, 0%, 33%,0)); /* #545454 */ + background: -webkit-linear-gradient(left, hsl(0, 0%, 33%,.1) 70%, hsl(0, 0%, 33%,0)); /* #545454 */ + background: hsla(0, 0%, 33%, 0.25); /* #545454 */ + background: linear-gradient(left, hsl(0, 0%, 33%,.1) 70%, hsl(0, 0%, 33%,0)); /* #545454 */ + border-bottom:1px dashed hsl(0, 0%, 33%); /* #545454 */ + border-top:1px dashed hsl(0, 0%, 33%); /* #545454 */ left: 0; line-height: inherit; margin-top: 0.75em; /* Same as .prism’s padding-top */ @@ -148,10 +150,10 @@ pre[data-line] { } .line-highlight:before, .line-highlight[data-end]:after { - background-color: hsl(215, 15%, 59%); + background-color: hsl(215, 15%, 59%); /* #8794A6 */ border-radius: 999px; box-shadow: 0 1px white; - color: hsl(24, 20%, 95%); + color: hsl(24, 20%, 95%); /* #F5F2F0 */ content: attr(data-start); font: bold 65%/1.5 sans-serif; left: .6em; From 1992721e1bb9682210850374881685fcf16f5b7e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Bach?= Date: Fri, 4 Jan 2013 13:42:46 +0000 Subject: [PATCH 48/56] Add note about opacity bug on bold labels in IE. --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 0c29f0a..10d7447 100644 --- a/README.md +++ b/README.md @@ -94,7 +94,8 @@ The way superLabels uses placeholders (as of version 1.1.1) is as follows: Below I'll list any bugs that I'm aware of and will try to get around to fixing as soon as I can. * Auto filling of form fields that is performed by some browsers (other than Chrome) causes a visual bug. Currently the label stays visible and positioned on top of the field while the field has a value. I've found a bug report for Firefox [here](https://bugzilla.mozilla.org/show_bug.cgi?id=184761). +* Opacity bug with bold label text in IE. This was pointed out by [alensa](https://github.com/alensa) in [this bug](https://github.com/remybach/jQuery.superLabels/issues/11#issuecomment-11860664). The proposed fix is to add a background colour to the label in your CSS. #### License -MIT License - [http://remybach.mit-license.org/](http://remybach.mit-license.org/ 'Link through to read my License.') \ No newline at end of file +MIT License - [http://remybach.mit-license.org/](http://remybach.mit-license.org/ 'Link through to read my License.') From d18149137e669199704c6affa971ac77843579dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Bach?= Date: Fri, 4 Jan 2013 13:43:37 +0000 Subject: [PATCH 49/56] Remove direct link to comment on issue 11. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 10d7447..8c6aee6 100644 --- a/README.md +++ b/README.md @@ -94,7 +94,7 @@ The way superLabels uses placeholders (as of version 1.1.1) is as follows: Below I'll list any bugs that I'm aware of and will try to get around to fixing as soon as I can. * Auto filling of form fields that is performed by some browsers (other than Chrome) causes a visual bug. Currently the label stays visible and positioned on top of the field while the field has a value. I've found a bug report for Firefox [here](https://bugzilla.mozilla.org/show_bug.cgi?id=184761). -* Opacity bug with bold label text in IE. This was pointed out by [alensa](https://github.com/alensa) in [this bug](https://github.com/remybach/jQuery.superLabels/issues/11#issuecomment-11860664). The proposed fix is to add a background colour to the label in your CSS. +* Opacity bug with bold label text in IE. This was pointed out by [alensa](https://github.com/alensa) in [this bug](https://github.com/remybach/jQuery.superLabels/issues/11). The proposed fix is to add a background colour to the label in your CSS. #### License From 1c2b5be474ba9d5ca496a2e0dd41c5a9c85e25bc Mon Sep 17 00:00:00 2001 From: Remy Bach Date: Thu, 17 Jan 2013 07:59:49 +0200 Subject: [PATCH 50/56] Minor version bump and added the jQuery plugin repo manifest file. --- jquery.superLabels.js | 2 +- jquery.superLabels.min.js | 2 +- superLabels.jquery.json | 28 ++++++++++++++++++++++++++++ 3 files changed, 30 insertions(+), 2 deletions(-) create mode 100644 superLabels.jquery.json diff --git a/jquery.superLabels.js b/jquery.superLabels.js index 5c9ddea..4ee70ed 100644 --- a/jquery.superLabels.js +++ b/jquery.superLabels.js @@ -1,7 +1,7 @@ /* * Title: jQuery Super Labels Plugin - Give your forms a helping of awesome! * Author: Rémy Bach - * Version: 2.0 + * Version: 2.0.1 * License: http://remybach.mit-license.org * Url: http://github.com/remybach/jQuery.superLabels * Description: diff --git a/jquery.superLabels.min.js b/jquery.superLabels.min.js index 7b1f847..b9f64c6 100644 --- a/jquery.superLabels.min.js +++ b/jquery.superLabels.min.js @@ -1,7 +1,7 @@ /* * Title: jQuery Super Labels Plugin - Give your forms a helping of awesome! * Author: Rémy Bach - * Version: 2.0 + * Version: 2.0.1 * License: http://remybach.mit-license.org * Url: http://github.com/remybach/jQuery.superLabels * Description: diff --git a/superLabels.jquery.json b/superLabels.jquery.json new file mode 100644 index 0000000..878e8af --- /dev/null +++ b/superLabels.jquery.json @@ -0,0 +1,28 @@ +{ + "name": "superLabels", + "version": "2.0.1", + "title": "jQuery Super Labels", + "author": { + "name": "Rémy Bach", + "url": "http://remy.bach.me.uk" + }, + "licenses": [{ + "type": "MIT", + "url": "http://remybach.mit-license.org/" + }], + "dependencies": { + "jquery": "*" + }, + "description": "Give your forms a helping of awesome!", + "keywords": [ + "form", + "forms", + "label", + "labels", + "usability" + ], + "homepage": "https://github.com/remybach/jQuery.superLabels", + "docs": "https://github.com/remybach/jQuery.superLabels", + "demo": "http://remy.bach.me.uk/superlabels_demo/", + "bugs": "https://github.com/remybach/jQuery.superLabels/issues" +} \ No newline at end of file From 7348e769f071ee9b516316907acd2acec084e9d1 Mon Sep 17 00:00:00 2001 From: Remy Bach Date: Thu, 17 Jan 2013 08:23:02 +0200 Subject: [PATCH 51/56] Fix the dependency version in the jQuery plugin repo file. --- jquery.superLabels.js | 2 +- jquery.superLabels.min.js | 2 +- superLabels.jquery.json | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/jquery.superLabels.js b/jquery.superLabels.js index 4ee70ed..5cfe342 100644 --- a/jquery.superLabels.js +++ b/jquery.superLabels.js @@ -1,7 +1,7 @@ /* * Title: jQuery Super Labels Plugin - Give your forms a helping of awesome! * Author: Rémy Bach - * Version: 2.0.1 + * Version: 2.0.2 * License: http://remybach.mit-license.org * Url: http://github.com/remybach/jQuery.superLabels * Description: diff --git a/jquery.superLabels.min.js b/jquery.superLabels.min.js index b9f64c6..0c8a852 100644 --- a/jquery.superLabels.min.js +++ b/jquery.superLabels.min.js @@ -1,7 +1,7 @@ /* * Title: jQuery Super Labels Plugin - Give your forms a helping of awesome! * Author: Rémy Bach - * Version: 2.0.1 + * Version: 2.0.2 * License: http://remybach.mit-license.org * Url: http://github.com/remybach/jQuery.superLabels * Description: diff --git a/superLabels.jquery.json b/superLabels.jquery.json index 878e8af..8daa0cd 100644 --- a/superLabels.jquery.json +++ b/superLabels.jquery.json @@ -1,6 +1,6 @@ { "name": "superLabels", - "version": "2.0.1", + "version": "2.0.2", "title": "jQuery Super Labels", "author": { "name": "Rémy Bach", @@ -11,7 +11,7 @@ "url": "http://remybach.mit-license.org/" }], "dependencies": { - "jquery": "*" + "jquery": ">=1.5" }, "description": "Give your forms a helping of awesome!", "keywords": [ From c5aec2cc42ed122432ec33f011d94500b8a4d0d2 Mon Sep 17 00:00:00 2001 From: Remy Bach Date: Tue, 5 Mar 2013 17:29:27 +0000 Subject: [PATCH 52/56] Add Grunt. Can now do the following: Run JS Hint, check that the version in the jquery.json file matches what's in packages.json file, update the banner in the jquery.superLabels.js file, and automatically minify. --- .gitignore | 1 + Gruntfile.js | 81 ++++++++++++++++++++++++++++++++++++++++ package.json | 25 +++++++++++++ tasks/checkBanner.js | 32 ++++++++++++++++ tasks/checkjQueryJSON.js | 29 ++++++++++++++ tasks/minify.js | 37 ++++++++++++++++++ 6 files changed, 205 insertions(+) create mode 100644 .gitignore create mode 100644 Gruntfile.js create mode 100644 package.json create mode 100644 tasks/checkBanner.js create mode 100644 tasks/checkjQueryJSON.js create mode 100644 tasks/minify.js diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..40b878d --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +node_modules/ \ No newline at end of file diff --git a/Gruntfile.js b/Gruntfile.js new file mode 100644 index 0000000..510ab97 --- /dev/null +++ b/Gruntfile.js @@ -0,0 +1,81 @@ +/*global module:false*/ + +module.exports = function(grunt) { + + // Project configuration. + grunt.initConfig({ + pkg: grunt.file.readJSON('package.json'), + meta: { + version: '<%= pkg.version %>', + banner: '/*!\n' + + ' * Title: jQuery Super Labels Plugin - Give your forms a helping of awesome!\n' + + ' * Author: Rémy Bach\n' + + ' * Version: <%= pkg.version %>\n' + + ' * License: http://remybach.mit-license.org\n' + + ' * Url: http://github.com/remybach/jQuery.superLabels\n' + + ' * Description:\n' + + ' * This plugin allows you to display your form labels on top of your form fields, saving you space on your page.\n' + + ' */\n'+ + ';' + }, + jshint: { + files: ['jquery.superLabels.js'], + options: { + // Enforcing + curly: true, + immed: true, + indent: 4, + latedef: true, + newcap: true, + noarg: true, + noempty: true, + strict: true, + sub: true, + trailing: true, + undef: true, + unused: true, + + // Relaxing + boss: true, + eqnull: true, + globalstrict: true, + iterator: true, + loopfunc: true, + smarttabs: true, + + // Environments + browser: true, + jquery: true, + nonstandard: true, + white: false + } + }, + checkBanner: { + filename: 'jquery.superLabels.js' + }, + checkjQueryJSON: { + filename: 'superLabels.jquery.json' + }, + minify: { + dest: 'jquery.superLabels.min.js', + filename: 'jquery.superLabels.js' + }, + uglify: { + options: { + banner: '<%= meta.banner %>' + }, + dist: { + files: { + 'jquery.superLabels.min.js': ['', 'jquery.superLabels.min.js'] + } + } + } + }); + + grunt.loadNpmTasks('grunt-contrib-jshint'); + grunt.loadNpmTasks('grunt-contrib-uglify'); + grunt.loadTasks('tasks'); + + // Default task - Run JS Hint, check the version in the jquery.json file matches what's in packages.json, update the banner in the superlabels file, and minify. + grunt.registerTask('default', ["jshint", "checkjQueryJSON", "checkBanner", "minify"]); +}; \ No newline at end of file diff --git a/package.json b/package.json new file mode 100644 index 0000000..8fc8108 --- /dev/null +++ b/package.json @@ -0,0 +1,25 @@ +{ + "name": "jQuery.superLabels", + "version": "2.0.3", + "description": "Give your forms a helping of awesome!", + "homepage": "http://remy.bach.me.uk/superlabels_demo/", + "bugs": { + "url": "https://github.com/remybach/jQuery.superLabels/issues" + }, + "contributors": [ + { + "name": "Rémy Bach", + "url": "http://remy.bach.me.uk" + } + ], + "repository": { + "type": "git", + "url": "https://github.com/remybach/jQuery.superLabels" + }, + "private": true, + "devDependencies": { + "grunt": "0.4.0rc7", + "grunt-contrib-jshint": "0.1.1", + "grunt-contrib-uglify": "0.1.1" + } +} \ No newline at end of file diff --git a/tasks/checkBanner.js b/tasks/checkBanner.js new file mode 100644 index 0000000..10224d1 --- /dev/null +++ b/tasks/checkBanner.js @@ -0,0 +1,32 @@ +module.exports = function(grunt) { + 'use strict'; + + grunt.registerTask('checkBanner', 'Update the banner of the given file.', function() { + var banner, filename; + + grunt.config.requires('minify.filename'); + + banner = grunt.config('meta.banner'); + filename = grunt.config('minify.filename'); + + var src; + + // Warn on and remove invalid source files (if nonull was set). + if (!grunt.file.exists(filename)) { + grunt.log.warn('Source file not found at "' + filename + '"'); + return false; + } + + grunt.log.writeln('Updating Banner for: '+filename); + + src = grunt.file.read(filename); + + // Strip out the existing banner + src = src.replace(/\/\*![\r\n] \*\sTitle(.|[\r\n])*?\*\/[\r\n];/gm, banner); + + grunt.file.write(filename, src); + + grunt.log.writeln('Done updating banner in: '+filename); + + }); +}; \ No newline at end of file diff --git a/tasks/checkjQueryJSON.js b/tasks/checkjQueryJSON.js new file mode 100644 index 0000000..d3aacc0 --- /dev/null +++ b/tasks/checkjQueryJSON.js @@ -0,0 +1,29 @@ +module.exports = function(grunt) { + 'use strict'; + + grunt.registerTask('checkjQueryJSON', 'Update the version number in the jquery.json file.', function() { + var filename; + + grunt.config.requires('checkjQueryJSON.filename'); + + filename = grunt.config('checkjQueryJSON.filename'); + + var json; + + // Warn on and remove invalid source files (if nonull was set). + if (!grunt.file.exists(filename)) { + grunt.log.warn('Source file not found at "' + filename + '"'); + return false; + } + + grunt.log.writeln('Updating Banner for: '+filename); + + json = grunt.file.readJSON(filename); + + json.version = grunt.config('meta.version'); + + grunt.file.write(filename, JSON.stringify(json)); + + grunt.log.writeln('Done updating version in: '+filename); + }); +}; \ No newline at end of file diff --git a/tasks/minify.js b/tasks/minify.js new file mode 100644 index 0000000..6c841d4 --- /dev/null +++ b/tasks/minify.js @@ -0,0 +1,37 @@ +module.exports = function(grunt) { + 'use strict'; + + grunt.registerTask('minify', 'Strip out some of the guff and uglify.', function() { + var dest, + filename; + + // Fail task if we don't know which file/s to minify or where to put them + grunt.config.requires('minify.dest'); + grunt.config.requires('minify.filename'); + + dest = grunt.config('minify.dest'); + filename = grunt.config('minify.filename'); + + var src; + + // Warn on and remove invalid source files (if nonull was set). + if (!grunt.file.exists(filename)) { + grunt.log.warn('Source file not found at "' + filename + '"'); + return false; + } + + grunt.log.writeln('Minifying: '+filename); + + src = grunt.file.read(filename); + + // Strip out anything we don't want in the minified version. + src = src.replace(/\/\* nominify \*\/(.|[\r\n])*?\/\* \/nominify \*\//gm, ''); + + grunt.file.write(dest, src); + + grunt.task.run('uglify'); + + grunt.log.writeln('Done minifying, stripped and uglified file is at: '+dest); + + }); +}; \ No newline at end of file From 489c6a564a06e964aa7be56c88025f100536d421 Mon Sep 17 00:00:00 2001 From: Remy Bach Date: Tue, 5 Mar 2013 17:31:25 +0000 Subject: [PATCH 53/56] Run everything through grunt. Added strict mode, cleaned up a few things according to JS Hint and updated the version number. --- jquery.superLabels.js | 50 ++++++++++++++++++++++++++++++--------- jquery.superLabels.min.js | 6 ++--- superLabels.jquery.json | 29 +---------------------- 3 files changed, 43 insertions(+), 42 deletions(-) diff --git a/jquery.superLabels.js b/jquery.superLabels.js index 5cfe342..f9a7ff0 100644 --- a/jquery.superLabels.js +++ b/jquery.superLabels.js @@ -1,17 +1,22 @@ -/* +/*global console */ +/*! * Title: jQuery Super Labels Plugin - Give your forms a helping of awesome! * Author: Rémy Bach - * Version: 2.0.2 + * Version: 2.0.3 * License: http://remybach.mit-license.org * Url: http://github.com/remybach/jQuery.superLabels * Description: * This plugin allows you to display your form labels on top of your form fields, saving you space on your page. */ ;(function($) { + 'use strict'; + var defaults = { autoCharLimit:false, // Whether to automatically attempt to determine the number of characters after which to fade the label out or not. baseZindex:0, // The base z-index which we display on top of. + /* nominify */ debug:false, + /* /nominify */ duration:500, // Time of the slide in milliseconds. easingIn:($.easing && $.easing.def ? 'easeInOutCubic' : false), // The easing in function to use for the slide. easingOut:($.easing && $.easing.def ? 'easeInOutCubic' : false), // The easing out function to use for the slide. @@ -24,7 +29,10 @@ wrapSelector:false // The selector for the element you have wrapping each field. }, acceptedInputTypes = ['text', 'search', 'url', 'tel', 'email', 'password', 'number'], - acceptedElements = ['input', 'textarea', 'select']; + acceptedElements = ['input', 'textarea', 'select'], + + // Function declarations + _getLabel, _prepLabel, _focus, _blur, _keyup, _noVal, _withinCharLimit, _approximateChars/* nominify */,_log, _info, _error/* /nominify */; $.fn.superLabels = function(options) { var _fields = [], @@ -48,7 +56,9 @@ // to superLabels. $(this).data('slDefaults', $.extend(_newDefaults, options || {})).addClass('sl-defaults'); + /* nominify */ if (!$.easing.def) { _info('Easing plugin not found - using standard jQuery animations.'); } + /* /nominify */ // Check for whether the user has just passed in the form. If so, we need to fetch all the accepted fields. if (this.length === 1 && /form/i.test(this[0].tagName)) { @@ -75,7 +85,9 @@ // Don't even bother going further if this isn't one of the accepted input field types or elements. if ((_field[0].tagName.toLowerCase() === 'input' && $.inArray(_field.attr('type'), acceptedInputTypes)) === -1 && $.inArray(_field[0].tagName.toLowerCase(), acceptedElements) !== -1) { + /* nominify */ _info('Doh! The following '+this.tagName.toLowerCase()+', is not supported.', this); + /* /nominify */ return true; // Equivalent to continue in a normal for loop. } @@ -102,7 +114,9 @@ // Make sure this form field has a label if (_label.length === 0) { + /* nominify */ _info('Doh! The following '+this.tagName.toLowerCase()+' has no related label.', this); + /* /nominify */ return true; } @@ -131,7 +145,8 @@ // Get the label for a given field. _getLabel = function(_field) { var _defaults = $(_field).closest('.sl-defaults').data('slDefaults'), - _label = $(_field).siblings('label'); + _label = $(_field).siblings('label'), + _for; if (_label.length === 0) { // If a selector is present for the wrapping element, use that, otherwise, proceed to use more traditional methods. @@ -148,8 +163,7 @@ // Position the label. _prepLabel = function(_field, _label) { - var _charLimit, - _charLimitAttr = _field.data('slCharLimit'), + var _charLimitAttr = _field.data('slCharLimit'), _defaults = $(_field).closest('.sl-defaults').data('slDefaults'), _opacity = 0, _selected; @@ -198,7 +212,7 @@ _to = { opacity:0 }; if (_noVal(this)) { - _label = _getLabel(this); + _label = _getLabel(this); if (_defaults.noAnimate) { _label.hide(); @@ -288,7 +302,7 @@ _approximateChars = function(_field, _label) { var _available, _charLen, - _chars = '1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ' + _chars = '1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ', _properties = ["font-family", "font-size", "font-weight", "letter-spacing", "line-height", "text-shadow", "text-transform"], _tmp = $('
'+_chars+'
'); @@ -318,8 +332,22 @@ _field.data('slCharLimit', Math.floor(_available / _charLen)); }; + /* nominify */ // Console Functions (We need these to make sure this only displays when the console exists.) - _log = function() { if (defaults.debug && console && console.log) console.log.apply(console, arguments); }; - _info = function() { if (defaults.debug && console && console.info) console.info.apply(console, arguments); }; - _error = function() { if (defaults.debug && console && console.error) console.error.apply(console, arguments); }; + _log = function() { + if (defaults.debug && console && console.log) { + console.log.apply(console, arguments); + } + }; + _info = function() { + if (defaults.debug && console && console.info) { + console.info.apply(console, arguments); + } + }; + _error = function() { + if (defaults.debug && console && console.error) { + console.error.apply(console, arguments); + } + }; + /* /nominify */ })(jQuery); \ No newline at end of file diff --git a/jquery.superLabels.min.js b/jquery.superLabels.min.js index 0c8a852..dbc6d7a 100644 --- a/jquery.superLabels.min.js +++ b/jquery.superLabels.min.js @@ -1,10 +1,10 @@ -/* +/*! * Title: jQuery Super Labels Plugin - Give your forms a helping of awesome! * Author: Rémy Bach - * Version: 2.0.2 + * Version: 2.0.3 * License: http://remybach.mit-license.org * Url: http://github.com/remybach/jQuery.superLabels * Description: * This plugin allows you to display your form labels on top of your form fields, saving you space on your page. */ -(function(e){var t={autoCharLimit:false,baseZindex:0,duration:500,easingIn:e.easing&&e.easing.def?"easeInOutCubic":false,easingOut:e.easing&&e.easing.def?"easeInOutCubic":false,fadeDuration:250,labelLeft:0,labelTop:0,noAnimate:false,opacity:.5,slide:true,wrapSelector:false},n=["text","search","url","tel","email","password","number"],r=["input","textarea","select"];e.fn.superLabels=function(i){var s=[],o;if(this.length===0){return false}if(i&&i.labelLeft&&isNaN(i.labelLeft)){i.labelLeft=Number(i.labelLeft.replace(/\D+/,""))}if(i&&i.labelTop&&isNaN(i.labelTop)){i.labelTop=Number(i.labelTop.replace(/\D+/,""))}o=e.extend({},t);e(this).data("slDefaults",e.extend(o,i||{})).addClass("sl-defaults");if(this.length===1&&/form/i.test(this[0].tagName)){s=e(r.join(","),this)}else if(this.length>1){this.each(function(){if(/form/i.test(this.tagName)){e.merge(s,e(r.join(","),this))}else{s.push(this)}})}else{s=this}return e(s).each(function(){var t=e(this),i,s=t.attr("placeholder"),o;if((t[0].tagName.toLowerCase()==="input"&&e.inArray(t.attr("type"),n))===-1&&e.inArray(t[0].tagName.toLowerCase(),r)!==-1){return true}i=_getLabel(this);if(s){if(i.length===0){o='";o+="";o=e(o);i=o;t.before(i)}else{i.attr("title",s)}t.removeAttr("placeholder")}if(i.length===0){return true}_prepLabel(t,i);if(!this.tagName.match(/select/i)){t.focus(_focus);t.blur(_blur);t.change(_blur);t.bind("input",_keyup);t.bind("propertychange",_blur);t.keyup(_keyup);i.click(function(){t.focus()})}})};_getLabel=function(t){var n=e(t).closest(".sl-defaults").data("slDefaults"),r=e(t).siblings("label");if(r.length===0){if(n.wrapSelector){r=e(t).parents(n.wrapSelector).find("label")}else{_for=t.id||t.name;r=e('[for="'+_for+'"]')}}return r};_prepLabel=function(t,n){var r,i=t.data("slCharLimit"),s=e(t).closest(".sl-defaults").data("slDefaults"),o=0,u;if(t[0].tagName.match(/select/i)){u=t.find("[selected]").length===0?" selected":"";t.prepend('");n.css("display","none")}else{if(i==="auto"||s.autoCharLimit&&isNaN(i)){_approximateChars(t,n)}if(_noVal(t)){o=1}else if(_withinCharLimit(t)){o=s._opacity}t.css({zIndex:s.baseZindex+1}).addClass("sl_field");n.css({left:_noVal(t)?s.labelLeft:e(t).width()-n.width(),opacity:o,position:"absolute",top:s.labelTop,zIndex:s.baseZindex+2}).addClass("sl_label")}};_focus=function(){var t=e(this).closest(".sl-defaults").data("slDefaults"),n=t.duration,r,i={opacity:0};if(_noVal(this)){r=_getLabel(this);if(t.noAnimate){r.hide();return false}if(t.slide){i.left=e(this).width()-r.width();i.opacity=t.opacity}else{n=t.fadeDuration}r.stop(true,false).animate(i,n,t.easingOut)}};_blur=function(){var t=e(this).closest(".sl-defaults").data("slDefaults"),n=t.duration,r,i={opacity:1};if(_noVal(this)){r=_getLabel(this);if(t.noAnimate){r.show();return false}if(t.slide){i.left=t.labelLeft}else{n=t.fadeDuration}r.stop(true,false).animate(i,n,t.easingOut)}else{_keyup.apply(this)}};_keyup=function(){var t=e(this).closest(".sl-defaults").data("slDefaults"),n,r=0;if(t.noAnimate){return false}n=_getLabel(this);if(_noVal(this)&&n.css("opacity")>0||!_noVal(this)&&n.css("opacity")===0){return false}if(_noVal(this)&&n.css("opacity")!==0||_withinCharLimit(this)){r=t.opacity}n.stop(true,false).animate({opacity:r},t.fadeDuration,t.easingOut)};_noVal=function(t){return e(t).val()===""};_withinCharLimit=function(t){var n=e(t).data("slCharLimit");if(!n||typeof n!=="number"){return false}t=t.length?t[0]:t;return n&&t.value&&t.value.length<=n};_approximateChars=function(t,n){var r,i,s="1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";_properties=["font-family","font-size","font-weight","letter-spacing","line-height","text-shadow","text-transform"],_tmp=e("
"+s+"
");e.each(_properties,function(e,n){_tmp.css(n,t.css(n))});_tmp.css({position:"absolute",visibility:"hidden"});t.parent().append(_tmp);i=Math.round(_tmp.width()/s.length);_tmp.remove();r=t.width()-n.width();t.data("slCharLimit",Math.floor(r/i))}})(jQuery) \ No newline at end of file +;(function(t){"use strict";var e,a,i,s,l,n,o,r,u={autoCharLimit:!1,baseZindex:0,duration:500,easingIn:t.easing&&t.easing.def?"easeInOutCubic":!1,easingOut:t.easing&&t.easing.def?"easeInOutCubic":!1,fadeDuration:250,labelLeft:0,labelTop:0,noAnimate:!1,opacity:.5,slide:!0,wrapSelector:!1},d=["text","search","url","tel","email","password","number"],h=["input","textarea","select"];t.fn.superLabels=function(n){var o,r=[];return 0===this.length?!1:(n&&n.labelLeft&&isNaN(n.labelLeft)&&(n.labelLeft=Number(n.labelLeft.replace(/\D+/,""))),n&&n.labelTop&&isNaN(n.labelTop)&&(n.labelTop=Number(n.labelTop.replace(/\D+/,""))),o=t.extend({},u),t(this).data("slDefaults",t.extend(o,n||{})).addClass("sl-defaults"),1===this.length&&/form/i.test(this[0].tagName)?r=t(h.join(","),this):this.length>1?this.each(function(){/form/i.test(this.tagName)?t.merge(r,t(h.join(","),this)):r.push(this)}):r=this,t(r).each(function(){var n,o,r=t(this),u=r.attr("placeholder");return-1===("input"===r[0].tagName.toLowerCase()&&t.inArray(r.attr("type"),d))&&-1!==t.inArray(r[0].tagName.toLowerCase(),h)?!0:(n=e(this),u&&(0===n.length?(o='",o+="",o=t(o),n=o,r.before(n)):n.attr("title",u),r.removeAttr("placeholder")),0===n.length?!0:(a(r,n),this.tagName.match(/select/i)||(r.focus(i),r.blur(s),r.change(s),r.bind("input",l),r.bind("propertychange",s),r.keyup(l),n.click(function(){r.focus()})),void 0))}))},e=function(e){var a,i=t(e).closest(".sl-defaults").data("slDefaults"),s=t(e).siblings("label");return 0===s.length&&(i.wrapSelector?s=t(e).parents(i.wrapSelector).find("label"):(a=e.id||e.name,s=t('[for="'+a+'"]'))),s},a=function(e,a){var i,s=e.data("slCharLimit"),l=t(e).closest(".sl-defaults").data("slDefaults"),u=0;e[0].tagName.match(/select/i)?(i=0===e.find("[selected]").length?" selected":"",e.prepend('"),a.css("display","none")):(("auto"===s||l.autoCharLimit&&isNaN(s))&&r(e,a),n(e)?u=1:o(e)&&(u=l._opacity),e.css({zIndex:l.baseZindex+1}).addClass("sl_field"),a.css({left:n(e)?l.labelLeft:t(e).width()-a.width(),opacity:u,position:"absolute",top:l.labelTop,zIndex:l.baseZindex+2}).addClass("sl_label"))},i=function(){var a,i=t(this).closest(".sl-defaults").data("slDefaults"),s=i.duration,l={opacity:0};if(n(this)){if(a=e(this),i.noAnimate)return a.hide(),!1;i.slide?(l.left=t(this).width()-a.width(),l.opacity=i.opacity):s=i.fadeDuration,a.stop(!0,!1).animate(l,s,i.easingOut)}},s=function(){var a,i=t(this).closest(".sl-defaults").data("slDefaults"),s=i.duration,o={opacity:1};if(n(this)){if(a=e(this),i.noAnimate)return a.show(),!1;i.slide?o.left=i.labelLeft:s=i.fadeDuration,a.stop(!0,!1).animate(o,s,i.easingOut)}else l.apply(this)},l=function(){var a,i=t(this).closest(".sl-defaults").data("slDefaults"),s=0;return i.noAnimate?!1:(a=e(this),n(this)&&a.css("opacity")>0||!n(this)&&0===a.css("opacity")?!1:((n(this)&&0!==a.css("opacity")||o(this))&&(s=i.opacity),a.stop(!0,!1).animate({opacity:s},i.fadeDuration,i.easingOut),void 0))},n=function(e){return""===t(e).val()},o=function(e){var a=t(e).data("slCharLimit");return a&&"number"==typeof a?(e=e.length?e[0]:e,a&&e.value&&a>=e.value.length):!1},r=function(e,a){var i,s,l="1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",n=["font-family","font-size","font-weight","letter-spacing","line-height","text-shadow","text-transform"],o=t("
"+l+"
");t.each(n,function(t,a){o.css(a,e.css(a))}),o.css({position:"absolute",visibility:"hidden"}),e.parent().append(o),s=Math.round(o.width()/l.length),o.remove(),i=e.width()-a.width(),e.data("slCharLimit",Math.floor(i/s))}})(jQuery); \ No newline at end of file diff --git a/superLabels.jquery.json b/superLabels.jquery.json index 8daa0cd..1120080 100644 --- a/superLabels.jquery.json +++ b/superLabels.jquery.json @@ -1,28 +1 @@ -{ - "name": "superLabels", - "version": "2.0.2", - "title": "jQuery Super Labels", - "author": { - "name": "Rémy Bach", - "url": "http://remy.bach.me.uk" - }, - "licenses": [{ - "type": "MIT", - "url": "http://remybach.mit-license.org/" - }], - "dependencies": { - "jquery": ">=1.5" - }, - "description": "Give your forms a helping of awesome!", - "keywords": [ - "form", - "forms", - "label", - "labels", - "usability" - ], - "homepage": "https://github.com/remybach/jQuery.superLabels", - "docs": "https://github.com/remybach/jQuery.superLabels", - "demo": "http://remy.bach.me.uk/superlabels_demo/", - "bugs": "https://github.com/remybach/jQuery.superLabels/issues" -} \ No newline at end of file +{"name":"superLabels","version":"2.0.3","title":"jQuery Super Labels","author":{"name":"Rémy Bach","url":"http://remy.bach.me.uk"},"licenses":[{"type":"MIT","url":"http://remybach.mit-license.org/"}],"dependencies":{"jquery":">=1.5"},"description":"Give your forms a helping of awesome!","keywords":["form","forms","label","labels","usability"],"homepage":"https://github.com/remybach/jQuery.superLabels","docs":"https://github.com/remybach/jQuery.superLabels","demo":"http://remy.bach.me.uk/superlabels_demo/","bugs":"https://github.com/remybach/jQuery.superLabels/issues"} \ No newline at end of file From 4b417f1faba5c7f6e4dc69f85aa877e40ac28cd6 Mon Sep 17 00:00:00 2001 From: Remy Bach Date: Sun, 14 Apr 2013 14:29:38 +0100 Subject: [PATCH 54/56] Remove NaN check so that any united value can be used (like em for example) --- jquery.superLabels.js | 8 -------- jquery.superLabels.min.js | 4 ++-- package.json | 2 +- superLabels.jquery.json | 2 +- 4 files changed, 4 insertions(+), 12 deletions(-) diff --git a/jquery.superLabels.js b/jquery.superLabels.js index f9a7ff0..a464328 100644 --- a/jquery.superLabels.js +++ b/jquery.superLabels.js @@ -41,14 +41,6 @@ // If this has been run on an empty set of elements, pop out. if (this.length === 0) { return false; } - // Remove any NaNs from the positions (if present) - if (options && options.labelLeft && isNaN(options.labelLeft)) { - options.labelLeft = Number(options.labelLeft.replace(/\D+/, '')); - } - if (options && options.labelTop && isNaN(options.labelTop)) { - options.labelTop = Number(options.labelTop.replace(/\D+/, '')); - } - // Make a copy of the defaults. _newDefaults = $.extend({}, defaults); // If options were passed in, merge them with the defaults. diff --git a/jquery.superLabels.min.js b/jquery.superLabels.min.js index dbc6d7a..c2699c7 100644 --- a/jquery.superLabels.min.js +++ b/jquery.superLabels.min.js @@ -1,10 +1,10 @@ /*! * Title: jQuery Super Labels Plugin - Give your forms a helping of awesome! * Author: Rémy Bach - * Version: 2.0.3 + * Version: 2.0.4 * License: http://remybach.mit-license.org * Url: http://github.com/remybach/jQuery.superLabels * Description: * This plugin allows you to display your form labels on top of your form fields, saving you space on your page. */ -;(function(t){"use strict";var e,a,i,s,l,n,o,r,u={autoCharLimit:!1,baseZindex:0,duration:500,easingIn:t.easing&&t.easing.def?"easeInOutCubic":!1,easingOut:t.easing&&t.easing.def?"easeInOutCubic":!1,fadeDuration:250,labelLeft:0,labelTop:0,noAnimate:!1,opacity:.5,slide:!0,wrapSelector:!1},d=["text","search","url","tel","email","password","number"],h=["input","textarea","select"];t.fn.superLabels=function(n){var o,r=[];return 0===this.length?!1:(n&&n.labelLeft&&isNaN(n.labelLeft)&&(n.labelLeft=Number(n.labelLeft.replace(/\D+/,""))),n&&n.labelTop&&isNaN(n.labelTop)&&(n.labelTop=Number(n.labelTop.replace(/\D+/,""))),o=t.extend({},u),t(this).data("slDefaults",t.extend(o,n||{})).addClass("sl-defaults"),1===this.length&&/form/i.test(this[0].tagName)?r=t(h.join(","),this):this.length>1?this.each(function(){/form/i.test(this.tagName)?t.merge(r,t(h.join(","),this)):r.push(this)}):r=this,t(r).each(function(){var n,o,r=t(this),u=r.attr("placeholder");return-1===("input"===r[0].tagName.toLowerCase()&&t.inArray(r.attr("type"),d))&&-1!==t.inArray(r[0].tagName.toLowerCase(),h)?!0:(n=e(this),u&&(0===n.length?(o='",o+="",o=t(o),n=o,r.before(n)):n.attr("title",u),r.removeAttr("placeholder")),0===n.length?!0:(a(r,n),this.tagName.match(/select/i)||(r.focus(i),r.blur(s),r.change(s),r.bind("input",l),r.bind("propertychange",s),r.keyup(l),n.click(function(){r.focus()})),void 0))}))},e=function(e){var a,i=t(e).closest(".sl-defaults").data("slDefaults"),s=t(e).siblings("label");return 0===s.length&&(i.wrapSelector?s=t(e).parents(i.wrapSelector).find("label"):(a=e.id||e.name,s=t('[for="'+a+'"]'))),s},a=function(e,a){var i,s=e.data("slCharLimit"),l=t(e).closest(".sl-defaults").data("slDefaults"),u=0;e[0].tagName.match(/select/i)?(i=0===e.find("[selected]").length?" selected":"",e.prepend('"),a.css("display","none")):(("auto"===s||l.autoCharLimit&&isNaN(s))&&r(e,a),n(e)?u=1:o(e)&&(u=l._opacity),e.css({zIndex:l.baseZindex+1}).addClass("sl_field"),a.css({left:n(e)?l.labelLeft:t(e).width()-a.width(),opacity:u,position:"absolute",top:l.labelTop,zIndex:l.baseZindex+2}).addClass("sl_label"))},i=function(){var a,i=t(this).closest(".sl-defaults").data("slDefaults"),s=i.duration,l={opacity:0};if(n(this)){if(a=e(this),i.noAnimate)return a.hide(),!1;i.slide?(l.left=t(this).width()-a.width(),l.opacity=i.opacity):s=i.fadeDuration,a.stop(!0,!1).animate(l,s,i.easingOut)}},s=function(){var a,i=t(this).closest(".sl-defaults").data("slDefaults"),s=i.duration,o={opacity:1};if(n(this)){if(a=e(this),i.noAnimate)return a.show(),!1;i.slide?o.left=i.labelLeft:s=i.fadeDuration,a.stop(!0,!1).animate(o,s,i.easingOut)}else l.apply(this)},l=function(){var a,i=t(this).closest(".sl-defaults").data("slDefaults"),s=0;return i.noAnimate?!1:(a=e(this),n(this)&&a.css("opacity")>0||!n(this)&&0===a.css("opacity")?!1:((n(this)&&0!==a.css("opacity")||o(this))&&(s=i.opacity),a.stop(!0,!1).animate({opacity:s},i.fadeDuration,i.easingOut),void 0))},n=function(e){return""===t(e).val()},o=function(e){var a=t(e).data("slCharLimit");return a&&"number"==typeof a?(e=e.length?e[0]:e,a&&e.value&&a>=e.value.length):!1},r=function(e,a){var i,s,l="1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",n=["font-family","font-size","font-weight","letter-spacing","line-height","text-shadow","text-transform"],o=t("
"+l+"
");t.each(n,function(t,a){o.css(a,e.css(a))}),o.css({position:"absolute",visibility:"hidden"}),e.parent().append(o),s=Math.round(o.width()/l.length),o.remove(),i=e.width()-a.width(),e.data("slCharLimit",Math.floor(i/s))}})(jQuery); \ No newline at end of file +;(function(t){"use strict";var e,a,i,s,n,l,o,r,d={autoCharLimit:!1,baseZindex:0,duration:500,easingIn:t.easing&&t.easing.def?"easeInOutCubic":!1,easingOut:t.easing&&t.easing.def?"easeInOutCubic":!1,fadeDuration:250,labelLeft:0,labelTop:0,noAnimate:!1,opacity:.5,slide:!0,wrapSelector:!1},u=["text","search","url","tel","email","password","number"],h=["input","textarea","select"];t.fn.superLabels=function(l){var o,r=[];return 0===this.length?!1:(o=t.extend({},d),t(this).data("slDefaults",t.extend(o,l||{})).addClass("sl-defaults"),1===this.length&&/form/i.test(this[0].tagName)?r=t(h.join(","),this):this.length>1?this.each(function(){/form/i.test(this.tagName)?t.merge(r,t(h.join(","),this)):r.push(this)}):r=this,t(r).each(function(){var l,o,r=t(this),d=r.attr("placeholder");return-1===("input"===r[0].tagName.toLowerCase()&&t.inArray(r.attr("type"),u))&&-1!==t.inArray(r[0].tagName.toLowerCase(),h)?!0:(l=e(this),d&&(0===l.length?(o='",o+="",o=t(o),l=o,r.before(l)):l.attr("title",d),r.removeAttr("placeholder")),0===l.length?!0:(a(r,l),this.tagName.match(/select/i)||(r.focus(i),r.blur(s),r.change(s),r.bind("input",n),r.bind("propertychange",s),r.keyup(n),l.click(function(){r.focus()})),void 0))}))},e=function(e){var a,i=t(e).closest(".sl-defaults").data("slDefaults"),s=t(e).siblings("label");return 0===s.length&&(i.wrapSelector?s=t(e).parents(i.wrapSelector).find("label"):(a=e.id||e.name,s=t('[for="'+a+'"]'))),s},a=function(e,a){var i,s=e.data("slCharLimit"),n=t(e).closest(".sl-defaults").data("slDefaults"),d=0;e[0].tagName.match(/select/i)?(i=0===e.find("[selected]").length?" selected":"",e.prepend('"),a.css("display","none")):(("auto"===s||n.autoCharLimit&&isNaN(s))&&r(e,a),l(e)?d=1:o(e)&&(d=n._opacity),e.css({zIndex:n.baseZindex+1}).addClass("sl_field"),a.css({left:l(e)?n.labelLeft:t(e).width()-a.width(),opacity:d,position:"absolute",top:n.labelTop,zIndex:n.baseZindex+2}).addClass("sl_label"))},i=function(){var a,i=t(this).closest(".sl-defaults").data("slDefaults"),s=i.duration,n={opacity:0};if(l(this)){if(a=e(this),i.noAnimate)return a.hide(),!1;i.slide?(n.left=t(this).width()-a.width(),n.opacity=i.opacity):s=i.fadeDuration,a.stop(!0,!1).animate(n,s,i.easingOut)}},s=function(){var a,i=t(this).closest(".sl-defaults").data("slDefaults"),s=i.duration,o={opacity:1};if(l(this)){if(a=e(this),i.noAnimate)return a.show(),!1;i.slide?o.left=i.labelLeft:s=i.fadeDuration,a.stop(!0,!1).animate(o,s,i.easingOut)}else n.apply(this)},n=function(){var a,i=t(this).closest(".sl-defaults").data("slDefaults"),s=0;return i.noAnimate?!1:(a=e(this),l(this)&&a.css("opacity")>0||!l(this)&&0===a.css("opacity")?!1:((l(this)&&0!==a.css("opacity")||o(this))&&(s=i.opacity),a.stop(!0,!1).animate({opacity:s},i.fadeDuration,i.easingOut),void 0))},l=function(e){return""===t(e).val()},o=function(e){var a=t(e).data("slCharLimit");return a&&"number"==typeof a?(e=e.length?e[0]:e,a&&e.value&&a>=e.value.length):!1},r=function(e,a){var i,s,n="1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",l=["font-family","font-size","font-weight","letter-spacing","line-height","text-shadow","text-transform"],o=t("
"+n+"
");t.each(l,function(t,a){o.css(a,e.css(a))}),o.css({position:"absolute",visibility:"hidden"}),e.parent().append(o),s=Math.round(o.width()/n.length),o.remove(),i=e.width()-a.width(),e.data("slCharLimit",Math.floor(i/s))}})(jQuery); \ No newline at end of file diff --git a/package.json b/package.json index 8fc8108..6d3ba62 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "jQuery.superLabels", - "version": "2.0.3", + "version": "2.0.4", "description": "Give your forms a helping of awesome!", "homepage": "http://remy.bach.me.uk/superlabels_demo/", "bugs": { diff --git a/superLabels.jquery.json b/superLabels.jquery.json index 1120080..2e5c0e1 100644 --- a/superLabels.jquery.json +++ b/superLabels.jquery.json @@ -1 +1 @@ -{"name":"superLabels","version":"2.0.3","title":"jQuery Super Labels","author":{"name":"Rémy Bach","url":"http://remy.bach.me.uk"},"licenses":[{"type":"MIT","url":"http://remybach.mit-license.org/"}],"dependencies":{"jquery":">=1.5"},"description":"Give your forms a helping of awesome!","keywords":["form","forms","label","labels","usability"],"homepage":"https://github.com/remybach/jQuery.superLabels","docs":"https://github.com/remybach/jQuery.superLabels","demo":"http://remy.bach.me.uk/superlabels_demo/","bugs":"https://github.com/remybach/jQuery.superLabels/issues"} \ No newline at end of file +{"name":"superLabels","version":"2.0.4","title":"jQuery Super Labels","author":{"name":"Rémy Bach","url":"http://remy.bach.me.uk"},"licenses":[{"type":"MIT","url":"http://remybach.mit-license.org/"}],"dependencies":{"jquery":">=1.5"},"description":"Give your forms a helping of awesome!","keywords":["form","forms","label","labels","usability"],"homepage":"https://github.com/remybach/jQuery.superLabels","docs":"https://github.com/remybach/jQuery.superLabels","demo":"http://remy.bach.me.uk/superlabels_demo/","bugs":"https://github.com/remybach/jQuery.superLabels/issues"} \ No newline at end of file From 051befb933777df4609a4ba9c39b1ce8431d5b4d Mon Sep 17 00:00:00 2001 From: Remy Bach Date: Tue, 28 May 2013 10:06:22 +0100 Subject: [PATCH 55/56] Add bower.json and update Grunt tasks to update version number in all *.json files. --- Gruntfile.js | 6 +++--- bower.json | 1 + tasks/checkjQueryJSON.js | 29 ----------------------------- tasks/updateVersion.js | 33 +++++++++++++++++++++++++++++++++ 4 files changed, 37 insertions(+), 32 deletions(-) create mode 100644 bower.json delete mode 100644 tasks/checkjQueryJSON.js create mode 100644 tasks/updateVersion.js diff --git a/Gruntfile.js b/Gruntfile.js index 510ab97..6e8f59e 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -53,8 +53,8 @@ module.exports = function(grunt) { checkBanner: { filename: 'jquery.superLabels.js' }, - checkjQueryJSON: { - filename: 'superLabels.jquery.json' + updateVersion: { + files: [ 'superLabels.jquery.json', 'bower.json' ] }, minify: { dest: 'jquery.superLabels.min.js', @@ -77,5 +77,5 @@ module.exports = function(grunt) { grunt.loadTasks('tasks'); // Default task - Run JS Hint, check the version in the jquery.json file matches what's in packages.json, update the banner in the superlabels file, and minify. - grunt.registerTask('default', ["jshint", "checkjQueryJSON", "checkBanner", "minify"]); + grunt.registerTask('default', ["jshint", "updateVersion", "checkBanner", "minify"]); }; \ No newline at end of file diff --git a/bower.json b/bower.json new file mode 100644 index 0000000..3f962be --- /dev/null +++ b/bower.json @@ -0,0 +1 @@ +{"name":"jQuery.superLabels","version":"2.0.4","description":"Give your forms a helping of awesome!","homepage":"http://remy.bach.me.uk/superlabels_demo/","bugs":"https://github.com/remybach/jQuery.superLabels/issues","repository":{"type":"git","url":"https://github.com/remybach/jQuery.superLabels"},"main":"jquery.superLabels.min.js","licenses":[{"type":"MIT"}]} \ No newline at end of file diff --git a/tasks/checkjQueryJSON.js b/tasks/checkjQueryJSON.js deleted file mode 100644 index d3aacc0..0000000 --- a/tasks/checkjQueryJSON.js +++ /dev/null @@ -1,29 +0,0 @@ -module.exports = function(grunt) { - 'use strict'; - - grunt.registerTask('checkjQueryJSON', 'Update the version number in the jquery.json file.', function() { - var filename; - - grunt.config.requires('checkjQueryJSON.filename'); - - filename = grunt.config('checkjQueryJSON.filename'); - - var json; - - // Warn on and remove invalid source files (if nonull was set). - if (!grunt.file.exists(filename)) { - grunt.log.warn('Source file not found at "' + filename + '"'); - return false; - } - - grunt.log.writeln('Updating Banner for: '+filename); - - json = grunt.file.readJSON(filename); - - json.version = grunt.config('meta.version'); - - grunt.file.write(filename, JSON.stringify(json)); - - grunt.log.writeln('Done updating version in: '+filename); - }); -}; \ No newline at end of file diff --git a/tasks/updateVersion.js b/tasks/updateVersion.js new file mode 100644 index 0000000..d31ce05 --- /dev/null +++ b/tasks/updateVersion.js @@ -0,0 +1,33 @@ +module.exports = function(grunt) { + 'use strict'; + + grunt.registerTask('updateVersion', 'Update the version number in all relevant *.json files.', function() { + var filename, + files, + json; + + grunt.config.requires('updateVersion.files'); + + files = grunt.config('updateVersion.files'); + + for (var i = files.length - 1; i >= 0; i--) { + filename = files[i]; + + // Warn on and remove invalid source files (if nonull was set). + if (!grunt.file.exists(filename)) { + grunt.log.warn('Source file not found at "' + filename + '"'); + return false; + } + + grunt.log.writeln('Updating Banner for: '+filename); + + json = grunt.file.readJSON(filename); + + json.version = grunt.config('meta.version'); + + grunt.file.write(filename, JSON.stringify(json)); + + grunt.log.writeln('Done updating version in: '+filename); + } + }); +}; \ No newline at end of file From ad069690554739056c084ee3b62750e6c2fb3e74 Mon Sep 17 00:00:00 2001 From: Remy Bach Date: Tue, 28 May 2013 10:11:35 +0100 Subject: [PATCH 56/56] Make the updateVersion grunt task pretty print the JSON. --- bower.json | 18 +++++++++++++++++- superLabels.jquery.json | 31 ++++++++++++++++++++++++++++++- tasks/updateVersion.js | 2 +- 3 files changed, 48 insertions(+), 3 deletions(-) diff --git a/bower.json b/bower.json index 3f962be..4d0cb64 100644 --- a/bower.json +++ b/bower.json @@ -1 +1,17 @@ -{"name":"jQuery.superLabels","version":"2.0.4","description":"Give your forms a helping of awesome!","homepage":"http://remy.bach.me.uk/superlabels_demo/","bugs":"https://github.com/remybach/jQuery.superLabels/issues","repository":{"type":"git","url":"https://github.com/remybach/jQuery.superLabels"},"main":"jquery.superLabels.min.js","licenses":[{"type":"MIT"}]} \ No newline at end of file +{ + "name": "jQuery.superLabels", + "version": "2.0.4", + "description": "Give your forms a helping of awesome!", + "homepage": "http://remy.bach.me.uk/superlabels_demo/", + "bugs": "https://github.com/remybach/jQuery.superLabels/issues", + "repository": { + "type": "git", + "url": "https://github.com/remybach/jQuery.superLabels" + }, + "main": "jquery.superLabels.min.js", + "licenses": [ + { + "type": "MIT" + } + ] +} \ No newline at end of file diff --git a/superLabels.jquery.json b/superLabels.jquery.json index 2e5c0e1..572f14a 100644 --- a/superLabels.jquery.json +++ b/superLabels.jquery.json @@ -1 +1,30 @@ -{"name":"superLabels","version":"2.0.4","title":"jQuery Super Labels","author":{"name":"Rémy Bach","url":"http://remy.bach.me.uk"},"licenses":[{"type":"MIT","url":"http://remybach.mit-license.org/"}],"dependencies":{"jquery":">=1.5"},"description":"Give your forms a helping of awesome!","keywords":["form","forms","label","labels","usability"],"homepage":"https://github.com/remybach/jQuery.superLabels","docs":"https://github.com/remybach/jQuery.superLabels","demo":"http://remy.bach.me.uk/superlabels_demo/","bugs":"https://github.com/remybach/jQuery.superLabels/issues"} \ No newline at end of file +{ + "name": "superLabels", + "version": "2.0.4", + "title": "jQuery Super Labels", + "author": { + "name": "Rémy Bach", + "url": "http://remy.bach.me.uk" + }, + "licenses": [ + { + "type": "MIT", + "url": "http://remybach.mit-license.org/" + } + ], + "dependencies": { + "jquery": ">=1.5" + }, + "description": "Give your forms a helping of awesome!", + "keywords": [ + "form", + "forms", + "label", + "labels", + "usability" + ], + "homepage": "https://github.com/remybach/jQuery.superLabels", + "docs": "https://github.com/remybach/jQuery.superLabels", + "demo": "http://remy.bach.me.uk/superlabels_demo/", + "bugs": "https://github.com/remybach/jQuery.superLabels/issues" +} \ No newline at end of file diff --git a/tasks/updateVersion.js b/tasks/updateVersion.js index d31ce05..49e28bf 100644 --- a/tasks/updateVersion.js +++ b/tasks/updateVersion.js @@ -25,7 +25,7 @@ module.exports = function(grunt) { json.version = grunt.config('meta.version'); - grunt.file.write(filename, JSON.stringify(json)); + grunt.file.write(filename, JSON.stringify(json, null, 4)); grunt.log.writeln('Done updating version in: '+filename); }