PageSourceSearch

https://site.geoedge.com/js/jquery.simpleplaceholder.js

js geoedge.com collected 2026-09-24 17:12:58 UTC 2,102 bytes, 69 lines download raw bytes

1/*
2 * Simple Placeholder by @marcgg under MIT License
3 * Report bugs or contribute on Gihub: https://github.com/marcgg/Simple-Placeholder
4*/
5
6(function($) {
7  $.simplePlaceholder = {
8    placeholderClass: null,
9
10    hidePlaceholder: function(){
11      var $this = $(this);
12      if($this.val() == $this.attr('placeholder') && $this.data($.simplePlaceholder.placeholderData)){
13        $this
14          .val("")
15          .removeClass($.simplePlaceholder.placeholderClass)
16          .data($.simplePlaceholder.placeholderData, false);
17      }
18    },
19
20    showPlaceholder: function(){
21      var $this = $(this);
22      if($this.val() == ""){
23        $this
24          .val($this.attr('placeholder'))
25          .addClass($.simplePlaceholder.placeholderClass)
26          .data($.simplePlaceholder.placeholderData, true);
27      }
28    },
29
30    preventPlaceholderSubmit: function(){
31      $(this).find(".simple-placeholder").each(function(e){
32        var $this = $(this);
33        if($this.val() == $this.attr('placeholder') && $this.data($.simplePlaceholder.placeholderData)){
34          $this.val('');
35        }
36      });
37      return true;
38    }
39  };
40
41  $.fn.simplePlaceholder = function(options) {
42    if(document.createElement('input').placeholder == undefined){
43      var config = {
44        placeholderClass : 'placeholding',
45        placeholderData : 'simplePlaceholder.placeholding'
46      };
47
48      if(options) $.extend(config, options);
49      $.extend($.simplePlaceholder, config);
50
51      this.each(function() {
52        var $this = $(this);
53        $this.focus($.simplePlaceholder.hidePlaceholder);
54        $this.blur($.simplePlaceholder.showPlaceholder);
55        $this.data($.simplePlaceholder.placeholderData, false);
56        if($this.val() == '') {
57          $this.val($this.attr("placeholder"));
58          $this.addClass($.simplePlaceholder.placeholderClass);
59          $this.data($.simplePlaceholder.placeholderData, true);
60        }
61        $this.addClass("simple-placeholder");
62        $(this.form).submit($.simplePlaceholder.preventPlaceholderSubmit);
63      });
64    }
65
66    return this;
67  };
68
69})(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.