compass_formalize 0.0.4 → 0.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +1 -0
- data/CHANGELOG.md +5 -4
- data/README.md +31 -0
- data/compass_formalize.gemspec +2 -2
- data/stylesheets/_formalize.sass +226 -170
- data/templates/{dojo → common}/button.png +0 -0
- data/templates/{dojo → common}/select_arrow.gif +0 -0
- data/templates/dojo/dojo.formalize.js +46 -19
- data/templates/dojo/dojo.formalize.min.js +1 -1
- data/templates/dojo/manifest.rb +5 -0
- data/templates/extjs/extjs.formalize.js +48 -25
- data/templates/extjs/extjs.formalize.min.js +1 -1
- data/templates/jquery-legacy/jquery.formalize.legacy.js +187 -0
- data/templates/jquery-legacy/jquery.formalize.legacy.min.js +1 -0
- data/templates/jquery-legacy/manifest.rb +42 -0
- data/templates/jquery/jquery.formalize.js +42 -20
- data/templates/jquery/jquery.formalize.min.js +1 -1
- data/templates/jquery/manifest.rb +6 -1
- data/templates/mootools/manifest.rb +5 -0
- data/templates/mootools/mootools.formalize.js +49 -20
- data/templates/mootools/mootools.formalize.min.js +1 -1
- data/templates/prototype/manifest.rb +5 -0
- data/templates/prototype/prototype.formalize.js +43 -23
- data/templates/prototype/prototype.formalize.min.js +1 -1
- data/templates/yui/manifest.rb +5 -0
- data/templates/yui/yui.formalize.js +57 -43
- data/templates/yui/yui.formalize.min.js +1 -1
- metadata +11 -40
- data/templates/extjs/button.png +0 -0
- data/templates/extjs/select_arrow.gif +0 -0
- data/templates/jquery/button.png +0 -0
- data/templates/jquery/select_arrow.gif +0 -0
- data/templates/mootools/button.png +0 -0
- data/templates/mootools/select_arrow.gif +0 -0
- data/templates/prototype/button.png +0 -0
- data/templates/prototype/select_arrow.gif +0 -0
- data/templates/yui/button.png +0 -0
- data/templates/yui/select_arrow.gif +0 -0
| 
            File without changes
         | 
| 
            File without changes
         | 
| @@ -1,36 +1,47 @@ | |
| 1 | 
            -
             | 
| 2 | 
            -
             | 
| 3 | 
            -
             | 
| 1 | 
            +
            /*
         | 
| 2 | 
            +
              Formalize - version 1.2
         | 
| 3 | 
            +
             | 
| 4 | 
            +
              Note: This file depends on the Dojo library.
         | 
| 5 | 
            +
            */
         | 
| 4 6 |  | 
| 5 7 | 
             
            // Module pattern:
         | 
| 6 | 
            -
            // http://yuiblog.com/blog/2007/06/12/module-pattern | 
| 8 | 
            +
            // http://yuiblog.com/blog/2007/06/12/module-pattern
         | 
