Skip to content

Commit

Permalink
Merge branch 'develop' of git://github.com/pixelmatrix/uniform into d…
Browse files Browse the repository at this point in the history
…evelop
  • Loading branch information
ericfreese committed Feb 21, 2013
2 parents 51c6a87 + 60d2eb7 commit 1850e2c
Show file tree
Hide file tree
Showing 19 changed files with 166 additions and 85 deletions.
30 changes: 17 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,10 @@ Installation

Installation of Uniform is quite simple. First, make sure you have jQuery installed. Then you’ll want to link to the jquery.uniform.js file and uniform.default.css in the head area of your page. Here's what your `<head>` tag contents should probably contain:

<!-- Make sure your CSS file is listed before jQuery -->
<link rel="stylesheet" href="uniform.default.css" media="screen" />
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8/jquery.min.js"></script>
<script src="jquery.uniform.js"></script>
<link rel="stylesheet" href="uniform.default.css" media="screen" />

This relies upon a copy of jquery.uniform.js, uniform.default.css and the various images all being available on your webserver.

Expand All @@ -43,9 +44,10 @@ You can exclude elements too by using more jQuery selectors or methods:

A complete set of tags in the HEAD section of your site can therefore look like this:

<!-- Make sure your CSS file is listed before jQuery -->
<link rel="stylesheet" href="uniform.default.css" media="screen" />
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8/jquery.min.js"></script>
<script src="jquery.uniform.js"></script>
<link rel="stylesheet" href="uniform.default.css" media="screen" />
<script type='text/javascript'>
// On load, style typical form elements
$(function () {
Expand All @@ -68,7 +70,7 @@ You can pass in extra parameters to control certain aspects of Uniform. To pass
Alternately, you can specify global defaults by using the `defaults` property. *Note: The property name changed in v2.0.*

$.uniform.defaults.checkedClass = "uniformCheckedClass";
$.uniform.defaults.fileBtnText = "Pick a file";
$.uniform.defaults.fileBtnHtml = "Pick a file";

### activeClass (string)

Expand Down Expand Up @@ -134,13 +136,13 @@ Sets the class given to div inside a file upload container that acts as the "Cho

$(":file").uniform({fileButtonClass: 'myFileBtnClass'});

### fileButtonText (string)
### fileButtonHtml (string)

*Default:* "Choose File"

Sets the text written on the action button inside a file upload input.

$(":file").uniform({fileButtonText: 'Choose &hellip;'});
$(":file").uniform({fileButtonHtml: 'Choose &hellip;'});

### fileClass (string)

Expand All @@ -150,13 +152,13 @@ Sets the class given to the wrapper div for file upload elements.

$(":file").uniform({fileClass: 'myFileClass'});

### fileDefaultText (string)
### fileDefaultHtml (string)

*Default:* "No file selected"

Sets the text written in the filename div of a file upload input when there is no file selected.

$(":file").uniform({fileDefaultText: 'Select a file please'});
$(":file").uniform({fileDefaultHtml: 'Select a file please'});

### filenameClass (string)

Expand Down Expand Up @@ -214,13 +216,13 @@ Sets the class given to the wrapper div for radio elements.

$(":radio").uniform({radioClass: 'myRadioClass'});

### resetDefaultText (string)
### resetDefaultHtml (string)

*Default:* "Reset"

This text is what's shown on form reset buttons. It is very similar to submitDefaultText.
This text is what's shown on form reset buttons. It is very similar to submitDefaultHtml.

$("input[type='reset']).uniform({resetDefaultText: "Clear"});
$("input[type='reset']).uniform({resetDefaultHtml: "Clear"});

### resetSelector (boolean/string)

Expand Down Expand Up @@ -252,13 +254,13 @@ Sets the class given to the wrapper div for select elements that are multiselect

$("select").uniform({selectMultiClass: 'myMultiSelectClass'});

### submitDefaultText (string)
### submitDefaultHtml (string)

*Default:* "Submit"

This text is what's shown on form submit buttons. It is very similar to resetDefaultText.
This text is what's shown on form submit buttons. It is very similar to resetDefaultHtml.

$("input[type='submit']).uniform({resetDefaultText: "Submit Form"});
$("input[type='submit']).uniform({resetDefaultHtml: "Submit Form"});

### textareaClass (string)

Expand Down Expand Up @@ -345,6 +347,8 @@ Uniform is supposed to be pretty simple, but there are a few things that can be

* If you have ideas, or bugs, please post them in [GitHub](https://github.com/pixelmatrix/uniform). We rely on our users' for improvement ideas and bug reports. Without your participation, Uniform will stay static.

* If you are having problems with automatically sized select elements in Firefox, double check and ensure your CSS files are listed before jQuery, Uniform and your code that uniforms the form elements.


Upgrading To 2.0
----------------
Expand Down
4 changes: 2 additions & 2 deletions demo/demo.html
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@
}


css('../themes/' + optionValues.theme + '/css/uniform.' + optionValues.theme + '.css');

url = '://ajax.googleapis.com/ajax/libs/jquery/'

if (window.location.protocol == 'https:') {
Expand All @@ -57,8 +59,6 @@
} else {
script('../jquery.uniform.js');
}

css('../themes/' + optionValues.theme + '/css/uniform.' + optionValues.theme + '.css');
}());
</script>
<script type="text/javascript">
Expand Down
32 changes: 22 additions & 10 deletions jquery.uniform.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
Uniform v2.0.0
Uniform v2.1.0
Copyright © 2009 Josh Pyles / Pixelmatrix Design LLC
http://pixelmatrixdesign.com
Expand Down Expand Up @@ -68,7 +68,7 @@ Enjoy!
for (name in events) {
if (events.hasOwnProperty(name)) {
namespaced = name.replace(/ |$/g, options.eventNamespace);
$el.bind(name, events[name]);
$el.bind(namespaced, events[name]);
}
}
}
Expand Down Expand Up @@ -349,7 +349,7 @@ Enjoy!
* @return boolean
*/
function isMsieSevenOrNewer() {
if (typeof document.security !== 'undefined') {
if (typeof window.XMLHttpRequest !== 'undefined') {
return true;
}

Expand Down Expand Up @@ -439,12 +439,12 @@ Enjoy!
* @param object newCss CSS values to swap out
* @param Function callback Function to run
*/
function swap($el, newCss, callback) {
function swap($elements, newCss, callback) {
var restore, item;

restore = [];

$el.each(function () {
$elements.each(function () {
var name;

for (name in newCss) {
Expand Down Expand Up @@ -477,7 +477,14 @@ Enjoy!
* @param String method
*/
function sizingInvisible($el, callback) {
swap($el.parents().andSelf().not(':visible'), {
var targets;

// We wish to target ourselves and any parents as long as
// they are not visible
targets = $el.parents();
targets.push($el[0]);
targets = targets.not(':visible');
swap(targets, {
visibility: "hidden",
display: "block",
position: "absolute"
Expand Down Expand Up @@ -793,10 +800,15 @@ Enjoy!
// Use the width of the select and adjust the
// span and div accordingly
sizingInvisible($el, function () {
var spanPad;
spanPad = $span.outerWidth() - $span.width();
$div.width(origElemWidth + spanPad);
$span.width(origElemWidth);
// Force "display: block" - related to bug #287
swap($([ $span[0], $div[0] ]), {
display: "block"
}, function () {
var spanPad;
spanPad = $span.outerWidth() - $span.width();
$div.width(origElemWidth + spanPad);
$span.width(origElemWidth);
});
});
} else {
// Force the select to fill the size of the div
Expand Down
2 changes: 1 addition & 1 deletion jquery.uniform.min.js

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions themes/_base/css/uniform._base.css
Original file line number Diff line number Diff line change
Expand Up @@ -249,10 +249,16 @@ div.button {
height: 30px;
cursor: pointer;
position: relative;
/* Keep submit buttons barely visible so you can submit by pressing enter */
/* Duplicating due to IE8 */ }
div.button a, div.button button, div.button input {
position: absolute;
display: none; }
div.button input[type="submit"], div.button button[type="submit"] {
opacity: 0.01;
filter: alpha(opacity=1);
-moz-opacity: 0.01;
display: block; }
div.button span {
display: -moz-inline-box;
display: inline-block;
Expand Down
2 changes: 1 addition & 1 deletion themes/_base/css/uniform._base.min.css

Large diffs are not rendered by default.

16 changes: 13 additions & 3 deletions themes/_base/css/uniform._base.scss
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
@mixin opacity($opacity) {
opacity: $opacity;
filter: unquote("alpha(opacity=#{round($opacity * 100)})");
-moz-opacity: $opacity;
}

@mixin hideYetClickable() {
opacity: 0;
filter: alpha(opacity=0);
-moz-opacity: 0;
@include opacity(0);
border: none;
background: none;
}
Expand Down Expand Up @@ -517,6 +521,12 @@ div#{$class-wrapper}#{$class-button} {
display: none;
}

/* Keep submit buttons barely visible so you can submit by pressing enter */
input[type="submit"], button[type="submit"] {
@include opacity(0.01);
display: block;
}

span {
@include inline-block();
line-height: 1;
Expand Down
10 changes: 8 additions & 2 deletions themes/agent/css/uniform.agent.css
Original file line number Diff line number Diff line change
Expand Up @@ -260,10 +260,16 @@ div.button {
height: 32px;
cursor: pointer;
position: relative;
/* Keep submit buttons barely visible so you can submit by pressing enter */
/* Duplicating due to IE8 */ }
div.button a, div.button button, div.button input {
position: absolute;
display: none; }
div.button input[type="submit"], div.button button[type="submit"] {
opacity: 0.01;
filter: alpha(opacity=1);
-moz-opacity: 0.01;
display: block; }
div.button span {
display: -moz-inline-box;
display: inline-block;
Expand Down Expand Up @@ -349,11 +355,11 @@ div.selector {
padding: 0 25px 0 0;
color: #fff;
font-weight: normal;
text-shadow: 0 1px 0 #fff; }
text-shadow: 0 1px 0 white; }
div.selector select {
font-family: "Helvetica Neue", Arial, Helvetica, sans-serif;
font-size: 1em;
border: solid 1px #fff; }
border: solid 1px white; }
div.selector.disabled span, div.selector.disabled:active span, div.selector.disabled.active span {
color: #bbb; }
div.selector:disabled span, div.selector:disabled:active span, div.selector:disabled.active span {
Expand Down
Loading

0 comments on commit 1850e2c

Please sign in to comment.