PageSourceSearch

https://westadamsheritage.org/sites/all/themes/omega/omega/js/jquery.formalize.js?qpb167

js westadamsheritage.org collected 2026-10-02 07:32:27 UTC 4,208 bytes, 140 lines download raw bytes

1/*
2  Formalize - version 1.1
3
4  Note: This file depends on the jQuery library.
5*/
6
7// Module pattern:
8// http://yuiblog.com/blog/2007/06/12/module-pattern
9var FORMALIZE = (function($, window, document, undefined) {
10  // Private constants.
11  var PLACEHOLDER_SUPPORTED = 'placeholder' in document.createElement('input');
12  var AUTOFOCUS_SUPPORTED = 'autofocus' in document.createElement('input');
13  var IE6 = !!($.browser.msie && parseInt($.browser.version, 10) === 6);
14  var IE7 = !!($.browser.msie && parseInt($.browser.version, 10) === 7);
15
16  // Expose innards of FORMALIZE.
17  return {
18    // FORMALIZE.go
19    go: function() {
20      for (var i in FORMALIZE.init) {
21        FORMALIZE.init[i]();
22      }
23    },
24    // FORMALIZE.init
25    init: {
26      // FORMALIZE.init.ie6_skin_inputs
27      ie6_skin_inputs: function() {
28        // Test for Internet Explorer 6.
29        if (!IE6 || !$('input, select, textarea').length) {
30          // Exit if the browser is not IE6,
31          // or if no form elements exist.
32          return;
33        }
34
35        // For <input type="submit" />, etc.
36        var button_regex = /button|submit|reset/;
37
38        // For <input type="text" />, etc.
39        var type_regex = /date|datetime|datetime-local|email|month|number|password|range|search|tel|text|time|url|week/;
40
41        $('input').each(function() {
42          var el = $(this);
43
44          // Is it a button?
45          if (this.getAttribute('type').match(button_regex)) {
46            el.addClass('ie6-button');
47
48            /* Is it disabled? */
49            if (this.disabled) {
50              el.addClass('ie6-button-disabled');
51            }
52          }
53          // Or is it a textual input?
54          else if (this.getAttribute('type').match(type_regex)) {
55            el.addClass('ie6-input');
56
57            /* Is it disabled? */
58            if (this.disabled) {
59              el.addClass('ie6-input-disabled');
60            }
61          }
62        });
63
64        $('textarea, select').each(function() {
65          /* Is it disabled? */
66          if (this.disabled) {
67            $(this).addClass('ie6-input-disabled');
68          }
69        });
70      },
71      // FORMALIZE.init.autofocus
72      autofocus: function() {
73        if (AUTOFOCUS_SUPPORTED || !$(':input[autofocus]').length) {
74          return;
75        }
76
77        $(':input[autofocus]:visible:first').focus();
78      },
79      // FORMALIZE.init.placeholder
80      placeholder: function() {
81        if (PLACEHOLDER_SUPPORTED || !$(':input[placeholder]').length) {
82          // Exit if placeholder is supported natively,
83          // or if page does not have any placeholder.
84          return;
85        }
86
87        FORMALIZE.misc.add_placeholder();
88
89        $(':input[placeholder]').each(function() {
90          var el = $(this);
91          var text = el.attr('placeholder');
92
93          el.focus(function() {
94            if (el.val() === text) {
95              el.val('').removeClass('placeholder-text');
96            }
97          }).blur(function() {
98            FORMALIZE.misc.add_placeholder();
99          });
100
101          // Prevent <form> from accidentally
102          // submitting the placeholder text.
103          el.closest('form').submit(function() {
104            if (el.val() === text) {
105              el.val('').removeClass('placeholder-text');
106            }
107          }).bind('reset', function() {
108            setTimeout(FORMALIZE.misc.add_placeholder, 50);
109          });
110        });
111      }
112    },
113    // FORMALIZE.misc
114    misc: {
115      // FORMALIZE.misc.add_placeholder
116      add_placeholder: function() {
117        if (PLACEHOLDER_SUPPORTED || !$(':input[placeholder]').length) {
118          // Exit if placeholder is supported natively,
119          // or if page does not have any placeholder.
120          return;
121        }
122
123        $(':input[placeholder]').each(function() {
124          var el = $(this);
125          var text = el.attr('placeholder');
126
127          if (!el.val() || el.val() === text) {
128            el.val(text).addClass('placeholder-text');
129          }
130        });
131      }
132    }
133  };
134// Alias jQuery, window, document.
135})(jQuery, this, this.document);
136
137// Automatically calls all functions in FORMALIZE.init
138jQuery(document).ready(function() {
139  FORMALIZE.go();
140});

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.