| 7 9 | 
             
            var FORMALIZE = (function(window, document, undefined) {
         | 
| 10 | 
            +
              // Internet Explorer detection.
         | 
| 11 | 
            +
              function IE(version) {
         | 
| 12 | 
            +
                var b = document.createElement('b');
         | 
| 13 | 
            +
                b.innerHTML = '<!--[if IE ' + version + ']><br><![endif]-->';
         | 
| 14 | 
            +
                return !!b.getElementsByTagName('br').length;
         | 
| 15 | 
            +
              }
         | 
| 16 | 
            +
             | 
| 8 17 | 
             
              // Private constants.
         | 
| 9 18 | 
             
              var PLACEHOLDER_SUPPORTED = 'placeholder' in document.createElement('input');
         | 
| 10 19 | 
             
              var AUTOFOCUS_SUPPORTED = 'autofocus' in document.createElement('input');
         | 
| 11 | 
            -
              var  | 
| 12 | 
            -
              var  | 
| 13 | 
            -
              var IE7 = parseInt(dojo.isIE, 10) === 7;
         | 
| 20 | 
            +
              var IE6 = IE(6);
         | 
| 21 | 
            +
              var IE7 = IE(7);
         | 
| 14 22 |  | 
| 15 23 | 
             
              // Expose innards of FORMALIZE.
         | 
| 16 24 | 
             
              return {
         | 
| 17 25 | 
             
                // FORMALIZE.go
         | 
| 18 26 | 
             
                go: function() {
         | 
| 19 | 
            -
                   | 
| 20 | 
            -
             | 
| 27 | 
            +
                  var i, j = this.init;
         | 
| 28 | 
            +
             | 
| 29 | 
            +
                  for (i in j) {
         | 
| 30 | 
            +
                    j.hasOwnProperty(i) && j[i]();
         | 
| 21 31 | 
             
                  }
         | 
| 22 32 | 
             
                },
         | 
| 23 33 | 
             
                // FORMALIZE.init
         | 
| 24 34 | 
             
                init: {
         | 
| 25 | 
            -
                  // FORMALIZE.init. | 
| 26 | 
            -
                   | 
| 27 | 
            -
                     | 
| 28 | 
            -
                       | 
| 29 | 
            -
             | 
| 30 | 
            -
             | 
| 31 | 
            -
             | 
| 32 | 
            -
             | 
| 33 | 
            -
             | 
| 35 | 
            +
                  // FORMALIZE.init.disable_link_button
         | 
| 36 | 
            +
                  disable_link_button: function() {
         | 
| 37 | 
            +
                    dojo.connect(document.documentElement, 'click', function(ev) {
         | 
| 38 | 
            +
                      var el = ev.target;
         | 
| 39 | 
            +
                      var is_disabled = el.tagName.toLowerCase() === 'a' && el.className.match('button_disabled');
         | 
| 40 | 
            +
             | 
| 41 | 
            +
                      if (is_disabled) {
         | 
| 42 | 
            +
                        ev.preventDefault();
         | 
| 43 | 
            +
                      }
         | 
| 44 | 
            +
                    });
         | 
| 34 45 | 
             
                  },
         | 
| 35 46 | 
             
                  // FORMALIZE.init.full_input_size
         | 
| 36 47 | 
             
                  full_input_size: function() {
         | 
| @@ -98,7 +109,11 @@ var FORMALIZE = (function(window, document, undefined) { | |
| 98 109 | 
             
                      return;
         | 
| 99 110 | 
             
                    }
         | 
| 100 111 |  | 
| 101 | 
            -
                    dojo.query('[autofocus]')[0] | 
| 112 | 
            +
                    var el = dojo.query('[autofocus]')[0];
         | 
| 113 | 
            +
             | 
| 114 | 
            +
                    if (!el.disabled) {
         | 
| 115 | 
            +
                      el.focus();
         | 
| 116 | 
            +
                    }
         | 
| 102 117 | 
             
                  },
         | 
| 103 118 | 
             
                  // FORMALIZE.init.placeholder
         | 
| 104 119 | 
             
                  placeholder: function() {
         | 
| @@ -111,6 +126,12 @@ var FORMALIZE = (function(window, document, undefined) { | |
| 111 126 | 
             
                    FORMALIZE.misc.add_placeholder();
         | 
| 112 127 |  | 
| 113 128 | 
             
                    dojo.query('[placeholder]').forEach(function(el) {
         | 
| 129 | 
            +
                      // Placeholder obscured in older browsers,
         | 
| 130 | 
            +
                      // so there's no point adding to password.
         | 
| 131 | 
            +
                      if (el.type === 'password') {
         | 
| 132 | 
            +
                        return;
         | 
| 133 | 
            +
                      }
         | 
| 134 | 
            +
             | 
| 114 135 | 
             
                      dojo.connect(el, 'onfocus', function() {
         | 
| 115 136 | 
             
                        var text = el.getAttribute('placeholder');
         | 
| 116 137 |  | 
| @@ -156,6 +177,12 @@ var FORMALIZE = (function(window, document, undefined) { | |
| 156 177 | 
             
                    }
         | 
| 157 178 |  | 
| 158 179 | 
             
                    dojo.query('[placeholder]').forEach(function(el) {
         | 
| 180 | 
            +
                      // Placeholder obscured in older browsers,
         | 
| 181 | 
            +
                      // so there's no point adding to password.
         | 
| 182 | 
            +
                      if (el.type === 'password') {
         | 
| 183 | 
            +
                        return;
         | 
| 184 | 
            +
                      }
         | 
| 185 | 
            +
             | 
| 159 186 | 
             
                      var text = el.getAttribute('placeholder');
         | 
| 160 187 |  | 
| 161 188 | 
             
                      if (!el.value || el.value === text) {
         | 
| @@ -1 +1 @@ | |
| 1 | 
            -
            var FORMALIZE=function( | 
| 1 | 
            +
            var FORMALIZE=function(e,t,n){function r(e){var n=t.createElement("b");return n.innerHTML="<!--[if IE "+e+"]><br><![endif]-->",!!n.getElementsByTagName("br").length}var i="placeholder"in t.createElement("input"),s="autofocus"in t.createElement("input"),o=r(6),u=r(7);return{go:function(){var e,t=this.init;for(e in t)t.hasOwnProperty(e)&&t[e]()},init:{disable_link_button:function(){dojo.connect(t.documentElement,"click",function(e){var t=e.target,n=t.tagName.toLowerCase()==="a"&&t.className.match("button_disabled");n&&e.preventDefault()})},full_input_size:function(){if(!u||!dojo.query("textarea, input.input_full").length)return;dojo.query("textarea, input.input_full").forEach(function(e){var n=e.cloneNode(!1),r=t.createElement("span");r.className="input_full_wrap",r.appendChild(n),e.parentNode.replaceChild(r,e)})},ie6_skin_inputs:function(){if(!o||!dojo.query("input, select, textarea").length)return;var e=/button|submit|reset/,t=/date|datetime|datetime-local|email|month|number|password|range|search|tel|text|time|url|week/;dojo.query("input").forEach(function(n){n.getAttribute("type").match(e)?(dojo.addClass(n,"ie6_button"),n.disabled&&dojo.addClass(n,"ie6_button_disabled")):n.getAttribute("type").match(t)&&(dojo.addClass(n,"ie6_input"),n.disabled&&dojo.addClass(n,"ie6_input_disabled"))}),dojo.query("textarea, select").forEach(function(e){e.disabled&&dojo.addClass(e,"ie6_input_disabled")})},autofocus:function(){if(s||!dojo.query("[autofocus]").length)return;var e=dojo.query("[autofocus]")[0];e.disabled||e.focus()},placeholder:function(){if(i||!dojo.query("[placeholder]").length)return;FORMALIZE.misc.add_placeholder(),dojo.query("[placeholder]").forEach(function(e){if(e.type==="password")return;dojo.connect(e,"onfocus",function(){var t=e.getAttribute("placeholder");e.value===t&&(e.value="",dojo.removeClass(e,"placeholder_text"))}),dojo.connect(e,"onblur",function(){FORMALIZE.misc.add_placeholder()})}),dojo.query("form").forEach(function(e){dojo.connect(e,"onsubmit",function(){dojo.query("[placeholder]",e).forEach(function(e){var t=e.getAttribute("placeholder");e.value===t&&(e.value="",dojo.removeClass(e,"placeholder_text"))})}),dojo.connect(e,"onreset",function(){setTimeout(FORMALIZE.misc.add_placeholder,50)})})}},misc:{add_placeholder:function(){if(i||!dojo.query("[placeholder]").length)return;dojo.query("[placeholder]").forEach(function(e){if(e.type==="password")return;var t=e.getAttribute("placeholder");if(!e.value||e.value===t)e.value=t,dojo.addClass(e,"placeholder_text")})}}}}(this,this.document);dojo.addOnLoad(function(){FORMALIZE.go()})
         | 
    
        data/templates/dojo/manifest.rb
    CHANGED
    
    | @@ -1,4 +1,9 @@ | |
| 1 1 | 
             
            # Make sure you list all the project template files here in the manifest.
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            # Image Import
         | 
| 4 | 
            +
            file '../common/button.png', :like => :image, :to => 'button.png'
         | 
| 5 | 
            +
            file '../common/select_arrow.gif', :like => :image, :to => 'select_arrow.gif'
         | 
| 6 | 
            +
             | 
| 2 7 | 
             
            discover :all
         | 
| 3 8 |  | 
| 4 9 | 
             
            description "Teach your forms some manners."
         | 
| @@ -1,33 +1,47 @@ | |
| 1 | 
            -
             | 
| 2 | 
            -
             | 
| 3 | 
            -
             | 
| 1 | 
            +
            /*
         | 
| 2 | 
            +
              Formalize - version 1.2
         | 
| 3 | 
            +
             | 
| 4 | 
            +
              Note: This file depends on the ExtJS 3.x library.
         | 
| 5 | 
            +
            */
         | 
| 6 | 
            +
             | 
| 7 | 
            +
            // Module pattern:
         | 
| 8 | 
            +
            // http://yuiblog.com/blog/2007/06/12/module-pattern
         | 
| 4 9 | 
             
            var FORMALIZE = (function(window, document, undefined) {
         | 
| 10 | 
            +
              // Internet Explorer detection.
         | 
| 11 | 
            +
              function IE(version) {
         | 
| 12 | 
            +
                var b = document.createElement('b');
         | 
| 13 | 
            +
                b.innerHTML = '<!--[if IE ' + version + ']><br><![endif]-->';
         | 
| 14 | 
            +
                return !!b.getElementsByTagName('br').length;
         | 
| 15 | 
            +
              }
         | 
| 16 | 
            +
             | 
| 5 17 | 
             
              // Private constants.
         | 
| 6 18 | 
             
              var PLACEHOLDER_SUPPORTED = 'placeholder' in document.createElement('input');
         | 
| 7 19 | 
             
              var AUTOFOCUS_SUPPORTED = 'autofocus' in document.createElement('input');
         | 
| 8 | 
            -
              var  | 
| 9 | 
            -
              var  | 
| 10 | 
            -
              var IE7 = Ext.isIE7;
         | 
| 20 | 
            +
              var IE6 = IE(6);
         | 
| 21 | 
            +
              var IE7 = IE(7);
         | 
| 11 22 |  | 
| 12 23 | 
             
              // Expose innards of FORMALIZE.
         | 
| 13 24 | 
             
              return {
         | 
| 14 25 | 
             
                // FORMALIZE.go
         | 
| 15 26 | 
             
                go: function() {
         | 
| 16 | 
            -
                   | 
| 17 | 
            -
             | 
| 27 | 
            +
                  var i, j = this.init;
         | 
| 28 | 
            +
             | 
| 29 | 
            +
                  for (i in j) {
         | 
| 30 | 
            +
                    j.hasOwnProperty(i) && j[i]();
         | 
| 18 31 | 
             
                  }
         | 
| 19 32 | 
             
                },
         | 
| 20 33 | 
             
                // FORMALIZE.init
         | 
| 21 34 | 
             
                init: {
         | 
| 22 | 
            -
                  // FORMALIZE.init. | 
| 23 | 
            -
                   | 
| 24 | 
            -
                     | 
| 25 | 
            -
                       | 
| 26 | 
            -
             | 
| 27 | 
            -
             | 
| 28 | 
            -
             | 
| 29 | 
            -
             | 
| 30 | 
            -
             | 
| 35 | 
            +
                  // FORMALIZE.init.disable_link_button
         | 
| 36 | 
            +
                  disable_link_button: function() {
         | 
| 37 | 
            +
                    Ext.getBody().on('click', function(ev) {
         | 
| 38 | 
            +
                      var el = ev.target;
         | 
| 39 | 
            +
                      var is_disabled = el.tagName.toLowerCase() === 'a' && el.className.match('button_disabled');
         | 
| 40 | 
            +
             | 
| 41 | 
            +
                      if (is_disabled) {
         | 
| 42 | 
            +
                        ev.preventDefault();
         | 
| 43 | 
            +
                      }
         | 
| 44 | 
            +
                    });
         | 
| 31 45 | 
             
                  },
         | 
| 32 46 | 
             
                  // FORMALIZE.init.full_input_size
         | 
| 33 47 | 
             
                  full_input_size: function() {
         | 
| @@ -90,7 +104,11 @@ var FORMALIZE = (function(window, document, undefined) { | |
| 90 104 | 
             
                      return;
         | 
| 91 105 | 
             
                    }
         | 
| 92 106 |  | 
| 93 | 
            -
                    Ext.query('[autofocus]')[0] | 
| 107 | 
            +
                    var el = Ext.query('[autofocus]')[0];
         | 
| 108 | 
            +
             | 
| 109 | 
            +
                    if (!el.disabled) {
         | 
| 110 | 
            +
                      el.focus();
         | 
| 111 | 
            +
                    }
         | 
| 94 112 | 
             
                  },
         | 
| 95 113 | 
             
                  // FORMALIZE.init.placeholder
         | 
| 96 114 | 
             
                  placeholder: function() {
         | 
| @@ -103,16 +121,15 @@ var FORMALIZE = (function(window, document, undefined) { | |
| 103 121 | 
             
                    FORMALIZE.misc.add_placeholder();
         | 
| 104 122 |  | 
| 105 123 | 
             
                    Ext.each(Ext.query('[placeholder]'), function(el) {
         | 
| 124 | 
            +
                      // Placeholder obscured in older browsers,
         | 
| 125 | 
            +
                      // so there's no point adding to password.
         | 
| 126 | 
            +
                      if (el.type === 'password') {
         | 
| 127 | 
            +
                        return;
         | 
| 128 | 
            +
                      }
         | 
| 129 | 
            +
             | 
| 106 130 | 
             
                      var text = el.getAttribute('placeholder');
         | 
| 107 131 | 
             
                      var form = Ext.get(el).parent('form');
         | 
| 108 132 |  | 
| 109 | 
            -
                      function add_placeholder() {
         | 
| 110 | 
            -
                        if (!el.value || el.value === text) {
         | 
| 111 | 
            -
                          el.value = text;
         | 
| 112 | 
            -
                          Ext.get(el).addClass('placeholder_text');
         | 
| 113 | 
            -
                        }
         | 
| 114 | 
            -
                      }
         | 
| 115 | 
            -
             | 
| 116 133 | 
             
                      Ext.get(el).on('focus', function() {
         | 
| 117 134 | 
             
                        if (el.value === text) {
         | 
| 118 135 | 
             
                          el.value = '';
         | 
| @@ -150,6 +167,12 @@ var FORMALIZE = (function(window, document, undefined) { | |
| 150 167 | 
             
                    }
         | 
| 151 168 |  | 
| 152 169 | 
             
                    Ext.each(Ext.query('[placeholder]'), function(el) {
         | 
| 170 | 
            +
                      // Placeholder obscured in older browsers,
         | 
| 171 | 
            +
                      // so there's no point adding to password.
         | 
| 172 | 
            +
                      if (el.type === 'password') {
         | 
| 173 | 
            +
                        return;
         | 
| 174 | 
            +
                      }
         | 
| 175 | 
            +
             | 
| 153 176 | 
             
                      var text = el.getAttribute('placeholder');
         | 
| 154 177 |  | 
| 155 178 | 
             
                      if (!el.value || el.value === text) {
         | 
| @@ -1 +1 @@ | |
| 1 | 
            -
            var FORMALIZE=function( | 
| 1 | 
            +
            var FORMALIZE=function(e,t,n){function r(e){var n=t.createElement("b");return n.innerHTML="<!--[if IE "+e+"]><br><![endif]-->",!!n.getElementsByTagName("br").length}var i="placeholder"in t.createElement("input"),s="autofocus"in t.createElement("input"),o=r(6),u=r(7);return{go:function(){var e,t=this.init;for(e in t)t.hasOwnProperty(e)&&t[e]()},init:{disable_link_button:function(){Ext.getBody().on("click",function(e){var t=e.target,n=t.tagName.toLowerCase()==="a"&&t.className.match("button_disabled");n&&e.preventDefault()})},full_input_size:function(){if(!u||!Ext.query("textarea, input.input_full"))return;Ext.each(Ext.query("textarea, input.input_full"),function(e){Ext.get(e).wrap('<span class="input_full_wrap"></span>')})},ie6_skin_inputs:function(){if(!o||!Ext.query("input, select, textarea"))return;var e=/button|submit|reset/,t=/date|datetime|datetime-local|email|month|number|password|range|search|tel|text|time|url|week/;Ext.each(Ext.query("input"),function(n){n.getAttribute("type").match(e)?(Ext.get(n).addClass("ie6_button"),n.disabled&&Ext.get(n).addClass("ie6_button_disabled")):n.getAttribute("type").match(t)&&(Ext.get(n).addClass("ie6_input"),n.disabled&&Ext.get(n).addClass("ie6_input_disabled"))}),Ext.each(Ext.query("textarea, select"),function(e){e.disabled&&Ext.get(e).addClass("ie6_input_disabled")})},autofocus:function(){if(s||!Ext.query("[autofocus]"))return;var e=Ext.query("[autofocus]")[0];e.disabled||e.focus()},placeholder:function(){if(i||!Ext.query("[placeholder]"))return;FORMALIZE.misc.add_placeholder(),Ext.each(Ext.query("[placeholder]"),function(e){if(e.type==="password")return;var t=e.getAttribute("placeholder"),n=Ext.get(e).parent("form");Ext.get(e).on("focus",function(){e.value===t&&(e.value="",Ext.get(e).removeClass("placeholder_text"))}),Ext.get(e).on("blur",function(){FORMALIZE.misc.add_placeholder()}),n.on("submit",function(){e.value===t&&(e.value="",Ext.get(e).removeClass("placeholder_text"))}),n.on("reset",function(){setTimeout(FORMALIZE.misc.add_placeholder,50)})})}},misc:{add_placeholder:function(){if(i||!Ext.query("[placeholder]"))return;Ext.each(Ext.query("[placeholder]"),function(e){if(e.type==="password")return;var t=e.getAttribute("placeholder");if(!e.value||e.value===t)e.value=t,Ext.get(e).addClass("placeholder_text")})}}}}(this,this.document);Ext.onReady(function(){FORMALIZE.go()})
         | 
| @@ -0,0 +1,187 @@ | |
| 1 | 
            +
            /*
         | 
| 2 | 
            +
              Formalize - version 1.2
         | 
| 3 | 
            +
             | 
| 4 | 
            +
              Note: This file depends on the jQuery library.
         | 
| 5 | 
            +
             | 
| 6 | 
            +
              This version of Formalize, "jquery.formalize.legacy.js"
         | 
| 7 | 
            +
              is intended for use with jQuery version 1.4, and exists
         | 
| 8 | 
            +
              because Drupal 7 ships with jQuery 1.4.4. When you are
         | 
| 9 | 
            +
              starting a new project with a current version of jQuery,
         | 
| 10 | 
            +
              you should simply use the "jquery.formalize.js" instead.
         | 
| 11 | 
            +
            */
         | 
| 12 | 
            +
             | 
| 13 | 
            +
            // Module pattern:
         | 
| 14 | 
            +
            // http://yuiblog.com/blog/2007/06/12/module-pattern
         | 
| 15 | 
            +
            var FORMALIZE = (function($, window, document, undefined) {
         | 
| 16 | 
            +
              // Internet Explorer detection.
         | 
| 17 | 
            +
              function IE(version) {
         | 
| 18 | 
            +
                var b = document.createElement('b');
         | 
| 19 | 
            +
                b.innerHTML = '<!--[if IE ' + version + ']><br><![endif]-->';
         | 
| 20 | 
            +
                return !!b.getElementsByTagName('br').length;
         | 
| 21 | 
            +
              }
         | 
| 22 | 
            +
             | 
| 23 | 
            +
              // Private constants.
         | 
| 24 | 
            +
              var PLACEHOLDER_SUPPORTED = 'placeholder' in document.createElement('input');
         | 
| 25 | 
            +
              var AUTOFOCUS_SUPPORTED = 'autofocus' in document.createElement('input');
         | 
| 26 | 
            +
              var IE6 = IE(6);
         | 
| 27 | 
            +
              var IE7 = IE(7);
         | 
| 28 | 
            +
             | 
| 29 | 
            +
              // Expose innards of FORMALIZE.
         | 
| 30 | 
            +
              return {
         | 
| 31 | 
            +
                // FORMALIZE.go
         | 
| 32 | 
            +
                go: function() {
         | 
| 33 | 
            +
                  var i, j = this.init;
         | 
| 34 | 
            +
             | 
| 35 | 
            +
                  for (i in j) {
         | 
| 36 | 
            +
                    j.hasOwnProperty(i) && j[i]();
         | 
| 37 | 
            +
                  }
         | 
| 38 | 
            +
                },
         | 
| 39 | 
            +
                // FORMALIZE.init
         | 
| 40 | 
            +
                init: {
         | 
| 41 | 
            +
                  // FORMALIZE.init.disable_link_button
         | 
| 42 | 
            +
                  disable_link_button: function() {
         | 
| 43 | 
            +
                    $(document.documentElement).delegate('a.button_disabled', 'click', function() {
         | 
| 44 | 
            +
                      return false;
         | 
| 45 | 
            +
                    });
         | 
| 46 | 
            +
                  },
         | 
| 47 | 
            +
                  // FORMALIZE.init.full_input_size
         | 
| 48 | 
            +
                  full_input_size: function() {
         | 
| 49 | 
            +
                    if (!IE7 || !$('textarea, input.input_full').length) {
         | 
| 50 | 
            +
                      return;
         | 
| 51 | 
            +
                    }
         | 
| 52 | 
            +
             | 
| 53 | 
            +
                    // This fixes width: 100% on <textarea> and class="input_full".
         | 
| 54 | 
            +
                    // It ensures that form elements don't go wider than container.
         | 
| 55 | 
            +
                    $('textarea, input.input_full').wrap('<span class="input_full_wrap"></span>');
         | 
| 56 | 
            +
                  },
         | 
| 57 | 
            +
                  // FORMALIZE.init.ie6_skin_inputs
         | 
| 58 | 
            +
                  ie6_skin_inputs: function() {
         | 
| 59 | 
            +
                    // Test for Internet Explorer 6.
         | 
| 60 | 
            +
                    if (!IE6 || !$('input, select, textarea').length) {
         | 
| 61 | 
            +
                      // Exit if the browser is not IE6,
         | 
| 62 | 
            +
                      // or if no form elements exist.
         | 
| 63 | 
            +
                      return;
         | 
| 64 | 
            +
                    }
         | 
| 65 | 
            +
             | 
| 66 | 
            +
                    // For <input type="submit" />, etc.
         | 
| 67 | 
            +
                    var button_regex = /button|submit|reset/;
         | 
| 68 | 
            +
             | 
| 69 | 
            +
                    // For <input type="text" />, etc.
         | 
| 70 | 
            +
                    var type_regex = /date|datetime|datetime-local|email|month|number|password|range|search|tel|text|time|url|week/;
         | 
| 71 | 
            +
             | 
| 72 | 
            +
                    $('input').each(function() {
         | 
| 73 | 
            +
                      var el = $(this);
         | 
| 74 | 
            +
             | 
| 75 | 
            +
                      // Is it a button?
         | 
| 76 | 
            +
                      if (this.getAttribute('type').match(button_regex)) {
         | 
| 77 | 
            +
                        el.addClass('ie6_button');
         | 
| 78 | 
            +
             | 
| 79 | 
            +
                        /* Is it disabled? */
         | 
| 80 | 
            +
                        if (this.disabled) {
         | 
| 81 | 
            +
                          el.addClass('ie6_button_disabled');
         | 
| 82 | 
            +
                        }
         | 
| 83 | 
            +
                      }
         | 
| 84 | 
            +
                      // Or is it a textual input?
         | 
| 85 | 
            +
                      else if (this.getAttribute('type').match(type_regex)) {
         | 
| 86 | 
            +
                        el.addClass('ie6_input');
         | 
| 87 | 
            +
             | 
| 88 | 
            +
                        /* Is it disabled? */
         | 
| 89 | 
            +
                        if (this.disabled) {
         | 
| 90 | 
            +
                          el.addClass('ie6_input_disabled');
         | 
| 91 | 
            +
                        }
         | 
| 92 | 
            +
                      }
         | 
| 93 | 
            +
                    });
         | 
| 94 | 
            +
             | 
| 95 | 
            +
                    $('textarea, select').each(function() {
         | 
| 96 | 
            +
                      /* Is it disabled? */
         | 
| 97 | 
            +
                      if (this.disabled) {
         | 
| 98 | 
            +
                        $(this).addClass('ie6_input_disabled');
         | 
| 99 | 
            +
                      }
         | 
| 100 | 
            +
                    });
         | 
| 101 | 
            +
                  },
         | 
| 102 | 
            +
                  // FORMALIZE.init.autofocus
         | 
| 103 | 
            +
                  autofocus: function() {
         | 
| 104 | 
            +
                    if (AUTOFOCUS_SUPPORTED || !$(':input[autofocus]').length) {
         | 
| 105 | 
            +
                      return;
         | 
| 106 | 
            +
                    }
         | 
| 107 | 
            +
             | 
| 108 | 
            +
                    var el = $('[autofocus]')[0];
         | 
| 109 | 
            +
             | 
| 110 | 
            +
                    if (!el.disabled) {
         | 
| 111 | 
            +
                      el.focus();
         | 
| 112 | 
            +
                    }
         | 
| 113 | 
            +
                  },
         | 
| 114 | 
            +
                  // FORMALIZE.init.placeholder
         | 
| 115 | 
            +
                  placeholder: function() {
         | 
| 116 | 
            +
                    if (PLACEHOLDER_SUPPORTED || !$(':input[placeholder]').length) {
         | 
| 117 | 
            +
                      // Exit if placeholder is supported natively,
         | 
| 118 | 
            +
                      // or if page does not have any placeholder.
         | 
| 119 | 
            +
                      return;
         | 
| 120 | 
            +
                    }
         | 
| 121 | 
            +
             | 
| 122 | 
            +
                    FORMALIZE.misc.add_placeholder();
         | 
| 123 | 
            +
             | 
| 124 | 
            +
                    $(':input[placeholder]').each(function() {
         | 
| 125 | 
            +
                      // Placeholder obscured in older browsers,
         | 
| 126 | 
            +
                      // so there's no point adding to password.
         | 
| 127 | 
            +
                      if (this.type === 'password') {
         | 
| 128 | 
            +
                        return;
         | 
| 129 | 
            +
                      }
         | 
| 130 | 
            +
             | 
| 131 | 
            +
                      var el = $(this);
         | 
| 132 | 
            +
                      var text = el.attr('placeholder');
         | 
| 133 | 
            +
             | 
| 134 | 
            +
                      el.focus(function() {
         | 
| 135 | 
            +
                        if (el.val() === text) {
         | 
| 136 | 
            +
                          el.val('').removeClass('placeholder_text');
         | 
| 137 | 
            +
                        }
         | 
| 138 | 
            +
                      }).blur(function() {
         | 
| 139 | 
            +
                        FORMALIZE.misc.add_placeholder();
         | 
| 140 | 
            +
                      });
         | 
| 141 | 
            +
             | 
| 142 | 
            +
                      // Prevent <form> from accidentally
         | 
| 143 | 
            +
                      // submitting the placeholder text.
         | 
| 144 | 
            +
                      el.closest('form').submit(function() {
         | 
| 145 | 
            +
                        if (el.val() === text) {
         | 
| 146 | 
            +
                          el.val('').removeClass('placeholder_text');
         | 
| 147 | 
            +
                        }
         | 
| 148 | 
            +
                      }).bind('reset', function() {
         | 
| 149 | 
            +
                        setTimeout(FORMALIZE.misc.add_placeholder, 50);
         | 
| 150 | 
            +
                      });
         | 
| 151 | 
            +
                    });
         | 
| 152 | 
            +
                  }
         | 
| 153 | 
            +
                },
         | 
| 154 | 
            +
                // FORMALIZE.misc
         | 
| 155 | 
            +
                misc: {
         | 
| 156 | 
            +
                  // FORMALIZE.misc.add_placeholder
         | 
| 157 | 
            +
                  add_placeholder: function() {
         | 
| 158 | 
            +
                    if (PLACEHOLDER_SUPPORTED || !$(':input[placeholder]').length) {
         | 
| 159 | 
            +
                      // Exit if placeholder is supported natively,
         | 
| 160 | 
            +
                      // or if page does not have any placeholder.
         | 
| 161 | 
            +
                      return;
         | 
| 162 | 
            +
                    }
         | 
| 163 | 
            +
             | 
| 164 | 
            +
                    $(':input[placeholder]').each(function() {
         | 
| 165 | 
            +
                      // Placeholder obscured in older browsers,
         | 
| 166 | 
            +
                      // so there's no point adding to password.
         | 
| 167 | 
            +
                      if (this.type === 'password') {
         | 
| 168 | 
            +
                        return;
         | 
| 169 | 
            +
                      }
         | 
| 170 | 
            +
             | 
| 171 | 
            +
                      var el = $(this);
         | 
| 172 | 
            +
                      var text = el.attr('placeholder');
         | 
| 173 | 
            +
             | 
| 174 | 
            +
                      if (!el.val() || el.val() === text) {
         | 
| 175 | 
            +
                        el.val(text).addClass('placeholder_text');
         | 
| 176 | 
            +
                      }
         | 
| 177 | 
            +
                    });
         | 
| 178 | 
            +
                  }
         | 
| 179 | 
            +
                }
         | 
| 180 | 
            +
              };
         | 
| 181 | 
            +
            // Alias jQuery, window, document.
         | 
| 182 | 
            +
            })(jQuery, this, this.document);
         | 
| 183 | 
            +
             | 
| 184 | 
            +
            // Automatically calls all functions in FORMALIZE.init
         | 
| 185 | 
            +
            jQuery(document).ready(function() {
         | 
| 186 | 
            +
              FORMALIZE.go();
         | 
| 187 | 
            +
            });
         | 
| @@ -0,0 +1 @@ | |
| 1 | 
            +
            var FORMALIZE=function(a,b,c){function e(a){var b=c.createElement("b");return b.innerHTML="<!--[if IE "+a+"]><br><![endif]-->",!!b.getElementsByTagName("br").length}var f="placeholder"in c.createElement("input"),g="autofocus"in c.createElement("input"),h=e(6),i=e(7);return{go:function(){var a,b=this.init;for(a in b)b.hasOwnProperty(a)&&b[a]()},init:{disable_link_button:function(){a(c.documentElement).delegate("a.button_disabled","click",function(){return!1})},full_input_size:function(){i&&a("textarea, input.input_full").length&&a("textarea, input.input_full").wrap('<span class="input_full_wrap"></span>')},ie6_skin_inputs:function(){if(h&&a("input, select, textarea").length){var b=/button|submit|reset/,c=/date|datetime|datetime-local|email|month|number|password|range|search|tel|text|time|url|week/;a("input").each(function(){var d=a(this);this.getAttribute("type").match(b)?(d.addClass("ie6_button"),this.disabled&&d.addClass("ie6_button_disabled")):this.getAttribute("type").match(c)&&(d.addClass("ie6_input"),this.disabled&&d.addClass("ie6_input_disabled"))}),a("textarea, select").each(function(){this.disabled&&a(this).addClass("ie6_input_disabled")})}},autofocus:function(){if(!g&&a(":input[autofocus]").length){var b=a("[autofocus]")[0];b.disabled||b.focus()}},placeholder:function(){!f&&a(":input[placeholder]").length&&(FORMALIZE.misc.add_placeholder(),a(":input[placeholder]").each(function(){if("password"!==this.type){var b=a(this),c=b.attr("placeholder");b.focus(function(){b.val()===c&&b.val("").removeClass("placeholder_text")}).blur(function(){FORMALIZE.misc.add_placeholder()}),b.closest("form").submit(function(){b.val()===c&&b.val("").removeClass("placeholder_text")}).bind("reset",function(){setTimeout(FORMALIZE.misc.add_placeholder,50)})}}))}},misc:{add_placeholder:function(){!f&&a(":input[placeholder]").length&&a(":input[placeholder]").each(function(){if("password"!==this.type){var b=a(this),c=b.attr("placeholder");b.val()&&b.val()!==c||b.val(c).addClass("placeholder_text")}})}}}}(jQuery,this,this.document);jQuery(document).ready(function(){FORMALIZE.go()});
         | 
| @@ -0,0 +1,42 @@ | |
| 1 | 
            +
            # Make sure you list all the project template files here in the manifest.
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            # Image Import
         | 
| 4 | 
            +
            file '../common/button.png', :like => :image, :to => 'button.png'
         | 
| 5 | 
            +
            file '../common/select_arrow.gif', :like => :image, :to => 'select_arrow.gif'
         | 
| 6 | 
            +
             | 
| 7 | 
            +
            discover :all 
         | 
| 8 | 
            +
             | 
| 9 | 
            +
            description "Teach your forms some manners."
         | 
| 10 | 
            +
             | 
| 11 | 
            +
            help %Q{
         | 
| 12 | 
            +
              Please see the Formalize website for documentation:
         | 
| 13 | 
            +
             | 
| 14 | 
            +
                  http://formalize.me/
         | 
| 15 | 
            +
            }
         | 
| 16 | 
            +
             | 
| 17 | 
            +
            welcome_message %Q{
         | 
| 18 | 
            +
             | 
| 19 | 
            +
              Formalize assets have been copied to the proper asset folders
         | 
| 20 | 
            +
              based on your Compass configuration.
         | 
| 21 | 
            +
             | 
| 22 | 
            +
              Usage:
         | 
| 23 | 
            +
             | 
| 24 | 
            +
               If you're using SCSS syntax, in your stylesheet:
         | 
| 25 | 
            +
             | 
| 26 | 
            +
                 @import "formalize";
         | 
| 27 | 
            +
             | 
| 28 | 
            +
               or if you're using indented syntax
         | 
| 29 | 
            +
             | 
| 30 | 
            +
                 @import "formalize"
         | 
| 31 | 
            +
             | 
| 32 | 
            +
               In your HTML markup, include the JavaScript implementation of
         | 
| 33 | 
            +
               your choice:
         | 
| 34 | 
            +
             | 
| 35 | 
            +
               // a jQuery example
         | 
| 36 | 
            +
               <script src="/javascripts/jquery.formalize.legacy.js"></script>
         | 
| 37 | 
            +
             | 
| 38 | 
            +
              Please see the Formalize website for documentation:
         | 
| 39 | 
            +
             | 
| 40 | 
            +
                  http://formalize.me/
         | 
| 41 | 
            +
            }
         | 
| 42 | 
            +
             |