Sha256: 73b9e53c5a54fed62b5abc124c5d6ec5c58d595e034ed1c7c883be735b7c5699

Contents?: true

Size: 1.17 KB

Versions: 87

Compression:

Stored size: 1.17 KB

Contents

(function($) {

  var Placeholder = {

     _PLACEHOLDERS : [],

    _p : function( $field ) {

       this.fieldObject = $field;
       this.placeholderText = $field.val();
       var placeholderText = $field.val();

       $field.addClass('ph');

       $field.blur(function() {
         if ( $(this).val() == '' ) {
           $(this).val( placeholderText );
           $(this).addClass('ph');
         }
       });

       $field.focus(function() {
         $(this).removeClass('ph');
         if ( $(this).val() == placeholderText ) {
           $(this).val('');
         } else {
           $(this)[0].select();
         }
       });

     },

     add : function( $field ) {
       Placeholder._PLACEHOLDERS.push( new Placeholder._p( $field ) );
     },

     clearAll: function() {
       for ( var i=0; i < Placeholder._PLACEHOLDERS.length; i++ ) {
         if ( Placeholder._PLACEHOLDERS[i].fieldObject.val() ==
              Placeholder._PLACEHOLDERS[i].placeholderText ) {
           Placeholder._PLACEHOLDERS[i].fieldObject.val('');
         }
       }
     },

     exists : function() {
       return ( _PLACEHOLDERS.length );
     }

 };

 $.GollumPlaceholder = Placeholder;

})(jQuery);

Version data entries

87 entries across 87 versions & 2 rubygems

Version Path
gollum-2.4.12 lib/gollum/public/gollum/javascript/gollum.placeholder.js
gollum-2.4.11 lib/gollum/frontend/public/gollum/javascript/gollum.placeholder.js
gollum-2.4.10 lib/gollum/frontend/public/gollum/javascript/gollum.placeholder.js
gollum-2.4.9 lib/gollum/frontend/public/gollum/javascript/gollum.placeholder.js
gollum-2.4.8 lib/gollum/frontend/public/gollum/javascript/gollum.placeholder.js
gollum-2.4.7 lib/gollum/frontend/public/gollum/javascript/gollum.placeholder.js
gollum-2.4.6 lib/gollum/frontend/public/gollum/javascript/gollum.placeholder.js
gollum-2.4.5 lib/gollum/frontend/public/gollum/javascript/gollum.placeholder.js
gollum-2.4.4 lib/gollum/frontend/public/gollum/javascript/gollum.placeholder.js
gollum-2.4.3 lib/gollum/frontend/public/gollum/javascript/gollum.placeholder.js
gollum-2.4.2 lib/gollum/frontend/public/gollum/javascript/gollum.placeholder.js
gollum-2.4.1 lib/gollum/frontend/public/gollum/javascript/gollum.placeholder.js
gollum-2.4.0 lib/gollum/frontend/public/gollum/javascript/gollum.placeholder.js
gollum-2.3.12 lib/gollum/frontend/public/gollum/javascript/gollum.placeholder.js
gollum-2.3.11 lib/gollum/frontend/public/gollum/javascript/gollum.placeholder.js
gollum-2.3.10 lib/gollum/frontend/public/gollum/javascript/gollum.placeholder.js
gollum-2.3.9 lib/gollum/frontend/public/gollum/javascript/gollum.placeholder.js
gollum-2.3.8 lib/gollum/frontend/public/gollum/javascript/gollum.placeholder.js
gollum-2.3.7 lib/gollum/frontend/public/gollum/javascript/gollum.placeholder.js
gollum-2.3.6 lib/gollum/frontend/public/gollum/javascript/gollum.placeholder.js