PageSourceSearch

https://klokkerholm.com/x/js/updnWatermark.js

js klokkerholm.com collected 2026-10-08 14:37:05 UTC 2,135 bytes, 54 lines download raw bytes

1(function($) {
2    $.fn.updnWatermark = function(options) {
3        options = $.extend({}, $.fn.updnWatermark.defaults, options);
4        return this.each(function() {
5            var $input = $(this);
6            // Checks to see if watermark already applied.
7            var $watermark = $input.data("updnWatermark");
8            // Only create watermark if title attribute exists
9            if (!$watermark && this.title) {
10                // Inserts a span and set as positioning context
11                var $watermark = $("<span/>")
12        					.addClass(options.cssClass)
13                    .insertBefore(this)
14                    .hide()
15        					.bind("show", function() {
16                      $(this).children().fadeIn("fast");
17                  })
18                  .bind("hide", function() {
19                      $(this).children().hide();
20                  });
21      				// Positions watermark label relative to positioning context
22      				$("<label/>").appendTo($watermark)
23                  .text("" + this.title + "")
24                  .attr("for", this.id);
25      				// Associate input element with watermark plugin.
26              $input.data("updnWatermark", $watermark);
27            }
28            // Hook up blur/focus handlers to show/hide watermark.
29            if ($watermark) {
30                $input
31                    .focus(function(ev) {
32                        $watermark.trigger("hide");
33                    })
34                    .blur(function(ev) {
35                        if (!$(this).val()) {
36                            $watermark.trigger("show");
37                        }
38                    });
39                // Sets initial watermark state.
40                if (!$input.val()) {
41                    $watermark.show();
42                }
43            }
44        });
45    };
46    $.fn.updnWatermark.defaults = {
47        cssClass: "updnWatermark"
48    };
49    $.updnWatermark = {
50        attachAll: function(options) {
51			    $("input:text[title!=''],input:password[title!=''],textarea").updnWatermark(options);
52        }
53    };
54})(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.