diff --git a/.gitignore b/.gitignore index 4d01b4f..22fa479 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,4 @@ doc/*.html examples/site/_site/* .sass-cache/ +build/.remote/ diff --git a/CNAME b/CNAME index 1b424ae..b960acb 100644 --- a/CNAME +++ b/CNAME @@ -1 +1 @@ -uraniumjs.com \ No newline at end of file +uranium.io \ No newline at end of file diff --git a/Gemfile b/Gemfile index 45f27d0..70095a6 100644 --- a/Gemfile +++ b/Gemfile @@ -1,6 +1,7 @@ -source "http://gems.moovweb.org" +source "http://gems.moovweb.net" +source "http://rubygems.org" gem "rake" gem "manhattan_uploader", "0.2.24" gem "fusion", "0.0.5" -gem "rdiscount" \ No newline at end of file +gem "rdiscount" diff --git a/Gemfile.lock b/Gemfile.lock index 85deb75..78de1ec 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,5 +1,6 @@ GEM - remote: http://gems.moovweb.org/ + remote: http://gems.moovweb.net/ + remote: http://rubygems.org/ specs: domain_name (0.5.2) unf (~> 0.0.3) diff --git a/README.md b/README.md index 73c1343..2d59d8f 100644 --- a/README.md +++ b/README.md @@ -1,134 +1,125 @@ -# Overview +# Uranium -Uranium is meant to be : +## Overview + +Uranium is a simple Javascript interaction library written in jQuery. It's meant to be... - Lightweight -- Easy to use +- Declarative +- Interface Focused That's it! -If given the choice between easy to use and powerful, ease of use is the greater goal. If you find yourself wanting something that a given widget will not do, you're encouraged to extend the widget yourself. +If given the choice between easy to use and powerful, ease of use is the greater goal. -It should be noted that since Uranium extends xui -- this library is geared for widgets that are useful on mobile devices. It also is designed to support mobile browsers (for now just webkit, but you can build it for blackberry/mobile IE as well). +View the [website](http://uranium.io/) for more details and demos. -View the [website](http://uraniumjs.com/) for more details and demos. --- -# Lightweight - -**The whole library is 15 KB gzipped (including all widgets and xui) !** - -- Uranium is based on [xui](http://xuijs.com/) -- the featherweight mobile js library -- Uranium is bundled with xui to make just one javascript file(uranium/raw/master/build/src/uranium.js). -- If you want it even lighter, you can make a custom [build](uranium/blob/master/doc/dev/build.md) yourself. Follow the instructions below. - ---- - -# Easy to Use +## Easy to Use **Uranium requires ZERO programming on your part.** -Uranium adopts the 'declarative' javascript style. Because of this, you can use the widgets without touching a single line of javascript. +Uranium adopts the 'declarative' Javascript style. Because of this, you can use the interactions just by editing your HTML and CSS, without touching a single line of Javascript. -**What is declarative javascript?** +**What is declarative Javascript?** -Declarative javascript is a model that looks for how html elements are formatted to construct all the necessary js magic to make those elements come to life. +Declarative Javascript is a model that looks for how html elements are formatted to construct all the necessary js magic to make those elements come to life. --- -# Get Started -There are two primary steps to make a widget: +## Uranium is not ... + +**...designed for executing logic or site functions** -- Add special attributes to the html element you wish to make a widget -- Include [uranium.js](uranium/raw/master/build/src/uranium.js) +The declarative Javascript in Uranium is not designed for performing functions, but for enabling interactions. It's a bad idea to add attributes to an element to perform some Javascript logic. This is exactly why onclicks should be avoided. If you want to execute site logic or perform functions, that's what events / listeners / callbacks are for. The declarative approach promoted by Uranium makes the view (your UI/UX) rely on the model (your HTML). -View the [website](http://uraniumjs.com/) for a [tutorial](http://uraniumjs.com/tutorials.html) (we have videos!), more details, and awesome [demos](http://uraniumjs.com/widget_list.html). +**But I need to do x/y/z functions that Uranium doesn't handle !** + +You're in luck! Uranium is designed to work with [jQuery](http://www.jquery.com) – which (we think) provides a great set of convenient Javascript functions along with some very useful cross-browser compatibility features. With this in mind, using Uranium gives you the best of both worlds – its primary purpose is to make it easy to add great interaction – but if you need to do something fancy, it makes sure the tools you need to do so concisely are also available. -- Read our [philosophy](http://uraniumjs.com/more.html) to understand our design goals and see how to implement a widget. -- Admire all the [widgets](http://uraniumjs.com/widget_list.html) available. --- -# Uranium is not ... +## Building Uranium -**... designed for executing logic or site functions** +If you're contributing to the code base, you need to test your changes and update the bundled Javascript. -Uranium makes the view (your UI/UX) rely on the model (your HTML). The declarative aspect is not designed for performing functions. You wouldn't want to add attributes to an element to perform some js logic (this is exactly why onclicks should be avoided) -- thats what events / listeners / callbacks are for. +**Bundling** -**But I need to do x/y/z functions that Uranium doesn't handle !** +Bundling uses [fusion](http://rubygems.org/gems/fusion) to bundle the Javascript. This means you have to install the fusion ruby gem before you can run the build process. To perform the default build from inside your local copy of the Uranium repository, just do: + + gem install fusion + cd build + rake + +This will read in the full Javascript source in the lib/jquery.uranium.js file, and place both full-source and minified copies of Uranium in build/src/. -You're in luck! Uranium bundles with xui -- which (we think) provides a great minimal set of convenient javascript functions (query, add-listeners, ajax, iterate, etc). With this in mind, Uranium is the best of both worlds -- its primary purpose is to make it easy to create great widgets UI/UX -- but if you need to do something fancy, it gives you the tools you need to do so concisely. +**Testing** +You need to go through all of the test cases in the /examples/index.html file and make sure that all the interactions still work. Of course, if you've added functionality, or a new interaction, you need to make a test example for your new cases as well and make sure those pass. It should be an example file that can be shown on the website. --- -# Building Uranium +## Building an Interaction -If you're contributing to the code base, you need to test your changes and update the bundled javascript. +Fork Uranium. Build your interaction. Issue a Pull Request. Revel in glory. -**Bundling** +If you're contributing to the code base, you need to test your changes and update the bundled Javascript. -Bundling uses the Google Closure Compiler to bundle the javascript. Don't worry -- part of the rake task is to install if for you! To perform the default build, just do: +**Technical** - cd build - rake +TODO: Information on how the code base should be structured, conventions, etc... -This will compile all the widgets with each flavor (BB/IE/webkit) of xui. +To get the examples running locally, start the jekyll server with: -**Custom Bundling** +`jekyll serve --watch` -The rake task really just reads the config files (e.g. webkit.yaml) to know how to bundle the javascript. The different versions also have different widget lists to reflect those widgets compatabile with that browser flavor. +In a separate terminal process, run -If you want to omit certain widgets or make a custom build, you're welcome to do so locally (and can do so by making your own custom yaml file / build task). This is a great way to only build a smaller version of the specific widgets that you'll need. +`sass --watch examples/scss:_examples/css --line-comments --compass` -**Testing** +on the stylesheets folder to compile your Sass files. -You need to go through all of the test cases under /examples and make sure that all the widgets still work. Of course, if you've added functionality or a new widget, you need to make a test example for your new cases as well and make sure those pass. It should be an example file that can be shown on the website. +You will be able to navigate to [localhost:4000](localhost:4000) to see the examples running in your browser. ---- +**Documentation** -# Building a Widget +You'll need to generate a .html file demonstrating the use of your new interaction. It goes in the examples folder, and should do the following things -Fork Uranium. Build your widget. Issue a Pull Request. Revel in glory. +* Provide documentation of all the attributes, CSS, and JS required to make the interaction go. +* At least one example of how the interaction can be used. -If you're contributing to the code base, you need to test your changes and update the bundled javascript. +**Important Note** -**Technical** +If there are two versions of jQuery on a page, Uranium will break. To avoid this, try to only use 1 instance of jQuery. If that is not possible, you will need to use jQuery.noConflict() on both instances. -TODO: Information on how the code base should be structured, conventions, etc... +--- -Start the jekyll server with `jekyll --server --pygments` +## Future Wishlist -Run `sass --watch stylesheets/sass:stylesheets --line-comments --compass` onteh stylesheets folder to compile your SASS files. +Uranium is an ongoing project and we're constantly looking to add useful features (that are within the scope of the ideals above). -**Documentation** +Additional features to current interactions: + + - *Carousel*: "Stop autoscroll" button + - *Carousel*: Auto-populate clones on infinite scroll when container is larger than actual items + - *Geocode*: Entering zipcode should find address -You'll need to generate an .html file that goes in the _site/widgets folder that should do the following things +New interactions: -* Provide documentation of all the attributes, CSS, and JS required to make the widget go. -* At least one example of how the widget can be used. + - Validation interaction for form inputs --- -# MIT License +## MIT License -Copyright (C) 2011 by Moov Corporation (aka Moovweb) +Copyright (C) 2011-2013 by Moov Corporation (aka Moovweb) -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/Rakefile b/Rakefile index 9167fbb..4112599 100644 --- a/Rakefile +++ b/Rakefile @@ -49,3 +49,4 @@ task :upload => [:enrich] do end task :default => [:enrich] + diff --git a/VERSION b/VERSION index ceab6e1..9f8e9b6 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.1 \ No newline at end of file +1.0 \ No newline at end of file diff --git a/_config.yml b/_config.yml index 7c0b799..7c10a7f 100644 --- a/_config.yml +++ b/_config.yml @@ -1,4 +1,4 @@ -# url: "http://moovweb.github.com/uranium/" -source: "examples/site" -destination: "examples/site/_site" -auto: "true" \ No newline at end of file +url: "http://moovweb.github.com/uranium/" +source: "examples/" +destination: "_examples" +pygments: true \ No newline at end of file diff --git a/bootstrap/README.md b/bootstrap/README.md deleted file mode 100644 index bb3a55e..0000000 --- a/bootstrap/README.md +++ /dev/null @@ -1,5 +0,0 @@ -# BOOTSTRAP - -**Purpose**: Ask as an instructional launching pad for building widgets. - -**TODO**: Provide instructions \ No newline at end of file diff --git a/bootstrap/css/scss/test.sass b/bootstrap/css/scss/test.sass deleted file mode 100644 index 56b11b2..0000000 --- a/bootstrap/css/scss/test.sass +++ /dev/null @@ -1,52 +0,0 @@ -@import compass - -// File SCSS - -body - font-family: sans-serif - -h1 - margin: 0px 20px - -.test, .description - border: 1px solid #555555 - margin: 20px - padding: 0px 10px 10px - -.demo - border: 1px solid green - margin: 20px - padding: 0px 10px 10px - -.code - border: 1px solid blue - margin: 20px - padding: 0px 10px 10px - background: #E8E8E8 - color: black - font-family: courier - text-align: left - overflow: scroll - -// Widget specific SCSS - -*[data-ur-set='input-clear'] - position: relative - input[data-ur-input-clear-component='input'] - width: 100% - min-height: 30px - position: relative - +box-sizing(border-box) - .data-ur-input-clear-ex - // absolute to allow for center positioning in the text field - position: absolute - display: none - // created from the glyphicons (http://glyphicons.com/) circle_remove icon - // image included such that it can be modified to be smaller or the color changed if desired - background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABoAAAAaCAYAAACpSkzOAAAKQ2lDQ1BJQ0MgcHJvZmlsZQAAeNqdU3dYk/cWPt/3ZQ9WQtjwsZdsgQAiI6wIyBBZohCSAGGEEBJAxYWIClYUFRGcSFXEgtUKSJ2I4qAouGdBiohai1VcOO4f3Ke1fXrv7e371/u855zn/M55zw+AERImkeaiagA5UoU8Otgfj09IxMm9gAIVSOAEIBDmy8JnBcUAAPADeXh+dLA//AGvbwACAHDVLiQSx+H/g7pQJlcAIJEA4CIS5wsBkFIAyC5UyBQAyBgAsFOzZAoAlAAAbHl8QiIAqg0A7PRJPgUA2KmT3BcA2KIcqQgAjQEAmShHJAJAuwBgVYFSLALAwgCgrEAiLgTArgGAWbYyRwKAvQUAdo5YkA9AYACAmUIszAAgOAIAQx4TzQMgTAOgMNK/4KlfcIW4SAEAwMuVzZdL0jMUuJXQGnfy8ODiIeLCbL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JBGzmc7d+eD8BGVZ1nv9PSkU0aiicgjMAMmdnQCalU9pvyfJQRfAwsD8VkNlMAmBpoFAMZAYSCX2AYoVPU8CCQiz8AWmHOd7YGVqh6CQAaya9XhWjsBrg2W9eja/SETX2auoTFvfShuCILFKjoZmbrqyE+lqW7uuXVtqgzZTFWPTUYxdW1VdQk4C9ynZmniCdm6TV3oRqWqvgEY1w1Yh3/zKQMxFgDZAG2dgC3R4DmLCWmWicirOZEK5mnuIbW6PDJa2urZNZlcAUJToxN3sBSgIHU9gQwC1ZeAiMi4TWMiWJ3baA+B1QF17TxgsRg/DRvsARF59xS+IxDzWUSmyv1G0Aigqqqzc24CvAScn4Cp53xq34IPoap++qb3/oaK3v+a3vd4+PJeXxxS+yKhJTpP+ajvVVXVl3PuA3iI1Cy2nKx829D/rlsDCyRWw4sWyG+u+8N6uRUsuAAAAABJRU5ErkJggg==) no-repeat - // if you alter the size of the image, the dimensions - // and layout position will need to be changed as well - height: 27px - width: 27px - top: 4px - right: 2px diff --git a/bootstrap/css/scss/test.scss b/bootstrap/css/scss/test.scss deleted file mode 100644 index 88bfb86..0000000 --- a/bootstrap/css/scss/test.scss +++ /dev/null @@ -1,59 +0,0 @@ -@import "compass"; -// File SCSS - -body { - font-family: sans-serif; -} - -h1 { - margin: 0px 20px; -} - -.test, .description { - border: 1px solid #555555; - margin: 20px; - padding: 0px 10px 10px; -} - -.demo { - border: 1px solid green; - margin: 20px; - padding: 0px 10px 10px; -} - -.code { - border: 1px solid blue; - margin: 20px; - padding: 0px 10px 10px; - background: #E8E8E8; - color: black; - font-family: courier; - text-align: left; - overflow: scroll; -} - -// Widget specific SCSS - -*[data-ur-set='input-clear'] { - position: relative; - input[data-ur-input-clear-component='input'] { - width:100%; - min-height: 30px; - position: relative; - @include box-sizing(border-box); - } - .data-ur-input-clear-ex { - // absolute to allow for center positioning in the text field - position: absolute; - display: none; - // created from the glyphicons (http://glyphicons.com/) circle_remove icon - // image included such that it can be modified to be smaller or the color changed if desired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3x+eSCk+OnZKeenU4/PdSZ3Hn3TPyZa11RXb1nQ8+ePxd07ky3X/fJ897nj13wvHD0Ivdi2yW3S609rj1HfnD94UivW2/rZffL7Vc8rnT0Tes70e/Tf/pqwNVz1/jXLl2feb3vxuwbt24m3Ry4Jbr1+Hb27Rd3Cu5M3F16j3iv/L7a/eoH+g/qf7T+sWXAbeD4YMBgz8NZD+8OCYee/pT/04fh0kfMR9UjRiONj50fHxsNGr3yZM6T4aeypxPPyn5W/3nrc6vn3/3i+0vPWPzY8Av5i8+/rnmp83Lvq6mvOscjxx+8znk98ab8rc7bfe+477rfx70fmSj8QP5Q89H6Y8en0E/3Pud8/vwv94Tz+4A5JREAAAAGYktHRAD/AP8A/6C9p5MAAAAJcEhZcwAACxMAAAsTAQCanBgAAAAHdElNRQfcAx8WHyF/aorvAAABgUlEQVRIx8WWsXnCQAyFf5smHZR0oUwXynS5EWADsgEbyNqADUKZdB4BbwAbmDIdbJBGzmc7d+eD8BGVZ1nv9PSkU0aiicgjMAMmdnQCalU9pvyfJQRfAwsD8VkNlMAmBpoFAMZAYSCX2AYoVPU8CCQiz8AWmHOd7YGVqh6CQAaya9XhWjsBrg2W9eja/SETX2auoTFvfShuCILFKjoZmbrqyE+lqW7uuXVtqgzZTFWPTUYxdW1VdQk4C9ynZmniCdm6TV3oRqWqvgEY1w1Yh3/zKQMxFgDZAG2dgC3R4DmLCWmWicirOZEK5mnuIbW6PDJa2urZNZlcAUJToxN3sBSgIHU9gQwC1ZeAiMi4TWMiWJ3baA+B1QF17TxgsRg/DRvsARF59xS+IxDzWUSmyv1G0Aigqqqzc24CvAScn4Cp53xq34IPoap++qb3/oaK3v+a3vd4+PJeXxxS+yKhJTpP+ajvVVXVl3PuA3iI1Cy2nKx829D/rlsDCyRWw4sWyG+u+8N6uRUsuAAAAABJRU5ErkJggg==) no-repeat; - // if you alter the size of the image, the dimensions - // and layout position will need to be changed as well - height: 27px; - width: 27px; - top: 4px; - right: 2px; - } -} diff --git a/bootstrap/css/test.css b/bootstrap/css/test.css deleted file mode 100644 index f232ff4..0000000 --- a/bootstrap/css/test.css +++ /dev/null @@ -1,43 +0,0 @@ -body { - font-family: sans-serif; } - -h1 { - margin: 0px 20px; } - -.test, .description { - border: 1px solid #555555; - margin: 20px; - padding: 0px 10px 10px; } - -.demo { - border: 1px solid green; - margin: 20px; - padding: 0px 10px 10px; } - -.code { - border: 1px solid blue; - margin: 20px; - padding: 0px 10px 10px; - background: #E8E8E8; - color: black; - font-family: courier; - text-align: left; - overflow: scroll; } - -*[data-ur-set='input-clear'] { - position: relative; } - *[data-ur-set='input-clear'] input[data-ur-input-clear-component='input'] { - width: 100%; - min-height: 30px; - position: relative; - -webkit-box-sizing: border-box; - -moz-box-sizing: border-box; - box-sizing: border-box; } - *[data-ur-set='input-clear'] .data-ur-input-clear-ex { - position: absolute; - display: none; - background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABoAAAAaCAYAAACpSkzOAAAKQ2lDQ1BJQ0MgcHJvZmlsZQAAeNqdU3dYk/cWPt/3ZQ9WQtjwsZdsgQAiI6wIyBBZohCSAGGEEBJAxYWIClYUFRGcSFXEgtUKSJ2I4qAouGdBiohai1VcOO4f3Ke1fXrv7e371/u855zn/M55zw+AERImkeaiagA5UoU8Otgfj09IxMm9gAIVSOAEIBDmy8JnBcUAAPADeXh+dLA//AGvbwACAHDVLiQSx+H/g7pQJlcAIJEA4CIS5wsBkFIAyC5UyBQAyBgAsFOzZAoAlAAAbHl8QiIAqg0A7PRJPgUA2KmT3BcA2KIcqQgAjQEAmShHJAJAuwBgVYFSLALAwgCgrEAiLgTArgGAWbYyRwKAvQUAdo5YkA9AYACAmUIszAAgOAIAQx4TzQMgTAOgMNK/4KlfcIW4SAEAwMuVzZdL0jMUuJXQGnfy8ODiIeLCbLFCYRcpEGYJ5CKcl5sjE0jnA0zODAAAGvnRwf44P5Dn5uTh5mbnbO/0xaL+a/BvIj4h8d/+vIwCBAAQTs/v2l/l5dYDcMc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d7YGVqh6CQAaya9XhWjsBrg2W9eja/SETX2auoTFvfShuCILFKjoZmbrqyE+lqW7uuXVtqgzZTFWPTUYxdW1VdQk4C9ynZmniCdm6TV3oRqWqvgEY1w1Yh3/zKQMxFgDZAG2dgC3R4DmLCWmWicirOZEK5mnuIbW6PDJa2urZNZlcAUJToxN3sBSgIHU9gQwC1ZeAiMi4TWMiWJ3baA+B1QF17TxgsRg/DRvsARF59xS+IxDzWUSmyv1G0Aigqqqzc24CvAScn4Cp53xq34IPoap++qb3/oaK3v+a3vd4+PJeXxxS+yKhJTpP+ajvVVXVl3PuA3iI1Cy2nKx829D/rlsDCyRWw4sWyG+u+8N6uRUsuAAAAABJRU5ErkJggg==) no-repeat; - height: 27px; - width: 27px; - top: 4px; - right: 2px; } diff --git a/bootstrap/images/glyphicons_192_circle_remove.png b/bootstrap/images/glyphicons_192_circle_remove.png deleted file mode 100755 index 5c06da2..0000000 Binary files a/bootstrap/images/glyphicons_192_circle_remove.png and /dev/null differ diff --git a/bootstrap/images/remove.png b/bootstrap/images/remove.png deleted file mode 100644 index 1cd221d..0000000 Binary files a/bootstrap/images/remove.png and /dev/null differ diff --git a/bootstrap/widget_bootstrap.html b/bootstrap/widget_bootstrap.html deleted file mode 100644 index c44cdee..0000000 --- a/bootstrap/widget_bootstrap.html +++ /dev/null @@ -1,78 +0,0 @@ - - - - Input Clear - - - - - - - - - - - - - - - - - -

Widget Bootstrap

-
- -

When a user focuses on a text input field, a small x appears along the right side of the field that can be clicked to clear it.

-
-
- -

Demo

-
- -
- -
- -
- -
- -
-
-
- -

HTML Attributes

-
-  data-ur-set='input-clear'
-  data-ur-input-clear-component='input-clear'
-
- -

Required SCSS

-
-  *[data-ur-set='input-clear'] {
-    position: relative;
-    input[data-ur-input-clear-component='input'] {
-      width:100%;
-      min-height: 30px;
-      position: relative;
-      @include box-sizing(border-box);
-    }
-    .data-ur-input-clear-ex {
-      // absolute to allow for center positioning in the text field
-      position: absolute;
-      display: none;
-      // created from the glyphicons circle_remove icon
-      // image included such that it can be modified to be smaller or the color changed if desired
-      background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABoAAAAaCAYAAACpSkzOAAAKQ2lDQ1BJQ0MgcHJvZmlsZQAAeNqdU3dYk/cWPt/3ZQ9WQtjwsZdsgQAiI6wIyBBZohCSAGGEEBJAxYWIClYUFRGcSFXEgtUKSJ2I4qAouGdBiohai1VcOO4f3Ke1fXrv7e371/u855zn/M55zw+AERImkeaiagA5UoU8Otgfj09IxMm9gAIVSOAEIBDmy8JnBcUAAPADeXh+dLA//AGvbwACAHDVLiQSx+H/g7pQJlcAIJEA4CIS5wsBkFIAyC5UyBQAyBgAsFOzZAoAlAAAbHl8QiIAqg0A7PRJPgUA2KmT3BcA2KIcqQgAjQEAmShHJAJAuwBgVYFSLALAwgCgrEAiLgTArgGAWbYyRwKAvQUAdo5YkA9AYACAmUIszAAgOAIAQx4TzQMgTAOgMNK/4KlfcIW4SAEAwMuVzZdL0jMUuJXQGnfy8ODiIeLCbLFCYRcpEGYJ5CKcl5sjE0jnA0zODAAAGvnRwf44P5Dn5uTh5mbnbO/0xaL+a/BvIj4h8d/+vIwCBAAQTs/v2l/l5dYDcMcBsHW/a6lbANpWAGjf+V0z2wmgWgrQevmLeTj8QB6eoVDIPB0cCgsL7SViob0w44s+/zPhb+CLfvb8QB7+23rwAHGaQJmtwKOD/XFhbnauUo7nywRCMW735yP+x4V//Y4p0eI0sVwsFYrxWIm4UCJNx3m5UpFEIcmV4hLpfzLxH5b9CZN3DQCshk/ATrYHtctswH7uAQKLDljSdgBAfvMtjBoLkQAQZzQyefcAAJO/+Y9AKwEAzZek4wAAvOgYXKiUF0zGCAAARKCBKrBBBwzBFKzADpzBHbzAFwJhBkRADCTAPBBCBuSAHAqhGJZBGVTAOtgEtbADGqARmuEQtMExOA3n4BJcgetwFwZgGJ7CGLyGCQRByAgTYSE6iBFijtgizggXmY4EImFINJKApCDpiBRRIsXIcqQCqUJqkV1II/ItchQ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9ob3v6IyjnR1eHUe+t/9+7zHjY3XHNY9XnqCdKD3x+eSCk+OnZKeenU4/PdSZ3Hn3TPyZa11RXb1nQ8+ePxd07ky3X/fJ897nj13wvHD0Ivdi2yW3S609rj1HfnD94UivW2/rZffL7Vc8rnT0Tes70e/Tf/pqwNVz1/jXLl2feb3vxuwbt24m3Ry4Jbr1+Hb27Rd3Cu5M3F16j3iv/L7a/eoH+g/qf7T+sWXAbeD4YMBgz8NZD+8OCYee/pT/04fh0kfMR9UjRiONj50fHxsNGr3yZM6T4aeypxPPyn5W/3nrc6vn3/3i+0vPWPzY8Av5i8+/rnmp83Lvq6mvOscjxx+8znk98ab8rc7bfe+477rfx70fmSj8QP5Q89H6Y8en0E/3Pud8/vwv94Tz+4A5JREAAAAGYktHRAD/AP8A/6C9p5MAAAAJcEhZcwAACxMAAAsTAQCanBgAAAAHdElNRQfcAx8WHyF/aorvAAABgUlEQVRIx8WWsXnCQAyFf5smHZR0oUwXynS5EWADsgEbyNqADUKZdB4BbwAbmDIdbJBGzmc7d+eD8BGVZ1nv9PSkU0aiicgjMAMmdnQCalU9pvyfJQRfAwsD8VkNlMAmBpoFAMZAYSCX2AYoVPU8CCQiz8AWmHOd7YGVqh6CQAaya9XhWjsBrg2W9eja/SETX2auoTFvfShuCILFKjoZmbrqyE+lqW7uuXVtqgzZTFWPTUYxdW1VdQk4C9ynZmniCdm6TV3oRqWqvgEY1w1Yh3/zKQMxFgDZAG2dgC3R4DmLCWmWicirOZEK5mnuIbW6PDJa2urZNZlcAUJToxN3sBSgIHU9gQwC1ZeAiMi4TWMiWJ3baA+B1QF17TxgsRg/DRvsARF59xS+IxDzWUSmyv1G0Aigqqqzc24CvAScn4Cp53xq34IPoap++qb3/oaK3v+a3vd4+PJeXxxS+yKhJTpP+ajvVVXVl3PuA3iI1Cy2nKx829D/rlsDCyRWw4sWyG+u+8N6uRUsuAAAAABJRU5ErkJggg==) no-repeat;
-      // if you alter the size of the image, the dimensions
-      // and layout position will need to be changed as well
-      height: 27px;
-      width: 27px;
-      top: 4px;
-      right: 2px;
-    }
-  }
-
-
- - \ No newline at end of file diff --git a/build/optimized-bundles.yml b/build/optimized-bundles.yml index ca0a980..3980039 100644 --- a/build/optimized-bundles.yml +++ b/build/optimized-bundles.yml @@ -1,28 +1,4 @@ ---- +--- - :output_file: src/uranium.js - :input_directory: ../lib :input_files: - - ../lib/external/xui-2.3.2.js - - ../lib/external/showhide.js - - ../lib/external/fade.js - - ../lib/uranium_mixins.js -- :output_file: src/uranium-bb.js - :input_files: - - ../lib/external/xui-bb-2.3.2.js - - ../lib/external/showhide.js - - ../lib/external/fade.js - - ../lib/uranium_mixins.js - - ../lib/toggler.js - - ../lib/tabs.js - - ../lib/select_list.js - - ../lib/select_buttons.js -- :output_file: src/uranium-ie.js - :input_files: - - ../lib/external/xui-ie-2.3.2.js - - ../lib/external/showhide.js - - ../lib/external/fade.js - - ../lib/uranium_mixins.js - - ../lib/toggler.js - - ../lib/tabs.js - - ../lib/select_list.js - - ../lib/select_buttons.js + - src/uranium-pretty.js diff --git a/build/pretty-bundles.yml b/build/pretty-bundles.yml index 4e3b59d..8a93d15 100644 --- a/build/pretty-bundles.yml +++ b/build/pretty-bundles.yml @@ -1,28 +1,25 @@ ---- +--- - :output_file: src/uranium-pretty.js - :input_directory: ../lib :input_files: - - ../lib/external/xui-2.3.2.js - - ../lib/external/showhide.js - - ../lib/external/fade.js - - ../lib/uranium_mixins.js -- :output_file: src/uranium-bb-pretty.js - :input_files: - - ../lib/external/xui-bb-2.3.2.js - - ../lib/external/showhide.js - - ../lib/external/fade.js - - ../lib/uranium_mixins.js + - ../lib/before.js + - ../lib/helpers.js - ../lib/toggler.js - ../lib/tabs.js - - ../lib/select_list.js - - ../lib/select_buttons.js -- :output_file: src/uranium-ie-pretty.js + - ../lib/inputclear.js + - ../lib/geocode.js + - ../lib/zoom.js + - ../lib/carousel.js + - ../lib/setup.js + - ../lib/after.js +- :output_file: ../examples/scripts/jquery.uranium.js :input_files: - - ../lib/external/xui-ie-2.3.2.js - - ../lib/external/showhide.js - - ../lib/external/fade.js - - ../lib/uranium_mixins.js + - ../lib/before.js + - ../lib/helpers.js - ../lib/toggler.js - ../lib/tabs.js - - ../lib/select_list.js - - ../lib/select_buttons.js + - ../lib/inputclear.js + - ../lib/geocode.js + - ../lib/zoom.js + - ../lib/carousel.js + - ../lib/setup.js + - ../lib/after.js diff --git a/build/src/uranium-bb-pretty.js b/build/src/uranium-bb-pretty.js deleted file mode 100644 index 9135e1a..0000000 --- a/build/src/uranium-bb-pretty.js +++ /dev/null @@ -1,3198 +0,0 @@ -(function () { -/** - Basics - ====== - - xui is available as the global `x$` function. It accepts a CSS selector string or DOM element, or an array of a mix of these, as parameters, - and returns the xui object. For example: - - var header = x$('#header'); // returns the element with id attribute equal to "header". - - For more information on CSS selectors, see the [W3C specification](http://www.w3.org/TR/CSS2/selector.html). Please note that there are - different levels of CSS selector support (Levels 1, 2 and 3) and different browsers support each to different degrees. Be warned! - - The functions described in the docs are available on the xui object and often manipulate or retrieve information about the elements in the - xui collection. - -*/ -var undefined, - xui, - window = this, - string = new String('string'), // prevents Goog compiler from removing primative and subsidising out allowing us to compress further - document = window.document, // obvious really - simpleExpr = /^#?([\w-]+)$/, // for situations of dire need. Symbian and the such - idExpr = /^#/, - tagExpr = /<([\w:]+)/, // so you can create elements on the fly a la x$('yay') - slice = function (e) { return [].slice.call(e, 0); }; - try { var a = slice(document.documentElement.childNodes)[0].nodeType; } - catch(e){ slice = function (e) { var ret=[]; for (var i=0; e[i]; i++) ret.push(e[i]); return ret; }; } - -window.x$ = window.xui = xui = function(q, context) { - return new xui.fn.find(q, context); -}; - -// patch in forEach to help get the size down a little and avoid over the top currying on event.js and dom.js (shortcuts) -if (! [].forEach) { - Array.prototype.forEach = function(fn) { - var len = this.length || 0, - i = 0, - that = arguments[1]; // wait, what's that!? awwww rem. here I thought I knew ya! - // @rem - that that is a hat tip to your thats :) - - if (typeof fn == 'function') { - for (; i < len; i++) { - fn.call(that, this[i], i, this); - } - } - }; -} -/* - * Array Remove - By John Resig (MIT Licensed) - */ -function removex(array, from, to) { - var rest = array.slice((to || from) + 1 || array.length); - array.length = from < 0 ? array.length + from: from; - return array.push.apply(array, rest); -} - -// converts all CSS style names to DOM style names, i.e. margin-left to marginLeft -function domstyle(name) { - return name.replace(/\-[a-z]/g,function(m) { return m[1].toUpperCase(); }); -} - -// converts all DOM style names to CSS style names, i.e. marginLeft to margin-left -function cssstyle(name) { - return name.replace(/[A-Z]/g, function(m) { return '-'+m.toLowerCase(); }) -} - -xui.fn = xui.prototype = { - -/** - extend - ------ - - Extends XUI's prototype with the members of another object. - - ### syntax ### - - xui.extend( object ); - - ### arguments ### - - - object `Object` contains the members that will be added to XUI's prototype. - - ### example ### - - Given: - - var sugar = { - first: function() { return this[0]; }, - last: function() { return this[this.length - 1]; } - } - - We can extend xui's prototype with members of `sugar` by using `extend`: - - xui.extend(sugar); - - Now we can use `first` and `last` in all instances of xui: - - var f = x$('.button').first(); - var l = x$('.notice').last(); -*/ - extend: function(o) { - for (var i in o) { - xui.fn[i] = o[i]; - } - }, - -/** - find - ---- - - Find the elements that match a query string. `x$` is an alias for `find`. - - ### syntax ### - - x$( window ).find( selector, context ); - - ### arguments ### - - - selector `String` is a CSS selector that will query for elements. - - context `HTMLElement` is the parent element to search from _(optional)_. - - ### example ### - - Given the following markup: - - - - - We can select list items using `find`: - - x$('li'); // returns all four list item elements. - x$('#second').find('li'); // returns list items "three" and "four" -*/ - find: function(q, context) { - var ele = [], tempNode; - - if (!q) { - return this; - } else if (context == undefined && this.length) { - ele = this.each(function(el) { - ele = ele.concat(slice(xui(q, el))); - }).reduce(ele); - } else { - context = context || document; - // fast matching for pure ID selectors and simple element based selectors - if (typeof q == string) { - if (simpleExpr.test(q) && context.getElementById && context.getElementsByTagName) { - ele = idExpr.test(q) ? [context.getElementById(q.substr(1))] : context.getElementsByTagName(q); - // nuke failed selectors - if (ele[0] == null) { - ele = []; - } - // match for full html tags to create elements on the go - } else if (tagExpr.test(q)) { - tempNode = document.createElement('i'); - tempNode.innerHTML = q; - slice(tempNode.childNodes).forEach(function (el) { - ele.push(el); - }); - } else { - // one selector, check if Sizzle is available and use it instead of querySelectorAll. - if (window.Sizzle !== undefined) { - ele = Sizzle(q, context); - } else { - ele = context.querySelectorAll(q); - } - } - // blanket slice - ele = slice(ele); - } else if (q instanceof Array) { - ele = q; - } else if (q.nodeName || q === window) { // only allows nodes in - // an element was passed in - ele = [q]; - } else if (q.toString() == '[object NodeList]' || -q.toString() == '[object HTMLCollection]' || typeof q.length == 'number') { - ele = slice(q); - } - } - // disabling the append style, could be a plugin (found in more/base): - // xui.fn.add = function (q) { this.elements = this.elements.concat(this.reduce(xui(q).elements)); return this; } - return this.set(ele); - }, - -/** - set - --- - - Sets the objects in the xui collection. - - ### syntax ### - - x$( window ).set( array ); -*/ - set: function(elements) { - var ret = xui(); - ret.cache = slice(this.length ? this : []); - ret.length = 0; - [].push.apply(ret, elements); - return ret; - }, - -/** - reduce - ------ - - Reduces the set of elements in the xui object to a unique set. - - ### syntax ### - - x$( window ).reduce( elements, index ); - - ### arguments ### - - - elements `Array` is an array of elements to reduce _(optional)_. - - index `Number` is the last array index to include in the reduction. If unspecified, it will reduce all elements _(optional)_. -*/ - reduce: function(elements, b) { - var a = [], - elements = elements || slice(this); - elements.forEach(function(el) { - // question the support of [].indexOf in older mobiles (RS will bring up 5800 to test) - if (a.indexOf(el, 0, b) < 0) - a.push(el); - }); - - return a; - }, - -/** - has - --- - - Returns the elements that match a given CSS selector. - - ### syntax ### - - x$( window ).has( selector ); - - ### arguments ### - - - selector `String` is a CSS selector that will match all children of the xui collection. - - ### example ### - - Given: - -
-
Item one
-
Item two
-
- - We can use `has` to select specific objects: - - var divs = x$('div'); // got all three divs. - var rounded = divs.has('.round'); // got two divs with the class .round -*/ - has: function(q) { - var list = xui(q); - return this.filter(function () { - var that = this; - var found = null; - list.each(function (el) { - found = (found || el == that); - }); - return found; - }); - }, - -/** - filter - ------ - - Extend XUI with custom filters. This is an interal utility function, but is also useful to developers. - - ### syntax ### - - x$( window ).filter( fn ); - - ### arguments ### - - - fn `Function` is called for each element in the XUI collection. - - // `index` is the array index of the current element - function( index ) { - // `this` is the element iterated on - // return true to add element to new XUI collection - } - - ### example ### - - Filter all the `` elements that are disabled: - - x$('input').filter(function(index) { - return this.checked; - }); -*/ - filter: function(fn) { - var elements = []; - return this.each(function(el, i) { - if (fn.call(el, i)) elements.push(el); - }).set(elements); - }, - -/** - not - --- - - The opposite of `has`. It modifies the elements and returns all of the elements that do __not__ match a CSS query. - - ### syntax ### - - x$( window ).not( selector ); - - ### arguments ### - - - selector `String` a CSS selector for the elements that should __not__ be matched. - - ### example ### - - Given: - -
-
Item one
-
Item two
-
Item three
-
Item four
-
- - We can use `not` to select objects: - - var divs = x$('div'); // got all four divs. - var notRound = divs.not('.round'); // got two divs with classes .square and .shadow -*/ - not: function(q) { - var list = slice(this), - omittedNodes = xui(q); - if (!omittedNodes.length) { - return this; - } - return this.filter(function(i) { - var found; - omittedNodes.each(function(el) { - return found = list[i] != el; - }); - return found; - }); - }, - -/** - each - ---- - - Element iterator for an XUI collection. - - ### syntax ### - - x$( window ).each( fn ) - - ### arguments ### - - - fn `Function` callback that is called once for each element. - - // `element` is the current element - // `index` is the element index in the XUI collection - // `xui` is the XUI collection. - function( element, index, xui ) { - // `this` is the current element - } - - ### example ### - - x$('div').each(function(element, index, xui) { - alert("Here's the " + index + " element: " + element); - }); -*/ - each: function(fn) { - // we could compress this by using [].forEach.call - but we wouldn't be able to support - // fn return false breaking the loop, a feature I quite like. - for (var i = 0, len = this.length; i < len; ++i) { - if (fn.call(this[i], this[i], i, this) === false) - break; - } - return this; - } -}; - -xui.fn.find.prototype = xui.fn; -xui.extend = xui.fn.extend; -/** - DOM - === - - Set of methods for manipulating the Document Object Model (DOM). - -*/ -xui.extend({ -/** - html - ---- - - Manipulates HTML in the DOM. Also just returns the inner HTML of elements in the collection if called with no arguments. - - ### syntax ### - - x$( window ).html( location, html ); - - or this method will accept just a HTML fragment with a default behavior of inner: - - x$( window ).html( html ); - - or you can use shorthand syntax by using the location name argument as the function name: - - x$( window ).outer( html ); - x$( window ).before( html ); - - or you can just retrieve the inner HTML of elements in the collection with: - - x$( document.body ).html(); - - ### arguments ### - - - location `String` can be one of: _inner_, _outer_, _top_, _bottom_, _remove_, _before_ or _after_. - - html `String` is a string of HTML markup or a `HTMLElement`. - - ### example ### - - x$('#foo').html('inner', 'rock and roll'); - x$('#foo').html('outer', '

