diff --git a/.bowerrc b/.bowerrc new file mode 100644 index 00000000..163342d5 --- /dev/null +++ b/.bowerrc @@ -0,0 +1,3 @@ +{ + "directory": "./assets/" +} \ No newline at end of file diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 00000000..afcf58af --- /dev/null +++ b/.editorconfig @@ -0,0 +1,14 @@ +# editorconfig.org +root = true + +[*] +indent_style = tab +indent_size = 4 +end_of_line = lf +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true + +[{package.json,*.yml,*.conf,*.sh}] +indent_style = space +indent_size = 2 diff --git a/.eslintignore b/.eslintignore new file mode 100644 index 00000000..22131adb --- /dev/null +++ b/.eslintignore @@ -0,0 +1,6 @@ +dist +demos +assets +tests/specs/libs/ +tests/specs/bundle.js +tests/headless.js diff --git a/.eslintrc.json b/.eslintrc.json new file mode 100644 index 00000000..f6694342 --- /dev/null +++ b/.eslintrc.json @@ -0,0 +1,46 @@ +{ + "root": true, + "env": { + "browser": true, + "amd": true, + "commonjs": true, + "webextensions": true + }, + "globals": { + "hello": "writable" + }, + "extends": [ + "5app", + "eslint:recommended" + ], + "parserOptions": { + "ecmaVersion": 2021 + }, + "rules": { + "brace-style": 0, + "dot-notation": [2, {"allowKeywords": false}], + "eqeqeq": 0, + "jsdoc/check-tag-names": 0, + "max-params": [2, {"max": 6}], + "no-console": 0, + "no-empty": 0, + "no-param-reassign": 0, + "no-prototype-builtins": 0, + "no-redeclare": 0, + "no-throw-literal": 0, + "no-unused-vars": 0, + "no-use-before-define": 0, + "no-useless-call": 0, + "no-useless-escape": 0, + "no-useless-return": 0, + "no-var": 0, + "object-shorthand": 0, + "prefer-arrow-callback": 0, + "prefer-rest-params": 0, + "prefer-spread": 0, + "prefer-template": 0, + "quote-props": [2, "as-needed", {"keywords": true}], + "radix": 0, + "spaced-comment": 0 + } +} diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..5990bd92 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,48 @@ + +name: CI + +on: [push] + +jobs: + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-node@v2 + with: + node-version: 18 + - run: npm i + - run: npm run lint + + test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-node@v2 + with: + node-version: 18 + # Browserstack fix https://github.com/browserstack/browserstack-runner/issues/224#issuecomment-803409764 + - run: rm ./package-lock.json + - run: npm i + - run: npm test + - run: npm run test:browserstack + env: + BROWSERSTACK_KEY: ${{ secrets.BROWSERSTACK_KEY }} + BROWSERSTACK_USERNAME: ${{ secrets.BROWSERSTACK_USERNAME }} + + release: + needs: + - lint + - test + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-node@v2 + with: + node-version: 18 + - run: npm i + - name: Release + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} + run: npx semantic-release diff --git a/.gitignore b/.gitignore index dfa0b112..4c553263 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,8 @@ +.DS_Store node_modules/ coverage/ +_site/ src/*.html -src/**/*.html \ No newline at end of file +src/**/*.html +tests/specs/bundle.js +.env.sh diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 00000000..b3811f56 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,58 @@ +# [1.20.0](https://github.com/MrSwitch/hello.js/compare/v1.19.5...v1.20.0) (2023-01-25) + + +### Features + +* **state:** Base64 encoding instead of uri encoding of state param for yahoo ([#658](https://github.com/MrSwitch/hello.js/issues/658)) ([b196a7b](https://github.com/MrSwitch/hello.js/commit/b196a7b72c265280d16e1296be6b39619c23169c)) + +## [1.19.5](https://github.com/MrSwitch/hello.js/compare/v1.19.4...v1.19.5) (2021-09-19) + + +### Bug Fixes + +* **redirects:** lock down redirect attempts, fixes [#619](https://github.com/MrSwitch/hello.js/issues/619) ([544e5ea](https://github.com/MrSwitch/hello.js/commit/544e5ea3876116d93689e26b2c6a0b9ad9052e14)) + +## [1.19.4](https://github.com/MrSwitch/hello.js/compare/v1.19.3...v1.19.4) (2021-06-24) + + +### Bug Fixes + +* **lint:** lint and publish [#622](https://github.com/MrSwitch/hello.js/issues/622) ([c3988b6](https://github.com/MrSwitch/hello.js/commit/c3988b649b18f2d83d80c1ebb9819fd48359484a)) + +## [1.19.3](https://github.com/MrSwitch/hello.js/compare/v1.19.2...v1.19.3) (2021-04-13) + + +### Bug Fixes + +* **deps:** npm audit localhost ([384bf14](https://github.com/MrSwitch/hello.js/commit/384bf14b87b36028ed1876f9092bde1352ebaa89)) + +## [1.19.2](https://github.com/MrSwitch/hello.js/compare/v1.19.1...v1.19.2) (2021-03-20) + + +### Bug Fixes + +* **ci:** build dist ([e9be935](https://github.com/MrSwitch/hello.js/commit/e9be9354a4a6d8a2b3388c2d5435220a2b912d75)) + +## [1.19.1](https://github.com/MrSwitch/hello.js/compare/v1.19.0...v1.19.1) (2021-03-20) + + +### Bug Fixes + +* **ci:** build dist ([8b56eb5](https://github.com/MrSwitch/hello.js/commit/8b56eb539b7cd533b79d56764ea2038519cbbc3d)) + +# [1.19.0](https://github.com/MrSwitch/hello.js/compare/v1.18.8...v1.19.0) (2021-03-20) + + +### Bug Fixes + +* **global:** remove global variable ([2c378fe](https://github.com/MrSwitch/hello.js/commit/2c378fe680d792b6145ba30dfba1f7b1a01e8993)) + + +### Features + +* **build:** build dist from bash ([29ee7a4](https://github.com/MrSwitch/hello.js/commit/29ee7a418dedda2bc8ef82557893102fb2bcc00c)) + + +### Performance Improvements + +* remove redundant files from published npm package ([816cbb3](https://github.com/MrSwitch/hello.js/commit/816cbb3c874acee523e662c7c77eff59dd3621b3)) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 00000000..3bff5c96 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,120 @@ +# Contributing to HelloJS + +🎉 Thank you for your interest in contributing to HelloJS! +Contributions of all kinds — code, documentation, bug reports, and ideas — help make this project better. + +--- + +## 📚 Help and Support + +If you are having problems implementing HelloJS, you might find your answers already discussed. Please see: + +- [Issues on GitHub](https://github.com/MrSwitch/hello.js/issues) +- [FAQ’s on StackOverflow](http://stackoverflow.com/questions/tagged/hello.js) + +Want to discuss your implementations? + +- [Discussions on Gitter](https://gitter.im/MrSwitch/hello.js) + +If you are experiencing a bug in HelloJS or would like the library to support other services and features, please [create a new issue](https://github.com/MrSwitch/hello.js/issues/new). + +--- + +## 💡 Ways You Can Contribute + +You don’t need to write code to contribute — there are many ways to help: + +- **Report Issues** → Found a bug? Please [open an issue](https://github.com/MrSwitch/hello.js/issues/new). +- **Improve Documentation** → Fix typos, clarify explanations, or add missing steps in `README.md` or `CONTRIBUTING.md`. +- **Suggest Features** → Have an idea? Share it in a new issue for discussion. +- **Answer Questions** → Help others on StackOverflow or in the Gitter chat. +- **Contribute Code** → Work on bugs or features listed in the issue tracker. + +--- + +## ⚙️ Setting Up the Project Locally + +1. **Fork the Repository** + Click “Fork” on the top right of the [HelloJS GitHub repo](https://github.com/MrSwitch/hello.js). + +2. **Clone Your Fork** + ```bash + git clone https://github.com//hello.js.git + cd hello.js + ``` + +3. **Install Dependencies:** + Make sure you have Node.js installed, then run: + ```sh + npm install + ``` + +4. **Run Tests:** + To confirm everything works: + ```sh + npm test + ``` + +--- + +## ✏️ Making Changes + +1. **Create a New Branch:** + ```sh + git checkout -b my-change + ``` + +2. **Make Your Edits:** + Update code or documentation as needed. + +3. **Test Your Changes:** + Run tests to ensure nothing breaks: + ```sh + npm test + ``` + +4. **Commit Your Changes:** + ```sh + git add . + git commit -m "docs: improve contributing guide" + ``` + +--- + +## 📤 Submitting Your Contribution + +1. **Push Your Branch:** + ```sh + git push origin my-change + ``` + +2. **Open a Pull Request:** + - Go to your fork on GitHub. + - Click “Compare & pull request.” + - In the PR description, explain: + - What you changed + - Why it’s helpful (e.g., “makes contributing easier for beginners”) + +--- + +## 🗣️ Communication & Support + +- **Bugs / Features:** [Open an issue](https://github.com/MrSwitch/hello.js/issues/new) +- **Questions:** Ask on [StackOverflow](https://stackoverflow.com/questions/tagged/hello.js) +- **Discussion:** Join our [Gitter chat](https://gitter.im/MrSwitch/hello.js) + +--- + +## ✅ Contribution Checklist + +- [ ] Forked and cloned the repo +- [ ] Installed dependencies (`npm install`) +- [ ] Created a new branch +- [ ] Made clear, focused changes +- [ ] Ran tests successfully +- [ ] Opened a PR with a good description + +--- + +Thank you for making HelloJS better! +This guide is designed to help beginners and experienced contributors alike. \ No newline at end of file diff --git a/LICENSE b/LICENSE index 57f86ce6..0c6400b5 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2013 Andrew Dodson +Copyright (c) 2018 Andrew Dodson 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 @@ -17,4 +17,4 @@ 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. \ No newline at end of file +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/README.md b/README.md index 178af9dd..d4a5f743 100644 --- a/README.md +++ b/README.md @@ -1,25 +1,39 @@ +# hello.js +[![CDNJS](https://img.shields.io/cdnjs/v/hellojs.svg)](https://cdnjs.com/libraries/hellojs/) + +A client-side JavaScript SDK for authenticating with [OAuth2](http://tools.ietf.org/pdf/draft-ietf-oauth-v2-12.pdf) (and **OAuth1** with a [oauth proxy](#oauth-proxy)) web services and querying their REST APIs. HelloJS standardizes paths and responses to common APIs like Google Data Services, Facebook Graph and Windows Live Connect. It's **modular**, so that list is [growing](./modules). No more spaghetti code! -# hello.js -A client-side Javascript SDK for authenticating with [OAuth2](http://tools.ietf.org/pdf/draft-ietf-oauth-v2-12.pdf) (and OAuth1 with a [oauth proxy](#oauth-proxy)) web services and querying their REST API's. HelloJS Standardizes paths and responses to common API's like Google Data Services, Facebook Graph and Windows Live Connect. Its modular so that list is [growing](modules.html). No more spaghetti code! +## E.g. +
+
See demo at https://adodson.com/hello.js/.
+
+ +
+
+
+

+## Try out the next version +The `next` version is a modern rewrite of hellojs, please support this development in the `v2` branch. + npm i hellojs@next ## Features -Looking for more? HelloJS supports a lot more actions than just getting the users profile. Like, matching users with a users social friends list, sharing events with the users social streams, accessing and playing around with a users photos. Lets see if these whet your appetite ... +Here are some more demos... - + - + @@ -88,32 +102,47 @@ Looking for more? HelloJS supports a lot more actions than just getting the user -Items marked with a ✓ are fully working and can be [tested here](./tests/). -Items marked with a ✗ aren't provided by the provider at this time. -Blank items are work in progress, but there is good evidence that they can be done. -Anything not listed i have no knowledge of and would appreciate input. - +- Items marked with a ✓ are fully working and can be [tested here](./tests/). +- Items marked with a ✗ aren't provided by the provider at this time. +- Blank items are a work in progress, but there is good evidence that they can be done. +- I have no knowledge of anything unlisted and would appreciate input. ## Install -Download: [HelloJS](dist/hello.all.js) | [HelloJS (minified)](dist/hello.all.min.js) +Download: [HelloJS](https://github.com/MrSwitch/hello.js/raw/master/dist/hello.all.js) | [HelloJS (minified)](https://github.com/MrSwitch/hello.js/raw/master/dist/hello.all.min.js) + +Compiled source, which combines all of the modules, can be obtained from [GitHub](https://github.com/MrSwitch/hello.js/tree/master/dist), and source files can be found in [Source](https://github.com/MrSwitch/hello.js/tree/master/src). -Compiled source, which combines all the modules can be obtained from [Github](https://github.com/MrSwitch/hello.js/tree/master/dist), and source files can be found in [Source](https://github.com/MrSwitch/hello.js/tree/master/src). +**Note:** Some services require OAuth1 or server-side OAuth2 authorization. In such cases, HelloJS communicates with an [OAuth Proxy](#oauth-proxy). -### Bower Package +### NPM +```bash +npm i hellojs +``` - # Install the package manager, bower - npm install bower +At the present time only the bundled files in the `/dist/hello.*` support CommonJS. e.g. `let hello = require('hellojs/dist/hello.all.js')`. - # Install hello - bower install hello +### Bower +```bash +bower install hello +``` The [Bower](http://bower.io/) package shall install the aforementioned "/src" and "/dist" directories. The "/src" directory provides individual modules which can be packaged as desired. -Note: Some services require OAuth1 or server-side OAuth2 authorization. In such case HelloJS communicates with an [OAuth Proxy](#oauth-proxy). + + +## Help & Support + + +- [GitHub](https://github.com/MrSwitch/hello.js/issues) for reporting bugs and feature requests. +- [Gitter](https://gitter.im/MrSwitch/hello.js) to reach out for help. +- [Stack Overflow](http://stackoverflow.com/questions/tagged/hello.js) use tag **hello.js** +- [Slides](http://freddy03h.github.io/hello-presentation/#/) by Freddy Harris + + ## Quick Start Quick start shows you how to go from zero to loading in the name and picture of a user, like in the demo above. @@ -121,279 +150,537 @@ Quick start shows you how to go from zero to loading in the name and picture of - [Register your app domain](#1-register) - [Include hello.js script](#2-include-hellojs-script-in-your-page) -- [Create the signin buttons](#3-create-the-signin-buttons) -- [Setup listener for login and retrieve user info.](#4-add-listeners-for-the-user-login) +- [Create the sign-in buttons](#3-create-the-signin-buttons) +- [Setup listener for login and retrieve user info](#4-add-listeners-for-the-user-login) - [Initiate the client_ids and all listeners](#5-configure-hellojs-with-your-client_ids-and-initiate-all-listeners) ### 1. Register -Register your application with atleast one of the following networks. Ensure you register the correct domain as they can be quite picky +Register your application with at least one of the following networks. Ensure you register the correct domain as they can be quite picky. - -- [FaceBook](https://developers.facebook.com/apps) -- [Windows Live](https://manage.dev.live.com/) -- [Google +](https://code.google.com/apis/console/b/0/#:access) +- [Facebook](https://developers.facebook.com/apps) +- [Windows Live](https://account.live.com/developers/applications/index) +- [Google+](https://code.google.com/apis/console/b/0/#:access) ### 2. Include Hello.js script in your page - - -### 3. Create the signin buttons -Just add onclick events to call hello( network ).login(). Style your buttons as you like, i've used [zocial css](http://zocial.smcllns.com), but there are many other icon sets and fonts - - - +```html + +``` +### 3. Create the sign-in buttons +Just add onclick events to call hello(network).login(). Style your buttons as you like; I've used [zocial css](http://zocial.smcllns.com), but there are many other icon sets and fonts. +```html + +``` ### 4. Add listeners for the user login -Lets define a simple function, which will load a user profile into the page after they signin and on subsequent page refreshes. Below is our event listener which will listen for a change in the authentication event and make an API call for data. - +Let's define a simple function, which will load a user profile into the page after they sign in and on subsequent page refreshes. Below is our event listener which will listen for a change in the authentication event and make an API call for data. +```javascript +hello.on('auth.login', function(auth) { - hello.on('auth.login', function(auth){ - - // call user information, for the given network - hello( auth.network ).api( '/me' ).success(function(r){ - var $target = $("#profile_"+ auth.network ); - if($target.length==0){ - $target = $("
").appendTo("#profile"); - } - $target.html(' Hey '+r.name).attr('title', r.name + " on "+ auth.network); - }); + // Call user information, for the given network + hello(auth.network).api('me').then(function(r) { + // Inject it into the container + var label = document.getElementById('profile_' + auth.network); + if (!label) { + label = document.createElement('div'); + label.id = 'profile_' + auth.network; + document.getElementById('profile').appendChild(label); + } + label.innerHTML = ' Hey ' + r.name; }); +}); +``` +### 5. Configure hello.js with your client IDs and initiate all listeners -### 5. Configure hello.js with your client_id's and initiate all listeners - -Now let's wire it up with our registration detail obtained in step 1. By passing a [key:value, ...] list into the hello.init function. e.g.... - - - hello.init({ - facebook : FACEBOOK_CLIENT_ID, - windows : WINDOWS_CLIENT_ID, - google : GOOGLE_CLIENT_ID - },{redirect_uri:'redirect.html'}); +Now let's wire it up with our registration detail obtained in step 1. By passing a [key:value, ...] list into the `hello.init` function. e.g.... +```javascript +hello.init({ + facebook: FACEBOOK_CLIENT_ID, + windows: WINDOWS_CLIENT_ID, + google: GOOGLE_CLIENT_ID +}, {redirect_uri: 'redirect.html'}); +``` That's it. The code above actually powers the demo at the start so, no excuses. - # Core Methods ## hello.init() -Initiate the environment. And add the application credentials +Initiate the environment. And add the application credentials. -### hello.init( {facebook: id, windows: id, google: id, .... } ) +### hello.init({facebook: *id*, windows: *id*, google: *id*, ... })
WindowsFaceBookFacebook GoogleMore..More..
- + + + + - - + + + + + + + +
nametype
nametype
credentials - object( key => value, ...  ) - - - - - - - - -
nametypeexampledescription - argumentdefault
keystringwindows, facebook or google - App name"srequiredn/a
valuestring - 0000000AB1234ID of the service to connect to - requiredn/a
-
options - set's default options, as in hello.login() -
credentialsobject( key => value, ...  ) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
nametypeexampledescriptionargumentdefault
keystringwindows, facebook or googleApp namesrequiredn/a
valuestring0000000AB1234ID of the service to connect torequiredn/a
+
optionssets default options, as in hello.login()
### Example: - - hello.init({ - facebook : '359288236870', - windows : '000000004403AD10' - }); - +```js +hello.init({ + facebook: '359288236870', + windows: '000000004403AD10' +}); +``` ## hello.login() - +
If a network string is provided: A consent window to authenticate with that network will be initiated. Else if no network is provided a prompt to select one of the networks will open. A callback will be executed if the user authenticates and or cancels the authentication flow. -### hello.login( [network] [,options] [, callback() ] ) +### hello.login([network] [, options] [, callback()]) - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + +
nametypeexampledescription - argumentdefault
networkstringwindows, facebookOne of our services. - required - null
options - object - - - - - - - -
nametypeexampledescription - argumentdefault
displaystringpopup, page or none - How the signin flow should work, "none" is used to refresh the access_token in the background - optional - popup
scopestringemail, publish or photos - Comma separated list of scopes - optional - null
redirect_uristringredirect.html - A full or relative URI of a page which includes this script file hello.js - optional - window.location.href
response_typestringtoken, code - Mechanism for skipping auth flow - optional - token
forceBooleanfalse: return current session else initiate auth flow; true: Always initiate auth flow - Mechanism for authentication - optional - true
-
callbackfunctionfunction(){alert("Logged - in!");} - A callback when the users session has been initiated - optional - null
nametypeexampledescriptionargumentdefault
networkstringwindows, facebookOne of our services.requirednull
optionsobject + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
nametypeexampledescriptionargumentdefault
displaystringpopup, page or none"popup" - as the name suggests, "page" - navigates the whole page, "none" - refresh the access_token in the backgroundoptionalpopup
scopestringemail, publish or photosComma separated list of scopesoptionalnull
redirect_uristringRedirect Page + A full or relative URI of a page which includes this script file hello.js + optional + window.location.href
response_typestringtoken, codeImplicit (token) or Explicit (code) Grant flowoptionaltoken
forceBoolean or nulltrue, false or null(true) initiate auth flow and prompt for reauthentication where available. (null) initiate auth flow. (false) only prompt auth flow if the scopes have changed or the token expired.optionalnull
popupobject{resizable:1}Overrides the popups specsoptionalSee hello.settings.popup
statestringijustsetthisHonours the state parameter, by storing it within its own state objectoptional
+
callbackfunctionfunction(){alert("Logged in!");}A callback when the users session has been initiatedoptionalnull
### Examples: - - hello( "facebook" ).login( function(){ - alert("You are signed in to Facebook"); - }); - - +```js +hello('facebook').login().then(function() { + alert('You are signed in to Facebook'); +}, function(e) { + alert('Signin error: ' + e.error.message); +}); +``` ## hello.logout() +
+Remove all sessions or individual session. -Remove all sessions or individual sessions. - -### hello.logout( [network] [, callback() ] ) +### hello.logout([network] [, options] [, callback()]) - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + +
nametypeexampledescription - argumentdefault
networkstringwindows, facebookOne of our services. - optional - null
callbackfunctionfunction(){alert("Logged - in!");} - A callback when the users session has been initiated - optional - null
nametypeexampledescriptionargumentdefault
networkstring + windows, + facebook + One of our services. + optional + + null +
optionsobject + + + + + + + + + + + + + + + + + +
nametypeexampledescriptionargumentdefault
forcebooleantrueIf set to true, the user will be logged out of the providers site as well as the local application. By default the user will still be signed into the providers site. + optional + false
+
callbackfunction + function() {alert('Logged out!');} + + + A callback when the users session has been terminated + optional + + null +
### Example: - - hello( "facebook" ).logout(function(){ - alert("Signed out"); - }); - - +```js +hello('facebook').logout().then(function() { + alert('Signed out'); +}, function(e) { + alert('Signed out error: ' + e.error.message); +}); +``` ## hello.getAuthResponse() +
+Get the current status of the session. This is a synchronous request and does not validate any session cookie which may have gone expired. -Get the current status of the session, this is an synchronous request and does not validate any session cookies which may have expired. - -### hello.getAuthResponse( network ); +### hello.getAuthResponse(network) - - + + + + + + + + + + + + + + + +
nametypeexampledescription - argumentdefault
networkstringwindows, facebookOne of our services. - optional - current
nametypeexampledescriptionargumentdefault
networkstringwindows, facebookOne of our services.optionalcurrent
### Examples: +```js +var online = function(session) { + var currentTime = (new Date()).getTime() / 1000; + return session && session.access_token && session.expires > currentTime; +}; - var online = function(session){ - var current_time = (new Date()).getTime() / 1000; - return session && session.access_token && session.expires > current_time; - }; - - var fb = hello( "facebook" ).getAuthResponse(); - var wl = hello( "windows" ).getAuthResponse(); - - alert(( online(fb) ? "Signed":"Not signed") + " into FaceBook, " + ( online(wl) ? "Signed":"Not signed")+" into Windows Live"); +var fb = hello('facebook').getAuthResponse(); +var wl = hello('windows').getAuthResponse(); +alert((online(fb) ? 'Signed' : 'Not signed') + ' into Facebook, ' + (online(wl) ? 'Signed' : 'Not signed') + ' into Windows Live'); +``` ## hello.api() +
+Make calls to the API for getting and posting data. -Make calls to the API for getting and posting data +### hello.api([path], [method], [data], [callback(json)]) -### hello.api( [ path ], [ method ], [ data ], [ callback(json) ] ) +``` +hello.api([path], [method], [data], [callback(json)]).then(successHandler, errorHandler) +``` - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
nametypeexampledescription - argumentdefault
pathstring/me, /me/friendsPath or URI of the resource. See REST API, - Can be prefixed with the name of the service - requirednull
methodget, post, delete, putSee typeHTTP request method to use. - optionalget
dataobject{name: Hello, description: Fandelicious} - A JSON object of data, FormData, HTMLInputElement, HTMLFormElment to be sent along with a get, post or put request - optional - null
callbackfunctionfunction(json){console.log(json);} - A function to call with the body of the response returned in the first - parameter as an object, else boolean false - optional - null
nametypeexampledescriptionargumentdefault
pathstring + /me, + /me/friends + A relative path to the modules base URI, a full URI or a mapped path defined by the module - see REST API. + required + null
queryobject + {name:Hello} + HTTP query string parameters. + optional + null
method + get, + post, + delete, + put + See + type + HTTP request method to use. + optional + + get +
dataobject + {name:Hello, description:Fandelicious} + + A JSON object of data, FormData, HTMLInputElement, HTMLFormElment to be sent along with a + get, + postor + putrequest + + optional + + null +
timeoutinteger + 3000 = 3 seconds. + + Wait milliseconds before resolving the Promise with a reject. + + optional + + 60000 +
callbackfunction + function(json){console.log(json);} + + A function to call with the body of the response returned in the first parameter as an object, else boolean false. + + optional + + null +
More options (below) require putting the options into a 'key'=>'value' hash. I.e. hello(network).api(options) +
formatResponseboolean + false + + true: format the response, false: return raw response. + + optional + + true +
- ### Examples: +```js +hello('facebook').api('me').then(function(json) { + alert('Your name is ' + json.name); +}, function(e) { + alert('Whoops! ' + e.error.message); +}); +``` - hello( "facebook" ).api("me").success(function(json){ - alert("Your name is "+ json.name); - }).error(function(){ - alert("Whoops!"); - }); - +# Event Subscription -# Event subscription +Please see [demo of the global events](demos/events.html). ## hello.on() -Bind a callback to an event. An event maybe triggered by a change in user state or a change in some detail. - -### hello.on( event, callback ); +Bind a callback to an event. The event may be triggered by any change in user state or a change in any detail. +### hello.on(event, callback) @@ -407,6 +694,10 @@ Bind a callback to an event. An event maybe triggered by a change in user state + + + + @@ -422,171 +713,300 @@ Bind a callback to an event. An event maybe triggered by a change in user state
auth Triggered whenever session changes
auth.initTriggered prior to requesting an authentication flow
auth.login Triggered whenever a user logs in
- ### Example: +```js +var sessionStart = function() { + alert('Session has started'); +}; +hello.on('auth.login', sessionStart); +``` - var sessionstart = function(){ - alert("Session has started"); - }; - hello.on("auth.login",sessionstart); +## hello.off() +Remove a callback. Both event name and function must co-exist. +### hello.off(event, callback) -## hello.off() +```js +hello.off('auth.login', sessionStart); +``` -Remove a callback, both event name and function must exist +# Concepts -### hello.off( event, callback ); +## Pagination, Limit and Next Page +Responses which are a subset of the total results should provide a `response.paging.next` property. This can be plugged back into `hello.api` in order to get the next page of results. + +In the example below the function `paginationExample()` is initially called with `me/friends`. Subsequent calls take the path from `resp.paging.next`. + +```js +function paginationExample(path) { + hello('facebook') + .api(path, {limit: 1}) + .then( + function callback(resp) { + if (resp.paging && resp.paging.next) { + if (confirm('Got friend ' + resp.data[0].name + '. Get another?')) { + // Call the API again but with the 'resp.paging.next` path + paginationExample(resp.paging.next); + } + } + else { + alert('Got friend ' + resp.data[0].name); + } + }, + function() { + alert('Whoops!'); + } + ); +} +paginationExample('me/friends'); +``` - hello.off("auth.login",sessionstart); +## Scope +The scope property defines which privileges an app requires from a network provider. The scope can be defined globally for a session through `hello.init(object, {scope: 'string'})`, or at the point of triggering the auth flow e.g. `hello('network').login({scope: 'string'});` +An app can specify multiple scopes, separated by commas - as in the example below. +```js +hello('facebook').login({ + scope: 'friends, photos, publish' +}); +``` -# Misc +Scopes are tightly coupled with API requests. Unauthorized error response from an endpoint will occur if the scope privileges have not been granted. Use the [hello.api reference table](http://adodson.com/hello.js/#helloapi) to explore the API and scopes. -## Pagination, Limit and Next Page -A convenient function to get the `next` resultset is provided in the second parameter of any GET callback. Calling this function recreates the request with the original parameters and event listeners. Albeit the original path is augmented with the parameters defined in the paging.next property. +It's considered good practice to limit the use of scopes. The more unnecessary privileges you ask for the more likely users are going to drop off. If your app has many different sections, consider re-authorizing the user with different privileges as they go. +HelloJS modules standardises popular scope names. However you can always use proprietary scopes, e.g. to access google spreadsheets: `hello('google').login({scope: 'https://spreadsheets.google.com/feeds'});` - hello( "facebook" ).api( "me/friends", {limit: 1} ).success( function( json, next ){ - if( next ){ - if( confirm( "Got friend "+ json.data[0].name + ". Get another?" ) ){ - next(); - } - } - else{ - alert( "Got friend "+ json.data[0].name + ". That's it!" ); - } - }).error( function(){ - alert("Whoops!"); - }); +
See Scope for standardised scopes.
+ +## Redirect Page +Providers of the OAuth1/2 authorization flow must respect a Redirect URI parameter in the authorization request (also known as a Callback URL). E.g. `...&redirect_uri=http://mydomain.com/redirect.html&...` + +The `redirect_uri` is always a full URL. It must point to a Redirect document which will process the authorization response and set user session data. In order for an application to communicate with this document and set the session data, the origin of the document must match that of the application - this restriction is known as the same-origin security policy. + +A successful authorisation response will append the user credentials to the Redirect URI. e.g. `?access_token=12312&expires_in=3600`. The Redirect document is responsible for interpreting the request and setting the session data. + +### Create a Redirect Page and URI + +In HelloJS the default value of `redirect_uri` is the current page. However its recommended that you explicitly set the `redirect_uri` to a dedicated page with minimal UI and page weight. +Create an HTML page on your site which will be your redirect document. Include the HelloJS script e.g... +```html + +; +``` -## Error handling +Do add css animations incase there is a wait. **View Source** on [./redirect.html](./redirect.html) for an example. -For hello.api([path], [callback]) the first parameter of callback -upon error will be either boolean (false) or be an error object as -described below. +Then within your application script where you initiate HelloJS, define the Redirect URI to point to this page. e.g. + +```js +hello.init({ + facebook:client_id +}, { + redirect_uri: '/redirect.html' +}); +``` + +Please note: The `redirect_uri` example above in `hello.init` is relative, it will be turned into an absolute path by HelloJS before being used. + +## Error Handling + +Errors are returned i.e. `hello.api([path]).then(null, [*errorHandler*])` - alternatively `hello.api([path], [*handleSuccessOrError*])`. + +The [Promise](#promises-a) response standardizes the binding of error handlers. ### Error Object +The first parameter of a failed request to the *errorHandler* may be either *boolean (false)* or be an **Error Object**... + - - - -
nametype
errorobject - - - + + + + - - + + + +
nametypeexampledescription - argumentdefault
nametype
codestring - request_token_unauthorizedCode - requiredn/a
messagestringThe - provided access token.... - Error messagerequiredn/a
errorobject + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
nametypeexampledescriptionargumentdefault
codestring + request_token_unauthorized + Code + required + n/a
messagestringThe provided access token.... + Error message + required + n/a
+
+## Extending the services +Services are added to HelloJS as "modules" for more information about creating your own modules and examples, go to [Modules](./modules) -
+## OAuth Proxy +
+A list of the service providers OAuth* mechanisms is available at Provider OAuth Mechanisms +
-## Extending the services -Services are added to HelloJS as "modules" for more information about creating your own modules and examples, go to [Modules](./modules.html) +For providers which support only OAuth1 or OAuth2 with Explicit Grant, the authentication flow needs to be signed with a secret key that may not be exposed in the browser. HelloJS gets round this problem by the use of an intermediary webservice defined by `oauth_proxy`. This service looks up the secret from a database and performs the handshake required to provision an `access_token`. In the case of OAuth1, the webservice also signs subsequent API requests. -## OAuth Proxy -Services which rely on the OAuth 1 authentication method require a server side handshake with the secret key - this is unlike client-side OAuth 2 which doesn't need a secret and verifies the app based on the redirect_uri property. +**Quick start:** Register your Client ID and secret at the OAuth Proxy service, [Register your App](https://auth-server.herokuapp.com/) + + +The default proxy service is [https://auth-server.herokuapp.com/](https://auth-server.herokuapp.com/). Developers may add their own network registration Client ID and secret to this service in order to get up and running. +Alternatively recreate this service with [node-oauth-shim](https://npmjs.org/package/oauth-shim). Then override the default `oauth_proxy` in HelloJS client script in `hello.init`, like so... + +```javascript +hello.init( + CLIENT_IDS, + { + oauth_proxy: 'https://auth-server.herokuapp.com/proxy' + } +) +``` + +### Enforce Explicit Grant + +Enforcing the OAuth2 Explicit Grant is done by setting `response_type=code` in [hello.login](#hellologin) options - or globally in [hello.init](#helloinit) options. E.g... + +```javascript +hello(network).login({ + response_type: 'code' +}); +``` + +## Refresh Access Token + +Access tokens provided by services are generally short lived - typically 1 hour. Some providers allow for the token to be refreshed in the background after expiry. -Making HelloJS work with OAuth1 endpoints requires a proxy server to authorize the user and sign subsequent requests. As a shim HelloJS uses a service hosted at [http://auth-server.herokuapp.com/](http://auth-server.herokuapp.com/) developers may add their own network registration AppID/client_id and secret to this service in order to easily get started. +
A list of services which enable silent authentication after the Implicit Grant signin Refresh access_token +
-The aforementioned service uses [//node-oauth-shim](https://npmjs.org/package/oauth-shim), so go npm install oauth-shim that for your own deployment. +Unlike Implicit grant; Explicit grant may return the `refresh_token`. HelloJS honors the OAuth2 refresh_token, and will also request a new access_token once it has expired. +### Bulletproof Requests + +A good way to design your app is to trigger requests through a user action, you can then test for a valid access token prior to making the API request with a potentially expired token. + +```javascript +var google = hello('google'); +// Set force to false, to avoid triggering the OAuth flow if there is an unexpired access_token available. +google.login({force: false}).then(function() { + google.api('me').then(handler); +}); +``` + +## Promises A+ + +The response from the async methods `hello.login`, `hello.logout` and `hello.api` return a thenable method which is Promise A+ compatible. + +For a demo, or, if you're bundling up the library from `src/*` files, then please checkout [Promises](demos/promises.html) + ## Browser Support - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Browser
IE10
IE9
IE8
IE7
FF
CR
SA
OP
Mob
Mini5
iOSWP 7
hello.js1,234
+HelloJS targets all modern browsers. + +Polyfills are included in `src/hello.polyfill.js` this is to bring older browsers upto date. If you're using the resources located in `dist/` this is already bundled in. But if you're building from source you might like to first determine whether these polyfills are required, or if you're already supporting them etc... + +## PhoneGap Support +HelloJS can also be run on PhoneGap applications. Checkout the demo [hellojs-phonegap-demo](https://github.com/MrSwitch/hellojs-phonegap-demo) +## Chrome Apps -IE7: Makes beeping sounds whenever the POST, PUT or DELETE methods are -used - because of the XD, IFrame+Form+hack. -- IE7: Requires JSON.js and localStorage shims -- Opera Mini: Supports inline consent only, i.e. reloads original page. -- WP7: Supports inline consent only, i.e. reloads original page. +**Demo** [hellojs-chromeapp-demo](https://github.com/MrSwitch/hellojs-chromeapp-demo) +HelloJS module [src/hello.chromeapp.js](./src/hello.chromeapp.js) (also bundled in dist/*) shims the library to support the unique API's of the Chrome App environment (or Chrome Extension). -## Contributing +### Chrome manifest.json prerequisites -"No, It's perfect!".... If you believe that then give it a [star](https://github.com/MrSwitch/hello.js). +The `manifest.json` file must have the following permissions... -Having read this far you have already invested your time, why not contribute!? +```json + "permissions": [ + "identity", + "storage", + "https://*/" + ], +``` -HelloJS is constantly evolving, as are the services which it connects too. So if you think something could be said better, find something buggy or missing from either the code, documentation or demos then please put it in, no matter how trivial. +# Credits +HelloJS relies on these fantastic services for it's development and deployment, without which it would still be kicking around in a cave - not evolving very fast. -### Changing code? -Please adopt the continuous integration tests. +- [BrowserStack](https://www.browserstack.com/) for providing a means to test across multiple devices. - # Using NodeJS on your dev environment - # cd into the project root and install dev dependencies - npm install -l +## Can I contribute? - # run continuous integration tests - npm test +Yes, yes you can. In fact this isn't really free software, it comes with bugs and documentation errors. Moreover it tracks third party API's which just won't sit still. And it's intended for everyone to understand, so if you dont understand something then it's not fulfilling it's goal. +... otherwise give it a [star](https://github.com/MrSwitch/hello.js). -Open a couple of browsers with the given URL (e.g. it'll say "Karma v0.9.8 server started at http://localhost:9876/"). The tests are triggered when the code is modified +### Changing Code? +Ensure you setup and test your code on a variety of browsers. +```bash +# Using Node.js on your dev environment +# cd into the project root and install dev dependencies +npm install -l +# Install the grunt CLI (if you haven't already) +sudo npm install -g grunt-cli +# Run the tests +grunt test +# Run the tests in the browser... +# 1. In project root create local web server e.g. +python -m SimpleHTTPServer +# 2. Then open the following URL in your web browser: +# http://localhost:8000/tests/specs/index.html +``` diff --git a/_build.js b/_build.js deleted file mode 100644 index 3ebee2c4..00000000 --- a/_build.js +++ /dev/null @@ -1,18 +0,0 @@ -// _build.js -// Put this in the build package of Sublime Text 2 -/* -{ - "cmd": ["node", "${file_path:${folder}}/app.build.js", "$file_path"], - "working_dir" : "${file_path:${folder}}" -} -*/ - -// Require IO operations -// This package can be found -var shunt = require('shunt'); - -shunt({ - 'dist/hello.js' : 'src/hello.js', - 'dist/hello.all.js' : ['src/hello.js', 'src/modules/'], - 'README.md' : './index.html' -}); \ No newline at end of file diff --git a/_layouts/default.html b/_layouts/default.html new file mode 100644 index 00000000..30e6e58a --- /dev/null +++ b/_layouts/default.html @@ -0,0 +1,13 @@ + + + + + + + + + + + + +{{ content }} diff --git a/assets/css-social-buttons/.bower.json b/assets/css-social-buttons/.bower.json new file mode 100644 index 00000000..2dd4b3b6 --- /dev/null +++ b/assets/css-social-buttons/.bower.json @@ -0,0 +1,34 @@ +{ + "name": "css-social-buttons", + "description": "Zocial CSS social buttons", + "keywords": [ + "css", + "font", + "icon", + "social", + "zocial" + ], + "homepage": "http://zocial.smcllns.com/", + "main": [ + "css/zocial.css" + ], + "license": "MIT", + "ignore": [ + "*.json", + "*.yml", + "*.html", + "src/", + "templates/" + ], + "version": "1.2.0", + "_release": "1.2.0", + "_resolution": { + "type": "version", + "tag": "v1.2.0", + "commit": "4cb5a72a376610fa38acae21f8666268ba6f5af4" + }, + "_source": "https://github.com/samcollins/css-social-buttons.git", + "_target": "^1.2.0", + "_originalSource": "css-social-buttons", + "_direct": true +} \ No newline at end of file diff --git a/assets/css-social-buttons/.nojekyll b/assets/css-social-buttons/.nojekyll new file mode 100644 index 00000000..e69de29b diff --git a/assets/css-social-buttons/CNAME b/assets/css-social-buttons/CNAME new file mode 100644 index 00000000..9ef80048 --- /dev/null +++ b/assets/css-social-buttons/CNAME @@ -0,0 +1 @@ +zocial.smcllns.com diff --git a/assets/css-social-buttons/History.md b/assets/css-social-buttons/History.md new file mode 100644 index 00000000..33ba264f --- /dev/null +++ b/assets/css-social-buttons/History.md @@ -0,0 +1,27 @@ + +1.2.0 / 2016-01-03 +================== + + * NEW: Twitch icon. Thanks @inquam + * NEW: join.me icon. Might be a bit broken. Thanks @suttonj + +1.1.1 / 2015-07-04 +================== + + * FIX: broken bower.json + +1.1.0 / 2015-07-03 +================== + + * NEW: now also distributed on NPM + * NEW: website is now published trough the same repo (thanks @crowmagnumb !) + * CHANGE: official instagram icon + * FIX: general code and packaging cleanup + +1.0.0 / 2015-04-11 +================== + +First versioned release ! + +Recently added fontcustom support. + diff --git a/assets/css-social-buttons/LICENSE b/assets/css-social-buttons/LICENSE new file mode 100644 index 00000000..fbf0251f --- /dev/null +++ b/assets/css-social-buttons/LICENSE @@ -0,0 +1,22 @@ +Copyright (c) 2011-2015 Sam Collins (@smcllns) and contributors + +MIT License + +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 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/assets/css-social-buttons/README.md b/assets/css-social-buttons/README.md new file mode 100644 index 00000000..6d4da161 --- /dev/null +++ b/assets/css-social-buttons/README.md @@ -0,0 +1,58 @@ +# Zocial CSS social buttons + +I basically rewrote this entire set so they are full vector buttons, meaning: + +- @font-face icons +- custom font file for all social icons +- icon font use private unicode spaces for accessibility +- em sizing based on button font-size +- support for about 83 different services +- buttons and icons supported +- no raster images (sweet) +- works splendidly on any browser supporting @font-face +- CSS3 degrades gracefully in IE8 and below etc. +- also includes generic icon-less primary and secondary buttons + +*[Demo](https://smcllns.github.io/css-social-buttons/)* + +## How to use these buttons + +```html + +``` + +or + +```html +Button label +``` + +- Can be any element e.g. `a`, `div`, `button` etc. +- Add class of `.zocial` +- Add class for name of service e.g. `.dropbox`, `.twitter`, `.github` +- Done :-) + +Check out [zocial.smcllns.com](http://zocial.smcllns.com) for code examples. + +There's also a LESS version from @gustavohenke [here](https://github.com/gustavohenke/zocial-less) + +Problems, questions or requests to [@smcllns](http://twitter.com/smcllns) + +## CDN + +This project is available on CDNJS: +https://cdnjs.com/libraries/css-social-buttons + +## How to contribute + +1. Install [Font Custom](https://github.com/FontCustom/fontcustom) +2. Add new font in the `src/` folder. +3. Set color settings in the `templates/zocial.css` file. +4. Run `fontcustom compile` +5. Update the `sample.html` file with both the button and icon. +6. Test rendering. If broken go to step 2. +7. Send pull-request ! + +## License + +Under [MIT License](http://opensource.org/licenses/mit-license.php) diff --git a/assets/css-social-buttons/bower.json b/assets/css-social-buttons/bower.json new file mode 100644 index 00000000..054c3c7a --- /dev/null +++ b/assets/css-social-buttons/bower.json @@ -0,0 +1,23 @@ +{ + "name": "css-social-buttons", + "description": "Zocial CSS social buttons", + "keywords": [ + "css", + "font", + "icon", + "social", + "zocial" + ], + "homepage": "http://zocial.smcllns.com/", + "main": [ + "css/zocial.css" + ], + "license": "MIT", + "ignore": [ + "*.json", + "*.yml", + "*.html", + "src/", + "templates/" + ] +} diff --git a/assets/css-social-buttons/css/zocial.css b/assets/css-social-buttons/css/zocial.css new file mode 100644 index 00000000..b521c0b0 --- /dev/null +++ b/assets/css-social-buttons/css/zocial.css @@ -0,0 +1,510 @@ +@charset "UTF-8"; + +/*! + Zocial Butons + http://zocial.smcllns.com + by Sam Collins (@smcllns) + License: http://opensource.org/licenses/mit-license.php + + You are free to use and modify, as long as you keep this license comment intact or link back to zocial.smcllns.com on your site. +*/ + + +/* Button structure */ + +.zocial, +a.zocial { + border: 1px solid #777; + border-color: rgba(0,0,0,0.2); + border-bottom-color: #333; + border-bottom-color: rgba(0,0,0,0.4); + color: #fff; + -moz-box-shadow: inset 0 0.08em 0 rgba(255,255,255,0.4), inset 0 0 0.1em rgba(255,255,255,0.9); + -webkit-box-shadow: inset 0 0.08em 0 rgba(255,255,255,0.4), inset 0 0 0.1em rgba(255,255,255,0.9); + box-shadow: inset 0 0.08em 0 rgba(255,255,255,0.4), inset 0 0 0.1em rgba(255,255,255,0.9); + cursor: pointer; + display: inline-block; + font: bold 100%/2.1 "Lucida Grande", Tahoma, sans-serif; + padding: 0 .95em 0 0; + text-align: center; + text-decoration: none; + text-shadow: 0 1px 0 rgba(0,0,0,0.5); + white-space: nowrap; + + -moz-user-select: none; + -webkit-user-select: none; + user-select: none; + + position: relative; + + -moz-border-radius: .3em; + -webkit-border-radius: .3em; + border-radius: .3em; +} + +.zocial:before { + content: ""; + border-right: 0.075em solid rgba(0,0,0,0.1); + float: left; + font: 120%/1.65 zocial; + font-style: normal; + font-weight: normal; + margin: 0 0.5em 0 0; + padding: 0 0.5em; + text-align: center; + text-decoration: none; + text-transform: none; + + -moz-box-shadow: 0.075em 0 0 rgba(255,255,255,0.25); + -webkit-box-shadow: 0.075em 0 0 rgba(255,255,255,0.25); + box-shadow: 0.075em 0 0 rgba(255,255,255,0.25); + + -moz-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; + -webkit-font-smoothing: antialiased; + font-smoothing: antialiased; +} + +.zocial:active { + outline: none; /* outline is visible on :focus */ +} + +.zocial:hover, +.zocial:focus { + color: #fff; +} + +/* Buttons can be displayed as standalone icons by adding a class of "icon" */ + +.zocial.icon { + overflow: hidden; + max-width: 2.4em; + padding-left: 0; + padding-right: 0; + max-height: 2.15em; + white-space: nowrap; +} +.zocial.icon:before { + padding: 0; + width: 2em; + height: 2em; + + box-shadow: none; + border: none; +} + +/* Gradients */ + +.zocial { + background-image: -moz-linear-gradient(rgba(255,255,255,.1), rgba(255,255,255,.05) 49%, rgba(0,0,0,.05) 51%, rgba(0,0,0,.1)); + background-image: -ms-linear-gradient(rgba(255,255,255,.1), rgba(255,255,255,.05) 49%, rgba(0,0,0,.05) 51%, rgba(0,0,0,.1)); + background-image: -o-linear-gradient(rgba(255,255,255,.1), rgba(255,255,255,.05) 49%, rgba(0,0,0,.05) 51%, rgba(0,0,0,.1)); + background-image: -webkit-gradient(linear, left top, left bottom, from(rgba(255,255,255,.1)), color-stop(49%, rgba(255,255,255,.05)), color-stop(51%, rgba(0,0,0,.05)), to(rgba(0,0,0,.1))); + background-image: -webkit-linear-gradient(rgba(255,255,255,.1), rgba(255,255,255,.05) 49%, rgba(0,0,0,.05) 51%, rgba(0,0,0,.1)); + background-image: linear-gradient(rgba(255,255,255,.1), rgba(255,255,255,.05) 49%, rgba(0,0,0,.05) 51%, rgba(0,0,0,.1)); +} + +.zocial:hover, .zocial:focus { + background-image: -moz-linear-gradient(rgba(255,255,255,.15) 49%, rgba(0,0,0,.1) 51%, rgba(0,0,0,.15)); + background-image: -ms-linear-gradient(rgba(255,255,255,.15) 49%, rgba(0,0,0,.1) 51%, rgba(0,0,0,.15)); + background-image: -o-linear-gradient(rgba(255,255,255,.15) 49%, rgba(0,0,0,.1) 51%, rgba(0,0,0,.15)); + background-image: -webkit-gradient(linear, left top, left bottom, from(rgba(255,255,255,.15)), color-stop(49%, rgba(255,255,255,.15)), color-stop(51%, rgba(0,0,0,.1)), to(rgba(0,0,0,.15))); + background-image: -webkit-linear-gradient(rgba(255,255,255,.15) 49%, rgba(0,0,0,.1) 51%, rgba(0,0,0,.15)); + background-image: linear-gradient(rgba(255,255,255,.15) 49%, rgba(0,0,0,.1) 51%, rgba(0,0,0,.15)); +} + +.zocial:active { + background-image: -moz-linear-gradient(bottom, rgba(255,255,255,.1), rgba(255,255,255,0) 30%, transparent 50%, rgba(0,0,0,.1)); + background-image: -ms-linear-gradient(bottom, rgba(255,255,255,.1), rgba(255,255,255,0) 30%, transparent 50%, rgba(0,0,0,.1)); + background-image: -o-linear-gradient(bottom, rgba(255,255,255,.1), rgba(255,255,255,0) 30%, transparent 50%, rgba(0,0,0,.1)); + background-image: -webkit-gradient(linear, left top, left bottom, from(rgba(255,255,255,.1)), color-stop(30%, rgba(255,255,255,0)), color-stop(50%, transparent), to(rgba(0,0,0,.1))); + background-image: -webkit-linear-gradient(bottom, rgba(255,255,255,.1), rgba(255,255,255,0) 30%, transparent 50%, rgba(0,0,0,.1)); + background-image: linear-gradient(bottom, rgba(255,255,255,.1), rgba(255,255,255,0) 30%, transparent 50%, rgba(0,0,0,.1)); +} + +/* Adjustments for light background buttons */ + +.zocial.acrobat, +.zocial.bitcoin, +.zocial.cloudapp, +.zocial.dropbox, +.zocial.email, +.zocial.eventful, +.zocial.github, +.zocial.gmail, +.zocial.instapaper, +.zocial.itunes, +.zocial.ninetyninedesigns, +.zocial.openid, +.zocial.plancast, +.zocial.pocket, +.zocial.posterous, +.zocial.reddit, +.zocial.secondary, +.zocial.stackoverflow, +.zocial.viadeo, +.zocial.weibo, +.zocial.wikipedia { + border: 1px solid #aaa; + border-color: rgba(0,0,0,0.3); + border-bottom-color: #777; + border-bottom-color: rgba(0,0,0,0.5); + -moz-box-shadow: inset 0 0.08em 0 rgba(255,255,255,0.7), inset 0 0 0.08em rgba(255,255,255,0.5); + -webkit-box-shadow: inset 0 0.08em 0 rgba(255,255,255,0.7), inset 0 0 0.08em rgba(255,255,255,0.5); + box-shadow: inset 0 0.08em 0 rgba(255,255,255,0.7), inset 0 0 0.08em rgba(255,255,255,0.5); + text-shadow: 0 1px 0 rgba(255,255,255,0.8); +} + +/* :hover adjustments for light background buttons */ + +.zocial.acrobat:focus, +.zocial.acrobat:hover, +.zocial.bitcoin:focus, +.zocial.bitcoin:hover, +.zocial.dropbox:focus, +.zocial.dropbox:hover, +.zocial.email:focus, +.zocial.email:hover, +.zocial.eventful:focus, +.zocial.eventful:hover, +.zocial.github:focus, +.zocial.github:hover, +.zocial.gmail:focus, +.zocial.gmail:hover, +.zocial.instapaper:focus, +.zocial.instapaper:hover, +.zocial.itunes:focus, +.zocial.itunes:hover, +.zocial.ninetyninedesigns:focus, +.zocial.ninetyninedesigns:hover, +.zocial.openid:focus, +.zocial.openid:hover, +.zocial.plancast:focus, +.zocial.plancast:hover, +.zocial.pocket:focus, +.zocial.pocket:hover, +.zocial.posterous:focus, +.zocial.posterous:hover, +.zocial.reddit:focus, +.zocial.reddit:hover, +.zocial.secondary:focus, +.zocial.secondary:hover, +.zocial.stackoverflow:focus, +.zocial.stackoverflow:hover, +.zocial.twitter:focus, +.zocial.viadeo:focus, +.zocial.viadeo:hover, +.zocial.weibo:focus, +.zocial.weibo:hover, +.zocial.wikipedia:focus, +.zocial.wikipedia:hover { + background-image: -webkit-gradient(linear, left top, left bottom, from(rgba(255,255,255,0.5)), color-stop(49%, rgba(255,255,255,0.2)), color-stop(51%, rgba(0,0,0,0.05)), to(rgba(0,0,0,0.15))); + background-image: -moz-linear-gradient(top, rgba(255,255,255,0.5), rgba(255,255,255,0.2) 49%, rgba(0,0,0,0.05) 51%, rgba(0,0,0,0.15)); + background-image: -webkit-linear-gradient(top, rgba(255,255,255,0.5), rgba(255,255,255,0.2) 49%, rgba(0,0,0,0.05) 51%, rgba(0,0,0,0.15)); + background-image: -o-linear-gradient(top, rgba(255,255,255,0.5), rgba(255,255,255,0.2) 49%, rgba(0,0,0,0.05) 51%, rgba(0,0,0,0.15)); + background-image: -ms-linear-gradient(top, rgba(255,255,255,0.5), rgba(255,255,255,0.2) 49%, rgba(0,0,0,0.05) 51%, rgba(0,0,0,0.15)); + background-image: linear-gradient(top, rgba(255,255,255,0.5), rgba(255,255,255,0.2) 49%, rgba(0,0,0,0.05) 51%, rgba(0,0,0,0.15)); +} + +/* :active adjustments for light background buttons */ + +.zocial.acrobat:active, +.zocial.bitcoin:active, +.zocial.dropbox:active, +.zocial.email:active, +.zocial.eventful:active, +.zocial.github:active, +.zocial.gmail:active, +.zocial.instapaper:active, +.zocial.itunes:active, +.zocial.ninetyninedesigns:active, +.zocial.openid:active, +.zocial.plancast:active, +.zocial.pocket:active, +.zocial.posterous:active, +.zocial.reddit:active, +.zocial.secondary:active, +.zocial.stackoverflow:active, +.zocial.viadeo:active, +.zocial.weibo:active, +.zocial.wikipedia:active { + background-image: -webkit-gradient(linear, left top, left bottom, from(rgba(255,255,255,0)), color-stop(30%, rgba(255,255,255,0)), color-stop(50%, rgba(0,0,0,0)), to(rgba(0,0,0,0.1))); + background-image: -moz-linear-gradient(bottom, rgba(255,255,255,0), rgba(255,255,255,0) 30%, rgba(0,0,0,0) 50%, rgba(0,0,0,0.1)); + background-image: -webkit-linear-gradient(bottom, rgba(255,255,255,0), rgba(255,255,255,0) 30%, rgba(0,0,0,0) 50%, rgba(0,0,0,0.1)); + background-image: -o-linear-gradient(bottom, rgba(255,255,255,0), rgba(255,255,255,0) 30%, rgba(0,0,0,0) 50%, rgba(0,0,0,0.1)); + background-image: -ms-linear-gradient(bottom, rgba(255,255,255,0), rgba(255,255,255,0) 30%, rgba(0,0,0,0) 50%, rgba(0,0,0,0.1)); + background-image: linear-gradient(bottom, rgba(255,255,255,0), rgba(255,255,255,0) 30%, rgba(0,0,0,0) 50%, rgba(0,0,0,0.1)); +} + +/* Button icon */ +.zocial.acrobat:before { content: "\f100"; } +.zocial.amazon:before { content: "\f101"; } +.zocial.android:before { content: "\f102"; } +.zocial.angellist:before { content: "\f103"; } +.zocial.aol:before { content: "\f104"; } +.zocial.appnet:before { content: "\f105"; } +.zocial.appstore:before { content: "\f106"; } +.zocial.bitbucket:before { content: "\f107"; } +.zocial.bitcoin:before { content: "\f108"; } +.zocial.blogger:before { content: "\f109"; } +.zocial.buffer:before { content: "\f10a"; } +.zocial.cal:before { content: "\f10b"; } +.zocial.call:before { content: "\f10c"; } +.zocial.cart:before { content: "\f10d"; } +.zocial.chrome:before { content: "\f10e"; } +.zocial.cloudapp:before { content: "\f10f"; } +.zocial.creativecommons:before { content: "\f110"; } +.zocial.delicious:before { content: "\f111"; } +.zocial.digg:before { content: "\f112"; } +.zocial.disqus:before { content: "\f113"; } +.zocial.dribbble:before { content: "\f114"; } +.zocial.dropbox:before { content: "\f115"; } +.zocial.drupal:before { content: "\f116"; } +.zocial.dwolla:before { content: "\f118"; } +.zocial.email:before { content: "\f119"; } +.zocial.eventasaurus:before { content: "\f11a"; } +.zocial.eventbrite:before { content: "\f11b"; } +.zocial.eventful:before { content: "\f11c"; } +.zocial.evernote:before { content: "\f11d"; } +.zocial.facebook:before { content: "\f11e"; } +.zocial.fivehundredpx:before { content: "\f11f"; } +.zocial.flattr:before { content: "\f120"; } +.zocial.flickr:before { content: "\f121"; } +.zocial.forrst:before { content: "\f122"; } +.zocial.foursquare:before { content: "\f123"; } +.zocial.github:before { content: "\f124"; } +.zocial.gmail:before { content: "\f125"; } +.zocial.google:before { content: "\f126"; } +.zocial.googleplay:before { content: "\f127"; } +.zocial.googleplus:before { content: "\f128"; } +.zocial.gowalla:before { content: "\f129"; } +.zocial.grooveshark:before { content: "\f12a"; } +.zocial.guest:before { content: "\f12b"; } +.zocial.html5:before { content: "\f12c"; } +.zocial.ie:before { content: "\f12d"; } +.zocial.instagram:before { content: "\f12e"; } +.zocial.instapaper:before { content: "\f12f"; } +.zocial.intensedebate:before { content: "\f130"; } +.zocial.itunes:before { content: "\f131"; } +.zocial.joinme:before { content: "\f165"; } +.zocial.klout:before { content: "\f132"; } +.zocial.lanyrd:before { content: "\f133"; } +.zocial.lastfm:before { content: "\f134"; } +.zocial.lego:before { content: "\f135"; } +.zocial.linkedin:before { content: "\f136"; } +.zocial.lkdto:before { content: "\f137"; } +.zocial.logmein:before { content: "\f138"; } +.zocial.macstore:before { content: "\f139"; } +.zocial.meetup:before { content: "\f13a"; } +.zocial.myspace:before { content: "\f13b"; } +.zocial.ninetyninedesigns:before { content: "\f13c"; } +.zocial.openid:before { content: "\f13d"; } +.zocial.opentable:before { content: "\f13e"; } +.zocial.paypal:before { content: "\f13f"; } +.zocial.persona:before { content: "\f164"; } +.zocial.pinboard:before { content: "\f140"; } +.zocial.pinterest:before { content: "\f141"; } +.zocial.plancast:before { content: "\f142"; } +.zocial.plurk:before { content: "\f143"; } +.zocial.pocket:before { content: "\f144"; } +.zocial.podcast:before { content: "\f145"; } +.zocial.posterous:before { content: "\f146"; } +.zocial.print:before { content: "\f147"; } +.zocial.quora:before { content: "\f148"; } +.zocial.reddit:before { content: "\f149"; } +.zocial.rss:before { content: "\f14a"; } +.zocial.scribd:before { content: "\f14b"; } +.zocial.skype:before { content: "\f14c"; } +.zocial.smashing:before { content: "\f14d"; } +.zocial.songkick:before { content: "\f14e"; } +.zocial.soundcloud:before { content: "\f14f"; } +.zocial.spotify:before { content: "\f150"; } +.zocial.stackoverflow:before { content: "\f151"; } +.zocial.statusnet:before { content: "\f152"; } +.zocial.steam:before { content: "\f153"; } +.zocial.stripe:before { content: "\f154"; } +.zocial.stumbleupon:before { content: "\f155"; } +.zocial.tumblr:before { content: "\f156"; } +.zocial.twitch:before { content: "\f166"; } +.zocial.twitter:before { content: "\f157"; } +.zocial.viadeo:before { content: "\f158"; } +.zocial.vimeo:before { content: "\f159"; } +.zocial.vk:before { content: "\f15a"; } +.zocial.weibo:before { content: "\f15b"; } +.zocial.wikipedia:before { content: "\f15c"; } +.zocial.windows:before { content: "\f15d"; } +.zocial.wordpress:before { content: "\f15e"; } +.zocial.xing:before { content: "\f15f"; } +.zocial.yahoo:before { content: "\f160"; } +.zocial.ycombinator:before { content: "\f161"; } +.zocial.yelp:before { content: "\f162"; } +.zocial.youtube:before { content: "\f163"; } + +/* Button color */ +.zocial.acrobat:before {color: #FB0000;} +.zocial.bitcoin:before {color: #f7931a;} +.zocial.dropbox:before {color: #1f75cc;} +.zocial.drupal:before {color: #fff;} +.zocial.email:before {color: #312c2a;} +.zocial.eventasaurus:before {color: #9de428;} +.zocial.eventful:before {color: #0066CC;} +.zocial.fivehundredpx:before {color: #29b6ff;} +.zocial.forrst:before {color: #50894f;} +.zocial.gmail:before {color: #f00;} +.zocial.itunes:before {color: #1a6dd2;} +.zocial.lego:before {color:#fff900;} +.zocial.ninetyninedesigns:before {color: #f50;} +.zocial.openid:before {color: #ff921d;} +.zocial.pocket:before {color:#ee4056;} +.zocial.persona:before {color:#fff;} +.zocial.reddit:before {color: red;} +.zocial.scribd:before {color: #00d5ea;} +.zocial.stackoverflow:before {color: #ff7a15;} +.zocial.statusnet:before {color: #fff;} +.zocial.viadeo:before {color: #f59b20;} +.zocial.weibo:before {color: #e6162d;} + +/* Button background and text color */ + +.zocial.acrobat {background-color: #fff; color: #000;} +.zocial.amazon {background-color: #ffad1d; color: #030037; text-shadow: 0 1px 0 rgba(255,255,255,0.5);} +.zocial.android {background-color: #a4c639;} +.zocial.angellist {background-color: #000;} +.zocial.aol {background-color: #f00;} +.zocial.appnet {background-color: #3178bd;} +.zocial.appstore {background-color: #000;} +.zocial.bitbucket {background-color: #205081;} +.zocial.bitcoin {background-color: #efefef; color: #4d4d4d;} +.zocial.blogger {background-color: #ee5a22;} +.zocial.buffer {background-color: #232323;} +.zocial.call {background-color: #008000;} +.zocial.cal {background-color: #d63538;} +.zocial.cart {background-color: #333;} +.zocial.chrome {background-color: #006cd4;} +.zocial.cloudapp {background-color: #fff; color: #312c2a;} +.zocial.creativecommons {background-color: #000;} +.zocial.delicious {background-color: #3271cb;} +.zocial.digg {background-color: #164673;} +.zocial.disqus {background-color: #5d8aad;} +.zocial.dribbble {background-color: #ea4c89;} +.zocial.dropbox {background-color: #fff; color: #312c2a;} +.zocial.drupal {background-color: #0077c0; color: #fff;} +.zocial.dwolla {background-color: #e88c02;} +.zocial.email {background-color: #f0f0eb; color: #312c2a;} +.zocial.eventasaurus {background-color: #192931; color: #fff;} +.zocial.eventbrite {background-color: #ff5616;} +.zocial.eventful {background-color: #fff; color: #47ab15;} +.zocial.evernote {background-color: #6bb130; color: #fff;} +.zocial.facebook {background-color: #4863ae;} +.zocial.fivehundredpx {background-color: #333;} +.zocial.flattr {background-color: #8aba42;} +.zocial.flickr {background-color: #ff0084;} +.zocial.forrst {background-color: #1e360d;} +.zocial.foursquare {background-color: #44a8e0;} +.zocial.github {background-color: #fbfbfb; color: #050505;} +.zocial.gmail {background-color: #efefef; color: #222;} +.zocial.google {background-color: #4e6cf7;} +.zocial.googleplay {background-color: #000;} +.zocial.googleplus {background-color: #dd4b39;} +.zocial.gowalla {background-color: #ff720a;} +.zocial.grooveshark {background-color: #111; color:#eee;} +.zocial.guest {background-color: #1b4d6d;} +.zocial.html5 {background-color: #ff3617;} +.zocial.ie {background-color: #00a1d9;} +.zocial.instapaper {background-color: #eee; color: #222;} +.zocial.instagram {background-color: #3f729b;} +.zocial.intensedebate {background-color: #0099e1;} +.zocial.klout {background-color: #e34a25;} +.zocial.itunes {background-color: #efefeb; color: #312c2a;} +.zocial.lanyrd {background-color: #2e6ac2;} +.zocial.lastfm {background-color: #dc1a23;} +.zocial.lego {background-color: #fb0000;} +.zocial.linkedin {background-color: #0083a8;} +.zocial.lkdto {background-color: #7c786f;} +.zocial.logmein {background-color: #000;} +.zocial.macstore {background-color: #007dcb} +.zocial.meetup {background-color: #ff0026;} +.zocial.myspace {background-color: #000;} +.zocial.ninetyninedesigns {background-color: #fff; color: #072243;} +.zocial.openid {background-color: #f5f5f5; color: #333;} +.zocial.opentable {background-color: #990000;} +.zocial.paypal {background-color: #fff; color: #32689a; text-shadow: 0 1px 0 rgba(255,255,255,0.5);} +.zocial.persona {background-color: #1258a1; color: #fff;} +.zocial.pinboard {background-color: blue;} +.zocial.pinterest {background-color: #c91618;} +.zocial.plancast {background-color: #e7ebed; color: #333;} +.zocial.plurk {background-color: #cf682f;} +.zocial.pocket {background-color: #fff; color: #777;} +.zocial.podcast {background-color: #9365ce;} +.zocial.posterous {background-color: #ffd959; color: #bc7134;} +.zocial.print {background-color: #f0f0eb; color: #222; text-shadow: 0 1px 0 rgba(255,255,255,0.8);} +.zocial.quora {background-color: #a82400;} +.zocial.reddit {background-color: #fff; color: #222;} +.zocial.rss {background-color: #ff7f25;} +.zocial.scribd {background-color: #231c1a;} +.zocial.skype {background-color: #00a2ed;} +.zocial.smashing {background-color: #ff4f27;} +.zocial.songkick {background-color: #ff0050;} +.zocial.soundcloud {background-color: #ff4500;} +.zocial.spotify {background-color: #60af00;} +.zocial.stackoverflow {background-color: #fff; color: #555;} +.zocial.statusnet {background-color: #829d25;} +.zocial.steam {background-color: #000;} +.zocial.stripe {background-color: #2f7ed6;} +.zocial.stumbleupon {background-color: #eb4924;} +.zocial.tumblr {background-color: #374a61;} +.zocial.twitter {background-color: #46c0fb;} +.zocial.twitch {background-color: #6441A5;} +.zocial.viadeo {background-color: #fff; color: #000;} +.zocial.vimeo {background-color: #00a2cd;} +.zocial.vk {background-color: #45688E;} +.zocial.weibo {background-color: #faf6f1; color: #000;} +.zocial.wikipedia {background-color: #fff; color: #000;} +.zocial.windows {background-color: #0052a4; color: #fff;} +.zocial.wordpress {background-color: #464646;} +.zocial.xing {background-color: #0a5d5e;} +.zocial.yahoo {background-color: #a200c2;} +.zocial.ycombinator {background-color: #ff6600;} +.zocial.yelp {background-color: #e60010;} +.zocial.youtube {background-color: #f00;} + +/* +The Miscellaneous Buttons +These button have no icons and can be general purpose buttons while ensuring consistent button style +Credit to @guillermovs for suggesting +*/ + +.zocial.primary, .zocial.secondary {margin: 0.1em 0; padding: 0 1em;} +.zocial.primary:before, .zocial.secondary:before {display: none;} +.zocial.primary {background-color: #333;} +.zocial.secondary {background-color: #f0f0eb; color: #222; text-shadow: 0 1px 0 rgba(255,255,255,0.8);} + +/* Any browser-specific adjustments */ + +button:-moz-focus-inner { + border: 0; + padding: 0; +} + +/* Reference icons from font-files +** Base 64-encoded version recommended to resolve cross-site font-loading issues +*/ + +@font-face { + font-family: "zocial"; + src: url("./zocial.eot"); + src: url("./zocial.eot?#iefix") format("embedded-opentype"), + url(data:application/x-font-woff;charset=utf-8;base64,d09GRgABAAAAAEa0AA0AAAAAZfQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABGRlRNAABGmAAAABoAAAAccZsxBE9TLzIAAAGgAAAASQAAAGBQal8MY21hcAAAAqQAAABMAAABUvFF+FpjdnQgAAAC8AAAAAQAAAAEABEBRGdhc3AAAEaQAAAACAAAAAj//wADZ2x5ZgAAA8wAAD/8AABafNLvtMFoZWFkAAABMAAAADAAAAA2BrjO62hoZWEAAAFgAAAAIAAAACQEdwEbaG10eAAAAewAAAC1AAAA3gWl/5Jsb2NhAAAC9AAAANYAAADWmyKDrm1heHAAAAGAAAAAHwAAACAAwAE3bmFtZQAAQ8gAAAFSAAACYT6yvfpwb3N0AABFHAAAAXQAAAQmi64tm3jaY2BkYGAA4plrcpnj+W2+MnAzMYDApXXHpWD0/wX/NzDNYeICcjkYwNIARm8MKHjaY2BkYGDi+r+BQY+J4f+C/6lMcxiAIiiAFQCI6gWUeNpjYGRgYMhiZGMQYQABJiBmZACJOTDogQQAEMkA+QB42mNgYfzD+IWBlYGB0YcxjYGBwR1Kf2WQZGhhYGBiYGNmgAFGAQYECEhzTWE4wKDwMY3xwP8DDHpMXAwBIDVIShQYGAFzGAwbAAA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UElPsuKdUcixhucI6JLasHBakMQr+dXUuMedJiRgKmrnDDsdYYYgeI/O92VevwpqVomqonwOj0iTOpHK6k2mSL+0yDEO5tW4hx0XuxkU5NzJWWnYWzq2GvV5GNatUtc5Ubhwt9nSfcb6E82JfzGzCfF0/yWKDWxYmtRvm/2Yfcn13Oih9dBFxxeyJMKDFj6mG8nAfod+NurGOBn/MM+FlJR9v6xEk7SpDVefqekxMubZFLrWOlNZa/u7zCVEGZlIAAHjabc/FcpRhEEbh/0yA4MEhWIJLkOnPkmDxwd0CCW4FC3bcH3cGFJwlb1XXWT7VXa/7u18/u9Huf/v25+h63RA9hljDWtYxzHo2sJFNbGYLWxlhG9vZwU52sZs97GUfo+znAAc5xGHGGOcIRznGcU5wklOc5gxnmeAc57nARfoEiUyh0phkimkucZkrXOUaM8wyxzwLLLLEgOvc4Ca3uM0d7nKP+zzgIY94zBOe8oznLPOCl6ywyite84a3vOM9H/jIJz7zZfjH96+D6Pdt2GSzLbbaZiftlJ22c3beLthFu2QH/xr6oR/6oR/6oR/6oRu6oRu6oRu6oRu6STfpJt2km3STbtJN/p30k37ST/pJP+kn/aSf9bN+1s/6WT/rZ/2sn/WzftbP+lk/62f9rF/0i37RL/pFv+gX/aJf9It+0S/6Rb/oF/2iX/WrftWv+lW/6lf9ql/1q37Vr/pVv+pX/arf9Jt+02/6Tb/pt/YbvBr5SwAAAAH//wACeNpjYGBgZACCM7aLzoPoS+uOS8FoAE7LBz4AAA==), + url("./zocial.woff") format("woff"), + url("./zocial.ttf") format("truetype"), + url("./zocial.svg#zocial") format("svg"); + font-weight: normal; + font-style: normal; +} + +@media screen and (-webkit-min-device-pixel-ratio:0) { + @font-face { + font-family: "zocial"; + src: url("./zocial.svg#zocial") format("svg"); + } +} diff --git a/assets/css-social-buttons/css/zocial.eot b/assets/css-social-buttons/css/zocial.eot new file mode 100644 index 00000000..a3935456 Binary files /dev/null and b/assets/css-social-buttons/css/zocial.eot differ diff --git a/assets/css-social-buttons/css/zocial.svg b/assets/css-social-buttons/css/zocial.svg new file mode 100644 index 00000000..bebb24a5 --- /dev/null +++ b/assets/css-social-buttons/css/zocial.svg @@ -0,0 +1,1116 @@ + + + + + +Created by FontForge 20120731 at Sun Jan 3 13:39:54 2016 + By danlil,,, +Created by danlil,,, with FontForge 2.0 (http://fontforge.sf.net) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/css-social-buttons/css/zocial.ttf b/assets/css-social-buttons/css/zocial.ttf new file mode 100644 index 00000000..7a36061a Binary files /dev/null and b/assets/css-social-buttons/css/zocial.ttf differ diff --git a/assets/css-social-buttons/css/zocial.woff b/assets/css-social-buttons/css/zocial.woff new file mode 100644 index 00000000..45eea428 Binary files /dev/null and b/assets/css-social-buttons/css/zocial.woff differ diff --git a/assets/css-social-buttons/site/bebasneue-webfont.eot b/assets/css-social-buttons/site/bebasneue-webfont.eot new file mode 100644 index 00000000..eefc29f3 Binary files /dev/null and b/assets/css-social-buttons/site/bebasneue-webfont.eot differ diff --git a/assets/css-social-buttons/site/bebasneue-webfont.svg b/assets/css-social-buttons/site/bebasneue-webfont.svg new file mode 100644 index 00000000..c6c7d6cc --- /dev/null +++ b/assets/css-social-buttons/site/bebasneue-webfont.svg @@ -0,0 +1,146 @@ + + + + +This is a custom SVG webfont generated by Font Squirrel. +Copyright : Copyright c 2010 by Ryoichi Tsunekawa All rights reserved +Designer : Ryoichi Tsunekawa +Foundry : Ryoichi Tsunekawa + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/assets/css-social-buttons/site/bebasneue-webfont.ttf b/assets/css-social-buttons/site/bebasneue-webfont.ttf new file mode 100644 index 00000000..9b9eefc6 Binary files /dev/null and b/assets/css-social-buttons/site/bebasneue-webfont.ttf differ diff --git a/assets/css-social-buttons/site/bebasneue-webfont.woff b/assets/css-social-buttons/site/bebasneue-webfont.woff new file mode 100644 index 00000000..89423e13 Binary files /dev/null and b/assets/css-social-buttons/site/bebasneue-webfont.woff differ diff --git a/assets/css-social-buttons/site/button-sample.png b/assets/css-social-buttons/site/button-sample.png new file mode 100644 index 00000000..00caa3c3 Binary files /dev/null and b/assets/css-social-buttons/site/button-sample.png differ diff --git a/assets/css-social-buttons/site/core.css b/assets/css-social-buttons/site/core.css new file mode 100644 index 00000000..fb7bbec7 --- /dev/null +++ b/assets/css-social-buttons/site/core.css @@ -0,0 +1,329 @@ +@font-face { + font-family: 'Bebas Neue'; + src: url('bebasneue-webfont.eot'); + src: url('bebasneue-webfont.eot?#iefix') format('embedded-opentype'), + url('bebasneue-webfont.woff') format('woff'), + url('bebasneue-webfont.ttf') format('truetype'), + url('bebasneue-webfont.svg#BebasNeueRegular') format('svg'); + font-weight: normal; + font-style: normal; +} +@font-face { + font-family: "pictos"; + src: + url("pictos-web.eot?") format("eot"), + url("pictos-web.woff") format("woff"), + url("pictos-web.ttf") format("truetype"), + url("pictos-web.svg#webfontIyfZbseF") format("svg"); + font-weight: normal; + font-style: normal; +} +body { + background: #f0ecdf url('white-radial-gradient.png') no-repeat center 50px; + color: #312C2A; + font-family: Georgia, serif; + margin: 4em auto; + text-shadow: 0 1px 0 rgba(255,255,255,0.75); + width: 800px; +} + +h1 { + font-family: "Baskerville Old Face", Georgia, serif; + line-height: 1.5em; + font-weight: normal; + text-align: center; + font-size: 2em; + padding: 0; + margin: 0; +} +h2, #button-sample:before { + text-transform: uppercase; + font-family: "Bebas Neue", "Helvetica Neue", serif; + font-size: 20px; + font-weight: normal; +} +h1, h2, p, #purchase-area > div > span { + opacity: 0.9; +} +a { + color: #312C2A; + color: rgba(49,44,42,0.75); + text-decoration: none; +} +a:hover { + border-bottom: 1px solid rgba(49,44,42,0.5); +} +.dingbat { + background: url(dingbat.png) no-repeat center center; + width: 63px; + height: 29px; + margin: 0 auto; + padding: 64px 0; + opacity: 0.75; + clear: both; +} + + +#button-sample { + margin: 0 auto 64px; + width: 804px; + height: 314px; + background: url(button-sample.png) no-repeat center top; + text-align: center; + position: relative; + cursor: pointer; +} +#button-sample:hover:before { + content: "view demo"; + display: block; + background: #fff; + background: rgba(255,255,255,0.75); + width: 128px; + height: 128px; + line-height: 128px; + white-space: nowrap; + position: absolute; + left: 50%; + margin-left: -64px; + z-index: 100; + border-radius: 100px; + -moz-border-radius: 100px; + -webkit-border-radius: 100px; + top: 50%; + margin-top: -96px; +} +#button-sample > span { + text-align: center; + display: block; + width: 100%; + position: absolute; + bottom: 32px; + left: 0; + font-weight: normal; + font-size: 13px; + color: #777; + padding: 16px 0; +} +#button-sample > span:before { + content: "k "; + font-family: "pictos"; + color: #BA5B64; + font-size: 18px; +} +#purchase-area > a.zocial { + margin: 48px 0; + font-size: 20px; + display: inline-block; +} +#purchase-area > p.subtxt { + width: 45.5%; + padding: 0 10px; + margin: 10px 9% 0; + text-align: center; + font-size: 15px; +} +#purchase-area > p.subtxt > a { + line-height: 1.5; + padding-bottom: 2px; + border-bottom: 1px solid rgba(0,0,0,0.25); +} +#purchase-area > p.subtxt > a:hover { + color: rgba(0,0,0,0.9); +} +#purchase-area div.cta { + float: left; + width: 60%; + padding: 72px 32px; + text-align: center; +} +#purchase-area div.aside { + margin-left: 69%; + width: 30%; + margin-top: -32px; +} +#purchase-area div.aside > span { + font-size: 48px; + padding: 16px 0; + margin: 0 0 2px 0; + border-bottom: 4px solid rgba(0,0,0,0.75); + position: relative; + display: block; + font-weight: bold; + text-decoration: line-through; +} +#purchase-area div.aside p { + padding: 16px 0; + margin: 0; +} +#purchase-area div.aside h2 { + padding: 16px 0; + margin: 0 0 2px 0; + border-bottom: 4px solid rgba(0,0,0,0.75); + border-top: 1px solid rgba(0,0,0,0.75); +} +#purchase-area div.aside p { + font-size: 12px; +} +#labels { + margin-top: 48px; +} +#labels > article { + width: 30%; + float: left; + margin-right: 4.5%; +} +#labels > article:nth-of-type(3) { + margin-right: 0; +} +#labels p:first-letter { + float: left; + font-size: 56px; + line-height: 56px; + padding: 0 10px 0 0; + display: block; +} +#labels p, +#demo-area > p { + font-size: 12px; +} +#demo-area { + padding: 0; +} +#demo-area > p:before { + font-family: "pictos"; + content: "3 "; +} +#demo-area > h2 { + border-bottom: 4px solid rgba(0,0,0,0.75); + padding: 4px 0; + margin-bottom: 2px; +} +#demo-area > p:nth-of-type(1) { + border-top: 1px solid rgba(0,0,0,0.75); + padding-top: 1em; + margin-top: 2px; +} +#demo-area > h2, +#demo-area > p { + margin-left: 69%; + width: 30%; +} +#demo { + float: left; + width: 64.5%; + padding-top: 64px; + height: 154px; + -webkit-border-radius: 2px; + -moz-border-radius: 2px; + border-radius: 2px; + position: relative; + text-align: center; +} +#demo form { + position: absolute; + bottom: 0; + width: 96%; + margin: 0; + background: rgba(0,0,0,0.1); + -webkit-border-radius: 2px 2px 4px 4px; + -moz-border-radius: 2px 2px 4px 4px; + border-radius: 2px 2px 4px 4px; + -webkit-box-shadow: inset 0 1px 0 rgba(255,255,255,0.5), 0 1px 0px rgba(0,0,0,0.25); + -moz-box-shadow: inset 0 1px 0 rgba(255,255,255,0.5), 0 1px 0px rgba(0,0,0,0.25); + box-shadow: inset 0 1px 0 rgba(255,255,255,0.5), 0 1px 0px rgba(0,0,0,0.25); + border-top: 1px solid rgba(0,0,0,0); + text-align: left; + padding: 4px 2%; +} +#demo form > p { + font-size: 12px; + font-weight: normal; + float: left; + text-align: center; + margin: 0; + width: 30%; + padding: 8px 1.5%; +} +#demo form > input:nth-of-type(1), +#demo form > input:nth-of-type(2) { + width: 29%; + display: inline-block; + margin: 0 1.5%; + font-size: 11px; + padding: 1% 0.5%; + border: 0; + border-radius: 2px; +} +#demo form > input:nth-of-type(1) { + width: 26%; + margin: 0 3%; +} +#demo form > input:nth-of-type(2) { + width: 31%; + -webkit-box-shadow: inset 0 1px 0px rgba(0,0,0,0.35); + -moz-box-shadow: inset 0 1px 0px rgba(0,0,0,0.35); + box-shadow: inset 0 1px 0px rgba(0,0,0,0.35); + border-bottom: 1px solid rgba(255,255,255,0.35); +} +#demo form > div { + text-align: center; + display: inline-block; + font-size: 12px; + width: 13%; +} +#demo form > div:nth-of-type(1) { + margin-left: 3%; +} +#howto { + padding: 64px 0 0; +} +#howto.compact code, +#howto.compact p:nth-of-type(n+2), +#howto.compact h2:nth-of-type(n+2) { + display: none; +} +#howto p { + font-size: 12px; +} +#howto code { + background: rgba(0,0,0,0.1); + line-height: 1.5em; + padding: 1em; + margin: 2em 0 ; + display: block; +} +body > footer p { + text-align: center; + font-size: 12px; +} +#button-lightbox { + position: relative; + background: rgba(255,255,255,0.95); + z-index: 1000; + text-align: center; + padding: 32px 0; + width: 760px; + margin: 0 auto; + -webkit-box-shadow: 0 1px 2px rgba(0,0,0,0.75); + -moz-box-shadow: 0 1px 2px rgba(0,0,0,0.75); + box-shadow: 0 1px 2px rgba(0,0,0,0.75); + -webkit-border-radius: 2px; + -moz-border-radius: 2px; + border-radius: 2px; + margin-bottom: 4em; +} +#button-lightbox p { + font-size: 13px; + padding: 32px 0; +} +#button-lightbox > img { +} +#button-lightbox h2 { + padding: 64px 0 0; +} +.hidden { + display: none; +} +section, article, aside, header, footer { + display: block; +} diff --git a/assets/css-social-buttons/site/dingbat.png b/assets/css-social-buttons/site/dingbat.png new file mode 100644 index 00000000..aca3c52d Binary files /dev/null and b/assets/css-social-buttons/site/dingbat.png differ diff --git a/assets/css-social-buttons/site/html5slider.js b/assets/css-social-buttons/site/html5slider.js new file mode 100644 index 00000000..f35a73e7 --- /dev/null +++ b/assets/css-social-buttons/site/html5slider.js @@ -0,0 +1,265 @@ +/* +html5slider - a JS implementation of for Firefox 4 and up + +Copyright (c) 2010-2011 Frank Yan, + +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 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. +*/ + +(function() { + +// test for native support +var test = document.createElement('input'); +try { + test.type = 'range'; + if (test.type == 'range') + return; +} catch (e) { + return; +} + +// test for required property support +if (!document.mozSetImageElement || !('MozAppearance' in test.style)) + return; + +var scale; +var isMac = navigator.platform == 'MacIntel'; +var thumb = { + radius: isMac ? 9 : 6, + width: isMac ? 22 : 12, + height: isMac ? 16 : 20 +}; +var track = '-moz-linear-gradient(top, transparent ' + (isMac ? + '6px, #999 6px, #999 7px, #ccc 9px, #bbb 11px, #bbb 12px, transparent 12px' : + '9px, #999 9px, #bbb 10px, #fff 11px, transparent 11px') + + ', transparent)'; +var styles = { + 'min-width': thumb.width + 'px', + 'min-height': thumb.height + 'px', + 'max-height': thumb.height + 'px', + padding: 0, + border: 0, + 'border-radius': 0, + cursor: 'default', + 'text-indent': '-999999px' // -moz-user-select: none; breaks mouse capture +}; +var onChange = document.createEvent('HTMLEvents'); +onChange.initEvent('change', true, false); + +if (document.readyState == 'loading') + document.addEventListener('DOMContentLoaded', initialize, true); +else + initialize(); + +function initialize() { + // create initial sliders + Array.forEach(document.querySelectorAll('input[type=range]'), transform); + // create sliders on-the-fly + document.addEventListener('DOMNodeInserted', onNodeInserted, true); +} + +function onNodeInserted(e) { + check(e.target); + if (e.target.querySelectorAll) + Array.forEach(e.target.querySelectorAll('input'), check); +} + +function check(input, async) { + if (input.localName != 'input' || input.type == 'range'); + else if (input.getAttribute('type') == 'range') + transform(input); + else if (!async) + setTimeout(check, 0, input, true); +} + +function transform(slider) { + + var isValueSet, areAttrsSet, isChanged, isClick, prevValue, rawValue, prevX; + var min, max, step, range, value = slider.value; + + // lazily create shared slider affordance + if (!scale) { + scale = document.body.appendChild(document.createElement('hr')); + style(scale, { + '-moz-appearance': isMac ? 'scale-horizontal' : 'scalethumb-horizontal', + display: 'block', + visibility: 'visible', + opacity: 1, + position: 'fixed', + top: '-999999px' + }); + document.mozSetImageElement('__sliderthumb__', scale); + } + + // reimplement value and type properties + slider.__defineGetter__('value', function() { + return '' + value; + }); + slider.__defineSetter__('value', function(val) { + value = '' + val; + isValueSet = true; + draw(); + }); + slider.__defineGetter__('type', function() { + return 'range'; + }); + + // sync properties with attributes + ['min', 'max', 'step'].forEach(function(prop) { + if (slider.hasAttribute(prop)) + areAttrsSet = true; + slider.__defineGetter__(prop, function() { + return this.hasAttribute(prop) ? this.getAttribute(prop) : ''; + }); + slider.__defineSetter__(prop, function(val) { + val === null ? this.removeAttribute(prop) : this.setAttribute(prop, val); + }); + }); + + // initialize slider + slider.readOnly = true; + style(slider, styles); + update(); + + slider.addEventListener('DOMAttrModified', function(e) { + // note that value attribute only sets initial value + if (e.attrName == 'value' && !isValueSet) { + value = e.newValue; + draw(); + } + else if (~['min', 'max', 'step'].indexOf(e.attrName)) { + update(); + areAttrsSet = true; + } + }, true); + + slider.addEventListener('mousedown', onDragStart, true); + slider.addEventListener('keydown', onKeyDown, true); + slider.addEventListener('focus', onFocus, true); + slider.addEventListener('blur', onBlur, true); + + function onDragStart(e) { + isClick = true; + setTimeout(function() { isClick = false; }, 0); + if (e.button || !range) + return; + var width = parseFloat(getComputedStyle(this, 0).width); + var multiplier = (width - thumb.width) / range; + if (!multiplier) + return; + // distance between click and center of thumb + var dev = e.clientX - this.getBoundingClientRect().left - thumb.width / 2 - + (value - min) * multiplier; + // if click was not on thumb, move thumb to click location + if (Math.abs(dev) > thumb.radius) { + isChanged = true; + this.value -= -dev / multiplier; + } + rawValue = value; + prevX = e.clientX; + this.addEventListener('mousemove', onDrag, true); + this.addEventListener('mouseup', onDragEnd, true); + } + + function onDrag(e) { + var width = parseFloat(getComputedStyle(this, 0).width); + var multiplier = (width - thumb.width) / range; + if (!multiplier) + return; + rawValue += (e.clientX - prevX) / multiplier; + prevX = e.clientX; + isChanged = true; + this.value = rawValue; + } + + function onDragEnd() { + this.removeEventListener('mousemove', onDrag, true); + this.removeEventListener('mouseup', onDragEnd, true); + } + + function onKeyDown(e) { + if (e.keyCode > 36 && e.keyCode < 41) { // 37-40: left, up, right, down + onFocus.call(this); + isChanged = true; + this.value = value + (e.keyCode == 38 || e.keyCode == 39 ? step : -step); + } + } + + function onFocus() { + if (!isClick) + this.style.boxShadow = !isMac ? '0 0 0 2px #fb0' : + '0 0 2px 1px -moz-mac-focusring, inset 0 0 1px -moz-mac-focusring'; + } + + function onBlur() { + this.style.boxShadow = ''; + } + + // determines whether value is valid number in attribute form + function isAttrNum(value) { + return !isNaN(value) && +value == parseFloat(value); + } + + // validates min, max, and step attributes and redraws + function update() { + min = isAttrNum(slider.min) ? +slider.min : 0; + max = isAttrNum(slider.max) ? +slider.max : 100; + if (max < min) + max = min > 100 ? min : 100; + step = isAttrNum(slider.step) && slider.step > 0 ? +slider.step : 1; + range = max - min; + draw(true); + } + + // recalculates value property + function calc() { + if (!isValueSet && !areAttrsSet) + value = slider.getAttribute('value'); + if (!isAttrNum(value)) + value = (min + max) / 2;; + // snap to step intervals (WebKit sometimes does not - bug?) + value = Math.round((value - min) / step) * step + min; + if (value < min) + value = min; + else if (value > max) + value = min + ~~(range / step) * step; + } + + // renders slider using CSS background ;) + function draw(attrsModified) { + calc(); + if (isChanged && value != prevValue) + slider.dispatchEvent(onChange); + isChanged = false; + if (!attrsModified && value == prevValue) + return; + prevValue = value; + var position = range ? (value - min) / range * 100 : 0; + var bg = '-moz-element(#__sliderthumb__) ' + position + '% no-repeat, '; + style(slider, { background: bg + track }); + } + +} + +function style(element, styles) { + for (var prop in styles) + element.style.setProperty(prop, styles[prop], 'important'); +} + +})(); diff --git a/assets/css-social-buttons/site/pictos-web.eot b/assets/css-social-buttons/site/pictos-web.eot new file mode 100644 index 00000000..f34d23f5 Binary files /dev/null and b/assets/css-social-buttons/site/pictos-web.eot differ diff --git a/assets/css-social-buttons/site/pictos-web.svg b/assets/css-social-buttons/site/pictos-web.svg new file mode 100644 index 00000000..2d168314 --- /dev/null +++ b/assets/css-social-buttons/site/pictos-web.svg @@ -0,0 +1,114 @@ + + + + +This is a custom SVG webfont generated by Font Squirrel. +Designer : Drew Wilson +Foundry : Drew Wilson +Foundry URL : httppictosdrewwilsoncom + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/assets/css-social-buttons/site/pictos-web.ttf b/assets/css-social-buttons/site/pictos-web.ttf new file mode 100644 index 00000000..3ad12d5e Binary files /dev/null and b/assets/css-social-buttons/site/pictos-web.ttf differ diff --git a/assets/css-social-buttons/site/pictos-web.woff b/assets/css-social-buttons/site/pictos-web.woff new file mode 100644 index 00000000..90e53628 Binary files /dev/null and b/assets/css-social-buttons/site/pictos-web.woff differ diff --git a/assets/css-social-buttons/site/size-change.js b/assets/css-social-buttons/site/size-change.js new file mode 100644 index 00000000..ef808807 --- /dev/null +++ b/assets/css-social-buttons/site/size-change.js @@ -0,0 +1,46 @@ +(function($) { + $(function() { + var demo = $('#demo'); + var sizeInput = demo.find('input[type="range"]'); + var textInput = demo.find('input[type="text"]'); + var iconToggle = demo.find('input[type="radio"]'); + + sizeInput.change(function() { + var val = $(this).val() + "px"; + demo.find('.zocial').css('font-size', val); + demo.find('#font-size-display').text(val); + }) + textInput.keyup(function() { + var newlabel = $(this).val(); + demo.find('.zocial').text(newlabel); + }) + textInput.blur(function() { + if ($(this).val().length<1) demo.find('.zocial').text("Sign in with Google+"); + }) + iconToggle.click(function() { + if ($(this).attr('id') == "select-icon") demo.find('.zocial').addClass('icon'); + else demo.find('.zocial').removeClass('icon'); + }) + + $(document).ready(function() { + $('#button-lightbox a').click(function() { + _gaq.push(['_trackPageview', '/hide/button_preview']); + }) + }) + $('#button-sample').click(function() { + _gaq.push(['_trackPageview', '/view/button_preview']); + }) + $('#show-examples').click(function() { + _gaq.push(['_trackPageview', '/view/code_example']); + $('#howto').removeClass('compact'); + $(this).remove(); + return false; + }) + demo.click(function() { + _gaq.push(['_trackPageview', '/view/demo']); + }) + $('#purchase-area a').click(function() { + _gaq.push(['_trackPageview', '/click/' + $(this).attr('id')]); + }); + }) +})(jQuery) \ No newline at end of file diff --git a/assets/css-social-buttons/site/white-radial-gradient.png b/assets/css-social-buttons/site/white-radial-gradient.png new file mode 100644 index 00000000..c3537eb6 Binary files /dev/null and b/assets/css-social-buttons/site/white-radial-gradient.png differ diff --git a/assets/expect/.bower.json b/assets/expect/.bower.json new file mode 100644 index 00000000..b9752d99 --- /dev/null +++ b/assets/expect/.bower.json @@ -0,0 +1,15 @@ +{ + "name": "expect", + "homepage": "https://github.com/LearnBoost/expect.js", + "version": "0.3.1", + "_release": "0.3.1", + "_resolution": { + "type": "version", + "tag": "0.3.1", + "commit": "68ce6a98a5008ec0a11298e026ee00ad0142f118" + }, + "_source": "git://github.com/LearnBoost/expect.js.git", + "_target": "~0.3.1", + "_originalSource": "expect", + "_direct": true +} \ No newline at end of file diff --git a/assets/expect/.gitignore b/assets/expect/.gitignore new file mode 100644 index 00000000..fd4f2b06 --- /dev/null +++ b/assets/expect/.gitignore @@ -0,0 +1,2 @@ +node_modules +.DS_Store diff --git a/assets/expect/.npmignore b/assets/expect/.npmignore new file mode 100644 index 00000000..26ef5d8d --- /dev/null +++ b/assets/expect/.npmignore @@ -0,0 +1,3 @@ +support +test +Makefile diff --git a/assets/expect/History.md b/assets/expect/History.md new file mode 100644 index 00000000..e03f91ff --- /dev/null +++ b/assets/expect/History.md @@ -0,0 +1,54 @@ + +0.3.0 / 2014-02-20 +================== + + * renmaed to `index.js` + * added repository to package.json + * remove unused variable and merge + * simpify isDate() and remove unnecessary semicolon. + * Add .withArgs() syntax for building scenario + * eql(): fix wrong order of actual vs. expected. + * Added formatting for Error objects + * Add support for 'regexp' type and eql comparison of regular expressions. + * Better to follow the same coding style + * Use 'showDiff' flag + * Add 'actual' & 'expected' property to the thrown error + * Pass .fail() unit test + * Ignore 'script*' global leak in chrome + * Exposed object stringification function + * Use isRegExp in Assertion::throwException. Fix #25 + * Cleaned up local variables + +0.2.0 / 2012-10-19 +================== + + * fix isRegExp bug in some edge cases + * add closure to all assertion messages deferring costly inspects + until there is actually a failure + * fix `make test` for recent mochas + * add inspect() case for DOM elements + * relax failure msg null check + * add explicit failure through `expect().fail()` + * clarified all `empty` functionality in README example + * added docs for throwException fn/regexp signatures + +0.1.2 / 2012-02-04 +================== + + * Added regexp matching support for exceptions. + * Added support for throwException callback. + * Added `throwError` synonym to `throwException`. + * Added object support for `.empty`. + * Fixed `.a('object')` with nulls, and english error in error message. + * Fix bug `indexOf` (IE). [hokaccha] + * Fixed object property checking with `undefined` as value. [vovik] + +0.1.1 / 2011-12-18 +================== + + * Fixed typo + +0.1.0 / 2011-12-18 +================== + + * Initial import diff --git a/assets/expect/Makefile b/assets/expect/Makefile new file mode 100644 index 00000000..fa831713 --- /dev/null +++ b/assets/expect/Makefile @@ -0,0 +1,14 @@ + +REPORTER = dot + +test: + @./node_modules/.bin/mocha \ + --require ./test/common \ + --reporter $(REPORTER) \ + --growl \ + test/expect.js + +test-browser: + @./node_modules/.bin/serve . + +.PHONY: test diff --git a/assets/expect/README.md b/assets/expect/README.md new file mode 100644 index 00000000..2683ed34 --- /dev/null +++ b/assets/expect/README.md @@ -0,0 +1,263 @@ +# Expect + +Minimalistic BDD assertion toolkit based on +[should.js](http://github.com/visionmedia/should.js) + +```js +expect(window.r).to.be(undefined); +expect({ a: 'b' }).to.eql({ a: 'b' }) +expect(5).to.be.a('number'); +expect([]).to.be.an('array'); +expect(window).not.to.be.an(Image); +``` + +## Features + +- Cross-browser: works on IE6+, Firefox, Safari, Chrome, Opera. +- Compatible with all test frameworks. +- Node.JS ready (`require('expect.js')`). +- Standalone. Single global with no prototype extensions or shims. + +## How to use + +### Node + +Install it with NPM or add it to your `package.json`: + +``` +$ npm install expect.js +``` + +Then: + +```js +var expect = require('expect.js'); +``` + +### Browser + +Expose the `expect.js` found at the top level of this repository. + +```html + +``` + +## API + +**ok**: asserts that the value is _truthy_ or not + +```js +expect(1).to.be.ok(); +expect(true).to.be.ok(); +expect({}).to.be.ok(); +expect(0).to.not.be.ok(); +``` + +**be** / **equal**: asserts `===` equality + +```js +expect(1).to.be(1) +expect(NaN).not.to.equal(NaN); +expect(1).not.to.be(true) +expect('1').to.not.be(1); +``` + +**eql**: asserts loose equality that works with objects + +```js +expect({ a: 'b' }).to.eql({ a: 'b' }); +expect(1).to.eql('1'); +``` + +**a**/**an**: asserts `typeof` with support for `array` type and `instanceof` + +```js +// typeof with optional `array` +expect(5).to.be.a('number'); +expect([]).to.be.an('array'); // works +expect([]).to.be.an('object'); // works too, since it uses `typeof` + +// constructors +expect(5).to.be.a(Number); +expect([]).to.be.an(Array); +expect(tobi).to.be.a(Ferret); +expect(person).to.be.a(Mammal); +``` + +**match**: asserts `String` regular expression match + +```js +expect(program.version).to.match(/[0-9]+\.[0-9]+\.[0-9]+/); +``` + +**contain**: asserts indexOf for an array or string + +```js +expect([1, 2]).to.contain(1); +expect('hello world').to.contain('world'); +``` + +**length**: asserts array `.length` + +```js +expect([]).to.have.length(0); +expect([1,2,3]).to.have.length(3); +``` + +**empty**: asserts that an array is empty or not + +```js +expect([]).to.be.empty(); +expect({}).to.be.empty(); +expect({ length: 0, duck: 'typing' }).to.be.empty(); +expect({ my: 'object' }).to.not.be.empty(); +expect([1,2,3]).to.not.be.empty(); +``` + +**property**: asserts presence of an own property (and value optionally) + +```js +expect(window).to.have.property('expect') +expect(window).to.have.property('expect', expect) +expect({a: 'b'}).to.have.property('a'); +``` + +**key**/**keys**: asserts the presence of a key. Supports the `only` modifier + +```js +expect({ a: 'b' }).to.have.key('a'); +expect({ a: 'b', c: 'd' }).to.only.have.keys('a', 'c'); +expect({ a: 'b', c: 'd' }).to.only.have.keys(['a', 'c']); +expect({ a: 'b', c: 'd' }).to.not.only.have.key('a'); +``` + +**throwException**/**throwError**: asserts that the `Function` throws or not when called + +```js +expect(fn).to.throwError(); // synonym of throwException +expect(fn).to.throwException(function (e) { // get the exception object + expect(e).to.be.a(SyntaxError); +}); +expect(fn).to.throwException(/matches the exception message/); +expect(fn2).to.not.throwException(); +``` + +**withArgs**: creates anonymous function to call fn with arguments + +```js +expect(fn).withArgs(invalid, arg).to.throwException(); +expect(fn).withArgs(valid, arg).to.not.throwException(); +``` + +**within**: asserts a number within a range + +```js +expect(1).to.be.within(0, Infinity); +``` + +**greaterThan**/**above**: asserts `>` + +```js +expect(3).to.be.above(0); +expect(5).to.be.greaterThan(3); +``` + +**lessThan**/**below**: asserts `<` + +```js +expect(0).to.be.below(3); +expect(1).to.be.lessThan(3); +``` + +**fail**: explicitly forces failure. + +```js +expect().fail() +expect().fail("Custom failure message") +``` + +## Using with a test framework + +For example, if you create a test suite with +[mocha](http://github.com/visionmedia/mocha). + +Let's say we wanted to test the following program: + +**math.js** + +```js +function add (a, b) { return a + b; }; +``` + +Our test file would look like this: + +```js +describe('test suite', function () { + it('should expose a function', function () { + expect(add).to.be.a('function'); + }); + + it('should do math', function () { + expect(add(1, 3)).to.equal(4); + }); +}); +``` + +If a certain expectation fails, an exception will be raised which gets captured +and shown/processed by the test runner. + +## Differences with should.js + +- No need for static `should` methods like `should.strictEqual`. For example, + `expect(obj).to.be(undefined)` works well. +- Some API simplifications / changes. +- API changes related to browser compatibility. + +## Running tests + +Clone the repository and install the developer dependencies: + +``` +git clone git://github.com/LearnBoost/expect.js.git expect +cd expect && npm install +``` + +### Node + +`make test` + +### Browser + +`make test-browser` + +and point your browser(s) to `http://localhost:3000/test/` + +## Credits + +(The MIT License) + +Copyright (c) 2011 Guillermo Rauch <guillermo@learnboost.com> + +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 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. + +### 3rd-party + +Heavily borrows from [should.js](http://github.com/visionmedia/should.js) by TJ +Holowaychuck - MIT. diff --git a/assets/expect/index.js b/assets/expect/index.js new file mode 100644 index 00000000..b1e921dd --- /dev/null +++ b/assets/expect/index.js @@ -0,0 +1,1284 @@ +(function (global, module) { + + var exports = module.exports; + + /** + * Exports. + */ + + module.exports = expect; + expect.Assertion = Assertion; + + /** + * Exports version. + */ + + expect.version = '0.3.1'; + + /** + * Possible assertion flags. + */ + + var flags = { + not: ['to', 'be', 'have', 'include', 'only'] + , to: ['be', 'have', 'include', 'only', 'not'] + , only: ['have'] + , have: ['own'] + , be: ['an'] + }; + + function expect (obj) { + return new Assertion(obj); + } + + /** + * Constructor + * + * @api private + */ + + function Assertion (obj, flag, parent) { + this.obj = obj; + this.flags = {}; + + if (undefined != parent) { + this.flags[flag] = true; + + for (var i in parent.flags) { + if (parent.flags.hasOwnProperty(i)) { + this.flags[i] = true; + } + } + } + + var $flags = flag ? flags[flag] : keys(flags) + , self = this; + + if ($flags) { + for (var i = 0, l = $flags.length; i < l; i++) { + // avoid recursion + if (this.flags[$flags[i]]) continue; + + var name = $flags[i] + , assertion = new Assertion(this.obj, name, this) + + if ('function' == typeof Assertion.prototype[name]) { + // clone the function, make sure we dont touch the prot reference + var old = this[name]; + this[name] = function () { + return old.apply(self, arguments); + }; + + for (var fn in Assertion.prototype) { + if (Assertion.prototype.hasOwnProperty(fn) && fn != name) { + this[name][fn] = bind(assertion[fn], assertion); + } + } + } else { + this[name] = assertion; + } + } + } + } + + /** + * Performs an assertion + * + * @api private + */ + + Assertion.prototype.assert = function (truth, msg, error, expected) { + var msg = this.flags.not ? error : msg + , ok = this.flags.not ? !truth : truth + , err; + + if (!ok) { + err = new Error(msg.call(this)); + if (arguments.length > 3) { + err.actual = this.obj; + err.expected = expected; + err.showDiff = true; + } + throw err; + } + + this.and = new Assertion(this.obj); + }; + + /** + * Check if the value is truthy + * + * @api public + */ + + Assertion.prototype.ok = function () { + this.assert( + !!this.obj + , function(){ return 'expected ' + i(this.obj) + ' to be truthy' } + , function(){ return 'expected ' + i(this.obj) + ' to be falsy' }); + }; + + /** + * Creates an anonymous function which calls fn with arguments. + * + * @api public + */ + + Assertion.prototype.withArgs = function() { + expect(this.obj).to.be.a('function'); + var fn = this.obj; + var args = Array.prototype.slice.call(arguments); + return expect(function() { fn.apply(null, args); }); + }; + + /** + * Assert that the function throws. + * + * @param {Function|RegExp} callback, or regexp to match error string against + * @api public + */ + + Assertion.prototype.throwError = + Assertion.prototype.throwException = function (fn) { + expect(this.obj).to.be.a('function'); + + var thrown = false + , not = this.flags.not; + + try { + this.obj(); + } catch (e) { + if (isRegExp(fn)) { + var subject = 'string' == typeof e ? e : e.message; + if (not) { + expect(subject).to.not.match(fn); + } else { + expect(subject).to.match(fn); + } + } else if ('function' == typeof fn) { + fn(e); + } + thrown = true; + } + + if (isRegExp(fn) && not) { + // in the presence of a matcher, ensure the `not` only applies to + // the matching. + this.flags.not = false; + } + + var name = this.obj.name || 'fn'; + this.assert( + thrown + , function(){ return 'expected ' + name + ' to throw an exception' } + , function(){ return 'expected ' + name + ' not to throw an exception' }); + }; + + /** + * Checks if the array is empty. + * + * @api public + */ + + Assertion.prototype.empty = function () { + var expectation; + + if ('object' == typeof this.obj && null !== this.obj && !isArray(this.obj)) { + if ('number' == typeof this.obj.length) { + expectation = !this.obj.length; + } else { + expectation = !keys(this.obj).length; + } + } else { + if ('string' != typeof this.obj) { + expect(this.obj).to.be.an('object'); + } + + expect(this.obj).to.have.property('length'); + expectation = !this.obj.length; + } + + this.assert( + expectation + , function(){ return 'expected ' + i(this.obj) + ' to be empty' } + , function(){ return 'expected ' + i(this.obj) + ' to not be empty' }); + return this; + }; + + /** + * Checks if the obj exactly equals another. + * + * @api public + */ + + Assertion.prototype.be = + Assertion.prototype.equal = function (obj) { + this.assert( + obj === this.obj + , function(){ return 'expected ' + i(this.obj) + ' to equal ' + i(obj) } + , function(){ return 'expected ' + i(this.obj) + ' to not equal ' + i(obj) }); + return this; + }; + + /** + * Checks if the obj sortof equals another. + * + * @api public + */ + + Assertion.prototype.eql = function (obj) { + this.assert( + expect.eql(this.obj, obj) + , function(){ return 'expected ' + i(this.obj) + ' to sort of equal ' + i(obj) } + , function(){ return 'expected ' + i(this.obj) + ' to sort of not equal ' + i(obj) } + , obj); + return this; + }; + + /** + * Assert within start to finish (inclusive). + * + * @param {Number} start + * @param {Number} finish + * @api public + */ + + Assertion.prototype.within = function (start, finish) { + var range = start + '..' + finish; + this.assert( + this.obj >= start && this.obj <= finish + , function(){ return 'expected ' + i(this.obj) + ' to be within ' + range } + , function(){ return 'expected ' + i(this.obj) + ' to not be within ' + range }); + return this; + }; + + /** + * Assert typeof / instance of + * + * @api public + */ + + Assertion.prototype.a = + Assertion.prototype.an = function (type) { + if ('string' == typeof type) { + // proper english in error msg + var n = /^[aeiou]/.test(type) ? 'n' : ''; + + // typeof with support for 'array' + this.assert( + 'array' == type ? isArray(this.obj) : + 'regexp' == type ? isRegExp(this.obj) : + 'object' == type + ? 'object' == typeof this.obj && null !== this.obj + : type == typeof this.obj + , function(){ return 'expected ' + i(this.obj) + ' to be a' + n + ' ' + type } + , function(){ return 'expected ' + i(this.obj) + ' not to be a' + n + ' ' + type }); + } else { + // instanceof + var name = type.name || 'supplied constructor'; + this.assert( + this.obj instanceof type + , function(){ return 'expected ' + i(this.obj) + ' to be an instance of ' + name } + , function(){ return 'expected ' + i(this.obj) + ' not to be an instance of ' + name }); + } + + return this; + }; + + /** + * Assert numeric value above _n_. + * + * @param {Number} n + * @api public + */ + + Assertion.prototype.greaterThan = + Assertion.prototype.above = function (n) { + this.assert( + this.obj > n + , function(){ return 'expected ' + i(this.obj) + ' to be above ' + n } + , function(){ return 'expected ' + i(this.obj) + ' to be below ' + n }); + return this; + }; + + /** + * Assert numeric value below _n_. + * + * @param {Number} n + * @api public + */ + + Assertion.prototype.lessThan = + Assertion.prototype.below = function (n) { + this.assert( + this.obj < n + , function(){ return 'expected ' + i(this.obj) + ' to be below ' + n } + , function(){ return 'expected ' + i(this.obj) + ' to be above ' + n }); + return this; + }; + + /** + * Assert string value matches _regexp_. + * + * @param {RegExp} regexp + * @api public + */ + + Assertion.prototype.match = function (regexp) { + this.assert( + regexp.exec(this.obj) + , function(){ return 'expected ' + i(this.obj) + ' to match ' + regexp } + , function(){ return 'expected ' + i(this.obj) + ' not to match ' + regexp }); + return this; + }; + + /** + * Assert property "length" exists and has value of _n_. + * + * @param {Number} n + * @api public + */ + + Assertion.prototype.length = function (n) { + expect(this.obj).to.have.property('length'); + var len = this.obj.length; + this.assert( + n == len + , function(){ return 'expected ' + i(this.obj) + ' to have a length of ' + n + ' but got ' + len } + , function(){ return 'expected ' + i(this.obj) + ' to not have a length of ' + len }); + return this; + }; + + /** + * Assert property _name_ exists, with optional _val_. + * + * @param {String} name + * @param {Mixed} val + * @api public + */ + + Assertion.prototype.property = function (name, val) { + if (this.flags.own) { + this.assert( + Object.prototype.hasOwnProperty.call(this.obj, name) + , function(){ return 'expected ' + i(this.obj) + ' to have own property ' + i(name) } + , function(){ return 'expected ' + i(this.obj) + ' to not have own property ' + i(name) }); + return this; + } + + if (this.flags.not && undefined !== val) { + if (undefined === this.obj[name]) { + throw new Error(i(this.obj) + ' has no property ' + i(name)); + } + } else { + var hasProp; + try { + hasProp = name in this.obj + } catch (e) { + hasProp = undefined !== this.obj[name] + } + + this.assert( + hasProp + , function(){ return 'expected ' + i(this.obj) + ' to have a property ' + i(name) } + , function(){ return 'expected ' + i(this.obj) + ' to not have a property ' + i(name) }); + } + + if (undefined !== val) { + this.assert( + val === this.obj[name] + , function(){ return 'expected ' + i(this.obj) + ' to have a property ' + i(name) + + ' of ' + i(val) + ', but got ' + i(this.obj[name]) } + , function(){ return 'expected ' + i(this.obj) + ' to not have a property ' + i(name) + + ' of ' + i(val) }); + } + + this.obj = this.obj[name]; + return this; + }; + + /** + * Assert that the array contains _obj_ or string contains _obj_. + * + * @param {Mixed} obj|string + * @api public + */ + + Assertion.prototype.string = + Assertion.prototype.contain = function (obj) { + if ('string' == typeof this.obj) { + this.assert( + ~this.obj.indexOf(obj) + , function(){ return 'expected ' + i(this.obj) + ' to contain ' + i(obj) } + , function(){ return 'expected ' + i(this.obj) + ' to not contain ' + i(obj) }); + } else { + this.assert( + ~indexOf(this.obj, obj) + , function(){ return 'expected ' + i(this.obj) + ' to contain ' + i(obj) } + , function(){ return 'expected ' + i(this.obj) + ' to not contain ' + i(obj) }); + } + return this; + }; + + /** + * Assert exact keys or inclusion of keys by using + * the `.own` modifier. + * + * @param {Array|String ...} keys + * @api public + */ + + Assertion.prototype.key = + Assertion.prototype.keys = function ($keys) { + var str + , ok = true; + + $keys = isArray($keys) + ? $keys + : Array.prototype.slice.call(arguments); + + if (!$keys.length) throw new Error('keys required'); + + var actual = keys(this.obj) + , len = $keys.length; + + // Inclusion + ok = every($keys, function (key) { + return ~indexOf(actual, key); + }); + + // Strict + if (!this.flags.not && this.flags.only) { + ok = ok && $keys.length == actual.length; + } + + // Key string + if (len > 1) { + $keys = map($keys, function (key) { + return i(key); + }); + var last = $keys.pop(); + str = $keys.join(', ') + ', and ' + last; + } else { + str = i($keys[0]); + } + + // Form + str = (len > 1 ? 'keys ' : 'key ') + str; + + // Have / include + str = (!this.flags.only ? 'include ' : 'only have ') + str; + + // Assertion + this.assert( + ok + , function(){ return 'expected ' + i(this.obj) + ' to ' + str } + , function(){ return 'expected ' + i(this.obj) + ' to not ' + str }); + + return this; + }; + + /** + * Assert a failure. + * + * @param {String ...} custom message + * @api public + */ + Assertion.prototype.fail = function (msg) { + var error = function() { return msg || "explicit failure"; } + this.assert(false, error, error); + return this; + }; + + /** + * Function bind implementation. + */ + + function bind (fn, scope) { + return function () { + return fn.apply(scope, arguments); + } + } + + /** + * Array every compatibility + * + * @see bit.ly/5Fq1N2 + * @api public + */ + + function every (arr, fn, thisObj) { + var scope = thisObj || global; + for (var i = 0, j = arr.length; i < j; ++i) { + if (!fn.call(scope, arr[i], i, arr)) { + return false; + } + } + return true; + } + + /** + * Array indexOf compatibility. + * + * @see bit.ly/a5Dxa2 + * @api public + */ + + function indexOf (arr, o, i) { + if (Array.prototype.indexOf) { + return Array.prototype.indexOf.call(arr, o, i); + } + + if (arr.length === undefined) { + return -1; + } + + for (var j = arr.length, i = i < 0 ? i + j < 0 ? 0 : i + j : i || 0 + ; i < j && arr[i] !== o; i++); + + return j <= i ? -1 : i; + } + + // https://gist.github.com/1044128/ + var getOuterHTML = function(element) { + if ('outerHTML' in element) return element.outerHTML; + var ns = "http://www.w3.org/1999/xhtml"; + var container = document.createElementNS(ns, '_'); + var xmlSerializer = new XMLSerializer(); + var html; + if (document.xmlVersion) { + return xmlSerializer.serializeToString(element); + } else { + container.appendChild(element.cloneNode(false)); + html = container.innerHTML.replace('><', '>' + element.innerHTML + '<'); + container.innerHTML = ''; + return html; + } + }; + + // Returns true if object is a DOM element. + var isDOMElement = function (object) { + if (typeof HTMLElement === 'object') { + return object instanceof HTMLElement; + } else { + return object && + typeof object === 'object' && + object.nodeType === 1 && + typeof object.nodeName === 'string'; + } + }; + + /** + * Inspects an object. + * + * @see taken from node.js `util` module (copyright Joyent, MIT license) + * @api private + */ + + function i (obj, showHidden, depth) { + var seen = []; + + function stylize (str) { + return str; + } + + function format (value, recurseTimes) { + // Provide a hook for user-specified inspect functions. + // Check that value is an object with an inspect function on it + if (value && typeof value.inspect === 'function' && + // Filter out the util module, it's inspect function is special + value !== exports && + // Also filter out any prototype objects using the circular check. + !(value.constructor && value.constructor.prototype === value)) { + return value.inspect(recurseTimes); + } + + // Primitive types cannot have properties + switch (typeof value) { + case 'undefined': + return stylize('undefined', 'undefined'); + + case 'string': + var simple = '\'' + json.stringify(value).replace(/^"|"$/g, '') + .replace(/'/g, "\\'") + .replace(/\\"/g, '"') + '\''; + return stylize(simple, 'string'); + + case 'number': + return stylize('' + value, 'number'); + + case 'boolean': + return stylize('' + value, 'boolean'); + } + // For some reason typeof null is "object", so special case here. + if (value === null) { + return stylize('null', 'null'); + } + + if (isDOMElement(value)) { + return getOuterHTML(value); + } + + // Look up the keys of the object. + var visible_keys = keys(value); + var $keys = showHidden ? Object.getOwnPropertyNames(value) : visible_keys; + + // Functions without properties can be shortcutted. + if (typeof value === 'function' && $keys.length === 0) { + if (isRegExp(value)) { + return stylize('' + value, 'regexp'); + } else { + var name = value.name ? ': ' + value.name : ''; + return stylize('[Function' + name + ']', 'special'); + } + } + + // Dates without properties can be shortcutted + if (isDate(value) && $keys.length === 0) { + return stylize(value.toUTCString(), 'date'); + } + + // Error objects can be shortcutted + if (value instanceof Error) { + return stylize("["+value.toString()+"]", 'Error'); + } + + var base, type, braces; + // Determine the object type + if (isArray(value)) { + type = 'Array'; + braces = ['[', ']']; + } else { + type = 'Object'; + braces = ['{', '}']; + } + + // Make functions say that they are functions + if (typeof value === 'function') { + var n = value.name ? ': ' + value.name : ''; + base = (isRegExp(value)) ? ' ' + value : ' [Function' + n + ']'; + } else { + base = ''; + } + + // Make dates with properties first say the date + if (isDate(value)) { + base = ' ' + value.toUTCString(); + } + + if ($keys.length === 0) { + return braces[0] + base + braces[1]; + } + + if (recurseTimes < 0) { + if (isRegExp(value)) { + return stylize('' + value, 'regexp'); + } else { + return stylize('[Object]', 'special'); + } + } + + seen.push(value); + + var output = map($keys, function (key) { + var name, str; + if (value.__lookupGetter__) { + if (value.__lookupGetter__(key)) { + if (value.__lookupSetter__(key)) { + str = stylize('[Getter/Setter]', 'special'); + } else { + str = stylize('[Getter]', 'special'); + } + } else { + if (value.__lookupSetter__(key)) { + str = stylize('[Setter]', 'special'); + } + } + } + if (indexOf(visible_keys, key) < 0) { + name = '[' + key + ']'; + } + if (!str) { + if (indexOf(seen, value[key]) < 0) { + if (recurseTimes === null) { + str = format(value[key]); + } else { + str = format(value[key], recurseTimes - 1); + } + if (str.indexOf('\n') > -1) { + if (isArray(value)) { + str = map(str.split('\n'), function (line) { + return ' ' + line; + }).join('\n').substr(2); + } else { + str = '\n' + map(str.split('\n'), function (line) { + return ' ' + line; + }).join('\n'); + } + } + } else { + str = stylize('[Circular]', 'special'); + } + } + if (typeof name === 'undefined') { + if (type === 'Array' && key.match(/^\d+$/)) { + return str; + } + name = json.stringify('' + key); + if (name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)) { + name = name.substr(1, name.length - 2); + name = stylize(name, 'name'); + } else { + name = name.replace(/'/g, "\\'") + .replace(/\\"/g, '"') + .replace(/(^"|"$)/g, "'"); + name = stylize(name, 'string'); + } + } + + return name + ': ' + str; + }); + + seen.pop(); + + var numLinesEst = 0; + var length = reduce(output, function (prev, cur) { + numLinesEst++; + if (indexOf(cur, '\n') >= 0) numLinesEst++; + return prev + cur.length + 1; + }, 0); + + if (length > 50) { + output = braces[0] + + (base === '' ? '' : base + '\n ') + + ' ' + + output.join(',\n ') + + ' ' + + braces[1]; + + } else { + output = braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1]; + } + + return output; + } + return format(obj, (typeof depth === 'undefined' ? 2 : depth)); + } + + expect.stringify = i; + + function isArray (ar) { + return Object.prototype.toString.call(ar) === '[object Array]'; + } + + function isRegExp(re) { + var s; + try { + s = '' + re; + } catch (e) { + return false; + } + + return re instanceof RegExp || // easy case + // duck-type for context-switching evalcx case + typeof(re) === 'function' && + re.constructor.name === 'RegExp' && + re.compile && + re.test && + re.exec && + s.match(/^\/.*\/[gim]{0,3}$/); + } + + function isDate(d) { + return d instanceof Date; + } + + function keys (obj) { + if (Object.keys) { + return Object.keys(obj); + } + + var keys = []; + + for (var i in obj) { + if (Object.prototype.hasOwnProperty.call(obj, i)) { + keys.push(i); + } + } + + return keys; + } + + function map (arr, mapper, that) { + if (Array.prototype.map) { + return Array.prototype.map.call(arr, mapper, that); + } + + var other= new Array(arr.length); + + for (var i= 0, n = arr.length; i= 2) { + var rv = arguments[1]; + } else { + do { + if (i in this) { + rv = this[i++]; + break; + } + + // if array contains no values, no initial value to return + if (++i >= len) + throw new TypeError(); + } while (true); + } + + for (; i < len; i++) { + if (i in this) + rv = fun.call(null, rv, this[i], i, this); + } + + return rv; + } + + /** + * Asserts deep equality + * + * @see taken from node.js `assert` module (copyright Joyent, MIT license) + * @api private + */ + + expect.eql = function eql(actual, expected) { + // 7.1. All identical values are equivalent, as determined by ===. + if (actual === expected) { + return true; + } else if ('undefined' != typeof Buffer + && Buffer.isBuffer(actual) && Buffer.isBuffer(expected)) { + if (actual.length != expected.length) return false; + + for (var i = 0; i < actual.length; i++) { + if (actual[i] !== expected[i]) return false; + } + + return true; + + // 7.2. If the expected value is a Date object, the actual value is + // equivalent if it is also a Date object that refers to the same time. + } else if (actual instanceof Date && expected instanceof Date) { + return actual.getTime() === expected.getTime(); + + // 7.3. Other pairs that do not both pass typeof value == "object", + // equivalence is determined by ==. + } else if (typeof actual != 'object' && typeof expected != 'object') { + return actual == expected; + // If both are regular expression use the special `regExpEquiv` method + // to determine equivalence. + } else if (isRegExp(actual) && isRegExp(expected)) { + return regExpEquiv(actual, expected); + // 7.4. For all other Object pairs, including Array objects, equivalence is + // determined by having the same number of owned properties (as verified + // with Object.prototype.hasOwnProperty.call), the same set of keys + // (although not necessarily the same order), equivalent values for every + // corresponding key, and an identical "prototype" property. Note: this + // accounts for both named and indexed properties on Arrays. + } else { + return objEquiv(actual, expected); + } + }; + + function isUndefinedOrNull (value) { + return value === null || value === undefined; + } + + function isArguments (object) { + return Object.prototype.toString.call(object) == '[object Arguments]'; + } + + function regExpEquiv (a, b) { + return a.source === b.source && a.global === b.global && + a.ignoreCase === b.ignoreCase && a.multiline === b.multiline; + } + + function objEquiv (a, b) { + if (isUndefinedOrNull(a) || isUndefinedOrNull(b)) + return false; + // an identical "prototype" property. + if (a.prototype !== b.prototype) return false; + //~~~I've managed to break Object.keys through screwy arguments passing. + // Converting to array solves the problem. + if (isArguments(a)) { + if (!isArguments(b)) { + return false; + } + a = pSlice.call(a); + b = pSlice.call(b); + return expect.eql(a, b); + } + try{ + var ka = keys(a), + kb = keys(b), + key, i; + } catch (e) {//happens when one is a string literal and the other isn't + return false; + } + // having the same number of owned properties (keys incorporates hasOwnProperty) + if (ka.length != kb.length) + return false; + //the same set of keys (although not necessarily the same order), + ka.sort(); + kb.sort(); + //~~~cheap key test + for (i = ka.length - 1; i >= 0; i--) { + if (ka[i] != kb[i]) + return false; + } + //equivalent values for every corresponding key, and + //~~~possibly expensive deep test + for (i = ka.length - 1; i >= 0; i--) { + key = ka[i]; + if (!expect.eql(a[key], b[key])) + return false; + } + return true; + } + + var json = (function () { + "use strict"; + + if ('object' == typeof JSON && JSON.parse && JSON.stringify) { + return { + parse: nativeJSON.parse + , stringify: nativeJSON.stringify + } + } + + var JSON = {}; + + function f(n) { + // Format integers to have at least two digits. + return n < 10 ? '0' + n : n; + } + + function date(d, key) { + return isFinite(d.valueOf()) ? + d.getUTCFullYear() + '-' + + f(d.getUTCMonth() + 1) + '-' + + f(d.getUTCDate()) + 'T' + + f(d.getUTCHours()) + ':' + + f(d.getUTCMinutes()) + ':' + + f(d.getUTCSeconds()) + 'Z' : null; + } + + var cx = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g, + escapable = /[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g, + gap, + indent, + meta = { // table of character substitutions + '\b': '\\b', + '\t': '\\t', + '\n': '\\n', + '\f': '\\f', + '\r': '\\r', + '"' : '\\"', + '\\': '\\\\' + }, + rep; + + + function quote(string) { + + // If the string contains no control characters, no quote characters, and no + // backslash characters, then we can safely slap some quotes around it. + // Otherwise we must also replace the offending characters with safe escape + // sequences. + + escapable.lastIndex = 0; + return escapable.test(string) ? '"' + string.replace(escapable, function (a) { + var c = meta[a]; + return typeof c === 'string' ? c : + '\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice(-4); + }) + '"' : '"' + string + '"'; + } + + + function str(key, holder) { + + // Produce a string from holder[key]. + + var i, // The loop counter. + k, // The member key. + v, // The member value. + length, + mind = gap, + partial, + value = holder[key]; + + // If the value has a toJSON method, call it to obtain a replacement value. + + if (value instanceof Date) { + value = date(key); + } + + // If we were called with a replacer function, then call the replacer to + // obtain a replacement value. + + if (typeof rep === 'function') { + value = rep.call(holder, key, value); + } + + // What happens next depends on the value's type. + + switch (typeof value) { + case 'string': + return quote(value); + + case 'number': + + // JSON numbers must be finite. Encode non-finite numbers as null. + + return isFinite(value) ? String(value) : 'null'; + + case 'boolean': + case 'null': + + // If the value is a boolean or null, convert it to a string. Note: + // typeof null does not produce 'null'. The case is included here in + // the remote chance that this gets fixed someday. + + return String(value); + + // If the type is 'object', we might be dealing with an object or an array or + // null. + + case 'object': + + // Due to a specification blunder in ECMAScript, typeof null is 'object', + // so watch out for that case. + + if (!value) { + return 'null'; + } + + // Make an array to hold the partial results of stringifying this object value. + + gap += indent; + partial = []; + + // Is the value an array? + + if (Object.prototype.toString.apply(value) === '[object Array]') { + + // The value is an array. Stringify every element. Use null as a placeholder + // for non-JSON values. + + length = value.length; + for (i = 0; i < length; i += 1) { + partial[i] = str(i, value) || 'null'; + } + + // Join all of the elements together, separated with commas, and wrap them in + // brackets. + + v = partial.length === 0 ? '[]' : gap ? + '[\n' + gap + partial.join(',\n' + gap) + '\n' + mind + ']' : + '[' + partial.join(',') + ']'; + gap = mind; + return v; + } + + // If the replacer is an array, use it to select the members to be stringified. + + if (rep && typeof rep === 'object') { + length = rep.length; + for (i = 0; i < length; i += 1) { + if (typeof rep[i] === 'string') { + k = rep[i]; + v = str(k, value); + if (v) { + partial.push(quote(k) + (gap ? ': ' : ':') + v); + } + } + } + } else { + + // Otherwise, iterate through all of the keys in the object. + + for (k in value) { + if (Object.prototype.hasOwnProperty.call(value, k)) { + v = str(k, value); + if (v) { + partial.push(quote(k) + (gap ? ': ' : ':') + v); + } + } + } + } + + // Join all of the member texts together, separated with commas, + // and wrap them in braces. + + v = partial.length === 0 ? '{}' : gap ? + '{\n' + gap + partial.join(',\n' + gap) + '\n' + mind + '}' : + '{' + partial.join(',') + '}'; + gap = mind; + return v; + } + } + + // If the JSON object does not yet have a stringify method, give it one. + + JSON.stringify = function (value, replacer, space) { + + // The stringify method takes a value and an optional replacer, and an optional + // space parameter, and returns a JSON text. The replacer can be a function + // that can replace values, or an array of strings that will select the keys. + // A default replacer method can be provided. Use of the space parameter can + // produce text that is more easily readable. + + var i; + gap = ''; + indent = ''; + + // If the space parameter is a number, make an indent string containing that + // many spaces. + + if (typeof space === 'number') { + for (i = 0; i < space; i += 1) { + indent += ' '; + } + + // If the space parameter is a string, it will be used as the indent string. + + } else if (typeof space === 'string') { + indent = space; + } + + // If there is a replacer, it must be a function or an array. + // Otherwise, throw an error. + + rep = replacer; + if (replacer && typeof replacer !== 'function' && + (typeof replacer !== 'object' || + typeof replacer.length !== 'number')) { + throw new Error('JSON.stringify'); + } + + // Make a fake root object containing our value under the key of ''. + // Return the result of stringifying the value. + + return str('', {'': value}); + }; + + // If the JSON object does not yet have a parse method, give it one. + + JSON.parse = function (text, reviver) { + // The parse method takes a text and an optional reviver function, and returns + // a JavaScript value if the text is a valid JSON text. + + var j; + + function walk(holder, key) { + + // The walk method is used to recursively walk the resulting structure so + // that modifications can be made. + + var k, v, value = holder[key]; + if (value && typeof value === 'object') { + for (k in value) { + if (Object.prototype.hasOwnProperty.call(value, k)) { + v = walk(value, k); + if (v !== undefined) { + value[k] = v; + } else { + delete value[k]; + } + } + } + } + return reviver.call(holder, key, value); + } + + + // Parsing happens in four stages. In the first stage, we replace certain + // Unicode characters with escape sequences. JavaScript handles many characters + // incorrectly, either silently deleting them, or treating them as line endings. + + text = String(text); + cx.lastIndex = 0; + if (cx.test(text)) { + text = text.replace(cx, function (a) { + return '\\u' + + ('0000' + a.charCodeAt(0).toString(16)).slice(-4); + }); + } + + // In the second stage, we run the text against regular expressions that look + // for non-JSON patterns. We are especially concerned with '()' and 'new' + // because they can cause invocation, and '=' because it can cause mutation. + // But just to be safe, we want to reject all unexpected forms. + + // We split the second stage into 4 regexp operations in order to work around + // crippling inefficiencies in IE's and Safari's regexp engines. First we + // replace the JSON backslash pairs with '@' (a non-JSON character). Second, we + // replace all simple value tokens with ']' characters. Third, we delete all + // open brackets that follow a colon or comma or that begin the text. Finally, + // we look to see that the remaining characters are only whitespace or ']' or + // ',' or ':' or '{' or '}'. If that is so, then the text is safe for eval. + + if (/^[\],:{}\s]*$/ + .test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, '@') + .replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']') + .replace(/(?:^|:|,)(?:\s*\[)+/g, ''))) { + + // In the third stage we use the eval function to compile the text into a + // JavaScript structure. The '{' operator is subject to a syntactic ambiguity + // in JavaScript: it can begin a block or an object literal. We wrap the text + // in parens to eliminate the ambiguity. + + j = eval('(' + text + ')'); + + // In the optional fourth stage, we recursively walk the new structure, passing + // each name/value pair to a reviver function for possible transformation. + + return typeof reviver === 'function' ? + walk({'': j}, '') : j; + } + + // If the text is not JSON parseable, then a SyntaxError is thrown. + + throw new SyntaxError('JSON.parse'); + }; + + return JSON; + })(); + + if ('undefined' != typeof window) { + window.expect = module.exports; + } + +})( + this + , 'undefined' != typeof module ? module : {exports: {}} +); diff --git a/assets/expect/package.json b/assets/expect/package.json new file mode 100644 index 00000000..3ad39f71 --- /dev/null +++ b/assets/expect/package.json @@ -0,0 +1,13 @@ +{ + "name": "expect.js" + , "version": "0.3.1" + , "description": "BDD style assertions for node and the browser." + , "repository": { + "type": "git", + "url": "git://github.com/LearnBoost/expect.js.git" + } + , "devDependencies": { + "mocha": "*" + , "serve": "*" + } +} diff --git a/assets/expect/support/jquery.js b/assets/expect/support/jquery.js new file mode 100644 index 00000000..034f4126 --- /dev/null +++ b/assets/expect/support/jquery.js @@ -0,0 +1,9266 @@ +/*! + * jQuery JavaScript Library v1.7.1 + * http://jquery.com/ + * + * Copyright 2011, John Resig + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * Includes Sizzle.js + * http://sizzlejs.com/ + * Copyright 2011, The Dojo Foundation + * Released under the MIT, BSD, and GPL Licenses. + * + * Date: Mon Nov 21 21:11:03 2011 -0500 + */ +(function( window, undefined ) { + +// Use the correct document accordingly with window argument (sandbox) +var document = window.document, + navigator = window.navigator, + location = window.location; +var jQuery = (function() { + +// Define a local copy of jQuery +var jQuery = function( selector, context ) { + // The jQuery object is actually just the init constructor 'enhanced' + return new jQuery.fn.init( selector, context, rootjQuery ); + }, + + // Map over jQuery in case of overwrite + _jQuery = window.jQuery, + + // Map over the $ in case of overwrite + _$ = window.$, + + // A central reference to the root jQuery(document) + rootjQuery, + + // A simple way to check for HTML strings or ID strings + // Prioritize #id over to avoid XSS via location.hash (#9521) + quickExpr = /^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/, + + // Check if a string has a non-whitespace character in it + rnotwhite = /\S/, + + // Used for trimming whitespace + trimLeft = /^\s+/, + trimRight = /\s+$/, + + // Match a standalone tag + rsingleTag = /^<(\w+)\s*\/?>(?:<\/\1>)?$/, + + // JSON RegExp + rvalidchars = /^[\],:{}\s]*$/, + rvalidescape = /\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, + rvalidtokens = /"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, + rvalidbraces = /(?:^|:|,)(?:\s*\[)+/g, + + // Useragent RegExp + rwebkit = /(webkit)[ \/]([\w.]+)/, + ropera = /(opera)(?:.*version)?[ \/]([\w.]+)/, + rmsie = /(msie) ([\w.]+)/, + rmozilla = /(mozilla)(?:.*? rv:([\w.]+))?/, + + // Matches dashed string for camelizing + rdashAlpha = /-([a-z]|[0-9])/ig, + rmsPrefix = /^-ms-/, + + // Used by jQuery.camelCase as callback to replace() + fcamelCase = function( all, letter ) { + return ( letter + "" ).toUpperCase(); + }, + + // Keep a UserAgent string for use with jQuery.browser + userAgent = navigator.userAgent, + + // For matching the engine and version of the browser + browserMatch, + + // The deferred used on DOM ready + readyList, + + // The ready event handler + DOMContentLoaded, + + // Save a reference to some core methods + toString = Object.prototype.toString, + hasOwn = Object.prototype.hasOwnProperty, + push = Array.prototype.push, + slice = Array.prototype.slice, + trim = String.prototype.trim, + indexOf = Array.prototype.indexOf, + + // [[Class]] -> type pairs + class2type = {}; + +jQuery.fn = jQuery.prototype = { + constructor: jQuery, + init: function( selector, context, rootjQuery ) { + var match, elem, ret, doc; + + // Handle $(""), $(null), or $(undefined) + if ( !selector ) { + return this; + } + + // Handle $(DOMElement) + if ( selector.nodeType ) { + this.context = this[0] = selector; + this.length = 1; + return this; + } + + // The body element only exists once, optimize finding it + if ( selector === "body" && !context && document.body ) { + this.context = document; + this[0] = document.body; + this.selector = selector; + this.length = 1; + return this; + } + + // Handle HTML strings + if ( typeof selector === "string" ) { + // Are we dealing with HTML string or an ID? + if ( selector.charAt(0) === "<" && selector.charAt( selector.length - 1 ) === ">" && selector.length >= 3 ) { + // Assume that strings that start and end with <> are HTML and skip the regex check + match = [ null, selector, null ]; + + } else { + match = quickExpr.exec( selector ); + } + + // Verify a match, and that no context was specified for #id + if ( match && (match[1] || !context) ) { + + // HANDLE: $(html) -> $(array) + if ( match[1] ) { + context = context instanceof jQuery ? context[0] : context; + doc = ( context ? context.ownerDocument || context : document ); + + // If a single string is passed in and it's a single tag + // just do a createElement and skip the rest + ret = rsingleTag.exec( selector ); + + if ( ret ) { + if ( jQuery.isPlainObject( context ) ) { + selector = [ document.createElement( ret[1] ) ]; + jQuery.fn.attr.call( selector, context, true ); + + } else { + selector = [ doc.createElement( ret[1] ) ]; + } + + } else { + ret = jQuery.buildFragment( [ match[1] ], [ doc ] ); + selector = ( ret.cacheable ? jQuery.clone(ret.fragment) : ret.fragment ).childNodes; + } + + return jQuery.merge( this, selector ); + + // HANDLE: $("#id") + } else { + elem = document.getElementById( match[2] ); + + // Check parentNode to catch when Blackberry 4.6 returns + // nodes that are no longer in the document #6963 + if ( elem && elem.parentNode ) { + // Handle the case where IE and Opera return items + // by name instead of ID + if ( elem.id !== match[2] ) { + return rootjQuery.find( selector ); + } + + // Otherwise, we inject the element directly into the jQuery object + this.length = 1; + this[0] = elem; + } + + this.context = document; + this.selector = selector; + return this; + } + + // HANDLE: $(expr, $(...)) + } else if ( !context || context.jquery ) { + return ( context || rootjQuery ).find( selector ); + + // HANDLE: $(expr, context) + // (which is just equivalent to: $(context).find(expr) + } else { + return this.constructor( context ).find( selector ); + } + + // HANDLE: $(function) + // Shortcut for document ready + } else if ( jQuery.isFunction( selector ) ) { + return rootjQuery.ready( selector ); + } + + if ( selector.selector !== undefined ) { + this.selector = selector.selector; + this.context = selector.context; + } + + return jQuery.makeArray( selector, this ); + }, + + // Start with an empty selector + selector: "", + + // The current version of jQuery being used + jquery: "1.7.1", + + // The default length of a jQuery object is 0 + length: 0, + + // The number of elements contained in the matched element set + size: function() { + return this.length; + }, + + toArray: function() { + return slice.call( this, 0 ); + }, + + // Get the Nth element in the matched element set OR + // Get the whole matched element set as a clean array + get: function( num ) { + return num == null ? + + // Return a 'clean' array + this.toArray() : + + // Return just the object + ( num < 0 ? this[ this.length + num ] : this[ num ] ); + }, + + // Take an array of elements and push it onto the stack + // (returning the new matched element set) + pushStack: function( elems, name, selector ) { + // Build a new jQuery matched element set + var ret = this.constructor(); + + if ( jQuery.isArray( elems ) ) { + push.apply( ret, elems ); + + } else { + jQuery.merge( ret, elems ); + } + + // Add the old object onto the stack (as a reference) + ret.prevObject = this; + + ret.context = this.context; + + if ( name === "find" ) { + ret.selector = this.selector + ( this.selector ? " " : "" ) + selector; + } else if ( name ) { + ret.selector = this.selector + "." + name + "(" + selector + ")"; + } + + // Return the newly-formed element set + return ret; + }, + + // Execute a callback for every element in the matched set. + // (You can seed the arguments with an array of args, but this is + // only used internally.) + each: function( callback, args ) { + return jQuery.each( this, callback, args ); + }, + + ready: function( fn ) { + // Attach the listeners + jQuery.bindReady(); + + // Add the callback + readyList.add( fn ); + + return this; + }, + + eq: function( i ) { + i = +i; + return i === -1 ? + this.slice( i ) : + this.slice( i, i + 1 ); + }, + + first: function() { + return this.eq( 0 ); + }, + + last: function() { + return this.eq( -1 ); + }, + + slice: function() { + return this.pushStack( slice.apply( this, arguments ), + "slice", slice.call(arguments).join(",") ); + }, + + map: function( callback ) { + return this.pushStack( jQuery.map(this, function( elem, i ) { + return callback.call( elem, i, elem ); + })); + }, + + end: function() { + return this.prevObject || this.constructor(null); + }, + + // For internal use only. + // Behaves like an Array's method, not like a jQuery method. + push: push, + sort: [].sort, + splice: [].splice +}; + +// Give the init function the jQuery prototype for later instantiation +jQuery.fn.init.prototype = jQuery.fn; + +jQuery.extend = jQuery.fn.extend = function() { + var options, name, src, copy, copyIsArray, clone, + target = arguments[0] || {}, + i = 1, + length = arguments.length, + deep = false; + + // Handle a deep copy situation + if ( typeof target === "boolean" ) { + deep = target; + target = arguments[1] || {}; + // skip the boolean and the target + i = 2; + } + + // Handle case when target is a string or something (possible in deep copy) + if ( typeof target !== "object" && !jQuery.isFunction(target) ) { + target = {}; + } + + // extend jQuery itself if only one argument is passed + if ( length === i ) { + target = this; + --i; + } + + for ( ; i < length; i++ ) { + // Only deal with non-null/undefined values + if ( (options = arguments[ i ]) != null ) { + // Extend the base object + for ( name in options ) { + src = target[ name ]; + copy = options[ name ]; + + // Prevent never-ending loop + if ( target === copy ) { + continue; + } + + // Recurse if we're merging plain objects or arrays + if ( deep && copy && ( jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)) ) ) { + if ( copyIsArray ) { + copyIsArray = false; + clone = src && jQuery.isArray(src) ? src : []; + + } else { + clone = src && jQuery.isPlainObject(src) ? src : {}; + } + + // Never move original objects, clone them + target[ name ] = jQuery.extend( deep, clone, copy ); + + // Don't bring in undefined values + } else if ( copy !== undefined ) { + target[ name ] = copy; + } + } + } + } + + // Return the modified object + return target; +}; + +jQuery.extend({ + noConflict: function( deep ) { + if ( window.$ === jQuery ) { + window.$ = _$; + } + + if ( deep && window.jQuery === jQuery ) { + window.jQuery = _jQuery; + } + + return jQuery; + }, + + // Is the DOM ready to be used? Set to true once it occurs. + isReady: false, + + // A counter to track how many items to wait for before + // the ready event fires. See #6781 + readyWait: 1, + + // Hold (or release) the ready event + holdReady: function( hold ) { + if ( hold ) { + jQuery.readyWait++; + } else { + jQuery.ready( true ); + } + }, + + // Handle when the DOM is ready + ready: function( wait ) { + // Either a released hold or an DOMready/load event and not yet ready + if ( (wait === true && !--jQuery.readyWait) || (wait !== true && !jQuery.isReady) ) { + // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443). + if ( !document.body ) { + return setTimeout( jQuery.ready, 1 ); + } + + // Remember that the DOM is ready + jQuery.isReady = true; + + // If a normal DOM Ready event fired, decrement, and wait if need be + if ( wait !== true && --jQuery.readyWait > 0 ) { + return; + } + + // If there are functions bound, to execute + readyList.fireWith( document, [ jQuery ] ); + + // Trigger any bound ready events + if ( jQuery.fn.trigger ) { + jQuery( document ).trigger( "ready" ).off( "ready" ); + } + } + }, + + bindReady: function() { + if ( readyList ) { + return; + } + + readyList = jQuery.Callbacks( "once memory" ); + + // Catch cases where $(document).ready() is called after the + // browser event has already occurred. + if ( document.readyState === "complete" ) { + // Handle it asynchronously to allow scripts the opportunity to delay ready + return setTimeout( jQuery.ready, 1 ); + } + + // Mozilla, Opera and webkit nightlies currently support this event + if ( document.addEventListener ) { + // Use the handy event callback + document.addEventListener( "DOMContentLoaded", DOMContentLoaded, false ); + + // A fallback to window.onload, that will always work + window.addEventListener( "load", jQuery.ready, false ); + + // If IE event model is used + } else if ( document.attachEvent ) { + // ensure firing before onload, + // maybe late but safe also for iframes + document.attachEvent( "onreadystatechange", DOMContentLoaded ); + + // A fallback to window.onload, that will always work + window.attachEvent( "onload", jQuery.ready ); + + // If IE and not a frame + // continually check to see if the document is ready + var toplevel = false; + + try { + toplevel = window.frameElement == null; + } catch(e) {} + + if ( document.documentElement.doScroll && toplevel ) { + doScrollCheck(); + } + } + }, + + // See test/unit/core.js for details concerning isFunction. + // Since version 1.3, DOM methods and functions like alert + // aren't supported. They return false on IE (#2968). + isFunction: function( obj ) { + return jQuery.type(obj) === "function"; + }, + + isArray: Array.isArray || function( obj ) { + return jQuery.type(obj) === "array"; + }, + + // A crude way of determining if an object is a window + isWindow: function( obj ) { + return obj && typeof obj === "object" && "setInterval" in obj; + }, + + isNumeric: function( obj ) { + return !isNaN( parseFloat(obj) ) && isFinite( obj ); + }, + + type: function( obj ) { + return obj == null ? + String( obj ) : + class2type[ toString.call(obj) ] || "object"; + }, + + isPlainObject: function( obj ) { + // Must be an Object. + // Because of IE, we also have to check the presence of the constructor property. + // Make sure that DOM nodes and window objects don't pass through, as well + if ( !obj || jQuery.type(obj) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) { + return false; + } + + try { + // Not own constructor property must be Object + if ( obj.constructor && + !hasOwn.call(obj, "constructor") && + !hasOwn.call(obj.constructor.prototype, "isPrototypeOf") ) { + return false; + } + } catch ( e ) { + // IE8,9 Will throw exceptions on certain host objects #9897 + return false; + } + + // Own properties are enumerated firstly, so to speed up, + // if last one is own, then all properties are own. + + var key; + for ( key in obj ) {} + + return key === undefined || hasOwn.call( obj, key ); + }, + + isEmptyObject: function( obj ) { + for ( var name in obj ) { + return false; + } + return true; + }, + + error: function( msg ) { + throw new Error( msg ); + }, + + parseJSON: function( data ) { + if ( typeof data !== "string" || !data ) { + return null; + } + + // Make sure leading/trailing whitespace is removed (IE can't handle it) + data = jQuery.trim( data ); + + // Attempt to parse using the native JSON parser first + if ( window.JSON && window.JSON.parse ) { + return window.JSON.parse( data ); + } + + // Make sure the incoming data is actual JSON + // Logic borrowed from http://json.org/json2.js + if ( rvalidchars.test( data.replace( rvalidescape, "@" ) + .replace( rvalidtokens, "]" ) + .replace( rvalidbraces, "")) ) { + + return ( new Function( "return " + data ) )(); + + } + jQuery.error( "Invalid JSON: " + data ); + }, + + // Cross-browser xml parsing + parseXML: function( data ) { + var xml, tmp; + try { + if ( window.DOMParser ) { // Standard + tmp = new DOMParser(); + xml = tmp.parseFromString( data , "text/xml" ); + } else { // IE + xml = new ActiveXObject( "Microsoft.XMLDOM" ); + xml.async = "false"; + xml.loadXML( data ); + } + } catch( e ) { + xml = undefined; + } + if ( !xml || !xml.documentElement || xml.getElementsByTagName( "parsererror" ).length ) { + jQuery.error( "Invalid XML: " + data ); + } + return xml; + }, + + noop: function() {}, + + // Evaluates a script in a global context + // Workarounds based on findings by Jim Driscoll + // http://weblogs.java.net/blog/driscoll/archive/2009/09/08/eval-javascript-global-context + globalEval: function( data ) { + if ( data && rnotwhite.test( data ) ) { + // We use execScript on Internet Explorer + // We use an anonymous function so that context is window + // rather than jQuery in Firefox + ( window.execScript || function( data ) { + window[ "eval" ].call( window, data ); + } )( data ); + } + }, + + // Convert dashed to camelCase; used by the css and data modules + // Microsoft forgot to hump their vendor prefix (#9572) + camelCase: function( string ) { + return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase ); + }, + + nodeName: function( elem, name ) { + return elem.nodeName && elem.nodeName.toUpperCase() === name.toUpperCase(); + }, + + // args is for internal usage only + each: function( object, callback, args ) { + var name, i = 0, + length = object.length, + isObj = length === undefined || jQuery.isFunction( object ); + + if ( args ) { + if ( isObj ) { + for ( name in object ) { + if ( callback.apply( object[ name ], args ) === false ) { + break; + } + } + } else { + for ( ; i < length; ) { + if ( callback.apply( object[ i++ ], args ) === false ) { + break; + } + } + } + + // A special, fast, case for the most common use of each + } else { + if ( isObj ) { + for ( name in object ) { + if ( callback.call( object[ name ], name, object[ name ] ) === false ) { + break; + } + } + } else { + for ( ; i < length; ) { + if ( callback.call( object[ i ], i, object[ i++ ] ) === false ) { + break; + } + } + } + } + + return object; + }, + + // Use native String.trim function wherever possible + trim: trim ? + function( text ) { + return text == null ? + "" : + trim.call( text ); + } : + + // Otherwise use our own trimming functionality + function( text ) { + return text == null ? + "" : + text.toString().replace( trimLeft, "" ).replace( trimRight, "" ); + }, + + // results is for internal usage only + makeArray: function( array, results ) { + var ret = results || []; + + if ( array != null ) { + // The window, strings (and functions) also have 'length' + // Tweaked logic slightly to handle Blackberry 4.7 RegExp issues #6930 + var type = jQuery.type( array ); + + if ( array.length == null || type === "string" || type === "function" || type === "regexp" || jQuery.isWindow( array ) ) { + push.call( ret, array ); + } else { + jQuery.merge( ret, array ); + } + } + + return ret; + }, + + inArray: function( elem, array, i ) { + var len; + + if ( array ) { + if ( indexOf ) { + return indexOf.call( array, elem, i ); + } + + len = array.length; + i = i ? i < 0 ? Math.max( 0, len + i ) : i : 0; + + for ( ; i < len; i++ ) { + // Skip accessing in sparse arrays + if ( i in array && array[ i ] === elem ) { + return i; + } + } + } + + return -1; + }, + + merge: function( first, second ) { + var i = first.length, + j = 0; + + if ( typeof second.length === "number" ) { + for ( var l = second.length; j < l; j++ ) { + first[ i++ ] = second[ j ]; + } + + } else { + while ( second[j] !== undefined ) { + first[ i++ ] = second[ j++ ]; + } + } + + first.length = i; + + return first; + }, + + grep: function( elems, callback, inv ) { + var ret = [], retVal; + inv = !!inv; + + // Go through the array, only saving the items + // that pass the validator function + for ( var i = 0, length = elems.length; i < length; i++ ) { + retVal = !!callback( elems[ i ], i ); + if ( inv !== retVal ) { + ret.push( elems[ i ] ); + } + } + + return ret; + }, + + // arg is for internal usage only + map: function( elems, callback, arg ) { + var value, key, ret = [], + i = 0, + length = elems.length, + // jquery objects are treated as arrays + isArray = elems instanceof jQuery || length !== undefined && typeof length === "number" && ( ( length > 0 && elems[ 0 ] && elems[ length -1 ] ) || length === 0 || jQuery.isArray( elems ) ) ; + + // Go through the array, translating each of the items to their + if ( isArray ) { + for ( ; i < length; i++ ) { + value = callback( elems[ i ], i, arg ); + + if ( value != null ) { + ret[ ret.length ] = value; + } + } + + // Go through every key on the object, + } else { + for ( key in elems ) { + value = callback( elems[ key ], key, arg ); + + if ( value != null ) { + ret[ ret.length ] = value; + } + } + } + + // Flatten any nested arrays + return ret.concat.apply( [], ret ); + }, + + // A global GUID counter for objects + guid: 1, + + // Bind a function to a context, optionally partially applying any + // arguments. + proxy: function( fn, context ) { + if ( typeof context === "string" ) { + var tmp = fn[ context ]; + context = fn; + fn = tmp; + } + + // Quick check to determine if target is callable, in the spec + // this throws a TypeError, but we will just return undefined. + if ( !jQuery.isFunction( fn ) ) { + return undefined; + } + + // Simulated bind + var args = slice.call( arguments, 2 ), + proxy = function() { + return fn.apply( context, args.concat( slice.call( arguments ) ) ); + }; + + // Set the guid of unique handler to the same of original handler, so it can be removed + proxy.guid = fn.guid = fn.guid || proxy.guid || jQuery.guid++; + + return proxy; + }, + + // Mutifunctional method to get and set values to a collection + // The value/s can optionally be executed if it's a function + access: function( elems, key, value, exec, fn, pass ) { + var length = elems.length; + + // Setting many attributes + if ( typeof key === "object" ) { + for ( var k in key ) { + jQuery.access( elems, k, key[k], exec, fn, value ); + } + return elems; + } + + // Setting one attribute + if ( value !== undefined ) { + // Optionally, function values get executed if exec is true + exec = !pass && exec && jQuery.isFunction(value); + + for ( var i = 0; i < length; i++ ) { + fn( elems[i], key, exec ? value.call( elems[i], i, fn( elems[i], key ) ) : value, pass ); + } + + return elems; + } + + // Getting an attribute + return length ? fn( elems[0], key ) : undefined; + }, + + now: function() { + return ( new Date() ).getTime(); + }, + + // Use of jQuery.browser is frowned upon. + // More details: http://docs.jquery.com/Utilities/jQuery.browser + uaMatch: function( ua ) { + ua = ua.toLowerCase(); + + var match = rwebkit.exec( ua ) || + ropera.exec( ua ) || + rmsie.exec( ua ) || + ua.indexOf("compatible") < 0 && rmozilla.exec( ua ) || + []; + + return { browser: match[1] || "", version: match[2] || "0" }; + }, + + sub: function() { + function jQuerySub( selector, context ) { + return new jQuerySub.fn.init( selector, context ); + } + jQuery.extend( true, jQuerySub, this ); + jQuerySub.superclass = this; + jQuerySub.fn = jQuerySub.prototype = this(); + jQuerySub.fn.constructor = jQuerySub; + jQuerySub.sub = this.sub; + jQuerySub.fn.init = function init( selector, context ) { + if ( context && context instanceof jQuery && !(context instanceof jQuerySub) ) { + context = jQuerySub( context ); + } + + return jQuery.fn.init.call( this, selector, context, rootjQuerySub ); + }; + jQuerySub.fn.init.prototype = jQuerySub.fn; + var rootjQuerySub = jQuerySub(document); + return jQuerySub; + }, + + browser: {} +}); + +// Populate the class2type map +jQuery.each("Boolean Number String Function Array Date RegExp Object".split(" "), function(i, name) { + class2type[ "[object " + name + "]" ] = name.toLowerCase(); +}); + +browserMatch = jQuery.uaMatch( userAgent ); +if ( browserMatch.browser ) { + jQuery.browser[ browserMatch.browser ] = true; + jQuery.browser.version = browserMatch.version; +} + +// Deprecated, use jQuery.browser.webkit instead +if ( jQuery.browser.webkit ) { + jQuery.browser.safari = true; +} + +// IE doesn't match non-breaking spaces with \s +if ( rnotwhite.test( "\xA0" ) ) { + trimLeft = /^[\s\xA0]+/; + trimRight = /[\s\xA0]+$/; +} + +// All jQuery objects should point back to these +rootjQuery = jQuery(document); + +// Cleanup functions for the document ready method +if ( document.addEventListener ) { + DOMContentLoaded = function() { + document.removeEventListener( "DOMContentLoaded", DOMContentLoaded, false ); + jQuery.ready(); + }; + +} else if ( document.attachEvent ) { + DOMContentLoaded = function() { + // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443). + if ( document.readyState === "complete" ) { + document.detachEvent( "onreadystatechange", DOMContentLoaded ); + jQuery.ready(); + } + }; +} + +// The DOM ready check for Internet Explorer +function doScrollCheck() { + if ( jQuery.isReady ) { + return; + } + + try { + // If IE is used, use the trick by Diego Perini + // http://javascript.nwbox.com/IEContentLoaded/ + document.documentElement.doScroll("left"); + } catch(e) { + setTimeout( doScrollCheck, 1 ); + return; + } + + // and execute any waiting functions + jQuery.ready(); +} + +return jQuery; + +})(); + + +// String to Object flags format cache +var flagsCache = {}; + +// Convert String-formatted flags into Object-formatted ones and store in cache +function createFlags( flags ) { + var object = flagsCache[ flags ] = {}, + i, length; + flags = flags.split( /\s+/ ); + for ( i = 0, length = flags.length; i < length; i++ ) { + object[ flags[i] ] = true; + } + return object; +} + +/* + * Create a callback list using the following parameters: + * + * flags: an optional list of space-separated flags that will change how + * the callback list behaves + * + * By default a callback list will act like an event callback list and can be + * "fired" multiple times. + * + * Possible flags: + * + * once: will ensure the callback list can only be fired once (like a Deferred) + * + * memory: will keep track of previous values and will call any callback added + * after the list has been fired right away with the latest "memorized" + * values (like a Deferred) + * + * unique: will ensure a callback can only be added once (no duplicate in the list) + * + * stopOnFalse: interrupt callings when a callback returns false + * + */ +jQuery.Callbacks = function( flags ) { + + // Convert flags from String-formatted to Object-formatted + // (we check in cache first) + flags = flags ? ( flagsCache[ flags ] || createFlags( flags ) ) : {}; + + var // Actual callback list + list = [], + // Stack of fire calls for repeatable lists + stack = [], + // Last fire value (for non-forgettable lists) + memory, + // Flag to know if list is currently firing + firing, + // First callback to fire (used internally by add and fireWith) + firingStart, + // End of the loop when firing + firingLength, + // Index of currently firing callback (modified by remove if needed) + firingIndex, + // Add one or several callbacks to the list + add = function( args ) { + var i, + length, + elem, + type, + actual; + for ( i = 0, length = args.length; i < length; i++ ) { + elem = args[ i ]; + type = jQuery.type( elem ); + if ( type === "array" ) { + // Inspect recursively + add( elem ); + } else if ( type === "function" ) { + // Add if not in unique mode and callback is not in + if ( !flags.unique || !self.has( elem ) ) { + list.push( elem ); + } + } + } + }, + // Fire callbacks + fire = function( context, args ) { + args = args || []; + memory = !flags.memory || [ context, args ]; + firing = true; + firingIndex = firingStart || 0; + firingStart = 0; + firingLength = list.length; + for ( ; list && firingIndex < firingLength; firingIndex++ ) { + if ( list[ firingIndex ].apply( context, args ) === false && flags.stopOnFalse ) { + memory = true; // Mark as halted + break; + } + } + firing = false; + if ( list ) { + if ( !flags.once ) { + if ( stack && stack.length ) { + memory = stack.shift(); + self.fireWith( memory[ 0 ], memory[ 1 ] ); + } + } else if ( memory === true ) { + self.disable(); + } else { + list = []; + } + } + }, + // Actual Callbacks object + self = { + // Add a callback or a collection of callbacks to the list + add: function() { + if ( list ) { + var length = list.length; + add( arguments ); + // Do we need to add the callbacks to the + // current firing batch? + if ( firing ) { + firingLength = list.length; + // With memory, if we're not firing then + // we should call right away, unless previous + // firing was halted (stopOnFalse) + } else if ( memory && memory !== true ) { + firingStart = length; + fire( memory[ 0 ], memory[ 1 ] ); + } + } + return this; + }, + // Remove a callback from the list + remove: function() { + if ( list ) { + var args = arguments, + argIndex = 0, + argLength = args.length; + for ( ; argIndex < argLength ; argIndex++ ) { + for ( var i = 0; i < list.length; i++ ) { + if ( args[ argIndex ] === list[ i ] ) { + // Handle firingIndex and firingLength + if ( firing ) { + if ( i <= firingLength ) { + firingLength--; + if ( i <= firingIndex ) { + firingIndex--; + } + } + } + // Remove the element + list.splice( i--, 1 ); + // If we have some unicity property then + // we only need to do this once + if ( flags.unique ) { + break; + } + } + } + } + } + return this; + }, + // Control if a given callback is in the list + has: function( fn ) { + if ( list ) { + var i = 0, + length = list.length; + for ( ; i < length; i++ ) { + if ( fn === list[ i ] ) { + return true; + } + } + } + return false; + }, + // Remove all callbacks from the list + empty: function() { + list = []; + return this; + }, + // Have the list do nothing anymore + disable: function() { + list = stack = memory = undefined; + return this; + }, + // Is it disabled? + disabled: function() { + return !list; + }, + // Lock the list in its current state + lock: function() { + stack = undefined; + if ( !memory || memory === true ) { + self.disable(); + } + return this; + }, + // Is it locked? + locked: function() { + return !stack; + }, + // Call all callbacks with the given context and arguments + fireWith: function( context, args ) { + if ( stack ) { + if ( firing ) { + if ( !flags.once ) { + stack.push( [ context, args ] ); + } + } else if ( !( flags.once && memory ) ) { + fire( context, args ); + } + } + return this; + }, + // Call all the callbacks with the given arguments + fire: function() { + self.fireWith( this, arguments ); + return this; + }, + // To know if the callbacks have already been called at least once + fired: function() { + return !!memory; + } + }; + + return self; +}; + + + + +var // Static reference to slice + sliceDeferred = [].slice; + +jQuery.extend({ + + Deferred: function( func ) { + var doneList = jQuery.Callbacks( "once memory" ), + failList = jQuery.Callbacks( "once memory" ), + progressList = jQuery.Callbacks( "memory" ), + state = "pending", + lists = { + resolve: doneList, + reject: failList, + notify: progressList + }, + promise = { + done: doneList.add, + fail: failList.add, + progress: progressList.add, + + state: function() { + return state; + }, + + // Deprecated + isResolved: doneList.fired, + isRejected: failList.fired, + + then: function( doneCallbacks, failCallbacks, progressCallbacks ) { + deferred.done( doneCallbacks ).fail( failCallbacks ).progress( progressCallbacks ); + return this; + }, + always: function() { + deferred.done.apply( deferred, arguments ).fail.apply( deferred, arguments ); + return this; + }, + pipe: function( fnDone, fnFail, fnProgress ) { + return jQuery.Deferred(function( newDefer ) { + jQuery.each( { + done: [ fnDone, "resolve" ], + fail: [ fnFail, "reject" ], + progress: [ fnProgress, "notify" ] + }, function( handler, data ) { + var fn = data[ 0 ], + action = data[ 1 ], + returned; + if ( jQuery.isFunction( fn ) ) { + deferred[ handler ](function() { + returned = fn.apply( this, arguments ); + if ( returned && jQuery.isFunction( returned.promise ) ) { + returned.promise().then( newDefer.resolve, newDefer.reject, newDefer.notify ); + } else { + newDefer[ action + "With" ]( this === deferred ? newDefer : this, [ returned ] ); + } + }); + } else { + deferred[ handler ]( newDefer[ action ] ); + } + }); + }).promise(); + }, + // Get a promise for this deferred + // If obj is provided, the promise aspect is added to the object + promise: function( obj ) { + if ( obj == null ) { + obj = promise; + } else { + for ( var key in promise ) { + obj[ key ] = promise[ key ]; + } + } + return obj; + } + }, + deferred = promise.promise({}), + key; + + for ( key in lists ) { + deferred[ key ] = lists[ key ].fire; + deferred[ key + "With" ] = lists[ key ].fireWith; + } + + // Handle state + deferred.done( function() { + state = "resolved"; + }, failList.disable, progressList.lock ).fail( function() { + state = "rejected"; + }, doneList.disable, progressList.lock ); + + // Call given func if any + if ( func ) { + func.call( deferred, deferred ); + } + + // All done! + return deferred; + }, + + // Deferred helper + when: function( firstParam ) { + var args = sliceDeferred.call( arguments, 0 ), + i = 0, + length = args.length, + pValues = new Array( length ), + count = length, + pCount = length, + deferred = length <= 1 && firstParam && jQuery.isFunction( firstParam.promise ) ? + firstParam : + jQuery.Deferred(), + promise = deferred.promise(); + function resolveFunc( i ) { + return function( value ) { + args[ i ] = arguments.length > 1 ? sliceDeferred.call( arguments, 0 ) : value; + if ( !( --count ) ) { + deferred.resolveWith( deferred, args ); + } + }; + } + function progressFunc( i ) { + return function( value ) { + pValues[ i ] = arguments.length > 1 ? sliceDeferred.call( arguments, 0 ) : value; + deferred.notifyWith( promise, pValues ); + }; + } + if ( length > 1 ) { + for ( ; i < length; i++ ) { + if ( args[ i ] && args[ i ].promise && jQuery.isFunction( args[ i ].promise ) ) { + args[ i ].promise().then( resolveFunc(i), deferred.reject, progressFunc(i) ); + } else { + --count; + } + } + if ( !count ) { + deferred.resolveWith( deferred, args ); + } + } else if ( deferred !== firstParam ) { + deferred.resolveWith( deferred, length ? [ firstParam ] : [] ); + } + return promise; + } +}); + + + + +jQuery.support = (function() { + + var support, + all, + a, + select, + opt, + input, + marginDiv, + fragment, + tds, + events, + eventName, + i, + isSupported, + div = document.createElement( "div" ), + documentElement = document.documentElement; + + // Preliminary tests + div.setAttribute("className", "t"); + div.innerHTML = "
a"; + + all = div.getElementsByTagName( "*" ); + a = div.getElementsByTagName( "a" )[ 0 ]; + + // Can't get basic test support + if ( !all || !all.length || !a ) { + return {}; + } + + // First batch of supports tests + select = document.createElement( "select" ); + opt = select.appendChild( document.createElement("option") ); + input = div.getElementsByTagName( "input" )[ 0 ]; + + support = { + // IE strips leading whitespace when .innerHTML is used + leadingWhitespace: ( div.firstChild.nodeType === 3 ), + + // Make sure that tbody elements aren't automatically inserted + // IE will insert them into empty tables + tbody: !div.getElementsByTagName("tbody").length, + + // Make sure that link elements get serialized correctly by innerHTML + // This requires a wrapper element in IE + htmlSerialize: !!div.getElementsByTagName("link").length, + + // Get the style information from getAttribute + // (IE uses .cssText instead) + style: /top/.test( a.getAttribute("style") ), + + // Make sure that URLs aren't manipulated + // (IE normalizes it by default) + hrefNormalized: ( a.getAttribute("href") === "/a" ), + + // Make sure that element opacity exists + // (IE uses filter instead) + // Use a regex to work around a WebKit issue. See #5145 + opacity: /^0.55/.test( a.style.opacity ), + + // Verify style float existence + // (IE uses styleFloat instead of cssFloat) + cssFloat: !!a.style.cssFloat, + + // Make sure that if no value is specified for a checkbox + // that it defaults to "on". + // (WebKit defaults to "" instead) + checkOn: ( input.value === "on" ), + + // Make sure that a selected-by-default option has a working selected property. + // (WebKit defaults to false instead of true, IE too, if it's in an optgroup) + optSelected: opt.selected, + + // Test setAttribute on camelCase class. If it works, we need attrFixes when doing get/setAttribute (ie6/7) + getSetAttribute: div.className !== "t", + + // Tests for enctype support on a form(#6743) + enctype: !!document.createElement("form").enctype, + + // Makes sure cloning an html5 element does not cause problems + // Where outerHTML is undefined, this still works + html5Clone: document.createElement("nav").cloneNode( true ).outerHTML !== "<:nav>", + + // Will be defined later + submitBubbles: true, + changeBubbles: true, + focusinBubbles: false, + deleteExpando: true, + noCloneEvent: true, + inlineBlockNeedsLayout: false, + shrinkWrapBlocks: false, + reliableMarginRight: true + }; + + // Make sure checked status is properly cloned + input.checked = true; + support.noCloneChecked = input.cloneNode( true ).checked; + + // Make sure that the options inside disabled selects aren't marked as disabled + // (WebKit marks them as disabled) + select.disabled = true; + support.optDisabled = !opt.disabled; + + // Test to see if it's possible to delete an expando from an element + // Fails in Internet Explorer + try { + delete div.test; + } catch( e ) { + support.deleteExpando = false; + } + + if ( !div.addEventListener && div.attachEvent && div.fireEvent ) { + div.attachEvent( "onclick", function() { + // Cloning a node shouldn't copy over any + // bound event handlers (IE does this) + support.noCloneEvent = false; + }); + div.cloneNode( true ).fireEvent( "onclick" ); + } + + // Check if a radio maintains its value + // after being appended to the DOM + input = document.createElement("input"); + input.value = "t"; + input.setAttribute("type", "radio"); + support.radioValue = input.value === "t"; + + input.setAttribute("checked", "checked"); + div.appendChild( input ); + fragment = document.createDocumentFragment(); + fragment.appendChild( div.lastChild ); + + // WebKit doesn't clone checked state correctly in fragments + support.checkClone = fragment.cloneNode( true ).cloneNode( true ).lastChild.checked; + + // Check if a disconnected checkbox will retain its checked + // value of true after appended to the DOM (IE6/7) + support.appendChecked = input.checked; + + fragment.removeChild( input ); + fragment.appendChild( div ); + + div.innerHTML = ""; + + // Check if div with explicit width and no margin-right incorrectly + // gets computed margin-right based on width of container. For more + // info see bug #3333 + // Fails in WebKit before Feb 2011 nightlies + // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right + if ( window.getComputedStyle ) { + marginDiv = document.createElement( "div" ); + marginDiv.style.width = "0"; + marginDiv.style.marginRight = "0"; + div.style.width = "2px"; + div.appendChild( marginDiv ); + support.reliableMarginRight = + ( parseInt( ( window.getComputedStyle( marginDiv, null ) || { marginRight: 0 } ).marginRight, 10 ) || 0 ) === 0; + } + + // Technique from Juriy Zaytsev + // http://perfectionkills.com/detecting-event-support-without-browser-sniffing/ + // We only care about the case where non-standard event systems + // are used, namely in IE. Short-circuiting here helps us to + // avoid an eval call (in setAttribute) which can cause CSP + // to go haywire. See: https://developer.mozilla.org/en/Security/CSP + if ( div.attachEvent ) { + for( i in { + submit: 1, + change: 1, + focusin: 1 + }) { + eventName = "on" + i; + isSupported = ( eventName in div ); + if ( !isSupported ) { + div.setAttribute( eventName, "return;" ); + isSupported = ( typeof div[ eventName ] === "function" ); + } + support[ i + "Bubbles" ] = isSupported; + } + } + + fragment.removeChild( div ); + + // Null elements to avoid leaks in IE + fragment = select = opt = marginDiv = div = input = null; + + // Run tests that need a body at doc ready + jQuery(function() { + var container, outer, inner, table, td, offsetSupport, + conMarginTop, ptlm, vb, style, html, + body = document.getElementsByTagName("body")[0]; + + if ( !body ) { + // Return for frameset docs that don't have a body + return; + } + + conMarginTop = 1; + ptlm = "position:absolute;top:0;left:0;width:1px;height:1px;margin:0;"; + vb = "visibility:hidden;border:0;"; + style = "style='" + ptlm + "border:5px solid #000;padding:0;'"; + html = "
" + + "" + + "
"; + + container = document.createElement("div"); + container.style.cssText = vb + "width:0;height:0;position:static;top:0;margin-top:" + conMarginTop + "px"; + body.insertBefore( container, body.firstChild ); + + // Construct the test element + div = document.createElement("div"); + container.appendChild( div ); + + // Check if table cells still have offsetWidth/Height when they are set + // to display:none and there are still other visible table cells in a + // table row; if so, offsetWidth/Height are not reliable for use when + // determining if an element has been hidden directly using + // display:none (it is still safe to use offsets if a parent element is + // hidden; don safety goggles and see bug #4512 for more information). + // (only IE 8 fails this test) + div.innerHTML = "
t
"; + tds = div.getElementsByTagName( "td" ); + isSupported = ( tds[ 0 ].offsetHeight === 0 ); + + tds[ 0 ].style.display = ""; + tds[ 1 ].style.display = "none"; + + // Check if empty table cells still have offsetWidth/Height + // (IE <= 8 fail this test) + support.reliableHiddenOffsets = isSupported && ( tds[ 0 ].offsetHeight === 0 ); + + // Figure out if the W3C box model works as expected + div.innerHTML = ""; + div.style.width = div.style.paddingLeft = "1px"; + jQuery.boxModel = support.boxModel = div.offsetWidth === 2; + + if ( typeof div.style.zoom !== "undefined" ) { + // Check if natively block-level elements act like inline-block + // elements when setting their display to 'inline' and giving + // them layout + // (IE < 8 does this) + div.style.display = "inline"; + div.style.zoom = 1; + support.inlineBlockNeedsLayout = ( div.offsetWidth === 2 ); + + // Check if elements with layout shrink-wrap their children + // (IE 6 does this) + div.style.display = ""; + div.innerHTML = "
"; + support.shrinkWrapBlocks = ( div.offsetWidth !== 2 ); + } + + div.style.cssText = ptlm + vb; + div.innerHTML = html; + + outer = div.firstChild; + inner = outer.firstChild; + td = outer.nextSibling.firstChild.firstChild; + + offsetSupport = { + doesNotAddBorder: ( inner.offsetTop !== 5 ), + doesAddBorderForTableAndCells: ( td.offsetTop === 5 ) + }; + + inner.style.position = "fixed"; + inner.style.top = "20px"; + + // safari subtracts parent border width here which is 5px + offsetSupport.fixedPosition = ( inner.offsetTop === 20 || inner.offsetTop === 15 ); + inner.style.position = inner.style.top = ""; + + outer.style.overflow = "hidden"; + outer.style.position = "relative"; + + offsetSupport.subtractsBorderForOverflowNotVisible = ( inner.offsetTop === -5 ); + offsetSupport.doesNotIncludeMarginInBodyOffset = ( body.offsetTop !== conMarginTop ); + + body.removeChild( container ); + div = container = null; + + jQuery.extend( support, offsetSupport ); + }); + + return support; +})(); + + + + +var rbrace = /^(?:\{.*\}|\[.*\])$/, + rmultiDash = /([A-Z])/g; + +jQuery.extend({ + cache: {}, + + // Please use with caution + uuid: 0, + + // Unique for each copy of jQuery on the page + // Non-digits removed to match rinlinejQuery + expando: "jQuery" + ( jQuery.fn.jquery + Math.random() ).replace( /\D/g, "" ), + + // The following elements throw uncatchable exceptions if you + // attempt to add expando properties to them. + noData: { + "embed": true, + // Ban all objects except for Flash (which handle expandos) + "object": "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000", + "applet": true + }, + + hasData: function( elem ) { + elem = elem.nodeType ? jQuery.cache[ elem[jQuery.expando] ] : elem[ jQuery.expando ]; + return !!elem && !isEmptyDataObject( elem ); + }, + + data: function( elem, name, data, pvt /* Internal Use Only */ ) { + if ( !jQuery.acceptData( elem ) ) { + return; + } + + var privateCache, thisCache, ret, + internalKey = jQuery.expando, + getByName = typeof name === "string", + + // We have to handle DOM nodes and JS objects differently because IE6-7 + // can't GC object references properly across the DOM-JS boundary + isNode = elem.nodeType, + + // Only DOM nodes need the global jQuery cache; JS object data is + // attached directly to the object so GC can occur automatically + cache = isNode ? jQuery.cache : elem, + + // Only defining an ID for JS objects if its cache already exists allows + // the code to shortcut on the same path as a DOM node with no cache + id = isNode ? elem[ internalKey ] : elem[ internalKey ] && internalKey, + isEvents = name === "events"; + + // Avoid doing any more work than we need to when trying to get data on an + // object that has no data at all + if ( (!id || !cache[id] || (!isEvents && !pvt && !cache[id].data)) && getByName && data === undefined ) { + return; + } + + if ( !id ) { + // Only DOM nodes need a new unique ID for each element since their data + // ends up in the global cache + if ( isNode ) { + elem[ internalKey ] = id = ++jQuery.uuid; + } else { + id = internalKey; + } + } + + if ( !cache[ id ] ) { + cache[ id ] = {}; + + // Avoids exposing jQuery metadata on plain JS objects when the object + // is serialized using JSON.stringify + if ( !isNode ) { + cache[ id ].toJSON = jQuery.noop; + } + } + + // An object can be passed to jQuery.data instead of a key/value pair; this gets + // shallow copied over onto the existing cache + if ( typeof name === "object" || typeof name === "function" ) { + if ( pvt ) { + cache[ id ] = jQuery.extend( cache[ id ], name ); + } else { + cache[ id ].data = jQuery.extend( cache[ id ].data, name ); + } + } + + privateCache = thisCache = cache[ id ]; + + // jQuery data() is stored in a separate object inside the object's internal data + // cache in order to avoid key collisions between internal data and user-defined + // data. + if ( !pvt ) { + if ( !thisCache.data ) { + thisCache.data = {}; + } + + thisCache = thisCache.data; + } + + if ( data !== undefined ) { + thisCache[ jQuery.camelCase( name ) ] = data; + } + + // Users should not attempt to inspect the internal events object using jQuery.data, + // it is undocumented and subject to change. But does anyone listen? No. + if ( isEvents && !thisCache[ name ] ) { + return privateCache.events; + } + + // Check for both converted-to-camel and non-converted data property names + // If a data property was specified + if ( getByName ) { + + // First Try to find as-is property data + ret = thisCache[ name ]; + + // Test for null|undefined property data + if ( ret == null ) { + + // Try to find the camelCased property + ret = thisCache[ jQuery.camelCase( name ) ]; + } + } else { + ret = thisCache; + } + + return ret; + }, + + removeData: function( elem, name, pvt /* Internal Use Only */ ) { + if ( !jQuery.acceptData( elem ) ) { + return; + } + + var thisCache, i, l, + + // Reference to internal data cache key + internalKey = jQuery.expando, + + isNode = elem.nodeType, + + // See jQuery.data for more information + cache = isNode ? jQuery.cache : elem, + + // See jQuery.data for more information + id = isNode ? elem[ internalKey ] : internalKey; + + // If there is already no cache entry for this object, there is no + // purpose in continuing + if ( !cache[ id ] ) { + return; + } + + if ( name ) { + + thisCache = pvt ? cache[ id ] : cache[ id ].data; + + if ( thisCache ) { + + // Support array or space separated string names for data keys + if ( !jQuery.isArray( name ) ) { + + // try the string as a key before any manipulation + if ( name in thisCache ) { + name = [ name ]; + } else { + + // split the camel cased version by spaces unless a key with the spaces exists + name = jQuery.camelCase( name ); + if ( name in thisCache ) { + name = [ name ]; + } else { + name = name.split( " " ); + } + } + } + + for ( i = 0, l = name.length; i < l; i++ ) { + delete thisCache[ name[i] ]; + } + + // If there is no data left in the cache, we want to continue + // and let the cache object itself get destroyed + if ( !( pvt ? isEmptyDataObject : jQuery.isEmptyObject )( thisCache ) ) { + return; + } + } + } + + // See jQuery.data for more information + if ( !pvt ) { + delete cache[ id ].data; + + // Don't destroy the parent cache unless the internal data object + // had been the only thing left in it + if ( !isEmptyDataObject(cache[ id ]) ) { + return; + } + } + + // Browsers that fail expando deletion also refuse to delete expandos on + // the window, but it will allow it on all other JS objects; other browsers + // don't care + // Ensure that `cache` is not a window object #10080 + if ( jQuery.support.deleteExpando || !cache.setInterval ) { + delete cache[ id ]; + } else { + cache[ id ] = null; + } + + // We destroyed the cache and need to eliminate the expando on the node to avoid + // false lookups in the cache for entries that no longer exist + if ( isNode ) { + // IE does not allow us to delete expando properties from nodes, + // nor does it have a removeAttribute function on Document nodes; + // we must handle all of these cases + if ( jQuery.support.deleteExpando ) { + delete elem[ internalKey ]; + } else if ( elem.removeAttribute ) { + elem.removeAttribute( internalKey ); + } else { + elem[ internalKey ] = null; + } + } + }, + + // For internal use only. + _data: function( elem, name, data ) { + return jQuery.data( elem, name, data, true ); + }, + + // A method for determining if a DOM node can handle the data expando + acceptData: function( elem ) { + if ( elem.nodeName ) { + var match = jQuery.noData[ elem.nodeName.toLowerCase() ]; + + if ( match ) { + return !(match === true || elem.getAttribute("classid") !== match); + } + } + + return true; + } +}); + +jQuery.fn.extend({ + data: function( key, value ) { + var parts, attr, name, + data = null; + + if ( typeof key === "undefined" ) { + if ( this.length ) { + data = jQuery.data( this[0] ); + + if ( this[0].nodeType === 1 && !jQuery._data( this[0], "parsedAttrs" ) ) { + attr = this[0].attributes; + for ( var i = 0, l = attr.length; i < l; i++ ) { + name = attr[i].name; + + if ( name.indexOf( "data-" ) === 0 ) { + name = jQuery.camelCase( name.substring(5) ); + + dataAttr( this[0], name, data[ name ] ); + } + } + jQuery._data( this[0], "parsedAttrs", true ); + } + } + + return data; + + } else if ( typeof key === "object" ) { + return this.each(function() { + jQuery.data( this, key ); + }); + } + + parts = key.split("."); + parts[1] = parts[1] ? "." + parts[1] : ""; + + if ( value === undefined ) { + data = this.triggerHandler("getData" + parts[1] + "!", [parts[0]]); + + // Try to fetch any internally stored data first + if ( data === undefined && this.length ) { + data = jQuery.data( this[0], key ); + data = dataAttr( this[0], key, data ); + } + + return data === undefined && parts[1] ? + this.data( parts[0] ) : + data; + + } else { + return this.each(function() { + var self = jQuery( this ), + args = [ parts[0], value ]; + + self.triggerHandler( "setData" + parts[1] + "!", args ); + jQuery.data( this, key, value ); + self.triggerHandler( "changeData" + parts[1] + "!", args ); + }); + } + }, + + removeData: function( key ) { + return this.each(function() { + jQuery.removeData( this, key ); + }); + } +}); + +function dataAttr( elem, key, data ) { + // If nothing was found internally, try to fetch any + // data from the HTML5 data-* attribute + if ( data === undefined && elem.nodeType === 1 ) { + + var name = "data-" + key.replace( rmultiDash, "-$1" ).toLowerCase(); + + data = elem.getAttribute( name ); + + if ( typeof data === "string" ) { + try { + data = data === "true" ? true : + data === "false" ? false : + data === "null" ? null : + jQuery.isNumeric( data ) ? parseFloat( data ) : + rbrace.test( data ) ? jQuery.parseJSON( data ) : + data; + } catch( e ) {} + + // Make sure we set the data so it isn't changed later + jQuery.data( elem, key, data ); + + } else { + data = undefined; + } + } + + return data; +} + +// checks a cache object for emptiness +function isEmptyDataObject( obj ) { + for ( var name in obj ) { + + // if the public data object is empty, the private is still empty + if ( name === "data" && jQuery.isEmptyObject( obj[name] ) ) { + continue; + } + if ( name !== "toJSON" ) { + return false; + } + } + + return true; +} + + + + +function handleQueueMarkDefer( elem, type, src ) { + var deferDataKey = type + "defer", + queueDataKey = type + "queue", + markDataKey = type + "mark", + defer = jQuery._data( elem, deferDataKey ); + if ( defer && + ( src === "queue" || !jQuery._data(elem, queueDataKey) ) && + ( src === "mark" || !jQuery._data(elem, markDataKey) ) ) { + // Give room for hard-coded callbacks to fire first + // and eventually mark/queue something else on the element + setTimeout( function() { + if ( !jQuery._data( elem, queueDataKey ) && + !jQuery._data( elem, markDataKey ) ) { + jQuery.removeData( elem, deferDataKey, true ); + defer.fire(); + } + }, 0 ); + } +} + +jQuery.extend({ + + _mark: function( elem, type ) { + if ( elem ) { + type = ( type || "fx" ) + "mark"; + jQuery._data( elem, type, (jQuery._data( elem, type ) || 0) + 1 ); + } + }, + + _unmark: function( force, elem, type ) { + if ( force !== true ) { + type = elem; + elem = force; + force = false; + } + if ( elem ) { + type = type || "fx"; + var key = type + "mark", + count = force ? 0 : ( (jQuery._data( elem, key ) || 1) - 1 ); + if ( count ) { + jQuery._data( elem, key, count ); + } else { + jQuery.removeData( elem, key, true ); + handleQueueMarkDefer( elem, type, "mark" ); + } + } + }, + + queue: function( elem, type, data ) { + var q; + if ( elem ) { + type = ( type || "fx" ) + "queue"; + q = jQuery._data( elem, type ); + + // Speed up dequeue by getting out quickly if this is just a lookup + if ( data ) { + if ( !q || jQuery.isArray(data) ) { + q = jQuery._data( elem, type, jQuery.makeArray(data) ); + } else { + q.push( data ); + } + } + return q || []; + } + }, + + dequeue: function( elem, type ) { + type = type || "fx"; + + var queue = jQuery.queue( elem, type ), + fn = queue.shift(), + hooks = {}; + + // If the fx queue is dequeued, always remove the progress sentinel + if ( fn === "inprogress" ) { + fn = queue.shift(); + } + + if ( fn ) { + // Add a progress sentinel to prevent the fx queue from being + // automatically dequeued + if ( type === "fx" ) { + queue.unshift( "inprogress" ); + } + + jQuery._data( elem, type + ".run", hooks ); + fn.call( elem, function() { + jQuery.dequeue( elem, type ); + }, hooks ); + } + + if ( !queue.length ) { + jQuery.removeData( elem, type + "queue " + type + ".run", true ); + handleQueueMarkDefer( elem, type, "queue" ); + } + } +}); + +jQuery.fn.extend({ + queue: function( type, data ) { + if ( typeof type !== "string" ) { + data = type; + type = "fx"; + } + + if ( data === undefined ) { + return jQuery.queue( this[0], type ); + } + return this.each(function() { + var queue = jQuery.queue( this, type, data ); + + if ( type === "fx" && queue[0] !== "inprogress" ) { + jQuery.dequeue( this, type ); + } + }); + }, + dequeue: function( type ) { + return this.each(function() { + jQuery.dequeue( this, type ); + }); + }, + // Based off of the plugin by Clint Helfers, with permission. + // http://blindsignals.com/index.php/2009/07/jquery-delay/ + delay: function( time, type ) { + time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time; + type = type || "fx"; + + return this.queue( type, function( next, hooks ) { + var timeout = setTimeout( next, time ); + hooks.stop = function() { + clearTimeout( timeout ); + }; + }); + }, + clearQueue: function( type ) { + return this.queue( type || "fx", [] ); + }, + // Get a promise resolved when queues of a certain type + // are emptied (fx is the type by default) + promise: function( type, object ) { + if ( typeof type !== "string" ) { + object = type; + type = undefined; + } + type = type || "fx"; + var defer = jQuery.Deferred(), + elements = this, + i = elements.length, + count = 1, + deferDataKey = type + "defer", + queueDataKey = type + "queue", + markDataKey = type + "mark", + tmp; + function resolve() { + if ( !( --count ) ) { + defer.resolveWith( elements, [ elements ] ); + } + } + while( i-- ) { + if (( tmp = jQuery.data( elements[ i ], deferDataKey, undefined, true ) || + ( jQuery.data( elements[ i ], queueDataKey, undefined, true ) || + jQuery.data( elements[ i ], markDataKey, undefined, true ) ) && + jQuery.data( elements[ i ], deferDataKey, jQuery.Callbacks( "once memory" ), true ) )) { + count++; + tmp.add( resolve ); + } + } + resolve(); + return defer.promise(); + } +}); + + + + +var rclass = /[\n\t\r]/g, + rspace = /\s+/, + rreturn = /\r/g, + rtype = /^(?:button|input)$/i, + rfocusable = /^(?:button|input|object|select|textarea)$/i, + rclickable = /^a(?:rea)?$/i, + rboolean = /^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i, + getSetAttribute = jQuery.support.getSetAttribute, + nodeHook, boolHook, fixSpecified; + +jQuery.fn.extend({ + attr: function( name, value ) { + return jQuery.access( this, name, value, true, jQuery.attr ); + }, + + removeAttr: function( name ) { + return this.each(function() { + jQuery.removeAttr( this, name ); + }); + }, + + prop: function( name, value ) { + return jQuery.access( this, name, value, true, jQuery.prop ); + }, + + removeProp: function( name ) { + name = jQuery.propFix[ name ] || name; + return this.each(function() { + // try/catch handles cases where IE balks (such as removing a property on window) + try { + this[ name ] = undefined; + delete this[ name ]; + } catch( e ) {} + }); + }, + + addClass: function( value ) { + var classNames, i, l, elem, + setClass, c, cl; + + if ( jQuery.isFunction( value ) ) { + return this.each(function( j ) { + jQuery( this ).addClass( value.call(this, j, this.className) ); + }); + } + + if ( value && typeof value === "string" ) { + classNames = value.split( rspace ); + + for ( i = 0, l = this.length; i < l; i++ ) { + elem = this[ i ]; + + if ( elem.nodeType === 1 ) { + if ( !elem.className && classNames.length === 1 ) { + elem.className = value; + + } else { + setClass = " " + elem.className + " "; + + for ( c = 0, cl = classNames.length; c < cl; c++ ) { + if ( !~setClass.indexOf( " " + classNames[ c ] + " " ) ) { + setClass += classNames[ c ] + " "; + } + } + elem.className = jQuery.trim( setClass ); + } + } + } + } + + return this; + }, + + removeClass: function( value ) { + var classNames, i, l, elem, className, c, cl; + + if ( jQuery.isFunction( value ) ) { + return this.each(function( j ) { + jQuery( this ).removeClass( value.call(this, j, this.className) ); + }); + } + + if ( (value && typeof value === "string") || value === undefined ) { + classNames = ( value || "" ).split( rspace ); + + for ( i = 0, l = this.length; i < l; i++ ) { + elem = this[ i ]; + + if ( elem.nodeType === 1 && elem.className ) { + if ( value ) { + className = (" " + elem.className + " ").replace( rclass, " " ); + for ( c = 0, cl = classNames.length; c < cl; c++ ) { + className = className.replace(" " + classNames[ c ] + " ", " "); + } + elem.className = jQuery.trim( className ); + + } else { + elem.className = ""; + } + } + } + } + + return this; + }, + + toggleClass: function( value, stateVal ) { + var type = typeof value, + isBool = typeof stateVal === "boolean"; + + if ( jQuery.isFunction( value ) ) { + return this.each(function( i ) { + jQuery( this ).toggleClass( value.call(this, i, this.className, stateVal), stateVal ); + }); + } + + return this.each(function() { + if ( type === "string" ) { + // toggle individual class names + var className, + i = 0, + self = jQuery( this ), + state = stateVal, + classNames = value.split( rspace ); + + while ( (className = classNames[ i++ ]) ) { + // check each className given, space seperated list + state = isBool ? state : !self.hasClass( className ); + self[ state ? "addClass" : "removeClass" ]( className ); + } + + } else if ( type === "undefined" || type === "boolean" ) { + if ( this.className ) { + // store className if set + jQuery._data( this, "__className__", this.className ); + } + + // toggle whole className + this.className = this.className || value === false ? "" : jQuery._data( this, "__className__" ) || ""; + } + }); + }, + + hasClass: function( selector ) { + var className = " " + selector + " ", + i = 0, + l = this.length; + for ( ; i < l; i++ ) { + if ( this[i].nodeType === 1 && (" " + this[i].className + " ").replace(rclass, " ").indexOf( className ) > -1 ) { + return true; + } + } + + return false; + }, + + val: function( value ) { + var hooks, ret, isFunction, + elem = this[0]; + + if ( !arguments.length ) { + if ( elem ) { + hooks = jQuery.valHooks[ elem.nodeName.toLowerCase() ] || jQuery.valHooks[ elem.type ]; + + if ( hooks && "get" in hooks && (ret = hooks.get( elem, "value" )) !== undefined ) { + return ret; + } + + ret = elem.value; + + return typeof ret === "string" ? + // handle most common string cases + ret.replace(rreturn, "") : + // handle cases where value is null/undef or number + ret == null ? "" : ret; + } + + return; + } + + isFunction = jQuery.isFunction( value ); + + return this.each(function( i ) { + var self = jQuery(this), val; + + if ( this.nodeType !== 1 ) { + return; + } + + if ( isFunction ) { + val = value.call( this, i, self.val() ); + } else { + val = value; + } + + // Treat null/undefined as ""; convert numbers to string + if ( val == null ) { + val = ""; + } else if ( typeof val === "number" ) { + val += ""; + } else if ( jQuery.isArray( val ) ) { + val = jQuery.map(val, function ( value ) { + return value == null ? "" : value + ""; + }); + } + + hooks = jQuery.valHooks[ this.nodeName.toLowerCase() ] || jQuery.valHooks[ this.type ]; + + // If set returns undefined, fall back to normal setting + if ( !hooks || !("set" in hooks) || hooks.set( this, val, "value" ) === undefined ) { + this.value = val; + } + }); + } +}); + +jQuery.extend({ + valHooks: { + option: { + get: function( elem ) { + // attributes.value is undefined in Blackberry 4.7 but + // uses .value. See #6932 + var val = elem.attributes.value; + return !val || val.specified ? elem.value : elem.text; + } + }, + select: { + get: function( elem ) { + var value, i, max, option, + index = elem.selectedIndex, + values = [], + options = elem.options, + one = elem.type === "select-one"; + + // Nothing was selected + if ( index < 0 ) { + return null; + } + + // Loop through all the selected options + i = one ? index : 0; + max = one ? index + 1 : options.length; + for ( ; i < max; i++ ) { + option = options[ i ]; + + // Don't return options that are disabled or in a disabled optgroup + if ( option.selected && (jQuery.support.optDisabled ? !option.disabled : option.getAttribute("disabled") === null) && + (!option.parentNode.disabled || !jQuery.nodeName( option.parentNode, "optgroup" )) ) { + + // Get the specific value for the option + value = jQuery( option ).val(); + + // We don't need an array for one selects + if ( one ) { + return value; + } + + // Multi-Selects return an array + values.push( value ); + } + } + + // Fixes Bug #2551 -- select.val() broken in IE after form.reset() + if ( one && !values.length && options.length ) { + return jQuery( options[ index ] ).val(); + } + + return values; + }, + + set: function( elem, value ) { + var values = jQuery.makeArray( value ); + + jQuery(elem).find("option").each(function() { + this.selected = jQuery.inArray( jQuery(this).val(), values ) >= 0; + }); + + if ( !values.length ) { + elem.selectedIndex = -1; + } + return values; + } + } + }, + + attrFn: { + val: true, + css: true, + html: true, + text: true, + data: true, + width: true, + height: true, + offset: true + }, + + attr: function( elem, name, value, pass ) { + var ret, hooks, notxml, + nType = elem.nodeType; + + // don't get/set attributes on text, comment and attribute nodes + if ( !elem || nType === 3 || nType === 8 || nType === 2 ) { + return; + } + + if ( pass && name in jQuery.attrFn ) { + return jQuery( elem )[ name ]( value ); + } + + // Fallback to prop when attributes are not supported + if ( typeof elem.getAttribute === "undefined" ) { + return jQuery.prop( elem, name, value ); + } + + notxml = nType !== 1 || !jQuery.isXMLDoc( elem ); + + // All attributes are lowercase + // Grab necessary hook if one is defined + if ( notxml ) { + name = name.toLowerCase(); + hooks = jQuery.attrHooks[ name ] || ( rboolean.test( name ) ? boolHook : nodeHook ); + } + + if ( value !== undefined ) { + + if ( value === null ) { + jQuery.removeAttr( elem, name ); + return; + + } else if ( hooks && "set" in hooks && notxml && (ret = hooks.set( elem, value, name )) !== undefined ) { + return ret; + + } else { + elem.setAttribute( name, "" + value ); + return value; + } + + } else if ( hooks && "get" in hooks && notxml && (ret = hooks.get( elem, name )) !== null ) { + return ret; + + } else { + + ret = elem.getAttribute( name ); + + // Non-existent attributes return null, we normalize to undefined + return ret === null ? + undefined : + ret; + } + }, + + removeAttr: function( elem, value ) { + var propName, attrNames, name, l, + i = 0; + + if ( value && elem.nodeType === 1 ) { + attrNames = value.toLowerCase().split( rspace ); + l = attrNames.length; + + for ( ; i < l; i++ ) { + name = attrNames[ i ]; + + if ( name ) { + propName = jQuery.propFix[ name ] || name; + + // See #9699 for explanation of this approach (setting first, then removal) + jQuery.attr( elem, name, "" ); + elem.removeAttribute( getSetAttribute ? name : propName ); + + // Set corresponding property to false for boolean attributes + if ( rboolean.test( name ) && propName in elem ) { + elem[ propName ] = false; + } + } + } + } + }, + + attrHooks: { + type: { + set: function( elem, value ) { + // We can't allow the type property to be changed (since it causes problems in IE) + if ( rtype.test( elem.nodeName ) && elem.parentNode ) { + jQuery.error( "type property can't be changed" ); + } else if ( !jQuery.support.radioValue && value === "radio" && jQuery.nodeName(elem, "input") ) { + // Setting the type on a radio button after the value resets the value in IE6-9 + // Reset value to it's default in case type is set after value + // This is for element creation + var val = elem.value; + elem.setAttribute( "type", value ); + if ( val ) { + elem.value = val; + } + return value; + } + } + }, + // Use the value property for back compat + // Use the nodeHook for button elements in IE6/7 (#1954) + value: { + get: function( elem, name ) { + if ( nodeHook && jQuery.nodeName( elem, "button" ) ) { + return nodeHook.get( elem, name ); + } + return name in elem ? + elem.value : + null; + }, + set: function( elem, value, name ) { + if ( nodeHook && jQuery.nodeName( elem, "button" ) ) { + return nodeHook.set( elem, value, name ); + } + // Does not return so that setAttribute is also used + elem.value = value; + } + } + }, + + propFix: { + tabindex: "tabIndex", + readonly: "readOnly", + "for": "htmlFor", + "class": "className", + maxlength: "maxLength", + cellspacing: "cellSpacing", + cellpadding: "cellPadding", + rowspan: "rowSpan", + colspan: "colSpan", + usemap: "useMap", + frameborder: "frameBorder", + contenteditable: "contentEditable" + }, + + prop: function( elem, name, value ) { + var ret, hooks, notxml, + nType = elem.nodeType; + + // don't get/set properties on text, comment and attribute nodes + if ( !elem || nType === 3 || nType === 8 || nType === 2 ) { + return; + } + + notxml = nType !== 1 || !jQuery.isXMLDoc( elem ); + + if ( notxml ) { + // Fix name and attach hooks + name = jQuery.propFix[ name ] || name; + hooks = jQuery.propHooks[ name ]; + } + + if ( value !== undefined ) { + if ( hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) { + return ret; + + } else { + return ( elem[ name ] = value ); + } + + } else { + if ( hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ) { + return ret; + + } else { + return elem[ name ]; + } + } + }, + + propHooks: { + tabIndex: { + get: function( elem ) { + // elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set + // http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/ + var attributeNode = elem.getAttributeNode("tabindex"); + + return attributeNode && attributeNode.specified ? + parseInt( attributeNode.value, 10 ) : + rfocusable.test( elem.nodeName ) || rclickable.test( elem.nodeName ) && elem.href ? + 0 : + undefined; + } + } + } +}); + +// Add the tabIndex propHook to attrHooks for back-compat (different case is intentional) +jQuery.attrHooks.tabindex = jQuery.propHooks.tabIndex; + +// Hook for boolean attributes +boolHook = { + get: function( elem, name ) { + // Align boolean attributes with corresponding properties + // Fall back to attribute presence where some booleans are not supported + var attrNode, + property = jQuery.prop( elem, name ); + return property === true || typeof property !== "boolean" && ( attrNode = elem.getAttributeNode(name) ) && attrNode.nodeValue !== false ? + name.toLowerCase() : + undefined; + }, + set: function( elem, value, name ) { + var propName; + if ( value === false ) { + // Remove boolean attributes when set to false + jQuery.removeAttr( elem, name ); + } else { + // value is true since we know at this point it's type boolean and not false + // Set boolean attributes to the same name and set the DOM property + propName = jQuery.propFix[ name ] || name; + if ( propName in elem ) { + // Only set the IDL specifically if it already exists on the element + elem[ propName ] = true; + } + + elem.setAttribute( name, name.toLowerCase() ); + } + return name; + } +}; + +// IE6/7 do not support getting/setting some attributes with get/setAttribute +if ( !getSetAttribute ) { + + fixSpecified = { + name: true, + id: true + }; + + // Use this for any attribute in IE6/7 + // This fixes almost every IE6/7 issue + nodeHook = jQuery.valHooks.button = { + get: function( elem, name ) { + var ret; + ret = elem.getAttributeNode( name ); + return ret && ( fixSpecified[ name ] ? ret.nodeValue !== "" : ret.specified ) ? + ret.nodeValue : + undefined; + }, + set: function( elem, value, name ) { + // Set the existing or create a new attribute node + var ret = elem.getAttributeNode( name ); + if ( !ret ) { + ret = document.createAttribute( name ); + elem.setAttributeNode( ret ); + } + return ( ret.nodeValue = value + "" ); + } + }; + + // Apply the nodeHook to tabindex + jQuery.attrHooks.tabindex.set = nodeHook.set; + + // Set width and height to auto instead of 0 on empty string( Bug #8150 ) + // This is for removals + jQuery.each([ "width", "height" ], function( i, name ) { + jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], { + set: function( elem, value ) { + if ( value === "" ) { + elem.setAttribute( name, "auto" ); + return value; + } + } + }); + }); + + // Set contenteditable to false on removals(#10429) + // Setting to empty string throws an error as an invalid value + jQuery.attrHooks.contenteditable = { + get: nodeHook.get, + set: function( elem, value, name ) { + if ( value === "" ) { + value = "false"; + } + nodeHook.set( elem, value, name ); + } + }; +} + + +// Some attributes require a special call on IE +if ( !jQuery.support.hrefNormalized ) { + jQuery.each([ "href", "src", "width", "height" ], function( i, name ) { + jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], { + get: function( elem ) { + var ret = elem.getAttribute( name, 2 ); + return ret === null ? undefined : ret; + } + }); + }); +} + +if ( !jQuery.support.style ) { + jQuery.attrHooks.style = { + get: function( elem ) { + // Return undefined in the case of empty string + // Normalize to lowercase since IE uppercases css property names + return elem.style.cssText.toLowerCase() || undefined; + }, + set: function( elem, value ) { + return ( elem.style.cssText = "" + value ); + } + }; +} + +// Safari mis-reports the default selected property of an option +// Accessing the parent's selectedIndex property fixes it +if ( !jQuery.support.optSelected ) { + jQuery.propHooks.selected = jQuery.extend( jQuery.propHooks.selected, { + get: function( elem ) { + var parent = elem.parentNode; + + if ( parent ) { + parent.selectedIndex; + + // Make sure that it also works with optgroups, see #5701 + if ( parent.parentNode ) { + parent.parentNode.selectedIndex; + } + } + return null; + } + }); +} + +// IE6/7 call enctype encoding +if ( !jQuery.support.enctype ) { + jQuery.propFix.enctype = "encoding"; +} + +// Radios and checkboxes getter/setter +if ( !jQuery.support.checkOn ) { + jQuery.each([ "radio", "checkbox" ], function() { + jQuery.valHooks[ this ] = { + get: function( elem ) { + // Handle the case where in Webkit "" is returned instead of "on" if a value isn't specified + return elem.getAttribute("value") === null ? "on" : elem.value; + } + }; + }); +} +jQuery.each([ "radio", "checkbox" ], function() { + jQuery.valHooks[ this ] = jQuery.extend( jQuery.valHooks[ this ], { + set: function( elem, value ) { + if ( jQuery.isArray( value ) ) { + return ( elem.checked = jQuery.inArray( jQuery(elem).val(), value ) >= 0 ); + } + } + }); +}); + + + + +var rformElems = /^(?:textarea|input|select)$/i, + rtypenamespace = /^([^\.]*)?(?:\.(.+))?$/, + rhoverHack = /\bhover(\.\S+)?\b/, + rkeyEvent = /^key/, + rmouseEvent = /^(?:mouse|contextmenu)|click/, + rfocusMorph = /^(?:focusinfocus|focusoutblur)$/, + rquickIs = /^(\w*)(?:#([\w\-]+))?(?:\.([\w\-]+))?$/, + quickParse = function( selector ) { + var quick = rquickIs.exec( selector ); + if ( quick ) { + // 0 1 2 3 + // [ _, tag, id, class ] + quick[1] = ( quick[1] || "" ).toLowerCase(); + quick[3] = quick[3] && new RegExp( "(?:^|\\s)" + quick[3] + "(?:\\s|$)" ); + } + return quick; + }, + quickIs = function( elem, m ) { + var attrs = elem.attributes || {}; + return ( + (!m[1] || elem.nodeName.toLowerCase() === m[1]) && + (!m[2] || (attrs.id || {}).value === m[2]) && + (!m[3] || m[3].test( (attrs[ "class" ] || {}).value )) + ); + }, + hoverHack = function( events ) { + return jQuery.event.special.hover ? events : events.replace( rhoverHack, "mouseenter$1 mouseleave$1" ); + }; + +/* + * Helper functions for managing events -- not part of the public interface. + * Props to Dean Edwards' addEvent library for many of the ideas. + */ +jQuery.event = { + + add: function( elem, types, handler, data, selector ) { + + var elemData, eventHandle, events, + t, tns, type, namespaces, handleObj, + handleObjIn, quick, handlers, special; + + // Don't attach events to noData or text/comment nodes (allow plain objects tho) + if ( elem.nodeType === 3 || elem.nodeType === 8 || !types || !handler || !(elemData = jQuery._data( elem )) ) { + return; + } + + // Caller can pass in an object of custom data in lieu of the handler + if ( handler.handler ) { + handleObjIn = handler; + handler = handleObjIn.handler; + } + + // Make sure that the handler has a unique ID, used to find/remove it later + if ( !handler.guid ) { + handler.guid = jQuery.guid++; + } + + // Init the element's event structure and main handler, if this is the first + events = elemData.events; + if ( !events ) { + elemData.events = events = {}; + } + eventHandle = elemData.handle; + if ( !eventHandle ) { + elemData.handle = eventHandle = function( e ) { + // Discard the second event of a jQuery.event.trigger() and + // when an event is called after a page has unloaded + return typeof jQuery !== "undefined" && (!e || jQuery.event.triggered !== e.type) ? + jQuery.event.dispatch.apply( eventHandle.elem, arguments ) : + undefined; + }; + // Add elem as a property of the handle fn to prevent a memory leak with IE non-native events + eventHandle.elem = elem; + } + + // Handle multiple events separated by a space + // jQuery(...).bind("mouseover mouseout", fn); + types = jQuery.trim( hoverHack(types) ).split( " " ); + for ( t = 0; t < types.length; t++ ) { + + tns = rtypenamespace.exec( types[t] ) || []; + type = tns[1]; + namespaces = ( tns[2] || "" ).split( "." ).sort(); + + // If event changes its type, use the special event handlers for the changed type + special = jQuery.event.special[ type ] || {}; + + // If selector defined, determine special event api type, otherwise given type + type = ( selector ? special.delegateType : special.bindType ) || type; + + // Update special based on newly reset type + special = jQuery.event.special[ type ] || {}; + + // handleObj is passed to all event handlers + handleObj = jQuery.extend({ + type: type, + origType: tns[1], + data: data, + handler: handler, + guid: handler.guid, + selector: selector, + quick: quickParse( selector ), + namespace: namespaces.join(".") + }, handleObjIn ); + + // Init the event handler queue if we're the first + handlers = events[ type ]; + if ( !handlers ) { + handlers = events[ type ] = []; + handlers.delegateCount = 0; + + // Only use addEventListener/attachEvent if the special events handler returns false + if ( !special.setup || special.setup.call( elem, data, namespaces, eventHandle ) === false ) { + // Bind the global event handler to the element + if ( elem.addEventListener ) { + elem.addEventListener( type, eventHandle, false ); + + } else if ( elem.attachEvent ) { + elem.attachEvent( "on" + type, eventHandle ); + } + } + } + + if ( special.add ) { + special.add.call( elem, handleObj ); + + if ( !handleObj.handler.guid ) { + handleObj.handler.guid = handler.guid; + } + } + + // Add to the element's handler list, delegates in front + if ( selector ) { + handlers.splice( handlers.delegateCount++, 0, handleObj ); + } else { + handlers.push( handleObj ); + } + + // Keep track of which events have ever been used, for event optimization + jQuery.event.global[ type ] = true; + } + + // Nullify elem to prevent memory leaks in IE + elem = null; + }, + + global: {}, + + // Detach an event or set of events from an element + remove: function( elem, types, handler, selector, mappedTypes ) { + + var elemData = jQuery.hasData( elem ) && jQuery._data( elem ), + t, tns, type, origType, namespaces, origCount, + j, events, special, handle, eventType, handleObj; + + if ( !elemData || !(events = elemData.events) ) { + return; + } + + // Once for each type.namespace in types; type may be omitted + types = jQuery.trim( hoverHack( types || "" ) ).split(" "); + for ( t = 0; t < types.length; t++ ) { + tns = rtypenamespace.exec( types[t] ) || []; + type = origType = tns[1]; + namespaces = tns[2]; + + // Unbind all events (on this namespace, if provided) for the element + if ( !type ) { + for ( type in events ) { + jQuery.event.remove( elem, type + types[ t ], handler, selector, true ); + } + continue; + } + + special = jQuery.event.special[ type ] || {}; + type = ( selector? special.delegateType : special.bindType ) || type; + eventType = events[ type ] || []; + origCount = eventType.length; + namespaces = namespaces ? new RegExp("(^|\\.)" + namespaces.split(".").sort().join("\\.(?:.*\\.)?") + "(\\.|$)") : null; + + // Remove matching events + for ( j = 0; j < eventType.length; j++ ) { + handleObj = eventType[ j ]; + + if ( ( mappedTypes || origType === handleObj.origType ) && + ( !handler || handler.guid === handleObj.guid ) && + ( !namespaces || namespaces.test( handleObj.namespace ) ) && + ( !selector || selector === handleObj.selector || selector === "**" && handleObj.selector ) ) { + eventType.splice( j--, 1 ); + + if ( handleObj.selector ) { + eventType.delegateCount--; + } + if ( special.remove ) { + special.remove.call( elem, handleObj ); + } + } + } + + // Remove generic event handler if we removed something and no more handlers exist + // (avoids potential for endless recursion during removal of special event handlers) + if ( eventType.length === 0 && origCount !== eventType.length ) { + if ( !special.teardown || special.teardown.call( elem, namespaces ) === false ) { + jQuery.removeEvent( elem, type, elemData.handle ); + } + + delete events[ type ]; + } + } + + // Remove the expando if it's no longer used + if ( jQuery.isEmptyObject( events ) ) { + handle = elemData.handle; + if ( handle ) { + handle.elem = null; + } + + // removeData also checks for emptiness and clears the expando if empty + // so use it instead of delete + jQuery.removeData( elem, [ "events", "handle" ], true ); + } + }, + + // Events that are safe to short-circuit if no handlers are attached. + // Native DOM events should not be added, they may have inline handlers. + customEvent: { + "getData": true, + "setData": true, + "changeData": true + }, + + trigger: function( event, data, elem, onlyHandlers ) { + // Don't do events on text and comment nodes + if ( elem && (elem.nodeType === 3 || elem.nodeType === 8) ) { + return; + } + + // Event object or event type + var type = event.type || event, + namespaces = [], + cache, exclusive, i, cur, old, ontype, special, handle, eventPath, bubbleType; + + // focus/blur morphs to focusin/out; ensure we're not firing them right now + if ( rfocusMorph.test( type + jQuery.event.triggered ) ) { + return; + } + + if ( type.indexOf( "!" ) >= 0 ) { + // Exclusive events trigger only for the exact event (no namespaces) + type = type.slice(0, -1); + exclusive = true; + } + + if ( type.indexOf( "." ) >= 0 ) { + // Namespaced trigger; create a regexp to match event type in handle() + namespaces = type.split("."); + type = namespaces.shift(); + namespaces.sort(); + } + + if ( (!elem || jQuery.event.customEvent[ type ]) && !jQuery.event.global[ type ] ) { + // No jQuery handlers for this event type, and it can't have inline handlers + return; + } + + // Caller can pass in an Event, Object, or just an event type string + event = typeof event === "object" ? + // jQuery.Event object + event[ jQuery.expando ] ? event : + // Object literal + new jQuery.Event( type, event ) : + // Just the event type (string) + new jQuery.Event( type ); + + event.type = type; + event.isTrigger = true; + event.exclusive = exclusive; + event.namespace = namespaces.join( "." ); + event.namespace_re = event.namespace? new RegExp("(^|\\.)" + namespaces.join("\\.(?:.*\\.)?") + "(\\.|$)") : null; + ontype = type.indexOf( ":" ) < 0 ? "on" + type : ""; + + // Handle a global trigger + if ( !elem ) { + + // TODO: Stop taunting the data cache; remove global events and always attach to document + cache = jQuery.cache; + for ( i in cache ) { + if ( cache[ i ].events && cache[ i ].events[ type ] ) { + jQuery.event.trigger( event, data, cache[ i ].handle.elem, true ); + } + } + return; + } + + // Clean up the event in case it is being reused + event.result = undefined; + if ( !event.target ) { + event.target = elem; + } + + // Clone any incoming data and prepend the event, creating the handler arg list + data = data != null ? jQuery.makeArray( data ) : []; + data.unshift( event ); + + // Allow special events to draw outside the lines + special = jQuery.event.special[ type ] || {}; + if ( special.trigger && special.trigger.apply( elem, data ) === false ) { + return; + } + + // Determine event propagation path in advance, per W3C events spec (#9951) + // Bubble up to document, then to window; watch for a global ownerDocument var (#9724) + eventPath = [[ elem, special.bindType || type ]]; + if ( !onlyHandlers && !special.noBubble && !jQuery.isWindow( elem ) ) { + + bubbleType = special.delegateType || type; + cur = rfocusMorph.test( bubbleType + type ) ? elem : elem.parentNode; + old = null; + for ( ; cur; cur = cur.parentNode ) { + eventPath.push([ cur, bubbleType ]); + old = cur; + } + + // Only add window if we got to document (e.g., not plain obj or detached DOM) + if ( old && old === elem.ownerDocument ) { + eventPath.push([ old.defaultView || old.parentWindow || window, bubbleType ]); + } + } + + // Fire handlers on the event path + for ( i = 0; i < eventPath.length && !event.isPropagationStopped(); i++ ) { + + cur = eventPath[i][0]; + event.type = eventPath[i][1]; + + handle = ( jQuery._data( cur, "events" ) || {} )[ event.type ] && jQuery._data( cur, "handle" ); + if ( handle ) { + handle.apply( cur, data ); + } + // Note that this is a bare JS function and not a jQuery handler + handle = ontype && cur[ ontype ]; + if ( handle && jQuery.acceptData( cur ) && handle.apply( cur, data ) === false ) { + event.preventDefault(); + } + } + event.type = type; + + // If nobody prevented the default action, do it now + if ( !onlyHandlers && !event.isDefaultPrevented() ) { + + if ( (!special._default || special._default.apply( elem.ownerDocument, data ) === false) && + !(type === "click" && jQuery.nodeName( elem, "a" )) && jQuery.acceptData( elem ) ) { + + // Call a native DOM method on the target with the same name name as the event. + // Can't use an .isFunction() check here because IE6/7 fails that test. + // Don't do default actions on window, that's where global variables be (#6170) + // IE<9 dies on focus/blur to hidden element (#1486) + if ( ontype && elem[ type ] && ((type !== "focus" && type !== "blur") || event.target.offsetWidth !== 0) && !jQuery.isWindow( elem ) ) { + + // Don't re-trigger an onFOO event when we call its FOO() method + old = elem[ ontype ]; + + if ( old ) { + elem[ ontype ] = null; + } + + // Prevent re-triggering of the same event, since we already bubbled it above + jQuery.event.triggered = type; + elem[ type ](); + jQuery.event.triggered = undefined; + + if ( old ) { + elem[ ontype ] = old; + } + } + } + } + + return event.result; + }, + + dispatch: function( event ) { + + // Make a writable jQuery.Event from the native event object + event = jQuery.event.fix( event || window.event ); + + var handlers = ( (jQuery._data( this, "events" ) || {} )[ event.type ] || []), + delegateCount = handlers.delegateCount, + args = [].slice.call( arguments, 0 ), + run_all = !event.exclusive && !event.namespace, + handlerQueue = [], + i, j, cur, jqcur, ret, selMatch, matched, matches, handleObj, sel, related; + + // Use the fix-ed jQuery.Event rather than the (read-only) native event + args[0] = event; + event.delegateTarget = this; + + // Determine handlers that should run if there are delegated events + // Avoid disabled elements in IE (#6911) and non-left-click bubbling in Firefox (#3861) + if ( delegateCount && !event.target.disabled && !(event.button && event.type === "click") ) { + + // Pregenerate a single jQuery object for reuse with .is() + jqcur = jQuery(this); + jqcur.context = this.ownerDocument || this; + + for ( cur = event.target; cur != this; cur = cur.parentNode || this ) { + selMatch = {}; + matches = []; + jqcur[0] = cur; + for ( i = 0; i < delegateCount; i++ ) { + handleObj = handlers[ i ]; + sel = handleObj.selector; + + if ( selMatch[ sel ] === undefined ) { + selMatch[ sel ] = ( + handleObj.quick ? quickIs( cur, handleObj.quick ) : jqcur.is( sel ) + ); + } + if ( selMatch[ sel ] ) { + matches.push( handleObj ); + } + } + if ( matches.length ) { + handlerQueue.push({ elem: cur, matches: matches }); + } + } + } + + // Add the remaining (directly-bound) handlers + if ( handlers.length > delegateCount ) { + handlerQueue.push({ elem: this, matches: handlers.slice( delegateCount ) }); + } + + // Run delegates first; they may want to stop propagation beneath us + for ( i = 0; i < handlerQueue.length && !event.isPropagationStopped(); i++ ) { + matched = handlerQueue[ i ]; + event.currentTarget = matched.elem; + + for ( j = 0; j < matched.matches.length && !event.isImmediatePropagationStopped(); j++ ) { + handleObj = matched.matches[ j ]; + + // Triggered event must either 1) be non-exclusive and have no namespace, or + // 2) have namespace(s) a subset or equal to those in the bound event (both can have no namespace). + if ( run_all || (!event.namespace && !handleObj.namespace) || event.namespace_re && event.namespace_re.test( handleObj.namespace ) ) { + + event.data = handleObj.data; + event.handleObj = handleObj; + + ret = ( (jQuery.event.special[ handleObj.origType ] || {}).handle || handleObj.handler ) + .apply( matched.elem, args ); + + if ( ret !== undefined ) { + event.result = ret; + if ( ret === false ) { + event.preventDefault(); + event.stopPropagation(); + } + } + } + } + } + + return event.result; + }, + + // Includes some event props shared by KeyEvent and MouseEvent + // *** attrChange attrName relatedNode srcElement are not normalized, non-W3C, deprecated, will be removed in 1.8 *** + props: "attrChange attrName relatedNode srcElement altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "), + + fixHooks: {}, + + keyHooks: { + props: "char charCode key keyCode".split(" "), + filter: function( event, original ) { + + // Add which for key events + if ( event.which == null ) { + event.which = original.charCode != null ? original.charCode : original.keyCode; + } + + return event; + } + }, + + mouseHooks: { + props: "button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "), + filter: function( event, original ) { + var eventDoc, doc, body, + button = original.button, + fromElement = original.fromElement; + + // Calculate pageX/Y if missing and clientX/Y available + if ( event.pageX == null && original.clientX != null ) { + eventDoc = event.target.ownerDocument || document; + doc = eventDoc.documentElement; + body = eventDoc.body; + + event.pageX = original.clientX + ( doc && doc.scrollLeft || body && body.scrollLeft || 0 ) - ( doc && doc.clientLeft || body && body.clientLeft || 0 ); + event.pageY = original.clientY + ( doc && doc.scrollTop || body && body.scrollTop || 0 ) - ( doc && doc.clientTop || body && body.clientTop || 0 ); + } + + // Add relatedTarget, if necessary + if ( !event.relatedTarget && fromElement ) { + event.relatedTarget = fromElement === event.target ? original.toElement : fromElement; + } + + // Add which for click: 1 === left; 2 === middle; 3 === right + // Note: button is not normalized, so don't use it + if ( !event.which && button !== undefined ) { + event.which = ( button & 1 ? 1 : ( button & 2 ? 3 : ( button & 4 ? 2 : 0 ) ) ); + } + + return event; + } + }, + + fix: function( event ) { + if ( event[ jQuery.expando ] ) { + return event; + } + + // Create a writable copy of the event object and normalize some properties + var i, prop, + originalEvent = event, + fixHook = jQuery.event.fixHooks[ event.type ] || {}, + copy = fixHook.props ? this.props.concat( fixHook.props ) : this.props; + + event = jQuery.Event( originalEvent ); + + for ( i = copy.length; i; ) { + prop = copy[ --i ]; + event[ prop ] = originalEvent[ prop ]; + } + + // Fix target property, if necessary (#1925, IE 6/7/8 & Safari2) + if ( !event.target ) { + event.target = originalEvent.srcElement || document; + } + + // Target should not be a text node (#504, Safari) + if ( event.target.nodeType === 3 ) { + event.target = event.target.parentNode; + } + + // For mouse/key events; add metaKey if it's not there (#3368, IE6/7/8) + if ( event.metaKey === undefined ) { + event.metaKey = event.ctrlKey; + } + + return fixHook.filter? fixHook.filter( event, originalEvent ) : event; + }, + + special: { + ready: { + // Make sure the ready event is setup + setup: jQuery.bindReady + }, + + load: { + // Prevent triggered image.load events from bubbling to window.load + noBubble: true + }, + + focus: { + delegateType: "focusin" + }, + blur: { + delegateType: "focusout" + }, + + beforeunload: { + setup: function( data, namespaces, eventHandle ) { + // We only want to do this special case on windows + if ( jQuery.isWindow( this ) ) { + this.onbeforeunload = eventHandle; + } + }, + + teardown: function( namespaces, eventHandle ) { + if ( this.onbeforeunload === eventHandle ) { + this.onbeforeunload = null; + } + } + } + }, + + simulate: function( type, elem, event, bubble ) { + // Piggyback on a donor event to simulate a different one. + // Fake originalEvent to avoid donor's stopPropagation, but if the + // simulated event prevents default then we do the same on the donor. + var e = jQuery.extend( + new jQuery.Event(), + event, + { type: type, + isSimulated: true, + originalEvent: {} + } + ); + if ( bubble ) { + jQuery.event.trigger( e, null, elem ); + } else { + jQuery.event.dispatch.call( elem, e ); + } + if ( e.isDefaultPrevented() ) { + event.preventDefault(); + } + } +}; + +// Some plugins are using, but it's undocumented/deprecated and will be removed. +// The 1.7 special event interface should provide all the hooks needed now. +jQuery.event.handle = jQuery.event.dispatch; + +jQuery.removeEvent = document.removeEventListener ? + function( elem, type, handle ) { + if ( elem.removeEventListener ) { + elem.removeEventListener( type, handle, false ); + } + } : + function( elem, type, handle ) { + if ( elem.detachEvent ) { + elem.detachEvent( "on" + type, handle ); + } + }; + +jQuery.Event = function( src, props ) { + // Allow instantiation without the 'new' keyword + if ( !(this instanceof jQuery.Event) ) { + return new jQuery.Event( src, props ); + } + + // Event object + if ( src && src.type ) { + this.originalEvent = src; + this.type = src.type; + + // Events bubbling up the document may have been marked as prevented + // by a handler lower down the tree; reflect the correct value. + this.isDefaultPrevented = ( src.defaultPrevented || src.returnValue === false || + src.getPreventDefault && src.getPreventDefault() ) ? returnTrue : returnFalse; + + // Event type + } else { + this.type = src; + } + + // Put explicitly provided properties onto the event object + if ( props ) { + jQuery.extend( this, props ); + } + + // Create a timestamp if incoming event doesn't have one + this.timeStamp = src && src.timeStamp || jQuery.now(); + + // Mark it as fixed + this[ jQuery.expando ] = true; +}; + +function returnFalse() { + return false; +} +function returnTrue() { + return true; +} + +// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding +// http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html +jQuery.Event.prototype = { + preventDefault: function() { + this.isDefaultPrevented = returnTrue; + + var e = this.originalEvent; + if ( !e ) { + return; + } + + // if preventDefault exists run it on the original event + if ( e.preventDefault ) { + e.preventDefault(); + + // otherwise set the returnValue property of the original event to false (IE) + } else { + e.returnValue = false; + } + }, + stopPropagation: function() { + this.isPropagationStopped = returnTrue; + + var e = this.originalEvent; + if ( !e ) { + return; + } + // if stopPropagation exists run it on the original event + if ( e.stopPropagation ) { + e.stopPropagation(); + } + // otherwise set the cancelBubble property of the original event to true (IE) + e.cancelBubble = true; + }, + stopImmediatePropagation: function() { + this.isImmediatePropagationStopped = returnTrue; + this.stopPropagation(); + }, + isDefaultPrevented: returnFalse, + isPropagationStopped: returnFalse, + isImmediatePropagationStopped: returnFalse +}; + +// Create mouseenter/leave events using mouseover/out and event-time checks +jQuery.each({ + mouseenter: "mouseover", + mouseleave: "mouseout" +}, function( orig, fix ) { + jQuery.event.special[ orig ] = { + delegateType: fix, + bindType: fix, + + handle: function( event ) { + var target = this, + related = event.relatedTarget, + handleObj = event.handleObj, + selector = handleObj.selector, + ret; + + // For mousenter/leave call the handler if related is outside the target. + // NB: No relatedTarget if the mouse left/entered the browser window + if ( !related || (related !== target && !jQuery.contains( target, related )) ) { + event.type = handleObj.origType; + ret = handleObj.handler.apply( this, arguments ); + event.type = fix; + } + return ret; + } + }; +}); + +// IE submit delegation +if ( !jQuery.support.submitBubbles ) { + + jQuery.event.special.submit = { + setup: function() { + // Only need this for delegated form submit events + if ( jQuery.nodeName( this, "form" ) ) { + return false; + } + + // Lazy-add a submit handler when a descendant form may potentially be submitted + jQuery.event.add( this, "click._submit keypress._submit", function( e ) { + // Node name check avoids a VML-related crash in IE (#9807) + var elem = e.target, + form = jQuery.nodeName( elem, "input" ) || jQuery.nodeName( elem, "button" ) ? elem.form : undefined; + if ( form && !form._submit_attached ) { + jQuery.event.add( form, "submit._submit", function( event ) { + // If form was submitted by the user, bubble the event up the tree + if ( this.parentNode && !event.isTrigger ) { + jQuery.event.simulate( "submit", this.parentNode, event, true ); + } + }); + form._submit_attached = true; + } + }); + // return undefined since we don't need an event listener + }, + + teardown: function() { + // Only need this for delegated form submit events + if ( jQuery.nodeName( this, "form" ) ) { + return false; + } + + // Remove delegated handlers; cleanData eventually reaps submit handlers attached above + jQuery.event.remove( this, "._submit" ); + } + }; +} + +// IE change delegation and checkbox/radio fix +if ( !jQuery.support.changeBubbles ) { + + jQuery.event.special.change = { + + setup: function() { + + if ( rformElems.test( this.nodeName ) ) { + // IE doesn't fire change on a check/radio until blur; trigger it on click + // after a propertychange. Eat the blur-change in special.change.handle. + // This still fires onchange a second time for check/radio after blur. + if ( this.type === "checkbox" || this.type === "radio" ) { + jQuery.event.add( this, "propertychange._change", function( event ) { + if ( event.originalEvent.propertyName === "checked" ) { + this._just_changed = true; + } + }); + jQuery.event.add( this, "click._change", function( event ) { + if ( this._just_changed && !event.isTrigger ) { + this._just_changed = false; + jQuery.event.simulate( "change", this, event, true ); + } + }); + } + return false; + } + // Delegated event; lazy-add a change handler on descendant inputs + jQuery.event.add( this, "beforeactivate._change", function( e ) { + var elem = e.target; + + if ( rformElems.test( elem.nodeName ) && !elem._change_attached ) { + jQuery.event.add( elem, "change._change", function( event ) { + if ( this.parentNode && !event.isSimulated && !event.isTrigger ) { + jQuery.event.simulate( "change", this.parentNode, event, true ); + } + }); + elem._change_attached = true; + } + }); + }, + + handle: function( event ) { + var elem = event.target; + + // Swallow native change events from checkbox/radio, we already triggered them above + if ( this !== elem || event.isSimulated || event.isTrigger || (elem.type !== "radio" && elem.type !== "checkbox") ) { + return event.handleObj.handler.apply( this, arguments ); + } + }, + + teardown: function() { + jQuery.event.remove( this, "._change" ); + + return rformElems.test( this.nodeName ); + } + }; +} + +// Create "bubbling" focus and blur events +if ( !jQuery.support.focusinBubbles ) { + jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) { + + // Attach a single capturing handler while someone wants focusin/focusout + var attaches = 0, + handler = function( event ) { + jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ), true ); + }; + + jQuery.event.special[ fix ] = { + setup: function() { + if ( attaches++ === 0 ) { + document.addEventListener( orig, handler, true ); + } + }, + teardown: function() { + if ( --attaches === 0 ) { + document.removeEventListener( orig, handler, true ); + } + } + }; + }); +} + +jQuery.fn.extend({ + + on: function( types, selector, data, fn, /*INTERNAL*/ one ) { + var origFn, type; + + // Types can be a map of types/handlers + if ( typeof types === "object" ) { + // ( types-Object, selector, data ) + if ( typeof selector !== "string" ) { + // ( types-Object, data ) + data = selector; + selector = undefined; + } + for ( type in types ) { + this.on( type, selector, data, types[ type ], one ); + } + return this; + } + + if ( data == null && fn == null ) { + // ( types, fn ) + fn = selector; + data = selector = undefined; + } else if ( fn == null ) { + if ( typeof selector === "string" ) { + // ( types, selector, fn ) + fn = data; + data = undefined; + } else { + // ( types, data, fn ) + fn = data; + data = selector; + selector = undefined; + } + } + if ( fn === false ) { + fn = returnFalse; + } else if ( !fn ) { + return this; + } + + if ( one === 1 ) { + origFn = fn; + fn = function( event ) { + // Can use an empty set, since event contains the info + jQuery().off( event ); + return origFn.apply( this, arguments ); + }; + // Use same guid so caller can remove using origFn + fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ ); + } + return this.each( function() { + jQuery.event.add( this, types, fn, data, selector ); + }); + }, + one: function( types, selector, data, fn ) { + return this.on.call( this, types, selector, data, fn, 1 ); + }, + off: function( types, selector, fn ) { + if ( types && types.preventDefault && types.handleObj ) { + // ( event ) dispatched jQuery.Event + var handleObj = types.handleObj; + jQuery( types.delegateTarget ).off( + handleObj.namespace? handleObj.type + "." + handleObj.namespace : handleObj.type, + handleObj.selector, + handleObj.handler + ); + return this; + } + if ( typeof types === "object" ) { + // ( types-object [, selector] ) + for ( var type in types ) { + this.off( type, selector, types[ type ] ); + } + return this; + } + if ( selector === false || typeof selector === "function" ) { + // ( types [, fn] ) + fn = selector; + selector = undefined; + } + if ( fn === false ) { + fn = returnFalse; + } + return this.each(function() { + jQuery.event.remove( this, types, fn, selector ); + }); + }, + + bind: function( types, data, fn ) { + return this.on( types, null, data, fn ); + }, + unbind: function( types, fn ) { + return this.off( types, null, fn ); + }, + + live: function( types, data, fn ) { + jQuery( this.context ).on( types, this.selector, data, fn ); + return this; + }, + die: function( types, fn ) { + jQuery( this.context ).off( types, this.selector || "**", fn ); + return this; + }, + + delegate: function( selector, types, data, fn ) { + return this.on( types, selector, data, fn ); + }, + undelegate: function( selector, types, fn ) { + // ( namespace ) or ( selector, types [, fn] ) + return arguments.length == 1? this.off( selector, "**" ) : this.off( types, selector, fn ); + }, + + trigger: function( type, data ) { + return this.each(function() { + jQuery.event.trigger( type, data, this ); + }); + }, + triggerHandler: function( type, data ) { + if ( this[0] ) { + return jQuery.event.trigger( type, data, this[0], true ); + } + }, + + toggle: function( fn ) { + // Save reference to arguments for access in closure + var args = arguments, + guid = fn.guid || jQuery.guid++, + i = 0, + toggler = function( event ) { + // Figure out which function to execute + var lastToggle = ( jQuery._data( this, "lastToggle" + fn.guid ) || 0 ) % i; + jQuery._data( this, "lastToggle" + fn.guid, lastToggle + 1 ); + + // Make sure that clicks stop + event.preventDefault(); + + // and execute the function + return args[ lastToggle ].apply( this, arguments ) || false; + }; + + // link all the functions, so any of them can unbind this click handler + toggler.guid = guid; + while ( i < args.length ) { + args[ i++ ].guid = guid; + } + + return this.click( toggler ); + }, + + hover: function( fnOver, fnOut ) { + return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver ); + } +}); + +jQuery.each( ("blur focus focusin focusout load resize scroll unload click dblclick " + + "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " + + "change select submit keydown keypress keyup error contextmenu").split(" "), function( i, name ) { + + // Handle event binding + jQuery.fn[ name ] = function( data, fn ) { + if ( fn == null ) { + fn = data; + data = null; + } + + return arguments.length > 0 ? + this.on( name, null, data, fn ) : + this.trigger( name ); + }; + + if ( jQuery.attrFn ) { + jQuery.attrFn[ name ] = true; + } + + if ( rkeyEvent.test( name ) ) { + jQuery.event.fixHooks[ name ] = jQuery.event.keyHooks; + } + + if ( rmouseEvent.test( name ) ) { + jQuery.event.fixHooks[ name ] = jQuery.event.mouseHooks; + } +}); + + + +/*! + * Sizzle CSS Selector Engine + * Copyright 2011, The Dojo Foundation + * Released under the MIT, BSD, and GPL Licenses. + * More information: http://sizzlejs.com/ + */ +(function(){ + +var chunker = /((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g, + expando = "sizcache" + (Math.random() + '').replace('.', ''), + done = 0, + toString = Object.prototype.toString, + hasDuplicate = false, + baseHasDuplicate = true, + rBackslash = /\\/g, + rReturn = /\r\n/g, + rNonWord = /\W/; + +// 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 m, set, checkSet, extra, ret, cur, pop, i, + prune = true, + contextXML = Sizzle.isXML( context ), + parts = [], + soFar = selector; + + // 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, seed ); + + } 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, seed ); + } + } + + } 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.matchesSelector = function( node, expr ) { + return Sizzle( expr, null, null, [node] ).length > 0; +}; + +Sizzle.find = function( expr, context, isXML ) { + var set, i, len, match, type, left; + + if ( !expr ) { + return []; + } + + for ( i = 0, len = Expr.order.length; i < len; i++ ) { + type = Expr.order[i]; + + if ( (match = Expr.leftMatch[ type ].exec( expr )) ) { + left = match[1]; + match.splice( 1, 1 ); + + if ( left.substr( left.length - 1 ) !== "\\" ) { + match[1] = (match[1] || "").replace( rBackslash, "" ); + set = Expr.find[ type ]( match, context, isXML ); + + if ( set != null ) { + expr = expr.replace( Expr.match[ type ], "" ); + break; + } + } + } + } + + if ( !set ) { + set = typeof context.getElementsByTagName !== "undefined" ? + context.getElementsByTagName( "*" ) : + []; + } + + return { set: set, expr: expr }; +}; + +Sizzle.filter = function( expr, set, inplace, not ) { + var match, anyFound, + type, found, item, filter, left, + i, pass, + old = expr, + result = [], + curLoop = set, + isXMLFilter = set && set[0] && Sizzle.isXML( set[0] ); + + while ( expr && set.length ) { + for ( type in Expr.filter ) { + if ( (match = Expr.leftMatch[ type ].exec( expr )) != null && match[2] ) { + filter = Expr.filter[ type ]; + 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 ( i = 0; (item = curLoop[i]) != null; i++ ) { + if ( item ) { + found = filter( item, match, i, curLoop ); + 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 new Error( "Syntax error, unrecognized expression: " + msg ); +}; + +/** + * Utility function for retreiving the text value of an array of DOM nodes + * @param {Array|Element} elem + */ +var getText = Sizzle.getText = function( elem ) { + var i, node, + nodeType = elem.nodeType, + ret = ""; + + if ( nodeType ) { + if ( nodeType === 1 || nodeType === 9 ) { + // Use textContent || innerText for elements + if ( typeof elem.textContent === 'string' ) { + return elem.textContent; + } else if ( typeof elem.innerText === 'string' ) { + // Replace IE's carriage returns + return elem.innerText.replace( rReturn, '' ); + } else { + // Traverse it's children + for ( elem = elem.firstChild; elem; elem = elem.nextSibling) { + ret += getText( elem ); + } + } + } else if ( nodeType === 3 || nodeType === 4 ) { + return elem.nodeValue; + } + } else { + + // If no nodeType, this is expected to be an array + for ( i = 0; (node = elem[i]); i++ ) { + // Do not traverse comment nodes + if ( node.nodeType !== 8 ) { + ret += getText( node ); + } + } + } + return ret; +}; + +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|(#?(?:[\w\u00c0-\uFFFF\-]|\\.)*)|)|)\s*\]/, + TAG: /^((?:[\w\u00c0-\uFFFF\*\-]|\\.)+)/, + CHILD: /:(only|nth|last|first)-child(?:\(\s*(even|odd|(?:[+\-]?\d+|(?:[+\-]?\d*)?n\s*(?:[+\-]\s*\d+)?))\s*\))?/, + 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" ); + }, + type: function( elem ) { + return elem.getAttribute( "type" ); + } + }, + + relative: { + "+": function(checkSet, part){ + var isPartStr = typeof part === "string", + isTag = isPartStr && !rNonWord.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 elem, + isPartStr = typeof part === "string", + i = 0, + l = checkSet.length; + + if ( isPartStr && !rNonWord.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 nodeCheck, + doneName = done++, + checkFn = dirCheck; + + if ( typeof part === "string" && !rNonWord.test( part ) ) { + part = part.toLowerCase(); + nodeCheck = part; + checkFn = dirNodeCheck; + } + + checkFn( "parentNode", part, doneName, checkSet, nodeCheck, isXML ); + }, + + "~": function( checkSet, part, isXML ) { + var nodeCheck, + doneName = done++, + checkFn = dirCheck; + + if ( typeof part === "string" && !rNonWord.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]); + // Check parentNode to catch when Blackberry 4.6 returns + // nodes that are no longer in the document #6963 + return m && m.parentNode ? [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 ) { + if ( typeof context.getElementsByTagName !== "undefined" ) { + return context.getElementsByTagName( match[1] ); + } + } + }, + preFilter: { + CLASS: function( match, curLoop, inplace, result, not, isXML ) { + match = " " + match[1].replace( rBackslash, "" ) + " "; + + 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\r]/g, " ").indexOf(match) >= 0) ) { + if ( !inplace ) { + result.push( elem ); + } + + } else if ( inplace ) { + curLoop[i] = false; + } + } + } + + return false; + }, + + ID: function( match ) { + return match[1].replace( rBackslash, "" ); + }, + + TAG: function( match, curLoop ) { + return match[1].replace( rBackslash, "" ).toLowerCase(); + }, + + CHILD: function( match ) { + if ( match[1] === "nth" ) { + if ( !match[2] ) { + Sizzle.error( match[0] ); + } + + match[2] = match[2].replace(/^\+|\s*/g, ''); + + // 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; + } + else if ( match[2] ) { + Sizzle.error( match[0] ); + } + + // TODO: Move to normal caching system + match[0] = done++; + + return match; + }, + + ATTR: function( match, curLoop, inplace, result, not, isXML ) { + var name = match[1] = match[1].replace( rBackslash, "" ); + + if ( !isXML && Expr.attrMap[name] ) { + match[1] = Expr.attrMap[name]; + } + + // Handle if an un-quoted value was used + match[4] = ( match[4] || match[5] || "" ).replace( rBackslash, "" ); + + 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 + if ( elem.parentNode ) { + 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 ) { + var attr = elem.getAttribute( "type" ), type = elem.type; + // IE6 and 7 will map elem.type to 'text' for new HTML5 types (search, etc) + // use getAttribute instead to test this case + return elem.nodeName.toLowerCase() === "input" && "text" === type && ( attr === type || attr === null ); + }, + + radio: function( elem ) { + return elem.nodeName.toLowerCase() === "input" && "radio" === elem.type; + }, + + checkbox: function( elem ) { + return elem.nodeName.toLowerCase() === "input" && "checkbox" === elem.type; + }, + + file: function( elem ) { + return elem.nodeName.toLowerCase() === "input" && "file" === elem.type; + }, + + password: function( elem ) { + return elem.nodeName.toLowerCase() === "input" && "password" === elem.type; + }, + + submit: function( elem ) { + var name = elem.nodeName.toLowerCase(); + return (name === "input" || name === "button") && "submit" === elem.type; + }, + + image: function( elem ) { + return elem.nodeName.toLowerCase() === "input" && "image" === elem.type; + }, + + reset: function( elem ) { + var name = elem.nodeName.toLowerCase(); + return (name === "input" || name === "button") && "reset" === elem.type; + }, + + button: function( elem ) { + var name = elem.nodeName.toLowerCase(); + return name === "input" && "button" === elem.type || name === "button"; + }, + + input: function( elem ) { + return (/input|select|textarea|button/i).test( elem.nodeName ); + }, + + focus: function( elem ) { + return elem === elem.ownerDocument.activeElement; + } + }, + 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 || 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( name ); + } + }, + + CHILD: function( elem, match ) { + var first, last, + doneName, parent, cache, + count, diff, + 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": + first = match[2]; + last = match[3]; + + if ( first === 1 && last === 0 ) { + return true; + } + + doneName = match[0]; + parent = elem.parentNode; + + if ( parent && (parent[ expando ] !== doneName || !elem.nodeIndex) ) { + count = 0; + + for ( node = parent.firstChild; node; node = node.nextSibling ) { + if ( node.nodeType === 1 ) { + node.nodeIndex = ++count; + } + } + + parent[ expando ] = doneName; + } + + 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 && 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 = Sizzle.attr ? + Sizzle.attr( elem, name ) : + 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 && Sizzle.attr ? + result != null : + 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 i = 0, + ret = results || []; + + 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, siblingCheck; + +if ( document.documentElement.compareDocumentPosition ) { + sortOrder = function( a, b ) { + if ( a === b ) { + hasDuplicate = true; + return 0; + } + + if ( !a.compareDocumentPosition || !b.compareDocumentPosition ) { + return a.compareDocumentPosition ? -1 : 1; + } + + return a.compareDocumentPosition(b) & 4 ? -1 : 1; + }; + +} else { + sortOrder = function( a, b ) { + // The nodes are identical, we can exit early + if ( a === b ) { + hasDuplicate = true; + return 0; + + // Fallback to using sourceIndex (in IE) if it's available on both nodes + } else if ( a.sourceIndex && b.sourceIndex ) { + return a.sourceIndex - b.sourceIndex; + } + + var al, bl, + ap = [], + bp = [], + aup = a.parentNode, + bup = b.parentNode, + cur = aup; + + // If the nodes are siblings (or identical) we can do a quick check + if ( aup === bup ) { + return siblingCheck( a, b ); + + // If no parents were found then the nodes are disconnected + } else if ( !aup ) { + return -1; + + } else if ( !bup ) { + return 1; + } + + // Otherwise they're somewhere else in the tree so we need + // to build up a full list of the parentNodes for comparison + while ( cur ) { + ap.unshift( cur ); + cur = cur.parentNode; + } + + cur = bup; + + while ( cur ) { + bp.unshift( cur ); + cur = cur.parentNode; + } + + al = ap.length; + bl = bp.length; + + // Start walking down the tree looking for a discrepancy + for ( var i = 0; i < al && i < bl; i++ ) { + if ( ap[i] !== bp[i] ) { + return siblingCheck( ap[i], bp[i] ); + } + } + + // We ended someplace up the tree so do a sibling check + return i === al ? + siblingCheck( a, bp[i], -1 ) : + siblingCheck( ap[i], b, 1 ); + }; + + siblingCheck = function( a, b, ret ) { + if ( a === b ) { + return ret; + } + + var cur = a.nextSibling; + + while ( cur ) { + if ( cur === b ) { + return -1; + } + + cur = cur.nextSibling; + } + + return 1; + }; +} + +// 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(), + root = document.documentElement; + + form.innerHTML = ""; + + // Inject it into the root element, check its status, and remove it quickly + 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 ); + + // release memory in IE + root = form = null; +})(); + +(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 ); + }; + } + + // release memory in IE + div = null; +})(); + +if ( document.querySelectorAll ) { + (function(){ + var oldSizzle = Sizzle, + div = document.createElement("div"), + id = "__sizzle__"; + + 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 && !Sizzle.isXML(context) ) { + // See if we find a selector to speed up + var match = /^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec( query ); + + if ( match && (context.nodeType === 1 || context.nodeType === 9) ) { + // Speed-up: Sizzle("TAG") + if ( match[1] ) { + return makeArray( context.getElementsByTagName( query ), extra ); + + // Speed-up: Sizzle(".CLASS") + } else if ( match[2] && Expr.find.CLASS && context.getElementsByClassName ) { + return makeArray( context.getElementsByClassName( match[2] ), extra ); + } + } + + if ( context.nodeType === 9 ) { + // Speed-up: Sizzle("body") + // The body element only exists once, optimize finding it + if ( query === "body" && context.body ) { + return makeArray( [ context.body ], extra ); + + // Speed-up: Sizzle("#ID") + } else if ( match && match[3] ) { + var elem = context.getElementById( match[3] ); + + // Check parentNode to catch when Blackberry 4.6 returns + // nodes that are no longer in the document #6963 + if ( elem && elem.parentNode ) { + // Handle the case where IE and Opera return items + // by name instead of ID + if ( elem.id === match[3] ) { + return makeArray( [ elem ], extra ); + } + + } else { + return makeArray( [], extra ); + } + } + + try { + return makeArray( context.querySelectorAll(query), extra ); + } catch(qsaError) {} + + // qSA works strangely on Element-rooted queries + // We can work around this by specifying an extra ID on the root + // and working up from there (Thanks to Andrew Dupont for the technique) + // IE 8 doesn't work on object elements + } else if ( context.nodeType === 1 && context.nodeName.toLowerCase() !== "object" ) { + var oldContext = context, + old = context.getAttribute( "id" ), + nid = old || id, + hasParent = context.parentNode, + relativeHierarchySelector = /^\s*[+~]/.test( query ); + + if ( !old ) { + context.setAttribute( "id", nid ); + } else { + nid = nid.replace( /'/g, "\\$&" ); + } + if ( relativeHierarchySelector && hasParent ) { + context = context.parentNode; + } + + try { + if ( !relativeHierarchySelector || hasParent ) { + return makeArray( context.querySelectorAll( "[id='" + nid + "'] " + query ), extra ); + } + + } catch(pseudoError) { + } finally { + if ( !old ) { + oldContext.removeAttribute( "id" ); + } + } + } + } + + return oldSizzle(query, context, extra, seed); + }; + + for ( var prop in oldSizzle ) { + Sizzle[ prop ] = oldSizzle[ prop ]; + } + + // release memory in IE + div = null; + })(); +} + +(function(){ + var html = document.documentElement, + matches = html.matchesSelector || html.mozMatchesSelector || html.webkitMatchesSelector || html.msMatchesSelector; + + if ( matches ) { + // Check to see if it's possible to do matchesSelector + // on a disconnected node (IE 9 fails this) + var disconnectedMatch = !matches.call( document.createElement( "div" ), "div" ), + pseudoWorks = false; + + try { + // This should fail with an exception + // Gecko does not error, returns false instead + matches.call( document.documentElement, "[test!='']:sizzle" ); + + } catch( pseudoError ) { + pseudoWorks = true; + } + + Sizzle.matchesSelector = function( node, expr ) { + // Make sure that attribute selectors are quoted + expr = expr.replace(/\=\s*([^'"\]]*)\s*\]/g, "='$1']"); + + if ( !Sizzle.isXML( node ) ) { + try { + if ( pseudoWorks || !Expr.match.PSEUDO.test( expr ) && !/!=/.test( expr ) ) { + var ret = matches.call( node, expr ); + + // IE 9's matchesSelector returns false on disconnected nodes + if ( ret || !disconnectedMatch || + // As well, disconnected nodes are said to be in a document + // fragment in IE 9, so check for that + node.document && node.document.nodeType !== 11 ) { + return ret; + } + } + } catch(e) {} + } + + return Sizzle(expr, null, null, [node]).length > 0; + }; + } +})(); + +(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]); + } + }; + + // release memory in IE + div = null; +})(); + +function dirNodeCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) { + for ( var i = 0, l = checkSet.length; i < l; i++ ) { + var elem = checkSet[i]; + + if ( elem ) { + var match = false; + + elem = elem[dir]; + + while ( elem ) { + if ( elem[ expando ] === doneName ) { + match = checkSet[elem.sizset]; + break; + } + + if ( elem.nodeType === 1 && !isXML ){ + elem[ expando ] = 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 ) { + var match = false; + + elem = elem[dir]; + + while ( elem ) { + if ( elem[ expando ] === doneName ) { + match = checkSet[elem.sizset]; + break; + } + + if ( elem.nodeType === 1 ) { + if ( !isXML ) { + elem[ expando ] = 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; + } + } +} + +if ( document.documentElement.contains ) { + Sizzle.contains = function( a, b ) { + return a !== b && (a.contains ? a.contains(b) : true); + }; + +} else if ( document.documentElement.compareDocumentPosition ) { + Sizzle.contains = function( a, b ) { + return !!(a.compareDocumentPosition(b) & 16); + }; + +} else { + Sizzle.contains = function() { + return false; + }; +} + +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, seed ) { + var match, + tmpSet = [], + later = "", + 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, seed ); + } + + return Sizzle.filter( later, tmpSet ); +}; + +// EXPOSE +// Override sizzle attribute retrieval +Sizzle.attr = jQuery.attr; +Sizzle.selectors.attrMap = {}; +jQuery.find = Sizzle; +jQuery.expr = Sizzle.selectors; +jQuery.expr[":"] = jQuery.expr.filters; +jQuery.unique = Sizzle.uniqueSort; +jQuery.text = Sizzle.getText; +jQuery.isXMLDoc = Sizzle.isXML; +jQuery.contains = Sizzle.contains; + + +})(); + + +var runtil = /Until$/, + rparentsprev = /^(?:parents|prevUntil|prevAll)/, + // Note: This RegExp should be improved, or likely pulled from Sizzle + rmultiselector = /,/, + isSimple = /^.[^:#\[\.,]*$/, + slice = Array.prototype.slice, + POS = jQuery.expr.match.POS, + // methods guaranteed to produce a unique set when starting from a unique set + guaranteedUnique = { + children: true, + contents: true, + next: true, + prev: true + }; + +jQuery.fn.extend({ + find: function( selector ) { + var self = this, + i, l; + + if ( typeof selector !== "string" ) { + return jQuery( selector ).filter(function() { + for ( i = 0, l = self.length; i < l; i++ ) { + if ( jQuery.contains( self[ i ], this ) ) { + return true; + } + } + }); + } + + var ret = this.pushStack( "", "find", selector ), + length, n, r; + + for ( i = 0, l = this.length; i < l; i++ ) { + length = ret.length; + jQuery.find( selector, this[i], ret ); + + if ( i > 0 ) { + // Make sure that the results are unique + for ( n = length; n < ret.length; n++ ) { + for ( r = 0; r < length; r++ ) { + if ( ret[r] === ret[n] ) { + ret.splice(n--, 1); + break; + } + } + } + } + } + + return ret; + }, + + has: function( target ) { + var targets = jQuery( target ); + return this.filter(function() { + for ( var i = 0, l = targets.length; i < l; i++ ) { + if ( jQuery.contains( this, targets[i] ) ) { + return true; + } + } + }); + }, + + not: function( selector ) { + return this.pushStack( winnow(this, selector, false), "not", selector); + }, + + filter: function( selector ) { + return this.pushStack( winnow(this, selector, true), "filter", selector ); + }, + + is: function( selector ) { + return !!selector && ( + typeof selector === "string" ? + // If this is a positional selector, check membership in the returned set + // so $("p:first").is("p:last") won't return true for a doc with two "p". + POS.test( selector ) ? + jQuery( selector, this.context ).index( this[0] ) >= 0 : + jQuery.filter( selector, this ).length > 0 : + this.filter( selector ).length > 0 ); + }, + + closest: function( selectors, context ) { + var ret = [], i, l, cur = this[0]; + + // Array (deprecated as of jQuery 1.7) + if ( jQuery.isArray( selectors ) ) { + var level = 1; + + while ( cur && cur.ownerDocument && cur !== context ) { + for ( i = 0; i < selectors.length; i++ ) { + + if ( jQuery( cur ).is( selectors[ i ] ) ) { + ret.push({ selector: selectors[ i ], elem: cur, level: level }); + } + } + + cur = cur.parentNode; + level++; + } + + return ret; + } + + // String + var pos = POS.test( selectors ) || typeof selectors !== "string" ? + jQuery( selectors, context || this.context ) : + 0; + + for ( i = 0, l = this.length; i < l; i++ ) { + cur = this[i]; + + while ( cur ) { + if ( pos ? pos.index(cur) > -1 : jQuery.find.matchesSelector(cur, selectors) ) { + ret.push( cur ); + break; + + } else { + cur = cur.parentNode; + if ( !cur || !cur.ownerDocument || cur === context || cur.nodeType === 11 ) { + break; + } + } + } + } + + ret = ret.length > 1 ? jQuery.unique( ret ) : ret; + + return this.pushStack( ret, "closest", selectors ); + }, + + // Determine the position of an element within + // the matched set of elements + index: function( elem ) { + + // No argument, return index in parent + if ( !elem ) { + return ( this[0] && this[0].parentNode ) ? this.prevAll().length : -1; + } + + // index in selector + if ( typeof elem === "string" ) { + return jQuery.inArray( this[0], jQuery( elem ) ); + } + + // Locate the position of the desired element + return jQuery.inArray( + // If it receives a jQuery object, the first element is used + elem.jquery ? elem[0] : elem, this ); + }, + + add: function( selector, context ) { + var set = typeof selector === "string" ? + jQuery( selector, context ) : + jQuery.makeArray( selector && selector.nodeType ? [ selector ] : selector ), + all = jQuery.merge( this.get(), set ); + + return this.pushStack( isDisconnected( set[0] ) || isDisconnected( all[0] ) ? + all : + jQuery.unique( all ) ); + }, + + andSelf: function() { + return this.add( this.prevObject ); + } +}); + +// A painfully simple check to see if an element is disconnected +// from a document (should be improved, where feasible). +function isDisconnected( node ) { + return !node || !node.parentNode || node.parentNode.nodeType === 11; +} + +jQuery.each({ + parent: function( elem ) { + var parent = elem.parentNode; + return parent && parent.nodeType !== 11 ? parent : null; + }, + parents: function( elem ) { + return jQuery.dir( elem, "parentNode" ); + }, + parentsUntil: function( elem, i, until ) { + return jQuery.dir( elem, "parentNode", until ); + }, + next: function( elem ) { + return jQuery.nth( elem, 2, "nextSibling" ); + }, + prev: function( elem ) { + return jQuery.nth( elem, 2, "previousSibling" ); + }, + nextAll: function( elem ) { + return jQuery.dir( elem, "nextSibling" ); + }, + prevAll: function( elem ) { + return jQuery.dir( elem, "previousSibling" ); + }, + nextUntil: function( elem, i, until ) { + return jQuery.dir( elem, "nextSibling", until ); + }, + prevUntil: function( elem, i, until ) { + return jQuery.dir( elem, "previousSibling", until ); + }, + siblings: function( elem ) { + return jQuery.sibling( elem.parentNode.firstChild, elem ); + }, + children: function( elem ) { + return jQuery.sibling( elem.firstChild ); + }, + contents: function( elem ) { + return jQuery.nodeName( elem, "iframe" ) ? + elem.contentDocument || elem.contentWindow.document : + jQuery.makeArray( elem.childNodes ); + } +}, function( name, fn ) { + jQuery.fn[ name ] = function( until, selector ) { + var ret = jQuery.map( this, fn, until ); + + if ( !runtil.test( name ) ) { + selector = until; + } + + if ( selector && typeof selector === "string" ) { + ret = jQuery.filter( selector, ret ); + } + + ret = this.length > 1 && !guaranteedUnique[ name ] ? jQuery.unique( ret ) : ret; + + if ( (this.length > 1 || rmultiselector.test( selector )) && rparentsprev.test( name ) ) { + ret = ret.reverse(); + } + + return this.pushStack( ret, name, slice.call( arguments ).join(",") ); + }; +}); + +jQuery.extend({ + filter: function( expr, elems, not ) { + if ( not ) { + expr = ":not(" + expr + ")"; + } + + return elems.length === 1 ? + jQuery.find.matchesSelector(elems[0], expr) ? [ elems[0] ] : [] : + jQuery.find.matches(expr, elems); + }, + + dir: function( elem, dir, until ) { + var matched = [], + cur = elem[ dir ]; + + while ( cur && cur.nodeType !== 9 && (until === undefined || cur.nodeType !== 1 || !jQuery( cur ).is( until )) ) { + if ( cur.nodeType === 1 ) { + matched.push( cur ); + } + cur = cur[dir]; + } + return matched; + }, + + nth: function( cur, result, dir, elem ) { + result = result || 1; + var num = 0; + + for ( ; cur; cur = cur[dir] ) { + if ( cur.nodeType === 1 && ++num === result ) { + break; + } + } + + return cur; + }, + + sibling: function( n, elem ) { + var r = []; + + for ( ; n; n = n.nextSibling ) { + if ( n.nodeType === 1 && n !== elem ) { + r.push( n ); + } + } + + return r; + } +}); + +// Implement the identical functionality for filter and not +function winnow( elements, qualifier, keep ) { + + // Can't pass null or undefined to indexOf in Firefox 4 + // Set to 0 to skip string check + qualifier = qualifier || 0; + + if ( jQuery.isFunction( qualifier ) ) { + return jQuery.grep(elements, function( elem, i ) { + var retVal = !!qualifier.call( elem, i, elem ); + return retVal === keep; + }); + + } else if ( qualifier.nodeType ) { + return jQuery.grep(elements, function( elem, i ) { + return ( elem === qualifier ) === keep; + }); + + } else if ( typeof qualifier === "string" ) { + var filtered = jQuery.grep(elements, function( elem ) { + return elem.nodeType === 1; + }); + + if ( isSimple.test( qualifier ) ) { + return jQuery.filter(qualifier, filtered, !keep); + } else { + qualifier = jQuery.filter( qualifier, filtered ); + } + } + + return jQuery.grep(elements, function( elem, i ) { + return ( jQuery.inArray( elem, qualifier ) >= 0 ) === keep; + }); +} + + + + +function createSafeFragment( document ) { + var list = nodeNames.split( "|" ), + safeFrag = document.createDocumentFragment(); + + if ( safeFrag.createElement ) { + while ( list.length ) { + safeFrag.createElement( + list.pop() + ); + } + } + return safeFrag; +} + +var nodeNames = "abbr|article|aside|audio|canvas|datalist|details|figcaption|figure|footer|" + + "header|hgroup|mark|meter|nav|output|progress|section|summary|time|video", + rinlinejQuery = / jQuery\d+="(?:\d+|null)"/g, + rleadingWhitespace = /^\s+/, + rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig, + rtagName = /<([\w:]+)/, + rtbody = /", "" ], + legend: [ 1, "
", "
" ], + thead: [ 1, "", "
" ], + tr: [ 2, "", "
" ], + td: [ 3, "", "
" ], + col: [ 2, "", "
" ], + area: [ 1, "", "" ], + _default: [ 0, "", "" ] + }, + safeFragment = createSafeFragment( document ); + +wrapMap.optgroup = wrapMap.option; +wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead; +wrapMap.th = wrapMap.td; + +// IE can't serialize and + + + + + + + +
+ + diff --git a/assets/index.css b/assets/index.css index a11e19ee..5c1e0004 100644 --- a/assets/index.css +++ b/assets/index.css @@ -1,37 +1,201 @@ -pre{word-break:break-word;word-break:break-all;tab-size:2;} -header nav{float:right;}header nav a{font-size:1.2em;padding:5px;background-color:#F5F7F5;border:1px solid #CCC;display:inline-block;text-decoration:none;} -#profile{text-align:center;}#profile img{border-radius:50%;height:100px;display:block;margin:auto;background-color:#ddd;} -#profile div{display:inline-block;padding:10px;} -button.zocial img{height:24px;vertical-align:middle;} -button.zocial span{clear:left;} -table.testtable pre+button{position:relative;margin:0;} -table.testtable button{cursor:pointer;} -table.testtable tbody td:first-child{min-width:200px;} -table.testtable tbody td:nth-child(2){min-width:100px;} -table.testtable td.method span{vertical-align:top;color:white;text-transform:uppercase;padding:7px 10px;border-radius:3px;font-size:0.7em;min-width:60px;text-align:center;} -table.testtable td.method span.get{background-color:#0F6AB4;} -table.testtable td.method span.post{background-color:#10A54A;} -table.testtable td.method span.put{background-color:#c5862b;} -table.testtable td.method span.delete{background-color:red;} -table.testtable td.method span.login,table.testtable td.method span.logout,table.testtable td.method span.getAuthResponse{background-color:#FF0;color:#444;} -table.testtable td,table.testtable th{padding:2px;} -table.testtable tr.debug{background-color:#E7F6EC;} -table.testtable .zocial.icon{vertical-align:top;color:black;border-color:transparent;border-radius:2px;background-color:transparent;} -table.testtable pre *{word-break:break-word;} -table.testtable th{font-weight:normal;} -table.testtable a:hover{cursor:pointer;text-decoration:underline;} -button{color:black;border:1px solid #D2D2D2;border-radius:10px;background-color:#fff;}button.run:before{content:"\025BA";} -button.working:before{content:"\02589";} -button.response{color:white;border-color:transparent;} -button.response.error{background-color:red;} -button.response.passed{background-color:#10A54A;} -button.response.exception{background-color:orange;} -button.pending{background-color:lime;} -button.response.error:after{content:"\02716";} -button.response.passed:after{content:"\02714";} -button.response.exception:after{content:"?";} -.method:before{vertical-align:top;color:white;text-transform:uppercase;padding:3px 0px;border-radius:3px;font-size:0.7em;min-width:60px;text-align:center;display:inline-block;margin:5px;} -.method.get:before{content:"GET";background-color:#0F6AB4;} -.method.post:before{content:"POST";background-color:#10A54A;} -.method.put:before{content:"PUT";background-color:#C5862B;} -.method.delete:before{content:"DELETE";background-color:red;} +pre { + word-break: break-word; + word-break: break-all; + tab-size: 2; +} +header nav { + float: right; +} +header nav a { + font-size: 1.2em; + padding: 5px; + background-color: #F5F7F5; + border: 1px solid #CCC; + display: inline-block; + text-decoration: none; +} +#profile { + text-align: center; +} +#profile img { + border-radius: 50%; + height: 100px; + display: block; + margin: auto; + background-color: #ddd; +} +#profile div { + display: inline-block; + padding: 10px; +} +button.zocial img { + height: 24px; + vertical-align: middle; +} +button.zocial span { + clear: left; +} +table.testtable pre + button { + position: relative; + margin: 0; +} +table.testtable button { + cursor: pointer; +} +table.testtable tbody td:first-child { + min-width: 200px; +} +table.testtable tbody td:nth-child(2) { + min-width: 100px; +} +table.testtable td.method span { + vertical-align: top; + color: white; + text-transform: uppercase; + padding: 7px 10px; + border-radius: 3px; + font-size: 0.7em; + min-width: 60px; + text-align: center; +} +table.testtable td.method span { + background-color: #4E5160; + color: white; +} +table.testtable td.method span.get { + background-color: #0F6AB4; +} +table.testtable td.method span.post { + background-color: #10A54A; +} +table.testtable td.method span.put { + background-color: #c5862b; +} +table.testtable td.method span.delete { + background-color: red; +} +table.testtable td, +table.testtable th { + padding: 2px; +} +table.testtable tr.debug { + background-color: #E7F6EC; +} +table.testtable .zocial.icon { + vertical-align: top; + color: black; + border-color: transparent; + border-radius: 2px; + background-color: transparent; +} +table.testtable pre * { + word-break: break-word; +} +table.testtable th { + font-weight: normal; +} +table.testtable a:hover { + cursor: pointer; + text-decoration: underline; +} +button.run, +button.working, +button.response, +button.pending { + color: black; + border: 1px solid #D2D2D2; + border-radius: 10px; + background-color: #fff; +} +button.run:before { + content: "\025BA"; +} +button.working:before { + content: "\02589"; +} +button.response { + color: white; + border-color: transparent; +} +button.response.error { + background-color: red; +} +button.response.error:after { + content: "\02716"; +} +button.response.passed { + background-color: #10A54A; +} +button.response.passed:after { + content: "\02714"; +} +button.response.exception { + background-color: orange; +} +button.response.exception:after { + content: "?"; +} +button.pending { + background-color: lime; +} +.method:before { + vertical-align: top; + color: white; + text-transform: uppercase; + padding: 3px 0px; + border-radius: 3px; + font-size: 0.7em; + min-width: 60px; + text-align: center; + display: inline-block; + margin: 5px; +} +.method.get:before { + content: "GET"; + background-color: #0F6AB4; +} +.method.post:before { + content: "POST"; + background-color: #10A54A; +} +.method.put:before { + content: "PUT"; + background-color: #C5862B; +} +.method.delete:before { + content: "DELETE"; + background-color: red; +} +.tooltip { + display: inline-block; + position: relative; +} +.tooltip:before { + background: #444; + border-radius: 50%; + color: #FFF; + content: '?'; + display: inline-block; + line-height: 1; + text-align: center; + width: 1em; + vertical-align: top; +} +.tooltip > span { + background: white; + border: 1px solid #444; + display: none; + padding: 10px; + position: absolute; + min-width: 200px; +} +.tooltip:hover > span { + display: inline-block; +} +.adorn-shoutout { + background: url(https://user-images.githubusercontent.com/83319/31722733-de95bbde-b3ea-11e7-96bf-4f4e8f915588.png); + background-repeat: no-repeat; + background-size: contain; + padding-left: 2em; + display: inline-block; +} diff --git a/assets/index.js b/assets/index.js index a6108a23..0798f373 100644 --- a/assets/index.js +++ b/assets/index.js @@ -3,6 +3,9 @@ * @author Andrew Dodson */ +// Prevent global leaks +(function(self) { + // // The following properties pertain to helper objects when defining the tests // @@ -45,10 +48,103 @@ var tests = [ } }, { - title : "Logout", + title : "Login force reauthentication", + api : "login", + method : 'login', + data : { + display : ["popup", "none", "page"], + scope : "", + force : true + }, + filter: function(p){ + var login = hello.services[p.network].login; + if (login) { + return !!login.toString().match(/\.force\b/); + } + return false; + }, + expected : { + authResponse : { + access_token : reg.string, + expires : /\d/ + }, + network: reg.string + } + }, + // { + // title : "Login via Authorization code grant flow", + // api : "login", + // method : 'login', + // data : { + // response_type : 'code', + // display : ["popup", "none", "page"], + // scope : "" + // }, + // filter : function(test){ + // return hello.services[test.network].oauth.grant && hello.services[test.network].oauth.version === 2; + // }, + // expected : { + // authResponse : { + // access_token : reg.string, + // expires : /\d/ + // }, + // network: reg.string + // } + // }, + { + title : "Logout from app", api : "logout", method : 'logout', expected : { + network : reg.string + } + }, + { + title : "Logout from app & network", + api : "logout", + method : 'logout', + data : { + force : true + }, + filter : function(test){ + return "logout" in hello.services[test.network]; + }, + expected : { + network : reg.string + } + }, + { + title : "OAuth2: Implicit Grant, services which do not require server side authorization", + api : "oauth", + method : "OAuth2: Implicit Grant", + filter : function(test){ + var oauth = hello.services[test.network].oauth; + return oauth.version === 2 && oauth.response_type !== 'code'; + } + }, + { + title : "OAuth2: Authorization code, service requires oauth_proxy", + api : "oauth", + method : "OAuth2: Explicit Grant", + filter : function(test){ + var oauth = hello.services[test.network].oauth; + return oauth.version === 2 && oauth.grant; + } + }, + { + title : "OAuth 1 + 1a, services which require oauth_proxy", + api : "oauth", + method : "oauth1 & 1a", + filter : function(test){ + return hello.services[test.network].oauth.version !== 2; + } + }, + { + title : "Refresh access token, using display=none", + api : "refresh", + method : "implicit grant", + filter : function(test){ + return hello.services[test.network].refresh; } }, { @@ -65,6 +161,7 @@ var tests = [ api : "api", method : 'get', path : 'me', + scope : ['email'], expected : { name : reg.name, id : reg.id, @@ -75,7 +172,10 @@ var tests = [ } }, { - title : "List my friends", + title : "List my network friends", + info : { + facebook : 'For applications registered after April 2014 only friends who have used the same app appear in resultset. See https://developers.facebook.com/docs/apps/changelog' + }, api : "api", method : 'get', path : 'me/friends', @@ -89,6 +189,21 @@ var tests = [ }] } }, + { + title : "List my contacts", + api : "api", + method : 'get', + path : 'me/contacts', + data : query, + scope : ["friends"], + expected : { + data : [{ + id : reg.id, + name : reg.name, + thumbnail : reg.url + }] + } + }, { title : "List my followers", api : "api", @@ -124,6 +239,7 @@ var tests = [ api : "api", method : 'get', path : 'me/share', + scope : ["share"], data : query, expected : { data : [] @@ -139,8 +255,70 @@ var tests = [ message : "Running the tests", link : window.location.href, picture : "http://adodson.com/hello.js/assets/logo.png" + }, + expected : {} + }, + { + title : "Post a status and upload a media file", + api : "api", + method : 'post', + path : 'me/share', + scope : ["publish"], + filter: function(p){ + return p.enabled && p.network === 'twitter'; + }, + data : { + message : "Uploading image", + file : INPUT_FILE + }, + expected : {} + }, + { + title : "Reshare an existing message", + api : "api", + method : 'post', + path : 'me/share', + scope : ["publish"], + filter: function(p){ + return p.enabled && 'twitter,linkedin'.indexOf(p.network) !== -1; + }, + data : { + id : 0 + }, + expected : {} + }, + { + title : "Get a list of items i've liked, favourited or starred", + api : "api", + method : 'get', + path : 'me/like', + data : query, + expected : { + data : [] } }, + { + title : "Like, favourite or star something", + api : "api", + method : 'post', + path : 'me/like', + scope : ["publish"], + data : { + id : 0 + }, + expected : {} + }, + { + title : "Unlike, unfavourite or unstar something", + api : "api", + method : 'delete', + path : 'me/like', + scope : ["publish"], + data : { + id : 0 + }, + expected : {} + }, { title : "List my albums", api : "api", @@ -167,14 +345,17 @@ var tests = [ id : "[ALBUM_ID]" }, setup : function(test, callback){ - hello(test.network).api("me/albums").success(function(r){ + + hello(test.network) + .api("me/albums") + .then(function(r){ if(r.data.length){ test.data.id = test.data.id.replace("[ALBUM_ID]", r.data[0].id ); callback(); return; } callback("Failed to setup: the user has no albums"); - }).error(function(){ + },function(){ callback("Failed to setup: could not open me/albums"); }); }, @@ -211,7 +392,9 @@ var tests = [ id : "[PHOTO_ID]" }, setup : function(test, callback){ - hello(test.network).api("me/albums").success( function(r){ + hello(test.network) + .api("me/albums") + .then( function(r){ if("data" in r && r.data.length > 0){ // Pick one randomly @@ -231,7 +414,7 @@ var tests = [ else{ callback("Failed to setup: The user has no albums yet"); } - }).error(function(){ + },function(){ callback("Failed to setup: Error connecting to me/albums"); }); }, @@ -255,6 +438,20 @@ var tests = [ id : reg.string } }, + { + title : "Remove an album", + api : "api", + method : 'delete', + path : 'me/album', + scope : ["publish_files"], + data : { + id : '[ALBUM_ID]' + }, + setup : before_photo_post, + expected : { + success : true + } + }, { title : "Upload image to Album", api : "api", @@ -287,15 +484,15 @@ var tests = [ } }, { - title : "Remove an album", + title : "Remove a Photo from an Album", api : "api", method : 'delete', - path : 'me/album', + path : 'me/photo', scope : ["publish_files"], data : { - id : '[ALBUM_ID]' + id : '[PHOTO_ID]' }, - setup : before_photo_post, + setup : get_test_photo, expected : { success : true } @@ -316,6 +513,38 @@ var tests = [ }] } }, + { + title : "Get files in folder", + api : "api", + method : 'get', + path : 'me/files', + scope : ["files"], + data : { + parent : '[FOLDER_ID]' + }, + setup : get_test_folder, + expected : { + data : [{ + id : reg.string, + name : reg.name + }] + } + }, + { + title : "Get file by ID", + api : "api", + method : 'get', + path : 'me/file', + scope : ["files"], + data : { + id : '[FILE_ID]' + }, + setup : get_test_file, + expected : { + id : reg.string, + name : reg.name + } + }, { title : "List folders", api : "api", @@ -361,6 +590,20 @@ var tests = [ }] } }, + { + title : "Delete a folder", + api : "api", + method : 'delete', + path : 'me/folder', + scope : ["publish_files"], + data : { + id : '[FOLDER_ID]' + }, + setup : get_test_folder, + expected : { + success : true + } + }, { title : "Upload my file", api : "api", @@ -368,7 +611,7 @@ var tests = [ path : 'me/files', scope : ["publish_files"], data : { - id : '[FOLDER_ID]', + parent : '[FOLDER_ID]', file : INPUT_FILE, name : "TestFile.png" }, @@ -385,7 +628,7 @@ var tests = [ path : 'me/files', scope : ["publish_files"], data : { - id : '[FOLDER_ID]', + parent : '[FOLDER_ID]', file : DATA_URL, name : "TestFile.png" }, @@ -395,6 +638,39 @@ var tests = [ name : reg.name } }, + { + title : "Update the file contents", + api : "api", + method : 'put', + path : 'me/files', + scope : ["publish_files"], + data : { + id : '[FILE_ID]', + file : DATA_URL, + name : "TestFile.png" + }, + setup : get_test_file, + expected : { + id : reg.string, + name : reg.name + } + }, + { + title : "Move the file location", + api : "api", + method : 'put', + path : 'me/files', + scope : ["publish_files"], + data : { + id : '[FILE_ID]', + parent : '[NEW_PARENT_ID]' + }, + setup : get_test_file, + expected : { + id : reg.string, + name : reg.name + } + }, { title : "Delete my file", api : "api", @@ -408,6 +684,72 @@ var tests = [ expected : { success : true } + }, + + //////////////////////////////// + // SCOPE + //////////////////////////////// + { + title : "Default scope", + api : "scope", + method : "basic", + filter : scopeFilter + }, + { + title : "Read Users Email", + api : "scope", + method : "email", + scope: ['email'], + filter : scopeFilter + }, + { + title : "Read Friends List", + api : "scope", + method : "friends", + scope: ['friends'], + filter : scopeFilter + }, + { + title : "Publish scope", + api : "scope", + method : "publish", + scope: ['publish'], + filter : scopeFilter + }, + { + title : "Read users Photos and Albums", + api : "scope", + method : "photos", + scope: ['photos'], + filter : scopeFilter + }, + { + title : "Read users Videos and Albums", + api : "scope", + method : "videos", + scope: ['videos'], + filter : scopeFilter + }, + { + title : "Read Files", + api : "scope", + method : "files", + scope: ['files'], + filter : scopeFilter + }, + { + title : "Publish Files Scope", + api : "scope", + method : "publish_files", + scope: ['publish_files'], + filter : scopeFilter + }, + { + title : "Persist the tokens or acquire a Refresh Token for continued access", + api : "scope", + method : "offline_access", + scope: ['offline_access'], + filter : scopeFilter } ]; @@ -415,12 +757,22 @@ var tests = [ /////////////////////////////////// // BEFORE SETUPS +function scopeFilter(test) { + var scope = hello.services[test.network].scope; + + if (scope) { + return scope[test.method]; + } +} + // // Get the ID of the test album // function before_photo_post(test, callback){ - hello(test.network).api("me/albums").success(function(r){ + hello(test.network) + .api("me/albums") + .then(function(r){ for(var i=0;i 0 + }, this); }); ko.utils.arrayForEach( tests, function(test){ @@ -815,7 +1212,7 @@ function Dictionary(data) { this.removeItem = function(item) { this.items.remove(item); }.bind(this); - + this.itemsAsObject = ko.dependentObservable(function() { var result = {}; ko.utils.arrayForEach(this.items(), function(item) { @@ -871,3 +1268,42 @@ function _indexOf(a,s){ } return -1; } + + + +self.getText = function getText(path, callback){ + // Load in the templates for API calls + var xhr = new XMLHttpRequest(); + xhr.onreadystatechange = function(){ + if (xhr.readyState === 4){ + xhr.onload(); + } + }; + xhr.onload = function(){ + callback(xhr.responseText); + xhr.onload = function(){}; + }; + xhr.open("GET",path, true); + xhr.send(); +} + +// Home page specific +if (document.getElementById('profile')) { + hello.on('auth.login', function(auth) { + + // Call user information, for the given network + hello(auth.network).api('me').then(function(r) { + // Inject it into the container + var label = document.getElementById('profile_' + auth.network); + if (!label) { + label = document.createElement('div'); + label.id = 'profile_' + auth.network; + document.getElementById('profile').appendChild(label); + } + label.innerHTML = ' Hey ' + r.name; + }); + }); +} + + +})(window); diff --git a/assets/index.less b/assets/index.less index 7c453f75..df86d843 100644 --- a/assets/index.less +++ b/assets/index.less @@ -71,22 +71,31 @@ table.testtable{ text-align:center; } - td.method span.get{ - background-color:#0F6AB4; - } - td.method span.post{ - background-color:#10A54A; - } - td.method span.put{ - background-color:#c5862b; - } - td.method span.delete{ - background-color:red; - } - - td.method span.login, td.method span.logout, td.method span.getAuthResponse{ - background-color:#FF0; - color:#444; + td.method{ + span{ + background-color:#4E5160; + color:white; + + &.get, + &.post, + &.put, + &.delete{ + } + + &.get{ + background-color:#0F6AB4; + } + &.post{ + background-color:#10A54A; + } + &.put{ + background-color:#c5862b; + } + &.delete{ + background-color:red; + } + + } } td,th{ @@ -122,10 +131,12 @@ table.testtable{ button{ - color:black; - border: 1px solid #D2D2D2; - border-radius:10px; - background-color:#fff; + &.run, &.working, &.response, &.pending{ + color:black; + border: 1px solid #D2D2D2; + border-radius:10px; + background-color:#fff; + } &.run:before{ content:"\025BA"; } @@ -136,28 +147,28 @@ button{ &.response{ color : white; border-color:transparent; - } - &.response.error{ - background-color:red; - } - &.response.passed{ - background-color:#10A54A; - } - &.response.exception{ - background-color:orange; + &.error{ + background-color:red; + &:after{ + content: "\02716"; + } + } + &.passed{ + background-color:#10A54A; + &:after{ + content: "\02714"; + } + } + &.exception{ + background-color:orange; + &:after{ + content: "?"; + } + } } &.pending{ background-color:lime; } - &.response.error:after{ - content: "\02716"; - } - &.response.passed:after{ - content: "\02714"; - } - &.response.exception:after{ - content: "?"; - } } @@ -192,3 +203,46 @@ button{ background-color: red; } } + + +.tooltip{ + + @color:#444; + display: inline-block; + position:relative; + + &:before{ + background: @color; + border-radius: 50%; + color: #FFF; + content: '?'; + display: inline-block; + line-height: 1; + text-align: center; + width: 1em; + vertical-align: top; + } + + &>span{ + background:white; + border:1px solid @color; + display:none; + padding:10px; + position: absolute; + min-width:200px; + } + &:hover{ + & > span{ + display: inline-block; + } + } +} + + +.adorn-shoutout { + background: url(https://user-images.githubusercontent.com/83319/31722733-de95bbde-b3ea-11e7-96bf-4f4e8f915588.png); + background-repeat: no-repeat; + background-size: contain; + padding-left: 2em; + display: inline-block; +} \ No newline at end of file diff --git a/assets/knockout/.bower.json b/assets/knockout/.bower.json new file mode 100644 index 00000000..4fda2529 --- /dev/null +++ b/assets/knockout/.bower.json @@ -0,0 +1,36 @@ +{ + "name": "knockout", + "homepage": "http://knockoutjs.com/", + "description": "Knockout makes it easier to create rich, responsive UIs with JavaScript", + "main": "dist/knockout.js", + "moduleType": [ + "amd", + "globals", + "node" + ], + "keywords": [ + "knockout", + "mvvm", + "mvc", + "spa" + ], + "license": "MIT", + "ignore": [ + "**/.*", + "node_modules", + "bower_components", + "spec", + "build/output" + ], + "version": "3.4.0", + "_release": "3.4.0", + "_resolution": { + "type": "version", + "tag": "v3.4.0", + "commit": "b294bf04260a4a2033f09868981e026f254a582a" + }, + "_source": "https://github.com/SteveSanderson/knockout.git", + "_target": "^3.4.0", + "_originalSource": "knockout", + "_direct": true +} \ No newline at end of file diff --git a/assets/knockout/Gruntfile.js b/assets/knockout/Gruntfile.js new file mode 100644 index 00000000..ca930a7f --- /dev/null +++ b/assets/knockout/Gruntfile.js @@ -0,0 +1,174 @@ +/*global module:false*/ +module.exports = function(grunt) { + var _ = grunt.util._; + + // Project configuration + grunt.initConfig({ + // Metadata + pkg: grunt.file.readJSON('package.json'), + fragments: './build/fragments/', + banner: '/*!\n' + + ' * Knockout JavaScript library v<%= pkg.version %>\n' + + ' * (c) Steven Sanderson - <%= pkg.homepage %>\n' + + ' * License: <%= pkg.licenses[0].type %> (<%= pkg.licenses[0].url %>)\n' + + ' */\n\n', + + checktrailingspaces: { + main: { + src: [ + "**/*.{js,html,css,bat,ps1,sh}", + "!build/output/**", + "!node_modules/**" + ], + filter: 'isFile' + } + }, + build: { + debug: './build/output/knockout-latest.debug.js', + min: './build/output/knockout-latest.js' + }, + dist: { + debug: './dist/knockout.debug.js', + min: './dist/knockout.js' + }, + test: { + phantomjs: 'spec/runner.phantom.js', + node: 'spec/runner.node.js' + } + }); + + grunt.registerTask('clean', 'Clean up output files.', function (target) { + var output = grunt.config('build'); + var files = [ output.debug, output.min ]; + var options = { force: (target == 'force') }; + _.forEach(files, function (file) { + if (grunt.file.exists(file)) + grunt.file.delete(file, options); + }); + return !this.errorCount; + }); + + var trailingSpaceRegex = /[ ]$/; + grunt.registerMultiTask('checktrailingspaces', 'checktrailingspaces', function() { + var matches = []; + this.files[0].src.forEach(function(filepath) { + var content = grunt.file.read(filepath), + lines = content.split(/\r*\n/); + lines.forEach(function(line, index) { + if (trailingSpaceRegex.test(line)) { + matches.push([filepath, (index+1), line].join(':')); + } + }); + }); + if (matches.length) { + grunt.log.error("The following files have trailing spaces that need to be cleaned up:"); + grunt.log.writeln(matches.join('\n')); + return false; + } + }); + + function getReferencedSources(sourceReferencesFilename) { + // Returns the array of filenames referenced by a file like source-references.js + var result; + global.knockoutDebugCallback = function(sources) { result = sources; }; + eval(grunt.file.read(sourceReferencesFilename)); + return result; + } + + function getCombinedSources() { + var fragments = grunt.config('fragments'), + sourceFilenames = [ + fragments + 'extern-pre.js', + fragments + 'amd-pre.js', + getReferencedSources(fragments + 'source-references.js'), + fragments + 'amd-post.js', + fragments + 'extern-post.js' + ], + flattenedSourceFilenames = Array.prototype.concat.apply([], sourceFilenames), + combinedSources = flattenedSourceFilenames.map(function(filename) { + return grunt.file.read('./' + filename); + }).join(''); + + return combinedSources.replace('##VERSION##', grunt.config('pkg.version')); + } + + function buildDebug(output) { + var source = []; + source.push(grunt.config('banner')); + source.push('(function(){\n'); + source.push('var DEBUG=true;\n'); + source.push(getCombinedSources()); + source.push('})();\n'); + grunt.file.write(output, source.join('').replace(/\r\n/g, '\n')); + } + + function buildMin(output, done) { + var cc = require('closure-compiler'); + var options = { + compilation_level: 'ADVANCED_OPTIMIZATIONS', + output_wrapper: '(function() {%output%})();' + }; + grunt.log.write('Compiling...'); + cc.compile('/**@const*/var DEBUG=false;' + getCombinedSources(), options, function (err, stdout, stderr) { + if (err) { + grunt.log.error(err); + done(false); + } else { + grunt.log.ok(); + grunt.file.write(output, (grunt.config('banner') + stdout).replace(/\r\n/g, '\n')); + done(true); + } + }); + } + + grunt.registerMultiTask('build', 'Build', function() { + if (!this.errorCount) { + var output = this.data; + if (this.target === 'debug') { + buildDebug(output); + } else if (this.target === 'min') { + buildMin(output, this.async()); + } + } + return !this.errorCount; + }); + + grunt.registerMultiTask('test', 'Run tests', function () { + var done = this.async(); + grunt.util.spawn({ cmd: this.target, args: [this.data] }, + function (error, result, code) { + if (code === 127 /*not found*/) { + grunt.verbose.error(result.stderr); + // ignore this error + done(true); + } else { + grunt.log.writeln(result.stdout); + if (error) + grunt.log.error(result.stderr); + done(!error); + } + } + ); + }); + + grunt.registerTask('dist', function() { + var version = grunt.config('pkg.version'), + buildConfig = grunt.config('build'), + distConfig = grunt.config('dist'); + grunt.file.copy(buildConfig.debug, distConfig.debug); + grunt.file.copy(buildConfig.min, distConfig.min); + + console.log('To publish, run:'); + console.log(' git add bower.json'); + console.log(' git add -f ' + distConfig.debug); + console.log(' git add -f ' + distConfig.min); + console.log(' git checkout head'); + console.log(' git commit -m \'Version ' + version + ' for distribution\''); + console.log(' git tag -a v' + version + ' -m \'Add tag v' + version + '\''); + console.log(' git checkout master'); + console.log(' git push origin --tags'); + }); + + // Default task. + grunt.registerTask('default', ['clean', 'checktrailingspaces', 'build', 'test']); +}; diff --git a/assets/knockout/LICENSE b/assets/knockout/LICENSE new file mode 100644 index 00000000..08a07b1a --- /dev/null +++ b/assets/knockout/LICENSE @@ -0,0 +1,22 @@ +The MIT License (MIT) - http://www.opensource.org/licenses/mit-license.php + +Copyright (c) Steven Sanderson, the Knockout.js team, and other contributors +http://knockoutjs.com/ + +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 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/assets/knockout/README.md b/assets/knockout/README.md new file mode 100644 index 00000000..72815ace --- /dev/null +++ b/assets/knockout/README.md @@ -0,0 +1,50 @@ +**Knockout** is a JavaScript [MVVM](http://en.wikipedia.org/wiki/Model_View_ViewModel) (a modern variant of MVC) library that makes it easier to create rich, desktop-like user interfaces with JavaScript and HTML. It uses *observers* to make your UI automatically stay in sync with an underlying data model, along with a powerful and extensible set of *declarative bindings* to enable productive development. + +##Getting started + +[![Join the chat at https://gitter.im/knockout/knockout](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/knockout/knockout?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) + +**Totally new to Knockout?** The most fun place to start is the [online interactive tutorials](http://learn.knockoutjs.com/). + +For more details, see + + * Documentation on [the project's website](http://knockoutjs.com/documentation/introduction.html) + * Online examples at [http://knockoutjs.com/examples/](http://knockoutjs.com/examples/) + +##Downloading Knockout + +You can [download released versions of Knockout](http://knockoutjs.com/downloads/) from the project's website. + +For Node.js developers, Knockout is also available from [npm](https://npmjs.org/) - just run `npm install knockout`. + +##Building Knockout from sources + +If you prefer to build the library yourself: + + 1. **Clone the repo from GitHub** + + git clone https://github.com/knockout/knockout.git + cd knockout + + 2. **Acquire build dependencies.** Make sure you have [Node.js](http://nodejs.org/) installed on your workstation. This is only needed to _build_ Knockout from sources. Knockout itself has no dependency on Node.js once it is built (it works with any server technology or none). Now run: + + npm install -g grunt-cli + npm install + + The first `npm` command sets up the popular [Grunt](http://gruntjs.com/) build tool. You might need to run this command with `sudo` if you're on Linux or Mac OS X, or in an Administrator command prompt on Windows. The second `npm` command fetches the remaining build dependencies. + + 3. **Run the build tool** + + grunt + + Now you'll find the built files in `build/output/`. + +## Running the tests + +If you have [phantomjs](http://phantomjs.org/download.html) installed, then the `grunt` script will automatically run the specification suite and report its results. + +Or, if you want to run the specs in a browser (e.g., for debugging), simply open `spec/runner.html` in your browser. + +##License + +MIT license - [http://www.opensource.org/licenses/mit-license.php](http://www.opensource.org/licenses/mit-license.php) diff --git a/assets/knockout/bower.json b/assets/knockout/bower.json new file mode 100644 index 00000000..a23bbfac --- /dev/null +++ b/assets/knockout/bower.json @@ -0,0 +1,25 @@ +{ + "name": "knockout", + "homepage": "http://knockoutjs.com/", + "description": "Knockout makes it easier to create rich, responsive UIs with JavaScript", + "main": "dist/knockout.js", + "moduleType": [ + "amd", + "globals", + "node" + ], + "keywords": [ + "knockout", + "mvvm", + "mvc", + "spa" + ], + "license": "MIT", + "ignore": [ + "**/.*", + "node_modules", + "bower_components", + "spec", + "build/output" + ] +} diff --git a/assets/knockout/build/fragments/amd-post.js b/assets/knockout/build/fragments/amd-post.js new file mode 100644 index 00000000..be4600a5 --- /dev/null +++ b/assets/knockout/build/fragments/amd-post.js @@ -0,0 +1 @@ +})); diff --git a/assets/knockout/build/fragments/amd-pre.js b/assets/knockout/build/fragments/amd-pre.js new file mode 100644 index 00000000..5193403c --- /dev/null +++ b/assets/knockout/build/fragments/amd-pre.js @@ -0,0 +1,13 @@ +(function(factory) { + // Support three module loading scenarios + if (typeof define === 'function' && define['amd']) { + // [1] AMD anonymous module + define(['exports', 'require'], factory); + } else if (typeof exports === 'object' && typeof module === 'object') { + // [2] CommonJS/Node.js + factory(module['exports'] || exports); // module.exports is for Node.js + } else { + // [3] No module loader (plain "); + }; + + var buildFolderPath = getPathToScriptTagSrc(debugFileName); + window.knockoutDebugCallback = function (scriptUrls) { + for (var i = 0; i < scriptUrls.length; i++) + referenceScript(buildFolderPath + scriptUrls[i]); + }; + referenceScript(buildFolderPath + sourcesReferenceFile); +})(); diff --git a/assets/knockout/dist/knockout.debug.js b/assets/knockout/dist/knockout.debug.js new file mode 100644 index 00000000..3bbeb22a --- /dev/null +++ b/assets/knockout/dist/knockout.debug.js @@ -0,0 +1,5871 @@ +/*! + * Knockout JavaScript library v3.4.0 + * (c) Steven Sanderson - http://knockoutjs.com/ + * License: MIT (http://www.opensource.org/licenses/mit-license.php) + */ + +(function(){ +var DEBUG=true; +(function(undefined){ + // (0, eval)('this') is a robust way of getting a reference to the global object + // For details, see http://stackoverflow.com/questions/14119988/return-this-0-evalthis/14120023#14120023 + var window = this || (0, eval)('this'), + document = window['document'], + navigator = window['navigator'], + jQueryInstance = window["jQuery"], + JSON = window["JSON"]; +(function(factory) { + // Support three module loading scenarios + if (typeof define === 'function' && define['amd']) { + // [1] AMD anonymous module + define(['exports', 'require'], factory); + } else if (typeof exports === 'object' && typeof module === 'object') { + // [2] CommonJS/Node.js + factory(module['exports'] || exports); // module.exports is for Node.js + } else { + // [3] No module loader (plain + + diff --git a/demos/FilePicker/pickfromweb.png b/demos/FilePicker/pickfromweb.png new file mode 100644 index 00000000..393acc62 Binary files /dev/null and b/demos/FilePicker/pickfromweb.png differ diff --git a/ui/FilePicker/popup.html b/demos/FilePicker/popup.html similarity index 100% rename from ui/FilePicker/popup.html rename to demos/FilePicker/popup.html diff --git a/demos/FilePicker/upload.png b/demos/FilePicker/upload.png new file mode 100644 index 00000000..6b1a6bc7 Binary files /dev/null and b/demos/FilePicker/upload.png differ diff --git a/demos/FilePicker/webcam.png b/demos/FilePicker/webcam.png new file mode 100644 index 00000000..d886df45 Binary files /dev/null and b/demos/FilePicker/webcam.png differ diff --git a/demos/activities.html b/demos/activities.html index 1c2f6cd2..0b55b82e 100644 --- a/demos/activities.html +++ b/demos/activities.html @@ -2,12 +2,13 @@ hello.js - demo - activities - - + + + @@ -24,19 +25,19 @@

Activities list

diff --git a/demos/albums.html b/demos/albums.html index a3894179..d0680a40 100644 --- a/demos/albums.html +++ b/demos/albums.html @@ -1,47 +1,75 @@ - - + + - -

Load album photos with Hello.js

+.demo{ + max-height:500px; + white-space: nowrap; + overflow: auto; +} +.column{ + display:inline-block; + white-space: normal; + width:33%; + min-width: 200px; + padding:0.3%; +} +div.column{ + height:300px; + overflow: auto; + background-color: #eee; + border: 2px solid white; +} +.column button{ + width:100%; +} -
+ +Photo Albums w/ hello.js +

Photo Albums w/ hello.js

-

Signin

+

Demo

- - - +
-

Select an album to load

+ Provider + Albums + Photos +
+
+ + + +
+
+
+
- - -
-
+

Source

Include hello.js + modules

@@ -49,75 +77,163 @@

Select an album to load

-

Listener: On login authenticated. Request users profile + Albums.

+

Setup a listener

- // Get albums - hello.api(auth.network+':me/albums', function(r){ - if(!r||r.error){ - console.error("Could not open albums from "+auth.network+", try resigning in"); - return; - } +

Initiate HelloJS

+

Plug the app keys (client_id')

+ + + + + +

Get Albums

+ + -

On album selected: Load photos

+

Album button control

+ +

Get Photos

+ + +

Create photo thumbnail

-

Plug the app keys (client_id') and voila

+ + -// Initiate hellojs -hello.init( CLIENT_IDS, { - scope: "files, photos", - redirect_uri : "../redirect.html" -}); - \ No newline at end of file diff --git a/demos/amazon.html b/demos/amazon.html new file mode 100644 index 00000000..4a774418 --- /dev/null +++ b/demos/amazon.html @@ -0,0 +1,52 @@ + + + + + + + + + + + +hello( amazon ) +

hello( amazon )

+ + + +
+ Amazon Documentation + Register App +
+ + +
Signin to connect with Amazon
+ + + \ No newline at end of file diff --git a/demos/amd.html b/demos/amd.html new file mode 100644 index 00000000..2b61d1ac --- /dev/null +++ b/demos/amd.html @@ -0,0 +1,33 @@ + + + + + +

hello.js via AMD

+ + + + + +

Using an AMD script, such as this one...

+ + +

Load hello.js asynchronously and get a reference to it.

+ \ No newline at end of file diff --git a/demos/bikeindex.html b/demos/bikeindex.html new file mode 100644 index 00000000..0d41161a --- /dev/null +++ b/demos/bikeindex.html @@ -0,0 +1,47 @@ + + + + + + + + + + + +hello( bikeindex ) +

hello( bikeindex )

+ + + + +
Signin to get a list of bikes
+ + + \ No newline at end of file diff --git a/demos/box.html b/demos/box.html new file mode 100644 index 00000000..cbf7801b --- /dev/null +++ b/demos/box.html @@ -0,0 +1,54 @@ + + + + + + +hello( box ) +

hello( box )

+ + +
+ Box.com only provides authentication from apps which are using HTTPS. See Box.com API documentation +
+ + + + + + + + + + +

Initiate box client

+ + + \ No newline at end of file diff --git a/demos/client_ids.js b/demos/client_ids.js index ee5d5dc0..f54426d5 100644 --- a/demos/client_ids.js +++ b/demos/client_ids.js @@ -3,21 +3,22 @@ // Defines the CLIENT_ID (AppID's) of the OAuth2 providers // relative to the domain host where this code is presented. +var location_https = window.location.href.indexOf('https://') === 0; + + // Register your domain with Facebook at and add here var FACEBOOK_CLIENT_ID = { - 'adodson.com' : '160981280706879', 'local.knarly.com' : '285836944766385', - 'mrswitch.github.com' : '304672569582045' -}[window.location.hostname]; +}[window.location.hostname] || '160981280706879'; + // Register your domain with Windows Live at http://manage.dev.live.com and add here var WINDOWS_CLIENT_ID = { - 'adodson.com' : '00000000400D8578', - 'mrswitch.github.com' : '0000000044088105', 'local.knarly.com' : '000000004405FD31' -}[window.location.hostname]; +}[window.location.hostname] || '00000000400D8578'; -// + +// Google Register -- https://console.developers.google.com var GOOGLE_CLIENT_ID = '656984324806-sr0q9vq78tlna4hvhlmcgp2bs2ut8uj8.apps.googleusercontent.com'; // To make it a little easier @@ -30,48 +31,70 @@ var CLIENT_IDS = { // Dropbox full 't5s644xtv7n4oth'... requires production authentication var DROPBOX_CLIENT_ID = '1lkagy1bz7h2uhl'; +// LinkedIn Register - https://www.linkedin.com/secure/developer var LINKEDIN_CLIENT_ID = 'bixrjszkfk0j'; // 'exgsps7wo5o7' var YAHOO_CLIENT_ID = { - 'local.knarly.com' : 'dj0yJmk9TTNoTWV6eE5ObW5NJmQ9WVdrOWVtSmhVbk5pTm1VbWNHbzlNVFUxT0RNeU16UTJNZy0tJnM9Y29uc3VtZXJzZWNyZXQmeD0yZQ--', + 'local.knarly.com' : 'dj0yJmk9cjVDdHlDaGtrbldJJmQ9WVdrOVYyZFhSWE4yTm04bWNHbzlNQS0tJnM9Y29uc3VtZXJzZWNyZXQmeD1jOA--', 'adodson.com' : 'dj0yJmk9dkVoREN1R3BLTThhJmQ9WVdrOVYyNUpORXRXTnpZbWNHbzlNQS0tJnM9Y29uc3VtZXJzZWNyZXQmeD1mNw--' }[window.location.hostname]; var TWITTER_CLIENT_ID = { - 'local.knarly.com' : 'krGNvpEVVBE27jcemC6uA', - 'adodson.com' : 'eQuyZuECKWPiv3D7E4qdg' -}[window.location.hostname]; + 'local.knarly.com' : 'krGNvpEVVBE27jcemC6uA' +}[window.location.hostname] || 'eQuyZuECKWPiv3D7E4qdg'; + +// SoundCloud Register - http://soundcloud.com/you/apps/ var SOUNDCLOUD_CLIENT_ID = { 'local.knarly.com' : '8a4a19f86cdab097fa71a15ab26a01d6', - 'adodson.com' : '47a386647dadf913e559c12ef6db4292' + 'adodson.com' : location_https ? 'eacfb4d662e046c19e53c9e44bf7f7b7' : '47a386647dadf913e559c12ef6db4292' }[window.location.hostname]; +// Spotify - Register https://beta.developer.spotify.com/dashboard/applications/create +var SPOTIFY_CLIENT_ID = '79f269bb5e804ffda7b2eca80477f6cc'; + +// FourSquare Register - https://foursquare.com/developers/apps var FOURSQUARE_CLIENT_ID = { 'local.knarly.com' : '3HEXMBQVH2SV0VXUKXOGQRPWH1PUTEIZN4KBDY5L54ZDXCDP', 'adodson.com' : 'MFRXCJP1TKMUSYC2JBYU50L0IH0GJP1HTNS1BV0ML3NNXG5B' }[window.location.hostname]; +// Github Register - https://github.com/settings/applications var GITHUB_CLIENT_ID = { 'local.knarly.com' : 'ca7e06a718b2e8eef737', - 'adodson.com' : 'd934ef34e2e40cf9b00a' + 'adodson.com' : location_https ? 'c379ed1ef504fccfa85c' : 'd934ef34e2e40cf9b00a' }[window.location.hostname]; +// Instagram Register - http://instagram.com/developer/clients/manage/ var INSTAGRAM_CLIENT_ID = { 'local.knarly.com' : 'bfbbf362ac3148aeb1150e5b8256bbe9', - 'adodson.com' : '264d13a33ba845f396a152cc326e6f5d' + 'adodson.com' : location_https ? 'e47d210f864c4b1ca94225ddab97205a' : '264d13a33ba845f396a152cc326e6f5d' }[window.location.hostname]; -var BOX_CLIENT_ID = { - 'local.knarly.com' : 'rdyb5se2fcuioryle3qdw2wcrps959x4', - 'adodson.com' : '264d13a33ba845f396a152cc326e6f5d' -}[window.location.hostname]; var FLICKR_CLIENT_ID = { 'local.knarly.com' : '46dfea40b0f9d3765bc598966b5955d3', 'adodson.com' : '8d7cfb86e6d6bfab49579c3bfdb95796' }[window.location.hostname]; +var VK_CLIENT_ID = { + 'local.knarly.com' : '5001721', + 'adodson.com' : '5001721' +}[window.location.hostname]; + + +var TUMBLR_CLIENT_ID = { + 'local.knarly.com' : '1odTR4hLo2oAoPlIoGN8O60d1tUw0CsZGdysFFPikX7APlcXlN', + 'adodson.com' : 'BHKkYCvKt33lL34iM1yWUhkYRw1lqwifbKKTfgh5FAX5uBzzxn' +}[window.location.hostname]; + + +// join.me Register - https://developer.join.me +var JOINME_CLIENT_ID = { + 'adodson.com': (location_https ? 'hnvbrvsb63gt3fwa2c7nmhfc' : 'myenm7aw34dbgejhuw4sv8zz'), + 'local.knarly.com': 'e7jmevgbve6uzqvsttf7pb85' +}[window.location.hostname]; + // To make it a little easier var CLIENT_IDS_ALL = { @@ -82,11 +105,13 @@ var CLIENT_IDS_ALL = { twitter : TWITTER_CLIENT_ID, yahoo : YAHOO_CLIENT_ID, instagram : INSTAGRAM_CLIENT_ID, + joinme: JOINME_CLIENT_ID, linkedin : LINKEDIN_CLIENT_ID, soundcloud : SOUNDCLOUD_CLIENT_ID, foursquare : FOURSQUARE_CLIENT_ID, github : GITHUB_CLIENT_ID, - flickr: FLICKR_CLIENT_ID + flickr: FLICKR_CLIENT_ID, + vk: VK_CLIENT_ID }; @@ -94,6 +119,15 @@ var CLIENT_IDS_ALL = { // OAUTH PROXY // var OAUTH_PROXY_URL = { - 'adodson.com' : 'https://auth-server.herokuapp.com/proxy', 'local.knarly.com' : 'http://local.knarly.com:5500/proxy' -}[window.location.hostname]; \ No newline at end of file +}[window.location.hostname] || 'https://auth-server.herokuapp.com/proxy'; + + + +// +// Redirect URI +// +var REDIRECT_URI = '/hello.js/redirect.html'; +if (typeof chrome === 'object' && typeof chrome.identity === 'object' && chrome.identity.launchWebAuthFlow) { + REDIRECT_URI = 'https://'+window.location.hostname+'.chromiumapp.org/redirect.html'; +} diff --git a/demos/dropbox.html b/demos/dropbox.html index 69a67c32..0ff74743 100644 --- a/demos/dropbox.html +++ b/demos/dropbox.html @@ -1,77 +1,46 @@ - - + + + + - -HelloJS and Dropbox -

HelloJS and Dropbox

- -
+ + +hello( dropbox ) +

hello( dropbox )

+ + +
+ +

Include the UI demo script.

+ + + \ No newline at end of file + diff --git a/demos/events.html b/demos/events.html new file mode 100644 index 00000000..fd70a02c --- /dev/null +++ b/demos/events.html @@ -0,0 +1,86 @@ + + + + hello.js - Login Events + + + + + + + + + + + + + + + + +

hello.js - Login Events

+ +

Global events are bound via hello.on(eventname, handler).

+ +

auth.login

+ +

Triggered per network, whenever a user logs in, or opens a page within the same origin with a valid session.

+ + + + + + + + + + + +

auth.logout

+

Triggered per network, whenever a user logs out.

+ + + + + + +

+
+
+
+

Initiate

+

Call hello.init last, otherwise the on-page-load events will not fire.

+ + + + + + \ No newline at end of file diff --git a/demos/facebook.html b/demos/facebook.html new file mode 100644 index 00000000..921713ef --- /dev/null +++ b/demos/facebook.html @@ -0,0 +1,61 @@ + + + + + + + + + + +hello( facebook ) +

hello( facebook )

+ +

Get profile

+ + + + + + + +

Get session permissions

+ +

Obtain the list of permissions for the current session.

+ + + + + +

+
+
\ No newline at end of file
diff --git a/demos/flickr.html b/demos/flickr.html
new file mode 100644
index 00000000..c164a468
--- /dev/null
+++ b/demos/flickr.html
@@ -0,0 +1,32 @@
+
+
+
+
+
+
+
+
+
+hello( flickr )
+

hello( flickr )

+ + +
+ diff --git a/demos/foursquare.html b/demos/foursquare.html index 08c13f56..b698d2df 100644 --- a/demos/foursquare.html +++ b/demos/foursquare.html @@ -1,13 +1,14 @@ - - + + + -HelloJS and FourSquare -

HelloJS and FourSquare

+hello( foursquare ) +

hello( foursquare )

@@ -15,7 +16,7 @@

HelloJS and FourSquare

hello.on('auth.login', function(r){ // Get Profile console.log("auth.login"); - hello.api(r.network+':/me', function(p){ + hello(r.network).api('me').then(function(p) { document.getElementById(r.network).innerHTML = "Connected to "+ r.network+" as " + p.name; }); }); @@ -23,4 +24,4 @@

HelloJS and FourSquare

hello.init({ foursquare : FOURSQUARE_CLIENT_ID }, {redirect_uri:'../redirect.html'}); - \ No newline at end of file + diff --git a/demos/friends.html b/demos/friends.html index 183da0d4..aa7f2655 100644 --- a/demos/friends.html +++ b/demos/friends.html @@ -2,23 +2,27 @@ hello.js - Javascript API for OAuth2 authentication and REST services - - + + -

hello.js - me/friends

+

hello.api( me/friends )

- - - - + + + + + +

Friends list

    + +

    Include hello.js and the modules

    One should merge these for performance.

    @@ -30,29 +34,56 @@

    Include hello.js and the modules

    Initiate

    Build Button events

    - \ No newline at end of file + diff --git a/demos/github.html b/demos/github.html index 6bece8a1..e155a64f 100644 --- a/demos/github.html +++ b/demos/github.html @@ -1,38 +1,73 @@ - - + + + -HelloJS and Github -

    HelloJS and Github

    +hello( github ) +

    hello( github )

    - -
    + + +

    Get user email

    + + + +
    
    +
    +
    +

    List user repos

    + + +
    
    +
    +
    +
    \ No newline at end of file
    +},{
    +	redirect_uri : '../redirect.html',
    +//	oauth_proxy : OAUTH_PROXY_URL
    +});
    +
    diff --git a/demos/google.html b/demos/google.html
    new file mode 100644
    index 00000000..afbffddf
    --- /dev/null
    +++ b/demos/google.html
    @@ -0,0 +1,45 @@
    +
    +
    +
    +
    +
    +hello( google )
    +

    hello( google )

    +

    Login to google

    + + + + + +
    
    +
    +
    +
    +
    +

    Initiate the library

    + + + + + + + diff --git a/demos/google_upload.html b/demos/google_upload.html index bc4d94ee..bd12ca07 100644 --- a/demos/google_upload.html +++ b/demos/google_upload.html @@ -1,5 +1,6 @@ - + + -

    Upload to Google Drive

    - +

    hello.js to Google Drive

    -
    +
    +
    
    +
     

    Include the SDK's

    @@ -23,31 +25,35 @@

    Upload to Google Drive

    Add event listeners for the login completed event and make a request for the users profile. Once that's loaded push it to the page.

    The function called when the above form is submitted

    \ No newline at end of file + + + diff --git a/demos/helper/alert-https.js b/demos/helper/alert-https.js new file mode 100644 index 00000000..8ed83549 --- /dev/null +++ b/demos/helper/alert-https.js @@ -0,0 +1,13 @@ +if(document.location.href.indexOf('https://')!==0){ + document.body.appendChild((function(){ + var div = document.createElement('div'); + div.className = "alert alert-warning"; + div.appendChild((function(){ + var a = document.createElement('a'); + a.href = document.location.href.replace('http://', 'https://'); + a.innerHTML = "Launch page with secure protocol - https://"; + return a; + })()); + return div; + })()); +} \ No newline at end of file diff --git a/demos/helper/alert.css b/demos/helper/alert.css new file mode 100644 index 00000000..01d08921 --- /dev/null +++ b/demos/helper/alert.css @@ -0,0 +1,16 @@ +.alert { + display: block; + padding: 15px; + margin-bottom: 20px; + border: 1px solid rgba(0, 0, 0, 0); + border-radius: 4px; +} +.alert-warning{ + color: #8A6D3B; + background-color: #FCF8E3; + border-color: #FAEBCC; +} +.alert.alert-warning:before { + content: "Warning: "; + font-weight: bold; +} diff --git a/demos/helper/uiFiles.css b/demos/helper/uiFiles.css new file mode 100644 index 00000000..e3f502ed --- /dev/null +++ b/demos/helper/uiFiles.css @@ -0,0 +1,13 @@ +#getMeFiles li img{ + width:24px; + height:24px; +} + +#getMeFiles ul.empty:after{ + content:"empty"; +} + +#getMeFiles a + a{ + margin-left:10px; +} + diff --git a/demos/helper/uiFiles.js b/demos/helper/uiFiles.js new file mode 100644 index 00000000..e32c9335 --- /dev/null +++ b/demos/helper/uiFiles.js @@ -0,0 +1,93 @@ +// uiFiles.js +// Creates a common UI component for inspecting the providers filesystem + +function uiFiles(network, target, parent){ + + parent = parent || ''; + + var app = hello( network ); + + // Get Files + app.api('me/files', {parent: parent}).then(function(p) { + + var ul = document.createElement('ul'); + (target||document.getElementById('uiFiles')).appendChild(ul); + + // Is the response empty + if (!p.data.length) { + ul.className="this applications folder is empty"; + return; + } + + // Else lets get the children + p.data.forEach(function(item){ + + + var li = document.createElement('li'); + + // Thumbnail + if(item.thumbnail) { + var img = document.createElement('img'); + img.src=item.thumbnail; + li.appendChild(img); + } + + // Label + var label = document.createElement('a'); + label.href="javascript:void(0);"; + label.className = "name"; + label.innerHTML = item.name; + label.onclick = function(){ + var target = this.parentNode; + var ul = target.getElementsByTagName('ul'), + ul = ul.length>0?ul[0]:false; + + if( ul && ul.style.display === 'none' ){ + ul.style.display = 'block'; + } + else if( ul ){ + ul.style.display = 'none'; + } + else if(item.files){ + uiFiles(network, target, item.files); + } + }; + li.appendChild(label); + + + // Is a URL available for this resource? + if (item.downloadLink) { + var link = document.createElement('a'); + link.target = "_blank"; + link.download = item.name; + link.href = item.downloadLink; + link.innerHTML = "download"; + li.appendChild(link); + } + + // Can we read this resource into the browser? + if (item.file) { + var file = document.createElement('a'); + file.href="javascript:void(0);"; + file.innerHTML = "read"; + file.onclick = function(){ + // Get a raw file + app.api(item.downloadLink, function(a){ + var a = window.URL.createObjectURL(a); + window.open(a); + }); + }; + li.appendChild(file); + } + ul.appendChild(li); + }); + + }, function(p) { + + if(p.error){ + alert(p.error.message?p.error.message:p.error); + return; + } + + }); +} diff --git a/demos/helper/uiProfile.js b/demos/helper/uiProfile.js new file mode 100644 index 00000000..5bcbcb0e --- /dev/null +++ b/demos/helper/uiProfile.js @@ -0,0 +1,50 @@ +// Profile UI +// Displays the users profile details + + +// Listen to signin requests +hello.on('auth.login', function(r) { + // Get Profile + hello( r.network ).api( '/me' ).then( function(p) { + var label = document.getElementById(r.network); + label.innerHTML = "Connected to "+ r.network+" as " + p.name; + + // On chrome apps we're not able to get remote images + // This is a workaround + if (typeof(chrome) === 'object') { + img_xhr(label.getElementsByTagName('img')[0], p.thumbnail); + } + }); +}); + + +// Intiate App credentials +hello.init({ + google : CLIENT_IDS_ALL.google, + windows : CLIENT_IDS_ALL.windows, + facebook : CLIENT_IDS_ALL.facebook, + twitter : CLIENT_IDS_ALL.twitter +},{ + scope : 'email', + redirect_uri: REDIRECT_URI +}); + + +// Bind events to the buttons on the page +var b = Array.prototype.slice.call(document.querySelectorAll('button.profile')); +b.forEach(function(btn){ + btn.onclick = function(){ + hello(this.id).login(); + }; +}); + +// Utility for loading the thumbnail in chromeapp +function img_xhr(img, url) { + var xhr = new XMLHttpRequest(); + xhr.open('GET', url, true); + xhr.responseType = 'blob'; + xhr.onload = function(e) { + img.src = window.URL.createObjectURL(this.response); + }; + xhr.send(); +} \ No newline at end of file diff --git a/demos/index.html b/demos/index.html new file mode 100644 index 00000000..29bafe2d --- /dev/null +++ b/demos/index.html @@ -0,0 +1,50 @@ +--- +title: HelloJS Demos +layout: default +--- + +

    hello.js demos

    + + +

    Apps

    +
  • Demo photo app
  • + +

    Core

    +
  • login
  • +
  • events
  • + +

    API endpoints

    +
  • activities
  • +
  • albums
  • +
  • friends
  • +
  • profile
  • +
  • share
  • +
  • upload-base64
  • +
  • upload
  • + +

    Web Services

    +
  • bikeindex
  • +
  • dropbox
  • +
  • facebook
  • +
  • flickr
  • +
  • foursquare
  • +
  • github
  • +
  • google
  • +
  • google_upload
  • +
  • instagram
  • +
  • joinme
  • +
  • linkedin
  • + +
  • soundcloud
  • +
  • spotify
  • +
  • twitter
  • +
  • vimeo
  • +
  • windows
  • +
  • yahoo
  • + + +

    Code sugar

    +
  • AMD
  • +
  • Promises/A+
  • \ No newline at end of file diff --git a/demos/instagram.html b/demos/instagram.html index ce8daf33..a541f4df 100644 --- a/demos/instagram.html +++ b/demos/instagram.html @@ -1,48 +1,160 @@ - - + + + -HelloJS and Instagram -

    HelloJS and Instagram

    +hello( instagram ) +

    hello( instagram )

    - +
    + +

    The button above executes getPhotos()

    + + +

    Set up your client id

    + + + + +

    Like

    + + + +

    Once photos are loaded, click the photo to 'like'

    + + + + + + + + \ No newline at end of file diff --git a/demos/issue41.html b/demos/issue41.html new file mode 100644 index 00000000..1c7dbba7 --- /dev/null +++ b/demos/issue41.html @@ -0,0 +1,76 @@ + + + + + DEMO + + + + + + + + + +

    Bem vindo (!) à Microsoft

    + + + +

    + Sair +

    + + + + + \ No newline at end of file diff --git a/demos/joinme.html b/demos/joinme.html new file mode 100644 index 00000000..560c82f7 --- /dev/null +++ b/demos/joinme.html @@ -0,0 +1,47 @@ + + + + + + + + + + +hello( joinme ) +

    hello( joinme )

    + + +
    + + + diff --git a/demos/linkedin.html b/demos/linkedin.html index 4ff736e2..12b2c561 100644 --- a/demos/linkedin.html +++ b/demos/linkedin.html @@ -1,21 +1,22 @@ - - + + + -HelloJS and LinkedIn -

    HelloJS and LinkedIn

    +hello( linkedin ) +

    hello( linkedin )

    \ No newline at end of file + diff --git a/demos/login-events.html b/demos/login-events.html deleted file mode 100644 index 88448834..00000000 --- a/demos/login-events.html +++ /dev/null @@ -1,50 +0,0 @@ - - - - hello.js - Login Events - - - - - - - -

    hello.js - Login Events

    - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/demos/login.html b/demos/login.html new file mode 100644 index 00000000..fd2d30f3 --- /dev/null +++ b/demos/login.html @@ -0,0 +1,169 @@ + + + + hello.js - Login Events + + + + + + + + + + + + + +

    hello login

    + +

    hello.login

    + + + + + + + +
    
    +
    +
    +
    +

    Set up credentials for all experiments.

    + + +

    hello.login [display:page]

    +

    This demo will redirect the browser window through the OAuth signin flow via the redirect_url, and return the browser window to the page_uri (the default value is the current page).

    + + + + + + + +
    
    +
    +
    +
    +

    Changing the value of page_uri in the request can be used to navigate to another page after the user has signed in. The example below navigates the user agent to the demos/ directory.

    + + + + + + + + + +

    If the final page is the same as the redirect_uri path then the page_uri must be disabled by setting it to false, i.e. page_uri=false + +

    hello.logout

    + + + + + + + + +
    
    +
    +
    +
    +

    hello.logout [force]

    + +

    Force logout from providers site too

    + + + + + + + + +
    
    +
    +
    +
    +
    +

    hello.login [scope]

    + +

    Force assign another scope

    + + + + + + + + +
    
    +
    +
    +
    +
    +
    +
    +
    +
    diff --git a/demos/paypal.html b/demos/paypal.html
    index 562d985c..8f14b023 100644
    --- a/demos/paypal.html
    +++ b/demos/paypal.html
    @@ -1,23 +1,25 @@
     
     
    -
    -
    +
    +
     
    +
     
    +
     
    -HelloJS and PayPal
    -

    HelloJS and PayPal

    +hello( paypal ) +

    hello( paypal )

    \ No newline at end of file + diff --git a/demos/profile.html b/demos/profile.html index 90f8e898..0626e0fa 100644 --- a/demos/profile.html +++ b/demos/profile.html @@ -1,25 +1,27 @@ - - + + + + + + -

    Demo hello.api('/me')

    - - - +

    hello.api( me )

    - \ No newline at end of file +

    Listen to the event "auth.login", and call hello( network ).api( 'me' ).then( handler )

    + +

    Demo

    + + + + + +

    Code

    + diff --git a/demos/promises.html b/demos/promises.html new file mode 100644 index 00000000..6e0fb3b0 --- /dev/null +++ b/demos/promises.html @@ -0,0 +1,95 @@ + + + + + + + + + + +

    hello, then

    + +

    The functions hello.api, hello.login and hello.logout return a Promises/A+ 1.1.1 compliant then method.

    + +

    Example hello.api().then()

    +

    This example shows how to use Promises to act on the response from hello.login and hello.api calls.

    + + + + + + +

    Promise.all

    + +

    Promise.all is not native in IE yet so here's a shim

    + + + +

    Example Promise.all

    + + +

    + + +

    
    +
    +
    +
    +
    +
    +

    Initiate app

    + diff --git a/demos/sdk/facebook.html b/demos/sdk/facebook.html new file mode 100644 index 00000000..7bd7670d --- /dev/null +++ b/demos/sdk/facebook.html @@ -0,0 +1,52 @@ + + + + +
    +

    Facebook proprietary SDK

    + +

    SignIn

    + + +

    SignOut: of this app and Facebook.com

    + + +

    Include the SDK's

    + + +

    FB.Event.subscribe

    + + +

    FB.init

    + + +

    FB.init

    + \ No newline at end of file diff --git a/demos/sdk/google-content-proxy.html b/demos/sdk/google-content-proxy.html new file mode 100644 index 00000000..c39eeb76 --- /dev/null +++ b/demos/sdk/google-content-proxy.html @@ -0,0 +1,13 @@ +
    \ No newline at end of file diff --git a/demos/sdk/google.html b/demos/sdk/google.html new file mode 100644 index 00000000..141f4971 --- /dev/null +++ b/demos/sdk/google.html @@ -0,0 +1,54 @@ + + + + +Windows Live demo + + + + + +

    Google SDK

    + +

    Signin

    + + +

    Signout: of this app only

    + diff --git a/demos/sdk/google_upload.html b/demos/sdk/google_upload.html index adf38501..ae872faf 100644 --- a/demos/sdk/google_upload.html +++ b/demos/sdk/google_upload.html @@ -1,5 +1,5 @@ - + + + + +

    LinkedIn SDK

    + +

    SignIn

    + +
    + +

    SignOut: of app and LinkedIn.com

    + + +

    Status Update

    + + + + + + + +
    + + + \ No newline at end of file diff --git a/demos/sdk/live.html b/demos/sdk/live.html index f1803ca3..e2c1c9bf 100644 --- a/demos/sdk/live.html +++ b/demos/sdk/live.html @@ -1,13 +1,20 @@ - - + + Windows Live demo + +

    Signin

    + +

    Signout: of app and windows

    + + + - + +

    Profile Demo: With Windows Live and FaceBook SDK's

    diff --git a/demos/sdk/soundcloud.html b/demos/sdk/soundcloud.html new file mode 100644 index 00000000..dfc8fa87 --- /dev/null +++ b/demos/sdk/soundcloud.html @@ -0,0 +1,23 @@ + + + + + +Soundcloud demo +

    Soundcloud demo

    + +

    Signin

    + + +

    Signout: of app and windows

    + + + + + \ No newline at end of file diff --git a/demos/upload_sdks.html b/demos/sdk/upload_sdks.html similarity index 97% rename from demos/upload_sdks.html rename to demos/sdk/upload_sdks.html index ce7cb1d0..606259ba 100644 --- a/demos/upload_sdks.html +++ b/demos/sdk/upload_sdks.html @@ -1,6 +1,6 @@ - - + +

    Upload demo with proprietary SDK's

    diff --git a/demos/share.html b/demos/share.html index d2c0d36f..ff3ed48e 100644 --- a/demos/share.html +++ b/demos/share.html @@ -1,9 +1,10 @@ - - + + + @@ -25,36 +26,31 @@ -

    Demo hello.api('/me/share')

    +

    hello.api( me/share )

    - +
    - +
    - - - -
    \ No newline at end of file + diff --git a/demos/signin-oauth1.html b/demos/signin-oauth1.html index b6d01e13..358a3f05 100644 --- a/demos/signin-oauth1.html +++ b/demos/signin-oauth1.html @@ -1,31 +1,44 @@ - - + + + + -HelloJS using OAuth 1.0/1.0a Providers +

    HelloJS w/ OAuth 1.0&1.0a

    + \ No newline at end of file diff --git a/demos/skydrive-xhr.html b/demos/skydrive-xhr.html index 3827b44c..1ac307e1 100644 --- a/demos/skydrive-xhr.html +++ b/demos/skydrive-xhr.html @@ -1,6 +1,6 @@ - - + + Simple SkyDrive Demo diff --git a/demos/skydrive.html b/demos/skydrive.html index 65daff98..cdd7fced 100644 --- a/demos/skydrive.html +++ b/demos/skydrive.html @@ -1,6 +1,6 @@ - - + + Simple SkyDrive Demo diff --git a/demos/skydrive_upload.html b/demos/skydrive_upload.html index cf1245ee..abaab7b9 100644 --- a/demos/skydrive_upload.html +++ b/demos/skydrive_upload.html @@ -1,6 +1,6 @@ - - + + Simple SkyDrive Demo diff --git a/demos/slack.html b/demos/slack.html new file mode 100644 index 00000000..b1fb9f0a --- /dev/null +++ b/demos/slack.html @@ -0,0 +1,107 @@ + + + + + + +hello( slack ) +

    hello( slack )

    + +
    +

    Checkout the Slack API.

    +

    The API uses the explicit OAuth2 grant flow, therefore requires an oauth_proxy.

    +
    + + + + + + + + +

    Initiate box client

    + + diff --git a/demos/smugmug.html b/demos/smugmug.html new file mode 100644 index 00000000..13a7701a --- /dev/null +++ b/demos/smugmug.html @@ -0,0 +1,32 @@ + + + + + + + + + +hello( smugmug ) +

    hello( smugmug )

    + + +
    + diff --git a/demos/soundcloud.html b/demos/soundcloud.html index 910325b6..832c05f9 100644 --- a/demos/soundcloud.html +++ b/demos/soundcloud.html @@ -1,14 +1,15 @@ - - + + + -HelloJS and SoundCloud -

    HelloJS and SoundCloud

    +hello( soundcloud ) +

    hello( soundcloud )

    @@ -16,10 +17,11 @@

    HelloJS and SoundCloud

    hello.on('auth.login', function(r){ // Get Profile console.log("auth.login"); - hello.api(r.network+':/me', function(p){ + var hi = hello(r.network) + hi.api('me').then(function(p){ document.getElementById(r.network).innerHTML = "Connected to "+ r.network+" as " + p.name; }); - hello.api(r.network+':/tracks', function(r){ + hi.api('/tracks', function(r){ console.log(r); for(var i=0;iHelloJS and SoundCloud hello.init({ soundcloud : SOUNDCLOUD_CLIENT_ID }, {redirect_uri:'../redirect.html'}); - \ No newline at end of file + diff --git a/demos/spotify.html b/demos/spotify.html new file mode 100644 index 00000000..ced66cab --- /dev/null +++ b/demos/spotify.html @@ -0,0 +1,29 @@ + + + + + + + + + + +hello( spotify ) +

    hello( spotify )

    + + +
    + diff --git a/demos/tumblr.html b/demos/tumblr.html new file mode 100644 index 00000000..c40bd52d --- /dev/null +++ b/demos/tumblr.html @@ -0,0 +1,71 @@ + + + + + + + + + +hello( tumblr ) +

    hello( tumblr )

    + + +
    + + +

    Custom functions search

    + + + +
    
    +
    +
    +
    +

    GET me/like

    + + + +
    
    +
    +
    diff --git a/demos/twitter.html b/demos/twitter.html
    index 30451959..d1e71cde 100644
    --- a/demos/twitter.html
    +++ b/demos/twitter.html
    @@ -1,24 +1,34 @@
     
    -
    -
    +
    +
     
     
    +
     
     
     
    -HelloJS and Twitter
    -

    HelloJS and Twitter

    +hello( twitter ) +

    hello( twitter )

    - +
    + + +

    Tweet

    + +
    + +
    + +
    + + + + + + \ No newline at end of file diff --git a/demos/upload-base64.html b/demos/upload-base64.html index dd7123f1..d92ad814 100644 --- a/demos/upload-base64.html +++ b/demos/upload-base64.html @@ -1,6 +1,6 @@ - - + + @@ -8,52 +8,71 @@ -

    Upload CanvasElement with Hello.js

    - -

    Create the signin buttons

    - - +

    Upload drawing w/ hello.js

    -

    Upload form

    - Album
    - +

    1. Select canvas

    - + ... here's one i created earlier + + +

    2. Choose a place to put it.

    + + + + + Albums ->
    + +

    3. Upload

    + + -
    +
    
    +
     

    Include hello.js

    + + +

    Add event listeners for the login completed event and make a request for the users profile. Once that's loaded push it to the page.

    + @@ -84,69 +103,48 @@

    Upload CanvasElement with Hello.js

    return new Blob([new Uint8Array(a)], {type: type}); } else - throw "Cannot create blob"; + log( "Cannot create blob" ); } - @@ -155,7 +153,7 @@

    Upload CanvasElement with Hello.js

    // Initiate hellojs hello.init( CLIENT_IDS, { - scope: "publish_files", + scope: "publish_files,photos", redirect_uri : "../redirect.html" }); @@ -170,8 +168,7 @@

    Upload CanvasElement with Hello.js

    // Draw on the canvas ctx.drawImage(img, 0, 0, canvas.width, canvas.height); } -img.src = "../favicon.ico"; - +img.src = "../assets/favicon.ico"; @@ -221,4 +218,15 @@

    Upload CanvasElement with Hello.js

    } } + + + \ No newline at end of file diff --git a/demos/upload.html b/demos/upload.html index 5d1936df..a4dd104b 100644 --- a/demos/upload.html +++ b/demos/upload.html @@ -1,8 +1,8 @@ - - + + -

    Upload Photo Demo with Hello.js

    +

    Upload Photo w/ hello.js

    Please signin to gather a list of Albums you already have created

    @@ -36,46 +36,41 @@

    Upload form

    hello.on('auth.login', function(auth){ // Get Profile - hello.api(auth.network+':me', function(r){ - if(!r||r.error){ - return; - } + var hi = hello(auth.network); + hi.api('me').then(function(r){ document.getElementById(auth.network).innerHTML = "Connected to "+auth.network+" as " + r.name; + }, function(e){ + console.error(e); }); // Get albums - hello.api(auth.network+':me/albums', function(r){ - - if(!r||r.error){ - console.error("Could not open albums from "+auth.network+", try resigning in"); - return; - } - + hi.api('me/albums').then(function(r){ var grp = document.createElement('optgroup'); grp.label = auth.network; document.getElementById('albums').appendChild(grp); for(var i=0;i @@ -104,4 +101,4 @@

    Upload form

    scope: "publish_files, photos", redirect_uri : "../redirect.html" }); - \ No newline at end of file + diff --git a/demos/vimeo.html b/demos/vimeo.html new file mode 100644 index 00000000..c032294b --- /dev/null +++ b/demos/vimeo.html @@ -0,0 +1,38 @@ + + + + + +hello( vimeo ) +

    hello( vimeo )

    + + +
    
    +
    +
    +
    +
    +
    +
    +

    Initiate the library

    + + \ No newline at end of file diff --git a/demos/vk.html b/demos/vk.html new file mode 100644 index 00000000..06bb9f95 --- /dev/null +++ b/demos/vk.html @@ -0,0 +1,37 @@ + + + + + + + + + +hello( vk ) +

    hello( vk )

    + + +
    + diff --git a/demos/windows.html b/demos/windows.html new file mode 100644 index 00000000..e99aafe5 --- /dev/null +++ b/demos/windows.html @@ -0,0 +1,47 @@ + + + + + + + + + +hello( windows ) +

    hello( windows )

    + + +
    +

    Build a login, call with login('windows')

    + + +

    Assign app client id

    + + diff --git a/demos/yahoo.html b/demos/yahoo.html index a964bd38..879db3df 100644 --- a/demos/yahoo.html +++ b/demos/yahoo.html @@ -1,31 +1,39 @@ - - + + + -HelloJS and Yahoo -

    HelloJS and Yahoo

    +hello( yahoo ) +

    hello( yahoo )

    - +
    \ No newline at end of file + diff --git a/dist/hello.all.js b/dist/hello.all.js index ac8e4468..ba2d3848 100644 --- a/dist/hello.all.js +++ b/dist/hello.all.js @@ -1,118 +1,279 @@ +/*! hellojs v1.20.0 - (c) 2012-2023 Andrew Dodson - MIT https://adodson.com/hello.js/LICENSE */ +// ES5 Object.create +if (!Object.create) { + + // Shim, Object create + // A shim for Object.create(), it adds a prototype to a new object + Object.create = (function() { + + function F() {} + + return function(o) { + + if (arguments.length != 1) { + throw new Error('Object.create implementation only accepts one parameter.'); + } + + F.prototype = o; + return new F(); + }; + + })(); + +} + +// ES5 Object.keys +if (!Object.keys) { + Object.keys = function(o, k, r) { + r = []; + for (k in o) { + if (r.hasOwnProperty.call(o, k)) + r.push(k); + } + + return r; + }; +} +/* eslint-disable no-extend-native */ +// ES5 [].indexOf +if (!Array.prototype.indexOf) { + Array.prototype.indexOf = function(s) { + + for (var j = 0; j < this.length; j++) { + if (this[j] === s) { + return j; + } + } + + return -1; + }; +} + +// ES5 [].forEach +if (!Array.prototype.forEach) { + Array.prototype.forEach = function(fun/*, thisArg*/) { + + if (this === void 0 || this === null) { + throw new TypeError(); + } + + var t = Object(this); + var len = t.length >>> 0; + if (typeof fun !== 'function') { + throw new TypeError(); + } + + var thisArg = arguments.length >= 2 ? arguments[1] : void 0; + for (var i = 0; i < len; i++) { + if (i in t) { + fun.call(thisArg, t[i], i, t); + } + } + + return this; + }; +} + +// ES5 [].filter +if (!Array.prototype.filter) { + Array.prototype.filter = function(fun, thisArg) { + + var a = []; + this.forEach(function(val, i, t) { + if (fun.call(thisArg || void 0, val, i, t)) { + a.push(val); + } + }); + + return a; + }; +} + +// Production steps of ECMA-262, Edition 5, 15.4.4.19 +// Reference: http://es5.github.io/#x15.4.4.19 +if (!Array.prototype.map) { + + Array.prototype.map = function(fun, thisArg) { + + var a = []; + this.forEach(function(val, i, t) { + a.push(fun.call(thisArg || void 0, val, i, t)); + }); + + return a; + }; +} + +// ES5 isArray +if (!Array.isArray) { + + // Function Array.isArray + Array.isArray = function(o) { + return Object.prototype.toString.call(o) === '[object Array]'; + }; + +} + +// Test for location.assign +if (typeof window === 'object' && typeof window.location === 'object' && !window.location.assign) { + + window.location.assign = function(url) { + window.location = url; + }; + +} + +// Test for Function.bind +if (!Function.prototype.bind) { + + // MDN + // Polyfill IE8, does not support native Function.bind + Function.prototype.bind = function(b) { + + if (typeof this !== 'function') { + throw new TypeError('Function.prototype.bind - what is trying to be bound is not callable'); + } + + function C() {} + + var a = [].slice; + var f = a.call(arguments, 1); + var _this = this; + var D = function() { + return _this.apply(this instanceof C ? this : b || window, f.concat(a.call(arguments))); + }; + + C.prototype = this.prototype; + D.prototype = new C(); + + return D; + }; + +} +/* eslint-enable no-extend-native */ /** * @hello.js * * HelloJS is a client side Javascript SDK for making OAuth2 logins and subsequent REST calls. * * @author Andrew Dodson - * @company Knarly + * @website https://adodson.com/hello.js/ * - * @copyright Andrew Dodson, 2012 - 2013 + * @copyright Andrew Dodson, 2012 - 2015 * @license MIT: You are free to use and modify this code for any use, on the condition that this copyright notice remains. */ -// Can't use strict with arguments.callee -//"use strict"; - - -// -// Setup -// Initiates the construction of the library - -var hello = function(name){ +var hello = function(name) { return hello.use(name); }; - hello.utils = { - // - // Extend the first object with the properties and methods of the second - extend : function(a,b){ - for(var x in b){ - a[x] = b[x]; - } - } -}; - + // Extend the first object with the properties and methods of the second + extend: function(r /*, a[, b[, ...]] */) { -///////////////////////////////////////////////// -// Core library -// This contains the following methods -// ---------------------------------------------- -// init -// login -// logout -// getAuthRequest -///////////////////////////////////////////////// - -hello.utils.extend( hello, { + // Get the arguments as an array but ommit the initial item + Array.prototype.slice.call(arguments, 1).forEach(function(a) { + if (Array.isArray(r) && Array.isArray(a)) { + Array.prototype.push.apply(r, a); + } + else if (r && (r instanceof Object || typeof r === 'object') && a && (a instanceof Object || typeof a === 'object') && r !== a) { + for (var x in a) { + // Prevent prototype pollution + if (x === '__proto__' || x === 'constructor') { + continue; + } - // - // Options - settings : { + r[x] = hello.utils.extend(r[x], a[x]); + } + } + else { - // - // OAuth 2 authentication defaults - redirect_uri : window.location.href.split('#')[0], - response_type : 'token', - display : 'popup', - state : '', + if (Array.isArray(a)) { + // Clone it + a = a.slice(0); + } - // - // OAuth 1 shim - // The path to the OAuth1 server for signing user requests - // Wanna recreate your own? checkout https://github.com/MrSwitch/node-oauth-shim - oauth_proxy : 'https://auth-server.herokuapp.com/proxy', + r = a; + } + }); - // - // API Timeout, milliseconds - timeout : 20000, + return r; + } +}; - // - // Default Network - default_service : null, +// Core library +hello.utils.extend(hello, { - // - // Force signin - // When hello.login is fired, ignore current session expiry and continue with login - force : true - }, + settings: { + // OAuth2 authentication defaults + redirect_uri: window.location.href.split('#')[0], + response_type: 'token', + display: 'popup', + state: '', - // - // Service - // Get/Set the default service - // - service : function(service){ + // OAuth1 shim + // The path to the OAuth1 server for signing user requests + // Want to recreate your own? Checkout https://github.com/MrSwitch/node-oauth-shim + oauth_proxy: 'https://auth-server.herokuapp.com/proxy', + + // API timeout in milliseconds + timeout: 20000, + + // Popup Options + popup: { + resizable: 1, + scrollbars: 1, + width: 500, + height: 550 + }, - //this.utils.warn("`hello.service` is deprecated"); + // Default scope + // Many services require atleast a profile scope, + // HelloJS automatially includes the value of provider.scope_map.basic + // If that's not required it can be removed via hello.settings.scope.length = 0; + scope: ['basic'], + + // Scope Maps + // This is the default module scope, these are the defaults which each service is mapped too. + // By including them here it prevents the scope from being applied accidentally + scope_map: { + basic: '' + }, - if(typeof (service) !== 'undefined' ){ - return this.utils.store( 'sync_service', service ); - } - return this.utils.store( 'sync_service' ); + // Default service / network + default_service: null, + + // Force authentication + // When hello.login is fired. + // (null): ignore current session expiry and continue with login + // (true): ignore current session expiry and continue with login, ask for user to reauthenticate + // (false): if the current session looks good for the request scopes return the current session. + force: null, + + // Page URL + // When 'display=page' this property defines where the users page should end up after redirect_uri + // Ths could be problematic if the redirect_uri is indeed the final place, + // Typically this circumvents the problem of the redirect_url being a dumb relay page. + page_uri: window.location.href }, + // Service configuration objects + services: {}, - // - // Services - // Collection of objects which define services configurations - services : {}, - - // // Use - // Define a new instance of the Hello library with a default service - // - use : function(service){ + // Define a new instance of the HelloJS library with a default service + use: function(service) { // Create self, which inherits from its parent - var self = this.utils.objectCreate(this); + var self = Object.create(this); // Inherit the prototype from its parent - self.settings = this.utils.objectCreate(this.settings); + self.settings = Object.create(this.settings); // Define the default service - if(service){ + if (service) { self.settings.default_service = service; } @@ -122,293 +283,307 @@ hello.utils.extend( hello, { return self; }, - - // - // init - // Define the clientId's for the endpoint services + // Initialize + // Define the client_ids for the endpoint services // @param object o, contains a key value pair, service => clientId // @param object opts, contains a key value pair of options used for defining the authentication defaults // @param number timeout, timeout in seconds - // - init : function(services,options){ + init: function(services, options) { var utils = this.utils; - if(!services){ + if (!services) { return this.services; } // Define provider credentials // Reformat the ID field - for( var x in services ){if(services.hasOwnProperty(x)){ - if( typeof(services[x]) !== 'object' ){ - services[x] = {id : services[x]}; + for (var x in services) {if (services.hasOwnProperty(x)) { + if (typeof (services[x]) !== 'object') { + services[x] = {id: services[x]}; } }} - // - // merge services if there already exists some - this.services = utils.merge(this.services, services); - - // - // Format the incoming - for( x in this.services ){if(this.services.hasOwnProperty(x)){ - this.services[x].scope = this.services[x].scope || {}; - }} + // Merge services if there already exists some + utils.extend(this.services, services); - // // Update the default settings with this one. - if(options){ - this.settings = utils.merge(this.settings, options); + if (options) { + utils.extend(this.settings, options); // Do this immediatly incase the browser changes the current path. - if("redirect_uri" in options){ - this.settings.redirect_uri = utils.realPath(options.redirect_uri); + if ('redirect_uri' in options) { + this.settings.redirect_uri = utils.url(options.redirect_uri).href; } } return this; }, - - // // Login // Using the endpoint - // @param network stringify name to connect to - // @param options object (optional) {display mode, is either none|popup(default)|page, scope: email,birthday,publish, .. } - // @param callback function (optional) fired on signin - // - login : function(){ - - // Create self - // An object which inherits its parent as the prototype. - // And constructs a new event chain. - var self = this.use(), - utils = self.utils; + // @param network stringify name to connect to + // @param options object (optional) {display mode, is either none|popup(default)|page, scope: email,birthday,publish, .. } + // @param callback function (optional) fired on signin + login: function() { - // Get parameters - var p = utils.args({network:'s', options:'o', callback:'f'}, arguments); + // Create an object which inherits its parent as the prototype and constructs a new event chain. + var _this = this; + var utils = _this.utils; + var error = utils.error; + var promise = utils.Promise(); - // Apply the args - self.args = p; + // Get parameters + var p = utils.args({network: 's', options: 'o', callback: 'f'}, arguments); // Local vars var url; - // merge/override options with app defaults - var opts = p.options = utils.merge(self.settings, p.options || {} ); + // Get all the custom options and store to be appended to the querystring + var qs = utils.diffKey(p.options, _this.settings); + + // Merge/override options with app defaults + var opts = p.options = utils.merge(_this.settings, p.options || {}); + + // Merge/override options with app defaults + opts.popup = utils.merge(_this.settings.popup, p.options.popup || {}); // Network - p.network = self.settings.default_service = p.network || self.settings.default_service; + p.network = p.network || _this.settings.default_service; - // - // Bind listener - self.on('complete', p.callback); + // Bind callback to both reject and fulfill states + promise.proxy.then(p.callback, p.callback); - // Is our service valid? - if( typeof(p.network) !== 'string' || !( p.network in self.services ) ){ - // trigger the default login. - // ahh we dont have one. - self.emitAfter('error complete', {error:{ - code : 'invalid_network', - message : 'The provided network was not recognized' - }}); - return self; + // Trigger an event on the global listener + function emit(s, value) { + hello.emit(s, value); } - // - var provider = self.services[p.network]; + promise.proxy.then(emit.bind(this, 'auth.login auth'), emit.bind(this, 'auth.failed auth')); - // - // Callback - // Save the callback until state comes back. - // - var responded = false; + // Is our service valid? + if (typeof (p.network) !== 'string' || !(p.network in _this.services)) { + // Trigger the default login. + // Ahh we dont have one. + return promise.reject(error('invalid_network', 'The provided network was not recognized')); + } + + var provider = _this.services[p.network]; - // // Create a global listener to capture events triggered out of scope - var callback_id = utils.globalEvent(function(obj){ + var callbackId = utils.globalEvent(function(obj) { - // - // Cancel the popup close listener - responded = true; + // The responseHandler returns a string, lets save this locally + if (obj) { + if (typeof (obj) == 'string') { + obj = JSON.parse(obj); + } + } + else { + obj = error('cancelled', 'The authentication was not completed'); + } - // // Handle these response using the local // Trigger on the parent - if(!obj.error){ + if (!obj.error) { // Save on the parent window the new credentials // This fixes an IE10 bug i think... atleast it does for me. - utils.store(obj.network,obj); + utils.store(obj.network, obj); - // Trigger local complete events - self.emit("complete success login auth.login auth", { - network : obj.network, - authResponse : obj + // Fulfill a successful login + promise.fulfill({ + network: obj.network, + authResponse: obj }); } - else{ - // Trigger local complete events - self.emit("complete error failed auth.failed", { - error : obj.error - }); + else { + // Reject a successful login + promise.reject(obj); } }); + var redirectUri = utils.url(opts.redirect_uri).href; + // May be a space-delimited list of multiple, complementary types + var responseType = provider.oauth.response_type || opts.response_type; - // - // QUERY STRING - // querystring parameters, we may pass our own arguments to form the querystring - // - p.qs = { - client_id : provider.id, - response_type : opts.response_type, - redirect_uri : opts.redirect_uri, - display : opts.display, - scope : 'basic', - state : { - client_id : provider.id, - network : p.network, - display : opts.display, - callback : callback_id, - state : opts.state, - oauth_proxy : opts.oauth_proxy + // Fallback to token if the module hasn't defined a grant url + if (/\bcode\b/.test(responseType) && !provider.oauth.grant) { + responseType = responseType.replace(/\bcode\b/, 'token'); + } + + // Query string parameters, we may pass our own arguments to form the querystring + p.qs = utils.merge(qs, { + client_id: encodeURIComponent(provider.id), + response_type: encodeURIComponent(responseType), + redirect_uri: encodeURIComponent(redirectUri), + state: { + client_id: provider.id, + network: p.network, + display: opts.display, + callback: callbackId, + state: opts.state, + redirect_uri: redirectUri } - }; + }); - // - // SESSION // Get current session for merging scopes, and for quick auth response var session = utils.store(p.network); - // - // SCOPES - // Authentication permisions - // - var scope = opts.scope; - if(scope && typeof(scope)!=='string'){ - scope = scope.join(','); + // Scopes (authentication permisions) + // Ensure this is a string - IE has a problem moving Arrays between windows + // Append the setup scope + var SCOPE_SPLIT = /[,\s]+/; + + // Include default scope settings (cloned). + var scope = _this.settings.scope ? [_this.settings.scope.toString()] : []; + + // Extend the providers scope list with the default + var scopeMap = utils.merge(_this.settings.scope_map, provider.scope || {}); + + // Add user defined scopes... + if (opts.scope) { + scope.push(opts.scope.toString()); } - scope = (scope ? scope + ',' : '') + p.qs.scope; - // Append scopes from a previous session + // Append scopes from a previous session. // This helps keep app credentials constant, // Avoiding having to keep tabs on what scopes are authorized - if(session && "scope" in session){ - scope += ","+session.scope.join(","); + if (session && 'scope' in session && session.scope instanceof String) { + scope.push(session.scope); } - // Save in the State - p.qs.state.scope = utils.unique( scope.split(/[,\s]+/) ); - // Map replace each scope with the providers default scopes - p.qs.scope = scope.replace(/[^,\s]+/ig, function(m){ - return (m in provider.scope) ? provider.scope[m] : ''; - }).replace(/[,\s]+/ig, ','); + // Join and Split again + scope = scope.join(',').split(SCOPE_SPLIT); - // remove duplication and empty spaces - p.qs.scope = utils.unique(p.qs.scope.split(/,+/)).join( provider.scope_delim || ','); + // Format remove duplicates and empty values + scope = utils.unique(scope).filter(filterEmpty); + // Save the the scopes to the state with the names that they were requested with. + p.qs.state.scope = scope.join(','); + // Map scopes to the providers naming convention + scope = scope.map(function(item) { + // Does this have a mapping? + return (item in scopeMap) ? scopeMap[item] : item; + }); + // Stringify and Arrayify so that double mapped scopes are given the chance to be formatted + scope = scope.join(',').split(SCOPE_SPLIT); - // - // FORCE - // Is the user already signed in with the appropriate scopes, valid access_token? - // - if(opts.force===false){ + // Again... + // Format remove duplicates and empty values + scope = utils.unique(scope).filter(filterEmpty); - if( session && "access_token" in session && session.access_token && "expires" in session && session.expires > ((new Date()).getTime()/1e3) ){ - // What is different about the scopes in the session vs the scopes in the new login? - var diff = utils.diff( session.scope || [], p.qs.state.scope || [] ); - if(diff.length===0){ + // Join with the expected scope delimiter into a string + p.qs.scope = scope.join(provider.scope_delim || ','); - // Nothing has changed - self.emit("notice", "User already has a valid access_token"); + // Is the user already signed in with the appropriate scopes, valid access_token? + if (opts.force === false) { - // Ok trigger the callback - self.emitAfter("complete success login", { - network : p.network, - authResponse : session + if (session && 'access_token' in session && session.access_token && 'expires' in session && session.expires > ((new Date()).getTime() / 1e3)) { + // What is different about the scopes in the session vs the scopes in the new login? + var diff = utils.diff((session.scope || '').split(SCOPE_SPLIT), (p.qs.state.scope || '').split(SCOPE_SPLIT)); + if (diff.length === 0) { + + // OK trigger the callback + promise.fulfill({ + unchanged: true, + network: p.network, + authResponse: session }); // Nothing has changed - return self; + return promise; } } } - // - // REDIRECT_URI - // Is the redirect_uri root? - // - p.qs.redirect_uri = utils.realPath(p.qs.redirect_uri); - - // Add OAuth to state - if(provider.oauth){ - p.qs.state.oauth = provider.oauth; + // Page URL + if (opts.display === 'page' && opts.page_uri) { + // Add a page location, place to endup after session has authenticated + p.qs.state.page_uri = utils.url(opts.page_uri).href; } - // Convert state to a string - p.qs.state = JSON.stringify(p.qs.state); - - // Bespoke // Override login querystrings from auth_options - if("login" in provider && typeof(provider.login) === 'function'){ + if ('login' in provider && typeof (provider.login) === 'function') { // Format the paramaters according to the providers formatting function provider.login(p); } + // Add OAuth to state + // Where the service is going to take advantage of the oauth_proxy + if (!/\btoken\b/.test(responseType) || + parseInt(provider.oauth.version, 10) < 2 || + (opts.display === 'none' && provider.oauth.grant && session && session.refresh_token)) { + + // Add the oauth endpoints + p.qs.state.oauth = provider.oauth; + // Add the proxy url + p.qs.state.oauth_proxy = opts.oauth_proxy; + + } + + // Convert state to a string + if (provider.oauth.base64_state) { + p.qs.state = window.btoa(JSON.stringify(p.qs.state)); + } + else { + p.qs.state = encodeURIComponent(JSON.stringify(p.qs.state)); + } - // // URL - // - if( parseInt(provider.oauth.version,10) === 1 ){ + if (parseInt(provider.oauth.version, 10) === 1) { + // Turn the request to the OAuth Proxy for 3-legged auth - url = utils.qs( opts.oauth_proxy, p.qs ); - } - else{ - url = utils.qs( provider.oauth.auth, p.qs ); + url = utils.qs(opts.oauth_proxy, p.qs, encodeFunction); } - self.emit("notice", "Authorization URL " + url ); + // Refresh token + else if (opts.display === 'none' && provider.oauth.grant && session && session.refresh_token) { + // Add the refresh_token to the request + p.qs.refresh_token = session.refresh_token; + + // Define the request path + url = utils.qs(opts.oauth_proxy, p.qs, encodeFunction); + } + else { + url = utils.qs(provider.oauth.auth, p.qs, encodeFunction); + } + + // Broadcast this event as an auth:init + emit('auth.init', p); - // // Execute // Trigger how we want self displayed - // Calling Quietly? - // - if( opts.display === 'none' ){ - // signin in the background, iframe - utils.append('iframe', { src : url, style : {position:'absolute',left:"-1000px",bottom:0,height:'1px',width:'1px'} }, 'body'); + if (opts.display === 'none') { + // Sign-in in the background, iframe + utils.iframe(url, redirectUri); } - // Triggering popup? - else if( opts.display === 'popup'){ + else if (opts.display === 'popup') { + + var popup = utils.popup(url, redirectUri, opts.popup); - var windowHeight = opts.window_height || 550; - var windowWidth = opts.window_width || 500; + var timer = setInterval(function() { + if (!popup || popup.closed) { + clearInterval(timer); + if (!promise.state) { - // Trigger callback - var popup = window.open( - url, - 'Authentication', - "resizeable=true,height=" + windowHeight + ",width=" + windowWidth + ",left="+((window.innerWidth-windowWidth)/2)+",top="+((window.innerHeight-windowHeight)/2) - ); + var response = error('cancelled', 'Login has been cancelled'); - // Ensure popup window has focus upon reload, Fix for FF. - popup.focus(); + if (!popup) { + response = error('blocked', 'Popup was blocked'); + } - var timer = setInterval(function(){ - if(popup.closed){ - clearInterval(timer); - if(!responded){ - self.emit("complete failed error", {error:{code:"cancelled", message:"Login has been cancelled"}, network:p.network }); + response.network = p.network; + + promise.reject(response); } } }, 100); @@ -418,553 +593,741 @@ hello.utils.extend( hello, { window.location = url; } - return self; - }, + return promise.proxy; + + function encodeFunction(s) {return s;} + function filterEmpty(s) {return !!s;} + }, - // - // Logout // Remove any data associated with a given service // @param string name of the service // @param function callback - // - logout : function(s, callback){ + logout: function() { + + var _this = this; + var utils = _this.utils; + var error = utils.error; - var p = this.utils.args({name:'s', callback:"f" }, arguments); + // Create a new promise + var promise = utils.Promise(); - // Create self - // An object which inherits its parent as the prototype. - // And constructs a new event chain. - var self = this.use(); + var p = utils.args({name: 's', options: 'o', callback: 'f'}, arguments); + + p.options = p.options || {}; // Add callback to events - self.on('complete', p.callback); + promise.proxy.then(p.callback, p.callback); + + // Trigger an event on the global listener + function emit(s, value) { + hello.emit(s, value); + } + + promise.proxy.then(emit.bind(this, 'auth.logout auth'), emit.bind(this, 'error')); + + // Network + p.name = p.name || this.settings.default_service; + p.authResponse = utils.store(p.name); - // Netowrk - p.name = p.name || self.settings.default_service; + if (p.name && !(p.name in _this.services)) { + + promise.reject(error('invalid_network', 'The network was unrecognized')); - if( p.name && !( p.name in self.services ) ){ - self.emitAfter("complete error", {error:{ - code : 'invalid_network', - message : 'The network was unrecognized' - }}); - return self; } - if(p.name && self.utils.store(p.name)){ + else if (p.name && p.authResponse) { + + // Define the callback + var callback = function(opts) { + + // Remove from the store + utils.store(p.name, null); + + // Emit events by default + promise.fulfill(hello.utils.merge({network: p.name}, opts || {})); + }; + + // Run an async operation to remove the users session + var _opts = {}; + if (p.options.force) { + var logout = _this.services[p.name].logout; + if (logout) { + // Convert logout to URL string, + // If no string is returned, then this function will handle the logout async style + if (typeof (logout) === 'function') { + logout = logout(callback, p); + } - // Trigger a logout callback on the provider - if(typeof(self.services[p.name].logout) === 'function'){ - self.services[p.name].logout(p); + // If logout is a string then assume URL and open in iframe. + if (typeof (logout) === 'string') { + utils.iframe(logout); + _opts.force = null; + _opts.message = 'Logout success on providers site was indeterminate'; + } + else if (logout === undefined) { + // The callback function will handle the response. + return promise.proxy; + } + } } - // Remove from the store - self.utils.store(p.name,''); - } - else if(!p.name){ - for(var x in self.services){if(self.services.hasOwnProperty(x)){ - self.logout(x); - }} - // remove the default - self.service(false); - // trigger callback + // Remove local credentials + callback(_opts); } - else{ - self.emitAfter("complete error", {error:{ - code : 'invalid_session', - message : 'There was no session to remove' - }}); - return self; + else { + promise.reject(error('invalid_session', 'There was no session to remove')); } - // Emit events by default - self.emitAfter("complete logout success auth.logout auth", true); - - return self; + return promise.proxy; }, - - - // - // getAuthResponse // Returns all the sessions that are subscribed too // @param string optional, name of the service to get information about. - // - getAuthResponse : function(service){ + getAuthResponse: function(service) { // If the service doesn't exist service = service || this.settings.default_service; - if( !service || !( service in this.services ) ){ - this.emit("complete error", {error:{ - code : 'invalid_network', - message : 'The network was unrecognized' - }}); + if (!service || !(service in this.services)) { return null; } return this.utils.store(service) || null; }, - - // - // Events - // Define placeholder for the events - events : {} + // Events: placeholder for the events + events: {} }); +// Core utilities +hello.utils.extend(hello.utils, { - - - - - -/////////////////////////////////// -// Core Utilities -/////////////////////////////////// - -hello.utils.extend( hello.utils, { + // Error + error: function(code, message) { + return { + error: { + code: code, + message: message + } + }; + }, // Append the querystring to a url // @param string url // @param object parameters - qs : function(url, params){ - if(params){ - var reg; - for(var x in params){ - if(url.indexOf(x)>-1){ - var str = "[\\?\\&]"+x+"=[^\\&]*"; - reg = new RegExp(str); - url = url.replace(reg,''); + qs: function(url, params, formatFunction) { + + if (params) { + + // Set default formatting function + formatFunction = formatFunction || encodeURIComponent; + + // Override the items in the URL which already exist + for (var x in params) { + var str = '([\\?\\&])' + x + '=[^\\&]*'; + var reg = new RegExp(str); + if (url.match(reg)) { + url = url.replace(reg, '$1' + x + '=' + formatFunction(params[x])); + delete params[x]; } } } - return url + (!this.isEmpty(params) ? ( url.indexOf('?') > -1 ? "&" : "?" ) + this.param(params) : ''); + + if (!this.isEmpty(params)) { + return url + (url.indexOf('?') > -1 ? '&' : '?') + this.param(params, formatFunction); + } + + return url; }, - - // // Param - // Explode/Encode the parameters of an URL string/object - // @param string s, String to decode - // - param : function(s){ - var b, - a = {}, - m; - - if(typeof(s)==='string'){ - - m = s.replace(/^[\#\?]/,'').match(/([^=\/\&]+)=([^\&]+)/g); - if(m){ - for(var i=0;i