1 /*! http://mths.be/placeholder v2.0.8 by @mathias */
4 var b
= {}, d
= /^jQuery\d+$/;
5 return c
.each(a
.attributes
, function (a
, c
) {
6 c
.specified
&& !d
.test(c
.name
) && (b
[c
.name
] = c
.value
)
11 var d
= this, e
= c(d
);
12 if (d
.value
== e
.attr("placeholder") && e
.hasClass("placeholder"))if (e
.data("placeholder-password")) {
13 if (e
= e
.hide().next().show().attr("id", e
.removeAttr("id").data("placeholder-id")), a
=== !0)return e
[0].value
= b
;
15 } else d
.value
= "", e
.removeClass("placeholder"), d
== g() && d
.select()
19 var a
, b
= this, f
= c(b
), g
= this.id
;
21 if ("password" == b
.type
) {
22 if (!f
.data("placeholder-textinput")) {
24 a
= f
.clone().attr({type
: "text"})
26 a
= c("<input>").attr(c
.extend(d(this), {type
: "text"}))
28 a
.removeAttr("name").data({
29 "placeholder-password": f
,
31 }).bind("focus.placeholder", e
), f
.data({"placeholder-textinput": a
, "placeholder-id": g
}).before(a
)
33 f
= f
.removeAttr("id").hide().prev().attr("id", g
).show()
35 f
.addClass("placeholder"), f
[0].value
= f
.attr("placeholder")
36 } else f
.removeClass("placeholder")
41 return b
.activeElement
46 var h
, i
, j
= "[object OperaMini]" == Object
.prototype.toString
.call(a
.operamini
), k
= "placeholder"in b
.createElement("input") && !j
, l
= "placeholder"in b
.createElement("textarea") && !j
, m
= c
.fn
, n
= c
.valHooks
, o
= c
.propHooks
;
47 k
&& l
? (i
= m
.placeholder = function () {
49 }, i
.input
= i
.textarea
= !0) : (i
= m
.placeholder = function () {
51 return a
.filter((k
? "textarea" : ":input") + "[placeholder]").not(".placeholder").bind({
52 "focus.placeholder": e
,
54 }).data("placeholder-enabled", !0).trigger("blur.placeholder"), a
55 }, i
.input
= k
, i
.textarea
= l
, h
= {
57 var b
= c(a
), d
= b
.data("placeholder-password");
58 return d
? d
[0].value
: b
.data("placeholder-enabled") && b
.hasClass("placeholder") ? "" : a
.value
59 }, set: function (a
, b
) {
60 var d
= c(a
), h
= d
.data("placeholder-password");
61 return h
? h
[0].value
= b
: d
.data("placeholder-enabled") ? ("" == b
? (a
.value
= b
, a
!= g() && f
.call(a
)) : d
.hasClass("placeholder") ? e
.call(a
, !0, b
) || (a
.value
= b
) : a
.value
= b
, d
) : a
.value
= b
63 }, k
|| (n
.input
= h
, o
.value
= h
), l
|| (n
.textarea
= h
, o
.value
= h
), c(function () {
64 c(b
).delegate("form", "submit.placeholder", function () {
65 var a
= c(".placeholder", this).each(e
);
66 setTimeout(function () {
70 }), c(a
).bind("beforeunload.placeholder", function () {
71 c(".placeholder").each(function () {
75 }(this, document
, jQuery
);