1/* 2* jQuery Form Example Plugin 1.4.2 3* Populate form inputs with example text that disappears on focus. 4* 5* e.g. 6* $('input#name').example('Bob Smith'); 7* $('input[@title]').example(function() { 8* return $(this).attr('title'); 9* }); 10* $('textarea#message').example('Type your message here', { 11* className: 'example_text' 12* }); 13* 14* Copyright (c) Paul Mucur (http://mucur.name), 2007-2008. 15* Dual-licensed under the BSD (BSD-LICENSE.txt) and GPL (GPL-LICENSE.txt) 16* licenses. 17* 18* This program is free software; you can redistribute it and/or modify 19* it under the terms of the GNU General Public License as published by 20* the Free Software Foundation; either version 2 of the License, or 21* (at your option) any later version. 22* 23* This program is distributed in the hope that it will be useful, 24* but WITHOUT ANY WARRANTY; without even the implied warranty of 25* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 26* GNU General Public License for more details. 27*/ 28(function(a){a.fn.example=function(e,c){var d=a.isFunction(e);var b=a.extend({},c,{example:e});return this.each(function(){var f=a(this);if(a.metadata){var g=a.extend({},a.fn.example.defaults,f.metadata(),b)}else{var g=a.extend({},a.fn.example.defaults,b)}if(!a.fn.example.boundClassNames[g.className]){a(window).unload(function(){a("."+g.className).val("")});a("form").submit(function(){a(this).find("."+g.className).val("")});a.fn.example.boundClassNames[g.className]=true}if(a.browser.msie&&!f.attr("defaultValue")&&(d||f.val()==g.example)){f.val("")}if(f.val()==""&&this!=document.activeElement){f.addClass(g.className);f.val(d?g.example.call(this):g.example)}f.focus(function(){if(a(this).is("."+g.className)){a(this).val("");a(this).removeClass(g.className)}});f.change(function(){if(a(this).is("."+g.className)){a(this).removeClass(g.className)}});f.blur(function(){if(a(this).val()==""){a(this).addClass(g.className);a(this).val(d?g.example.call(this):g.example)}})})};a.fn.example.defaults={className:"example"};a.fn.example.boundClassNames=[]})(jQuery); 29
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.