1/* 2* Placeholder plugin for jQuery 3* --- 4* Copyright 2010, Daniel Stocks (http://webcloud.se) 5* Released under the MIT, BSD, and GPL Licenses. 6*/ 7 8(function (b) { 9 function d(a) { 10 this.input = a; a.attr("type") == "password" && this.handlePassword(); b(a[0].form).submit(function () { if (a.hasClass("placeholder") && a[0].value == a.attr("placeholder")) a[0].value = "" }) 11 } 12 d.prototype = { 13 show: function (a) { 14 if (this.input[0].value === "" || a && this.valueIsPlaceholder()) { 15 if (this.isPassword) 16 try { 17 this.input[0].setAttribute("type", "text") 18 } 19 catch (b) { 20 this.input.before(this.fakePassword.show()).hide() 21 } 22 this.input.addClass("placeholder"); this.input[0].value = this.input.attr("placeholder") 23 } 24 }, 25 hide: function () { 26 if (this.valueIsPlaceholder() && this.input.hasClass("placeholder") && (this.input.removeClass("placeholder"), this.input[0].value = "", this.isPassword)) { 27 try { 28 this.input[0].setAttribute("type", "password") 29 } 30 catch (a) { } 31 this.input.show(); this.input[0].focus() 32 } 33 }, 34 valueIsPlaceholder: function () { 35 return this.input[0].value == this.input.attr("placeholder") 36 }, 37 handlePassword: function () { 38 var a = this.input; a.attr("realType", "password"); this.isPassword = !0; 39 if (b.browser.msie && a[0].outerHTML) { 40 var c = b(a[0].outerHTML.replace(/type=(['"])?password\1/gi, "type=$1text$1")); 41 this.fakePassword = c.val(a.attr("placeholder")).addClass("placeholder").focus(function () { 42 a.trigger("focus"); b(this).hide() 43 }); b(a[0].form).submit(function () { c.remove(); a.show() }) 44 } 45 } 46 }; 47 var e = !!("placeholder" in document.createElement("input")); 48 b.fn.placeholder = function () { 49 return e ? this : this.each(function () { 50 var a = b(this), c = new d(a); 51 c.show(!0); 52 a.focus(function () { c.hide() }); 53 a.blur(function () { c.show(!1) }); 54 b.browser.msie && (b(window).load(function () { 55 a.val() && a.removeClass("placeholder"); c.show(!0) 56 }), 57a.focus(function () { 58 if (this.value == "") { 59 var a = this.createTextRange(); a.collapse(!0); a.moveStart("character", 0); a.select() 60 } 61})) 62 }) 63 } 64})(jQuery);
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.