﻿/*! http://mths.be/placeholder v1.8.6 by @mathias */
(function (e, g, $) { var a = 'placeholder' in g.createElement('input'), c = 'placeholder' in g.createElement('textarea'), h = $.fn, i; if (a && c) { i = h.placeholder = function () { return this }; i.input = i.textarea = true } else { i = h.placeholder = function () { return this.filter((a ? 'textarea' : ':input') + '[placeholder]').not('.placeholder').bind('focus.placeholder', b).bind('blur.placeholder', d).trigger('blur.placeholder').end() }; i.input = a; i.textarea = c; $(function () { $('form').bind('submit.placeholder', function () { var j = $('.placeholder', this).each(b); setTimeout(function () { j.each(d) }, 10) }) }); $(e).bind('unload.placeholder', function () { $('.placeholder').val('') }) } function f(k) { var j = {}, l = /^jQuery\d+$/; $.each(k.attributes, function (n, m) { if (m.specified && !l.test(m.name)) { j[m.name] = m.value } }); return j } function b() { var j = $(this); if (j.val() === j.attr('placeholder') && j.hasClass('placeholder')) { if (j.data('placeholder-password')) { j.hide().next().show().focus().attr('id', j.removeAttr('id').data('placeholder-id')) } else { j.val('').removeClass('placeholder') } } } function d() { var n, m = $(this), j = m, l = this.id; if (m.val() === '') { if (m.is(':password')) { if (!m.data('placeholder-textinput')) { try { n = m.clone().attr({ type: 'text' }) } catch (k) { n = $('<input>').attr($.extend(f(this), { type: 'text' })) } n.removeAttr('name').data('placeholder-password', true).data('placeholder-id', l).bind('focus.placeholder', b); m.data('placeholder-textinput', n).data('placeholder-id', l).before(n) } m = m.removeAttr('id').hide().prev().attr('id', l).show() } m.addClass('placeholder').val(m.attr('placeholder')) } else { m.removeClass('placeholder') } } } (this, document, jQuery));
