+
+
+
\ No newline at end of file
diff --git a/docs/buttons/docs-buttons.html b/docs/buttons/docs-buttons.html
new file mode 100755
index 00000000..9d71368b
--- /dev/null
+++ b/docs/buttons/docs-buttons.html
@@ -0,0 +1,134 @@
+
+
+
+ jQuery Mobile Docs - Lists
+
+
+
+
+
+
+
+
+
Buttons
+
+
+
+
+
+
Button basics
+
in jQuery Mobile, buttons that are used for navigation are coded as links and those that submit forms are coded as button elements.
+
+
Buttons in page content
+
+
In the main content block of a page (data-role="content"), any link that you want to look like a button needs the data-role="button" added to the link to tell the framework to style the link as a button.
A button element or an input with a type of submit, reset, button, or image will all be automatically transformed into a custom styled button, no need to add the data-role="button" attribute. We found it was impossible to consistently style link and native form buttons consistently across platforms so the framework actually generates a new link-based button for each form button button and hides the original. When a click event fires on a the link button, it triggers a click on the original form button.
+
+
+<button>Button submit</button>
+
+
+
Creates this button:
+
+
+
Icon options
+
+
Icons can be added to buttons by adding a data-icon attribute on the anchor to specify the icon to display. There a core set of standard icons included in the framework. To minimize the download size of the core icons, jQuery Mobile only includes these icons in white and automatically adds a semi-transparent black circle behind the icon to make sure it has good contrast on all background colors.
By default, icons in buttons are added to the left of the text, but the data-iconpos attribute specifies the icon position: left or right of the text. To create an icon-only button, set the data-iconpos to notext and the button plugin will hide the text and add it as a title attribute on the link to provide context for screen readers and devices that support tooltips. In this example, we're adding a plus (+) icon and positioning it to the right of the text with our data- attributes on the link.
To use custom icons, specify a data-icon value that has a unique name like myapp-email and the button plugin will generate a class by prefixing ui-icon- to the data-icon value and apply it to the button. You can then write a CSS rule that targets the ui-icon-myapp-email class to specify the icon background source. To maintain visual consistency, create a white icon 18x18 pixels saved as a PNG-8 with alpha transparency.
+
+
Inline buttons
+
+
If you have multiple buttons that should sit side-by-side on the same line instead of stacked like the default buttons, wrap the buttons in a container that has a data-inline="true" attribute. This will style the buttons to be the width of their content and float the buttons so they sit on the same line.
It's possible to group a set of buttons together to form a single block of buttons that look contained like a navigation component. To get this effect, wrap a set of buttons in a container with the data-role="controlgroup" attribute and the framework will create a vertical button group. This removes all margins and drop shadows between the buttons and only rounds the top and bottom buttons to get the effect that they are group together.
By default, grouped buttons are presented as a vertical list. By adding the data-type="horizontal" attribute
to the control group container, you can swap this to a horizontal style group that floats the buttons side-by-side and sets the width to only be large enough to fit the content. Be aware that these will wrap to multiple lines if the button number of text length is to wide for the screen.
+
+
jQuery Mobile has a rich theming system that gives you full control of how buttons are styled. When a link is added to a container, it is automatically assigned a theme swatch letter that matches it's parent bar or content box to visually integrate the button into the parent container, like a chameleon. So a button placed inside a content container with a theme of "a" (black in the default theme) will be automatically assigned the button theme of "a" (charcoal in the default theme). Here are examples of the button theme pairings in the default theme. All buttons have the same HTML markup:
Button can be manually assigned any of the button color swatches from the theme to add visual contrast with the container they sit inside by adding the data-theme attribute on the button markup and specifying a swatch letter.
When buttons are placed inside header or footer bars, they are styled a bit differently than in the body. To save space, buttons in bars are styled with a smaller text size, less padding and only enough width to fit the text and icons inside. The toolbar documentation has full details on the styling options of button in bars.
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/docs/buttons/index.html b/docs/buttons/index.html
new file mode 100755
index 00000000..131d4486
--- /dev/null
+++ b/docs/buttons/index.html
@@ -0,0 +1,45 @@
+
+
+
+ jQuery Mobile Docs - Buttons
+
+
+
+
+
+
+
+
+
Buttons
+
+
+
+
+
Buttons are one of the core widgets in jQuery Mobile and are used within a wide range of other plugins.
+
+
+
\ No newline at end of file
diff --git a/docs/index.html b/docs/index.html
index 85131625..021426fb 100755
--- a/docs/index.html
+++ b/docs/index.html
@@ -19,11 +19,11 @@
diff --git a/docs/lists/images/asterisk_orange.png b/docs/lists/images/asterisk_orange.png
deleted file mode 100755
index 1ebebde5..00000000
Binary files a/docs/lists/images/asterisk_orange.png and /dev/null differ
diff --git a/docs/lists/images/book.png b/docs/lists/images/book.png
deleted file mode 100755
index b0f4dd79..00000000
Binary files a/docs/lists/images/book.png and /dev/null differ
diff --git a/docs/lists/images/cross.png b/docs/lists/images/cross.png
deleted file mode 100755
index 1514d51a..00000000
Binary files a/docs/lists/images/cross.png and /dev/null differ
diff --git a/docs/lists/images/email_delete.png b/docs/lists/images/email_delete.png
deleted file mode 100755
index a9932b1a..00000000
Binary files a/docs/lists/images/email_delete.png and /dev/null differ
diff --git a/docs/lists/images/flag_blue.png b/docs/lists/images/flag_blue.png
deleted file mode 100755
index 003924f5..00000000
Binary files a/docs/lists/images/flag_blue.png and /dev/null differ
diff --git a/docs/lists/images/folder.png b/docs/lists/images/folder.png
deleted file mode 100755
index 784e8fa4..00000000
Binary files a/docs/lists/images/folder.png and /dev/null differ
diff --git a/docs/lists/images/folder_heart.png b/docs/lists/images/folder_heart.png
deleted file mode 100755
index 56d7da1d..00000000
Binary files a/docs/lists/images/folder_heart.png and /dev/null differ
diff --git a/docs/lists/images/icon_box.png b/docs/lists/images/icon_box.png
deleted file mode 100755
index 8443c23e..00000000
Binary files a/docs/lists/images/icon_box.png and /dev/null differ
diff --git a/docs/lists/images/icon_email_go.png b/docs/lists/images/icon_email_go.png
deleted file mode 100755
index 4a6c5d39..00000000
Binary files a/docs/lists/images/icon_email_go.png and /dev/null differ
diff --git a/docs/lists/images/icon_tag.png b/docs/lists/images/icon_tag.png
deleted file mode 100755
index 9757fc6e..00000000
Binary files a/docs/lists/images/icon_tag.png and /dev/null differ
diff --git a/docs/lists/images/icon_vcard.png b/docs/lists/images/icon_vcard.png
deleted file mode 100755
index c02f315d..00000000
Binary files a/docs/lists/images/icon_vcard.png and /dev/null differ
diff --git a/docs/lists/images/star.png b/docs/lists/images/star.png
deleted file mode 100755
index b88c8578..00000000
Binary files a/docs/lists/images/star.png and /dev/null differ
diff --git a/docs/themes.html b/docs/themes.html
index 2ec969c4..10fb5315 100755
--- a/docs/themes.html
+++ b/docs/themes.html
@@ -17,14 +17,14 @@
-
Theming overview
+
Theming overview
The jQuery Mobile theme framework contains multiple color "swatches" for bars, content blocks and buttons. The key to the theme system used in jQuery UI is separation of color and texture (theme) from structural styles that define things like padding and dimensions. This allows the theme colors and textures to be defined once in the stylesheet then re-used throughout the interface as configurable color swatches that can be mixed and matched. We also take advantage of CSS3 properties to add rounded corners, box and text shadow and gradients to make the theme styles very lightweight and reduce server requests.
Themes include at least 3 swatches for bars, content blocks and buttons. To make mapping of color swatches consistent across our widgets, we have followed the convention that swatch "a" is the highest level of visual priority (black in our default theme), "b" is secondary level (blue) and "c" is the baseline level (gray) that we use by default in many situations. Themes may have additional swatches but these are used for accents colors or specific situations within an app or site.
-
Bars
+
Bars
The default theme contains 4 color swatches for bars to use in header, footer and tool bars. The swatches are designated by letters (a, b, c, etc.) and are organized into a visual hierarchy where "a" is the highest level of visual priority, "b" is secondary, "c" is the baseline, and "d" is for accents. Each swatch defines the border color, text color, gradient, text-shadow, font family and link color. Our default theme looks like this:
@@ -38,7 +38,7 @@
-
Content Blocks
+
Content Blocks
The default theme contains 3 color swatches for use in content blocks. These are designed to coordinate with the header color swatches in the default theme. Just as with bars, you can add as many content block swatches you want by extending the theme stylesheet. If a theme isn't specified on a content block, the framework will default to "c", just like the header.
@@ -48,7 +48,7 @@
-
Lists
+
Lists
There are 2 supported list view styles. The system defaults to the "a" swatch (silver in default theme) and it can be switched to "b" via the data-theme attribute.
The jQuery Mobile framework uses a single theme swatch called "active" (bright blue in the default theme) to consistently indicate the selected state, regardless of the theme of the widget. We apply this in navigation and form controls to indicate what is currently selected. Because this theme swatch is designed for clear, consistent user feedback, it is not currently a theme swatch that can be overridden via the markup. It is set once in the theme and applied by the framework whenever a selected or active state is needed. The styling for this state is in the theme stylesheet under the ui-btn-active style rules.
-
Buttons
+
Buttons
A set of 4 button colors are also included in the default theme. Each button has styles for normal, hover/focus and pressed states. Each button is intentionally styled to match the color of a bar so they feel tightly integrated.
When a link is placed in a header or footer bar, it is automatically transformed into a compact-sized button. It is also assigned a theme swatch letter that matches it's parent bar or content box to visually integrate the button into the parent theme, sort of like a chameleon. To illustrate this idea, below, the same exact button code is in each of the 4 bars and is automatically setting their color swatch to match on the parent bar swatch.
+
Context-aware button theming
+
A button is automatically assigned a theme swatch letter that matches it's parent bar or content box to visually integrate the button into the parent theme, like a chameleon. To illustrate this idea, below, the same exact button code is in each of the 4 bars and is automatically setting their color swatch to match on the parent bar swatch.
This makes it really easy to ripple a theme change through a page by setting a theme swatch on a parent because you know the buttons will maintain the same relative visual weight across themes. To add visual emphasis of certain buttons in a toolbar, the theme swatch color for a button can be set by adding a data-theme="a" to the anchor to make it stand out visually from it's parent. If the theme is set on a button in the markup, the framework won't override the theme swatch color when the parent theme is changed because you made a conscious decision to set the color.
+
This makes it really easy to ripple a theme change through a page by setting a theme swatch on a parent because you know the buttons will maintain the same relative visual weight across themes. Since form elements use the button styles, they will also adapt to their parent container too.
+
+
To add visual emphasis of certain buttons in a toolbar, the theme swatch color for a button can be set by adding a data-theme="a" to the anchor to make it stand out visually from it's parent. If the theme is set on a button in the markup, the framework won't override the theme swatch color when the parent theme is changed because you made a conscious decision to set the color.
There a core set of standard icons included in the framework that can be assigned to any button. To minimize the download size of the core icons, jQuery Mobile only includes these icons in white and automatically adds a semi-transparent black circle behind the icon to make sure it has good contrast on all background colors.
Extensible themes
diff --git a/docs/toolbars/images/album-af.jpg b/docs/toolbars/images/album-af.jpg
deleted file mode 100755
index e2e34fd8..00000000
Binary files a/docs/toolbars/images/album-af.jpg and /dev/null differ
diff --git a/docs/toolbars/images/album-ag.jpg b/docs/toolbars/images/album-ag.jpg
deleted file mode 100755
index 02766347..00000000
Binary files a/docs/toolbars/images/album-ag.jpg and /dev/null differ
diff --git a/docs/toolbars/images/album-bb.jpg b/docs/toolbars/images/album-bb.jpg
deleted file mode 100755
index e23683a4..00000000
Binary files a/docs/toolbars/images/album-bb.jpg and /dev/null differ
diff --git a/docs/toolbars/images/album-bk.jpg b/docs/toolbars/images/album-bk.jpg
deleted file mode 100755
index 58ec190e..00000000
Binary files a/docs/toolbars/images/album-bk.jpg and /dev/null differ
diff --git a/docs/toolbars/images/album-hc.jpg b/docs/toolbars/images/album-hc.jpg
deleted file mode 100755
index cc099d10..00000000
Binary files a/docs/toolbars/images/album-hc.jpg and /dev/null differ
diff --git a/docs/toolbars/images/album-k.jpg b/docs/toolbars/images/album-k.jpg
deleted file mode 100755
index ce6cfc29..00000000
Binary files a/docs/toolbars/images/album-k.jpg and /dev/null differ
diff --git a/docs/toolbars/images/album-mg.jpg b/docs/toolbars/images/album-mg.jpg
deleted file mode 100755
index c3850e3a..00000000
Binary files a/docs/toolbars/images/album-mg.jpg and /dev/null differ
diff --git a/docs/toolbars/images/album-ok.jpg b/docs/toolbars/images/album-ok.jpg
deleted file mode 100755
index 90a08f7a..00000000
Binary files a/docs/toolbars/images/album-ok.jpg and /dev/null differ
diff --git a/docs/toolbars/images/album-p.jpg b/docs/toolbars/images/album-p.jpg
deleted file mode 100755
index 3dcce6a8..00000000
Binary files a/docs/toolbars/images/album-p.jpg and /dev/null differ
diff --git a/docs/toolbars/images/album-rh.jpg b/docs/toolbars/images/album-rh.jpg
deleted file mode 100755
index 614969a2..00000000
Binary files a/docs/toolbars/images/album-rh.jpg and /dev/null differ
diff --git a/docs/toolbars/images/album-ws.jpg b/docs/toolbars/images/album-ws.jpg
deleted file mode 100755
index 33cf555a..00000000
Binary files a/docs/toolbars/images/album-ws.jpg and /dev/null differ
diff --git a/docs/toolbars/images/album-xx.jpg b/docs/toolbars/images/album-xx.jpg
deleted file mode 100755
index 78409fe7..00000000
Binary files a/docs/toolbars/images/album-xx.jpg and /dev/null differ
diff --git a/docs/toolbars/images/asterisk_orange.png b/docs/toolbars/images/asterisk_orange.png
deleted file mode 100755
index 1ebebde5..00000000
Binary files a/docs/toolbars/images/asterisk_orange.png and /dev/null differ
diff --git a/docs/toolbars/images/book.png b/docs/toolbars/images/book.png
deleted file mode 100755
index b0f4dd79..00000000
Binary files a/docs/toolbars/images/book.png and /dev/null differ
diff --git a/docs/toolbars/images/cross.png b/docs/toolbars/images/cross.png
deleted file mode 100755
index 1514d51a..00000000
Binary files a/docs/toolbars/images/cross.png and /dev/null differ
diff --git a/docs/toolbars/images/email_delete.png b/docs/toolbars/images/email_delete.png
deleted file mode 100755
index a9932b1a..00000000
Binary files a/docs/toolbars/images/email_delete.png and /dev/null differ
diff --git a/docs/toolbars/images/flag_blue.png b/docs/toolbars/images/flag_blue.png
deleted file mode 100755
index 003924f5..00000000
Binary files a/docs/toolbars/images/flag_blue.png and /dev/null differ
diff --git a/docs/toolbars/images/folder.png b/docs/toolbars/images/folder.png
deleted file mode 100755
index 784e8fa4..00000000
Binary files a/docs/toolbars/images/folder.png and /dev/null differ
diff --git a/docs/toolbars/images/folder_heart.png b/docs/toolbars/images/folder_heart.png
deleted file mode 100755
index 56d7da1d..00000000
Binary files a/docs/toolbars/images/folder_heart.png and /dev/null differ
diff --git a/docs/toolbars/images/icon_box.png b/docs/toolbars/images/icon_box.png
deleted file mode 100755
index 8443c23e..00000000
Binary files a/docs/toolbars/images/icon_box.png and /dev/null differ
diff --git a/docs/toolbars/images/icon_email_go.png b/docs/toolbars/images/icon_email_go.png
deleted file mode 100755
index 4a6c5d39..00000000
Binary files a/docs/toolbars/images/icon_email_go.png and /dev/null differ
diff --git a/docs/toolbars/images/icon_tag.png b/docs/toolbars/images/icon_tag.png
deleted file mode 100755
index 9757fc6e..00000000
Binary files a/docs/toolbars/images/icon_tag.png and /dev/null differ
diff --git a/docs/toolbars/images/icon_vcard.png b/docs/toolbars/images/icon_vcard.png
deleted file mode 100755
index c02f315d..00000000
Binary files a/docs/toolbars/images/icon_vcard.png and /dev/null differ
diff --git a/docs/toolbars/images/star.png b/docs/toolbars/images/star.png
deleted file mode 100755
index b88c8578..00000000
Binary files a/docs/toolbars/images/star.png and /dev/null differ
diff --git a/experiments/converter/application.js b/experiments/converter/application.js
index e164800d..ad55d10e 100644
--- a/experiments/converter/application.js
+++ b/experiments/converter/application.js
@@ -10,74 +10,78 @@ $(function() {
};
function list() {
- var ul = $("#conversions").empty().page( "destroy" ),
- ulEdit = $("#edit-conversions").empty().page( "destroy" );
- $.each(all, function(index, conversion) {
+ var ul = $( "#conversions" ).empty()
+ .filter( ":mobile-page" ).page( "destroy" ),
+ ulEdit = $( "#edit-conversions" ).empty()
+ .filter( ":mobile-page" ).page( "destroy" );
+
+ $.each( all, function( index, conversion ) {
// if last update was less then a minute ago, don't update
- if (conversion.type == "currency" && !conversion.rate || conversion.updated && conversion.updated + 60000 < +new Date) {
+ if ( conversion.type === "currency" && !conversion.rate || conversion.updated && conversion.updated + 60000 < +new Date) {
var self = conversion;
var url = "http://query.yahooapis.com/v1/public/yql?q=select%20rate%2Cname%20from%20csv%20where%20url%3D'http%3A%2F%2Fdownload.finance.yahoo.com%2Fd%2Fquotes%3Fs%3D" + conversion.from + conversion.to + "%253DX%26f%3Dl1n'%20and%20columns%3D'rate%2Cname'&format=json&diagnostics=true&callback=?";
- $.getJSON(url, function(result) {
- self.rate = parseFloat(result.query.results.row.rate);
+ $.getJSON( url, function( result ) {
+ console.log( "results", result );
+ self.rate = parseFloat( result.query.results.row.rate );
// TODO trigger a custom event instead of keyup?
- $("#term").keyup();
+ $( "#term" ).keyup();
self.updated = +new Date;
conversions.store();
});
}
- $("#conversion-field").tmpl(conversion, {
+ $( "#conversion-field" ).tmpl( conversion, {
symbols: symbols
- }).appendTo(ul);
- $("#conversion-edit-field").tmpl(conversion, {
+ }).appendTo( ul );
+ $( "#conversion-edit-field" ).tmpl( conversion, {
symbols: symbols
- }).appendTo(ulEdit);
+ }).appendTo( ulEdit );
});
ul.page();
// TODO trigger a custom event instead of keyup?
- $("#term").keyup();
+ $( "#term" ).keyup();
}
var all = conversions.all();
- $("#term").keyup(function() {
+ $( "#term" ).keyup(function() {
var value = this.value;
- $.each(all, function(index, conversion) {
- $("#" + conversion.from + conversion.to).val( conversion.rate
- ? Math.ceil(value * conversion.rate * 100) / 100
+ $.each( all, function( index, conversion ) {
+ $( "#" + conversion.from + conversion.to ).val( conversion.rate
+ ? Math.ceil( value * conversion.rate * 100 ) / 100
: "Rate not available, yet."
);
});
}).focus();
list();
- $("form").submit(function() {
- $("#term").blur();
+ $( "form" ).submit(function() {
+ $( "#term" ).blur();
return false;
});
- $("#add").click(function() {
+ $( "#add" ).click(function() {
all.push({
type: "currency",
- from: $("#currency-options-from").val(),
- to: $("#currency-options-to").val()
+ from: $( "#currency-options-from" ).val(),
+ to: $( "#currency-options-to" ).val()
});
conversions.store();
list();
return false;
});
- $("#clear").click(function() {
+ $( "#clear" ).click(function() {
conversions.clear();
list();
return false;
});
- $("#restore").click(function() {
+ $( "#restore" ).click(function() {
conversions.restore();
list();
return false;
});
- $("#edit-conversions").click(function(event) {
- var target = $(event.target).closest(".deletebutton");
- if (target.length) {
- conversions.remove(target.prev("label").attr("for"));
+ $( "#edit-conversions" ).click(function( event ) {
+ var target = $( event.target ).closest( ".deletebutton" );
+ if ( target.length ) {
+ conversions.remove( target.prev( "label" ).attr( "for" ) );
list();
}
return false;
- })
-});
\ No newline at end of file
+ });
+});
diff --git a/experiments/converter/storage.js b/experiments/converter/storage.js
index 8604e91c..5521b18b 100644
--- a/experiments/converter/storage.js
+++ b/experiments/converter/storage.js
@@ -1,65 +1,68 @@
(function() {
- var defaults = [
- {
- type: "currency",
- from: "USD",
- to: "EUR"
- }
- // TODO add back in as defaults once its possible to add other conversions, not just currencies
- /*,
- {
- type: "distance",
- from: "Miles",
- to: "Kilometer",
- rate: 1.609344
- },
- {
- type: "distance",
- from: "inch",
- to: "centimeter",
- rate: 2.54
- }*/
- ];
-
- // TODO fallback to whatever else when localStorage isn't available
- function get() {
- return JSON.parse(localStorage.getItem("conversions"));
+
+var defaults = [
+ {
+ type: "currency",
+ from: "USD",
+ to: "EUR"
}
- function set(value) {
- window.console && console.log && console.log("storing conversion: "+ JSON.stringify(value))
- localStorage.setItem("conversions", JSON.stringify(value));
+ // TODO add back in as defaults once its possible to add other conversions, not just currencies
+ /*,
+ {
+ type: "distance",
+ from: "Miles",
+ to: "Kilometer",
+ rate: 1.609344
+ },
+ {
+ type: "distance",
+ from: "inch",
+ to: "centimeter",
+ rate: 2.54
+ }*/
+];
+
+// TODO fallback to whatever else when localStorage isn't available
+function get() {
+ return JSON.parse( localStorage.getItem( "conversions" ) );
+}
+function set( value ) {
+ if ( window.console && console.log ) {
+ console.log( "storing conversion: "+ JSON.stringify( value ) );
}
-
- var conversions = get("conversions");
- if (!conversions) {
- conversions = $.extend([], defaults);
- set(conversions);
+ localStorage.setItem( "conversions", JSON.stringify( value ) );
+}
+
+var conversions = get( "conversions" );
+if ( !conversions ) {
+ conversions = defaults.slice();
+ set( conversions );
+}
+window.conversions = {
+ store: function() {
+ set( conversions );
+ },
+ all: function() {
+ return conversions;
+ },
+ clear: function() {
+ conversions.length = 0;
+ this.store();
+ },
+ restore: function() {
+ conversions.length = 0;
+ $.extend( conversions, defaults );
+ this.store();
+ },
+ remove: function( tofrom ) {
+ $.each( conversions, function( index, conversion ) {
+ if ( ( conversion.from + conversion.to ) === tofrom ) {
+ conversions.splice( index, 1 );
+ return false;
+ }
+ });
+ this.store();
}
- window.conversions = {
- store: function() {
- set(conversions);
- },
- all: function() {
- return conversions;
- },
- clear: function() {
- conversions.length = 0;
- this.store();
- },
- restore: function() {
- conversions.length = 0;
- $.extend(conversions, defaults);
- this.store();
- },
- remove: function(tofrom) {
- $.each(conversions, function(index, conversion) {
- if ((conversion.from + conversion.to) == tofrom) {
- conversions.splice(index, 1);
- return false;
- }
- });
- this.store();
- }
- };
-
+};
+
})();