lock and load

'); - x$('#foo').html('top', '
bangers and mash
'); - x$('#foo').html('bottom','mean and clean'); - x$('#foo').html('remove'); - x$('#foo').html('before', '

some warmup html

'); - x$('#foo').html('after', '

more html!

'); - - or - - x$('#foo').html('

sweet as honey

'); - x$('#foo').outer('

free as a bird

'); - x$('#foo').top('top of the pops'); - x$('#foo').bottom('bottom of the barrel'); - x$('#foo').before('
first in line
'); - x$('#foo').after('better late than never'); -*/ - html: function(location, html) { - clean(this); - - if (arguments.length == 0) { - var i = []; - this.each(function(el) { - i.push(el.innerHTML); - }); - return i; - } - if (arguments.length == 1 && arguments[0] != 'remove') { - html = location; - location = 'inner'; - } - if (location != 'remove' && html && html.each !== undefined) { - if (location == 'inner') { - var d = document.createElement('p'); - html.each(function(el) { - d.appendChild(el); - }); - this.each(function(el) { - el.innerHTML = d.innerHTML; - }); - } else { - var that = this; - html.each(function(el){ - that.html(location, el); - }); - } - return this; - } - return this.each(function(el) { - var parent, - list, - len, - i = 0; - if (location == "inner") { // .html - if (typeof html == string || typeof html == "number") { - el.innerHTML = html; - list = el.getElementsByTagName('SCRIPT'); - len = list.length; - for (; i < len; i++) { - eval(list[i].text); - } - } else { - el.innerHTML = ''; - el.appendChild(html); - } - } else { - if (location == 'remove') { - el.parentNode.removeChild(el); - } else { - var elArray = ['outer', 'top', 'bottom'], - wrappedE = wrapHelper(html, (elArray.indexOf(location) > -1 ? el : el.parentNode )), - children = wrappedE.childNodes; - if (location == "outer") { // .replaceWith - el.parentNode.replaceChild(wrappedE, el); - } else if (location == "top") { // .prependTo - el.insertBefore(wrappedE, el.firstChild); - } else if (location == "bottom") { // .appendTo - el.insertBefore(wrappedE, null); - } else if (location == "before") { // .insertBefore - el.parentNode.insertBefore(wrappedE, el); - } else if (location == "after") { // .insertAfter - el.parentNode.insertBefore(wrappedE, el.nextSibling); - } - var parent = wrappedE.parentNode; - while(children.length) { - parent.insertBefore(children[0], wrappedE); - } - parent.removeChild(wrappedE); - } - } - }); - }, - -/** - attr - ---- - - Gets or sets attributes on elements. If getting, returns an array of attributes matching the xui element collection's indices. - - ### syntax ### - - x$( window ).attr( attribute, value ); - - ### arguments ### - - - attribute `String` is the name of HTML attribute to get or set. - - value `Varies` is the value to set the attribute to. Do not use to get the value of attribute _(optional)_. - - ### example ### - - To get an attribute value, simply don't provide the optional second parameter: - - x$('.someClass').attr('class'); - - To set an attribute, use both parameters: - - x$('.someClass').attr('disabled', 'disabled'); -*/ - attr: function(attribute, val) { - if (arguments.length == 2) { - return this.each(function(el) { - if (el.tagName && el.tagName.toLowerCase() == 'input' && attribute == 'value') el.value = val; - else if (el.setAttribute) { - if (attribute == 'checked' && (val == '' || val == false || typeof val == "undefined")) el.removeAttribute(attribute); - else el.setAttribute(attribute, val); - } - }); - } else { - var attrs = []; - this.each(function(el) { - if (el.tagName && el.tagName.toLowerCase() == 'input' && attribute == 'value') attrs.push(el.value); - else if (el.getAttribute && el.getAttribute(attribute)) { - attrs.push(el.getAttribute(attribute)); - } - }); - return attrs; - } - } -}); -"inner outer top bottom remove before after".split(' ').forEach(function (method) { - xui.fn[method] = function(where) { return function (html) { return this.html(where, html); }; }(method); -}); -// private method for finding a dom element -function getTag(el) { - return (el.firstChild === null) ? {'UL':'LI','DL':'DT','TR':'TD'}[el.tagName] || el.tagName : el.firstChild.tagName; -} - -function wrapHelper(html, el) { - if (typeof html == string) return wrap(html, getTag(el)); - else { var e = document.createElement('div'); e.appendChild(html); return e; } -} - -// private method -// Wraps the HTML in a TAG, Tag is optional -// If the html starts with a Tag, it will wrap the context in that tag. -function wrap(xhtml, tag) { - var e = document.createElement('div'); - e.innerHTML = xhtml; - return e; -} - -/* -* Removes all erronious nodes from the DOM. -* -*/ -function clean(collection) { - var ns = /\S/; - collection.each(function(el) { - var d = el, - n = d.firstChild, - ni = -1, - nx; - while (n) { - nx = n.nextSibling; - if (n.nodeType == 3 && !ns.test(n.nodeValue)) { - d.removeChild(n); - } else { - n.nodeIndex = ++ni; // FIXME not sure what this is for, and causes IE to bomb (the setter) - @rem - } - n = nx; - } - }); -} -/** - Event - ===== - - A good old fashioned events with new skool handling. Shortcuts exist for: - - - click - - load - - touchstart - - touchmove - - touchend - - touchcancel - - gesturestart - - gesturechange - - gestureend - - orientationchange - -*/ -xui.events = {}; var cache = {}; -xui.extend({ - -/** - on - -- - - Registers a callback function to a DOM event on the element collection. - - ### syntax ### - - x$( 'button' ).on( type, fn ); - - or - - x$( 'button' ).click( fn ); - - ### arguments ### - - - type `String` is the event to subscribe (e.g. _load_, _click_, _touchstart_, etc). - - fn `Function` is a callback function to execute when the event is fired. - - ### example ### - - x$( 'button' ).on( 'click', function(e) { - alert('hey that tickles!'); - }); - - or - - x$(window).load(function(e) { - x$('.save').touchstart( function(evt) { alert('tee hee!'); }).css(background:'grey'); - }); -*/ - on: function(type, fn, details) { - return this.each(function (el) { - if (xui.events[type]) { - var id = _getEventID(el), - responders = _getRespondersForEvent(id, type); - - details = details || {}; - details.handler = function (event, data) { - xui.fn.fire.call(xui(this), type, data); - }; - - // trigger the initialiser - only happens the first time around - if (!responders.length) { - xui.events[type].call(el, details); - } - } - el.addEventListener(type, _createResponder(el, type, fn), false); - }); - }, - -/** - un - -- - - Unregisters a specific callback, or if no specific callback is passed in, - unregisters all event callbacks of a specific type. - - ### syntax ### - - Unregister the given function, for the given type, on all button elements: - - x$( 'button' ).un( type, fn ); - - Unregisters all callbacks of the given type, on all button elements: - - x$( 'button' ).un( type ); - - ### arguments ### - - - type `String` is the event to unsubscribe (e.g. _load_, _click_, _touchstart_, etc). - - fn `Function` is the callback function to unsubscribe _(optional)_. - - ### example ### - - // First, create a click event that display an alert message - x$('button').on('click', function() { - alert('hi!'); - }); - - // Now unsubscribe all functions that response to click on all button elements - x$('button').un('click'); - - or - - var greeting = function() { alert('yo!'); }; - - x$('button').on('click', greeting); - x$('button').on('click', function() { - alert('hi!'); - }); - - // When any button is clicked, the 'hi!' message will fire, but not the 'yo!' message. - x$('button').un('click', greeting); -*/ - un: function(type, fn) { - return this.each(function (el) { - var id = _getEventID(el), responders = _getRespondersForEvent(id, type), i = responders.length; - - while (i--) { - if (fn === undefined || fn.guid === responders[i].guid) { - el.removeEventListener(type, responders[i], false); - removex(cache[id][type], i, 1); - } - } - - if (cache[id][type].length === 0) delete cache[id][type]; - for (var t in cache[id]) { - return; - } - delete cache[id]; - }); - }, - -/** - fire - ---- - - Triggers a specific event on the xui collection. - - ### syntax ### - - x$( selector ).fire( type, data ); - - ### arguments ### - - - type `String` is the event to fire (e.g. _load_, _click_, _touchstart_, etc). - - data `Object` is a JSON object to use as the event's `data` property. - - ### example ### - - x$('button#reset').fire('click', { died:true }); - - x$('.target').fire('touchstart'); -*/ - fire: function (type, data) { - return this.each(function (el) { - if (el == document && !el.dispatchEvent) - el = document.documentElement; - - var event = document.createEvent('HTMLEvents'); - event.initEvent(type, true, true); - event.data = data || {}; - event.eventName = type; - - el.dispatchEvent(event); - }); - } -}); - -"click load submit touchstart touchmove touchend touchcancel gesturestart gesturechange gestureend orientationchange".split(' ').forEach(function (event) { - xui.fn[event] = function(action) { return function (fn) { return fn ? this.on(action, fn) : this.fire(action); }; }(event); -}); - -// patched orientation support - Andriod 1 doesn't have native onorientationchange events -xui(window).on('load', function() { - if (!('onorientationchange' in document.body)) { - (function (w, h) { - xui(window).on('resize', function () { - var portraitSwitch = (window.innerWidth < w && window.innerHeight > h) && (window.innerWidth < window.innerHeight), - landscapeSwitch = (window.innerWidth > w && window.innerHeight < h) && (window.innerWidth > window.innerHeight); - if (portraitSwitch || landscapeSwitch) { - window.orientation = portraitSwitch ? 0 : 90; // what about -90? Some support is better than none - xui('body').fire('orientationchange'); // will this bubble up? - w = window.innerWidth; - h = window.innerHeight; - } - }); - })(window.innerWidth, window.innerHeight); - } -}); - -// this doesn't belong on the prototype, it belongs as a property on the xui object -xui.touch = (function () { - try{ - return !!(document.createEvent("TouchEvent").initTouchEvent) - } catch(e) { - return false; - }; -})(); - -/** - ready - ---- - - Event handler for when the DOM is ready. Thank you [domready](http://www.github.com/ded/domready)! - - ### syntax ### - - x$.ready(handler); - - ### arguments ### - - - handler `Function` event handler to be attached to the "dom is ready" event. - - ### example ### - - x$.ready(function() { - alert('mah doms are ready'); - }); - - xui.ready(function() { - console.log('ready, set, go!'); - }); -*/ -xui.ready = function(handler) { - domReady(handler); -} - -// lifted from Prototype's (big P) event model -function _getEventID(element) { - if (element._xuiEventID) return element._xuiEventID; - return element._xuiEventID = ++_getEventID.id; -} - -_getEventID.id = 1; - -function _getRespondersForEvent(id, eventName) { - var c = cache[id] = cache[id] || {}; - return c[eventName] = c[eventName] || []; -} - -function _createResponder(element, eventName, handler) { - var id = _getEventID(element), r = _getRespondersForEvent(id, eventName); - - var responder = function(event) { - if (handler.call(element, event) === false) { - event.preventDefault(); - event.stopPropagation(); - } - }; - - responder.guid = handler.guid = handler.guid || ++_getEventID.id; - responder.handler = handler; - r.push(responder); - return responder; -} -/** - Fx - == - - Animations, transforms, and transitions for getting the most out of hardware accelerated CSS. - -*/ - -xui.extend({ - -/** - Tween - ----- - - Transforms a CSS property's value. - - ### syntax ### - - x$( selector ).tween( properties, callback ); - - ### arguments ### - - - properties `Object` or `Array` of CSS properties to tween. - - `Object` is a JSON object that defines the CSS properties. - - `Array` is a `Object` set that is tweened sequentially. - - callback `Function` to be called when the animation is complete. _(optional)_. - - ### properties ### - - A property can be any CSS style, referenced by the JavaScript notation. - - A property can also be an option from [emile.js](https://github.com/madrobby/emile): - - - duration `Number` of the animation in milliseconds. - - after `Function` is called after the animation is finished. - - easing `Function` allows for the overriding of the built-in animation function. - - // Receives one argument `pos` that indicates position - // in time between animation's start and end. - function(pos) { - // return the new position - return (-Math.cos(pos * Math.PI) / 2) + 0.5; - } - - ### example ### - - // one JSON object - x$('#box').tween({ left:'100px', backgroundColor:'blue' }); - x$('#box').tween({ left:'100px', backgroundColor:'blue' }, function() { - alert('done!'); - }); - - // array of two JSON objects - x$('#box').tween([{left:'100px', backgroundColor:'green', duration:.2 }, { right:'100px' }]); -*/ - tween: function( props, callback ) { - - // creates an options obj for emile - var emileOpts = function(o) { - var options = {}; - "duration after easing".split(' ').forEach( function(p) { - if (props[p]) { - options[p] = props[p]; - delete props[p]; - } - }); - return options; - } - - // serialize the properties into a string for emile - var serialize = function(props) { - var serialisedProps = [], key; - if (typeof props != string) { - for (key in props) { - serialisedProps.push(cssstyle(key) + ':' + props[key]); - } - serialisedProps = serialisedProps.join(';'); - } else { - serialisedProps = props; - } - return serialisedProps; - }; - - // queued animations - /* wtf is this? - if (props instanceof Array) { - // animate each passing the next to the last callback to enqueue - props.forEach(function(a){ - - }); - } - */ - // this branch means we're dealing with a single tween - var opts = emileOpts(props); - var prop = serialize(props); - - return this.each(function(e){ - emile(e, prop, opts, callback); - }); - } -}); -/** - Style - ===== - - Everything related to appearance. Usually, this is CSS. - -*/ -function hasClass(el, className) { - return getClassRegEx(className).test(el.className); -} - -// Via jQuery - used to avoid el.className = ' foo'; -// Used for trimming whitespace -var rtrim = /^(\s|\u00A0)+|(\s|\u00A0)+$/g; - -function trim(text) { - return (text || "").replace( rtrim, "" ); -} - -xui.extend({ -/** - setStyle - -------- - - Sets the value of a single CSS property. - - ### syntax ### - - x$( selector ).setStyle( property, value ); - - ### arguments ### - - - property `String` is the name of the property to modify. - - value `String` is the new value of the property. - - ### example ### - - x$('.flash').setStyle('color', '#000'); - x$('.button').setStyle('backgroundColor', '#EFEFEF'); -*/ - setStyle: function(prop, val) { - prop = domstyle(prop); - return this.each(function(el) { - el.style[prop] = val; - }); - }, - -/** - getStyle - -------- - - Returns the value of a single CSS property. Can also invoke a callback to perform more specific processing tasks related to the property value. - Please note that the return type is always an Array of strings. Each string corresponds to the CSS property value for the element with the same index in the xui collection. - - ### syntax ### - - x$( selector ).getStyle( property, callback ); - - ### arguments ### - - - property `String` is the name of the CSS property to get. - - callback `Function` is called on each element in the collection and passed the property _(optional)_. - - ### example ### - - - x$('ul#nav li.trunk').getStyle('font-size'); // returns ['12px'] - x$('ul#nav li.trunk').getStyle('fontSize'); // returns ['12px'] - x$('ul#nav li').getStyle('font-size'); // returns ['12px', '14px'] - - x$('ul#nav li.trunk').getStyle('backgroundColor', function(prop) { - alert(prop); // alerts 'blue' - }); -*/ - getStyle: function(prop, callback) { - // shortcut getComputedStyle function - var s = function(el, p) { - // this *can* be written to be smaller - see below, but in fact it doesn't compress in gzip as well, the commented - // out version actually *adds* 2 bytes. - // return document.defaultView.getComputedStyle(el, "").getPropertyValue(p.replace(/([A-Z])/g, "-$1").toLowerCase()); - return document.defaultView.getComputedStyle(el, "").getPropertyValue(cssstyle(p)); - } - if (callback === undefined) { - var styles = []; - this.each(function(el) {styles.push(s(el, prop))}); - return styles; - } else return this.each(function(el) { callback(s(el, prop)); }); - }, - -/** - addClass - -------- - - Adds a class to all of the elements in the collection. - - ### syntax ### - - x$( selector ).addClass( className ); - - ### arguments ### - - - className `String` is the name of the CSS class to add. - - ### example ### - - x$('.foo').addClass('awesome'); -*/ - addClass: function(className) { - var cs = className.split(' '); - return this.each(function(el) { - cs.forEach(function(clazz) { - if (hasClass(el, clazz) === false) { - el.className = trim(el.className + ' ' + clazz); - } - }); - }); - }, - -/** - hasClass - -------- - - Checks if the class is on _all_ elements in the xui collection. - - ### syntax ### - - x$( selector ).hasClass( className, fn ); - - ### arguments ### - - - className `String` is the name of the CSS class to find. - - fn `Function` is a called for each element found and passed the element _(optional)_. - - // `element` is the HTMLElement that has the class - function(element) { - console.log(element); - } - - ### example ### -
-
-
- - // returns true - x$('#foo').hasClass('awesome'); - - // returns false (not all elements with class 'foo' have class 'awesome'), - // but the callback gets invoked with the elements that did match the 'awesome' class - x$('.foo').hasClass('awesome', function(element) { - console.log('Hey, I found: ' + element + ' with class "awesome"'); - }); - - // returns true (all DIV elements have the 'foo' class) - x$('div').hasClass('foo'); -*/ - hasClass: function(className, callback) { - var self = this, - cs = className.split(' '); - return this.length && (function() { - var hasIt = true; - self.each(function(el) { - cs.forEach(function(clazz) { - if (hasClass(el, clazz)) { - if (callback) callback(el); - } else hasIt = false; - }); - }); - return hasIt; - })(); - }, - -/** - removeClass - ----------- - - Removes the specified class from all elements in the collection. If no class is specified, removes all classes from the collection. - - ### syntax ### - - x$( selector ).removeClass( className ); - - ### arguments ### - - - className `String` is the name of the CSS class to remove. If not specified, then removes all classes from the matched elements. _(optional)_ - - ### example ### - - x$('.foo').removeClass('awesome'); -*/ - removeClass: function(className) { - if (className === undefined) this.each(function(el) { el.className = ''; }); - else { - var cs = className.split(' '); - this.each(function(el) { - cs.forEach(function(clazz) { - el.className = trim(el.className.replace(getClassRegEx(clazz), '$1')); - }); - }); - } - return this; - }, - -/** - toggleClass - ----------- - - Removes the specified class if it exists on the elements in the xui collection, otherwise adds it. - - ### syntax ### - - x$( selector ).toggleClass( className ); - - ### arguments ### - - - className `String` is the name of the CSS class to toggle. - - ### example ### -
- - x$('.foo').toggleClass('awesome'); // div above loses its awesome class. -*/ - toggleClass: function(className) { - var cs = className.split(' '); - return this.each(function(el) { - cs.forEach(function(clazz) { - if (hasClass(el, clazz)) el.className = trim(el.className.replace(getClassRegEx(clazz), '$1')); - else el.className = trim(el.className + ' ' + clazz); - }); - }); - }, - -/** - css - --- - - Set multiple CSS properties at once. - - ### syntax ### - - x$( selector ).css( properties ); - - ### arguments ### - - - properties `Object` is a JSON object that defines the property name/value pairs to set. - - ### example ### - - x$('.foo').css({ backgroundColor:'blue', color:'white', border:'2px solid red' }); -*/ - css: function(o) { - for (var prop in o) { - this.setStyle(prop, o[prop]); - } - return this; - } -}); - -// RS: now that I've moved these out, they'll compress better, however, do these variables -// need to be instance based - if it's regarding the DOM, I'm guessing it's better they're -// global within the scope of xui - -// -- private methods -- // -var reClassNameCache = {}, - getClassRegEx = function(className) { - var re = reClassNameCache[className]; - if (!re) { - // Preserve any leading whitespace in the match, to be used when removing a class - re = new RegExp('(^|\\s+)' + className + '(?:\\s+|$)'); - reClassNameCache[className] = re; - } - return re; - }; -/** - XHR - === - - Everything related to remote network connections. - - */ -xui.extend({ -/** - xhr - --- - - The classic `XMLHttpRequest` sometimes also known as the Greek hero: _Ajax_. Not to be confused with _AJAX_ the cleaning agent. - - ### detail ### - - This method has a few new tricks. - - It is always invoked on an element collection and uses the behaviour of `html`. - - If there is no callback, then the `responseText` will be inserted into the elements in the collection. - - ### syntax ### - - x$( selector ).xhr( location, url, options ) - - or accept a url with a default behavior of inner: - - x$( selector ).xhr( url, options ); - - or accept a url with a callback: - - x$( selector ).xhr( url, fn ); - - ### arguments ### - - - location `String` is the location to insert the `responseText`. See `html` for values. - - url `String` is where to send the request. - - fn `Function` is called on status 200 (i.e. success callback). - - options `Object` is a JSON object with one or more of the following: - - method `String` can be _get_, _put_, _delete_, _post_. Default is _get_. - - async `Boolean` enables an asynchronous request. Defaults to _false_. - - data `String` is a url encoded string of parameters to send. - - error `Function` is called on error or status that is not 200. (i.e. failure callback). - - callback `Function` is called on status 200 (i.e. success callback). - - headers `Object` is a JSON object with key:value pairs that get set in the request's header set. - - ### response ### - - - The response is available to the callback function as `this`. - - The response is not passed into the callback. - - `this.reponseText` will have the resulting data from the file. - - ### example ### - - x$('#status').xhr('inner', '/status.html'); - x$('#status').xhr('outer', '/status.html'); - x$('#status').xhr('top', '/status.html'); - x$('#status').xhr('bottom','/status.html'); - x$('#status').xhr('before','/status.html'); - x$('#status').xhr('after', '/status.html'); - - or - - // same as using 'inner' - x$('#status').xhr('/status.html'); - - // define a callback, enable async execution and add a request header - x$('#left-panel').xhr('/panel', { - async: true, - callback: function() { - alert("The response is " + this.responseText); - }, - headers:{ - 'Mobile':'true' - } - }); - - // define a callback with the shorthand syntax - x$('#left-panel').xhr('/panel', function() { - alert("The response is " + this.responseText); - }); -*/ - xhr:function(location, url, options) { - - // this is to keep support for the old syntax (easy as that) - if (!/^(inner|outer|top|bottom|before|after)$/.test(location)) { - options = url; - url = location; - location = 'inner'; - } - - var o = options ? options : {}; - - if (typeof options == "function") { - // FIXME kill the console logging - // console.log('we been passed a func ' + options); - // console.log(this); - o = {}; - o.callback = options; - }; - - var that = this, - req = new XMLHttpRequest(), - method = o.method || 'get', - async = (typeof o.async != 'undefined'?o.async:true), - params = o.data || null, - key; - - req.queryString = params; - req.open(method, url, async); - - // Set "X-Requested-With" header - req.setRequestHeader('X-Requested-With','XMLHttpRequest'); - - if (method.toLowerCase() == 'post') req.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); - - for (key in o.headers) { - if (o.headers.hasOwnProperty(key)) { - req.setRequestHeader(key, o.headers[key]); - } - } - - req.handleResp = (o.callback != null) ? o.callback : function() { that.html(location, req.responseText); }; - req.handleError = (o.error && typeof o.error == 'function') ? o.error : function () {}; - function hdl(){ - if(req.readyState==4) { - delete(that.xmlHttpRequest); - if(req.status===0 || req.status==200) req.handleResp(); - if((/^[45]/).test(req.status)) req.handleError(); - } - } - if(async) { - req.onreadystatechange = hdl; - this.xmlHttpRequest = req; - } - req.send(params); - if(!async) hdl(); - - return this; - } -}); -// emile.js (c) 2009 Thomas Fuchs -// Licensed under the terms of the MIT license. - -(function(emile, container){ - var parseEl = document.createElement('div'), - props = ('backgroundColor borderBottomColor borderBottomWidth borderLeftColor borderLeftWidth '+ - 'borderRightColor borderRightWidth borderSpacing borderTopColor borderTopWidth bottom color fontSize '+ - 'fontWeight height left letterSpacing lineHeight marginBottom marginLeft marginRight marginTop maxHeight '+ - 'maxWidth minHeight minWidth opacity outlineColor outlineOffset outlineWidth paddingBottom paddingLeft '+ - 'paddingRight paddingTop right textIndent top width wordSpacing zIndex').split(' '); - - function interpolate(source,target,pos){ return (source+(target-source)*pos).toFixed(3); } - function s(str, p, c){ return str.substr(p,c||1); } - function color(source,target,pos){ - var i = 2, j, c, tmp, v = [], r = []; - while(j=3,c=arguments[i-1],i--) - if(s(c,0)=='r') { c = c.match(/\d+/g); while(j--) v.push(~~c[j]); } else { - if(c.length==4) c='#'+s(c,1)+s(c,1)+s(c,2)+s(c,2)+s(c,3)+s(c,3); - while(j--) v.push(parseInt(s(c,1+j*2,2), 16)); } - while(j--) { tmp = ~~(v[j+3]+(v[j]-v[j+3])*pos); r.push(tmp<0?0:tmp>255?255:tmp); } - return 'rgb('+r.join(',')+')'; - } - - function parse(prop){ - var p = parseFloat(prop), q = prop.replace(/^[\-\d\.]+/,''); - return isNaN(p) ? { v: q, f: color, u: ''} : { v: p, f: interpolate, u: q }; - } - - function normalize(style){ - var css, rules = {}, i = props.length, v; - parseEl.innerHTML = '
'; - css = parseEl.childNodes[0].style; - while(i--) if(v = css[props[i]]) rules[props[i]] = parse(v); - return rules; - } - - container[emile] = function(el, style, opts, after){ - el = typeof el == 'string' ? document.getElementById(el) : el; - opts = opts || {}; - var target = normalize(style), comp = el.currentStyle ? el.currentStyle : getComputedStyle(el, null), - prop, current = {}, start = +new Date, dur = opts.duration||200, finish = start+dur, interval, - easing = opts.easing || function(pos){ return (-Math.cos(pos*Math.PI)/2) + 0.5; }; - for(prop in target) current[prop] = parse(comp[prop]); - interval = setInterval(function(){ - var time = +new Date, pos = time>finish ? 1 : (time-start)/dur; - for(prop in target) - el.style[prop] = target[prop].f(current[prop].v,target[prop].v,easing(pos)) + target[prop].u; - if(time>finish) { clearInterval(interval); opts.after && opts.after(); after && setTimeout(after,1); } - },10); - } -})('emile', this); -/*! - * Sizzle CSS Selector Engine - v1.0 - * Copyright 2009, The Dojo Foundation - * Released under the MIT, BSD, and GPL Licenses. - * More information: http://sizzlejs.com/ - */ -(function(){ - -var chunker = /((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g, - done = 0, - toString = Object.prototype.toString, - hasDuplicate = false, - baseHasDuplicate = true; - -// Here we check if the JavaScript engine is using some sort of -// optimization where it does not always call our comparision -// function. If that is the case, discard the hasDuplicate value. -// Thus far that includes Google Chrome. -[0, 0].sort(function(){ - baseHasDuplicate = false; - return 0; -}); - -var Sizzle = function(selector, context, results, seed) { - results = results || []; - context = context || document; - - var origContext = context; - - if ( context.nodeType !== 1 && context.nodeType !== 9 ) { - return []; - } - - if ( !selector || typeof selector !== "string" ) { - return results; - } - - var parts = [], m, set, checkSet, extra, prune = true, contextXML = Sizzle.isXML(context), - soFar = selector, ret, cur, pop, i; - - // Reset the position of the chunker regexp (start from head) - do { - chunker.exec(""); - m = chunker.exec(soFar); - - if ( m ) { - soFar = m[3]; - - parts.push( m[1] ); - - if ( m[2] ) { - extra = m[3]; - break; - } - } - } while ( m ); - - if ( parts.length > 1 && origPOS.exec( selector ) ) { - if ( parts.length === 2 && Expr.relative[ parts[0] ] ) { - set = posProcess( parts[0] + parts[1], context ); - } else { - set = Expr.relative[ parts[0] ] ? - [ context ] : - Sizzle( parts.shift(), context ); - - while ( parts.length ) { - selector = parts.shift(); - - if ( Expr.relative[ selector ] ) { - selector += parts.shift(); - } - - set = posProcess( selector, set ); - } - } - } else { - // Take a shortcut and set the context if the root selector is an ID - // (but not if it'll be faster if the inner selector is an ID) - if ( !seed && parts.length > 1 && context.nodeType === 9 && !contextXML && - Expr.match.ID.test(parts[0]) && !Expr.match.ID.test(parts[parts.length - 1]) ) { - ret = Sizzle.find( parts.shift(), context, contextXML ); - context = ret.expr ? Sizzle.filter( ret.expr, ret.set )[0] : ret.set[0]; - } - - if ( context ) { - ret = seed ? - { expr: parts.pop(), set: makeArray(seed) } : - Sizzle.find( parts.pop(), parts.length === 1 && (parts[0] === "~" || parts[0] === "+") && context.parentNode ? context.parentNode : context, contextXML ); - set = ret.expr ? Sizzle.filter( ret.expr, ret.set ) : ret.set; - - if ( parts.length > 0 ) { - checkSet = makeArray(set); - } else { - prune = false; - } - - while ( parts.length ) { - cur = parts.pop(); - pop = cur; - - if ( !Expr.relative[ cur ] ) { - cur = ""; - } else { - pop = parts.pop(); - } - - if ( pop == null ) { - pop = context; - } - - Expr.relative[ cur ]( checkSet, pop, contextXML ); - } - } else { - checkSet = parts = []; - } - } - - if ( !checkSet ) { - checkSet = set; - } - - if ( !checkSet ) { - Sizzle.error( cur || selector ); - } - - if ( toString.call(checkSet) === "[object Array]" ) { - if ( !prune ) { - results.push.apply( results, checkSet ); - } else if ( context && context.nodeType === 1 ) { - for ( i = 0; checkSet[i] != null; i++ ) { - if ( checkSet[i] && (checkSet[i] === true || checkSet[i].nodeType === 1 && Sizzle.contains(context, checkSet[i])) ) { - results.push( set[i] ); - } - } - } else { - for ( i = 0; checkSet[i] != null; i++ ) { - if ( checkSet[i] && checkSet[i].nodeType === 1 ) { - results.push( set[i] ); - } - } - } - } else { - makeArray( checkSet, results ); - } - - if ( extra ) { - Sizzle( extra, origContext, results, seed ); - Sizzle.uniqueSort( results ); - } - - return results; -}; - -Sizzle.uniqueSort = function(results){ - if ( sortOrder ) { - hasDuplicate = baseHasDuplicate; - results.sort(sortOrder); - - if ( hasDuplicate ) { - for ( var i = 1; i < results.length; i++ ) { - if ( results[i] === results[i-1] ) { - results.splice(i--, 1); - } - } - } - } - - return results; -}; - -Sizzle.matches = function(expr, set){ - return Sizzle(expr, null, null, set); -}; - -Sizzle.find = function(expr, context, isXML){ - var set; - - if ( !expr ) { - return []; - } - - for ( var i = 0, l = Expr.order.length; i < l; i++ ) { - var type = Expr.order[i], match; - - if ( (match = Expr.leftMatch[ type ].exec( expr )) ) { - var left = match[1]; - match.splice(1,1); - - if ( left.substr( left.length - 1 ) !== "\\" ) { - match[1] = (match[1] || "").replace(/\\/g, ""); - set = Expr.find[ type ]( match, context, isXML ); - if ( set != null ) { - expr = expr.replace( Expr.match[ type ], "" ); - break; - } - } - } - } - - if ( !set ) { - set = context.getElementsByTagName("*"); - } - - return {set: set, expr: expr}; -}; - -Sizzle.filter = function(expr, set, inplace, not){ - var old = expr, result = [], curLoop = set, match, anyFound, - isXMLFilter = set && set[0] && Sizzle.isXML(set[0]); - - while ( expr && set.length ) { - for ( var type in Expr.filter ) { - if ( (match = Expr.leftMatch[ type ].exec( expr )) != null && match[2] ) { - var filter = Expr.filter[ type ], found, item, left = match[1]; - anyFound = false; - - match.splice(1,1); - - if ( left.substr( left.length - 1 ) === "\\" ) { - continue; - } - - if ( curLoop === result ) { - result = []; - } - - if ( Expr.preFilter[ type ] ) { - match = Expr.preFilter[ type ]( match, curLoop, inplace, result, not, isXMLFilter ); - - if ( !match ) { - anyFound = found = true; - } else if ( match === true ) { - continue; - } - } - - if ( match ) { - for ( var i = 0; (item = curLoop[i]) != null; i++ ) { - if ( item ) { - found = filter( item, match, i, curLoop ); - var pass = not ^ !!found; - - if ( inplace && found != null ) { - if ( pass ) { - anyFound = true; - } else { - curLoop[i] = false; - } - } else if ( pass ) { - result.push( item ); - anyFound = true; - } - } - } - } - - if ( found !== undefined ) { - if ( !inplace ) { - curLoop = result; - } - - expr = expr.replace( Expr.match[ type ], "" ); - - if ( !anyFound ) { - return []; - } - - break; - } - } - } - - // Improper expression - if ( expr === old ) { - if ( anyFound == null ) { - Sizzle.error( expr ); - } else { - break; - } - } - - old = expr; - } - - return curLoop; -}; - -Sizzle.error = function( msg ) { - throw "Syntax error, unrecognized expression: " + msg; -}; - -var Expr = Sizzle.selectors = { - order: [ "ID", "NAME", "TAG" ], - match: { - ID: /#((?:[\w\u00c0-\uFFFF\-]|\\.)+)/, - CLASS: /\.((?:[\w\u00c0-\uFFFF\-]|\\.)+)/, - NAME: /\[name=['"]*((?:[\w\u00c0-\uFFFF\-]|\\.)+)['"]*\]/, - ATTR: /\[\s*((?:[\w\u00c0-\uFFFF\-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/, - TAG: /^((?:[\w\u00c0-\uFFFF\*\-]|\\.)+)/, - CHILD: /:(only|nth|last|first)-child(?:\((even|odd|[\dn+\-]*)\))?/, - POS: /:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^\-]|$)/, - PSEUDO: /:((?:[\w\u00c0-\uFFFF\-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/ - }, - leftMatch: {}, - attrMap: { - "class": "className", - "for": "htmlFor" - }, - attrHandle: { - href: function(elem){ - return elem.getAttribute("href"); - } - }, - relative: { - "+": function(checkSet, part){ - var isPartStr = typeof part === "string", - isTag = isPartStr && !/\W/.test(part), - isPartStrNotTag = isPartStr && !isTag; - - if ( isTag ) { - part = part.toLowerCase(); - } - - for ( var i = 0, l = checkSet.length, elem; i < l; i++ ) { - if ( (elem = checkSet[i]) ) { - while ( (elem = elem.previousSibling) && elem.nodeType !== 1 ) {} - - checkSet[i] = isPartStrNotTag || elem && elem.nodeName.toLowerCase() === part ? - elem || false : - elem === part; - } - } - - if ( isPartStrNotTag ) { - Sizzle.filter( part, checkSet, true ); - } - }, - ">": function(checkSet, part){ - var isPartStr = typeof part === "string", - elem, i = 0, l = checkSet.length; - - if ( isPartStr && !/\W/.test(part) ) { - part = part.toLowerCase(); - - for ( ; i < l; i++ ) { - elem = checkSet[i]; - if ( elem ) { - var parent = elem.parentNode; - checkSet[i] = parent.nodeName.toLowerCase() === part ? parent : false; - } - } - } else { - for ( ; i < l; i++ ) { - elem = checkSet[i]; - if ( elem ) { - checkSet[i] = isPartStr ? - elem.parentNode : - elem.parentNode === part; - } - } - - if ( isPartStr ) { - Sizzle.filter( part, checkSet, true ); - } - } - }, - "": function(checkSet, part, isXML){ - var doneName = done++, checkFn = dirCheck, nodeCheck; - - if ( typeof part === "string" && !/\W/.test(part) ) { - part = part.toLowerCase(); - nodeCheck = part; - checkFn = dirNodeCheck; - } - - checkFn("parentNode", part, doneName, checkSet, nodeCheck, isXML); - }, - "~": function(checkSet, part, isXML){ - var doneName = done++, checkFn = dirCheck, nodeCheck; - - if ( typeof part === "string" && !/\W/.test(part) ) { - part = part.toLowerCase(); - nodeCheck = part; - checkFn = dirNodeCheck; - } - - checkFn("previousSibling", part, doneName, checkSet, nodeCheck, isXML); - } - }, - find: { - ID: function(match, context, isXML){ - if ( typeof context.getElementById !== "undefined" && !isXML ) { - var m = context.getElementById(match[1]); - return m ? [m] : []; - } - }, - NAME: function(match, context){ - if ( typeof context.getElementsByName !== "undefined" ) { - var ret = [], results = context.getElementsByName(match[1]); - - for ( var i = 0, l = results.length; i < l; i++ ) { - if ( results[i].getAttribute("name") === match[1] ) { - ret.push( results[i] ); - } - } - - return ret.length === 0 ? null : ret; - } - }, - TAG: function(match, context){ - return context.getElementsByTagName(match[1]); - } - }, - preFilter: { - CLASS: function(match, curLoop, inplace, result, not, isXML){ - match = " " + match[1].replace(/\\/g, "") + " "; - - if ( isXML ) { - return match; - } - - for ( var i = 0, elem; (elem = curLoop[i]) != null; i++ ) { - if ( elem ) { - if ( not ^ (elem.className && (" " + elem.className + " ").replace(/[\t\n]/g, " ").indexOf(match) >= 0) ) { - if ( !inplace ) { - result.push( elem ); - } - } else if ( inplace ) { - curLoop[i] = false; - } - } - } - - return false; - }, - ID: function(match){ - return match[1].replace(/\\/g, ""); - }, - TAG: function(match, curLoop){ - return match[1].toLowerCase(); - }, - CHILD: function(match){ - if ( match[1] === "nth" ) { - // parse equations like 'even', 'odd', '5', '2n', '3n+2', '4n-1', '-n+6' - var test = /(-?)(\d*)n((?:\+|-)?\d*)/.exec( - match[2] === "even" && "2n" || match[2] === "odd" && "2n+1" || - !/\D/.test( match[2] ) && "0n+" + match[2] || match[2]); - - // calculate the numbers (first)n+(last) including if they are negative - match[2] = (test[1] + (test[2] || 1)) - 0; - match[3] = test[3] - 0; - } - - // TODO: Move to normal caching system - match[0] = done++; - - return match; - }, - ATTR: function(match, curLoop, inplace, result, not, isXML){ - var name = match[1].replace(/\\/g, ""); - - if ( !isXML && Expr.attrMap[name] ) { - match[1] = Expr.attrMap[name]; - } - - if ( match[2] === "~=" ) { - match[4] = " " + match[4] + " "; - } - - return match; - }, - PSEUDO: function(match, curLoop, inplace, result, not){ - if ( match[1] === "not" ) { - // If we're dealing with a complex expression, or a simple one - if ( ( chunker.exec(match[3]) || "" ).length > 1 || /^\w/.test(match[3]) ) { - match[3] = Sizzle(match[3], null, null, curLoop); - } else { - var ret = Sizzle.filter(match[3], curLoop, inplace, true ^ not); - if ( !inplace ) { - result.push.apply( result, ret ); - } - return false; - } - } else if ( Expr.match.POS.test( match[0] ) || Expr.match.CHILD.test( match[0] ) ) { - return true; - } - - return match; - }, - POS: function(match){ - match.unshift( true ); - return match; - } - }, - filters: { - enabled: function(elem){ - return elem.disabled === false && elem.type !== "hidden"; - }, - disabled: function(elem){ - return elem.disabled === true; - }, - checked: function(elem){ - return elem.checked === true; - }, - selected: function(elem){ - // Accessing this property makes selected-by-default - // options in Safari work properly - elem.parentNode.selectedIndex; - return elem.selected === true; - }, - parent: function(elem){ - return !!elem.firstChild; - }, - empty: function(elem){ - return !elem.firstChild; - }, - has: function(elem, i, match){ - return !!Sizzle( match[3], elem ).length; - }, - header: function(elem){ - return (/h\d/i).test( elem.nodeName ); - }, - text: function(elem){ - return "text" === elem.type; - }, - radio: function(elem){ - return "radio" === elem.type; - }, - checkbox: function(elem){ - return "checkbox" === elem.type; - }, - file: function(elem){ - return "file" === elem.type; - }, - password: function(elem){ - return "password" === elem.type; - }, - submit: function(elem){ - return "submit" === elem.type; - }, - image: function(elem){ - return "image" === elem.type; - }, - reset: function(elem){ - return "reset" === elem.type; - }, - button: function(elem){ - return "button" === elem.type || elem.nodeName.toLowerCase() === "button"; - }, - input: function(elem){ - return (/input|select|textarea|button/i).test(elem.nodeName); - } - }, - setFilters: { - first: function(elem, i){ - return i === 0; - }, - last: function(elem, i, match, array){ - return i === array.length - 1; - }, - even: function(elem, i){ - return i % 2 === 0; - }, - odd: function(elem, i){ - return i % 2 === 1; - }, - lt: function(elem, i, match){ - return i < match[3] - 0; - }, - gt: function(elem, i, match){ - return i > match[3] - 0; - }, - nth: function(elem, i, match){ - return match[3] - 0 === i; - }, - eq: function(elem, i, match){ - return match[3] - 0 === i; - } - }, - filter: { - PSEUDO: function(elem, match, i, array){ - var name = match[1], filter = Expr.filters[ name ]; - - if ( filter ) { - return filter( elem, i, match, array ); - } else if ( name === "contains" ) { - return (elem.textContent || elem.innerText || Sizzle.getText([ elem ]) || "").indexOf(match[3]) >= 0; - } else if ( name === "not" ) { - var not = match[3]; - - for ( var j = 0, l = not.length; j < l; j++ ) { - if ( not[j] === elem ) { - return false; - } - } - - return true; - } else { - Sizzle.error( "Syntax error, unrecognized expression: " + name ); - } - }, - CHILD: function(elem, match){ - var type = match[1], node = elem; - switch (type) { - case 'only': - case 'first': - while ( (node = node.previousSibling) ) { - if ( node.nodeType === 1 ) { - return false; - } - } - if ( type === "first" ) { - return true; - } - node = elem; - case 'last': - while ( (node = node.nextSibling) ) { - if ( node.nodeType === 1 ) { - return false; - } - } - return true; - case 'nth': - var first = match[2], last = match[3]; - - if ( first === 1 && last === 0 ) { - return true; - } - - var doneName = match[0], - parent = elem.parentNode; - - if ( parent && (parent.sizcache !== doneName || !elem.nodeIndex) ) { - var count = 0; - for ( node = parent.firstChild; node; node = node.nextSibling ) { - if ( node.nodeType === 1 ) { - node.nodeIndex = ++count; - } - } - parent.sizcache = doneName; - } - - var diff = elem.nodeIndex - last; - if ( first === 0 ) { - return diff === 0; - } else { - return ( diff % first === 0 && diff / first >= 0 ); - } - } - }, - ID: function(elem, match){ - return elem.nodeType === 1 && elem.getAttribute("id") === match; - }, - TAG: function(elem, match){ - return (match === "*" && elem.nodeType === 1) || elem.nodeName.toLowerCase() === match; - }, - CLASS: function(elem, match){ - return (" " + (elem.className || elem.getAttribute("class")) + " ") - .indexOf( match ) > -1; - }, - ATTR: function(elem, match){ - var name = match[1], - result = Expr.attrHandle[ name ] ? - Expr.attrHandle[ name ]( elem ) : - elem[ name ] != null ? - elem[ name ] : - elem.getAttribute( name ), - value = result + "", - type = match[2], - check = match[4]; - - return result == null ? - type === "!=" : - type === "=" ? - value === check : - type === "*=" ? - value.indexOf(check) >= 0 : - type === "~=" ? - (" " + value + " ").indexOf(check) >= 0 : - !check ? - value && result !== false : - type === "!=" ? - value !== check : - type === "^=" ? - value.indexOf(check) === 0 : - type === "$=" ? - value.substr(value.length - check.length) === check : - type === "|=" ? - value === check || value.substr(0, check.length + 1) === check + "-" : - false; - }, - POS: function(elem, match, i, array){ - var name = match[2], filter = Expr.setFilters[ name ]; - - if ( filter ) { - return filter( elem, i, match, array ); - } - } - } -}; - -var origPOS = Expr.match.POS, - fescape = function(all, num){ - return "\\" + (num - 0 + 1); - }; - -for ( var type in Expr.match ) { - Expr.match[ type ] = new RegExp( Expr.match[ type ].source + (/(?![^\[]*\])(?![^\(]*\))/.source) ); - Expr.leftMatch[ type ] = new RegExp( /(^(?:.|\r|\n)*?)/.source + Expr.match[ type ].source.replace(/\\(\d+)/g, fescape) ); -} - -var makeArray = function(array, results) { - array = Array.prototype.slice.call( array, 0 ); - - if ( results ) { - results.push.apply( results, array ); - return results; - } - - return array; -}; - -// Perform a simple check to determine if the browser is capable of -// converting a NodeList to an array using builtin methods. -// Also verifies that the returned array holds DOM nodes -// (which is not the case in the Blackberry browser) -try { - Array.prototype.slice.call( document.documentElement.childNodes, 0 )[0].nodeType; - -// Provide a fallback method if it does not work -} catch(e){ - makeArray = function(array, results) { - var ret = results || [], i = 0; - - if ( toString.call(array) === "[object Array]" ) { - Array.prototype.push.apply( ret, array ); - } else { - if ( typeof array.length === "number" ) { - for ( var l = array.length; i < l; i++ ) { - ret.push( array[i] ); - } - } else { - for ( ; array[i]; i++ ) { - ret.push( array[i] ); - } - } - } - - return ret; - }; -} - -var sortOrder; - -if ( document.documentElement.compareDocumentPosition ) { - sortOrder = function( a, b ) { - if ( !a.compareDocumentPosition || !b.compareDocumentPosition ) { - if ( a == b ) { - hasDuplicate = true; - } - return a.compareDocumentPosition ? -1 : 1; - } - - var ret = a.compareDocumentPosition(b) & 4 ? -1 : a === b ? 0 : 1; - if ( ret === 0 ) { - hasDuplicate = true; - } - return ret; - }; -} else if ( "sourceIndex" in document.documentElement ) { - sortOrder = function( a, b ) { - if ( !a.sourceIndex || !b.sourceIndex ) { - if ( a == b ) { - hasDuplicate = true; - } - return a.sourceIndex ? -1 : 1; - } - - var ret = a.sourceIndex - b.sourceIndex; - if ( ret === 0 ) { - hasDuplicate = true; - } - return ret; - }; -} else if ( document.createRange ) { - sortOrder = function( a, b ) { - if ( !a.ownerDocument || !b.ownerDocument ) { - if ( a == b ) { - hasDuplicate = true; - } - return a.ownerDocument ? -1 : 1; - } - - var aRange = a.ownerDocument.createRange(), bRange = b.ownerDocument.createRange(); - aRange.setStart(a, 0); - aRange.setEnd(a, 0); - bRange.setStart(b, 0); - bRange.setEnd(b, 0); - var ret = aRange.compareBoundaryPoints(Range.START_TO_END, bRange); - if ( ret === 0 ) { - hasDuplicate = true; - } - return ret; - }; -} - -// Utility function for retreiving the text value of an array of DOM nodes -Sizzle.getText = function( elems ) { - var ret = "", elem; - - for ( var i = 0; elems[i]; i++ ) { - elem = elems[i]; - - // Get the text from text nodes and CDATA nodes - if ( elem.nodeType === 3 || elem.nodeType === 4 ) { - ret += elem.nodeValue; - - // Traverse everything else, except comment nodes - } else if ( elem.nodeType !== 8 ) { - ret += Sizzle.getText( elem.childNodes ); - } - } - - return ret; -}; - -// Check to see if the browser returns elements by name when -// querying by getElementById (and provide a workaround) -(function(){ - // We're going to inject a fake input element with a specified name - var form = document.createElement("div"), - id = "script" + (new Date()).getTime(); - form.innerHTML = ""; - - // Inject it into the root element, check its status, and remove it quickly - var root = document.documentElement; - root.insertBefore( form, root.firstChild ); - - // The workaround has to do additional checks after a getElementById - // Which slows things down for other browsers (hence the branching) - if ( document.getElementById( id ) ) { - Expr.find.ID = function(match, context, isXML){ - if ( typeof context.getElementById !== "undefined" && !isXML ) { - var m = context.getElementById(match[1]); - return m ? m.id === match[1] || typeof m.getAttributeNode !== "undefined" && m.getAttributeNode("id").nodeValue === match[1] ? [m] : undefined : []; - } - }; - - Expr.filter.ID = function(elem, match){ - var node = typeof elem.getAttributeNode !== "undefined" && elem.getAttributeNode("id"); - return elem.nodeType === 1 && node && node.nodeValue === match; - }; - } - - root.removeChild( form ); - root = form = null; // release memory in IE -})(); - -(function(){ - // Check to see if the browser returns only elements - // when doing getElementsByTagName("*") - - // Create a fake element - var div = document.createElement("div"); - div.appendChild( document.createComment("") ); - - // Make sure no comments are found - if ( div.getElementsByTagName("*").length > 0 ) { - Expr.find.TAG = function(match, context){ - var results = context.getElementsByTagName(match[1]); - - // Filter out possible comments - if ( match[1] === "*" ) { - var tmp = []; - - for ( var i = 0; results[i]; i++ ) { - if ( results[i].nodeType === 1 ) { - tmp.push( results[i] ); - } - } - - results = tmp; - } - - return results; - }; - } - - // Check to see if an attribute returns normalized href attributes - div.innerHTML = ""; - if ( div.firstChild && typeof div.firstChild.getAttribute !== "undefined" && - div.firstChild.getAttribute("href") !== "#" ) { - Expr.attrHandle.href = function(elem){ - return elem.getAttribute("href", 2); - }; - } - - div = null; // release memory in IE -})(); - -if ( document.querySelectorAll ) { - (function(){ - var oldSizzle = Sizzle, div = document.createElement("div"); - div.innerHTML = "

"; - - // Safari can't handle uppercase or unicode characters when - // in quirks mode. - if ( div.querySelectorAll && div.querySelectorAll(".TEST").length === 0 ) { - return; - } - - Sizzle = function(query, context, extra, seed){ - context = context || document; - - // Only use querySelectorAll on non-XML documents - // (ID selectors don't work in non-HTML documents) - if ( !seed && context.nodeType === 9 && !Sizzle.isXML(context) ) { - try { - return makeArray( context.querySelectorAll(query), extra ); - } catch(e){} - } - - return oldSizzle(query, context, extra, seed); - }; - - for ( var prop in oldSizzle ) { - Sizzle[ prop ] = oldSizzle[ prop ]; - } - - div = null; // release memory in IE - })(); -} - -(function(){ - var div = document.createElement("div"); - - div.innerHTML = "
"; - - // Opera can't find a second classname (in 9.6) - // Also, make sure that getElementsByClassName actually exists - if ( !div.getElementsByClassName || div.getElementsByClassName("e").length === 0 ) { - return; - } - - // Safari caches class attributes, doesn't catch changes (in 3.2) - div.lastChild.className = "e"; - - if ( div.getElementsByClassName("e").length === 1 ) { - return; - } - - Expr.order.splice(1, 0, "CLASS"); - Expr.find.CLASS = function(match, context, isXML) { - if ( typeof context.getElementsByClassName !== "undefined" && !isXML ) { - return context.getElementsByClassName(match[1]); - } - }; - - div = null; // release memory in IE -})(); - -function dirNodeCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) { - for ( var i = 0, l = checkSet.length; i < l; i++ ) { - var elem = checkSet[i]; - if ( elem ) { - elem = elem[dir]; - var match = false; - - while ( elem ) { - if ( elem.sizcache === doneName ) { - match = checkSet[elem.sizset]; - break; - } - - if ( elem.nodeType === 1 && !isXML ){ - elem.sizcache = doneName; - elem.sizset = i; - } - - if ( elem.nodeName.toLowerCase() === cur ) { - match = elem; - break; - } - - elem = elem[dir]; - } - - checkSet[i] = match; - } - } -} - -function dirCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) { - for ( var i = 0, l = checkSet.length; i < l; i++ ) { - var elem = checkSet[i]; - if ( elem ) { - elem = elem[dir]; - var match = false; - - while ( elem ) { - if ( elem.sizcache === doneName ) { - match = checkSet[elem.sizset]; - break; - } - - if ( elem.nodeType === 1 ) { - if ( !isXML ) { - elem.sizcache = doneName; - elem.sizset = i; - } - if ( typeof cur !== "string" ) { - if ( elem === cur ) { - match = true; - break; - } - - } else if ( Sizzle.filter( cur, [elem] ).length > 0 ) { - match = elem; - break; - } - } - - elem = elem[dir]; - } - - checkSet[i] = match; - } - } -} - -Sizzle.contains = document.compareDocumentPosition ? function(a, b){ - return !!(a.compareDocumentPosition(b) & 16); -} : function(a, b){ - return a !== b && (a.contains ? a.contains(b) : true); -}; - -Sizzle.isXML = function(elem){ - // documentElement is verified for cases where it doesn't yet exist - // (such as loading iframes in IE - #4833) - var documentElement = (elem ? elem.ownerDocument || elem : 0).documentElement; - return documentElement ? documentElement.nodeName !== "HTML" : false; -}; - -var posProcess = function(selector, context){ - var tmpSet = [], later = "", match, - root = context.nodeType ? [context] : context; - - // Position selectors must be done after the filter - // And so must :not(positional) so we move all PSEUDOs to the end - while ( (match = Expr.match.PSEUDO.exec( selector )) ) { - later += match[0]; - selector = selector.replace( Expr.match.PSEUDO, "" ); - } - - selector = Expr.relative[selector] ? selector + "*" : selector; - - for ( var i = 0, l = root.length; i < l; i++ ) { - Sizzle( selector, root[i], tmpSet ); - } - - return Sizzle.filter( later, tmpSet ); -}; - -// EXPOSE - -window.Sizzle = Sizzle; - -})(); -!function (context, doc) { - var fns = [], ol, fn, f = false, - testEl = doc.documentElement, - hack = testEl.doScroll, - domContentLoaded = 'DOMContentLoaded', - addEventListener = 'addEventListener', - onreadystatechange = 'onreadystatechange', - loaded = /^loade|c/.test(doc.readyState); - - function flush(i) { - loaded = 1; - while (i = fns.shift()) { i() } - } - doc[addEventListener] && doc[addEventListener](domContentLoaded, fn = function () { - doc.removeEventListener(domContentLoaded, fn, f); - flush(); - }, f); - - - hack && doc.attachEvent(onreadystatechange, (ol = function () { - if (/^c/.test(doc.readyState)) { - doc.detachEvent(onreadystatechange, ol); - flush(); - } - })); - - context['domReady'] = hack ? - function (fn) { - self != top ? - loaded ? fn() : fns.push(fn) : - function () { - try { - testEl.doScroll('left'); - } catch (e) { - return setTimeout(function() { context['domReady'](fn) }, 50); - } - fn(); - }() - } : - function (fn) { - loaded ? fn() : fns.push(fn); - }; - -}(this, document); -})(); - -xui.extend({ - /** - * Adds more DOM nodes to the existing element list. - */ - add: function(q) { - [].push.apply(this, slice(xui(q))); - return this.set(this.reduce()); - }, - - /** - * Pops the last selector from XUI - */ - end: function () { - return this.set(this.cache || []); - }, - /** - * Sets the `display` CSS property to `block`. - */ - show:function() { - return this.setStyle('display','block'); - }, - /** - * Sets the `display` CSS property to `none`. - */ - hide:function() { - return this.setStyle('display','none'); - } -}); - -xui.extend({ - fade:function(to, callback) { - var target = 0; - if (typeof to == 'string' && to == 'in') target = 1; - else if (typeof to == 'number') target = to; - return this.tween({opacity:target,duration:.2}, callback); - } -}); - -if(typeof(Ur) == "undefined") { - Ur = { - QuickLoaders: {}, - WindowLoaders: {}, - Widgets: {}, - onLoadCallbacks: [], - // Make an easy function that initializes all widgets for a given fragment: - setup: function(fragment) { - // Hacky: - Ur.initialize({type: "DOMContentLoaded"}, fragment); - - if(Ur.loaded) { - // These widgets _cant_ be initialized till page load - Ur.initialize({type: "load"}, fragment); - } else { - window.addEventListener("load", function(e) { Ur.initialize(e, fragment)}, false); - } - }, - initialize: function(event, fragment) { - var Loaders = (event.type == "DOMContentLoaded") ? Ur.QuickLoaders : Ur.WindowLoaders; - if(fragment === undefined) { - fragment = document.body; - } - - for(var name in Loaders) { - var widget = new Loaders[name]; - widget.initialize(fragment); - } - - if(event.type == "load") { - Ur.loaded = true; - Ur._onLoad(); - } - }, - error: function(msg) { - console.error("Uranium: " + msg); - }, - warn: function(msg) { - console.warn("Uranium: " + msg); - }, - // TODO: Make private - _onLoad: function() { - //iterate through the callbacks - x$().iterate( - Ur.onLoadCallbacks, - function(callback) { - callback(); - } - ); - }, - loaded: false - }; -} - -// This event is compatible with FF/Webkit - -window.addEventListener("load", Ur.initialize, false); -window.addEventListener("DOMContentLoaded", Ur.initialize, false); - -// Do this? OR just initialize as widgets are defined (and have uranium included at the bottom --- but that has limitations in inline JS using all of our x$() mixins) --> I think thats reason enough to try this for now - - -// Here's an example of initializing a fragment manually: -// Ur.setup("div.test"); -// You have to be careful what you select since it searches within for components -- if your selector just matches the components individually, this will fail - -// Now, you can re-initialize html fragments like so (After I refactor the widget initializers to search within fragments) -// x$(elem).on('click', Ur.Loaders['zoom-preview'].intialize(fragment)); -// or -// x$(elem).on('click', Ur.initialize(fragment)); - -var mixins = { - // Grabbed this from xui's forEach defn - iterate: function(stuff, fn) { - if (stuff === undefined) { - return; - } - var len = stuff.length || 0, - i = 0, - that = arguments[1]; - - if (typeof fn == "function") { - for (; i < len; i++) { - fn.call(that, stuff[i], i, stuff); - } - } - }, - offset: function(elm) { - if (elm == undefined) - elm = this[0]; - - var cumulative_top = 0, cumulative_left = 0; - while (elm.offsetParent) { - cumulative_top += elm.offsetTop; - cumulative_left += elm.offsetLeft; - elm = elm.offsetParent; - } - return {left: cumulative_left, top: cumulative_top}; - }, - - // TODO: Make private: - findNextAncestor: function(elem, type) { - //check to make sure there's still a parent: - if (elem.parentNode != window.document) { - return x$().findSetAncestor(elem.parentNode, type); - } else { - return null; - } - }, - - findSetAncestor: function(elem, type) { - var set_name = x$(elem).attr("data-ur-set")[0]; - if (set_name !== undefined && (type == undefined || set_name == type)) - return elem; - return x$().findNextAncestor(elem, type); - }, - - get_unique_uranium_id: (function() { - var count = 0; - return function get_id() { - count += 1; - return count; - } - })(), - - findElements: function(type, component_constructors) { - var groups = {}; - - this.each( - (function(type, constructors, groups) { - return function() {x$().helper_find(this, type, constructors, groups)}; - })(type, component_constructors, groups)); - - return groups; - }, - // TODO: Make helper_find() private since its just a helper function - helper_find: function(fragment, type, component_constructors, groups) { - var all_elements = x$(fragment).find("*[data-ur-" + type + "-component]"); - - all_elements.each(function() { - - var valid_component = true; - - ///////// Resolve this component to its set /////////// - - // Check if this has the data-ur-id attribute - var my_set_id = x$(this).attr("data-ur-id")[0]; - - if (my_set_id !== undefined) { - if ( groups[my_set_id] === undefined) { - groups[my_set_id] = {}; - } - } - else { - //Find any set ancestors - var my_ancestor = x$().findSetAncestor(this, type); - - var widget_disabled = x$(my_ancestor).attr("data-ur-state")[0]; - if (widget_disabled === "disabled" && Ur.loaded == false) { - return; - } - - if (my_ancestor !== null) { - // Check if the set has an id ... if not, 'set' it up -- HA - - my_set_id = x$(my_ancestor).attr("data-ur-id")[0]; - - if (my_set_id === undefined) { - //generate ID - my_set_id = x$().get_unique_uranium_id(); - x$(my_ancestor).attr("data-ur-id", my_set_id); - } - - if (groups[my_set_id] === undefined) { - //setup group - groups[my_set_id] = {}; - } - - groups[my_set_id]["set"] = my_ancestor; - - } - else { - // we're screwed ... report an error - Ur.error("couldn't find associated ur-set for component:"); - console.log(this); - valid_component = false; - } - } - - //////////// Add this component to its set ///////////// - - var component_type = x$(this).attr("data-ur-" + type + "-component"); - - if (component_type === undefined) { - valid_component = false; - } - - if (valid_component) { - // This is widget specific behavior - // -- For toggler, it makes sense for content to be multiple things - // -- For select-lists, it doesn't - if (component_constructors !== undefined && component_constructors[component_type] !== undefined) - component_constructors[component_type](groups[my_set_id], this, component_type); - else - groups[my_set_id][component_type] = this; - } - }); - - return groups; - } -} - -xui.extend(mixins); - -/* Toggler * -* * * * * * -* The toggler alternates the state of all the content elements bound to the -* toggler button. -* -* If no initial state is provided, the default value 'disabled' -* is set upon initialization. -*/ - -Ur.QuickLoaders['toggler'] = (function(){ - function ToggleContentComponent (group, content_component) { - // This is a 'collection' of components - // -- if I see it again, I'll make this abstract - if(group["content"] === undefined) { - group["content"] = []; - } - group["content"].push(content_component); - } - - function ToggleLoader(){ - this.component_constructors = { - "content" : ToggleContentComponent - }; - } - - ToggleLoader.prototype.find = function(fragment){ - var togglers = x$(fragment).findElements('toggler', this.component_constructors); - var self=this; - - for(var toggler_id in togglers) { - var toggler = togglers[toggler_id]; - - if (toggler["button"] === undefined) { - Ur.error("no button found for toggler with id=" + toggler_id); - continue; - } - - var toggler_state = x$(toggler["button"]).attr("data-ur-state")[0]; - if(toggler_state === undefined) { - x$(toggler["button"]).attr("data-ur-state", 'disabled'); - toggler_state = "disabled"; - } - - if (toggler["content"] === undefined) { - Ur.error("no content found for toggler with id=" + toggler_id); - continue; - } - - // Make the content state match the button state - x$().iterate( - toggler["content"], - function(content) { - if (x$(content).attr("data-ur-state")[0] === undefined ) { - x$(content).attr("data-ur-state", toggler_state) - } - } - ); - - } - - return togglers; - } - - ToggleLoader.prototype.construct_button_callback = function(contents, set) { - var self = this; - return function(evt) { - var button = evt.currentTarget; - var current_state = x$(button).attr("data-ur-state")[0]; - var new_state = current_state === "enabled" ? "disabled" : "enabled"; - - x$(button).attr("data-ur-state", new_state); - x$(set).attr("data-ur-state", new_state); - - x$().iterate( - contents, - function(content){ - var current_state = x$(content).attr("data-ur-state")[0]; - var new_state = current_state === "enabled" ? "disabled" : "enabled"; - x$(content).attr("data-ur-state", new_state); - } - ); - } - } - - ToggleLoader.prototype.initialize = function(fragment) { - var togglers = this.find(fragment); - for(var name in togglers){ - var toggler = togglers[name]; - // if (togglers) - x$(toggler["button"]).click(this.construct_button_callback(toggler["content"], toggler["set"])); - x$(toggler["set"]).attr("data-ur-state","enabled"); - } - } - - return ToggleLoader; - })(); - -/* Tabs * - * * * * * * - * The tabs are like togglers with state. If one is opened, the others are closed - * - * Question: Can I assume order is preserved? Ill use IDs for now - */ - -Ur.QuickLoaders['tabs'] = (function(){ - function Tabs(data){ - this.elements = data; - this.setup_callbacks(); - } - - Tabs.prototype.setup_callbacks = function() { - var default_tab = null; - - for(var tab_id in this.elements["buttons"]) { - - var button = this.elements["buttons"][tab_id]; - var content = this.elements["contents"][tab_id]; - - if (default_tab === null) { - default_tab = tab_id; - } - - if(content === undefined) { - Ur.error("no matching tab content for tab button"); - return; - } - - var state = x$(button).attr("data-ur-state")[0]; - if(state !== undefined && state == "enabled") { - default_tab = -1; - } - - var closeable = x$(this.elements["set"]).attr("data-ur-closeable")[0]; - closeable = (closeable !== undefined && closeable == "true") ? true : false; - var self = this; - x$(button).on( - "click", - function(evt) { - var firstScrollTop = evt.target.offsetTop - document.body.scrollTop; - var this_tab_id = x$(evt.currentTarget).attr("data-ur-tab-id")[0]; - - for(var tab_id in self.elements["buttons"]) { - var button = self.elements["buttons"][tab_id]; - var content = self.elements["contents"][tab_id]; - - if (tab_id !== this_tab_id) { - x$(button).attr("data-ur-state","disabled"); - x$(content).attr("data-ur-state","disabled"); - } else { - var new_state = "enabled"; - if (closeable) { - var old_state = x$(button).attr("data-ur-state")[0]; - old_state = (old_state === undefined) ? "disabled" : old_state; - new_state = (old_state == "enabled") ? "disabled" : "enabled"; - } - x$(button).attr("data-ur-state", new_state); - x$(content).attr("data-ur-state", new_state); - } - } - var secondScrollTop = evt.target.offsetTop - document.body.scrollTop; - if ( secondScrollTop <= 0 ) { - window.scrollBy(0, secondScrollTop - firstScrollTop); - } - } - ); - } - } - - var ComponentConstructors = { - "button" : function(group, component, type) { - if (group["buttons"] === undefined) { - group["buttons"] = {} - } - - var tab_id = x$(component).attr("data-ur-tab-id")[0]; - if (tab_id === undefined) { - Ur.error("tab defined without a tab-id"); - return; - } - - group["buttons"][tab_id] = component; - }, - "content" : function(group, component, type) { - if (group["contents"] === undefined) { - group["contents"] = {} - } - - var tab_id = x$(component).attr("data-ur-tab-id")[0]; - if (tab_id === undefined) { - Ur.error("tab defined without a tab-id"); - return; - } - - group["contents"][tab_id] = component; - } - } - - function TabsLoader(){ - } - - TabsLoader.prototype.initialize = function(fragment) { - var tabs = x$(fragment).findElements('tabs', ComponentConstructors); - Ur.Widgets["tabs"] = {}; - - for(var name in tabs){ - var tab = tabs[name]; - Ur.Widgets["tabs"][name] = new Tabs(tabs[name]); - } - } - - return TabsLoader; -})(); - -/* Select List * - * * * * * * * * - * The select-list binds a set of uranium-elements to corresponding