lib/assets/jzip/jquery/seat_holder.js in rich_i18n-1.2.2 vs lib/assets/jzip/jquery/seat_holder.js in rich_i18n-1.2.3

- old
+ new

@@ -1,31 +1,32 @@ if (typeof(SeatHolder) == "undefined") { // * -// * SeatHolder 0.8.7 (Uncompressed) +// * SeatHolder 0.8.8 (Uncompressed) // * The modest Javascript placeholder (used in http://gettopup.com) // * // * This library requires jQuery (http://jquery.com) // * // * (c) 2010 Paul Engel (Internetbureau Holder B.V.) // * Except otherwise noted, SeatHolder is licensed under // * http://creativecommons.org/licenses/by-sa/3.0 // * -// * $Date: 2010-09-01 23:14:04 +0100 (Wed, 01 September 2010) $ +// * $Date: 2010-10-19 23:23:28 +0100 (Tue, 19 October 2010) $ // * SeatHolder = (function() { - var hintClass = "sh_hint", hideClass = "sh_hide", ignored_types = ["file", "submit"]; + var hintClass = "sh_hint", hideClass = "sh_hide", ignored_types = ["file", "submit"], reacting = true; var injectCode = function() { var style = "<style>" + "." + hintClass + " { color: " + SeatHolder.hintColor +" !important } " + "." + hideClass + " { display: none !important }" + "</style>"; jQuery(style).prependTo("head"); }; + var bind = function() { var hintedElements = []; jQuery.each(jQuery(SeatHolder.selector), function(i, element) { element = jQuery(element); @@ -79,18 +80,31 @@ hintElement.val(element.attr("seatholder")); onBlur(null, element); }); }; + var react = function(bool) { + reacting = typeof(bool) == "undefined" ? true : bool; + }; + var onHintFocus = function(event) { + if (!reacting) { + return; + } + var hintElement = jQuery(event.target).addClass(hideClass); hintElement.data("hinted_element") .removeClass(hideClass) .focus(); }; + var onFocus = function(event) { + if (!reacting) { + return; + } + var element = jQuery(event.target); var seatholder = element.attr("seatholder"); if (element.val() == seatholder.replace(/^&/, "")) { element.val(""); @@ -105,10 +119,11 @@ oRange.select(); } else if (input.setSelectionRange) { input.setSelectionRange(0, element.val().length); } }; + var onBlur = function(event, element) { if (element == null) { element = jQuery(event.target); } @@ -133,11 +148,11 @@ hintElement.removeClass(hideClass); } }; return { - version: "0.8.7", + version: "0.8.8", selector: "[seatholder]", hintColor: "#AAA", init: function() { if (typeof(onSeatHolderReady) == "function") { onSeatHolderReady(); @@ -145,12 +160,11 @@ jQuery(document).ready(function() { injectCode(); bind(); }); }, - rebind: function() { - bind(); - } + rebind: bind, + react: react }; }()); (function requireMissingLibs() { var missing_libs = [];