diff --git a/CONTRIBUTING.md b/.github/CONTRIBUTING.md similarity index 93% rename from CONTRIBUTING.md rename to .github/CONTRIBUTING.md index 4e06e61..7192904 100644 --- a/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -19,7 +19,7 @@ Ensure the tests pass: ``` grunt test ``` - + Make your changes, add tests for your changes, then run the tests again: ``` @@ -38,6 +38,4 @@ Run the following `grunt` task to build the dist: grunt build ``` -Push to your fork, and open a [pull request](https://github.com/mobify/bellows/compare). Please ensure you describe your changes in your pull request, as they have a higher liklihood of being merged. - - +Push to your fork, and open a [pull request](https://github.com/mobify/bellows/compare). Please ensure you describe your changes in your pull request, as they have a higher likelihood of being merged. diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md new file mode 100644 index 0000000..3745d7b --- /dev/null +++ b/.github/ISSUE_TEMPLATE.md @@ -0,0 +1,12 @@ +**Feature Request** or **Bug Report** + + + + +### Summary + +### Expected behaviour + +### Actual behaviour + +### Steps to reproduce diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 0000000..045d7a3 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,21 @@ +Reviewers: GitHub @s of all reviewers + +Linked PRs: + +## Changes +- + +## TODOs: +- [ ] +1 +- [ ] Updated README +- [ ] Updated CHANGELOG +- [ ] +- [ ] + +## How To Test +- +- +- + +## Applicable Research Resources +- diff --git a/.gitignore b/.gitignore index 3fc0a6e..d734ecc 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,3 @@ node_modules/ -bower_components/ .DS_Store /.sass-cache/ diff --git a/.npmignore b/.npmignore new file mode 100644 index 0000000..0ffcfd2 --- /dev/null +++ b/.npmignore @@ -0,0 +1,8 @@ +# Ref https://docs.npmjs.com/misc/developers +.github/ +examples/ +tasks/ +templates/ +tests/ +circle.yml +Gruntfile.js diff --git a/CHANGELOG b/CHANGELOG index 8247a56..54c43ba 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,12 @@ +6.0.0 + - Publish to NPM + - Remove Zepto support in favor of jQuery + - Migrate all dependencies to NPM, remove Bower + - Migrate JS linting to eslint + - Migrate SCSS compilation to libsass + - Lint SCSS with sass-lint + - Update circleCI config with modern testing steps + - Add some GitHub templates for contributing, issues, and PRs 5.1.2 - Ensuring disabled items don't close on close 5.0.1 diff --git a/Gruntfile.js b/Gruntfile.js index 61d9eab..c73d3f7 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -1,4 +1,4 @@ -'use strict' +'use strict'; var path = require('path'); @@ -28,16 +28,18 @@ module.exports = function(grunt) { // load npm tasks var npmTasks = [ - 'grunt-contrib-uglify', - 'grunt-contrib-watch', - 'grunt-contrib-connect', - 'grunt-css', - 'grunt-shell', + 'grunt-autoprefixer', 'grunt-contrib-clean', + 'grunt-contrib-connect', 'grunt-contrib-copy', - 'grunt-autoprefixer', - 'grunt-contrib-sass', + 'grunt-contrib-uglify', + 'grunt-contrib-watch', + 'grunt-eslint', 'grunt-mocha-phantomjs', + 'grunt-open', + 'grunt-sass', + 'grunt-sass-lint', + 'grunt-shell', 'grunt-version' ]; @@ -47,10 +49,11 @@ module.exports = function(grunt) { } }); + grunt.registerTask('examples', ['build', 'connect:server', 'open:examples', 'watch']); grunt.registerTask('serve', ['build', 'connect:server', 'watch']); - grunt.registerTask('build', ['lint:dev', 'copy', 'uglify', 'version:all', 'sass', 'autoprefixer', 'cssmin']); - grunt.registerTask('release', ['lint:dev', 'test', 'shell:tagRelease']); + grunt.registerTask('build', ['sasslint', 'lint:prod', 'copy', 'uglify', 'version:all', 'sass', 'autoprefixer']); + grunt.registerTask('release', ['test', 'shell:tagRelease']); grunt.registerTask('test', ['build', 'connect:test', 'mocha_phantomjs']); - grunt.registerTask('test:browser', ['build', 'connect:test:keepalive']); + grunt.registerTask('test:browser', ['build', 'open:tests', 'connect:test:keepalive']); grunt.registerTask('default', 'build'); }; diff --git a/LICENSE b/LICENSE index 648b279..93f75d2 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2014 Mobify Research & Development Inc. +Copyright (c) 2016 Mobify Research & Development Inc. 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 diff --git a/README.md b/README.md index 9fd7a80..4900d9b 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ A mobile-first accordion UI module for progressive disclosure on the web. -[![Bower version](https://badge.fury.io/bo/bellows.svg)](http://badge.fury.io/bo/bellows) +[![NPM](https://nodei.co/npm/bellows-ui.png?downloads=true)](https://nodei.co/npm/bellows-ui/) [![Dependency Status](https://www.versioneye.com/user/projects/53ff9b7deab62a5003000009/badge.svg?style=flat)](https://www.versioneye.com/user/projects/53ff9b7deab62a5003000009) [![Build Status](https://circleci.com/gh/mobify/bellows/tree/master.svg?style=shield&circle-token=8c096b513a1f04ef1b977178c4f3358c2a42a132)](https://circleci.com/gh/mobify/bellows) @@ -10,41 +10,38 @@ A mobile-first accordion UI module for progressive disclosure on the web. ## Demo -You can find a simple demo on [the Documentation page](http://mobify.github.io/bellows). More demos can be found inside the `examples` folder in the repo. +You can find a simple demo on [the Documentation page](http://mobify.github.io/bellows). More demos can be found inside the `examples` folder in the repo. Run `grunt examples` to see them in Chrome (mobile device emulation is recommended). ## Requirements -* [Zepto](http://zeptojs.com/) -* [Velocity.js](http://velocityjs.org) +* [jQuery](http://jquery.com/) +* [Velocity.js](http://julian.com/research/velocity/) -### Velocity +### Zepto Support -If you are using Zepto, you need to load `bower_components/velocity/velocity.js` (this file comes with a jQuery shim bundled directly in it). If you are using jQuery, you need to load `bower_components/velocity/jquery.velocity.js`. - -### jQuery Support - -Bellows supports jQuery but is not actively developed for it. You should be able to use Bellows directly with jQuery 2.0. While we don't actively support jQuery for Bellows, we welcome any and all issues and PRs to help us make it work. +Bellows supports Zepto up until v5.1.2 but is not actively developed for it. While we don't actively support Zepto for Bellows, we welcome any and all issues and PRs to help us make it work. ## Installation -Bellows can be installed using bower: +Bellows can be installed using NPM: ``` -bower install bellows +npm install bellows-ui ``` ## Usage with Require.js -To use with require.js, after installing through bower you merely have to reference bellows in your require config file: +To use with require.js, after installing through NPM you merely have to reference bellows in your require config file (**Note**: If your project already has these external dependencies, and the versions are compatible, it's recommended that you use the one in your project to reduce duplication): ```config.js { 'paths': { - 'plugin': 'bower_components/plugin/dist/plugin.min', - 'bellows': 'bower_components/bellows/dist/bellows.min', - 'velocity': 'bower_components/mobify-velocity/velocity' + '$': 'node_modules/bellows-ui/node_modules/jquery/dist/jquery.min', + 'plugin': 'node_modules/bellows-ui/node_modules/plugin/dist/plugin.min', + 'velocity': 'node_modules/bellows-ui/node_modules/velocity-animate/velocity' + 'bellows': 'node_modules/bellows-ui/dist/bellows.min', } } @@ -54,7 +51,7 @@ And then require bellows in as needed: ``` define( - ['zepto', 'bellows'], + ['$', 'bellows'], function($) { $('.bellows').bellows(); } @@ -104,9 +101,9 @@ At a bare minimum, your markup structure should follow the above structure. You - - - + + + @@ -173,10 +170,10 @@ default: `swing` Sets the easing for the animation. Bellows takes all of the same easing properties that [Velocity.js](http://julian.com/research/velocity) accepts. -> * [jQuery UI's easings](http://easings.net/) and CSS3's easings ("ease", "ease-in", "ease-out", and "ease-in-out"), which are pre-packaged into Velocity. A bonus "spring" easing (sampled in the CSS Support pane) is also included. -* CSS3's bezier curves: Pass in a four-item array of bezier points. (Refer to [Cubic-Bezier.com](http://cubic-bezier.com/) for crafing custom bezier curves.) -* Spring physics: Pass a two-item array in the form of [ tension, friction ]. A higher tension (default: 600) increases total speed and bounciness. A lower friction (default: 20) increases ending vibration speed. -* Step easing: Pass a one-item array in the form of [ steps ]. The animation will jump toward its end values using the specified number of steps. +> * [jQuery UI's easings](http://easings.net/) and CSS3's easings ("ease", "ease-in", "ease-out", and "ease-in-out"), which are pre-packaged into Velocity. A bonus "spring" easing (sampled in the CSS Support pane) is also included. +* CSS3's bezier curves: Pass in a four-item array of bezier points. (Refer to [Cubic-Bezier.com](http://cubic-bezier.com/) for crafing custom bezier curves.) +* Spring physics: Pass a two-item array in the form of [ tension, friction ]. A higher tension (default: 600) increases total speed and bounciness. A lower friction (default: 20) increases ending vibration speed. +* Step easing: Pass a one-item array in the form of [ steps ]. The animation will jump toward its end values using the specified number of steps. For more information, check out [Velocity's docs on easing](http://julian.com/research/velocity/#easing). @@ -197,11 +194,11 @@ Triggered every time the selected bellows item is starting to open. | Parameter name | Description | |----------------|-------------| | **e** | An Event object passed to the callback | -| **ui** | An object containing any associated data for use inside the callback | +| **ui** | An object containing any associated data for use inside the callback | ```js $('.bellows').bellows({ - open: function(e, ui) { + open: function(e, ui) { // ui.item contains the item opening } }); @@ -218,11 +215,11 @@ Triggered every time the selected bellows item has finished opening. | Parameter name | Description | |----------------|-------------| | **e** | An Event object passed to the callback | -| **ui** | An object containing any associated data for use inside the callback | +| **ui** | An object containing any associated data for use inside the callback | ```js $('.bellows').bellows({ - opened: function(e, ui) { + opened: function(e, ui) { // ui.item contains the item that opened } }); @@ -237,11 +234,11 @@ Triggered every time an bellows item is starting to close. | Parameter name | Description | |----------------|-------------| | **e** | An Event object passed to the callback | -| **ui** | An object containing any associated data for use inside the callback | +| **ui** | An object containing any associated data for use inside the callback | ```js $('.bellows').bellows({ - close: function(e, ui) { + close: function(e, ui) { // ui.item contains the item closing } }); @@ -256,11 +253,11 @@ Triggered every time an bellows item is finished closing. | Parameter name | Description | |----------------|-------------| | **e** | An Event object passed to the callback | -| **ui** | An object containing any associated data for use inside the callback | +| **ui** | An object containing any associated data for use inside the callback | ```js $('.bellows').bellows({ - closed: function(e, ui) { + closed: function(e, ui) { // ui.item contains the item that closed } }); @@ -291,7 +288,7 @@ $bellows.bellows('openAll'); ``` ### close - + Close the selected bellows item by element reference ```js @@ -313,7 +310,7 @@ $bellows.bellows('closeAll'); ``` ### toggle - + Toggle the selected bellows item by element reference ```js @@ -363,7 +360,7 @@ $('.bellows').bellows({ }); ``` -This will scroll the viewport to the opened bellows item, restoring its position in the viewport. +This will scroll the viewport to the opened bellows item, restoring its position in the viewport. ## Browser Compatibility @@ -379,19 +376,16 @@ This will scroll the viewport to the opened bellows item, restoring its position ## Building a distribution ### Requirements -* [node.js 0.10.x/npm](http://nodejs.org/download/) +* [Node.js v4.x LTS + NPM v2.x](https://nodejs.org/en/download/) (Mobify recommends [NVM](https://github.com/creationix/nvm) for installing Node + NPM) * [Grunt](http://gruntjs.com/) * Install with `npm install -g grunt-cli` -* [Bower](http://bower.io/) - * Install with `npm install -g bower` ### Steps 1. `npm install` -1. `bower install` 1. `grunt build` The `dist` directory will be populated with minified versions of the css and javascript files for distribution and use with whatever build system you might use. The `src` directory has our raw unminified Sass and Javascript files if you prefer to work with those. ## License -_MIT License. Bellows is Copyright © 2014 Mobify. It is free software and may be redistributed under the terms specified in the LICENSE file._ +_MIT License. Bellows is Copyright © 2016 Mobify. It is free software and may be redistributed under the terms specified in the LICENSE file._ diff --git a/bower.json b/bower.json deleted file mode 100644 index 1168b28..0000000 --- a/bower.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "name": "bellows", - "version": "5.1.2", - "homepage": "https://github.com/mobify/bellows", - "authors": [ - "Mobify " - ], - "description": "A mobile first accordion UI plugin", - "main": "dist/bellows.min.js", - "keywords": [ - "bellows", - "accordion", - "toggle", - "mobile", - "mobify" - ], - "license": "MIT", - "ignore": [ - "./!(src|dist|lib|templates)" - ], - "dependencies": { - "plugin": "~3.0.0", - "mobify-velocity": "1.1.2", - "requirejs-text": "~2.0.12", - "requirejs": "~2.1.14" - }, - "devDependencies": { - "gremlins.js": "~0.1.0" - } -} diff --git a/circle.yml b/circle.yml index da2e009..8c02852 100644 --- a/circle.yml +++ b/circle.yml @@ -1,13 +1,14 @@ machine: node: - version: 0.10.21 + version: 4.3.1 -test: - pre: - - gem install sass -v 3.4 - - bower cache clean - - bower install +dependencies: override: - - grunt lint - - grunt test + - npm install + - npm install -g grunt-cli +test: + override: + - grunt sasslint + - grunt lint:prod + - grunt test diff --git a/dist/bellows-theme.css b/dist/bellows-theme.css index 0db05e1..237ec99 100644 --- a/dist/bellows-theme.css +++ b/dist/bellows-theme.css @@ -1,6 +1,7 @@ .bellows { -webkit-box-sizing: border-box; - box-sizing: border-box; } + box-sizing: border-box; +} .bellows__header { position: relative; @@ -9,50 +10,72 @@ border-width: 0 0 1px; background: #3498db; color: white; - -webkit-tap-highlight-color: transparent; } - .bellows__header:active { - background: #2980b9; } - .bellows__header::before, .bellows__header::after { - content: ''; - position: absolute; - top: 50%; - right: 20px; - z-index: 2; - display: block; - width: 16px; - height: 4px; - margin-top: -2px; - background: white; - pointer-events: none; - -webkit-transition: -webkit-transform 0.25s ease-in-out; - transition: transform 0.25s ease-in-out; } - .bellows__header::before { - content: ''; - -webkit-transform: rotate(0deg); - -ms-transform: rotate(0deg); - transform: rotate(0deg); } - .bellows__header::after { - -webkit-transform: rotate(90deg); - -ms-transform: rotate(90deg); - transform: rotate(90deg); } - .bellows__item.bellows--is-open > .bellows__header::before, .bellows__item.bellows--is-opening > .bellows__header::before { - -webkit-transform: rotate(180deg); - -ms-transform: rotate(180deg); - transform: rotate(180deg); } - .bellows__item.bellows--is-open > .bellows__header::after, .bellows__item.bellows--is-opening > .bellows__header::after { - -webkit-transform: rotate(360deg); - -ms-transform: rotate(360deg); - transform: rotate(360deg); } - .bellows__item:last-child > .bellows__header { - border-bottom: 0; } - .bellows__header h1, - .bellows__header h2, - .bellows__header h3, - .bellows__header h4 { - margin: 0; } + -webkit-tap-highlight-color: transparent; +} + +.bellows__header:active { + background: #2980b9; +} + +.bellows__header::before, .bellows__header::after { + content: ''; + position: absolute; + top: 50%; + right: 20px; + z-index: 2; + display: block; + width: 16px; + height: 4px; + margin-top: -2px; + background: white; + -webkit-transition: -webkit-transform 0.25s ease-in-out; + transition: transform 0.25s ease-in-out; + pointer-events: none; +} + +.bellows__header::before { + content: ''; + -webkit-transform: rotate(0deg); + -ms-transform: rotate(0deg); + transform: rotate(0deg); +} + +.bellows__header::after { + -webkit-transform: rotate(90deg); + -ms-transform: rotate(90deg); + transform: rotate(90deg); +} + +.bellows__item.bellows--is-open > .bellows__header::before, +.bellows__item.bellows--is-opening > .bellows__header::before { + -webkit-transform: rotate(180deg); + -ms-transform: rotate(180deg); + transform: rotate(180deg); +} + +.bellows__item.bellows--is-open > .bellows__header::after, +.bellows__item.bellows--is-opening > .bellows__header::after { + -webkit-transform: rotate(360deg); + -ms-transform: rotate(360deg); + transform: rotate(360deg); +} + +.bellows__item:last-child > .bellows__header { + border-bottom: 0; +} + +.bellows__header h1, +.bellows__header h2, +.bellows__header h3, +.bellows__header h4 { + margin: 0; +} .bellows__content { padding: 20px; - border: 1px solid #ecf0f1; } - .bellows__content .bellows { - margin-top: 20px; } + border: 1px solid #ecf0f1; +} + +.bellows__content .bellows { + margin-top: 20px; +} diff --git a/dist/bellows-theme.min.css b/dist/bellows-theme.min.css index f8b107a..b524393 100644 --- a/dist/bellows-theme.min.css +++ b/dist/bellows-theme.min.css @@ -1 +1 @@ -.bellows{-webkit-box-sizing:border-box;box-sizing:border-box}.bellows__header{position:relative;padding:15px 20px;border:1px solid #2980b9;border-width:0 0 1px;background:#3498db;color:#fff;-webkit-tap-highlight-color:transparent}.bellows__header:active{background:#2980b9}.bellows__header::before,.bellows__header::after{content:'';position:absolute;top:50%;right:20px;z-index:2;display:block;width:16px;height:4px;margin-top:-2px;background:#fff;pointer-events:none;-webkit-transition:-webkit-transform .25s ease-in-out;transition:transform .25s ease-in-out}.bellows__header::before{content:'';-webkit-transform:rotate(0deg);-ms-transform:rotate(0deg);transform:rotate(0deg)}.bellows__header::after{-webkit-transform:rotate(90deg);-ms-transform:rotate(90deg);transform:rotate(90deg)}.bellows__item.bellows--is-open>.bellows__header::before,.bellows__item.bellows--is-opening>.bellows__header::before{-webkit-transform:rotate(180deg);-ms-transform:rotate(180deg);transform:rotate(180deg)}.bellows__item.bellows--is-open>.bellows__header::after,.bellows__item.bellows--is-opening>.bellows__header::after{-webkit-transform:rotate(360deg);-ms-transform:rotate(360deg);transform:rotate(360deg)}.bellows__item:last-child>.bellows__header{border-bottom:0}.bellows__header h1,.bellows__header h2,.bellows__header h3,.bellows__header h4{margin:0}.bellows__content{padding:20px;border:1px solid #ecf0f1}.bellows__content .bellows{margin-top:20px} \ No newline at end of file +.bellows{-webkit-box-sizing:border-box;box-sizing:border-box}.bellows__header{position:relative;padding:15px 20px;border:1px solid #2980b9;border-width:0 0 1px;background:#3498db;color:white;-webkit-tap-highlight-color:transparent}.bellows__header:active{background:#2980b9}.bellows__header::before,.bellows__header::after{content:'';position:absolute;top:50%;right:20px;z-index:2;display:block;width:16px;height:4px;margin-top:-2px;background:white;-webkit-transition:-webkit-transform 0.25s ease-in-out;transition:transform 0.25s ease-in-out;pointer-events:none}.bellows__header::before{content:'';-webkit-transform:rotate(0deg);-ms-transform:rotate(0deg);transform:rotate(0deg)}.bellows__header::after{-webkit-transform:rotate(90deg);-ms-transform:rotate(90deg);transform:rotate(90deg)}.bellows__item.bellows--is-open>.bellows__header::before,.bellows__item.bellows--is-opening>.bellows__header::before{-webkit-transform:rotate(180deg);-ms-transform:rotate(180deg);transform:rotate(180deg)}.bellows__item.bellows--is-open>.bellows__header::after,.bellows__item.bellows--is-opening>.bellows__header::after{-webkit-transform:rotate(360deg);-ms-transform:rotate(360deg);transform:rotate(360deg)}.bellows__item:last-child>.bellows__header{border-bottom:0}.bellows__header h1,.bellows__header h2,.bellows__header h3,.bellows__header h4{margin:0}.bellows__content{padding:20px;border:1px solid #ecf0f1}.bellows__content .bellows{margin-top:20px} diff --git a/dist/bellows.css b/dist/bellows.css index 3120fa2..d5bc8a3 100644 --- a/dist/bellows.css +++ b/dist/bellows.css @@ -1,9 +1,12 @@ .bellows__item:not(.bellows--is-open) > .bellows__content { - display: none; } + display: none; +} .bellows__item.bellows--is-open > .bellows__content-wrapper, .bellows__item.bellows--is-closing > .bellows__content-wrapper { - display: block; } + display: block; +} .bellows__content-wrapper { - display: none; } + display: none; +} diff --git a/dist/bellows.js b/dist/bellows.js index 3dedf15..6e0035d 100644 --- a/dist/bellows.js +++ b/dist/bellows.js @@ -6,10 +6,10 @@ 'plugin' ], factory); } else { - var framework = window.Zepto || window.jQuery; + var framework = window.jQuery; factory(framework, framework.Velocity, window.Plugin); } -}(function($, Velocity, Plugin) { +})(function($, Velocity, Plugin) { var cssClasses = { ITEM: 'bellows__item', HEADER: 'bellows__header', @@ -29,11 +29,11 @@ CLICK: 'click.bellows' }; - function Bellows(element, options) { + var Bellows = function(element, options) { Bellows.__super__.call(this, element, options, Bellows.DEFAULTS); - } + }; - Bellows.VERSION = '5.1.2'; + Bellows.VERSION = '6.0.0'; Bellows.DEFAULTS = { singleItemOpen: false, @@ -66,7 +66,7 @@ /** * Ghetto Event Delegation™ - + TODO: Re-evalute this for new default of jQuery Zepto doesn't support descendant selectors in event delegation, so we compare against the closest bellows to ensure we are invoking the event from a direct child, not a bellows child from a nested bellows. @@ -254,4 +254,4 @@ $('[data-bellows]').bellows(); return $; -})); +}); diff --git a/dist/bellows.min.css b/dist/bellows.min.css index c42509a..2f0f7c7 100644 --- a/dist/bellows.min.css +++ b/dist/bellows.min.css @@ -1 +1 @@ -.bellows__item:not(.bellows--is-open)>.bellows__content{display:none}.bellows__item.bellows--is-open>.bellows__content-wrapper,.bellows__item.bellows--is-closing>.bellows__content-wrapper{display:block}.bellows__content-wrapper{display:none} \ No newline at end of file +.bellows__item:not(.bellows--is-open)>.bellows__content{display:none}.bellows__item.bellows--is-open>.bellows__content-wrapper,.bellows__item.bellows--is-closing>.bellows__content-wrapper{display:block}.bellows__content-wrapper{display:none} diff --git a/dist/bellows.min.js b/dist/bellows.min.js index c2fcbde..72523c4 100644 --- a/dist/bellows.min.js +++ b/dist/bellows.min.js @@ -1,2 +1,2 @@ -/*! bellows 5.1.2 (https://github.com/mobify/bellows.git) */ -(function(e){if("function"==typeof define&&define.amd)define(["$","velocity","plugin"],e);else{var t=window.Zepto||window.jQuery;e(t,t.Velocity,window.Plugin)}})(function(e,t,i){function s(e,t){s.__super__.call(this,e,t,s.DEFAULTS)}var n={ITEM:"bellows__item",HEADER:"bellows__header",OPENED:"bellows--is-open",OPENING:"bellows--is-opening",CLOSING:"bellows--is-closing",DISABLED:"bellows--is-disabled"},o={ITEM_HEADER:"> .bellows__item > .bellows__header",ITEM_CONTENT_WRAPPER:"> .bellows__content-wrapper",ITEM_CONTENT:"> .bellows__item > .bellows__content"},l={CLICK:"click.bellows"};return s.VERSION="5.1.2",s.DEFAULTS={singleItemOpen:!1,duration:200,easing:"swing",open:e.noop,opened:e.noop,close:e.noop,closed:e.noop},i.create("bellows",s,{_init:function(t){this.$bellows=e(t),this._wrapContent(this.$bellows),this._bindEvents()},destroy:function(){this.$bellows.removeData(this.name).off(l.CLICK)},_bindEvents:function(){var t=this;this.$bellows.on(l.CLICK,function(i){var s=e(i.target),o=s.closest(".bellows");s.is("a")||s.parents("a").length||o[0]===t.$bellows[0]&&(s.hasClass(n.HEADER)||s.closest(".bellows__header").length)&&(i.preventDefault(),t.toggle(s.closest(".bellows__item")))})},_getHeight:function(e){return parseFloat(t.CSS.getPropertyValue(e[0],"height"))},_setHeight:function(e){this.$bellows.css("height",e||"")},_item:function(e){return"number"==typeof e&&(e=this.$bellows.find("."+n.ITEM).eq(e)),e},_isOpen:function(e){return e.hasClass(n.OPENED)},_isDisabled:function(e){return e.hasClass(n.DISABLED)},_wrapContent:function(e){e.find(o.ITEM_CONTENT).wrap('
').parents(".bellows__item:not(.bellows--is-open)").find(o.ITEM_CONTENT_WRAPPER).attr("aria-hidden",!0)},toggle:function(e){e=this._item(e),this[e.hasClass(n.OPENED)?"close":"open"](e)},open:function(e){if(e=this._item(e),!this._isOpen(e)&&!this._isDisabled(e)){var i=this,s=e.find(o.ITEM_CONTENT_WRAPPER);this.options.singleItemOpen&&this.closeAll(),this._trigger("open",{item:e}),t.animate(s,"slideDown",{begin:function(){i._setHeight(i._getHeight(i.$bellows)+i._getHeight(s)),e.addClass(n.OPENING)},duration:this.options.duration,easing:this.options.easing,complete:function(){e.removeClass(n.OPENING).addClass(n.OPENED).find(o.ITEM_CONTENT_WRAPPER).removeAttr("aria-hidden"),i._setHeight(),i._trigger("opened",{item:e})}})}},close:function(e){if(e=this._item(e),this._isOpen(e)&&!this._isDisabled(e)){var i=this,s=e.find(o.ITEM_CONTENT_WRAPPER);this._trigger("close",{item:e}),t.animate(s,"slideUp",{begin:function(){i._setHeight(i._getHeight(i.$bellows)),e.removeClass(n.OPENED).addClass(n.CLOSING)},duration:this.options.duration,easing:this.options.easing,complete:function(){e.removeClass(n.CLOSING).find(o.ITEM_CONTENT_WRAPPER).attr("aria-hidden",!0),i._setHeight(),i._trigger("closed",{item:e})}})}},toggleAll:function(){var t=this;this.$bellows.find("."+n.ITEM).each(function(){t.toggle(e(this))})},openAll:function(){var t=this;this.$bellows.find("."+n.ITEM+":not(."+n.OPENED+")").each(function(){t.open(e(this))})},closeAll:function(){var t=this;this.$bellows.find("."+n.OPENED).each(function(){t.close(e(this))})},add:function(t,i){var s=e("
");e(t).appendTo(s),i&&this.$bellows.empty(),this._wrapContent(s),this.$bellows.append(s.children())}}),e("[data-bellows]").bellows(),e}); \ No newline at end of file +/*! bellows-ui 6.0.0 (git+https://github.com/mobify/bellows.git) */ +!function(a){if("function"==typeof define&&define.amd)define(["$","velocity","plugin"],a);else{var b=window.jQuery;a(b,b.Velocity,window.Plugin)}}(function(a,b,c){var d={ITEM:"bellows__item",HEADER:"bellows__header",OPENED:"bellows--is-open",OPENING:"bellows--is-opening",CLOSING:"bellows--is-closing",DISABLED:"bellows--is-disabled"},e={ITEM_HEADER:"> .bellows__item > .bellows__header",ITEM_CONTENT_WRAPPER:"> .bellows__content-wrapper",ITEM_CONTENT:"> .bellows__item > .bellows__content"},f={CLICK:"click.bellows"},g=function(a,b){g.__super__.call(this,a,b,g.DEFAULTS)};return g.VERSION="6.0.0",g.DEFAULTS={singleItemOpen:!1,duration:200,easing:"swing",open:a.noop,opened:a.noop,close:a.noop,closed:a.noop},c.create("bellows",g,{_init:function(b){this.$bellows=a(b),this._wrapContent(this.$bellows),this._bindEvents()},destroy:function(){this.$bellows.removeData(this.name).off(f.CLICK)},_bindEvents:function(){var b=this;this.$bellows.on(f.CLICK,function(c){var e=a(c.target),f=e.closest(".bellows");e.is("a")||e.parents("a").length||f[0]===b.$bellows[0]&&(e.hasClass(d.HEADER)||e.closest(".bellows__header").length)&&(c.preventDefault(),b.toggle(e.closest(".bellows__item")))})},_getHeight:function(a){return parseFloat(b.CSS.getPropertyValue(a[0],"height"))},_setHeight:function(a){this.$bellows.css("height",a||"")},_item:function(a){return"number"==typeof a&&(a=this.$bellows.find("."+d.ITEM).eq(a)),a},_isOpen:function(a){return a.hasClass(d.OPENED)},_isDisabled:function(a){return a.hasClass(d.DISABLED)},_wrapContent:function(a){a.find(e.ITEM_CONTENT).wrap('
').parents(".bellows__item:not(.bellows--is-open)").find(e.ITEM_CONTENT_WRAPPER).attr("aria-hidden",!0)},toggle:function(a){a=this._item(a),this[a.hasClass(d.OPENED)?"close":"open"](a)},open:function(a){if(a=this._item(a),!this._isOpen(a)&&!this._isDisabled(a)){var c=this,f=a.find(e.ITEM_CONTENT_WRAPPER);this.options.singleItemOpen&&this.closeAll(),this._trigger("open",{item:a}),b.animate(f,"slideDown",{begin:function(){c._setHeight(c._getHeight(c.$bellows)+c._getHeight(f)),a.addClass(d.OPENING)},duration:this.options.duration,easing:this.options.easing,complete:function(){a.removeClass(d.OPENING).addClass(d.OPENED).find(e.ITEM_CONTENT_WRAPPER).removeAttr("aria-hidden"),c._setHeight(),c._trigger("opened",{item:a})}})}},close:function(a){if(a=this._item(a),this._isOpen(a)&&!this._isDisabled(a)){var c=this,f=a.find(e.ITEM_CONTENT_WRAPPER);this._trigger("close",{item:a}),b.animate(f,"slideUp",{begin:function(){c._setHeight(c._getHeight(c.$bellows)),a.removeClass(d.OPENED).addClass(d.CLOSING)},duration:this.options.duration,easing:this.options.easing,complete:function(){a.removeClass(d.CLOSING).find(e.ITEM_CONTENT_WRAPPER).attr("aria-hidden",!0),c._setHeight(),c._trigger("closed",{item:a})}})}},toggleAll:function(){var b=this;this.$bellows.find("."+d.ITEM).each(function(){b.toggle(a(this))})},openAll:function(){var b=this;this.$bellows.find("."+d.ITEM+":not(."+d.OPENED+")").each(function(){b.open(a(this))})},closeAll:function(){var b=this;this.$bellows.find("."+d.OPENED).each(function(){b.close(a(this))})},add:function(b,c){var d=a("
");a(b).appendTo(d),c&&this.$bellows.empty(),this._wrapContent(d),this.$bellows.append(d.children())}}),a("[data-bellows]").bellows(),a}); \ No newline at end of file diff --git a/examples/animation.html b/examples/animation.html index f908f3e..d756e21 100644 --- a/examples/animation.html +++ b/examples/animation.html @@ -16,7 +16,7 @@

Bellows Examples

Different Animation Timings

-

You can pass Bellows alternate animation duration and easing when you initialize it. The different easings available are described in the readme

+

You can pass Bellows alternate animation duration and easing when you initialize it. The different easings available are described in the readme

@@ -53,7 +53,6 @@

Header

- + - diff --git a/examples/assets/js/config.js b/examples/assets/js/config.js index 6d38dd9..fddf4d9 100644 --- a/examples/assets/js/config.js +++ b/examples/assets/js/config.js @@ -2,10 +2,10 @@ require.config({ baseUrl: '../', almond: true, paths: { - 'text': 'bower_components/requirejs-text/text', - '$': 'lib/zeptojs/dist/zepto', - 'velocity': 'bower_components/mobify-velocity/velocity', - 'plugin': 'bower_components/plugin/dist/plugin.min', + 'text': 'node_modules/text/text', + '$': 'node_modules/jquery/dist/jquery', + 'velocity': 'node_modules/velocity-animate/velocity', + 'plugin': 'node_modules/plugin/dist/plugin.min', 'bellows': 'dist/bellows', 'setup-bellows': 'examples/assets/js/setup-bellows' }, diff --git a/examples/assets/js/setup-bellows.js b/examples/assets/js/setup-bellows.js index 221823b..f6b63eb 100644 --- a/examples/assets/js/setup-bellows.js +++ b/examples/assets/js/setup-bellows.js @@ -4,7 +4,7 @@ define(['bellows'], factory); } else { // Browser globals - root.setupBellows = factory(window.Zepto || window.jQuery); + root.setupBellows = factory(window.jQuery); } }(this, function ($) { diff --git a/examples/dataattr.html b/examples/dataattr.html index 9ae139a..98a4e9d 100644 --- a/examples/dataattr.html +++ b/examples/dataattr.html @@ -53,7 +53,6 @@

Header

- + - diff --git a/examples/default.html b/examples/default.html index 332482e..e914476 100644 --- a/examples/default.html +++ b/examples/default.html @@ -55,7 +55,6 @@

Header

Lorem honeyed locusts sit amet, none so wise, sed do eiusmod never resting ut labore et dolore magna aliqua. Manhood death before disgrace warrior, feed it to the goats spare me your false courtesy commodo consequat. Mace aute irure dolor in reprehenderit poison is a woman's weapon lord of light tower dwarf. The last of the dragons royal, godswood garron sister betrothed officia deserunt mollit anim id est snow.

- + - diff --git a/examples/inception.html b/examples/inception.html index bc54fe4..5ff5f5f 100644 --- a/examples/inception.html +++ b/examples/inception.html @@ -111,7 +111,6 @@

Header

- + - diff --git a/examples/index.html b/examples/index.html index dafde21..3f99350 100644 --- a/examples/index.html +++ b/examples/index.html @@ -21,8 +21,7 @@

Bellows Examples

  • Internal Header Link
  • - + - diff --git a/examples/link.html b/examples/link.html index 4d04fa4..606878b 100644 --- a/examples/link.html +++ b/examples/link.html @@ -59,7 +59,6 @@

    Header

    Lorem honeyed locusts sit amet, none so wise, sed do eiusmod never resting ut labore et dolore magna aliqua. Manhood death before disgrace warrior, feed it to the goats spare me your false courtesy commodo consequat. Mace aute irure dolor in reprehenderit poison is a woman's weapon lord of light tower dwarf. The last of the dragons royal, godswood garron sister betrothed officia deserunt mollit anim id est snow.

    - + - diff --git a/examples/norequire.html b/examples/norequire.html index ce319e8..c4a3b42 100644 --- a/examples/norequire.html +++ b/examples/norequire.html @@ -55,12 +55,11 @@

    Header

    Lorem honeyed locusts sit amet, none so wise, sed do eiusmod never resting ut labore et dolore magna aliqua. Manhood death before disgrace warrior, feed it to the goats spare me your false courtesy commodo consequat. Mace aute irure dolor in reprehenderit poison is a woman's weapon lord of light tower dwarf. The last of the dragons royal, godswood garron sister betrothed officia deserunt mollit anim id est snow.

    - - - + + + - diff --git a/examples/single.html b/examples/single.html index d5716b0..c3af4d4 100644 --- a/examples/single.html +++ b/examples/single.html @@ -53,7 +53,6 @@

    Header

    - + - diff --git a/lib/zeptojs/.bower.json b/lib/zeptojs/.bower.json deleted file mode 100644 index d2c508d..0000000 --- a/lib/zeptojs/.bower.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "name": "zeptojs", - "homepage": "https://github.com/madrobby/zepto", - "version": "1.1.3", - "_release": "1.1.3", - "_resolution": { - "type": "version", - "tag": "v1.1.3", - "commit": "fef90efe1c98f43f6ce1e1f2f793077e1c6994c5" - }, - "_source": "git://github.com/madrobby/zepto.git", - "_target": "1.1.3", - "_originalSource": "zeptojs" -} \ No newline at end of file diff --git a/lib/zeptojs/.gitignore b/lib/zeptojs/.gitignore deleted file mode 100644 index c5963fd..0000000 --- a/lib/zeptojs/.gitignore +++ /dev/null @@ -1,10 +0,0 @@ -.DS_Store -pkg -*.swp -docs/* -.jhw-cache -.rbenv-version -public -node_modules -temp/ -npm-debug.log \ No newline at end of file diff --git a/lib/zeptojs/.travis.yml b/lib/zeptojs/.travis.yml deleted file mode 100644 index b2f29ef..0000000 --- a/lib/zeptojs/.travis.yml +++ /dev/null @@ -1,9 +0,0 @@ -script: script/test -language: node_js -notifications: - campfire: - template: '%{message} [%{branch}] %{repository}/%{commit} %{author} %{build_url}' - rooms: - secure: VR6rWk0YhezBWnD8jPjSD8h/Q83S3NT0F34Au1vswt+/+Ku19S8X44vGVUG+NYdYyhg7uOqUaPN1Jr3KCpdcXgHEpUYiyBGJ8ebltavcjeHYWqK6ghcqgSnbDkifuC7Eu/9LcrOMOXgt+zkXjiVXW3+zyGVDcrs4cQ2vGY2DTYA= -node_js: -- 0.10 diff --git a/lib/zeptojs/CONTRIBUTING.md b/lib/zeptojs/CONTRIBUTING.md deleted file mode 100644 index a554d7a..0000000 --- a/lib/zeptojs/CONTRIBUTING.md +++ /dev/null @@ -1,45 +0,0 @@ -## Contributing to Zepto - -**Thanks for helping out!** - -In order for your code to make it in, several conditions must be met: - -* It's more likely your pull request will make it in if you adhere to **Zepto's - project goals**. Be sure to read the README in its entirety before setting out - to code. -* Please talk to the maintainers (@madrobby and @mislav) first if you want - to write a plugin, those are better kept in their own repositories. -* Fix only ONE thing or have only ONE feature in your pull request. - If you have multiple unrelated code updates, please submit a separate pull request for each one. -* **Your pull request must be written in English and be accompanied by a - detailed description**, ideally something we can use as documentation. - If you're not fluent in English, try your best and let us know so we'll help! -* Changes to jQuery-based API methods **must match their jQuery counterparts**. -* Please **do not just copy code from jQuery**. Zepto strives for API compatibility, - but has different goals for code style and size and target platforms. - In case you do copy code, you must clearly indicate the origin of the code, and - which license applies to it. However, it is likely your patch will be denied. -* **All code must have tests, and all tests must pass.** See the README on running the test suite. -* Please **also test manually** on as many target platforms you have access to, - but at least on latest Chrome (desktop) and Firefox (desktop). - See http://zeptojs.com for a full list of platforms. -* It's required that you follow Zepto's **code style guidelines** (see below) - -Whew, now that we have that out of the way thanks again! - -## Code style guidelines - -* Two spaces "soft tabs" indentation -* Remove any trailing whitespace from the end of lines -* `function name() { }` for named functions -* `function(){ }` for anonymous functions -* No curly braces for single-line control flow statements such as `if` & friends -* Don't write [semicolons that are optional][optional] -* Put a single semicolon _before_ statements that start with `(` or `[` - (see above article as for why it's needed) -* Use long, descriptive variable and method names -* Use blank lines to separate "paragraphs" of code for readability -* Use comments to describe non-obvious code behavior - - - [optional]: http://mislav.uniqpath.com/2010/05/semicolons/ diff --git a/lib/zeptojs/MIT-LICENSE b/lib/zeptojs/MIT-LICENSE deleted file mode 100644 index 5a62a30..0000000 --- a/lib/zeptojs/MIT-LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -Copyright (c) 2010-2014 Thomas Fuchs -http://zeptojs.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/lib/zeptojs/README.md b/lib/zeptojs/README.md deleted file mode 100644 index b00bceb..0000000 --- a/lib/zeptojs/README.md +++ /dev/null @@ -1,225 +0,0 @@ -# Zepto.js – a minimalist JavaScript library - -Zepto is a minimalist JavaScript library for modern browsers with a -largely jQuery-compatible API. If you use jQuery, you already know how to use Zepto. - -See [zeptojs.com][] for an extended introduction, downloads -and documentation. - -Zepto.js is licensed under the terms of the MIT License. - -Want to give us money or a tip? Don't. -Instead please donate to [charity: water](http://charitywater.org/). - -## Building - -[![Build Status](https://secure.travis-ci.org/madrobby/zepto.png?branch=master)](http://travis-ci.org/madrobby/zepto) - -The official site offers a download of the default distribution of Zepto. This -is good for starting out. However, at some point you might want to add some -optional modules and remove some of the default ones you don't need, to keep the -size at a minimum. That's when you need to check out Zepto's source code and use -the build commands. - -You will need Node.js installed on your system. - -~~~ sh -$ npm install -$ npm run-script dist - -# do a custom build -$ MODULES="zepto event data" npm run-script dist -~~~ - -The resulting files are: - -1. `dist/zepto.js` -2. `dist/zepto.min.js` - -If you install CoffeeScript globally, you can run `make` directly: - -~~~ sh -$ coffee make dist -$ MODULES="zepto event data ..." ./make dist -~~~ - -## Zepto modules - -Zepto modules are individual files in the "src/" directory. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    module default description
    zeptoCore module; contains most methods
    eventEvent handling via on() & off()
    ajaxXMLHttpRequest and JSONP functionality
    formSerialize & submit web forms
    ieSupport for Internet Explorer 10+ on the desktop and Windows Phone 8
    detectProvides $.os and $.browser information
    fxThe animate() method
    fx_methods - Animated show, hide, toggle, - and fade*() methods. -
    assets - Experimental support for cleaning up iOS memory after removing - image elements from the DOM. -
    data - A full-blown data() method, capable of storing arbitrary - objects in memory. -
    deferred - Provides $.Deferred promises API. - Depends on the "callbacks" module. -
    callbacks - Provides $.Callbacks for use in "deferred" module. -
    selector - Experimental jQuery - CSS extensions support for functionality such as $('div:first') and - el.is(':visible'). -
    touch - Fires tap– and swipe–related events on touch devices. This works with both - `touch` (iOS, Android) and `pointer` events (Windows Phone). -
    gestureFires pinch gesture events on touch devices
    stackProvides andSelf & end() chaining methods
    ios3 - String.prototype.trim and Array.prototype.reduce methods - (if they are missing) for compatibility with iOS 3.x. -
    - -## Contributing - -Please read our [contribution guidelines](https://github.com/madrobby/zepto/blob/master/CONTRIBUTING.md) -for information on how to contribute. - -Get in touch: - -* @[zeptojs](http://twitter.com/zeptojs) - -### Write documentation - -Zepto docs are written in Markdown and live in the ["gh-pages" branch][docs]. -They are published on [zeptojs.com][]. - -You can use GitHub's web interface to make quick changes to documentation for -specific Zepto features -([example: ajaxSettings](https://github.com/madrobby/zepto/blob/gh-pages/ajax/_posts/1900-01-01-Z-ajaxSettings.md)). -This will submit a pull request to us that we can review. - -### Report a bug - -1. Check if the bug is already fixed in the [master branch][master] since the - last release. -2. Check [existing issues][issues]. Open a new one, including exact browser & - platform information. For better formatting of your report, see - [GitHub-flavored Markdown][mkd]. - -### Running tests - -You will need to install [PhantomJS][]. On OS X, that's easy: - -~~~ sh -$ brew install phantomjs -~~~ - -To run the automated tests: - -~~~ sh -$ npm test -~~~ - -To run a test server, which you can hit with your browsers and devices: - -~~~ sh -$ npm start -~~~ - -Go to `http://your-ip-address:3000/` on your browser and follow the -instructions. For your convenience test failures and exceptions will be -reported to the the console you started the test server in (as well as -the browser console if available). - - [zeptojs.com]: http://zeptojs.com - [master]: https://github.com/madrobby/zepto/commits/master - [issues]: https://github.com/madrobby/zepto/issues - [docs]: https://github.com/madrobby/zepto/tree/gh-pages#readme - [mkd]: http://github.github.com/github-flavored-markdown/ - [evidence.js]: https://github.com/tobie/Evidence - [phantomjs]: http://code.google.com/p/phantomjs/wiki/Installation diff --git a/lib/zeptojs/dist/zepto.js b/lib/zeptojs/dist/zepto.js deleted file mode 100644 index 25c6bbe..0000000 --- a/lib/zeptojs/dist/zepto.js +++ /dev/null @@ -1,1811 +0,0 @@ -/* Zepto 1.1.3 - zepto event ajax form fx selector stack data - zeptojs.com/license */ - - -var Zepto = (function() { - var undefined, key, $, classList, emptyArray = [], slice = emptyArray.slice, filter = emptyArray.filter, - document = window.document, - elementDisplay = {}, classCache = {}, - cssNumber = { 'column-count': 1, 'columns': 1, 'font-weight': 1, 'line-height': 1,'opacity': 1, 'z-index': 1, 'zoom': 1 }, - fragmentRE = /^\s*<(\w+|!)[^>]*>/, - singleTagRE = /^<(\w+)\s*\/?>(?:<\/\1>|)$/, - tagExpanderRE = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig, - rootNodeRE = /^(?:body|html)$/i, - capitalRE = /([A-Z])/g, - - // special attributes that should be get/set via method calls - methodAttributes = ['val', 'css', 'html', 'text', 'data', 'width', 'height', 'offset'], - - adjacencyOperators = [ 'after', 'prepend', 'before', 'append' ], - table = document.createElement('table'), - tableRow = document.createElement('tr'), - containers = { - 'tr': document.createElement('tbody'), - 'tbody': table, 'thead': table, 'tfoot': table, - 'td': tableRow, 'th': tableRow, - '*': document.createElement('div') - }, - readyRE = /complete|loaded|interactive/, - simpleSelectorRE = /^[\w-]*$/, - class2type = {}, - toString = class2type.toString, - zepto = {}, - camelize, uniq, - tempParent = document.createElement('div'), - propMap = { - 'tabindex': 'tabIndex', - 'readonly': 'readOnly', - 'for': 'htmlFor', - 'class': 'className', - 'maxlength': 'maxLength', - 'cellspacing': 'cellSpacing', - 'cellpadding': 'cellPadding', - 'rowspan': 'rowSpan', - 'colspan': 'colSpan', - 'usemap': 'useMap', - 'frameborder': 'frameBorder', - 'contenteditable': 'contentEditable' - }, - isArray = Array.isArray || - function(object){ return object instanceof Array } - - zepto.matches = function(element, selector) { - if (!selector || !element || element.nodeType !== 1) return false - var matchesSelector = element.webkitMatchesSelector || element.mozMatchesSelector || - element.oMatchesSelector || element.matchesSelector - if (matchesSelector) return matchesSelector.call(element, selector) - // fall back to performing a selector: - var match, parent = element.parentNode, temp = !parent - if (temp) (parent = tempParent).appendChild(element) - match = ~zepto.qsa(parent, selector).indexOf(element) - temp && tempParent.removeChild(element) - return match - } - - function type(obj) { - return obj == null ? String(obj) : - class2type[toString.call(obj)] || "object" - } - - function isFunction(value) { return type(value) == "function" } - function isWindow(obj) { return obj != null && obj == obj.window } - function isDocument(obj) { return obj != null && obj.nodeType == obj.DOCUMENT_NODE } - function isObject(obj) { return type(obj) == "object" } - function isPlainObject(obj) { - return isObject(obj) && !isWindow(obj) && Object.getPrototypeOf(obj) == Object.prototype - } - function likeArray(obj) { return typeof obj.length == 'number' } - - function compact(array) { return filter.call(array, function(item){ return item != null }) } - function flatten(array) { return array.length > 0 ? $.fn.concat.apply([], array) : array } - camelize = function(str){ return str.replace(/-+(.)?/g, function(match, chr){ return chr ? chr.toUpperCase() : '' }) } - function dasherize(str) { - return str.replace(/::/g, '/') - .replace(/([A-Z]+)([A-Z][a-z])/g, '$1_$2') - .replace(/([a-z\d])([A-Z])/g, '$1_$2') - .replace(/_/g, '-') - .toLowerCase() - } - uniq = function(array){ return filter.call(array, function(item, idx){ return array.indexOf(item) == idx }) } - - function classRE(name) { - return name in classCache ? - classCache[name] : (classCache[name] = new RegExp('(^|\\s)' + name + '(\\s|$)')) - } - - function maybeAddPx(name, value) { - return (typeof value == "number" && !cssNumber[dasherize(name)]) ? value + "px" : value - } - - function defaultDisplay(nodeName) { - var element, display - if (!elementDisplay[nodeName]) { - element = document.createElement(nodeName) - document.body.appendChild(element) - display = getComputedStyle(element, '').getPropertyValue("display") - element.parentNode.removeChild(element) - display == "none" && (display = "block") - elementDisplay[nodeName] = display - } - return elementDisplay[nodeName] - } - - function children(element) { - return 'children' in element ? - slice.call(element.children) : - $.map(element.childNodes, function(node){ if (node.nodeType == 1) return node }) - } - - // `$.zepto.fragment` takes a html string and an optional tag name - // to generate DOM nodes nodes from the given html string. - // The generated DOM nodes are returned as an array. - // This function can be overriden in plugins for example to make - // it compatible with browsers that don't support the DOM fully. - zepto.fragment = function(html, name, properties) { - var dom, nodes, container - - // A special case optimization for a single tag - if (singleTagRE.test(html)) dom = $(document.createElement(RegExp.$1)) - - if (!dom) { - if (html.replace) html = html.replace(tagExpanderRE, "<$1>") - if (name === undefined) name = fragmentRE.test(html) && RegExp.$1 - if (!(name in containers)) name = '*' - - container = containers[name] - container.innerHTML = '' + html - dom = $.each(slice.call(container.childNodes), function(){ - container.removeChild(this) - }) - } - - if (isPlainObject(properties)) { - nodes = $(dom) - $.each(properties, function(key, value) { - if (methodAttributes.indexOf(key) > -1) nodes[key](value) - else nodes.attr(key, value) - }) - } - - return dom - } - - // `$.zepto.Z` swaps out the prototype of the given `dom` array - // of nodes with `$.fn` and thus supplying all the Zepto functions - // to the array. Note that `__proto__` is not supported on Internet - // Explorer. This method can be overriden in plugins. - zepto.Z = function(dom, selector) { - dom = dom || [] - dom.__proto__ = $.fn - dom.selector = selector || '' - return dom - } - - // `$.zepto.isZ` should return `true` if the given object is a Zepto - // collection. This method can be overriden in plugins. - zepto.isZ = function(object) { - return object instanceof zepto.Z - } - - // `$.zepto.init` is Zepto's counterpart to jQuery's `$.fn.init` and - // takes a CSS selector and an optional context (and handles various - // special cases). - // This method can be overriden in plugins. - zepto.init = function(selector, context) { - var dom - // If nothing given, return an empty Zepto collection - if (!selector) return zepto.Z() - // Optimize for string selectors - else if (typeof selector == 'string') { - selector = selector.trim() - // If it's a html fragment, create nodes from it - // Note: In both Chrome 21 and Firefox 15, DOM error 12 - // is thrown if the fragment doesn't begin with < - if (selector[0] == '<' && fragmentRE.test(selector)) - dom = zepto.fragment(selector, RegExp.$1, context), selector = null - // If there's a context, create a collection on that context first, and select - // nodes from there - else if (context !== undefined) return $(context).find(selector) - // If it's a CSS selector, use it to select nodes. - else dom = zepto.qsa(document, selector) - } - // If a function is given, call it when the DOM is ready - else if (isFunction(selector)) return $(document).ready(selector) - // If a Zepto collection is given, just return it - else if (zepto.isZ(selector)) return selector - else { - // normalize array if an array of nodes is given - if (isArray(selector)) dom = compact(selector) - // Wrap DOM nodes. - else if (isObject(selector)) - dom = [selector], selector = null - // If it's a html fragment, create nodes from it - else if (fragmentRE.test(selector)) - dom = zepto.fragment(selector.trim(), RegExp.$1, context), selector = null - // If there's a context, create a collection on that context first, and select - // nodes from there - else if (context !== undefined) return $(context).find(selector) - // And last but no least, if it's a CSS selector, use it to select nodes. - else dom = zepto.qsa(document, selector) - } - // create a new Zepto collection from the nodes found - return zepto.Z(dom, selector) - } - - // `$` will be the base `Zepto` object. When calling this - // function just call `$.zepto.init, which makes the implementation - // details of selecting nodes and creating Zepto collections - // patchable in plugins. - $ = function(selector, context){ - return zepto.init(selector, context) - } - - function extend(target, source, deep) { - for (key in source) - if (deep && (isPlainObject(source[key]) || isArray(source[key]))) { - if (isPlainObject(source[key]) && !isPlainObject(target[key])) - target[key] = {} - if (isArray(source[key]) && !isArray(target[key])) - target[key] = [] - extend(target[key], source[key], deep) - } - else if (source[key] !== undefined) target[key] = source[key] - } - - // Copy all but undefined properties from one or more - // objects to the `target` object. - $.extend = function(target){ - var deep, args = slice.call(arguments, 1) - if (typeof target == 'boolean') { - deep = target - target = args.shift() - } - args.forEach(function(arg){ extend(target, arg, deep) }) - return target - } - - // `$.zepto.qsa` is Zepto's CSS selector implementation which - // uses `document.querySelectorAll` and optimizes for some special cases, like `#id`. - // This method can be overriden in plugins. - zepto.qsa = function(element, selector){ - var found, - maybeID = selector[0] == '#', - maybeClass = !maybeID && selector[0] == '.', - nameOnly = maybeID || maybeClass ? selector.slice(1) : selector, // Ensure that a 1 char tag name still gets checked - isSimple = simpleSelectorRE.test(nameOnly) - return (isDocument(element) && isSimple && maybeID) ? - ( (found = element.getElementById(nameOnly)) ? [found] : [] ) : - (element.nodeType !== 1 && element.nodeType !== 9) ? [] : - slice.call( - isSimple && !maybeID ? - maybeClass ? element.getElementsByClassName(nameOnly) : // If it's simple, it could be a class - element.getElementsByTagName(selector) : // Or a tag - element.querySelectorAll(selector) // Or it's not simple, and we need to query all - ) - } - - function filtered(nodes, selector) { - return selector == null ? $(nodes) : $(nodes).filter(selector) - } - - $.contains = function(parent, node) { - return parent !== node && parent.contains(node) - } - - function funcArg(context, arg, idx, payload) { - return isFunction(arg) ? arg.call(context, idx, payload) : arg - } - - function setAttribute(node, name, value) { - value == null ? node.removeAttribute(name) : node.setAttribute(name, value) - } - - // access className property while respecting SVGAnimatedString - function className(node, value){ - var klass = node.className, - svg = klass && klass.baseVal !== undefined - - if (value === undefined) return svg ? klass.baseVal : klass - svg ? (klass.baseVal = value) : (node.className = value) - } - - // "true" => true - // "false" => false - // "null" => null - // "42" => 42 - // "42.5" => 42.5 - // "08" => "08" - // JSON => parse if valid - // String => self - function deserializeValue(value) { - var num - try { - return value ? - value == "true" || - ( value == "false" ? false : - value == "null" ? null : - !/^0/.test(value) && !isNaN(num = Number(value)) ? num : - /^[\[\{]/.test(value) ? $.parseJSON(value) : - value ) - : value - } catch(e) { - return value - } - } - - $.type = type - $.isFunction = isFunction - $.isWindow = isWindow - $.isArray = isArray - $.isPlainObject = isPlainObject - - $.isEmptyObject = function(obj) { - var name - for (name in obj) return false - return true - } - - $.inArray = function(elem, array, i){ - return emptyArray.indexOf.call(array, elem, i) - } - - $.camelCase = camelize - $.trim = function(str) { - return str == null ? "" : String.prototype.trim.call(str) - } - - // plugin compatibility - $.uuid = 0 - $.support = { } - $.expr = { } - - $.map = function(elements, callback){ - var value, values = [], i, key - if (likeArray(elements)) - for (i = 0; i < elements.length; i++) { - value = callback(elements[i], i) - if (value != null) values.push(value) - } - else - for (key in elements) { - value = callback(elements[key], key) - if (value != null) values.push(value) - } - return flatten(values) - } - - $.each = function(elements, callback){ - var i, key - if (likeArray(elements)) { - for (i = 0; i < elements.length; i++) - if (callback.call(elements[i], i, elements[i]) === false) return elements - } else { - for (key in elements) - if (callback.call(elements[key], key, elements[key]) === false) return elements - } - - return elements - } - - $.grep = function(elements, callback){ - return filter.call(elements, callback) - } - - if (window.JSON) $.parseJSON = JSON.parse - - // Populate the class2type map - $.each("Boolean Number String Function Array Date RegExp Object Error".split(" "), function(i, name) { - class2type[ "[object " + name + "]" ] = name.toLowerCase() - }) - - // Define methods that will be available on all - // Zepto collections - $.fn = { - // Because a collection acts like an array - // copy over these useful array functions. - forEach: emptyArray.forEach, - reduce: emptyArray.reduce, - push: emptyArray.push, - sort: emptyArray.sort, - indexOf: emptyArray.indexOf, - concat: emptyArray.concat, - - // `map` and `slice` in the jQuery API work differently - // from their array counterparts - map: function(fn){ - return $($.map(this, function(el, i){ return fn.call(el, i, el) })) - }, - slice: function(){ - return $(slice.apply(this, arguments)) - }, - - ready: function(callback){ - // need to check if document.body exists for IE as that browser reports - // document ready when it hasn't yet created the body element - if (readyRE.test(document.readyState) && document.body) callback($) - else document.addEventListener('DOMContentLoaded', function(){ callback($) }, false) - return this - }, - get: function(idx){ - return idx === undefined ? slice.call(this) : this[idx >= 0 ? idx : idx + this.length] - }, - toArray: function(){ return this.get() }, - size: function(){ - return this.length - }, - remove: function(){ - return this.each(function(){ - if (this.parentNode != null) - this.parentNode.removeChild(this) - }) - }, - each: function(callback){ - emptyArray.every.call(this, function(el, idx){ - return callback.call(el, idx, el) !== false - }) - return this - }, - filter: function(selector){ - if (isFunction(selector)) return this.not(this.not(selector)) - return $(filter.call(this, function(element){ - return zepto.matches(element, selector) - })) - }, - add: function(selector,context){ - return $(uniq(this.concat($(selector,context)))) - }, - is: function(selector){ - return this.length > 0 && zepto.matches(this[0], selector) - }, - not: function(selector){ - var nodes=[] - if (isFunction(selector) && selector.call !== undefined) - this.each(function(idx){ - if (!selector.call(this,idx)) nodes.push(this) - }) - else { - var excludes = typeof selector == 'string' ? this.filter(selector) : - (likeArray(selector) && isFunction(selector.item)) ? slice.call(selector) : $(selector) - this.forEach(function(el){ - if (excludes.indexOf(el) < 0) nodes.push(el) - }) - } - return $(nodes) - }, - has: function(selector){ - return this.filter(function(){ - return isObject(selector) ? - $.contains(this, selector) : - $(this).find(selector).size() - }) - }, - eq: function(idx){ - return idx === -1 ? this.slice(idx) : this.slice(idx, + idx + 1) - }, - first: function(){ - var el = this[0] - return el && !isObject(el) ? el : $(el) - }, - last: function(){ - var el = this[this.length - 1] - return el && !isObject(el) ? el : $(el) - }, - find: function(selector){ - var result, $this = this - if (typeof selector == 'object') - result = $(selector).filter(function(){ - var node = this - return emptyArray.some.call($this, function(parent){ - return $.contains(parent, node) - }) - }) - else if (this.length == 1) result = $(zepto.qsa(this[0], selector)) - else result = this.map(function(){ return zepto.qsa(this, selector) }) - return result - }, - closest: function(selector, context){ - var node = this[0], collection = false - if (typeof selector == 'object') collection = $(selector) - while (node && !(collection ? collection.indexOf(node) >= 0 : zepto.matches(node, selector))) - node = node !== context && !isDocument(node) && node.parentNode - return $(node) - }, - parents: function(selector){ - var ancestors = [], nodes = this - while (nodes.length > 0) - nodes = $.map(nodes, function(node){ - if ((node = node.parentNode) && !isDocument(node) && ancestors.indexOf(node) < 0) { - ancestors.push(node) - return node - } - }) - return filtered(ancestors, selector) - }, - parent: function(selector){ - return filtered(uniq(this.pluck('parentNode')), selector) - }, - children: function(selector){ - return filtered(this.map(function(){ return children(this) }), selector) - }, - contents: function() { - return this.map(function() { return slice.call(this.childNodes) }) - }, - siblings: function(selector){ - return filtered(this.map(function(i, el){ - return filter.call(children(el.parentNode), function(child){ return child!==el }) - }), selector) - }, - empty: function(){ - return this.each(function(){ this.innerHTML = '' }) - }, - // `pluck` is borrowed from Prototype.js - pluck: function(property){ - return $.map(this, function(el){ return el[property] }) - }, - show: function(){ - return this.each(function(){ - this.style.display == "none" && (this.style.display = '') - if (getComputedStyle(this, '').getPropertyValue("display") == "none") - this.style.display = defaultDisplay(this.nodeName) - }) - }, - replaceWith: function(newContent){ - return this.before(newContent).remove() - }, - wrap: function(structure){ - var func = isFunction(structure) - if (this[0] && !func) - var dom = $(structure).get(0), - clone = dom.parentNode || this.length > 1 - - return this.each(function(index){ - $(this).wrapAll( - func ? structure.call(this, index) : - clone ? dom.cloneNode(true) : dom - ) - }) - }, - wrapAll: function(structure){ - if (this[0]) { - $(this[0]).before(structure = $(structure)) - var children - // drill down to the inmost element - while ((children = structure.children()).length) structure = children.first() - $(structure).append(this) - } - return this - }, - wrapInner: function(structure){ - var func = isFunction(structure) - return this.each(function(index){ - var self = $(this), contents = self.contents(), - dom = func ? structure.call(this, index) : structure - contents.length ? contents.wrapAll(dom) : self.append(dom) - }) - }, - unwrap: function(){ - this.parent().each(function(){ - $(this).replaceWith($(this).children()) - }) - return this - }, - clone: function(){ - return this.map(function(){ return this.cloneNode(true) }) - }, - hide: function(){ - return this.css("display", "none") - }, - toggle: function(setting){ - return this.each(function(){ - var el = $(this) - ;(setting === undefined ? el.css("display") == "none" : setting) ? el.show() : el.hide() - }) - }, - prev: function(selector){ return $(this.pluck('previousElementSibling')).filter(selector || '*') }, - next: function(selector){ return $(this.pluck('nextElementSibling')).filter(selector || '*') }, - html: function(html){ - return arguments.length === 0 ? - (this.length > 0 ? this[0].innerHTML : null) : - this.each(function(idx){ - var originHtml = this.innerHTML - $(this).empty().append( funcArg(this, html, idx, originHtml) ) - }) - }, - text: function(text){ - return arguments.length === 0 ? - (this.length > 0 ? this[0].textContent : null) : - this.each(function(){ this.textContent = (text === undefined) ? '' : ''+text }) - }, - attr: function(name, value){ - var result - return (typeof name == 'string' && value === undefined) ? - (this.length == 0 || this[0].nodeType !== 1 ? undefined : - (name == 'value' && this[0].nodeName == 'INPUT') ? this.val() : - (!(result = this[0].getAttribute(name)) && name in this[0]) ? this[0][name] : result - ) : - this.each(function(idx){ - if (this.nodeType !== 1) return - if (isObject(name)) for (key in name) setAttribute(this, key, name[key]) - else setAttribute(this, name, funcArg(this, value, idx, this.getAttribute(name))) - }) - }, - removeAttr: function(name){ - return this.each(function(){ this.nodeType === 1 && setAttribute(this, name) }) - }, - prop: function(name, value){ - name = propMap[name] || name - return (value === undefined) ? - (this[0] && this[0][name]) : - this.each(function(idx){ - this[name] = funcArg(this, value, idx, this[name]) - }) - }, - data: function(name, value){ - var data = this.attr('data-' + name.replace(capitalRE, '-$1').toLowerCase(), value) - return data !== null ? deserializeValue(data) : undefined - }, - val: function(value){ - return arguments.length === 0 ? - (this[0] && (this[0].multiple ? - $(this[0]).find('option').filter(function(){ return this.selected }).pluck('value') : - this[0].value) - ) : - this.each(function(idx){ - this.value = funcArg(this, value, idx, this.value) - }) - }, - offset: function(coordinates){ - if (coordinates) return this.each(function(index){ - var $this = $(this), - coords = funcArg(this, coordinates, index, $this.offset()), - parentOffset = $this.offsetParent().offset(), - props = { - top: coords.top - parentOffset.top, - left: coords.left - parentOffset.left - } - - if ($this.css('position') == 'static') props['position'] = 'relative' - $this.css(props) - }) - if (this.length==0) return null - var obj = this[0].getBoundingClientRect() - return { - left: obj.left + window.pageXOffset, - top: obj.top + window.pageYOffset, - width: Math.round(obj.width), - height: Math.round(obj.height) - } - }, - css: function(property, value){ - if (arguments.length < 2) { - var element = this[0], computedStyle = getComputedStyle(element, '') - if(!element) return - if (typeof property == 'string') - return element.style[camelize(property)] || computedStyle.getPropertyValue(property) - else if (isArray(property)) { - var props = {} - $.each(isArray(property) ? property: [property], function(_, prop){ - props[prop] = (element.style[camelize(prop)] || computedStyle.getPropertyValue(prop)) - }) - return props - } - } - - var css = '' - if (type(property) == 'string') { - if (!value && value !== 0) - this.each(function(){ this.style.removeProperty(dasherize(property)) }) - else - css = dasherize(property) + ":" + maybeAddPx(property, value) - } else { - for (key in property) - if (!property[key] && property[key] !== 0) - this.each(function(){ this.style.removeProperty(dasherize(key)) }) - else - css += dasherize(key) + ':' + maybeAddPx(key, property[key]) + ';' - } - - return this.each(function(){ this.style.cssText += ';' + css }) - }, - index: function(element){ - return element ? this.indexOf($(element)[0]) : this.parent().children().indexOf(this[0]) - }, - hasClass: function(name){ - if (!name) return false - return emptyArray.some.call(this, function(el){ - return this.test(className(el)) - }, classRE(name)) - }, - addClass: function(name){ - if (!name) return this - return this.each(function(idx){ - classList = [] - var cls = className(this), newName = funcArg(this, name, idx, cls) - newName.split(/\s+/g).forEach(function(klass){ - if (!$(this).hasClass(klass)) classList.push(klass) - }, this) - classList.length && className(this, cls + (cls ? " " : "") + classList.join(" ")) - }) - }, - removeClass: function(name){ - return this.each(function(idx){ - if (name === undefined) return className(this, '') - classList = className(this) - funcArg(this, name, idx, classList).split(/\s+/g).forEach(function(klass){ - classList = classList.replace(classRE(klass), " ") - }) - className(this, classList.trim()) - }) - }, - toggleClass: function(name, when){ - if (!name) return this - return this.each(function(idx){ - var $this = $(this), names = funcArg(this, name, idx, className(this)) - names.split(/\s+/g).forEach(function(klass){ - (when === undefined ? !$this.hasClass(klass) : when) ? - $this.addClass(klass) : $this.removeClass(klass) - }) - }) - }, - scrollTop: function(value){ - if (!this.length) return - var hasScrollTop = 'scrollTop' in this[0] - if (value === undefined) return hasScrollTop ? this[0].scrollTop : this[0].pageYOffset - return this.each(hasScrollTop ? - function(){ this.scrollTop = value } : - function(){ this.scrollTo(this.scrollX, value) }) - }, - scrollLeft: function(value){ - if (!this.length) return - var hasScrollLeft = 'scrollLeft' in this[0] - if (value === undefined) return hasScrollLeft ? this[0].scrollLeft : this[0].pageXOffset - return this.each(hasScrollLeft ? - function(){ this.scrollLeft = value } : - function(){ this.scrollTo(value, this.scrollY) }) - }, - position: function() { - if (!this.length) return - - var elem = this[0], - // Get *real* offsetParent - offsetParent = this.offsetParent(), - // Get correct offsets - offset = this.offset(), - parentOffset = rootNodeRE.test(offsetParent[0].nodeName) ? { top: 0, left: 0 } : offsetParent.offset() - - // Subtract element margins - // note: when an element has margin: auto the offsetLeft and marginLeft - // are the same in Safari causing offset.left to incorrectly be 0 - offset.top -= parseFloat( $(elem).css('margin-top') ) || 0 - offset.left -= parseFloat( $(elem).css('margin-left') ) || 0 - - // Add offsetParent borders - parentOffset.top += parseFloat( $(offsetParent[0]).css('border-top-width') ) || 0 - parentOffset.left += parseFloat( $(offsetParent[0]).css('border-left-width') ) || 0 - - // Subtract the two offsets - return { - top: offset.top - parentOffset.top, - left: offset.left - parentOffset.left - } - }, - offsetParent: function() { - return this.map(function(){ - var parent = this.offsetParent || document.body - while (parent && !rootNodeRE.test(parent.nodeName) && $(parent).css("position") == "static") - parent = parent.offsetParent - return parent - }) - } - } - - // for now - $.fn.detach = $.fn.remove - - // Generate the `width` and `height` functions - ;['width', 'height'].forEach(function(dimension){ - var dimensionProperty = - dimension.replace(/./, function(m){ return m[0].toUpperCase() }) - - $.fn[dimension] = function(value){ - var offset, el = this[0] - if (value === undefined) return isWindow(el) ? el['inner' + dimensionProperty] : - isDocument(el) ? el.documentElement['scroll' + dimensionProperty] : - (offset = this.offset()) && offset[dimension] - else return this.each(function(idx){ - el = $(this) - el.css(dimension, funcArg(this, value, idx, el[dimension]())) - }) - } - }) - - function traverseNode(node, fun) { - fun(node) - for (var key in node.childNodes) traverseNode(node.childNodes[key], fun) - } - - // Generate the `after`, `prepend`, `before`, `append`, - // `insertAfter`, `insertBefore`, `appendTo`, and `prependTo` methods. - adjacencyOperators.forEach(function(operator, operatorIndex) { - var inside = operatorIndex % 2 //=> prepend, append - - $.fn[operator] = function(){ - // arguments can be nodes, arrays of nodes, Zepto objects and HTML strings - var argType, nodes = $.map(arguments, function(arg) { - argType = type(arg) - return argType == "object" || argType == "array" || arg == null ? - arg : zepto.fragment(arg) - }), - parent, copyByClone = this.length > 1 - if (nodes.length < 1) return this - - return this.each(function(_, target){ - parent = inside ? target : target.parentNode - - // convert all methods to a "before" operation - target = operatorIndex == 0 ? target.nextSibling : - operatorIndex == 1 ? target.firstChild : - operatorIndex == 2 ? target : - null - - nodes.forEach(function(node){ - if (copyByClone) node = node.cloneNode(true) - else if (!parent) return $(node).remove() - - traverseNode(parent.insertBefore(node, target), function(el){ - if (el.nodeName != null && el.nodeName.toUpperCase() === 'SCRIPT' && - (!el.type || el.type === 'text/javascript') && !el.src) - window['eval'].call(window, el.innerHTML) - }) - }) - }) - } - - // after => insertAfter - // prepend => prependTo - // before => insertBefore - // append => appendTo - $.fn[inside ? operator+'To' : 'insert'+(operatorIndex ? 'Before' : 'After')] = function(html){ - $(html)[operator](this) - return this - } - }) - - zepto.Z.prototype = $.fn - - // Export internal API functions in the `$.zepto` namespace - zepto.uniq = uniq - zepto.deserializeValue = deserializeValue - $.zepto = zepto - - return $ -})() - -window.Zepto = Zepto -window.$ === undefined && (window.$ = Zepto) - -;(function($){ - var _zid = 1, undefined, - slice = Array.prototype.slice, - isFunction = $.isFunction, - isString = function(obj){ return typeof obj == 'string' }, - handlers = {}, - specialEvents={}, - focusinSupported = 'onfocusin' in window, - focus = { focus: 'focusin', blur: 'focusout' }, - hover = { mouseenter: 'mouseover', mouseleave: 'mouseout' } - - specialEvents.click = specialEvents.mousedown = specialEvents.mouseup = specialEvents.mousemove = 'MouseEvents' - - function zid(element) { - return element._zid || (element._zid = _zid++) - } - function findHandlers(element, event, fn, selector) { - event = parse(event) - if (event.ns) var matcher = matcherFor(event.ns) - return (handlers[zid(element)] || []).filter(function(handler) { - return handler - && (!event.e || handler.e == event.e) - && (!event.ns || matcher.test(handler.ns)) - && (!fn || zid(handler.fn) === zid(fn)) - && (!selector || handler.sel == selector) - }) - } - function parse(event) { - var parts = ('' + event).split('.') - return {e: parts[0], ns: parts.slice(1).sort().join(' ')} - } - function matcherFor(ns) { - return new RegExp('(?:^| )' + ns.replace(' ', ' .* ?') + '(?: |$)') - } - - function eventCapture(handler, captureSetting) { - return handler.del && - (!focusinSupported && (handler.e in focus)) || - !!captureSetting - } - - function realEvent(type) { - return hover[type] || (focusinSupported && focus[type]) || type - } - - function add(element, events, fn, data, selector, delegator, capture){ - var id = zid(element), set = (handlers[id] || (handlers[id] = [])) - events.split(/\s/).forEach(function(event){ - if (event == 'ready') return $(document).ready(fn) - var handler = parse(event) - handler.fn = fn - handler.sel = selector - // emulate mouseenter, mouseleave - if (handler.e in hover) fn = function(e){ - var related = e.relatedTarget - if (!related || (related !== this && !$.contains(this, related))) - return handler.fn.apply(this, arguments) - } - handler.del = delegator - var callback = delegator || fn - handler.proxy = function(e){ - e = compatible(e) - if (e.isImmediatePropagationStopped()) return - e.data = data - var result = callback.apply(element, e._args == undefined ? [e] : [e].concat(e._args)) - if (result === false) e.preventDefault(), e.stopPropagation() - return result - } - handler.i = set.length - set.push(handler) - if ('addEventListener' in element) - element.addEventListener(realEvent(handler.e), handler.proxy, eventCapture(handler, capture)) - }) - } - function remove(element, events, fn, selector, capture){ - var id = zid(element) - ;(events || '').split(/\s/).forEach(function(event){ - findHandlers(element, event, fn, selector).forEach(function(handler){ - delete handlers[id][handler.i] - if ('removeEventListener' in element) - element.removeEventListener(realEvent(handler.e), handler.proxy, eventCapture(handler, capture)) - }) - }) - } - - $.event = { add: add, remove: remove } - - $.proxy = function(fn, context) { - if (isFunction(fn)) { - var proxyFn = function(){ return fn.apply(context, arguments) } - proxyFn._zid = zid(fn) - return proxyFn - } else if (isString(context)) { - return $.proxy(fn[context], fn) - } else { - throw new TypeError("expected function") - } - } - - $.fn.bind = function(event, data, callback){ - return this.on(event, data, callback) - } - $.fn.unbind = function(event, callback){ - return this.off(event, callback) - } - $.fn.one = function(event, selector, data, callback){ - return this.on(event, selector, data, callback, 1) - } - - var returnTrue = function(){return true}, - returnFalse = function(){return false}, - ignoreProperties = /^([A-Z]|returnValue$|layer[XY]$)/, - eventMethods = { - preventDefault: 'isDefaultPrevented', - stopImmediatePropagation: 'isImmediatePropagationStopped', - stopPropagation: 'isPropagationStopped' - } - - function compatible(event, source) { - if (source || !event.isDefaultPrevented) { - source || (source = event) - - $.each(eventMethods, function(name, predicate) { - var sourceMethod = source[name] - event[name] = function(){ - this[predicate] = returnTrue - return sourceMethod && sourceMethod.apply(source, arguments) - } - event[predicate] = returnFalse - }) - - if (source.defaultPrevented !== undefined ? source.defaultPrevented : - 'returnValue' in source ? source.returnValue === false : - source.getPreventDefault && source.getPreventDefault()) - event.isDefaultPrevented = returnTrue - } - return event - } - - function createProxy(event) { - var key, proxy = { originalEvent: event } - for (key in event) - if (!ignoreProperties.test(key) && event[key] !== undefined) proxy[key] = event[key] - - return compatible(proxy, event) - } - - $.fn.delegate = function(selector, event, callback){ - return this.on(event, selector, callback) - } - $.fn.undelegate = function(selector, event, callback){ - return this.off(event, selector, callback) - } - - $.fn.live = function(event, callback){ - $(document.body).delegate(this.selector, event, callback) - return this - } - $.fn.die = function(event, callback){ - $(document.body).undelegate(this.selector, event, callback) - return this - } - - $.fn.on = function(event, selector, data, callback, one){ - var autoRemove, delegator, $this = this - if (event && !isString(event)) { - $.each(event, function(type, fn){ - $this.on(type, selector, data, fn, one) - }) - return $this - } - - if (!isString(selector) && !isFunction(callback) && callback !== false) - callback = data, data = selector, selector = undefined - if (isFunction(data) || data === false) - callback = data, data = undefined - - if (callback === false) callback = returnFalse - - return $this.each(function(_, element){ - if (one) autoRemove = function(e){ - remove(element, e.type, callback) - return callback.apply(this, arguments) - } - - if (selector) delegator = function(e){ - var evt, match = $(e.target).closest(selector, element).get(0) - if (match && match !== element) { - evt = $.extend(createProxy(e), {currentTarget: match, liveFired: element}) - return (autoRemove || callback).apply(match, [evt].concat(slice.call(arguments, 1))) - } - } - - add(element, event, callback, data, selector, delegator || autoRemove) - }) - } - $.fn.off = function(event, selector, callback){ - var $this = this - if (event && !isString(event)) { - $.each(event, function(type, fn){ - $this.off(type, selector, fn) - }) - return $this - } - - if (!isString(selector) && !isFunction(callback) && callback !== false) - callback = selector, selector = undefined - - if (callback === false) callback = returnFalse - - return $this.each(function(){ - remove(this, event, callback, selector) - }) - } - - $.fn.trigger = function(event, args){ - event = (isString(event) || $.isPlainObject(event)) ? $.Event(event) : compatible(event) - event._args = args - return this.each(function(){ - // items in the collection might not be DOM elements - if('dispatchEvent' in this) this.dispatchEvent(event) - else $(this).triggerHandler(event, args) - }) - } - - // triggers event handlers on current element just as if an event occurred, - // doesn't trigger an actual event, doesn't bubble - $.fn.triggerHandler = function(event, args){ - var e, result - this.each(function(i, element){ - e = createProxy(isString(event) ? $.Event(event) : event) - e._args = args - e.target = element - $.each(findHandlers(element, event.type || event), function(i, handler){ - result = handler.proxy(e) - if (e.isImmediatePropagationStopped()) return false - }) - }) - return result - } - - // shortcut methods for `.bind(event, fn)` for each event type - ;('focusin focusout load resize scroll unload click dblclick '+ - 'mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave '+ - 'change select keydown keypress keyup error').split(' ').forEach(function(event) { - $.fn[event] = function(callback) { - return callback ? - this.bind(event, callback) : - this.trigger(event) - } - }) - - ;['focus', 'blur'].forEach(function(name) { - $.fn[name] = function(callback) { - if (callback) this.bind(name, callback) - else this.each(function(){ - try { this[name]() } - catch(e) {} - }) - return this - } - }) - - $.Event = function(type, props) { - if (!isString(type)) props = type, type = props.type - var event = document.createEvent(specialEvents[type] || 'Events'), bubbles = true - if (props) for (var name in props) (name == 'bubbles') ? (bubbles = !!props[name]) : (event[name] = props[name]) - event.initEvent(type, bubbles, true) - return compatible(event) - } - -})(Zepto) - -;(function($){ - var jsonpID = 0, - document = window.document, - key, - name, - rscript = /)<[^<]*)*<\/script>/gi, - scriptTypeRE = /^(?:text|application)\/javascript/i, - xmlTypeRE = /^(?:text|application)\/xml/i, - jsonType = 'application/json', - htmlType = 'text/html', - blankRE = /^\s*$/ - - // trigger a custom event and return false if it was cancelled - function triggerAndReturn(context, eventName, data) { - var event = $.Event(eventName) - $(context).trigger(event, data) - return !event.isDefaultPrevented() - } - - // trigger an Ajax "global" event - function triggerGlobal(settings, context, eventName, data) { - if (settings.global) return triggerAndReturn(context || document, eventName, data) - } - - // Number of active Ajax requests - $.active = 0 - - function ajaxStart(settings) { - if (settings.global && $.active++ === 0) triggerGlobal(settings, null, 'ajaxStart') - } - function ajaxStop(settings) { - if (settings.global && !(--$.active)) triggerGlobal(settings, null, 'ajaxStop') - } - - // triggers an extra global event "ajaxBeforeSend" that's like "ajaxSend" but cancelable - function ajaxBeforeSend(xhr, settings) { - var context = settings.context - if (settings.beforeSend.call(context, xhr, settings) === false || - triggerGlobal(settings, context, 'ajaxBeforeSend', [xhr, settings]) === false) - return false - - triggerGlobal(settings, context, 'ajaxSend', [xhr, settings]) - } - function ajaxSuccess(data, xhr, settings, deferred) { - var context = settings.context, status = 'success' - settings.success.call(context, data, status, xhr) - if (deferred) deferred.resolveWith(context, [data, status, xhr]) - triggerGlobal(settings, context, 'ajaxSuccess', [xhr, settings, data]) - ajaxComplete(status, xhr, settings) - } - // type: "timeout", "error", "abort", "parsererror" - function ajaxError(error, type, xhr, settings, deferred) { - var context = settings.context - settings.error.call(context, xhr, type, error) - if (deferred) deferred.rejectWith(context, [xhr, type, error]) - triggerGlobal(settings, context, 'ajaxError', [xhr, settings, error || type]) - ajaxComplete(type, xhr, settings) - } - // status: "success", "notmodified", "error", "timeout", "abort", "parsererror" - function ajaxComplete(status, xhr, settings) { - var context = settings.context - settings.complete.call(context, xhr, status) - triggerGlobal(settings, context, 'ajaxComplete', [xhr, settings]) - ajaxStop(settings) - } - - // Empty function, used as default callback - function empty() {} - - $.ajaxJSONP = function(options, deferred){ - if (!('type' in options)) return $.ajax(options) - - var _callbackName = options.jsonpCallback, - callbackName = ($.isFunction(_callbackName) ? - _callbackName() : _callbackName) || ('jsonp' + (++jsonpID)), - script = document.createElement('script'), - originalCallback = window[callbackName], - responseData, - abort = function(errorType) { - $(script).triggerHandler('error', errorType || 'abort') - }, - xhr = { abort: abort }, abortTimeout - - if (deferred) deferred.promise(xhr) - - $(script).on('load error', function(e, errorType){ - clearTimeout(abortTimeout) - $(script).off().remove() - - if (e.type == 'error' || !responseData) { - ajaxError(null, errorType || 'error', xhr, options, deferred) - } else { - ajaxSuccess(responseData[0], xhr, options, deferred) - } - - window[callbackName] = originalCallback - if (responseData && $.isFunction(originalCallback)) - originalCallback(responseData[0]) - - originalCallback = responseData = undefined - }) - - if (ajaxBeforeSend(xhr, options) === false) { - abort('abort') - return xhr - } - - window[callbackName] = function(){ - responseData = arguments - } - - script.src = options.url.replace(/\?(.+)=\?/, '?$1=' + callbackName) - document.head.appendChild(script) - - if (options.timeout > 0) abortTimeout = setTimeout(function(){ - abort('timeout') - }, options.timeout) - - return xhr - } - - $.ajaxSettings = { - // Default type of request - type: 'GET', - // Callback that is executed before request - beforeSend: empty, - // Callback that is executed if the request succeeds - success: empty, - // Callback that is executed the the server drops error - error: empty, - // Callback that is executed on request complete (both: error and success) - complete: empty, - // The context for the callbacks - context: null, - // Whether to trigger "global" Ajax events - global: true, - // Transport - xhr: function () { - return new window.XMLHttpRequest() - }, - // MIME types mapping - // IIS returns Javascript as "application/x-javascript" - accepts: { - script: 'text/javascript, application/javascript, application/x-javascript', - json: jsonType, - xml: 'application/xml, text/xml', - html: htmlType, - text: 'text/plain' - }, - // Whether the request is to another domain - crossDomain: false, - // Default timeout - timeout: 0, - // Whether data should be serialized to string - processData: true, - // Whether the browser should be allowed to cache GET responses - cache: true - } - - function mimeToDataType(mime) { - if (mime) mime = mime.split(';', 2)[0] - return mime && ( mime == htmlType ? 'html' : - mime == jsonType ? 'json' : - scriptTypeRE.test(mime) ? 'script' : - xmlTypeRE.test(mime) && 'xml' ) || 'text' - } - - function appendQuery(url, query) { - if (query == '') return url - return (url + '&' + query).replace(/[&?]{1,2}/, '?') - } - - // serialize payload and append it to the URL for GET requests - function serializeData(options) { - if (options.processData && options.data && $.type(options.data) != "string") - options.data = $.param(options.data, options.traditional) - if (options.data && (!options.type || options.type.toUpperCase() == 'GET')) - options.url = appendQuery(options.url, options.data), options.data = undefined - } - - $.ajax = function(options){ - var settings = $.extend({}, options || {}), - deferred = $.Deferred && $.Deferred() - for (key in $.ajaxSettings) if (settings[key] === undefined) settings[key] = $.ajaxSettings[key] - - ajaxStart(settings) - - if (!settings.crossDomain) settings.crossDomain = /^([\w-]+:)?\/\/([^\/]+)/.test(settings.url) && - RegExp.$2 != window.location.host - - if (!settings.url) settings.url = window.location.toString() - serializeData(settings) - if (settings.cache === false) settings.url = appendQuery(settings.url, '_=' + Date.now()) - - var dataType = settings.dataType, hasPlaceholder = /\?.+=\?/.test(settings.url) - if (dataType == 'jsonp' || hasPlaceholder) { - if (!hasPlaceholder) - settings.url = appendQuery(settings.url, - settings.jsonp ? (settings.jsonp + '=?') : settings.jsonp === false ? '' : 'callback=?') - return $.ajaxJSONP(settings, deferred) - } - - var mime = settings.accepts[dataType], - headers = { }, - setHeader = function(name, value) { headers[name.toLowerCase()] = [name, value] }, - protocol = /^([\w-]+:)\/\//.test(settings.url) ? RegExp.$1 : window.location.protocol, - xhr = settings.xhr(), - nativeSetHeader = xhr.setRequestHeader, - abortTimeout - - if (deferred) deferred.promise(xhr) - - if (!settings.crossDomain) setHeader('X-Requested-With', 'XMLHttpRequest') - setHeader('Accept', mime || '*/*') - if (mime = settings.mimeType || mime) { - if (mime.indexOf(',') > -1) mime = mime.split(',', 2)[0] - xhr.overrideMimeType && xhr.overrideMimeType(mime) - } - if (settings.contentType || (settings.contentType !== false && settings.data && settings.type.toUpperCase() != 'GET')) - setHeader('Content-Type', settings.contentType || 'application/x-www-form-urlencoded') - - if (settings.headers) for (name in settings.headers) setHeader(name, settings.headers[name]) - xhr.setRequestHeader = setHeader - - xhr.onreadystatechange = function(){ - if (xhr.readyState == 4) { - xhr.onreadystatechange = empty - clearTimeout(abortTimeout) - var result, error = false - if ((xhr.status >= 200 && xhr.status < 300) || xhr.status == 304 || (xhr.status == 0 && protocol == 'file:')) { - dataType = dataType || mimeToDataType(settings.mimeType || xhr.getResponseHeader('content-type')) - result = xhr.responseText - - try { - // http://perfectionkills.com/global-eval-what-are-the-options/ - if (dataType == 'script') (1,eval)(result) - else if (dataType == 'xml') result = xhr.responseXML - else if (dataType == 'json') result = blankRE.test(result) ? null : $.parseJSON(result) - } catch (e) { error = e } - - if (error) ajaxError(error, 'parsererror', xhr, settings, deferred) - else ajaxSuccess(result, xhr, settings, deferred) - } else { - ajaxError(xhr.statusText || null, xhr.status ? 'error' : 'abort', xhr, settings, deferred) - } - } - } - - if (ajaxBeforeSend(xhr, settings) === false) { - xhr.abort() - ajaxError(null, 'abort', xhr, settings, deferred) - return xhr - } - - if (settings.xhrFields) for (name in settings.xhrFields) xhr[name] = settings.xhrFields[name] - - var async = 'async' in settings ? settings.async : true - xhr.open(settings.type, settings.url, async, settings.username, settings.password) - - for (name in headers) nativeSetHeader.apply(xhr, headers[name]) - - if (settings.timeout > 0) abortTimeout = setTimeout(function(){ - xhr.onreadystatechange = empty - xhr.abort() - ajaxError(null, 'timeout', xhr, settings, deferred) - }, settings.timeout) - - // avoid sending empty string (#319) - xhr.send(settings.data ? settings.data : null) - return xhr - } - - // handle optional data/success arguments - function parseArguments(url, data, success, dataType) { - if ($.isFunction(data)) dataType = success, success = data, data = undefined - if (!$.isFunction(success)) dataType = success, success = undefined - return { - url: url - , data: data - , success: success - , dataType: dataType - } - } - - $.get = function(/* url, data, success, dataType */){ - return $.ajax(parseArguments.apply(null, arguments)) - } - - $.post = function(/* url, data, success, dataType */){ - var options = parseArguments.apply(null, arguments) - options.type = 'POST' - return $.ajax(options) - } - - $.getJSON = function(/* url, data, success */){ - var options = parseArguments.apply(null, arguments) - options.dataType = 'json' - return $.ajax(options) - } - - $.fn.load = function(url, data, success){ - if (!this.length) return this - var self = this, parts = url.split(/\s/), selector, - options = parseArguments(url, data, success), - callback = options.success - if (parts.length > 1) options.url = parts[0], selector = parts[1] - options.success = function(response){ - self.html(selector ? - $('
    ').html(response.replace(rscript, "")).find(selector) - : response) - callback && callback.apply(self, arguments) - } - $.ajax(options) - return this - } - - var escape = encodeURIComponent - - function serialize(params, obj, traditional, scope){ - var type, array = $.isArray(obj), hash = $.isPlainObject(obj) - $.each(obj, function(key, value) { - type = $.type(value) - if (scope) key = traditional ? scope : - scope + '[' + (hash || type == 'object' || type == 'array' ? key : '') + ']' - // handle data in serializeArray() format - if (!scope && array) params.add(value.name, value.value) - // recurse into nested objects - else if (type == "array" || (!traditional && type == "object")) - serialize(params, value, traditional, key) - else params.add(key, value) - }) - } - - $.param = function(obj, traditional){ - var params = [] - params.add = function(k, v){ this.push(escape(k) + '=' + escape(v)) } - serialize(params, obj, traditional) - return params.join('&').replace(/%20/g, '+') - } -})(Zepto) - -;(function($){ - $.fn.serializeArray = function() { - var result = [], el - $([].slice.call(this.get(0).elements)).each(function(){ - el = $(this) - var type = el.attr('type') - if (this.nodeName.toLowerCase() != 'fieldset' && - !this.disabled && type != 'submit' && type != 'reset' && type != 'button' && - ((type != 'radio' && type != 'checkbox') || this.checked)) - result.push({ - name: el.attr('name'), - value: el.val() - }) - }) - return result - } - - $.fn.serialize = function(){ - var result = [] - this.serializeArray().forEach(function(elm){ - result.push(encodeURIComponent(elm.name) + '=' + encodeURIComponent(elm.value)) - }) - return result.join('&') - } - - $.fn.submit = function(callback) { - if (callback) this.bind('submit', callback) - else if (this.length) { - var event = $.Event('submit') - this.eq(0).trigger(event) - if (!event.isDefaultPrevented()) this.get(0).submit() - } - return this - } - -})(Zepto) - -;(function($, undefined){ - var prefix = '', eventPrefix, endEventName, endAnimationName, - vendors = { Webkit: 'webkit', Moz: '', O: 'o' }, - document = window.document, testEl = document.createElement('div'), - supportedTransforms = /^((translate|rotate|scale)(X|Y|Z|3d)?|matrix(3d)?|perspective|skew(X|Y)?)$/i, - transform, - transitionProperty, transitionDuration, transitionTiming, transitionDelay, - animationName, animationDuration, animationTiming, animationDelay, - cssReset = {} - - function dasherize(str) { return str.replace(/([a-z])([A-Z])/, '$1-$2').toLowerCase() } - function normalizeEvent(name) { return eventPrefix ? eventPrefix + name : name.toLowerCase() } - - $.each(vendors, function(vendor, event){ - if (testEl.style[vendor + 'TransitionProperty'] !== undefined) { - prefix = '-' + vendor.toLowerCase() + '-' - eventPrefix = event - return false - } - }) - - transform = prefix + 'transform' - cssReset[transitionProperty = prefix + 'transition-property'] = - cssReset[transitionDuration = prefix + 'transition-duration'] = - cssReset[transitionDelay = prefix + 'transition-delay'] = - cssReset[transitionTiming = prefix + 'transition-timing-function'] = - cssReset[animationName = prefix + 'animation-name'] = - cssReset[animationDuration = prefix + 'animation-duration'] = - cssReset[animationDelay = prefix + 'animation-delay'] = - cssReset[animationTiming = prefix + 'animation-timing-function'] = '' - - $.fx = { - off: (eventPrefix === undefined && testEl.style.transitionProperty === undefined), - speeds: { _default: 400, fast: 200, slow: 600 }, - cssPrefix: prefix, - transitionEnd: normalizeEvent('TransitionEnd'), - animationEnd: normalizeEvent('AnimationEnd') - } - - $.fn.animate = function(properties, duration, ease, callback, delay){ - if ($.isFunction(duration)) - callback = duration, ease = undefined, duration = undefined - if ($.isFunction(ease)) - callback = ease, ease = undefined - if ($.isPlainObject(duration)) - ease = duration.easing, callback = duration.complete, delay = duration.delay, duration = duration.duration - if (duration) duration = (typeof duration == 'number' ? duration : - ($.fx.speeds[duration] || $.fx.speeds._default)) / 1000 - if (delay) delay = parseFloat(delay) / 1000 - return this.anim(properties, duration, ease, callback, delay) - } - - $.fn.anim = function(properties, duration, ease, callback, delay){ - var key, cssValues = {}, cssProperties, transforms = '', - that = this, wrappedCallback, endEvent = $.fx.transitionEnd, - fired = false - - if (duration === undefined) duration = $.fx.speeds._default / 1000 - if (delay === undefined) delay = 0 - if ($.fx.off) duration = 0 - - if (typeof properties == 'string') { - // keyframe animation - cssValues[animationName] = properties - cssValues[animationDuration] = duration + 's' - cssValues[animationDelay] = delay + 's' - cssValues[animationTiming] = (ease || 'linear') - endEvent = $.fx.animationEnd - } else { - cssProperties = [] - // CSS transitions - for (key in properties) - if (supportedTransforms.test(key)) transforms += key + '(' + properties[key] + ') ' - else cssValues[key] = properties[key], cssProperties.push(dasherize(key)) - - if (transforms) cssValues[transform] = transforms, cssProperties.push(transform) - if (duration > 0 && typeof properties === 'object') { - cssValues[transitionProperty] = cssProperties.join(', ') - cssValues[transitionDuration] = duration + 's' - cssValues[transitionDelay] = delay + 's' - cssValues[transitionTiming] = (ease || 'linear') - } - } - - wrappedCallback = function(event){ - if (typeof event !== 'undefined') { - if (event.target !== event.currentTarget) return // makes sure the event didn't bubble from "below" - $(event.target).unbind(endEvent, wrappedCallback) - } else - $(this).unbind(endEvent, wrappedCallback) // triggered by setTimeout - - fired = true - $(this).css(cssReset) - callback && callback.call(this) - } - if (duration > 0){ - this.bind(endEvent, wrappedCallback) - // transitionEnd is not always firing on older Android phones - // so make sure it gets fired - setTimeout(function(){ - if (fired) return - wrappedCallback.call(that) - }, (duration * 1000) + 25) - } - - // trigger page reflow so new elements can animate - this.size() && this.get(0).clientLeft - - this.css(cssValues) - - if (duration <= 0) setTimeout(function() { - that.each(function(){ wrappedCallback.call(this) }) - }, 0) - - return this - } - - testEl = null -})(Zepto) - -;(function($){ - var zepto = $.zepto, oldQsa = zepto.qsa, oldMatches = zepto.matches - - function visible(elem){ - elem = $(elem) - return !!(elem.width() || elem.height()) && elem.css("display") !== "none" - } - - // Implements a subset from: - // http://api.jquery.com/category/selectors/jquery-selector-extensions/ - // - // Each filter function receives the current index, all nodes in the - // considered set, and a value if there were parentheses. The value - // of `this` is the node currently being considered. The function returns the - // resulting node(s), null, or undefined. - // - // Complex selectors are not supported: - // li:has(label:contains("foo")) + li:has(label:contains("bar")) - // ul.inner:first > li - var filters = $.expr[':'] = { - visible: function(){ if (visible(this)) return this }, - hidden: function(){ if (!visible(this)) return this }, - selected: function(){ if (this.selected) return this }, - checked: function(){ if (this.checked) return this }, - parent: function(){ return this.parentNode }, - first: function(idx){ if (idx === 0) return this }, - last: function(idx, nodes){ if (idx === nodes.length - 1) return this }, - eq: function(idx, _, value){ if (idx === value) return this }, - contains: function(idx, _, text){ if ($(this).text().indexOf(text) > -1) return this }, - has: function(idx, _, sel){ if (zepto.qsa(this, sel).length) return this } - } - - var filterRe = new RegExp('(.*):(\\w+)(?:\\(([^)]+)\\))?$\\s*'), - childRe = /^\s*>/, - classTag = 'Zepto' + (+new Date()) - - function process(sel, fn) { - // quote the hash in `a[href^=#]` expression - sel = sel.replace(/=#\]/g, '="#"]') - var filter, arg, match = filterRe.exec(sel) - if (match && match[2] in filters) { - filter = filters[match[2]], arg = match[3] - sel = match[1] - if (arg) { - var num = Number(arg) - if (isNaN(num)) arg = arg.replace(/^["']|["']$/g, '') - else arg = num - } - } - return fn(sel, filter, arg) - } - - zepto.qsa = function(node, selector) { - return process(selector, function(sel, filter, arg){ - try { - var taggedParent - if (!sel && filter) sel = '*' - else if (childRe.test(sel)) - // support "> *" child queries by tagging the parent node with a - // unique class and prepending that classname onto the selector - taggedParent = $(node).addClass(classTag), sel = '.'+classTag+' '+sel - - var nodes = oldQsa(node, sel) - } catch(e) { - console.error('error performing selector: %o', selector) - throw e - } finally { - if (taggedParent) taggedParent.removeClass(classTag) - } - return !filter ? nodes : - zepto.uniq($.map(nodes, function(n, i){ return filter.call(n, i, nodes, arg) })) - }) - } - - zepto.matches = function(node, selector){ - return process(selector, function(sel, filter, arg){ - return (!sel || oldMatches(node, sel)) && - (!filter || filter.call(node, null, arg) === node) - }) - } -})(Zepto) - -;(function($){ - $.fn.end = function(){ - return this.prevObject || $() - } - - $.fn.andSelf = function(){ - return this.add(this.prevObject || $()) - } - - 'filter,add,not,eq,first,last,find,closest,parents,parent,children,siblings'.split(',').forEach(function(property){ - var fn = $.fn[property] - $.fn[property] = function(){ - var ret = fn.apply(this, arguments) - ret.prevObject = this - return ret - } - }) -})(Zepto) - -;(function($){ - var data = {}, dataAttr = $.fn.data, camelize = $.camelCase, - exp = $.expando = 'Zepto' + (+new Date()), emptyArray = [] - - // Get value from node: - // 1. first try key as given, - // 2. then try camelized key, - // 3. fall back to reading "data-*" attribute. - function getData(node, name) { - var id = node[exp], store = id && data[id] - if (name === undefined) return store || setData(node) - else { - if (store) { - if (name in store) return store[name] - var camelName = camelize(name) - if (camelName in store) return store[camelName] - } - return dataAttr.call($(node), name) - } - } - - // Store value under camelized key on node - function setData(node, name, value) { - var id = node[exp] || (node[exp] = ++$.uuid), - store = data[id] || (data[id] = attributeData(node)) - if (name !== undefined) store[camelize(name)] = value - return store - } - - // Read all "data-*" attributes from a node - function attributeData(node) { - var store = {} - $.each(node.attributes || emptyArray, function(i, attr){ - if (attr.name.indexOf('data-') == 0) - store[camelize(attr.name.replace('data-', ''))] = - $.zepto.deserializeValue(attr.value) - }) - return store - } - - $.fn.data = function(name, value) { - return value === undefined ? - // set multiple values via object - $.isPlainObject(name) ? - this.each(function(i, node){ - $.each(name, function(key, value){ setData(node, key, value) }) - }) : - // get value from first element - this.length == 0 ? undefined : getData(this[0], name) : - // set value on all elements - this.each(function(){ setData(this, name, value) }) - } - - $.fn.removeData = function(names) { - if (typeof names == 'string') names = names.split(/\s+/) - return this.each(function(){ - var id = this[exp], store = id && data[id] - if (store) $.each(names || store, function(key){ - delete store[names ? camelize(this) : key] - }) - }) - } - - // Generate extended `remove` and `empty` functions - ;['remove', 'empty'].forEach(function(methodName){ - var origFn = $.fn[methodName] - $.fn[methodName] = function() { - var elements = this.find('*') - if (methodName === 'remove') elements = elements.add(this) - elements.removeData() - return origFn.call(this) - } - }) -})(Zepto) diff --git a/lib/zeptojs/dist/zepto.min.gz b/lib/zeptojs/dist/zepto.min.gz deleted file mode 100644 index b65d8f8..0000000 Binary files a/lib/zeptojs/dist/zepto.min.gz and /dev/null differ diff --git a/lib/zeptojs/dist/zepto.min.js b/lib/zeptojs/dist/zepto.min.js deleted file mode 100644 index a20b00f..0000000 --- a/lib/zeptojs/dist/zepto.min.js +++ /dev/null @@ -1,2 +0,0 @@ -/* Zepto 1.1.3 - zepto event ajax form fx selector stack data - zeptojs.com/license */ -var Zepto=function(){function $(t){return null==t?String(t):j[T.call(t)]||"object"}function L(t){return"function"==$(t)}function Z(t){return null!=t&&t==t.window}function D(t){return null!=t&&t.nodeType==t.DOCUMENT_NODE}function k(t){return"object"==$(t)}function z(t){return k(t)&&!Z(t)&&Object.getPrototypeOf(t)==Object.prototype}function q(t){return"number"==typeof t.length}function R(t){return s.call(t,function(t){return null!=t})}function M(t){return t.length>0?n.fn.concat.apply([],t):t}function F(t){return t.replace(/::/g,"/").replace(/([A-Z]+)([A-Z][a-z])/g,"$1_$2").replace(/([a-z\d])([A-Z])/g,"$1_$2").replace(/_/g,"-").toLowerCase()}function _(t){return t in f?f[t]:f[t]=new RegExp("(^|\\s)"+t+"(\\s|$)")}function H(t,e){return"number"!=typeof e||c[F(t)]?e:e+"px"}function I(t){var e,n;return u[t]||(e=a.createElement(t),a.body.appendChild(e),n=getComputedStyle(e,"").getPropertyValue("display"),e.parentNode.removeChild(e),"none"==n&&(n="block"),u[t]=n),u[t]}function V(t){return"children"in t?o.call(t.children):n.map(t.childNodes,function(t){return 1==t.nodeType?t:void 0})}function U(n,i,r){for(e in i)r&&(z(i[e])||A(i[e]))?(z(i[e])&&!z(n[e])&&(n[e]={}),A(i[e])&&!A(n[e])&&(n[e]=[]),U(n[e],i[e],r)):i[e]!==t&&(n[e]=i[e])}function X(t,e){return null==e?n(t):n(t).filter(e)}function B(t,e,n,i){return L(e)?e.call(t,n,i):e}function J(t,e,n){null==n?t.removeAttribute(e):t.setAttribute(e,n)}function W(e,n){var i=e.className,r=i&&i.baseVal!==t;return n===t?r?i.baseVal:i:void(r?i.baseVal=n:e.className=n)}function Y(t){var e;try{return t?"true"==t||("false"==t?!1:"null"==t?null:/^0/.test(t)||isNaN(e=Number(t))?/^[\[\{]/.test(t)?n.parseJSON(t):t:e):t}catch(i){return t}}function G(t,e){e(t);for(var n in t.childNodes)G(t.childNodes[n],e)}var t,e,n,i,N,S,r=[],o=r.slice,s=r.filter,a=window.document,u={},f={},c={"column-count":1,columns:1,"font-weight":1,"line-height":1,opacity:1,"z-index":1,zoom:1},l=/^\s*<(\w+|!)[^>]*>/,h=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,p=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,d=/^(?:body|html)$/i,m=/([A-Z])/g,v=["val","css","html","text","data","width","height","offset"],g=["after","prepend","before","append"],y=a.createElement("table"),x=a.createElement("tr"),b={tr:a.createElement("tbody"),tbody:y,thead:y,tfoot:y,td:x,th:x,"*":a.createElement("div")},w=/complete|loaded|interactive/,E=/^[\w-]*$/,j={},T=j.toString,C={},O=a.createElement("div"),P={tabindex:"tabIndex",readonly:"readOnly","for":"htmlFor","class":"className",maxlength:"maxLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",rowspan:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder",contenteditable:"contentEditable"},A=Array.isArray||function(t){return t instanceof Array};return C.matches=function(t,e){if(!e||!t||1!==t.nodeType)return!1;var n=t.webkitMatchesSelector||t.mozMatchesSelector||t.oMatchesSelector||t.matchesSelector;if(n)return n.call(t,e);var i,r=t.parentNode,o=!r;return o&&(r=O).appendChild(t),i=~C.qsa(r,e).indexOf(t),o&&O.removeChild(t),i},N=function(t){return t.replace(/-+(.)?/g,function(t,e){return e?e.toUpperCase():""})},S=function(t){return s.call(t,function(e,n){return t.indexOf(e)==n})},C.fragment=function(e,i,r){var s,u,f;return h.test(e)&&(s=n(a.createElement(RegExp.$1))),s||(e.replace&&(e=e.replace(p,"<$1>")),i===t&&(i=l.test(e)&&RegExp.$1),i in b||(i="*"),f=b[i],f.innerHTML=""+e,s=n.each(o.call(f.childNodes),function(){f.removeChild(this)})),z(r)&&(u=n(s),n.each(r,function(t,e){v.indexOf(t)>-1?u[t](e):u.attr(t,e)})),s},C.Z=function(t,e){return t=t||[],t.__proto__=n.fn,t.selector=e||"",t},C.isZ=function(t){return t instanceof C.Z},C.init=function(e,i){var r;if(!e)return C.Z();if("string"==typeof e)if(e=e.trim(),"<"==e[0]&&l.test(e))r=C.fragment(e,RegExp.$1,i),e=null;else{if(i!==t)return n(i).find(e);r=C.qsa(a,e)}else{if(L(e))return n(a).ready(e);if(C.isZ(e))return e;if(A(e))r=R(e);else if(k(e))r=[e],e=null;else if(l.test(e))r=C.fragment(e.trim(),RegExp.$1,i),e=null;else{if(i!==t)return n(i).find(e);r=C.qsa(a,e)}}return C.Z(r,e)},n=function(t,e){return C.init(t,e)},n.extend=function(t){var e,n=o.call(arguments,1);return"boolean"==typeof t&&(e=t,t=n.shift()),n.forEach(function(n){U(t,n,e)}),t},C.qsa=function(t,e){var n,i="#"==e[0],r=!i&&"."==e[0],s=i||r?e.slice(1):e,a=E.test(s);return D(t)&&a&&i?(n=t.getElementById(s))?[n]:[]:1!==t.nodeType&&9!==t.nodeType?[]:o.call(a&&!i?r?t.getElementsByClassName(s):t.getElementsByTagName(e):t.querySelectorAll(e))},n.contains=function(t,e){return t!==e&&t.contains(e)},n.type=$,n.isFunction=L,n.isWindow=Z,n.isArray=A,n.isPlainObject=z,n.isEmptyObject=function(t){var e;for(e in t)return!1;return!0},n.inArray=function(t,e,n){return r.indexOf.call(e,t,n)},n.camelCase=N,n.trim=function(t){return null==t?"":String.prototype.trim.call(t)},n.uuid=0,n.support={},n.expr={},n.map=function(t,e){var n,r,o,i=[];if(q(t))for(r=0;r=0?e:e+this.length]},toArray:function(){return this.get()},size:function(){return this.length},remove:function(){return this.each(function(){null!=this.parentNode&&this.parentNode.removeChild(this)})},each:function(t){return r.every.call(this,function(e,n){return t.call(e,n,e)!==!1}),this},filter:function(t){return L(t)?this.not(this.not(t)):n(s.call(this,function(e){return C.matches(e,t)}))},add:function(t,e){return n(S(this.concat(n(t,e))))},is:function(t){return this.length>0&&C.matches(this[0],t)},not:function(e){var i=[];if(L(e)&&e.call!==t)this.each(function(t){e.call(this,t)||i.push(this)});else{var r="string"==typeof e?this.filter(e):q(e)&&L(e.item)?o.call(e):n(e);this.forEach(function(t){r.indexOf(t)<0&&i.push(t)})}return n(i)},has:function(t){return this.filter(function(){return k(t)?n.contains(this,t):n(this).find(t).size()})},eq:function(t){return-1===t?this.slice(t):this.slice(t,+t+1)},first:function(){var t=this[0];return t&&!k(t)?t:n(t)},last:function(){var t=this[this.length-1];return t&&!k(t)?t:n(t)},find:function(t){var e,i=this;return e="object"==typeof t?n(t).filter(function(){var t=this;return r.some.call(i,function(e){return n.contains(e,t)})}):1==this.length?n(C.qsa(this[0],t)):this.map(function(){return C.qsa(this,t)})},closest:function(t,e){var i=this[0],r=!1;for("object"==typeof t&&(r=n(t));i&&!(r?r.indexOf(i)>=0:C.matches(i,t));)i=i!==e&&!D(i)&&i.parentNode;return n(i)},parents:function(t){for(var e=[],i=this;i.length>0;)i=n.map(i,function(t){return(t=t.parentNode)&&!D(t)&&e.indexOf(t)<0?(e.push(t),t):void 0});return X(e,t)},parent:function(t){return X(S(this.pluck("parentNode")),t)},children:function(t){return X(this.map(function(){return V(this)}),t)},contents:function(){return this.map(function(){return o.call(this.childNodes)})},siblings:function(t){return X(this.map(function(t,e){return s.call(V(e.parentNode),function(t){return t!==e})}),t)},empty:function(){return this.each(function(){this.innerHTML=""})},pluck:function(t){return n.map(this,function(e){return e[t]})},show:function(){return this.each(function(){"none"==this.style.display&&(this.style.display=""),"none"==getComputedStyle(this,"").getPropertyValue("display")&&(this.style.display=I(this.nodeName))})},replaceWith:function(t){return this.before(t).remove()},wrap:function(t){var e=L(t);if(this[0]&&!e)var i=n(t).get(0),r=i.parentNode||this.length>1;return this.each(function(o){n(this).wrapAll(e?t.call(this,o):r?i.cloneNode(!0):i)})},wrapAll:function(t){if(this[0]){n(this[0]).before(t=n(t));for(var e;(e=t.children()).length;)t=e.first();n(t).append(this)}return this},wrapInner:function(t){var e=L(t);return this.each(function(i){var r=n(this),o=r.contents(),s=e?t.call(this,i):t;o.length?o.wrapAll(s):r.append(s)})},unwrap:function(){return this.parent().each(function(){n(this).replaceWith(n(this).children())}),this},clone:function(){return this.map(function(){return this.cloneNode(!0)})},hide:function(){return this.css("display","none")},toggle:function(e){return this.each(function(){var i=n(this);(e===t?"none"==i.css("display"):e)?i.show():i.hide()})},prev:function(t){return n(this.pluck("previousElementSibling")).filter(t||"*")},next:function(t){return n(this.pluck("nextElementSibling")).filter(t||"*")},html:function(t){return 0===arguments.length?this.length>0?this[0].innerHTML:null:this.each(function(e){var i=this.innerHTML;n(this).empty().append(B(this,t,e,i))})},text:function(e){return 0===arguments.length?this.length>0?this[0].textContent:null:this.each(function(){this.textContent=e===t?"":""+e})},attr:function(n,i){var r;return"string"==typeof n&&i===t?0==this.length||1!==this[0].nodeType?t:"value"==n&&"INPUT"==this[0].nodeName?this.val():!(r=this[0].getAttribute(n))&&n in this[0]?this[0][n]:r:this.each(function(t){if(1===this.nodeType)if(k(n))for(e in n)J(this,e,n[e]);else J(this,n,B(this,i,t,this.getAttribute(n)))})},removeAttr:function(t){return this.each(function(){1===this.nodeType&&J(this,t)})},prop:function(e,n){return e=P[e]||e,n===t?this[0]&&this[0][e]:this.each(function(t){this[e]=B(this,n,t,this[e])})},data:function(e,n){var i=this.attr("data-"+e.replace(m,"-$1").toLowerCase(),n);return null!==i?Y(i):t},val:function(t){return 0===arguments.length?this[0]&&(this[0].multiple?n(this[0]).find("option").filter(function(){return this.selected}).pluck("value"):this[0].value):this.each(function(e){this.value=B(this,t,e,this.value)})},offset:function(t){if(t)return this.each(function(e){var i=n(this),r=B(this,t,e,i.offset()),o=i.offsetParent().offset(),s={top:r.top-o.top,left:r.left-o.left};"static"==i.css("position")&&(s.position="relative"),i.css(s)});if(0==this.length)return null;var e=this[0].getBoundingClientRect();return{left:e.left+window.pageXOffset,top:e.top+window.pageYOffset,width:Math.round(e.width),height:Math.round(e.height)}},css:function(t,i){if(arguments.length<2){var r=this[0],o=getComputedStyle(r,"");if(!r)return;if("string"==typeof t)return r.style[N(t)]||o.getPropertyValue(t);if(A(t)){var s={};return n.each(A(t)?t:[t],function(t,e){s[e]=r.style[N(e)]||o.getPropertyValue(e)}),s}}var a="";if("string"==$(t))i||0===i?a=F(t)+":"+H(t,i):this.each(function(){this.style.removeProperty(F(t))});else for(e in t)t[e]||0===t[e]?a+=F(e)+":"+H(e,t[e])+";":this.each(function(){this.style.removeProperty(F(e))});return this.each(function(){this.style.cssText+=";"+a})},index:function(t){return t?this.indexOf(n(t)[0]):this.parent().children().indexOf(this[0])},hasClass:function(t){return t?r.some.call(this,function(t){return this.test(W(t))},_(t)):!1},addClass:function(t){return t?this.each(function(e){i=[];var r=W(this),o=B(this,t,e,r);o.split(/\s+/g).forEach(function(t){n(this).hasClass(t)||i.push(t)},this),i.length&&W(this,r+(r?" ":"")+i.join(" "))}):this},removeClass:function(e){return this.each(function(n){return e===t?W(this,""):(i=W(this),B(this,e,n,i).split(/\s+/g).forEach(function(t){i=i.replace(_(t)," ")}),void W(this,i.trim()))})},toggleClass:function(e,i){return e?this.each(function(r){var o=n(this),s=B(this,e,r,W(this));s.split(/\s+/g).forEach(function(e){(i===t?!o.hasClass(e):i)?o.addClass(e):o.removeClass(e)})}):this},scrollTop:function(e){if(this.length){var n="scrollTop"in this[0];return e===t?n?this[0].scrollTop:this[0].pageYOffset:this.each(n?function(){this.scrollTop=e}:function(){this.scrollTo(this.scrollX,e)})}},scrollLeft:function(e){if(this.length){var n="scrollLeft"in this[0];return e===t?n?this[0].scrollLeft:this[0].pageXOffset:this.each(n?function(){this.scrollLeft=e}:function(){this.scrollTo(e,this.scrollY)})}},position:function(){if(this.length){var t=this[0],e=this.offsetParent(),i=this.offset(),r=d.test(e[0].nodeName)?{top:0,left:0}:e.offset();return i.top-=parseFloat(n(t).css("margin-top"))||0,i.left-=parseFloat(n(t).css("margin-left"))||0,r.top+=parseFloat(n(e[0]).css("border-top-width"))||0,r.left+=parseFloat(n(e[0]).css("border-left-width"))||0,{top:i.top-r.top,left:i.left-r.left}}},offsetParent:function(){return this.map(function(){for(var t=this.offsetParent||a.body;t&&!d.test(t.nodeName)&&"static"==n(t).css("position");)t=t.offsetParent;return t})}},n.fn.detach=n.fn.remove,["width","height"].forEach(function(e){var i=e.replace(/./,function(t){return t[0].toUpperCase()});n.fn[e]=function(r){var o,s=this[0];return r===t?Z(s)?s["inner"+i]:D(s)?s.documentElement["scroll"+i]:(o=this.offset())&&o[e]:this.each(function(t){s=n(this),s.css(e,B(this,r,t,s[e]()))})}}),g.forEach(function(t,e){var i=e%2;n.fn[t]=function(){var t,o,r=n.map(arguments,function(e){return t=$(e),"object"==t||"array"==t||null==e?e:C.fragment(e)}),s=this.length>1;return r.length<1?this:this.each(function(t,a){o=i?a:a.parentNode,a=0==e?a.nextSibling:1==e?a.firstChild:2==e?a:null,r.forEach(function(t){if(s)t=t.cloneNode(!0);else if(!o)return n(t).remove();G(o.insertBefore(t,a),function(t){null==t.nodeName||"SCRIPT"!==t.nodeName.toUpperCase()||t.type&&"text/javascript"!==t.type||t.src||window.eval.call(window,t.innerHTML)})})})},n.fn[i?t+"To":"insert"+(e?"Before":"After")]=function(e){return n(e)[t](this),this}}),C.Z.prototype=n.fn,C.uniq=S,C.deserializeValue=Y,n.zepto=C,n}();window.Zepto=Zepto,void 0===window.$&&(window.$=Zepto),function(t){function l(t){return t._zid||(t._zid=e++)}function h(t,e,n,i){if(e=p(e),e.ns)var r=d(e.ns);return(s[l(t)]||[]).filter(function(t){return!(!t||e.e&&t.e!=e.e||e.ns&&!r.test(t.ns)||n&&l(t.fn)!==l(n)||i&&t.sel!=i)})}function p(t){var e=(""+t).split(".");return{e:e[0],ns:e.slice(1).sort().join(" ")}}function d(t){return new RegExp("(?:^| )"+t.replace(" "," .* ?")+"(?: |$)")}function m(t,e){return t.del&&!u&&t.e in f||!!e}function v(t){return c[t]||u&&f[t]||t}function g(e,i,r,o,a,u,f){var h=l(e),d=s[h]||(s[h]=[]);i.split(/\s/).forEach(function(i){if("ready"==i)return t(document).ready(r);var s=p(i);s.fn=r,s.sel=a,s.e in c&&(r=function(e){var n=e.relatedTarget;return!n||n!==this&&!t.contains(this,n)?s.fn.apply(this,arguments):void 0}),s.del=u;var l=u||r;s.proxy=function(t){if(t=j(t),!t.isImmediatePropagationStopped()){t.data=o;var i=l.apply(e,t._args==n?[t]:[t].concat(t._args));return i===!1&&(t.preventDefault(),t.stopPropagation()),i}},s.i=d.length,d.push(s),"addEventListener"in e&&e.addEventListener(v(s.e),s.proxy,m(s,f))})}function y(t,e,n,i,r){var o=l(t);(e||"").split(/\s/).forEach(function(e){h(t,e,n,i).forEach(function(e){delete s[o][e.i],"removeEventListener"in t&&t.removeEventListener(v(e.e),e.proxy,m(e,r))})})}function j(e,i){return(i||!e.isDefaultPrevented)&&(i||(i=e),t.each(E,function(t,n){var r=i[t];e[t]=function(){return this[n]=x,r&&r.apply(i,arguments)},e[n]=b}),(i.defaultPrevented!==n?i.defaultPrevented:"returnValue"in i?i.returnValue===!1:i.getPreventDefault&&i.getPreventDefault())&&(e.isDefaultPrevented=x)),e}function T(t){var e,i={originalEvent:t};for(e in t)w.test(e)||t[e]===n||(i[e]=t[e]);return j(i,t)}var n,e=1,i=Array.prototype.slice,r=t.isFunction,o=function(t){return"string"==typeof t},s={},a={},u="onfocusin"in window,f={focus:"focusin",blur:"focusout"},c={mouseenter:"mouseover",mouseleave:"mouseout"};a.click=a.mousedown=a.mouseup=a.mousemove="MouseEvents",t.event={add:g,remove:y},t.proxy=function(e,n){if(r(e)){var i=function(){return e.apply(n,arguments)};return i._zid=l(e),i}if(o(n))return t.proxy(e[n],e);throw new TypeError("expected function")},t.fn.bind=function(t,e,n){return this.on(t,e,n)},t.fn.unbind=function(t,e){return this.off(t,e)},t.fn.one=function(t,e,n,i){return this.on(t,e,n,i,1)};var x=function(){return!0},b=function(){return!1},w=/^([A-Z]|returnValue$|layer[XY]$)/,E={preventDefault:"isDefaultPrevented",stopImmediatePropagation:"isImmediatePropagationStopped",stopPropagation:"isPropagationStopped"};t.fn.delegate=function(t,e,n){return this.on(e,t,n)},t.fn.undelegate=function(t,e,n){return this.off(e,t,n)},t.fn.live=function(e,n){return t(document.body).delegate(this.selector,e,n),this},t.fn.die=function(e,n){return t(document.body).undelegate(this.selector,e,n),this},t.fn.on=function(e,s,a,u,f){var c,l,h=this;return e&&!o(e)?(t.each(e,function(t,e){h.on(t,s,a,e,f)}),h):(o(s)||r(u)||u===!1||(u=a,a=s,s=n),(r(a)||a===!1)&&(u=a,a=n),u===!1&&(u=b),h.each(function(n,r){f&&(c=function(t){return y(r,t.type,u),u.apply(this,arguments)}),s&&(l=function(e){var n,o=t(e.target).closest(s,r).get(0);return o&&o!==r?(n=t.extend(T(e),{currentTarget:o,liveFired:r}),(c||u).apply(o,[n].concat(i.call(arguments,1)))):void 0}),g(r,e,u,a,s,l||c)}))},t.fn.off=function(e,i,s){var a=this;return e&&!o(e)?(t.each(e,function(t,e){a.off(t,i,e)}),a):(o(i)||r(s)||s===!1||(s=i,i=n),s===!1&&(s=b),a.each(function(){y(this,e,s,i)}))},t.fn.trigger=function(e,n){return e=o(e)||t.isPlainObject(e)?t.Event(e):j(e),e._args=n,this.each(function(){"dispatchEvent"in this?this.dispatchEvent(e):t(this).triggerHandler(e,n)})},t.fn.triggerHandler=function(e,n){var i,r;return this.each(function(s,a){i=T(o(e)?t.Event(e):e),i._args=n,i.target=a,t.each(h(a,e.type||e),function(t,e){return r=e.proxy(i),i.isImmediatePropagationStopped()?!1:void 0})}),r},"focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select keydown keypress keyup error".split(" ").forEach(function(e){t.fn[e]=function(t){return t?this.bind(e,t):this.trigger(e)}}),["focus","blur"].forEach(function(e){t.fn[e]=function(t){return t?this.bind(e,t):this.each(function(){try{this[e]()}catch(t){}}),this}}),t.Event=function(t,e){o(t)||(e=t,t=e.type);var n=document.createEvent(a[t]||"Events"),i=!0;if(e)for(var r in e)"bubbles"==r?i=!!e[r]:n[r]=e[r];return n.initEvent(t,i,!0),j(n)}}(Zepto),function(t){function l(e,n,i){var r=t.Event(n);return t(e).trigger(r,i),!r.isDefaultPrevented()}function h(t,e,i,r){return t.global?l(e||n,i,r):void 0}function p(e){e.global&&0===t.active++&&h(e,null,"ajaxStart")}function d(e){e.global&&!--t.active&&h(e,null,"ajaxStop")}function m(t,e){var n=e.context;return e.beforeSend.call(n,t,e)===!1||h(e,n,"ajaxBeforeSend",[t,e])===!1?!1:void h(e,n,"ajaxSend",[t,e])}function v(t,e,n,i){var r=n.context,o="success";n.success.call(r,t,o,e),i&&i.resolveWith(r,[t,o,e]),h(n,r,"ajaxSuccess",[e,n,t]),y(o,e,n)}function g(t,e,n,i,r){var o=i.context;i.error.call(o,n,e,t),r&&r.rejectWith(o,[n,e,t]),h(i,o,"ajaxError",[n,i,t||e]),y(e,n,i)}function y(t,e,n){var i=n.context;n.complete.call(i,e,t),h(n,i,"ajaxComplete",[e,n]),d(n)}function x(){}function b(t){return t&&(t=t.split(";",2)[0]),t&&(t==f?"html":t==u?"json":s.test(t)?"script":a.test(t)&&"xml")||"text"}function w(t,e){return""==e?t:(t+"&"+e).replace(/[&?]{1,2}/,"?")}function E(e){e.processData&&e.data&&"string"!=t.type(e.data)&&(e.data=t.param(e.data,e.traditional)),!e.data||e.type&&"GET"!=e.type.toUpperCase()||(e.url=w(e.url,e.data),e.data=void 0)}function j(e,n,i,r){return t.isFunction(n)&&(r=i,i=n,n=void 0),t.isFunction(i)||(r=i,i=void 0),{url:e,data:n,success:i,dataType:r}}function C(e,n,i,r){var o,s=t.isArray(n),a=t.isPlainObject(n);t.each(n,function(n,u){o=t.type(u),r&&(n=i?r:r+"["+(a||"object"==o||"array"==o?n:"")+"]"),!r&&s?e.add(u.name,u.value):"array"==o||!i&&"object"==o?C(e,u,i,n):e.add(n,u)})}var i,r,e=0,n=window.document,o=/)<[^<]*)*<\/script>/gi,s=/^(?:text|application)\/javascript/i,a=/^(?:text|application)\/xml/i,u="application/json",f="text/html",c=/^\s*$/;t.active=0,t.ajaxJSONP=function(i,r){if(!("type"in i))return t.ajax(i);var f,h,o=i.jsonpCallback,s=(t.isFunction(o)?o():o)||"jsonp"+ ++e,a=n.createElement("script"),u=window[s],c=function(e){t(a).triggerHandler("error",e||"abort")},l={abort:c};return r&&r.promise(l),t(a).on("load error",function(e,n){clearTimeout(h),t(a).off().remove(),"error"!=e.type&&f?v(f[0],l,i,r):g(null,n||"error",l,i,r),window[s]=u,f&&t.isFunction(u)&&u(f[0]),u=f=void 0}),m(l,i)===!1?(c("abort"),l):(window[s]=function(){f=arguments},a.src=i.url.replace(/\?(.+)=\?/,"?$1="+s),n.head.appendChild(a),i.timeout>0&&(h=setTimeout(function(){c("timeout")},i.timeout)),l)},t.ajaxSettings={type:"GET",beforeSend:x,success:x,error:x,complete:x,context:null,global:!0,xhr:function(){return new window.XMLHttpRequest},accepts:{script:"text/javascript, application/javascript, application/x-javascript",json:u,xml:"application/xml, text/xml",html:f,text:"text/plain"},crossDomain:!1,timeout:0,processData:!0,cache:!0},t.ajax=function(e){var n=t.extend({},e||{}),o=t.Deferred&&t.Deferred();for(i in t.ajaxSettings)void 0===n[i]&&(n[i]=t.ajaxSettings[i]);p(n),n.crossDomain||(n.crossDomain=/^([\w-]+:)?\/\/([^\/]+)/.test(n.url)&&RegExp.$2!=window.location.host),n.url||(n.url=window.location.toString()),E(n),n.cache===!1&&(n.url=w(n.url,"_="+Date.now()));var s=n.dataType,a=/\?.+=\?/.test(n.url);if("jsonp"==s||a)return a||(n.url=w(n.url,n.jsonp?n.jsonp+"=?":n.jsonp===!1?"":"callback=?")),t.ajaxJSONP(n,o);var j,u=n.accepts[s],f={},l=function(t,e){f[t.toLowerCase()]=[t,e]},h=/^([\w-]+:)\/\//.test(n.url)?RegExp.$1:window.location.protocol,d=n.xhr(),y=d.setRequestHeader;if(o&&o.promise(d),n.crossDomain||l("X-Requested-With","XMLHttpRequest"),l("Accept",u||"*/*"),(u=n.mimeType||u)&&(u.indexOf(",")>-1&&(u=u.split(",",2)[0]),d.overrideMimeType&&d.overrideMimeType(u)),(n.contentType||n.contentType!==!1&&n.data&&"GET"!=n.type.toUpperCase())&&l("Content-Type",n.contentType||"application/x-www-form-urlencoded"),n.headers)for(r in n.headers)l(r,n.headers[r]);if(d.setRequestHeader=l,d.onreadystatechange=function(){if(4==d.readyState){d.onreadystatechange=x,clearTimeout(j);var e,i=!1;if(d.status>=200&&d.status<300||304==d.status||0==d.status&&"file:"==h){s=s||b(n.mimeType||d.getResponseHeader("content-type")),e=d.responseText;try{"script"==s?(1,eval)(e):"xml"==s?e=d.responseXML:"json"==s&&(e=c.test(e)?null:t.parseJSON(e))}catch(r){i=r}i?g(i,"parsererror",d,n,o):v(e,d,n,o)}else g(d.statusText||null,d.status?"error":"abort",d,n,o)}},m(d,n)===!1)return d.abort(),g(null,"abort",d,n,o),d;if(n.xhrFields)for(r in n.xhrFields)d[r]=n.xhrFields[r];var T="async"in n?n.async:!0;d.open(n.type,n.url,T,n.username,n.password);for(r in f)y.apply(d,f[r]);return n.timeout>0&&(j=setTimeout(function(){d.onreadystatechange=x,d.abort(),g(null,"timeout",d,n,o)},n.timeout)),d.send(n.data?n.data:null),d},t.get=function(){return t.ajax(j.apply(null,arguments))},t.post=function(){var e=j.apply(null,arguments);return e.type="POST",t.ajax(e)},t.getJSON=function(){var e=j.apply(null,arguments);return e.dataType="json",t.ajax(e)},t.fn.load=function(e,n,i){if(!this.length)return this;var a,r=this,s=e.split(/\s/),u=j(e,n,i),f=u.success;return s.length>1&&(u.url=s[0],a=s[1]),u.success=function(e){r.html(a?t("
    ").html(e.replace(o,"")).find(a):e),f&&f.apply(r,arguments)},t.ajax(u),this};var T=encodeURIComponent;t.param=function(t,e){var n=[];return n.add=function(t,e){this.push(T(t)+"="+T(e))},C(n,t,e),n.join("&").replace(/%20/g,"+")}}(Zepto),function(t){t.fn.serializeArray=function(){var n,e=[];return t([].slice.call(this.get(0).elements)).each(function(){n=t(this);var i=n.attr("type");"fieldset"!=this.nodeName.toLowerCase()&&!this.disabled&&"submit"!=i&&"reset"!=i&&"button"!=i&&("radio"!=i&&"checkbox"!=i||this.checked)&&e.push({name:n.attr("name"),value:n.val()})}),e},t.fn.serialize=function(){var t=[];return this.serializeArray().forEach(function(e){t.push(encodeURIComponent(e.name)+"="+encodeURIComponent(e.value))}),t.join("&")},t.fn.submit=function(e){if(e)this.bind("submit",e);else if(this.length){var n=t.Event("submit");this.eq(0).trigger(n),n.isDefaultPrevented()||this.get(0).submit()}return this}}(Zepto),function(t,e){function b(t){return t.replace(/([a-z])([A-Z])/,"$1-$2").toLowerCase()}function w(t){return i?i+t:t.toLowerCase()}var i,c,l,h,p,d,m,v,g,y,n="",s={Webkit:"webkit",Moz:"",O:"o"},a=window.document,u=a.createElement("div"),f=/^((translate|rotate|scale)(X|Y|Z|3d)?|matrix(3d)?|perspective|skew(X|Y)?)$/i,x={};t.each(s,function(t,r){return u.style[t+"TransitionProperty"]!==e?(n="-"+t.toLowerCase()+"-",i=r,!1):void 0}),c=n+"transform",x[l=n+"transition-property"]=x[h=n+"transition-duration"]=x[d=n+"transition-delay"]=x[p=n+"transition-timing-function"]=x[m=n+"animation-name"]=x[v=n+"animation-duration"]=x[y=n+"animation-delay"]=x[g=n+"animation-timing-function"]="",t.fx={off:i===e&&u.style.transitionProperty===e,speeds:{_default:400,fast:200,slow:600},cssPrefix:n,transitionEnd:w("TransitionEnd"),animationEnd:w("AnimationEnd")},t.fn.animate=function(n,i,r,o,s){return t.isFunction(i)&&(o=i,r=e,i=e),t.isFunction(r)&&(o=r,r=e),t.isPlainObject(i)&&(r=i.easing,o=i.complete,s=i.delay,i=i.duration),i&&(i=("number"==typeof i?i:t.fx.speeds[i]||t.fx.speeds._default)/1e3),s&&(s=parseFloat(s)/1e3),this.anim(n,i,r,o,s)},t.fn.anim=function(n,i,r,o,s){var a,w,T,u={},E="",j=this,C=t.fx.transitionEnd,N=!1;if(i===e&&(i=t.fx.speeds._default/1e3),s===e&&(s=0),t.fx.off&&(i=0),"string"==typeof n)u[m]=n,u[v]=i+"s",u[y]=s+"s",u[g]=r||"linear",C=t.fx.animationEnd;else{w=[];for(a in n)f.test(a)?E+=a+"("+n[a]+") ":(u[a]=n[a],w.push(b(a)));E&&(u[c]=E,w.push(c)),i>0&&"object"==typeof n&&(u[l]=w.join(", "),u[h]=i+"s",u[d]=s+"s",u[p]=r||"linear")}return T=function(e){if("undefined"!=typeof e){if(e.target!==e.currentTarget)return;t(e.target).unbind(C,T)}else t(this).unbind(C,T);N=!0,t(this).css(x),o&&o.call(this)},i>0&&(this.bind(C,T),setTimeout(function(){N||T.call(j)},1e3*i+25)),this.size()&&this.get(0).clientLeft,this.css(u),0>=i&&setTimeout(function(){j.each(function(){T.call(this)})},0),this},u=null}(Zepto),function(t){function r(e){return e=t(e),!(!e.width()&&!e.height())&&"none"!==e.css("display")}function f(t,e){t=t.replace(/=#\]/g,'="#"]');var n,i,r=s.exec(t);if(r&&r[2]in o&&(n=o[r[2]],i=r[3],t=r[1],i)){var a=Number(i);i=isNaN(a)?i.replace(/^["']|["']$/g,""):a}return e(t,n,i)}var e=t.zepto,n=e.qsa,i=e.matches,o=t.expr[":"]={visible:function(){return r(this)?this:void 0},hidden:function(){return r(this)?void 0:this},selected:function(){return this.selected?this:void 0},checked:function(){return this.checked?this:void 0},parent:function(){return this.parentNode},first:function(t){return 0===t?this:void 0},last:function(t,e){return t===e.length-1?this:void 0},eq:function(t,e,n){return t===n?this:void 0},contains:function(e,n,i){return t(this).text().indexOf(i)>-1?this:void 0},has:function(t,n,i){return e.qsa(this,i).length?this:void 0}},s=new RegExp("(.*):(\\w+)(?:\\(([^)]+)\\))?$\\s*"),a=/^\s*>/,u="Zepto"+ +new Date;e.qsa=function(i,r){return f(r,function(o,s,f){try{var c;!o&&s?o="*":a.test(o)&&(c=t(i).addClass(u),o="."+u+" "+o);var l=n(i,o)}catch(h){throw console.error("error performing selector: %o",r),h}finally{c&&c.removeClass(u)}return s?e.uniq(t.map(l,function(t,e){return s.call(t,e,l,f)})):l})},e.matches=function(t,e){return f(e,function(e,n,r){return!(e&&!i(t,e)||n&&n.call(t,null,r)!==t)})}}(Zepto),function(t){t.fn.end=function(){return this.prevObject||t()},t.fn.andSelf=function(){return this.add(this.prevObject||t())},"filter,add,not,eq,first,last,find,closest,parents,parent,children,siblings".split(",").forEach(function(e){var n=t.fn[e];t.fn[e]=function(){var t=n.apply(this,arguments);return t.prevObject=this,t}})}(Zepto),function(t){function s(o,s){var u=o[r],f=u&&e[u];if(void 0===s)return f||a(o);if(f){if(s in f)return f[s];var c=i(s);if(c in f)return f[c]}return n.call(t(o),s)}function a(n,o,s){var a=n[r]||(n[r]=++t.uuid),f=e[a]||(e[a]=u(n));return void 0!==o&&(f[i(o)]=s),f}function u(e){var n={};return t.each(e.attributes||o,function(e,r){0==r.name.indexOf("data-")&&(n[i(r.name.replace("data-",""))]=t.zepto.deserializeValue(r.value))}),n}var e={},n=t.fn.data,i=t.camelCase,r=t.expando="Zepto"+ +new Date,o=[];t.fn.data=function(e,n){return void 0===n?t.isPlainObject(e)?this.each(function(n,i){t.each(e,function(t,e){a(i,t,e)})}):0==this.length?void 0:s(this[0],e):this.each(function(){a(this,e,n)})},t.fn.removeData=function(n){return"string"==typeof n&&(n=n.split(/\s+/)),this.each(function(){var o=this[r],s=o&&e[o];s&&t.each(n||s,function(t){delete s[n?i(this):t]})})},["remove","empty"].forEach(function(e){var n=t.fn[e];t.fn[e]=function(){var t=this.find("*");return"remove"===e&&(t=t.add(this)),t.removeData(),n.call(this)}})}(Zepto); \ No newline at end of file diff --git a/lib/zeptojs/examples/anim.html b/lib/zeptojs/examples/anim.html deleted file mode 100644 index e30193e..0000000 --- a/lib/zeptojs/examples/anim.html +++ /dev/null @@ -1,9 +0,0 @@ -
    HELLO WORLD
    - - - - - - diff --git a/lib/zeptojs/examples/iphone/index.html b/lib/zeptojs/examples/iphone/index.html deleted file mode 100644 index 10a9bc6..0000000 --- a/lib/zeptojs/examples/iphone/index.html +++ /dev/null @@ -1,57 +0,0 @@ - - - - iPhone.Zepto - - - - - - - - - - - - - - diff --git a/lib/zeptojs/examples/iphone/iphone.css b/lib/zeptojs/examples/iphone/iphone.css deleted file mode 100644 index 1690361..0000000 --- a/lib/zeptojs/examples/iphone/iphone.css +++ /dev/null @@ -1,161 +0,0 @@ -* { - margin: 0px; - padding: 0px; -} -.toolbar { - -webkit-box-sizing: border-box; - background: #6D84A2 url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAArCAIAAAA2QHWOAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAEpJREFUeNpNjCEOgEAQA5v9/9eQaAQCd57L0WXTDSmimXZEse1HnNcIIINZYTPVv7Ac4/EWe7OTsC/ec+nDgcj/dpcH7EXt8up4AfRWcOjLIqWFAAAAAElFTkSuQmCC) repeat-x; - border-bottom: 1px solid #2D3642; - height: 45px; - padding: 10px; - position: relative; -} -body { - -webkit-perspective: 800; - -webkit-text-size-adjust: none; - -webkit-transform-style: preserve-3d; - -webkit-user-select: none; - font-family: Helvetica; - overflow-x: hidden; - height: 100%; - width: 100%; -} - -body > section { - background: #C5CCD3 url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAcAAAABCAIAAACdaSOZAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAABdJREFUeNpiPHrmCgMC/GNjYwNSAAEGADdNA3dnzPlQAAAAAElFTkSuQmCC); - display: block; - left: 0px; - position: absolute; - width: 100%; - -webkit-transform: translate3d(100%,0%,0%); - opacity: 0; - -webkit-transition: all 0.25s ease-in-out; - -webkit-transform-style: preserve-3d; - z-index: -10; -} - -.reverse { - -webkit-transform: translate3d(-100%, 0%, 0%); - opacity: 0; -} - -.current { - -webkit-transform: translate3d(0%,0%, 0%); - opacity: 1; - z-index: 1; -} -h1, h2 { - color: #4C566C; - font: normal normal bold 18px/normal Helvetica; - margin: 10px 20px 6px; - text-shadow: rgba(255, 255, 255, 0.19) -} -body.landscape .toolbar > h1 { - margin-left: -125px; - width: 250px; -} - -.toolbar > h1 { - color: white; - font-size: 20px; - font-weight: bold; - height: 40px; - left: 50%; - line-height: 1em; - margin: 1px 0px 0px -75px; - overflow: hidden; - position: absolute; - text-align: center; - text-overflow: ellipsis; - text-shadow: rgba(0, 0, 0, 0.398438) 0px -1px 0px; - top: 10px; - white-space: nowrap; - width: 150px; -} - -ul { - background: white; - border: 1px solid #B4B4B4; - border-bottom-left-radius: 8px 8px; - border-bottom-right-radius: 8px 8px; - border-top-left-radius: 8px 8px; - border-top-right-radius: 8px 8px; - color: black; - font: normal normal bold 17px/normal Helvetica; - margin: 15px 10px 17px; - padding: 0px; -} - -ul li { - color: black; - font-size: 14px; - border-top: 1px solid #B4B4B4; - color: #666; - list-style-type: none; - padding: 10px; -} - -li:first-child, li:first-child a { - border-top: 0px; - border-top-left-radius: 8px 8px; - border-top-right-radius: 8px 8px; -} - -ul li.arrow { - background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABkAAAAUCAYAAAB4d5a9AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAKVJREFUeNpi/P//PwOtARMDHcDwsYQFRJSXl8P4dVC6CZvizs5O8i1BsqARid9Ei+BiQ2KDLKumhSU1QNyKxG+hlkXoEQ+yqAPNogpapK5KNIvaKbUIVxKeAsTvkPg5QCxETUukgfgAkqFPgdgBzVKKLIFZoIJmwR1qBRdNLEC2BJQpV9LCAmRL/gBxAtRwqlqAXqzcgRrOQE0LQIBxtNIiBQAEGAA7xCa2yF9zEgAAAABJRU5ErkJggg==); - background-position: 100% 50%; - background-repeat: no-repeat; -} - -body > .current { - display: block !important; -} - -body.landscape > * { - min-height: 320px; -} - - -ul li a, li.img a + a { - color: black; - display: block; - margin: -10px; - overflow: hidden; - padding: 12px 10px; - text-decoration: none; - text-overflow: ellipsis; - white-space: nowrap; -} - - -.button, .back, .cancel, .add { --webkit-border-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAeCAIAAACqmwlGAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAatJREFUeNqVlMtKw0AUhqfJSRpTk5Za1FAvxS6sgrVeFrpQdOcT+IpuBVHcuVBQpCDYjeAdkSpavDTGNJkz43FpFZz8DISZ+b75J5tJbWwfMsZuby7rh/vN5v1H+539TMZxPa84v7g0WirTFISQR/t7jdOTcqVaGp+ze50uIfDbL62H3a3NqerMwtIqXF9dnF+dL6+t9/S6hmFqut4luHns80aKpcrxwY43PKK7+f6J2ZVcYTCl6ZIxKuwatEhbpmU72UKjfgCakXFz/TwW7L8QlgIbTNtBwVAgU0g644IGZoycqYVgQGRRLBQFggEpHJUFBI4iUhYIBhSSPooCwUB0zEWiBsERlRsECJSIUlEgOHmDH3TM909FgWBgqe8oCgRrLGGADlcvIDB5A2nfQ7kD6D5J/jn5lZILBoAUQgWVUgDoWi5r8zhUEXgU5nOOVp0sB+0W+f8WEDY9MabpYNUqQ29Pd1Hoi79eA1qkLQIIY5CGIOwUvYHBQr5xdvn4/BSGnS7BstIDhexUbVo3jNarD1Ky5xfftszF+WqPZcKvp5IjfoYRoYHv0/QLHvXjAb8xkEMAAAAASUVORK5CYII=) 0 5 0 5 stretch stretch; -background: none; -border-width: 0px 5px; -color: white; -font-family: inherit; -font-size: 12px; -font-weight: bold; -height: 30px; -line-height: 30px; -margin: 0px; -overflow: ; -padding: 0px 3px; -position: absolute; -right: 6px; -text-decoration: none; -text-overflow: ellipsis; -text-shadow: rgba(0, 0, 0, 0.496094) 0px -1px 0px; -top: 8px; -white-space: nowrap; -width: auto; -} - -.back { - -webkit-border-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACsAAAAeCAIAAAA6iHCJAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAArFJREFUeNrF0mtPE2EQBeB5t9vSRqEUKiAFkasggmC5x3CRECHx8sH/qMHEoKkiMUQTNJIIaAjeiFGUcEsotN22u9vtOzMKogYL39rlyfkBk3NG3HsyC8dLJhOzM8+/fvkcjexAtghRXVN/dXCkvOIcAKhEDMdY+7ESejgeqKpv7x3J9/ogS5hoc33l0YPxju6+YFefSkRwlI311cnQRM/gbd+ZUpfb43CokD2nCv2lFbVvZib9JaUqMUEGTYtNPZ7oHLpZXBJQFIUYSCJkj3A4830lrd3Di2/nVcxYwTSMift3m4LXCovKCYGQIDe8vrJveNQfTE+Fys9f8pdVSSTILeFyF/z/B8uflnSLG+qakRlRQo45XO5DHejJxOtXLzsG7yA7ME2Qe0hw6A+mn4ZqLvY4XR6UCLZAxH8rfFx6Z6BaXVJlSQS7SKSDC+JabGFurrnvBvJ+NXZBYpX4oP9AQ5eietKSAMDuDt4vLkhHfr6/XCKCvZBIjezuLMzPN/XcIhIADPYiZPXFs8lAQ7dwOA8KsL8Dr7/CoDzSDDgJCT2ljI0OOzBGKMVJACGUXU2/3h/Uo5vMDCdBQSRLcn9nox7bEgLsDoDCDKYli4p89ZXFZjJ6Ah3wvlhcb2mqPa1a0jIBhJ1RiPl3wpH4QG+bTGwDo51DKPwHMccS5mBvSzyyCcB2rgB/k5aoqK72xgo9FrbxgsMSulkZOBvwu1O6BjnGhO48p8IZfj1EsPWCR+jSMiCX0pbh9xXsrZCZrW1toOcy6mFMpyA3mNnUwi2NtQoxZwaZwzF9bKhTpHaN+C7KNGQPobTMhBZe7Wyts1iox729RNyOJkeHOj4sf19Z3YgmsraI251X6ve2BYMEIqIlVebjd0rj2la0rrrySkuDU1UhSySiYVrbkbiZ2qv2J5+53J2yzo3SAAAAAElFTkSuQmCC) 0 8 0 14 stretch stretch; -border-width: 0px 8px 0px 14px; -left: 6px; -max-width: 55px; -padding: 0px; -right: auto; -} diff --git a/lib/zeptojs/examples/load_jquery_on_ie.html b/lib/zeptojs/examples/load_jquery_on_ie.html deleted file mode 100644 index 8c51d74..0000000 --- a/lib/zeptojs/examples/load_jquery_on_ie.html +++ /dev/null @@ -1,18 +0,0 @@ - - - - Load jQuery if Zepto is not supported - - -

    Load jQuery if Zepto is not supported

    - - - - diff --git a/lib/zeptojs/examples/snow/index.html b/lib/zeptojs/examples/snow/index.html deleted file mode 100644 index 8941004..0000000 --- a/lib/zeptojs/examples/snow/index.html +++ /dev/null @@ -1,51 +0,0 @@ - - - - Let it snow with Zepto.js - - - - - - - - - - - - - - - - diff --git a/lib/zeptojs/examples/touch_events.html b/lib/zeptojs/examples/touch_events.html deleted file mode 100644 index 3a5eadf..0000000 --- a/lib/zeptojs/examples/touch_events.html +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - -
      -
    • List item 1 DELETE
    • -
    • List item 2 DELETE
    • -
    • List item 3 DELETE
    • -
    • List item 4 DELETE
    • -
    - - diff --git a/lib/zeptojs/make b/lib/zeptojs/make deleted file mode 100755 index d9254ee..0000000 --- a/lib/zeptojs/make +++ /dev/null @@ -1,98 +0,0 @@ -#!/usr/bin/env coffee -require 'shelljs/make' -fs = require 'fs' - -version = '1.1.3' -zepto_js = 'dist/zepto.js' -zepto_min = 'dist/zepto.min.js' -zepto_gz = 'dist/zepto.min.gz' - -port = 3999 -root = __dirname + '/' - -target.all = -> - target[zepto_js]() - target.test() - -## TASKS ## - -target.test = -> - test_app = require './test/server' - server = test_app.listen port - exec "phantomjs --disk-cache=true test/runner.coffee 'http://localhost:#{port}/'", (code) -> - server.close -> exit(code) - -target[zepto_js] = -> - target.build() unless test('-e', zepto_js) - -target[zepto_min] = -> - target.minify() if stale(zepto_min, zepto_js) - -target[zepto_gz] = -> - target.compress() if stale(zepto_gz, zepto_min) - -target.dist = -> - target.build() - target.minify() - target.compress() - -target.build = -> - cd __dirname - mkdir '-p', 'dist' - modules = (env['MODULES'] || 'zepto event ajax form ie').split(' ') - module_files = ( "src/#{module}.js" for module in modules ) - intro = "/* Zepto #{describe_version()} - #{modules.join(' ')} - zeptojs.com/license */\n" - dist = intro + cat(module_files).replace(/^\/[\/*].*$/mg, '').replace(/\n{3,}/g, "\n\n") - dist.to(zepto_js) - report_size(zepto_js) - -target.minify = -> - target.build() unless test('-e', zepto_js) - zepto_code = cat(zepto_js) - intro = zepto_code.slice(0, zepto_code.indexOf("\n") + 1) - (intro + minify(zepto_code)).to(zepto_min) - report_size(zepto_min) - -target.compress = -> - gzip = require('zlib').createGzip() - inp = fs.createReadStream(zepto_min) - out = fs.createWriteStream(zepto_gz) - inp.pipe(gzip).pipe(out) - out.on 'close', -> - report_size(zepto_gz) - factor = fsize(zepto_js) / fsize(zepto_gz) - echo "compression factor: #{format_number(factor)}" - -## HELPERS ## - -stale = (file, source) -> - target[source]() - !test('-e', file) || mtime(file) < mtime(source) - -mtime = (file) -> - fs.statSync(file).mtime.getTime() - -fsize = (file) -> - fs.statSync(file).size - -format_number = (size, precision = 1) -> - factor = Math.pow(10, precision) - decimal = Math.round(size * factor) % factor - parseInt(size) + "." + decimal - -report_size = (file) -> - echo "#{file}: #{format_number(fsize(file) / 1024)} KiB" - -describe_version = -> - desc = exec "git --git-dir='#{root + '.git'}' describe --tags HEAD", silent: true - if desc.code is 0 then desc.output.replace(/\s+$/, '') else version - -minify = (source_code) -> - uglify = require('uglify-js') - compressor = uglify.Compressor() - ast = uglify.parse(source_code) - ast.figure_out_scope() - ast.compute_char_frequency(); - ast.mangle_names(); - ast = ast.transform(compressor) - return ast.print_to_string() diff --git a/lib/zeptojs/package.json b/lib/zeptojs/package.json deleted file mode 100644 index c89f50e..0000000 --- a/lib/zeptojs/package.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "name": "zepto" - , "version": "1.1.3" - , "homepage": "http://zeptojs.com" - , "scripts": { - "test": "coffee make test" - , "dist": "coffee make dist" - , "start": "coffee test/server.coffee" - } - , "repository": { - "type": "git" - , "url": "https://github.com/madrobby/zepto.git" - } - , "licenses": [ - { - "type": "MIT" - , "url": "http://zeptojs.com/license/" - } - ] - , "devDependencies": { - "uglify-js": "2.4.x" - , "express": "3.1.x" - , "coffee-script": "1.5.x" - , "shelljs": "0.1.x" - } -} diff --git a/lib/zeptojs/script/bootstrap b/lib/zeptojs/script/bootstrap deleted file mode 100755 index bd84bb1..0000000 --- a/lib/zeptojs/script/bootstrap +++ /dev/null @@ -1,10 +0,0 @@ -#!/usr/bin/env bash -set -e - -npm install - -if phantom_version="$(phantomjs --version)"; then - echo "phantomjs ${phantom_version}" -else - echo "You should install PhantomJS for \`script/test' to work." >&2 -fi diff --git a/lib/zeptojs/script/guard b/lib/zeptojs/script/guard deleted file mode 100755 index 93fe00e..0000000 --- a/lib/zeptojs/script/guard +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/sh -if [ -z "$BUNDLE_GEMFILE" ]; then - export BUNDLE_GEMFILE=shutup -fi - -exec guard --no-notify "$@" diff --git a/lib/zeptojs/script/test b/lib/zeptojs/script/test deleted file mode 100755 index 2d76bc5..0000000 --- a/lib/zeptojs/script/test +++ /dev/null @@ -1,18 +0,0 @@ -#!/usr/bin/env bash -port=3999 - -export PATH=node_modules/.bin:"$PATH" - -coffee test/server.coffee $port & -pid=$! - -terminate_test_server() { - kill $pid -} -trap terminate_test_server EXIT - -phantomjs --disk-cache=true \ - test/runner.coffee "http://localhost:${port}/" "$@" \ - 2> >(grep -v "CoreText performance note" >&2) - -exit $? diff --git a/lib/zeptojs/src/ajax.js b/lib/zeptojs/src/ajax.js deleted file mode 100644 index 1402c5a..0000000 --- a/lib/zeptojs/src/ajax.js +++ /dev/null @@ -1,344 +0,0 @@ -// Zepto.js -// (c) 2010-2014 Thomas Fuchs -// Zepto.js may be freely distributed under the MIT license. - -;(function($){ - var jsonpID = 0, - document = window.document, - key, - name, - rscript = /)<[^<]*)*<\/script>/gi, - scriptTypeRE = /^(?:text|application)\/javascript/i, - xmlTypeRE = /^(?:text|application)\/xml/i, - jsonType = 'application/json', - htmlType = 'text/html', - blankRE = /^\s*$/ - - // trigger a custom event and return false if it was cancelled - function triggerAndReturn(context, eventName, data) { - var event = $.Event(eventName) - $(context).trigger(event, data) - return !event.isDefaultPrevented() - } - - // trigger an Ajax "global" event - function triggerGlobal(settings, context, eventName, data) { - if (settings.global) return triggerAndReturn(context || document, eventName, data) - } - - // Number of active Ajax requests - $.active = 0 - - function ajaxStart(settings) { - if (settings.global && $.active++ === 0) triggerGlobal(settings, null, 'ajaxStart') - } - function ajaxStop(settings) { - if (settings.global && !(--$.active)) triggerGlobal(settings, null, 'ajaxStop') - } - - // triggers an extra global event "ajaxBeforeSend" that's like "ajaxSend" but cancelable - function ajaxBeforeSend(xhr, settings) { - var context = settings.context - if (settings.beforeSend.call(context, xhr, settings) === false || - triggerGlobal(settings, context, 'ajaxBeforeSend', [xhr, settings]) === false) - return false - - triggerGlobal(settings, context, 'ajaxSend', [xhr, settings]) - } - function ajaxSuccess(data, xhr, settings, deferred) { - var context = settings.context, status = 'success' - settings.success.call(context, data, status, xhr) - if (deferred) deferred.resolveWith(context, [data, status, xhr]) - triggerGlobal(settings, context, 'ajaxSuccess', [xhr, settings, data]) - ajaxComplete(status, xhr, settings) - } - // type: "timeout", "error", "abort", "parsererror" - function ajaxError(error, type, xhr, settings, deferred) { - var context = settings.context - settings.error.call(context, xhr, type, error) - if (deferred) deferred.rejectWith(context, [xhr, type, error]) - triggerGlobal(settings, context, 'ajaxError', [xhr, settings, error || type]) - ajaxComplete(type, xhr, settings) - } - // status: "success", "notmodified", "error", "timeout", "abort", "parsererror" - function ajaxComplete(status, xhr, settings) { - var context = settings.context - settings.complete.call(context, xhr, status) - triggerGlobal(settings, context, 'ajaxComplete', [xhr, settings]) - ajaxStop(settings) - } - - // Empty function, used as default callback - function empty() {} - - $.ajaxJSONP = function(options, deferred){ - if (!('type' in options)) return $.ajax(options) - - var _callbackName = options.jsonpCallback, - callbackName = ($.isFunction(_callbackName) ? - _callbackName() : _callbackName) || ('jsonp' + (++jsonpID)), - script = document.createElement('script'), - originalCallback = window[callbackName], - responseData, - abort = function(errorType) { - $(script).triggerHandler('error', errorType || 'abort') - }, - xhr = { abort: abort }, abortTimeout - - if (deferred) deferred.promise(xhr) - - $(script).on('load error', function(e, errorType){ - clearTimeout(abortTimeout) - $(script).off().remove() - - if (e.type == 'error' || !responseData) { - ajaxError(null, errorType || 'error', xhr, options, deferred) - } else { - ajaxSuccess(responseData[0], xhr, options, deferred) - } - - window[callbackName] = originalCallback - if (responseData && $.isFunction(originalCallback)) - originalCallback(responseData[0]) - - originalCallback = responseData = undefined - }) - - if (ajaxBeforeSend(xhr, options) === false) { - abort('abort') - return xhr - } - - window[callbackName] = function(){ - responseData = arguments - } - - script.src = options.url.replace(/\?(.+)=\?/, '?$1=' + callbackName) - document.head.appendChild(script) - - if (options.timeout > 0) abortTimeout = setTimeout(function(){ - abort('timeout') - }, options.timeout) - - return xhr - } - - $.ajaxSettings = { - // Default type of request - type: 'GET', - // Callback that is executed before request - beforeSend: empty, - // Callback that is executed if the request succeeds - success: empty, - // Callback that is executed the the server drops error - error: empty, - // Callback that is executed on request complete (both: error and success) - complete: empty, - // The context for the callbacks - context: null, - // Whether to trigger "global" Ajax events - global: true, - // Transport - xhr: function () { - return new window.XMLHttpRequest() - }, - // MIME types mapping - // IIS returns Javascript as "application/x-javascript" - accepts: { - script: 'text/javascript, application/javascript, application/x-javascript', - json: jsonType, - xml: 'application/xml, text/xml', - html: htmlType, - text: 'text/plain' - }, - // Whether the request is to another domain - crossDomain: false, - // Default timeout - timeout: 0, - // Whether data should be serialized to string - processData: true, - // Whether the browser should be allowed to cache GET responses - cache: true - } - - function mimeToDataType(mime) { - if (mime) mime = mime.split(';', 2)[0] - return mime && ( mime == htmlType ? 'html' : - mime == jsonType ? 'json' : - scriptTypeRE.test(mime) ? 'script' : - xmlTypeRE.test(mime) && 'xml' ) || 'text' - } - - function appendQuery(url, query) { - if (query == '') return url - return (url + '&' + query).replace(/[&?]{1,2}/, '?') - } - - // serialize payload and append it to the URL for GET requests - function serializeData(options) { - if (options.processData && options.data && $.type(options.data) != "string") - options.data = $.param(options.data, options.traditional) - if (options.data && (!options.type || options.type.toUpperCase() == 'GET')) - options.url = appendQuery(options.url, options.data), options.data = undefined - } - - $.ajax = function(options){ - var settings = $.extend({}, options || {}), - deferred = $.Deferred && $.Deferred() - for (key in $.ajaxSettings) if (settings[key] === undefined) settings[key] = $.ajaxSettings[key] - - ajaxStart(settings) - - if (!settings.crossDomain) settings.crossDomain = /^([\w-]+:)?\/\/([^\/]+)/.test(settings.url) && - RegExp.$2 != window.location.host - - if (!settings.url) settings.url = window.location.toString() - serializeData(settings) - if (settings.cache === false) settings.url = appendQuery(settings.url, '_=' + Date.now()) - - var dataType = settings.dataType, hasPlaceholder = /\?.+=\?/.test(settings.url) - if (dataType == 'jsonp' || hasPlaceholder) { - if (!hasPlaceholder) - settings.url = appendQuery(settings.url, - settings.jsonp ? (settings.jsonp + '=?') : settings.jsonp === false ? '' : 'callback=?') - return $.ajaxJSONP(settings, deferred) - } - - var mime = settings.accepts[dataType], - headers = { }, - setHeader = function(name, value) { headers[name.toLowerCase()] = [name, value] }, - protocol = /^([\w-]+:)\/\//.test(settings.url) ? RegExp.$1 : window.location.protocol, - xhr = settings.xhr(), - nativeSetHeader = xhr.setRequestHeader, - abortTimeout - - if (deferred) deferred.promise(xhr) - - if (!settings.crossDomain) setHeader('X-Requested-With', 'XMLHttpRequest') - setHeader('Accept', mime || '*/*') - if (mime = settings.mimeType || mime) { - if (mime.indexOf(',') > -1) mime = mime.split(',', 2)[0] - xhr.overrideMimeType && xhr.overrideMimeType(mime) - } - if (settings.contentType || (settings.contentType !== false && settings.data && settings.type.toUpperCase() != 'GET')) - setHeader('Content-Type', settings.contentType || 'application/x-www-form-urlencoded') - - if (settings.headers) for (name in settings.headers) setHeader(name, settings.headers[name]) - xhr.setRequestHeader = setHeader - - xhr.onreadystatechange = function(){ - if (xhr.readyState == 4) { - xhr.onreadystatechange = empty - clearTimeout(abortTimeout) - var result, error = false - if ((xhr.status >= 200 && xhr.status < 300) || xhr.status == 304 || (xhr.status == 0 && protocol == 'file:')) { - dataType = dataType || mimeToDataType(settings.mimeType || xhr.getResponseHeader('content-type')) - result = xhr.responseText - - try { - // http://perfectionkills.com/global-eval-what-are-the-options/ - if (dataType == 'script') (1,eval)(result) - else if (dataType == 'xml') result = xhr.responseXML - else if (dataType == 'json') result = blankRE.test(result) ? null : $.parseJSON(result) - } catch (e) { error = e } - - if (error) ajaxError(error, 'parsererror', xhr, settings, deferred) - else ajaxSuccess(result, xhr, settings, deferred) - } else { - ajaxError(xhr.statusText || null, xhr.status ? 'error' : 'abort', xhr, settings, deferred) - } - } - } - - if (ajaxBeforeSend(xhr, settings) === false) { - xhr.abort() - ajaxError(null, 'abort', xhr, settings, deferred) - return xhr - } - - if (settings.xhrFields) for (name in settings.xhrFields) xhr[name] = settings.xhrFields[name] - - var async = 'async' in settings ? settings.async : true - xhr.open(settings.type, settings.url, async, settings.username, settings.password) - - for (name in headers) nativeSetHeader.apply(xhr, headers[name]) - - if (settings.timeout > 0) abortTimeout = setTimeout(function(){ - xhr.onreadystatechange = empty - xhr.abort() - ajaxError(null, 'timeout', xhr, settings, deferred) - }, settings.timeout) - - // avoid sending empty string (#319) - xhr.send(settings.data ? settings.data : null) - return xhr - } - - // handle optional data/success arguments - function parseArguments(url, data, success, dataType) { - if ($.isFunction(data)) dataType = success, success = data, data = undefined - if (!$.isFunction(success)) dataType = success, success = undefined - return { - url: url - , data: data - , success: success - , dataType: dataType - } - } - - $.get = function(/* url, data, success, dataType */){ - return $.ajax(parseArguments.apply(null, arguments)) - } - - $.post = function(/* url, data, success, dataType */){ - var options = parseArguments.apply(null, arguments) - options.type = 'POST' - return $.ajax(options) - } - - $.getJSON = function(/* url, data, success */){ - var options = parseArguments.apply(null, arguments) - options.dataType = 'json' - return $.ajax(options) - } - - $.fn.load = function(url, data, success){ - if (!this.length) return this - var self = this, parts = url.split(/\s/), selector, - options = parseArguments(url, data, success), - callback = options.success - if (parts.length > 1) options.url = parts[0], selector = parts[1] - options.success = function(response){ - self.html(selector ? - $('
    ').html(response.replace(rscript, "")).find(selector) - : response) - callback && callback.apply(self, arguments) - } - $.ajax(options) - return this - } - - var escape = encodeURIComponent - - function serialize(params, obj, traditional, scope){ - var type, array = $.isArray(obj), hash = $.isPlainObject(obj) - $.each(obj, function(key, value) { - type = $.type(value) - if (scope) key = traditional ? scope : - scope + '[' + (hash || type == 'object' || type == 'array' ? key : '') + ']' - // handle data in serializeArray() format - if (!scope && array) params.add(value.name, value.value) - // recurse into nested objects - else if (type == "array" || (!traditional && type == "object")) - serialize(params, value, traditional, key) - else params.add(key, value) - }) - } - - $.param = function(obj, traditional){ - var params = [] - params.add = function(k, v){ this.push(escape(k) + '=' + escape(v)) } - serialize(params, obj, traditional) - return params.join('&').replace(/%20/g, '+') - } -})(Zepto) diff --git a/lib/zeptojs/src/assets.js b/lib/zeptojs/src/assets.js deleted file mode 100644 index 0cfdb4e..0000000 --- a/lib/zeptojs/src/assets.js +++ /dev/null @@ -1,21 +0,0 @@ -// Zepto.js -// (c) 2010-2014 Thomas Fuchs -// Zepto.js may be freely distributed under the MIT license. - -;(function($){ - var cache = [], timeout - - $.fn.remove = function(){ - return this.each(function(){ - if(this.parentNode){ - if(this.tagName === 'IMG'){ - cache.push(this) - this.src = 'data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs=' - if (timeout) clearTimeout(timeout) - timeout = setTimeout(function(){ cache = [] }, 60000) - } - this.parentNode.removeChild(this) - } - }) - } -})(Zepto) diff --git a/lib/zeptojs/src/callbacks.js b/lib/zeptojs/src/callbacks.js deleted file mode 100644 index 79cddf8..0000000 --- a/lib/zeptojs/src/callbacks.js +++ /dev/null @@ -1,122 +0,0 @@ -// Zepto.js -// (c) 2010-2014 Thomas Fuchs -// Zepto.js may be freely distributed under the MIT license. - -;(function($){ - // Create a collection of callbacks to be fired in a sequence, with configurable behaviour - // Option flags: - // - once: Callbacks fired at most one time. - // - memory: Remember the most recent context and arguments - // - stopOnFalse: Cease iterating over callback list - // - unique: Permit adding at most one instance of the same callback - $.Callbacks = function(options) { - options = $.extend({}, options) - - var memory, // Last fire value (for non-forgettable lists) - fired, // Flag to know if list was already fired - firing, // Flag to know if list is currently firing - firingStart, // First callback to fire (used internally by add and fireWith) - firingLength, // End of the loop when firing - firingIndex, // Index of currently firing callback (modified by remove if needed) - list = [], // Actual callback list - stack = !options.once && [], // Stack of fire calls for repeatable lists - fire = function(data) { - memory = options.memory && data - fired = true - firingIndex = firingStart || 0 - firingStart = 0 - firingLength = list.length - firing = true - for ( ; list && firingIndex < firingLength ; ++firingIndex ) { - if (list[firingIndex].apply(data[0], data[1]) === false && options.stopOnFalse) { - memory = false - break - } - } - firing = false - if (list) { - if (stack) stack.length && fire(stack.shift()) - else if (memory) list.length = 0 - else Callbacks.disable() - } - }, - - Callbacks = { - add: function() { - if (list) { - var start = list.length, - add = function(args) { - $.each(args, function(_, arg){ - if (typeof arg === "function") { - if (!options.unique || !Callbacks.has(arg)) list.push(arg) - } - else if (arg && arg.length && typeof arg !== 'string') add(arg) - }) - } - add(arguments) - if (firing) firingLength = list.length - else if (memory) { - firingStart = start - fire(memory) - } - } - return this - }, - remove: function() { - if (list) { - $.each(arguments, function(_, arg){ - var index - while ((index = $.inArray(arg, list, index)) > -1) { - list.splice(index, 1) - // Handle firing indexes - if (firing) { - if (index <= firingLength) --firingLength - if (index <= firingIndex) --firingIndex - } - } - }) - } - return this - }, - has: function(fn) { - return !!(list && (fn ? $.inArray(fn, list) > -1 : list.length)) - }, - empty: function() { - firingLength = list.length = 0 - return this - }, - disable: function() { - list = stack = memory = undefined - return this - }, - disabled: function() { - return !list - }, - lock: function() { - stack = undefined; - if (!memory) Callbacks.disable() - return this - }, - locked: function() { - return !stack - }, - fireWith: function(context, args) { - if (list && (!fired || stack)) { - args = args || [] - args = [context, args.slice ? args.slice() : args] - if (firing) stack.push(args) - else fire(args) - } - return this - }, - fire: function() { - return Callbacks.fireWith(this, arguments) - }, - fired: function() { - return !!fired - } - } - - return Callbacks - } -})(Zepto) diff --git a/lib/zeptojs/src/data.js b/lib/zeptojs/src/data.js deleted file mode 100644 index b2049da..0000000 --- a/lib/zeptojs/src/data.js +++ /dev/null @@ -1,80 +0,0 @@ -// Zepto.js -// (c) 2010-2014 Thomas Fuchs -// Zepto.js may be freely distributed under the MIT license. - -// The following code is heavily inspired by jQuery's $.fn.data() - -;(function($){ - var data = {}, dataAttr = $.fn.data, camelize = $.camelCase, - exp = $.expando = 'Zepto' + (+new Date()), emptyArray = [] - - // Get value from node: - // 1. first try key as given, - // 2. then try camelized key, - // 3. fall back to reading "data-*" attribute. - function getData(node, name) { - var id = node[exp], store = id && data[id] - if (name === undefined) return store || setData(node) - else { - if (store) { - if (name in store) return store[name] - var camelName = camelize(name) - if (camelName in store) return store[camelName] - } - return dataAttr.call($(node), name) - } - } - - // Store value under camelized key on node - function setData(node, name, value) { - var id = node[exp] || (node[exp] = ++$.uuid), - store = data[id] || (data[id] = attributeData(node)) - if (name !== undefined) store[camelize(name)] = value - return store - } - - // Read all "data-*" attributes from a node - function attributeData(node) { - var store = {} - $.each(node.attributes || emptyArray, function(i, attr){ - if (attr.name.indexOf('data-') == 0) - store[camelize(attr.name.replace('data-', ''))] = - $.zepto.deserializeValue(attr.value) - }) - return store - } - - $.fn.data = function(name, value) { - return value === undefined ? - // set multiple values via object - $.isPlainObject(name) ? - this.each(function(i, node){ - $.each(name, function(key, value){ setData(node, key, value) }) - }) : - // get value from first element - this.length == 0 ? undefined : getData(this[0], name) : - // set value on all elements - this.each(function(){ setData(this, name, value) }) - } - - $.fn.removeData = function(names) { - if (typeof names == 'string') names = names.split(/\s+/) - return this.each(function(){ - var id = this[exp], store = id && data[id] - if (store) $.each(names || store, function(key){ - delete store[names ? camelize(this) : key] - }) - }) - } - - // Generate extended `remove` and `empty` functions - ;['remove', 'empty'].forEach(function(methodName){ - var origFn = $.fn[methodName] - $.fn[methodName] = function() { - var elements = this.find('*') - if (methodName === 'remove') elements = elements.add(this) - elements.removeData() - return origFn.call(this) - } - }) -})(Zepto) diff --git a/lib/zeptojs/src/deferred.js b/lib/zeptojs/src/deferred.js deleted file mode 100644 index a8e6311..0000000 --- a/lib/zeptojs/src/deferred.js +++ /dev/null @@ -1,118 +0,0 @@ -// Zepto.js -// (c) 2010-2014 Thomas Fuchs -// Zepto.js may be freely distributed under the MIT license. -// -// Some code (c) 2005, 2013 jQuery Foundation, Inc. and other contributors - -;(function($){ - var slice = Array.prototype.slice - - function Deferred(func) { - var tuples = [ - // action, add listener, listener list, final state - [ "resolve", "done", $.Callbacks({once:1, memory:1}), "resolved" ], - [ "reject", "fail", $.Callbacks({once:1, memory:1}), "rejected" ], - [ "notify", "progress", $.Callbacks({memory:1}) ] - ], - state = "pending", - promise = { - state: function() { - return state - }, - always: function() { - deferred.done(arguments).fail(arguments) - return this - }, - then: function(/* fnDone [, fnFailed [, fnProgress]] */) { - var fns = arguments - return Deferred(function(defer){ - $.each(tuples, function(i, tuple){ - var fn = $.isFunction(fns[i]) && fns[i] - deferred[tuple[1]](function(){ - var returned = fn && fn.apply(this, arguments) - if (returned && $.isFunction(returned.promise)) { - returned.promise() - .done(defer.resolve) - .fail(defer.reject) - .progress(defer.notify) - } else { - var context = this === promise ? defer.promise() : this, - values = fn ? [returned] : arguments - defer[tuple[0] + "With"](context, values) - } - }) - }) - fns = null - }).promise() - }, - - promise: function(obj) { - return obj != null ? $.extend( obj, promise ) : promise - } - }, - deferred = {} - - $.each(tuples, function(i, tuple){ - var list = tuple[2], - stateString = tuple[3] - - promise[tuple[1]] = list.add - - if (stateString) { - list.add(function(){ - state = stateString - }, tuples[i^1][2].disable, tuples[2][2].lock) - } - - deferred[tuple[0]] = function(){ - deferred[tuple[0] + "With"](this === deferred ? promise : this, arguments) - return this - } - deferred[tuple[0] + "With"] = list.fireWith - }) - - promise.promise(deferred) - if (func) func.call(deferred, deferred) - return deferred - } - - $.when = function(sub) { - var resolveValues = slice.call(arguments), - len = resolveValues.length, - i = 0, - remain = len !== 1 || (sub && $.isFunction(sub.promise)) ? len : 0, - deferred = remain === 1 ? sub : Deferred(), - progressValues, progressContexts, resolveContexts, - updateFn = function(i, ctx, val){ - return function(value){ - ctx[i] = this - val[i] = arguments.length > 1 ? slice.call(arguments) : value - if (val === progressValues) { - deferred.notifyWith(ctx, val) - } else if (!(--remain)) { - deferred.resolveWith(ctx, val) - } - } - } - - if (len > 1) { - progressValues = new Array(len) - progressContexts = new Array(len) - resolveContexts = new Array(len) - for ( ; i < len; ++i ) { - if (resolveValues[i] && $.isFunction(resolveValues[i].promise)) { - resolveValues[i].promise() - .done(updateFn(i, resolveContexts, resolveValues)) - .fail(deferred.reject) - .progress(updateFn(i, progressContexts, progressValues)) - } else { - --remain - } - } - } - if (!remain) deferred.resolveWith(resolveContexts, resolveValues) - return deferred.promise() - } - - $.Deferred = Deferred -})(Zepto) diff --git a/lib/zeptojs/src/detect.js b/lib/zeptojs/src/detect.js deleted file mode 100644 index dc8b2a3..0000000 --- a/lib/zeptojs/src/detect.js +++ /dev/null @@ -1,65 +0,0 @@ -// Zepto.js -// (c) 2010-2014 Thomas Fuchs -// Zepto.js may be freely distributed under the MIT license. - -;(function($){ - function detect(ua){ - var os = this.os = {}, browser = this.browser = {}, - webkit = ua.match(/Web[kK]it[\/]{0,1}([\d.]+)/), - android = ua.match(/(Android);?[\s\/]+([\d.]+)?/), - ipad = ua.match(/(iPad).*OS\s([\d_]+)/), - ipod = ua.match(/(iPod)(.*OS\s([\d_]+))?/), - iphone = !ipad && ua.match(/(iPhone\sOS)\s([\d_]+)/), - webos = ua.match(/(webOS|hpwOS)[\s\/]([\d.]+)/), - touchpad = webos && ua.match(/TouchPad/), - kindle = ua.match(/Kindle\/([\d.]+)/), - silk = ua.match(/Silk\/([\d._]+)/), - blackberry = ua.match(/(BlackBerry).*Version\/([\d.]+)/), - bb10 = ua.match(/(BB10).*Version\/([\d.]+)/), - rimtabletos = ua.match(/(RIM\sTablet\sOS)\s([\d.]+)/), - playbook = ua.match(/PlayBook/), - chrome = ua.match(/Chrome\/([\d.]+)/) || ua.match(/CriOS\/([\d.]+)/), - firefox = ua.match(/Firefox\/([\d.]+)/), - ie = ua.match(/MSIE\s([\d.]+)/), - safari = webkit && ua.match(/Mobile\//) && !chrome, - webview = ua.match(/(iPhone|iPod|iPad).*AppleWebKit(?!.*Safari)/) && !chrome - - // Todo: clean this up with a better OS/browser seperation: - // - discern (more) between multiple browsers on android - // - decide if kindle fire in silk mode is android or not - // - Firefox on Android doesn't specify the Android version - // - possibly devide in os, device and browser hashes - - if (browser.webkit = !!webkit) browser.version = webkit[1] - - if (android) os.android = true, os.version = android[2] - if (iphone && !ipod) os.ios = os.iphone = true, os.version = iphone[2].replace(/_/g, '.') - if (ipad) os.ios = os.ipad = true, os.version = ipad[2].replace(/_/g, '.') - if (ipod) os.ios = os.ipod = true, os.version = ipod[3] ? ipod[3].replace(/_/g, '.') : null - if (webos) os.webos = true, os.version = webos[2] - if (touchpad) os.touchpad = true - if (blackberry) os.blackberry = true, os.version = blackberry[2] - if (bb10) os.bb10 = true, os.version = bb10[2] - if (rimtabletos) os.rimtabletos = true, os.version = rimtabletos[2] - if (playbook) browser.playbook = true - if (kindle) os.kindle = true, os.version = kindle[1] - if (silk) browser.silk = true, browser.version = silk[1] - if (!silk && os.android && ua.match(/Kindle Fire/)) browser.silk = true - if (chrome) browser.chrome = true, browser.version = chrome[1] - if (firefox) browser.firefox = true, browser.version = firefox[1] - if (ie) browser.ie = true, browser.version = ie[1] - if (safari && (ua.match(/Safari/) || !!os.ios)) browser.safari = true - if (webview) browser.webview = true - - os.tablet = !!(ipad || playbook || (android && !ua.match(/Mobile/)) || - (firefox && ua.match(/Tablet/)) || (ie && !ua.match(/Phone/) && ua.match(/Touch/))) - os.phone = !!(!os.tablet && !os.ipod && (android || iphone || webos || blackberry || bb10 || - (chrome && ua.match(/Android/)) || (chrome && ua.match(/CriOS\/([\d.]+)/)) || - (firefox && ua.match(/Mobile/)) || (ie && ua.match(/Touch/)))) - } - - detect.call($, navigator.userAgent) - // make available to unit tests - $.__detect = detect - -})(Zepto) diff --git a/lib/zeptojs/src/event.js b/lib/zeptojs/src/event.js deleted file mode 100644 index 7ab2af4..0000000 --- a/lib/zeptojs/src/event.js +++ /dev/null @@ -1,276 +0,0 @@ -// Zepto.js -// (c) 2010-2014 Thomas Fuchs -// Zepto.js may be freely distributed under the MIT license. - -;(function($){ - var _zid = 1, undefined, - slice = Array.prototype.slice, - isFunction = $.isFunction, - isString = function(obj){ return typeof obj == 'string' }, - handlers = {}, - specialEvents={}, - focusinSupported = 'onfocusin' in window, - focus = { focus: 'focusin', blur: 'focusout' }, - hover = { mouseenter: 'mouseover', mouseleave: 'mouseout' } - - specialEvents.click = specialEvents.mousedown = specialEvents.mouseup = specialEvents.mousemove = 'MouseEvents' - - function zid(element) { - return element._zid || (element._zid = _zid++) - } - function findHandlers(element, event, fn, selector) { - event = parse(event) - if (event.ns) var matcher = matcherFor(event.ns) - return (handlers[zid(element)] || []).filter(function(handler) { - return handler - && (!event.e || handler.e == event.e) - && (!event.ns || matcher.test(handler.ns)) - && (!fn || zid(handler.fn) === zid(fn)) - && (!selector || handler.sel == selector) - }) - } - function parse(event) { - var parts = ('' + event).split('.') - return {e: parts[0], ns: parts.slice(1).sort().join(' ')} - } - function matcherFor(ns) { - return new RegExp('(?:^| )' + ns.replace(' ', ' .* ?') + '(?: |$)') - } - - function eventCapture(handler, captureSetting) { - return handler.del && - (!focusinSupported && (handler.e in focus)) || - !!captureSetting - } - - function realEvent(type) { - return hover[type] || (focusinSupported && focus[type]) || type - } - - function add(element, events, fn, data, selector, delegator, capture){ - var id = zid(element), set = (handlers[id] || (handlers[id] = [])) - events.split(/\s/).forEach(function(event){ - if (event == 'ready') return $(document).ready(fn) - var handler = parse(event) - handler.fn = fn - handler.sel = selector - // emulate mouseenter, mouseleave - if (handler.e in hover) fn = function(e){ - var related = e.relatedTarget - if (!related || (related !== this && !$.contains(this, related))) - return handler.fn.apply(this, arguments) - } - handler.del = delegator - var callback = delegator || fn - handler.proxy = function(e){ - e = compatible(e) - if (e.isImmediatePropagationStopped()) return - e.data = data - var result = callback.apply(element, e._args == undefined ? [e] : [e].concat(e._args)) - if (result === false) e.preventDefault(), e.stopPropagation() - return result - } - handler.i = set.length - set.push(handler) - if ('addEventListener' in element) - element.addEventListener(realEvent(handler.e), handler.proxy, eventCapture(handler, capture)) - }) - } - function remove(element, events, fn, selector, capture){ - var id = zid(element) - ;(events || '').split(/\s/).forEach(function(event){ - findHandlers(element, event, fn, selector).forEach(function(handler){ - delete handlers[id][handler.i] - if ('removeEventListener' in element) - element.removeEventListener(realEvent(handler.e), handler.proxy, eventCapture(handler, capture)) - }) - }) - } - - $.event = { add: add, remove: remove } - - $.proxy = function(fn, context) { - if (isFunction(fn)) { - var proxyFn = function(){ return fn.apply(context, arguments) } - proxyFn._zid = zid(fn) - return proxyFn - } else if (isString(context)) { - return $.proxy(fn[context], fn) - } else { - throw new TypeError("expected function") - } - } - - $.fn.bind = function(event, data, callback){ - return this.on(event, data, callback) - } - $.fn.unbind = function(event, callback){ - return this.off(event, callback) - } - $.fn.one = function(event, selector, data, callback){ - return this.on(event, selector, data, callback, 1) - } - - var returnTrue = function(){return true}, - returnFalse = function(){return false}, - ignoreProperties = /^([A-Z]|returnValue$|layer[XY]$)/, - eventMethods = { - preventDefault: 'isDefaultPrevented', - stopImmediatePropagation: 'isImmediatePropagationStopped', - stopPropagation: 'isPropagationStopped' - } - - function compatible(event, source) { - if (source || !event.isDefaultPrevented) { - source || (source = event) - - $.each(eventMethods, function(name, predicate) { - var sourceMethod = source[name] - event[name] = function(){ - this[predicate] = returnTrue - return sourceMethod && sourceMethod.apply(source, arguments) - } - event[predicate] = returnFalse - }) - - if (source.defaultPrevented !== undefined ? source.defaultPrevented : - 'returnValue' in source ? source.returnValue === false : - source.getPreventDefault && source.getPreventDefault()) - event.isDefaultPrevented = returnTrue - } - return event - } - - function createProxy(event) { - var key, proxy = { originalEvent: event } - for (key in event) - if (!ignoreProperties.test(key) && event[key] !== undefined) proxy[key] = event[key] - - return compatible(proxy, event) - } - - $.fn.delegate = function(selector, event, callback){ - return this.on(event, selector, callback) - } - $.fn.undelegate = function(selector, event, callback){ - return this.off(event, selector, callback) - } - - $.fn.live = function(event, callback){ - $(document.body).delegate(this.selector, event, callback) - return this - } - $.fn.die = function(event, callback){ - $(document.body).undelegate(this.selector, event, callback) - return this - } - - $.fn.on = function(event, selector, data, callback, one){ - var autoRemove, delegator, $this = this - if (event && !isString(event)) { - $.each(event, function(type, fn){ - $this.on(type, selector, data, fn, one) - }) - return $this - } - - if (!isString(selector) && !isFunction(callback) && callback !== false) - callback = data, data = selector, selector = undefined - if (isFunction(data) || data === false) - callback = data, data = undefined - - if (callback === false) callback = returnFalse - - return $this.each(function(_, element){ - if (one) autoRemove = function(e){ - remove(element, e.type, callback) - return callback.apply(this, arguments) - } - - if (selector) delegator = function(e){ - var evt, match = $(e.target).closest(selector, element).get(0) - if (match && match !== element) { - evt = $.extend(createProxy(e), {currentTarget: match, liveFired: element}) - return (autoRemove || callback).apply(match, [evt].concat(slice.call(arguments, 1))) - } - } - - add(element, event, callback, data, selector, delegator || autoRemove) - }) - } - $.fn.off = function(event, selector, callback){ - var $this = this - if (event && !isString(event)) { - $.each(event, function(type, fn){ - $this.off(type, selector, fn) - }) - return $this - } - - if (!isString(selector) && !isFunction(callback) && callback !== false) - callback = selector, selector = undefined - - if (callback === false) callback = returnFalse - - return $this.each(function(){ - remove(this, event, callback, selector) - }) - } - - $.fn.trigger = function(event, args){ - event = (isString(event) || $.isPlainObject(event)) ? $.Event(event) : compatible(event) - event._args = args - return this.each(function(){ - // items in the collection might not be DOM elements - if('dispatchEvent' in this) this.dispatchEvent(event) - else $(this).triggerHandler(event, args) - }) - } - - // triggers event handlers on current element just as if an event occurred, - // doesn't trigger an actual event, doesn't bubble - $.fn.triggerHandler = function(event, args){ - var e, result - this.each(function(i, element){ - e = createProxy(isString(event) ? $.Event(event) : event) - e._args = args - e.target = element - $.each(findHandlers(element, event.type || event), function(i, handler){ - result = handler.proxy(e) - if (e.isImmediatePropagationStopped()) return false - }) - }) - return result - } - - // shortcut methods for `.bind(event, fn)` for each event type - ;('focusin focusout load resize scroll unload click dblclick '+ - 'mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave '+ - 'change select keydown keypress keyup error').split(' ').forEach(function(event) { - $.fn[event] = function(callback) { - return callback ? - this.bind(event, callback) : - this.trigger(event) - } - }) - - ;['focus', 'blur'].forEach(function(name) { - $.fn[name] = function(callback) { - if (callback) this.bind(name, callback) - else this.each(function(){ - try { this[name]() } - catch(e) {} - }) - return this - } - }) - - $.Event = function(type, props) { - if (!isString(type)) props = type, type = props.type - var event = document.createEvent(specialEvents[type] || 'Events'), bubbles = true - if (props) for (var name in props) (name == 'bubbles') ? (bubbles = !!props[name]) : (event[name] = props[name]) - event.initEvent(type, bubbles, true) - return compatible(event) - } - -})(Zepto) diff --git a/lib/zeptojs/src/form.js b/lib/zeptojs/src/form.js deleted file mode 100644 index 17bde52..0000000 --- a/lib/zeptojs/src/form.js +++ /dev/null @@ -1,40 +0,0 @@ -// Zepto.js -// (c) 2010-2014 Thomas Fuchs -// Zepto.js may be freely distributed under the MIT license. - -;(function($){ - $.fn.serializeArray = function() { - var result = [], el - $([].slice.call(this.get(0).elements)).each(function(){ - el = $(this) - var type = el.attr('type') - if (this.nodeName.toLowerCase() != 'fieldset' && - !this.disabled && type != 'submit' && type != 'reset' && type != 'button' && - ((type != 'radio' && type != 'checkbox') || this.checked)) - result.push({ - name: el.attr('name'), - value: el.val() - }) - }) - return result - } - - $.fn.serialize = function(){ - var result = [] - this.serializeArray().forEach(function(elm){ - result.push(encodeURIComponent(elm.name) + '=' + encodeURIComponent(elm.value)) - }) - return result.join('&') - } - - $.fn.submit = function(callback) { - if (callback) this.bind('submit', callback) - else if (this.length) { - var event = $.Event('submit') - this.eq(0).trigger(event) - if (!event.isDefaultPrevented()) this.get(0).submit() - } - return this - } - -})(Zepto) diff --git a/lib/zeptojs/src/fx.js b/lib/zeptojs/src/fx.js deleted file mode 100644 index c36c577..0000000 --- a/lib/zeptojs/src/fx.js +++ /dev/null @@ -1,123 +0,0 @@ -// Zepto.js -// (c) 2010-2014 Thomas Fuchs -// Zepto.js may be freely distributed under the MIT license. - -;(function($, undefined){ - var prefix = '', eventPrefix, endEventName, endAnimationName, - vendors = { Webkit: 'webkit', Moz: '', O: 'o' }, - document = window.document, testEl = document.createElement('div'), - supportedTransforms = /^((translate|rotate|scale)(X|Y|Z|3d)?|matrix(3d)?|perspective|skew(X|Y)?)$/i, - transform, - transitionProperty, transitionDuration, transitionTiming, transitionDelay, - animationName, animationDuration, animationTiming, animationDelay, - cssReset = {} - - function dasherize(str) { return str.replace(/([a-z])([A-Z])/, '$1-$2').toLowerCase() } - function normalizeEvent(name) { return eventPrefix ? eventPrefix + name : name.toLowerCase() } - - $.each(vendors, function(vendor, event){ - if (testEl.style[vendor + 'TransitionProperty'] !== undefined) { - prefix = '-' + vendor.toLowerCase() + '-' - eventPrefix = event - return false - } - }) - - transform = prefix + 'transform' - cssReset[transitionProperty = prefix + 'transition-property'] = - cssReset[transitionDuration = prefix + 'transition-duration'] = - cssReset[transitionDelay = prefix + 'transition-delay'] = - cssReset[transitionTiming = prefix + 'transition-timing-function'] = - cssReset[animationName = prefix + 'animation-name'] = - cssReset[animationDuration = prefix + 'animation-duration'] = - cssReset[animationDelay = prefix + 'animation-delay'] = - cssReset[animationTiming = prefix + 'animation-timing-function'] = '' - - $.fx = { - off: (eventPrefix === undefined && testEl.style.transitionProperty === undefined), - speeds: { _default: 400, fast: 200, slow: 600 }, - cssPrefix: prefix, - transitionEnd: normalizeEvent('TransitionEnd'), - animationEnd: normalizeEvent('AnimationEnd') - } - - $.fn.animate = function(properties, duration, ease, callback, delay){ - if ($.isFunction(duration)) - callback = duration, ease = undefined, duration = undefined - if ($.isFunction(ease)) - callback = ease, ease = undefined - if ($.isPlainObject(duration)) - ease = duration.easing, callback = duration.complete, delay = duration.delay, duration = duration.duration - if (duration) duration = (typeof duration == 'number' ? duration : - ($.fx.speeds[duration] || $.fx.speeds._default)) / 1000 - if (delay) delay = parseFloat(delay) / 1000 - return this.anim(properties, duration, ease, callback, delay) - } - - $.fn.anim = function(properties, duration, ease, callback, delay){ - var key, cssValues = {}, cssProperties, transforms = '', - that = this, wrappedCallback, endEvent = $.fx.transitionEnd, - fired = false - - if (duration === undefined) duration = $.fx.speeds._default / 1000 - if (delay === undefined) delay = 0 - if ($.fx.off) duration = 0 - - if (typeof properties == 'string') { - // keyframe animation - cssValues[animationName] = properties - cssValues[animationDuration] = duration + 's' - cssValues[animationDelay] = delay + 's' - cssValues[animationTiming] = (ease || 'linear') - endEvent = $.fx.animationEnd - } else { - cssProperties = [] - // CSS transitions - for (key in properties) - if (supportedTransforms.test(key)) transforms += key + '(' + properties[key] + ') ' - else cssValues[key] = properties[key], cssProperties.push(dasherize(key)) - - if (transforms) cssValues[transform] = transforms, cssProperties.push(transform) - if (duration > 0 && typeof properties === 'object') { - cssValues[transitionProperty] = cssProperties.join(', ') - cssValues[transitionDuration] = duration + 's' - cssValues[transitionDelay] = delay + 's' - cssValues[transitionTiming] = (ease || 'linear') - } - } - - wrappedCallback = function(event){ - if (typeof event !== 'undefined') { - if (event.target !== event.currentTarget) return // makes sure the event didn't bubble from "below" - $(event.target).unbind(endEvent, wrappedCallback) - } else - $(this).unbind(endEvent, wrappedCallback) // triggered by setTimeout - - fired = true - $(this).css(cssReset) - callback && callback.call(this) - } - if (duration > 0){ - this.bind(endEvent, wrappedCallback) - // transitionEnd is not always firing on older Android phones - // so make sure it gets fired - setTimeout(function(){ - if (fired) return - wrappedCallback.call(that) - }, (duration * 1000) + 25) - } - - // trigger page reflow so new elements can animate - this.size() && this.get(0).clientLeft - - this.css(cssValues) - - if (duration <= 0) setTimeout(function() { - that.each(function(){ wrappedCallback.call(this) }) - }, 0) - - return this - } - - testEl = null -})(Zepto) diff --git a/lib/zeptojs/src/fx_methods.js b/lib/zeptojs/src/fx_methods.js deleted file mode 100644 index f92ac52..0000000 --- a/lib/zeptojs/src/fx_methods.js +++ /dev/null @@ -1,71 +0,0 @@ -// Zepto.js -// (c) 2010-2014 Thomas Fuchs -// Zepto.js may be freely distributed under the MIT license. - -;(function($, undefined){ - var document = window.document, docElem = document.documentElement, - origShow = $.fn.show, origHide = $.fn.hide, origToggle = $.fn.toggle - - function anim(el, speed, opacity, scale, callback) { - if (typeof speed == 'function' && !callback) callback = speed, speed = undefined - var props = { opacity: opacity } - if (scale) { - props.scale = scale - el.css($.fx.cssPrefix + 'transform-origin', '0 0') - } - return el.animate(props, speed, null, callback) - } - - function hide(el, speed, scale, callback) { - return anim(el, speed, 0, scale, function(){ - origHide.call($(this)) - callback && callback.call(this) - }) - } - - $.fn.show = function(speed, callback) { - origShow.call(this) - if (speed === undefined) speed = 0 - else this.css('opacity', 0) - return anim(this, speed, 1, '1,1', callback) - } - - $.fn.hide = function(speed, callback) { - if (speed === undefined) return origHide.call(this) - else return hide(this, speed, '0,0', callback) - } - - $.fn.toggle = function(speed, callback) { - if (speed === undefined || typeof speed == 'boolean') - return origToggle.call(this, speed) - else return this.each(function(){ - var el = $(this) - el[el.css('display') == 'none' ? 'show' : 'hide'](speed, callback) - }) - } - - $.fn.fadeTo = function(speed, opacity, callback) { - return anim(this, speed, opacity, null, callback) - } - - $.fn.fadeIn = function(speed, callback) { - var target = this.css('opacity') - if (target > 0) this.css('opacity', 0) - else target = 1 - return origShow.call(this).fadeTo(speed, target, callback) - } - - $.fn.fadeOut = function(speed, callback) { - return hide(this, speed, null, callback) - } - - $.fn.fadeToggle = function(speed, callback) { - return this.each(function(){ - var el = $(this) - el[ - (el.css('opacity') == 0 || el.css('display') == 'none') ? 'fadeIn' : 'fadeOut' - ](speed, callback) - }) - } - -})(Zepto) diff --git a/lib/zeptojs/src/gesture.js b/lib/zeptojs/src/gesture.js deleted file mode 100644 index b9cfd44..0000000 --- a/lib/zeptojs/src/gesture.js +++ /dev/null @@ -1,35 +0,0 @@ -// Zepto.js -// (c) 2010-2014 Thomas Fuchs -// Zepto.js may be freely distributed under the MIT license. - -;(function($){ - if ($.os.ios) { - var gesture = {}, gestureTimeout - - function parentIfText(node){ - return 'tagName' in node ? node : node.parentNode - } - - $(document).bind('gesturestart', function(e){ - var now = Date.now(), delta = now - (gesture.last || now) - gesture.target = parentIfText(e.target) - gestureTimeout && clearTimeout(gestureTimeout) - gesture.e1 = e.scale - gesture.last = now - }).bind('gesturechange', function(e){ - gesture.e2 = e.scale - }).bind('gestureend', function(e){ - if (gesture.e2 > 0) { - Math.abs(gesture.e1 - gesture.e2) != 0 && $(gesture.target).trigger('pinch') && - $(gesture.target).trigger('pinch' + (gesture.e1 - gesture.e2 > 0 ? 'In' : 'Out')) - gesture.e1 = gesture.e2 = gesture.last = 0 - } else if ('last' in gesture) { - gesture = {} - } - }) - - ;['pinch', 'pinchIn', 'pinchOut'].forEach(function(m){ - $.fn[m] = function(callback){ return this.bind(m, callback) } - }) - } -})(Zepto) diff --git a/lib/zeptojs/src/ie.js b/lib/zeptojs/src/ie.js deleted file mode 100644 index d3bb1fd..0000000 --- a/lib/zeptojs/src/ie.js +++ /dev/null @@ -1,38 +0,0 @@ -// Zepto.js -// (c) 2010-2014 Thomas Fuchs -// Zepto.js may be freely distributed under the MIT license. - -;(function($){ - // __proto__ doesn't exist on IE<11, so redefine - // the Z function to use object extension instead - if (!('__proto__' in {})) { - $.extend($.zepto, { - Z: function(dom, selector){ - dom = dom || [] - $.extend(dom, $.fn) - dom.selector = selector || '' - dom.__Z = true - return dom - }, - // this is a kludge but works - isZ: function(object){ - return $.type(object) === 'array' && '__Z' in object - } - }) - } - - // getComputedStyle shouldn't freak out when called - // without a valid element as argument - try { - getComputedStyle(undefined) - } catch(e) { - var nativeGetComputedStyle = getComputedStyle; - window.getComputedStyle = function(element){ - try { - return nativeGetComputedStyle(element) - } catch(e) { - return null - } - } - } -})(Zepto) diff --git a/lib/zeptojs/src/ios3.js b/lib/zeptojs/src/ios3.js deleted file mode 100644 index b5eb7c3..0000000 --- a/lib/zeptojs/src/ios3.js +++ /dev/null @@ -1,36 +0,0 @@ -// Zepto.js -// (c) 2010-2014 Thomas Fuchs -// Zepto.js may be freely distributed under the MIT license. - -;(function(undefined){ - if (String.prototype.trim === undefined) // fix for iOS 3.2 - String.prototype.trim = function(){ return this.replace(/^\s+|\s+$/g, '') } - - // For iOS 3.x - // from https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/reduce - if (Array.prototype.reduce === undefined) - Array.prototype.reduce = function(fun){ - if(this === void 0 || this === null) throw new TypeError() - var t = Object(this), len = t.length >>> 0, k = 0, accumulator - if(typeof fun != 'function') throw new TypeError() - if(len == 0 && arguments.length == 1) throw new TypeError() - - if(arguments.length >= 2) - accumulator = arguments[1] - else - do{ - if(k in t){ - accumulator = t[k++] - break - } - if(++k >= len) throw new TypeError() - } while (true) - - while (k < len){ - if(k in t) accumulator = fun.call(undefined, accumulator, t[k], k, t) - k++ - } - return accumulator - } - -})() diff --git a/lib/zeptojs/src/selector.js b/lib/zeptojs/src/selector.js deleted file mode 100644 index c1d5fa8..0000000 --- a/lib/zeptojs/src/selector.js +++ /dev/null @@ -1,85 +0,0 @@ -// Zepto.js -// (c) 2010-2014 Thomas Fuchs -// Zepto.js may be freely distributed under the MIT license. - -;(function($){ - var zepto = $.zepto, oldQsa = zepto.qsa, oldMatches = zepto.matches - - function visible(elem){ - elem = $(elem) - return !!(elem.width() || elem.height()) && elem.css("display") !== "none" - } - - // Implements a subset from: - // http://api.jquery.com/category/selectors/jquery-selector-extensions/ - // - // Each filter function receives the current index, all nodes in the - // considered set, and a value if there were parentheses. The value - // of `this` is the node currently being considered. The function returns the - // resulting node(s), null, or undefined. - // - // Complex selectors are not supported: - // li:has(label:contains("foo")) + li:has(label:contains("bar")) - // ul.inner:first > li - var filters = $.expr[':'] = { - visible: function(){ if (visible(this)) return this }, - hidden: function(){ if (!visible(this)) return this }, - selected: function(){ if (this.selected) return this }, - checked: function(){ if (this.checked) return this }, - parent: function(){ return this.parentNode }, - first: function(idx){ if (idx === 0) return this }, - last: function(idx, nodes){ if (idx === nodes.length - 1) return this }, - eq: function(idx, _, value){ if (idx === value) return this }, - contains: function(idx, _, text){ if ($(this).text().indexOf(text) > -1) return this }, - has: function(idx, _, sel){ if (zepto.qsa(this, sel).length) return this } - } - - var filterRe = new RegExp('(.*):(\\w+)(?:\\(([^)]+)\\))?$\\s*'), - childRe = /^\s*>/, - classTag = 'Zepto' + (+new Date()) - - function process(sel, fn) { - // quote the hash in `a[href^=#]` expression - sel = sel.replace(/=#\]/g, '="#"]') - var filter, arg, match = filterRe.exec(sel) - if (match && match[2] in filters) { - filter = filters[match[2]], arg = match[3] - sel = match[1] - if (arg) { - var num = Number(arg) - if (isNaN(num)) arg = arg.replace(/^["']|["']$/g, '') - else arg = num - } - } - return fn(sel, filter, arg) - } - - zepto.qsa = function(node, selector) { - return process(selector, function(sel, filter, arg){ - try { - var taggedParent - if (!sel && filter) sel = '*' - else if (childRe.test(sel)) - // support "> *" child queries by tagging the parent node with a - // unique class and prepending that classname onto the selector - taggedParent = $(node).addClass(classTag), sel = '.'+classTag+' '+sel - - var nodes = oldQsa(node, sel) - } catch(e) { - console.error('error performing selector: %o', selector) - throw e - } finally { - if (taggedParent) taggedParent.removeClass(classTag) - } - return !filter ? nodes : - zepto.uniq($.map(nodes, function(n, i){ return filter.call(n, i, nodes, arg) })) - }) - } - - zepto.matches = function(node, selector){ - return process(selector, function(sel, filter, arg){ - return (!sel || oldMatches(node, sel)) && - (!filter || filter.call(node, null, arg) === node) - }) - } -})(Zepto) diff --git a/lib/zeptojs/src/stack.js b/lib/zeptojs/src/stack.js deleted file mode 100644 index cbec614..0000000 --- a/lib/zeptojs/src/stack.js +++ /dev/null @@ -1,22 +0,0 @@ -// Zepto.js -// (c) 2010-2014 Thomas Fuchs -// Zepto.js may be freely distributed under the MIT license. - -;(function($){ - $.fn.end = function(){ - return this.prevObject || $() - } - - $.fn.andSelf = function(){ - return this.add(this.prevObject || $()) - } - - 'filter,add,not,eq,first,last,find,closest,parents,parent,children,siblings'.split(',').forEach(function(property){ - var fn = $.fn[property] - $.fn[property] = function(){ - var ret = fn.apply(this, arguments) - ret.prevObject = this - return ret - } - }) -})(Zepto) diff --git a/lib/zeptojs/src/touch.js b/lib/zeptojs/src/touch.js deleted file mode 100644 index c449212..0000000 --- a/lib/zeptojs/src/touch.js +++ /dev/null @@ -1,165 +0,0 @@ -// Zepto.js -// (c) 2010-2014 Thomas Fuchs -// Zepto.js may be freely distributed under the MIT license. - -;(function($){ - var touch = {}, - touchTimeout, tapTimeout, swipeTimeout, longTapTimeout, - longTapDelay = 750, - gesture - - function swipeDirection(x1, x2, y1, y2) { - return Math.abs(x1 - x2) >= - Math.abs(y1 - y2) ? (x1 - x2 > 0 ? 'Left' : 'Right') : (y1 - y2 > 0 ? 'Up' : 'Down') - } - - function longTap() { - longTapTimeout = null - if (touch.last) { - touch.el.trigger('longTap') - touch = {} - } - } - - function cancelLongTap() { - if (longTapTimeout) clearTimeout(longTapTimeout) - longTapTimeout = null - } - - function cancelAll() { - if (touchTimeout) clearTimeout(touchTimeout) - if (tapTimeout) clearTimeout(tapTimeout) - if (swipeTimeout) clearTimeout(swipeTimeout) - if (longTapTimeout) clearTimeout(longTapTimeout) - touchTimeout = tapTimeout = swipeTimeout = longTapTimeout = null - touch = {} - } - - function isPrimaryTouch(event){ - return (event.pointerType == 'touch' || - event.pointerType == event.MSPOINTER_TYPE_TOUCH) - && event.isPrimary - } - - function isPointerEventType(e, type){ - return (e.type == 'pointer'+type || - e.type.toLowerCase() == 'mspointer'+type) - } - - $(document).ready(function(){ - var now, delta, deltaX = 0, deltaY = 0, firstTouch, _isPointerType - - if ('MSGesture' in window) { - gesture = new MSGesture() - gesture.target = document.body - } - - $(document) - .bind('MSGestureEnd', function(e){ - var swipeDirectionFromVelocity = - e.velocityX > 1 ? 'Right' : e.velocityX < -1 ? 'Left' : e.velocityY > 1 ? 'Down' : e.velocityY < -1 ? 'Up' : null; - if (swipeDirectionFromVelocity) { - touch.el.trigger('swipe') - touch.el.trigger('swipe'+ swipeDirectionFromVelocity) - } - }) - .on('touchstart MSPointerDown pointerdown', function(e){ - if((_isPointerType = isPointerEventType(e, 'down')) && - !isPrimaryTouch(e)) return - firstTouch = _isPointerType ? e : e.touches[0] - if (e.touches && e.touches.length === 1 && touch.x2) { - // Clear out touch movement data if we have it sticking around - // This can occur if touchcancel doesn't fire due to preventDefault, etc. - touch.x2 = undefined - touch.y2 = undefined - } - now = Date.now() - delta = now - (touch.last || now) - touch.el = $('tagName' in firstTouch.target ? - firstTouch.target : firstTouch.target.parentNode) - touchTimeout && clearTimeout(touchTimeout) - touch.x1 = firstTouch.pageX - touch.y1 = firstTouch.pageY - if (delta > 0 && delta <= 250) touch.isDoubleTap = true - touch.last = now - longTapTimeout = setTimeout(longTap, longTapDelay) - // adds the current touch contact for IE gesture recognition - if (gesture && _isPointerType) gesture.addPointer(e.pointerId); - }) - .on('touchmove MSPointerMove pointermove', function(e){ - if((_isPointerType = isPointerEventType(e, 'move')) && - !isPrimaryTouch(e)) return - firstTouch = _isPointerType ? e : e.touches[0] - cancelLongTap() - touch.x2 = firstTouch.pageX - touch.y2 = firstTouch.pageY - - deltaX += Math.abs(touch.x1 - touch.x2) - deltaY += Math.abs(touch.y1 - touch.y2) - }) - .on('touchend MSPointerUp pointerup', function(e){ - if((_isPointerType = isPointerEventType(e, 'up')) && - !isPrimaryTouch(e)) return - cancelLongTap() - - // swipe - if ((touch.x2 && Math.abs(touch.x1 - touch.x2) > 30) || - (touch.y2 && Math.abs(touch.y1 - touch.y2) > 30)) - - swipeTimeout = setTimeout(function() { - touch.el.trigger('swipe') - touch.el.trigger('swipe' + (swipeDirection(touch.x1, touch.x2, touch.y1, touch.y2))) - touch = {} - }, 0) - - // normal tap - else if ('last' in touch) - // don't fire tap when delta position changed by more than 30 pixels, - // for instance when moving to a point and back to origin - if (deltaX < 30 && deltaY < 30) { - // delay by one tick so we can cancel the 'tap' event if 'scroll' fires - // ('tap' fires before 'scroll') - tapTimeout = setTimeout(function() { - - // trigger universal 'tap' with the option to cancelTouch() - // (cancelTouch cancels processing of single vs double taps for faster 'tap' response) - var event = $.Event('tap') - event.cancelTouch = cancelAll - touch.el.trigger(event) - - // trigger double tap immediately - if (touch.isDoubleTap) { - if (touch.el) touch.el.trigger('doubleTap') - touch = {} - } - - // trigger single tap after 250ms of inactivity - else { - touchTimeout = setTimeout(function(){ - touchTimeout = null - if (touch.el) touch.el.trigger('singleTap') - touch = {} - }, 250) - } - }, 0) - } else { - touch = {} - } - deltaX = deltaY = 0 - - }) - // when the browser window loses focus, - // for example when a modal dialog is shown, - // cancel all ongoing events - .on('touchcancel MSPointerCancel pointercancel', cancelAll) - - // scrolling the window indicates intention of the user - // to scroll, not tap or swipe, so cancel all ongoing events - $(window).on('scroll', cancelAll) - }) - - ;['swipe', 'swipeLeft', 'swipeRight', 'swipeUp', 'swipeDown', - 'doubleTap', 'tap', 'singleTap', 'longTap'].forEach(function(eventName){ - $.fn[eventName] = function(callback){ return this.on(eventName, callback) } - }) -})(Zepto) diff --git a/lib/zeptojs/src/zepto.js b/lib/zeptojs/src/zepto.js deleted file mode 100644 index 23ba6af..0000000 --- a/lib/zeptojs/src/zepto.js +++ /dev/null @@ -1,866 +0,0 @@ -// Zepto.js -// (c) 2010-2014 Thomas Fuchs -// Zepto.js may be freely distributed under the MIT license. - -var Zepto = (function() { - var undefined, key, $, classList, emptyArray = [], slice = emptyArray.slice, filter = emptyArray.filter, - document = window.document, - elementDisplay = {}, classCache = {}, - cssNumber = { 'column-count': 1, 'columns': 1, 'font-weight': 1, 'line-height': 1,'opacity': 1, 'z-index': 1, 'zoom': 1 }, - fragmentRE = /^\s*<(\w+|!)[^>]*>/, - singleTagRE = /^<(\w+)\s*\/?>(?:<\/\1>|)$/, - tagExpanderRE = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig, - rootNodeRE = /^(?:body|html)$/i, - capitalRE = /([A-Z])/g, - - // special attributes that should be get/set via method calls - methodAttributes = ['val', 'css', 'html', 'text', 'data', 'width', 'height', 'offset'], - - adjacencyOperators = [ 'after', 'prepend', 'before', 'append' ], - table = document.createElement('table'), - tableRow = document.createElement('tr'), - containers = { - 'tr': document.createElement('tbody'), - 'tbody': table, 'thead': table, 'tfoot': table, - 'td': tableRow, 'th': tableRow, - '*': document.createElement('div') - }, - readyRE = /complete|loaded|interactive/, - simpleSelectorRE = /^[\w-]*$/, - class2type = {}, - toString = class2type.toString, - zepto = {}, - camelize, uniq, - tempParent = document.createElement('div'), - propMap = { - 'tabindex': 'tabIndex', - 'readonly': 'readOnly', - 'for': 'htmlFor', - 'class': 'className', - 'maxlength': 'maxLength', - 'cellspacing': 'cellSpacing', - 'cellpadding': 'cellPadding', - 'rowspan': 'rowSpan', - 'colspan': 'colSpan', - 'usemap': 'useMap', - 'frameborder': 'frameBorder', - 'contenteditable': 'contentEditable' - }, - isArray = Array.isArray || - function(object){ return object instanceof Array } - - zepto.matches = function(element, selector) { - if (!selector || !element || element.nodeType !== 1) return false - var matchesSelector = element.webkitMatchesSelector || element.mozMatchesSelector || - element.oMatchesSelector || element.matchesSelector - if (matchesSelector) return matchesSelector.call(element, selector) - // fall back to performing a selector: - var match, parent = element.parentNode, temp = !parent - if (temp) (parent = tempParent).appendChild(element) - match = ~zepto.qsa(parent, selector).indexOf(element) - temp && tempParent.removeChild(element) - return match - } - - function type(obj) { - return obj == null ? String(obj) : - class2type[toString.call(obj)] || "object" - } - - function isFunction(value) { return type(value) == "function" } - function isWindow(obj) { return obj != null && obj == obj.window } - function isDocument(obj) { return obj != null && obj.nodeType == obj.DOCUMENT_NODE } - function isObject(obj) { return type(obj) == "object" } - function isPlainObject(obj) { - return isObject(obj) && !isWindow(obj) && Object.getPrototypeOf(obj) == Object.prototype - } - function likeArray(obj) { return typeof obj.length == 'number' } - - function compact(array) { return filter.call(array, function(item){ return item != null }) } - function flatten(array) { return array.length > 0 ? $.fn.concat.apply([], array) : array } - camelize = function(str){ return str.replace(/-+(.)?/g, function(match, chr){ return chr ? chr.toUpperCase() : '' }) } - function dasherize(str) { - return str.replace(/::/g, '/') - .replace(/([A-Z]+)([A-Z][a-z])/g, '$1_$2') - .replace(/([a-z\d])([A-Z])/g, '$1_$2') - .replace(/_/g, '-') - .toLowerCase() - } - uniq = function(array){ return filter.call(array, function(item, idx){ return array.indexOf(item) == idx }) } - - function classRE(name) { - return name in classCache ? - classCache[name] : (classCache[name] = new RegExp('(^|\\s)' + name + '(\\s|$)')) - } - - function maybeAddPx(name, value) { - return (typeof value == "number" && !cssNumber[dasherize(name)]) ? value + "px" : value - } - - function defaultDisplay(nodeName) { - var element, display - if (!elementDisplay[nodeName]) { - element = document.createElement(nodeName) - document.body.appendChild(element) - display = getComputedStyle(element, '').getPropertyValue("display") - element.parentNode.removeChild(element) - display == "none" && (display = "block") - elementDisplay[nodeName] = display - } - return elementDisplay[nodeName] - } - - function children(element) { - return 'children' in element ? - slice.call(element.children) : - $.map(element.childNodes, function(node){ if (node.nodeType == 1) return node }) - } - - // `$.zepto.fragment` takes a html string and an optional tag name - // to generate DOM nodes nodes from the given html string. - // The generated DOM nodes are returned as an array. - // This function can be overriden in plugins for example to make - // it compatible with browsers that don't support the DOM fully. - zepto.fragment = function(html, name, properties) { - var dom, nodes, container - - // A special case optimization for a single tag - if (singleTagRE.test(html)) dom = $(document.createElement(RegExp.$1)) - - if (!dom) { - if (html.replace) html = html.replace(tagExpanderRE, "<$1>") - if (name === undefined) name = fragmentRE.test(html) && RegExp.$1 - if (!(name in containers)) name = '*' - - container = containers[name] - container.innerHTML = '' + html - dom = $.each(slice.call(container.childNodes), function(){ - container.removeChild(this) - }) - } - - if (isPlainObject(properties)) { - nodes = $(dom) - $.each(properties, function(key, value) { - if (methodAttributes.indexOf(key) > -1) nodes[key](value) - else nodes.attr(key, value) - }) - } - - return dom - } - - // `$.zepto.Z` swaps out the prototype of the given `dom` array - // of nodes with `$.fn` and thus supplying all the Zepto functions - // to the array. Note that `__proto__` is not supported on Internet - // Explorer. This method can be overriden in plugins. - zepto.Z = function(dom, selector) { - dom = dom || [] - dom.__proto__ = $.fn - dom.selector = selector || '' - return dom - } - - // `$.zepto.isZ` should return `true` if the given object is a Zepto - // collection. This method can be overriden in plugins. - zepto.isZ = function(object) { - return object instanceof zepto.Z - } - - // `$.zepto.init` is Zepto's counterpart to jQuery's `$.fn.init` and - // takes a CSS selector and an optional context (and handles various - // special cases). - // This method can be overriden in plugins. - zepto.init = function(selector, context) { - var dom - // If nothing given, return an empty Zepto collection - if (!selector) return zepto.Z() - // Optimize for string selectors - else if (typeof selector == 'string') { - selector = selector.trim() - // If it's a html fragment, create nodes from it - // Note: In both Chrome 21 and Firefox 15, DOM error 12 - // is thrown if the fragment doesn't begin with < - if (selector[0] == '<' && fragmentRE.test(selector)) - dom = zepto.fragment(selector, RegExp.$1, context), selector = null - // If there's a context, create a collection on that context first, and select - // nodes from there - else if (context !== undefined) return $(context).find(selector) - // If it's a CSS selector, use it to select nodes. - else dom = zepto.qsa(document, selector) - } - // If a function is given, call it when the DOM is ready - else if (isFunction(selector)) return $(document).ready(selector) - // If a Zepto collection is given, just return it - else if (zepto.isZ(selector)) return selector - else { - // normalize array if an array of nodes is given - if (isArray(selector)) dom = compact(selector) - // Wrap DOM nodes. - else if (isObject(selector)) - dom = [selector], selector = null - // If it's a html fragment, create nodes from it - else if (fragmentRE.test(selector)) - dom = zepto.fragment(selector.trim(), RegExp.$1, context), selector = null - // If there's a context, create a collection on that context first, and select - // nodes from there - else if (context !== undefined) return $(context).find(selector) - // And last but no least, if it's a CSS selector, use it to select nodes. - else dom = zepto.qsa(document, selector) - } - // create a new Zepto collection from the nodes found - return zepto.Z(dom, selector) - } - - // `$` will be the base `Zepto` object. When calling this - // function just call `$.zepto.init, which makes the implementation - // details of selecting nodes and creating Zepto collections - // patchable in plugins. - $ = function(selector, context){ - return zepto.init(selector, context) - } - - function extend(target, source, deep) { - for (key in source) - if (deep && (isPlainObject(source[key]) || isArray(source[key]))) { - if (isPlainObject(source[key]) && !isPlainObject(target[key])) - target[key] = {} - if (isArray(source[key]) && !isArray(target[key])) - target[key] = [] - extend(target[key], source[key], deep) - } - else if (source[key] !== undefined) target[key] = source[key] - } - - // Copy all but undefined properties from one or more - // objects to the `target` object. - $.extend = function(target){ - var deep, args = slice.call(arguments, 1) - if (typeof target == 'boolean') { - deep = target - target = args.shift() - } - args.forEach(function(arg){ extend(target, arg, deep) }) - return target - } - - // `$.zepto.qsa` is Zepto's CSS selector implementation which - // uses `document.querySelectorAll` and optimizes for some special cases, like `#id`. - // This method can be overriden in plugins. - zepto.qsa = function(element, selector){ - var found, - maybeID = selector[0] == '#', - maybeClass = !maybeID && selector[0] == '.', - nameOnly = maybeID || maybeClass ? selector.slice(1) : selector, // Ensure that a 1 char tag name still gets checked - isSimple = simpleSelectorRE.test(nameOnly) - return (isDocument(element) && isSimple && maybeID) ? - ( (found = element.getElementById(nameOnly)) ? [found] : [] ) : - (element.nodeType !== 1 && element.nodeType !== 9) ? [] : - slice.call( - isSimple && !maybeID ? - maybeClass ? element.getElementsByClassName(nameOnly) : // If it's simple, it could be a class - element.getElementsByTagName(selector) : // Or a tag - element.querySelectorAll(selector) // Or it's not simple, and we need to query all - ) - } - - function filtered(nodes, selector) { - return selector == null ? $(nodes) : $(nodes).filter(selector) - } - - $.contains = function(parent, node) { - return parent !== node && parent.contains(node) - } - - function funcArg(context, arg, idx, payload) { - return isFunction(arg) ? arg.call(context, idx, payload) : arg - } - - function setAttribute(node, name, value) { - value == null ? node.removeAttribute(name) : node.setAttribute(name, value) - } - - // access className property while respecting SVGAnimatedString - function className(node, value){ - var klass = node.className, - svg = klass && klass.baseVal !== undefined - - if (value === undefined) return svg ? klass.baseVal : klass - svg ? (klass.baseVal = value) : (node.className = value) - } - - // "true" => true - // "false" => false - // "null" => null - // "42" => 42 - // "42.5" => 42.5 - // "08" => "08" - // JSON => parse if valid - // String => self - function deserializeValue(value) { - var num - try { - return value ? - value == "true" || - ( value == "false" ? false : - value == "null" ? null : - !/^0/.test(value) && !isNaN(num = Number(value)) ? num : - /^[\[\{]/.test(value) ? $.parseJSON(value) : - value ) - : value - } catch(e) { - return value - } - } - - $.type = type - $.isFunction = isFunction - $.isWindow = isWindow - $.isArray = isArray - $.isPlainObject = isPlainObject - - $.isEmptyObject = function(obj) { - var name - for (name in obj) return false - return true - } - - $.inArray = function(elem, array, i){ - return emptyArray.indexOf.call(array, elem, i) - } - - $.camelCase = camelize - $.trim = function(str) { - return str == null ? "" : String.prototype.trim.call(str) - } - - // plugin compatibility - $.uuid = 0 - $.support = { } - $.expr = { } - - $.map = function(elements, callback){ - var value, values = [], i, key - if (likeArray(elements)) - for (i = 0; i < elements.length; i++) { - value = callback(elements[i], i) - if (value != null) values.push(value) - } - else - for (key in elements) { - value = callback(elements[key], key) - if (value != null) values.push(value) - } - return flatten(values) - } - - $.each = function(elements, callback){ - var i, key - if (likeArray(elements)) { - for (i = 0; i < elements.length; i++) - if (callback.call(elements[i], i, elements[i]) === false) return elements - } else { - for (key in elements) - if (callback.call(elements[key], key, elements[key]) === false) return elements - } - - return elements - } - - $.grep = function(elements, callback){ - return filter.call(elements, callback) - } - - if (window.JSON) $.parseJSON = JSON.parse - - // Populate the class2type map - $.each("Boolean Number String Function Array Date RegExp Object Error".split(" "), function(i, name) { - class2type[ "[object " + name + "]" ] = name.toLowerCase() - }) - - // Define methods that will be available on all - // Zepto collections - $.fn = { - // Because a collection acts like an array - // copy over these useful array functions. - forEach: emptyArray.forEach, - reduce: emptyArray.reduce, - push: emptyArray.push, - sort: emptyArray.sort, - indexOf: emptyArray.indexOf, - concat: emptyArray.concat, - - // `map` and `slice` in the jQuery API work differently - // from their array counterparts - map: function(fn){ - return $($.map(this, function(el, i){ return fn.call(el, i, el) })) - }, - slice: function(){ - return $(slice.apply(this, arguments)) - }, - - ready: function(callback){ - // need to check if document.body exists for IE as that browser reports - // document ready when it hasn't yet created the body element - if (readyRE.test(document.readyState) && document.body) callback($) - else document.addEventListener('DOMContentLoaded', function(){ callback($) }, false) - return this - }, - get: function(idx){ - return idx === undefined ? slice.call(this) : this[idx >= 0 ? idx : idx + this.length] - }, - toArray: function(){ return this.get() }, - size: function(){ - return this.length - }, - remove: function(){ - return this.each(function(){ - if (this.parentNode != null) - this.parentNode.removeChild(this) - }) - }, - each: function(callback){ - emptyArray.every.call(this, function(el, idx){ - return callback.call(el, idx, el) !== false - }) - return this - }, - filter: function(selector){ - if (isFunction(selector)) return this.not(this.not(selector)) - return $(filter.call(this, function(element){ - return zepto.matches(element, selector) - })) - }, - add: function(selector,context){ - return $(uniq(this.concat($(selector,context)))) - }, - is: function(selector){ - return this.length > 0 && zepto.matches(this[0], selector) - }, - not: function(selector){ - var nodes=[] - if (isFunction(selector) && selector.call !== undefined) - this.each(function(idx){ - if (!selector.call(this,idx)) nodes.push(this) - }) - else { - var excludes = typeof selector == 'string' ? this.filter(selector) : - (likeArray(selector) && isFunction(selector.item)) ? slice.call(selector) : $(selector) - this.forEach(function(el){ - if (excludes.indexOf(el) < 0) nodes.push(el) - }) - } - return $(nodes) - }, - has: function(selector){ - return this.filter(function(){ - return isObject(selector) ? - $.contains(this, selector) : - $(this).find(selector).size() - }) - }, - eq: function(idx){ - return idx === -1 ? this.slice(idx) : this.slice(idx, + idx + 1) - }, - first: function(){ - var el = this[0] - return el && !isObject(el) ? el : $(el) - }, - last: function(){ - var el = this[this.length - 1] - return el && !isObject(el) ? el : $(el) - }, - find: function(selector){ - var result, $this = this - if (typeof selector == 'object') - result = $(selector).filter(function(){ - var node = this - return emptyArray.some.call($this, function(parent){ - return $.contains(parent, node) - }) - }) - else if (this.length == 1) result = $(zepto.qsa(this[0], selector)) - else result = this.map(function(){ return zepto.qsa(this, selector) }) - return result - }, - closest: function(selector, context){ - var node = this[0], collection = false - if (typeof selector == 'object') collection = $(selector) - while (node && !(collection ? collection.indexOf(node) >= 0 : zepto.matches(node, selector))) - node = node !== context && !isDocument(node) && node.parentNode - return $(node) - }, - parents: function(selector){ - var ancestors = [], nodes = this - while (nodes.length > 0) - nodes = $.map(nodes, function(node){ - if ((node = node.parentNode) && !isDocument(node) && ancestors.indexOf(node) < 0) { - ancestors.push(node) - return node - } - }) - return filtered(ancestors, selector) - }, - parent: function(selector){ - return filtered(uniq(this.pluck('parentNode')), selector) - }, - children: function(selector){ - return filtered(this.map(function(){ return children(this) }), selector) - }, - contents: function() { - return this.map(function() { return slice.call(this.childNodes) }) - }, - siblings: function(selector){ - return filtered(this.map(function(i, el){ - return filter.call(children(el.parentNode), function(child){ return child!==el }) - }), selector) - }, - empty: function(){ - return this.each(function(){ this.innerHTML = '' }) - }, - // `pluck` is borrowed from Prototype.js - pluck: function(property){ - return $.map(this, function(el){ return el[property] }) - }, - show: function(){ - return this.each(function(){ - this.style.display == "none" && (this.style.display = '') - if (getComputedStyle(this, '').getPropertyValue("display") == "none") - this.style.display = defaultDisplay(this.nodeName) - }) - }, - replaceWith: function(newContent){ - return this.before(newContent).remove() - }, - wrap: function(structure){ - var func = isFunction(structure) - if (this[0] && !func) - var dom = $(structure).get(0), - clone = dom.parentNode || this.length > 1 - - return this.each(function(index){ - $(this).wrapAll( - func ? structure.call(this, index) : - clone ? dom.cloneNode(true) : dom - ) - }) - }, - wrapAll: function(structure){ - if (this[0]) { - $(this[0]).before(structure = $(structure)) - var children - // drill down to the inmost element - while ((children = structure.children()).length) structure = children.first() - $(structure).append(this) - } - return this - }, - wrapInner: function(structure){ - var func = isFunction(structure) - return this.each(function(index){ - var self = $(this), contents = self.contents(), - dom = func ? structure.call(this, index) : structure - contents.length ? contents.wrapAll(dom) : self.append(dom) - }) - }, - unwrap: function(){ - this.parent().each(function(){ - $(this).replaceWith($(this).children()) - }) - return this - }, - clone: function(){ - return this.map(function(){ return this.cloneNode(true) }) - }, - hide: function(){ - return this.css("display", "none") - }, - toggle: function(setting){ - return this.each(function(){ - var el = $(this) - ;(setting === undefined ? el.css("display") == "none" : setting) ? el.show() : el.hide() - }) - }, - prev: function(selector){ return $(this.pluck('previousElementSibling')).filter(selector || '*') }, - next: function(selector){ return $(this.pluck('nextElementSibling')).filter(selector || '*') }, - html: function(html){ - return arguments.length === 0 ? - (this.length > 0 ? this[0].innerHTML : null) : - this.each(function(idx){ - var originHtml = this.innerHTML - $(this).empty().append( funcArg(this, html, idx, originHtml) ) - }) - }, - text: function(text){ - return arguments.length === 0 ? - (this.length > 0 ? this[0].textContent : null) : - this.each(function(){ this.textContent = (text === undefined) ? '' : ''+text }) - }, - attr: function(name, value){ - var result - return (typeof name == 'string' && value === undefined) ? - (this.length == 0 || this[0].nodeType !== 1 ? undefined : - (name == 'value' && this[0].nodeName == 'INPUT') ? this.val() : - (!(result = this[0].getAttribute(name)) && name in this[0]) ? this[0][name] : result - ) : - this.each(function(idx){ - if (this.nodeType !== 1) return - if (isObject(name)) for (key in name) setAttribute(this, key, name[key]) - else setAttribute(this, name, funcArg(this, value, idx, this.getAttribute(name))) - }) - }, - removeAttr: function(name){ - return this.each(function(){ this.nodeType === 1 && setAttribute(this, name) }) - }, - prop: function(name, value){ - name = propMap[name] || name - return (value === undefined) ? - (this[0] && this[0][name]) : - this.each(function(idx){ - this[name] = funcArg(this, value, idx, this[name]) - }) - }, - data: function(name, value){ - var data = this.attr('data-' + name.replace(capitalRE, '-$1').toLowerCase(), value) - return data !== null ? deserializeValue(data) : undefined - }, - val: function(value){ - return arguments.length === 0 ? - (this[0] && (this[0].multiple ? - $(this[0]).find('option').filter(function(){ return this.selected }).pluck('value') : - this[0].value) - ) : - this.each(function(idx){ - this.value = funcArg(this, value, idx, this.value) - }) - }, - offset: function(coordinates){ - if (coordinates) return this.each(function(index){ - var $this = $(this), - coords = funcArg(this, coordinates, index, $this.offset()), - parentOffset = $this.offsetParent().offset(), - props = { - top: coords.top - parentOffset.top, - left: coords.left - parentOffset.left - } - - if ($this.css('position') == 'static') props['position'] = 'relative' - $this.css(props) - }) - if (this.length==0) return null - var obj = this[0].getBoundingClientRect() - return { - left: obj.left + window.pageXOffset, - top: obj.top + window.pageYOffset, - width: Math.round(obj.width), - height: Math.round(obj.height) - } - }, - css: function(property, value){ - if (arguments.length < 2) { - var element = this[0], computedStyle = getComputedStyle(element, '') - if(!element) return - if (typeof property == 'string') - return element.style[camelize(property)] || computedStyle.getPropertyValue(property) - else if (isArray(property)) { - var props = {} - $.each(isArray(property) ? property: [property], function(_, prop){ - props[prop] = (element.style[camelize(prop)] || computedStyle.getPropertyValue(prop)) - }) - return props - } - } - - var css = '' - if (type(property) == 'string') { - if (!value && value !== 0) - this.each(function(){ this.style.removeProperty(dasherize(property)) }) - else - css = dasherize(property) + ":" + maybeAddPx(property, value) - } else { - for (key in property) - if (!property[key] && property[key] !== 0) - this.each(function(){ this.style.removeProperty(dasherize(key)) }) - else - css += dasherize(key) + ':' + maybeAddPx(key, property[key]) + ';' - } - - return this.each(function(){ this.style.cssText += ';' + css }) - }, - index: function(element){ - return element ? this.indexOf($(element)[0]) : this.parent().children().indexOf(this[0]) - }, - hasClass: function(name){ - if (!name) return false - return emptyArray.some.call(this, function(el){ - return this.test(className(el)) - }, classRE(name)) - }, - addClass: function(name){ - if (!name) return this - return this.each(function(idx){ - classList = [] - var cls = className(this), newName = funcArg(this, name, idx, cls) - newName.split(/\s+/g).forEach(function(klass){ - if (!$(this).hasClass(klass)) classList.push(klass) - }, this) - classList.length && className(this, cls + (cls ? " " : "") + classList.join(" ")) - }) - }, - removeClass: function(name){ - return this.each(function(idx){ - if (name === undefined) return className(this, '') - classList = className(this) - funcArg(this, name, idx, classList).split(/\s+/g).forEach(function(klass){ - classList = classList.replace(classRE(klass), " ") - }) - className(this, classList.trim()) - }) - }, - toggleClass: function(name, when){ - if (!name) return this - return this.each(function(idx){ - var $this = $(this), names = funcArg(this, name, idx, className(this)) - names.split(/\s+/g).forEach(function(klass){ - (when === undefined ? !$this.hasClass(klass) : when) ? - $this.addClass(klass) : $this.removeClass(klass) - }) - }) - }, - scrollTop: function(value){ - if (!this.length) return - var hasScrollTop = 'scrollTop' in this[0] - if (value === undefined) return hasScrollTop ? this[0].scrollTop : this[0].pageYOffset - return this.each(hasScrollTop ? - function(){ this.scrollTop = value } : - function(){ this.scrollTo(this.scrollX, value) }) - }, - scrollLeft: function(value){ - if (!this.length) return - var hasScrollLeft = 'scrollLeft' in this[0] - if (value === undefined) return hasScrollLeft ? this[0].scrollLeft : this[0].pageXOffset - return this.each(hasScrollLeft ? - function(){ this.scrollLeft = value } : - function(){ this.scrollTo(value, this.scrollY) }) - }, - position: function() { - if (!this.length) return - - var elem = this[0], - // Get *real* offsetParent - offsetParent = this.offsetParent(), - // Get correct offsets - offset = this.offset(), - parentOffset = rootNodeRE.test(offsetParent[0].nodeName) ? { top: 0, left: 0 } : offsetParent.offset() - - // Subtract element margins - // note: when an element has margin: auto the offsetLeft and marginLeft - // are the same in Safari causing offset.left to incorrectly be 0 - offset.top -= parseFloat( $(elem).css('margin-top') ) || 0 - offset.left -= parseFloat( $(elem).css('margin-left') ) || 0 - - // Add offsetParent borders - parentOffset.top += parseFloat( $(offsetParent[0]).css('border-top-width') ) || 0 - parentOffset.left += parseFloat( $(offsetParent[0]).css('border-left-width') ) || 0 - - // Subtract the two offsets - return { - top: offset.top - parentOffset.top, - left: offset.left - parentOffset.left - } - }, - offsetParent: function() { - return this.map(function(){ - var parent = this.offsetParent || document.body - while (parent && !rootNodeRE.test(parent.nodeName) && $(parent).css("position") == "static") - parent = parent.offsetParent - return parent - }) - } - } - - // for now - $.fn.detach = $.fn.remove - - // Generate the `width` and `height` functions - ;['width', 'height'].forEach(function(dimension){ - var dimensionProperty = - dimension.replace(/./, function(m){ return m[0].toUpperCase() }) - - $.fn[dimension] = function(value){ - var offset, el = this[0] - if (value === undefined) return isWindow(el) ? el['inner' + dimensionProperty] : - isDocument(el) ? el.documentElement['scroll' + dimensionProperty] : - (offset = this.offset()) && offset[dimension] - else return this.each(function(idx){ - el = $(this) - el.css(dimension, funcArg(this, value, idx, el[dimension]())) - }) - } - }) - - function traverseNode(node, fun) { - fun(node) - for (var key in node.childNodes) traverseNode(node.childNodes[key], fun) - } - - // Generate the `after`, `prepend`, `before`, `append`, - // `insertAfter`, `insertBefore`, `appendTo`, and `prependTo` methods. - adjacencyOperators.forEach(function(operator, operatorIndex) { - var inside = operatorIndex % 2 //=> prepend, append - - $.fn[operator] = function(){ - // arguments can be nodes, arrays of nodes, Zepto objects and HTML strings - var argType, nodes = $.map(arguments, function(arg) { - argType = type(arg) - return argType == "object" || argType == "array" || arg == null ? - arg : zepto.fragment(arg) - }), - parent, copyByClone = this.length > 1 - if (nodes.length < 1) return this - - return this.each(function(_, target){ - parent = inside ? target : target.parentNode - - // convert all methods to a "before" operation - target = operatorIndex == 0 ? target.nextSibling : - operatorIndex == 1 ? target.firstChild : - operatorIndex == 2 ? target : - null - - nodes.forEach(function(node){ - if (copyByClone) node = node.cloneNode(true) - else if (!parent) return $(node).remove() - - traverseNode(parent.insertBefore(node, target), function(el){ - if (el.nodeName != null && el.nodeName.toUpperCase() === 'SCRIPT' && - (!el.type || el.type === 'text/javascript') && !el.src) - window['eval'].call(window, el.innerHTML) - }) - }) - }) - } - - // after => insertAfter - // prepend => prependTo - // before => insertBefore - // append => appendTo - $.fn[inside ? operator+'To' : 'insert'+(operatorIndex ? 'Before' : 'After')] = function(html){ - $(html)[operator](this) - return this - } - }) - - zepto.Z.prototype = $.fn - - // Export internal API functions in the `$.zepto` namespace - zepto.uniq = uniq - zepto.deserializeValue = deserializeValue - $.zepto = zepto - - return $ -})() - -// If `$` is not yet defined, point it to `Zepto` -window.Zepto = Zepto -window.$ === undefined && (window.$ = Zepto) diff --git a/lib/zeptojs/test/ajax.html b/lib/zeptojs/test/ajax.html deleted file mode 100644 index a7f18be..0000000 --- a/lib/zeptojs/test/ajax.html +++ /dev/null @@ -1,1433 +0,0 @@ - - - - - - - Zepto Ajax unit tests - - - - - -

    Zepto Ajax unit tests

    -

    - Running… see browser console for results -

    -
    -
    -
    - - - - diff --git a/lib/zeptojs/test/ajax_deferred.html b/lib/zeptojs/test/ajax_deferred.html deleted file mode 100644 index e1b25df..0000000 --- a/lib/zeptojs/test/ajax_deferred.html +++ /dev/null @@ -1,213 +0,0 @@ - - - - - - - Zepto Ajax deferred - - - - - -

    Zepto Ajax deferred

    -

    - Running… see browser console for results -

    -
    -
    - - - - diff --git a/lib/zeptojs/test/callbacks.html b/lib/zeptojs/test/callbacks.html deleted file mode 100644 index 4a7388e..0000000 --- a/lib/zeptojs/test/callbacks.html +++ /dev/null @@ -1,272 +0,0 @@ - - - - - - - Zepto Callbacks unit tests - - - - - -

    Zepto Callbacks unit tests

    -

    - Running… see browser console for results -

    - - - - diff --git a/lib/zeptojs/test/data.html b/lib/zeptojs/test/data.html deleted file mode 100644 index 294fda1..0000000 --- a/lib/zeptojs/test/data.html +++ /dev/null @@ -1,329 +0,0 @@ - - - - - - - Zepto Data unit tests - - - - - -

    Zepto Data unit tests

    -

    - Running… see browser console for results -

    -
    -
    -
    -
    -
      -
    1. -
    2. -
    -
      -
    1. -
    2. -
    -
    - - - - diff --git a/lib/zeptojs/test/deferred.html b/lib/zeptojs/test/deferred.html deleted file mode 100644 index 7b3dba6..0000000 --- a/lib/zeptojs/test/deferred.html +++ /dev/null @@ -1,418 +0,0 @@ - - - - - - - Zepto Deferred unit tests - - - - - -

    Zepto Deferred unit tests

    -

    - Running… see browser console for results -

    - - - - diff --git a/lib/zeptojs/test/detect.html b/lib/zeptojs/test/detect.html deleted file mode 100644 index e082430..0000000 --- a/lib/zeptojs/test/detect.html +++ /dev/null @@ -1,432 +0,0 @@ - - - - - - - Zepto Detect unit tests - - - - - -

    Zepto Detect unit tests

    -

    - Running… see browser console for results -

    - - - - diff --git a/lib/zeptojs/test/event.html b/lib/zeptojs/test/event.html deleted file mode 100644 index 3db7372..0000000 --- a/lib/zeptojs/test/event.html +++ /dev/null @@ -1,434 +0,0 @@ - - - - - - - Zepto Event unit tests - - - - - -

    Zepto Event unit tests

    -

    - Running… see browser console for results -

    -
    -
    - - - - diff --git a/lib/zeptojs/test/evidence_runner.js b/lib/zeptojs/test/evidence_runner.js deleted file mode 100644 index 7c13f66..0000000 --- a/lib/zeptojs/test/evidence_runner.js +++ /dev/null @@ -1,123 +0,0 @@ -(function(){ - var ConsoleTestRunner = Evidence.AutoRunner.RUNNERS.console, - ConsoleTestResult = Evidence.UI.Console.TestResult, - AutoRunner = Evidence.AutoRunner, - printf = Evidence.UI.printf - - function inherit(superclass, extra) { - var klass = function(){ - this.initialize.apply(this, arguments) - } - var tmp = function(){} - tmp.prototype = superclass.prototype - klass.prototype = new tmp() - klass.prototype.constructor = klass - klass.prototype.initialize = function(){ - superclass.apply(this, arguments) - } - - if (extra) { - var methods = extra.call(klass, superclass.prototype) - for (var method in methods) klass.prototype[method] = methods[method] - } - return klass - } - - var TestRunner = inherit(ConsoleTestRunner, function(_super) { - AutoRunner.RUNNERS.zepto = this - return { - _makeResult: function() { return new TestResult(this.logger) } - } - }) - - var TestResult = inherit(ConsoleTestResult, function(_super) { - return { - start: function(t0) { - Evidence.TestResult.prototype.start.call(this, t0) - this.logger.debug('Started tests.') - }, - stop: function(t1) { - _super.stop.call(this, t1) - displayResults(this, (t1-this.t0)/1000) - checkLeakedGlobals() - }, - pauseTest: function(testcase) { - this.logger.debug('Paused testcase ' + testcase + '.') - }, - restartTest: function(testcase) { - this.logger.debug('Restarted testcase ' + testcase + '.') - }, - startSuite: function(suite) { - this.logger.debug('Started suite ' + suite + '.') - }, - addFailure: function(testcase, reason) { - this.logToServer(testcase, reason) - _super.addFailure.call(this, testcase, reason) - }, - addError: function(testcase, error) { - this.logToServer(testcase, error) - _super.addError.call(this, testcase, error) - }, - logToServer: function(testcase, error) { - if (location.protocol == 'file:') return - var name = testcase.parent.name + '#' + testcase.name, - message = error.template ? - Evidence.UI.printf(error.template, error.args) + (error.message ? ' ' + error.message : '') : - error.message, - body = 'name=' + encodeURIComponent(name) + '&' + - 'message=' + encodeURIComponent(message) + '&' + - 'trace=' + encodeURIComponent(error.stack || '') - - var xhr = new XMLHttpRequest() - xhr.open('POST', '/test/log', true) - xhr.setRequestHeader('content-type', 'application/x-www-form-urlencoded') - xhr.send(body) - } - } - }) - - Evidence.TestCase.prototype.debug = function(message) { - this._result.logToServer(this, { message: message }) - } - - // HACK: force our test runner as default - ;(function(){ - var _super = AutoRunner.prototype.retrieveOptions - AutoRunner.prototype.retrieveOptions = function() { - var options = _super.call(this) - if (!options.runner) options.runner = 'zepto' - return options - } - })() - - function $(id) { return document.getElementById(id) } - - function displayResults(results, seconds) { - var container = $('results') - if (container) { - if (results.failureCount || results.errorCount) { - container.className = 'failed' - container.innerHTML = printf("Finished in %d s. – %d failures, %d errors (%d assertions)", - [seconds, results.failureCount, results.errorCount, results.assertionCount]) - } else { - container.className = 'passed' - container.innerHTML = printf("Finished in %d s. – %d tests passed (%d assertions)", - [seconds, results.testCount, results.assertionCount]) - } - container.className += ' finished' - } - } - - var globals = [], expected = ['Zepto', '$', 'Evidence'] - for (var key in window) globals.push(key) - - function checkLeakedGlobals() { - var opera = /^Opera\b/.test(navigator.userAgent) - for (var key in window) - if ( globals.indexOf(key) < 0 && expected.indexOf(key) < 0 && - (!opera || typeof window[key] != 'object' || window[key].id != key) && - window.console && console.warn - ) - console.warn("unexpected global: " + key) - } -})() diff --git a/lib/zeptojs/test/fixtures/ajax_load_javascript.js b/lib/zeptojs/test/fixtures/ajax_load_javascript.js deleted file mode 100644 index e085da6..0000000 --- a/lib/zeptojs/test/fixtures/ajax_load_javascript.js +++ /dev/null @@ -1 +0,0 @@ -window.testValue = 1; diff --git a/lib/zeptojs/test/fixtures/ajax_load_selector.html b/lib/zeptojs/test/fixtures/ajax_load_selector.html deleted file mode 100644 index 5dcdaad..0000000 --- a/lib/zeptojs/test/fixtures/ajax_load_selector.html +++ /dev/null @@ -1,13 +0,0 @@ - - - - - testAjaxLoad - - -
    ajax load with selector
    -
    - Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. -
    - - diff --git a/lib/zeptojs/test/fixtures/ajax_load_selector_javascript.html b/lib/zeptojs/test/fixtures/ajax_load_selector_javascript.html deleted file mode 100644 index 2d90add..0000000 --- a/lib/zeptojs/test/fixtures/ajax_load_selector_javascript.html +++ /dev/null @@ -1,16 +0,0 @@ - - - - - testAjaxLoad - - -
    ajax load with selector
    -
    - Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. -
    - - - diff --git a/lib/zeptojs/test/fixtures/ajax_load_simple.html b/lib/zeptojs/test/fixtures/ajax_load_simple.html deleted file mode 100644 index d859adb..0000000 --- a/lib/zeptojs/test/fixtures/ajax_load_simple.html +++ /dev/null @@ -1 +0,0 @@ -simple ajax load diff --git a/lib/zeptojs/test/fixtures/iframe_document.html b/lib/zeptojs/test/fixtures/iframe_document.html deleted file mode 100644 index 1e8bf4f..0000000 --- a/lib/zeptojs/test/fixtures/iframe_document.html +++ /dev/null @@ -1 +0,0 @@ -Hello from iframe! diff --git a/lib/zeptojs/test/fixtures/zepto.json b/lib/zeptojs/test/fixtures/zepto.json deleted file mode 100644 index d7c2b76..0000000 --- a/lib/zeptojs/test/fixtures/zepto.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "zepto": "awesomeness" -} diff --git a/lib/zeptojs/test/form.html b/lib/zeptojs/test/form.html deleted file mode 100644 index aaa612b..0000000 --- a/lib/zeptojs/test/form.html +++ /dev/null @@ -1,151 +0,0 @@ - - - - - - - Zepto Form unit tests - - - - - -

    Zepto Form unit tests

    -

    - Running… see browser console for results -

    - -
    -
    - - - - - - - - -
    - - - -
    - - - -
    - - - - - - -
    -
    - - -
    - - - - diff --git a/lib/zeptojs/test/functional/assets.html b/lib/zeptojs/test/functional/assets.html deleted file mode 100644 index 528723e..0000000 --- a/lib/zeptojs/test/functional/assets.html +++ /dev/null @@ -1,61 +0,0 @@ - - - - - Zepto assets functional test - - - - - - - -

    Zepto assets functional test

    - -
    - - - -

    When you run this test without the assets plugin, Mobile Safari will stop loading after on average 8 images (that's on the iPad with 1 MB images). It might also crash.

    -

    PLEASE NOTE: You must restart Safari between runs (click the home button to return to the home screen, double-click the home button, tap-and-hold the Safari icon, then tap the minus badge).

    - -
    - - - - diff --git a/lib/zeptojs/test/functional/fx.html b/lib/zeptojs/test/functional/fx.html deleted file mode 100644 index 5c50a4d..0000000 --- a/lib/zeptojs/test/functional/fx.html +++ /dev/null @@ -1,48 +0,0 @@ - - - - - - - Zepto fx functional test - - - - - - - - -

    Zepto fx functional

    - -
    -
    I ♥ fx
    -
    - -
    -
    I ♥ fx
    -
    - - - - - - - -
    - - - - - -
    - - - - diff --git a/lib/zeptojs/test/functional/gesture.html b/lib/zeptojs/test/functional/gesture.html deleted file mode 100644 index c8513a9..0000000 --- a/lib/zeptojs/test/functional/gesture.html +++ /dev/null @@ -1,38 +0,0 @@ - - - - - Zepto gesture functional test - - - - - - - - - -

    Zepto gestures functional test

    - -
    - gesture events test -
    - -
    - - - - diff --git a/lib/zeptojs/test/functional/touch.html b/lib/zeptojs/test/functional/touch.html deleted file mode 100644 index cfd3032..0000000 --- a/lib/zeptojs/test/functional/touch.html +++ /dev/null @@ -1,107 +0,0 @@ - - - - - Zepto touch functional test - - - - - - - - -

    Zepto touch functional test

    - -

    - Browser supports touch events? -
    - - Browser supports MS pointer events? - -

    - -
    - touch events test -
    - -
    - touch events test (scrollable cancel) -
    - -
    - touch events test (scrollable cancel, single tap only) -
    - -
    - - - - diff --git a/lib/zeptojs/test/functional/touchcancel.html b/lib/zeptojs/test/functional/touchcancel.html deleted file mode 100644 index 62535bb..0000000 --- a/lib/zeptojs/test/functional/touchcancel.html +++ /dev/null @@ -1,60 +0,0 @@ - - - - - Zepto touch functional test - - - - - - - - -

    Zepto touch functional test

    - -

    - Double-tap and hold until the JavaScript alert occurs. After closing the - alert, tap again. Without touchcancel you will see a double tap instead of a tap. -

    - -
    - touch events test -
    - -
    - - - - diff --git a/lib/zeptojs/test/fx.html b/lib/zeptojs/test/fx.html deleted file mode 100644 index fe05d3c..0000000 --- a/lib/zeptojs/test/fx.html +++ /dev/null @@ -1,312 +0,0 @@ - - - - - - - Zepto Fx unit tests - - - - - - -

    Zepto Fx unit tests

    -

    - Running… see browser console for results -

    - -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    - -
    - - - - diff --git a/lib/zeptojs/test/index.html b/lib/zeptojs/test/index.html deleted file mode 100644 index c930fd3..0000000 --- a/lib/zeptojs/test/index.html +++ /dev/null @@ -1,70 +0,0 @@ - - - - - - - Zepto tests - - -

    Zepto tests

    -

    - This file is provided for manual testing. If there's a test failure, - please report the user agent: - -

    -

    - Start a test server with (you'll need to have npm installed):
    -
    - $ npm install (if you haven't installed dependencies yet)
    - $ npm run-script start -

    - On your device, go to
    - http://your-ip-address:3000/test -

    -

    - To start a test, click or tap it. Use the back button of - your browser to return to this index page. - Functional tests may require manual interaction. -

    - -

    Default modules unit tests

    - - -

    Other modules unit test

    - - -

    Functional tests

    - - - - diff --git a/lib/zeptojs/test/ios3.html b/lib/zeptojs/test/ios3.html deleted file mode 100644 index 9e3354a..0000000 --- a/lib/zeptojs/test/ios3.html +++ /dev/null @@ -1,62 +0,0 @@ - - - - - - - Zepto iOS3 unit tests - - - - -

    Zepto iOS3 unit tests

    -

    - Running… see browser console for results -

    - - - diff --git a/lib/zeptojs/test/runner.coffee b/lib/zeptojs/test/runner.coffee deleted file mode 100644 index f4a1610..0000000 --- a/lib/zeptojs/test/runner.coffee +++ /dev/null @@ -1,72 +0,0 @@ -# Test runner for PhantomJS -# Usage: -# $ phantomjs test/runner.coffee [, , ...] -# -# When no test pages specified, runs all automated tests. - -system = require('system') -fs = require('fs') - -args = system.args.slice(1) -prefix = args.shift() || "file://#{fs.workingDirectory}/" - -if args.length > 0 - # list of test pages to run - suites = args -else - # by default, run all test/*.html pages - modules = 'zepto ajax callbacks data deferred ajax_deferred detect touch event form fx selector stack'.split /\s+/ - suites = modules.map (name)-> "test/#{name}.html" - -page = require('webpage').create() - -page.onConsoleMessage = (msg) -> - console.log msg - -page.onError = (msg, trace) -> - console.log 'ERROR: ' + msg - -# used for waiting until the tests finish running -waitFor = (testFn, onReady, timeout=30000) -> - start = new Date() - interval = setInterval -> - if testFn() - clearInterval interval - onReady() - else if new Date() - start > timeout - console.log "timed out." - phantom.exit(1) - , 100 - -loadNextSuite = -> - if not suites.length - phantom.exit() - else - url = suites.shift() + "?verbosity=WARN" - # PhantomJS chokes on the query string on relative paths - url = prefix + url if not /:\/\//.test url - - page.open url, (status) -> - if status isnt "success" - console.log "failed opening #{url}" - phantom.exit(1) - - waitFor -> - page.evaluate -> - # the "#results" element needs to have the "finished" class - res = document.getElementById 'results' - /finished/.test res.className if res - , -> - passed = page.evaluate -> - res = document.getElementById 'results' - paths = location.pathname.split('/') - # echo test results to the console - console.log "#{paths[paths.length - 1]} - " + res.textContent - /passed/.test res.className - - if passed - loadNextSuite() - else - phantom.exit(1) - -loadNextSuite() diff --git a/lib/zeptojs/test/selector.html b/lib/zeptojs/test/selector.html deleted file mode 100644 index 1b5e0e6..0000000 --- a/lib/zeptojs/test/selector.html +++ /dev/null @@ -1,91 +0,0 @@ - - - - - - - Zepto Selector unit tests - - - - - - - -

    Zepto Selector unit tests

    -

    - Running… see browser console for results -

    -
    -
    • one
    • two
    -
    look at me!
    - -
      -
    1. child1
    2. -
    3. child2 -
        -
      • child3
      • -
      • child4
      • -
      -
    4. -
    -
    - - - - diff --git a/lib/zeptojs/test/server.coffee b/lib/zeptojs/test/server.coffee deleted file mode 100644 index 1da075d..0000000 --- a/lib/zeptojs/test/server.coffee +++ /dev/null @@ -1,125 +0,0 @@ -express = require 'express' -app = express() -path = require 'path' - -module.exports = app - -project_root = path.resolve(__dirname, '..') -app.use express.static(project_root) -app.use express.static(project_root + 'node_modules/mocha') -app.use express.static(project_root + 'node_modules/chai') - -app.use express.bodyParser() - -mime = (req) -> - type = req.headers['content-type'] or '' - type.split(';')[0] - -dump = (obj) -> - obj = '' unless obj - obj = JSON.stringify(obj) if obj and typeof obj isnt "string" - obj - -cleanTrace = (traceStr) -> - trace = traceStr.split("\n") - filtered = [] - for line in trace - if /\.html:/.test line - line = line.replace(/^.+?@/, '') - line = line.replace(/http:\/\/.+?\//, '') - line = line.replace(/(:\d+):\d+$/, '$1') - filtered.push line - filtered - -browser = (ua) -> - if m = ua.match /(Android .+?);/ - m[1] - else if m = ua.match /(iPhone|iPad|iPod).*?OS ([\d_]+)/ - 'iOS ' + m[2].replace(/_/g, '.') - else if m = ua.match /(Chrome\/[\d.]+)/ - m[1].replace '/', ' ' - else if m = ua.match /(Safari\/[\d.]+)/ - m[1].replace '/', ' ' - else if m = ua.match /(Firefox\/[\d.]+)/ - m[1].replace '/', ' ' - else if m = ua.match /\bMS(IE [\d.]+)/ - m[1] - else - ua - -app.all '/', (req, res) -> - res.redirect '/test' - -app.all '/test/echo=?', (req, res) -> - res.set 'Cache-Control', 'no-cache' - res.send """ - #{req.method} ?#{dump(req.query)} - content-type: #{mime(req)} - accept: #{req.headers['accept']} - #{dump(req.body)} - """ - -app.get '/test/jsonp', (req, res) -> - res.jsonp - query: req.query - hello: 'world' - -# send JSONP response despite callback not being set -app.get '/test/jsonpBlah', (req, res) -> - res.set 'Content-Type', 'text/javascript' - res.send 'blah()' - -app.get '/test/json', (req, res) -> - res.set 'Cache-Control', 'no-cache' - expectedType = req.headers['accept'] - if expectedType is '*/*' or /json/.test expectedType - if req.query.invalid - res.set 'Content-Type', 'application/json' - res.send 'invalidJSON' - else - res.json - query: req.query - hello: 'world' - else - res.send 400, 'FAIL' - -app.post '/test/create', (req, res) -> - res.json - action: 'created' - query: req.query - payload: req.body - -app.all '/test/slow', (req, res) -> - setTimeout -> - res.send 'DONE' - , 200 - -app.get '/test/cached', (req, res) -> - res.set 'Cache-Control', 'max-age=2' - res.set 'Expires', new Date(Date.now() + 2000).toUTCString() - now = new Date() - res.send now.getTime().toString() - -app.get '/test/auth', (req, res) -> - if req.headers.authorization is 'Basic emVwdG86ZG9nZQ==' - res.send 200 - else - res.set 'WWW-Authenticate', "Basic realm=\"#{req.query.realm}\"" - res.send 401 - -app.post '/test/log', (req, res) -> - params = req.body - trace = cleanTrace params.trace - console.log "[%s] %s: %s", browser(req.headers['user-agent']), params.name, params.message - console.log trace.join("\n").replace(/^/mg, ' ') if trace.length - res.send 200 - -app.all '/test/error', (req, res) -> - res.send 500, 'BOOM' - -if process.argv[1] is __filename - port = process.argv[2] - unless port - port = 3000 - console.log "Listening on port #{port}" - app.listen port diff --git a/lib/zeptojs/test/stack.html b/lib/zeptojs/test/stack.html deleted file mode 100644 index d4fb2e7..0000000 --- a/lib/zeptojs/test/stack.html +++ /dev/null @@ -1,73 +0,0 @@ - - - - - - - Zepto Stack unit tests - - - - - -

    Zepto Stack unit tests

    -

    - Running… see browser console for results -

    -
    - -
    -
    -
    12
    -
    - -
    -
    -
    -
    -
    -
    - -
    - - - - diff --git a/lib/zeptojs/test/test.css b/lib/zeptojs/test/test.css deleted file mode 100644 index 98e77a0..0000000 --- a/lib/zeptojs/test/test.css +++ /dev/null @@ -1,61 +0,0 @@ -* { - font-family: -apple-system-font, Helvetica, sans-serif; -} -body { - padding: 1em; -} -a:link, a:visited { color: darkblue; } -#results.failed em { font-style: normal; color: crimson; } -#results.passed em { font-style: normal; color: darkgreen; } -#fixtures { - position: absolute; - top: -10000px; - left: -10000px; -} -#nav { - list-style: none; - padding: 0; - margin: 2em 0 0 0; - font-size: 12px; - max-width: 30em; -} -#nav a { - padding: .8em 1.5em; - background: #eee; - border-top: 2px solid white; - text-decoration: none; - text-transform: uppercase; - letter-spacing: .1em; - display: block; - color: #555; -} -#nav .current a { background: #ccc; color: black; } -#nav a:active { background: #555; color: white; } - -ul { - padding: 0; -} - -li { - list-style-type: none; - padding: 0 0 15px; -} - -li a { - font-size: 16px; - border: 1px solid darkblue; - padding: 3px 10px; - text-decoration: none; -} -li a:visited { - border-color: #888; - color: #aaa; -} - -@media only screen and (max-device-width:480px) { - body { margin: 7px; font-size: small; } - h1 { margin: 0; } - h1, #results { text-align: center; } - #results { min-height: 3em; } - #nav { font-size: 14px; max-width: auto; } -} diff --git a/lib/zeptojs/test/touch.html b/lib/zeptojs/test/touch.html deleted file mode 100644 index 90829e4..0000000 --- a/lib/zeptojs/test/touch.html +++ /dev/null @@ -1,338 +0,0 @@ - - - - - - - Zepto Touch unit tests - - - - - -

    Zepto Touch unit tests

    -

    - Running… see browser console for results -

    - - - - - - diff --git a/lib/zeptojs/test/zepto.html b/lib/zeptojs/test/zepto.html deleted file mode 100644 index 658c7f6..0000000 --- a/lib/zeptojs/test/zepto.html +++ /dev/null @@ -1,3105 +0,0 @@ - - - - - - - Zepto Core unit tests - - - - - - -

    Zepto Core unit tests

    -

    - Running… see browser console for results -

    -
    - -
    -

    - yay - - nay -

    - -
    - -
    -
    Derp
    -
    - -
    -
    Hello
    -
    And
    -
    Goodbye
    -
    - -
    -
    -
    -
    - -
    - -
    -
    - - - - - - - - - - - - - - -
    - - - -
    - -
    -
    -
    -
    - -
    Here is some text
    -
    And some more
    -
    - -
    -
    -
    - -
    -
    -
    -
    - test -
    - -

    - 1 - 2 - 34 - 56 -

    - -

    - 1 - 2 - 34 - 56 -

    - -
    -
    -
    - -
    test
    - -
      -
    • -
        -
      • one
      • -
      • two
      • -
      • three
      • -
      -
        -
      • -
      -
    • -
    - - - -
      12
    - -
      -
    • -
    • -
    • -
    • -
    - -
      -
    • -
    • -
    • -
    • -
    - -
    - - - - -
    -
    - - - - - -
    - - - - - -
    -
    - -
    hi
    -
    hi
    - -
    -
    - -
    - -
    - - - -
    - -
    test
    - -
    hihello
    - -
    hihello
    - -
    12
    - -
    -
    -
    12
    -
    - -
    -
    -
    -
    -
    - -
    -
    -
    -
    -
    - -
    -
    -
    12
    -
    - -
    -
    -
    -
    -
    -
    - -
    -
    -
    -
    - -
    -
    -
    -
    - - - - - - - - - -
    - - - - diff --git a/lib/zeptojs/vendor/evidence.js b/lib/zeptojs/vendor/evidence.js deleted file mode 100644 index 7ced34e..0000000 --- a/lib/zeptojs/vendor/evidence.js +++ /dev/null @@ -1,1059 +0,0 @@ -/* evidence.js, version 0.6 - * - * Copyright (c) 2009 Tobie Langel (http://tobielangel.com) - * - * evidence.js is freely distributable under the terms of an MIT-style license. - *--------------------------------------------------------------------------*/ - -(function(global) { - var originalEvidence = global.Evidence, - originalOnload = global.onload; - - function Evidence() { - TestCase.extend.apply(TestCase, arguments); - } - - function noConflict() { - global.Evidence = originalEvidence; - return Evidence; - } - - Evidence.noConflict = noConflict; - Evidence.VERSION = '0.6'; - -var FILE_REGEXP = /.*?\/(\w+\.html)(.*)/; - -function getNameFromFile() { - return (global.location || '').toString().replace(FILE_REGEXP, '$1'); -} - -function chain(subclass, superclass) { - function Subclass() {} - Subclass.prototype = superclass.prototype; - subclass.prototype = new Subclass(); - subclass.prototype.constructor = subclass; - return subclass; -} - -function defer(block, context) { - if ('setTimeout' in global) { - window.setTimeout(function() { - block.call(context); - }, 10); - } else { - block.call(context); - } -} -function AssertionSkippedError(message) { - this.message = message; -} - -AssertionSkippedError.displayName = 'AssertionSkippedError'; - -(function(p) { - p.name = 'AssertionSkippedError'; -})(AssertionSkippedError.prototype); -Evidence.AssertionSkippedError = AssertionSkippedError; -function AssertionFailedError(message, template, args) { - this.message = message; - this.template = template || ''; - this.args = args; -} - -AssertionFailedError.displayName = 'AssertionFailedError'; - -(function(p) { - p.name = 'AssertionFailedError'; -})(AssertionFailedError.prototype); -Evidence.AssertionFailedError = AssertionFailedError; -function AssertionMessage(message, template, args) { - this.message = message.replace(/%/g, '%%'); - this.template = template || ''; - this.args = args; -} - -AssertionMessage.displayName = 'AssertionMessage'; - -(function(p) { - function toString() { - return UI.printf(this.message + this.template, this.args); - } - p.toString = toString; -})(AssertionMessage.prototype); -Evidence.AssertionMessage = AssertionMessage; - -var Assertions = (function() { - function _assertExpression(expression, message, template) { - /*for (var i=0; i < 100000; i++) { - (function(){})() - }*/ - if (expression) { - this.addAssertion(); - } else { - var args = Array.prototype.slice.call(arguments, 3); - throw new AssertionFailedError(message, template, args); - } - } - - function skip(message) { - throw new AssertionSkippedError(message || 'Skipped!'); - } - - function fail(message) { - this._assertExpression(false, message || 'Flunked!'); - } - - function assert(test, message) { - this._assertExpression( - !!test, - message || 'Failed assertion.', - 'Expected %o to evaluate to true.', test - ); - } - - function refute(test, message) { - this._assertExpression( - !test, - message || 'Failed refutation.', - 'Expected %o to evaluate to false.', test - ); - } - - function assertTrue(test, message) { - this._assertExpression( - (test === true), - message || 'Failed assertion.', - 'Expected %o to be true.', test - ); - } - - function refuteTrue(test, message) { - this._assertExpression( - (test !== true), - message || 'Failed refutation.', - 'Expected %o to not be true.', test - ); - } - - function assertNull(test, message) { - this._assertExpression( - (test === null), - message || 'Failed assertion.', - 'Expected %o to be null.', test - ); - } - - function refuteNull(test, message) { - this._assertExpression( - (test !== null), - message || 'Failed refutation.', - 'Expected %o to not be null.', test - ); - } - - function assertUndefined(test, message) { - this._assertExpression( - (typeof test === 'undefined'), - message || 'Failed assertion.', - 'Expected %o to be undefined.', test - ); - } - - function refuteUndefined(test, message) { - this._assertExpression( - (typeof test !== 'undefined'), - message || 'Failed refutation.', - 'Expected %o to not be undefined.', test - ); - } - - function assertFalse(test, message) { - this._assertExpression( - (test === false), - message || 'Failed assertion.', - 'Expected %o to be false.', test - ); - } - - function refuteFalse(test, message) { - this._assertExpression( - (test !== false), - message || 'Failed refutation.', - 'Expected %o to not be false.', test - ); - } - - function assertEqual(expected, actual, message) { - this._assertExpression( - (expected == actual), - message || 'Failed assertion.', - 'Expected %o to be == to %o.', actual, expected - ); - } - - function refuteEqual(expected, actual, message) { - this._assertExpression( - (expected != actual), - message || 'Failed refutation.', - 'Expected %o to be != to %o.', actual, expected - ); - } - - function assertIdentical(expected, actual, message) { - this._assertExpression( - (expected === actual), - message || 'Failed assertion.', - 'Expected %o to be === to %o.', actual, expected - ); - } - - function refuteIdentical(expected, actual, message) { - this._assertExpression( - (expected !== actual), - message || 'Failed refutation.', - 'Expected %o to be !== to %o.', actual, expected - ); - } - - function assertIn(property, object, message) { - this._assertExpression( - (property in object), - message || 'Failed assertion.', - 'Expected "%s" to be a property of %o.', property, object - ); - } - - function refuteIn(property, object, message) { - this._assertExpression( - !(property in object), - message || 'Failed refutation.', - 'Expected "%s" to not be a property of %o.', property, object - ); - } - - return { - _assertExpression: _assertExpression, - skip: skip, - assert: assert, - refute: refute, - assertNot: refute, - assertTrue: assertTrue, - assertNull: assertNull, - assertUndefined: assertUndefined, - assertFalse: assertFalse, - assertIdentical: assertIdentical, - refuteIdentical: refuteIdentical, - assertEqual: assertEqual, - refuteEqual: refuteEqual, - assertIn: assertIn, - refuteIn: refuteIn, - fail: fail, - flunk: fail - }; -})(); - Evidence.Assertions = Assertions; -function TestCase(methodName) { - this._methodName = methodName; - this.name = methodName; -} - -(function() { - function extend(name, methods) { - function TestCaseSubclass(methodName) { - TestCase.call(this, methodName); - } - - if (!methods) { - methods = name; - name = getNameFromFile(); - } - - chain(TestCaseSubclass, this); - TestCaseSubclass.displayName = name; - TestCaseSubclass.extend = extend; - - for(var prop in methods) { - TestCaseSubclass.prototype[prop] = methods[prop]; - } - TestCase.subclasses.push(TestCaseSubclass); - return TestCaseSubclass; - } - - function AssertionsMixin() {} - AssertionsMixin.prototype = Assertions; - TestCase.prototype = new AssertionsMixin(); - TestCase.constructor = TestCase; - - TestCase.displayName = 'TestCase'; - TestCase.extend = extend; - TestCase.subclasses = []; - TestCase.defaultTimeout = 10000; -})(); - -(function(p) { - function run(result) { - if (result) { this._result = result; } - try { - if (this._nextAssertions) { - this._result.restartTest(this); - this._nextAssertions(this); - } else { - /*this._globalProperties = objectKeys(global);*/ - this._result.startTest(this); - this.setUp(this); - this[this._methodName](this); - } - } catch(e) { - this._filterException(e); - } finally { - if (this._paused) { - this._result.pauseTest(this); - } else { - try { - this.tearDown(this); - } catch(e) { - this._filterException(e); - } finally { - this._nextAssertions = null; - this._result.stopTest(this); - defer(function() { - this.parent.next(); - }, this); - } - } - } - } - - function _filterException(e) { - var name = e.name; - switch(name) { - case 'AssertionFailedError': - this._result.addFailure(this, e); - break; - case 'AssertionSkippedError': - this._result.addSkip(this, e); - break; - default: - this._result.addError(this, e + ('stack' in e ? "\n"+e.stack : '')); - } - } - - function pause(assertions) { - this._paused = true; - var self = this; - if (assertions) { this._nextAssertions = assertions; } - self._timeoutId = global.setTimeout(function() { - self.resume(function() { - self.fail('Test timed out. Testing was not resumed after being paused.'); - }); - }, TestCase.defaultTimeout); - } - - function resume(assertions) { - if (this._paused) { // avoid race conditions - this._paused = false; - global.clearTimeout(this._timeoutId); - if (assertions) { this._nextAssertions = assertions; } - this.run(); - } - } - - function size() { - return 1; - } - - function toString() { - return this.constructor.displayName + '#' + this.name; - } - - function addAssertion() { - this._result.addAssertion(); - } - - p.run = run; - p.addAssertion = addAssertion; - p._filterException = _filterException; - p.pause = pause; - p.resume = resume; - p.size = size; - p.toString = toString; - p.setUp = function() {}; - p.tearDown = function() {}; -})(TestCase.prototype); - Evidence.TestCase = TestCase; -function TestSuite(name, tests) { - this.name = name; - this._tests = []; - if (tests) { - this.push.apply(this, tests); - } -} - -TestSuite.displayName = 'TestSuite'; - -(function(p) { - function run(result) { - this._index = 0; - this._result = result; - result.startSuite(this); - this.next(); - return result; - } - - function next() { - var next = this._tests[this._index]; - if (next) { - this._index++; - next.run(this._result); - } else { - this._result.stopSuite(this); - if (this.parent) { - this.parent.next(); - } else { - this._result.stop(new Date()); - } - } - } - - function push() { - for (var i = 0, length = arguments.length; i < length; i++) { - var test = arguments[i]; - test.parent = this; - this._tests.push(test); - } - } - - function addTest(test) { - test.parent = this; - this._tests.push(test); - } - - function addTests(tests) { - for (var i = 0, length = tests.length; i < length; i++) { - this.addTest(tests[i]); - } - } - - function size() { - var tests = this._tests, - length = tests.length, - sum = 0; - - for (var i = 0; i < length; i++) { - sum += tests[i].size(); - } - return sum; - } - - function isEmpty() { - return this.size() === 0; - } - - function toString() { - return this.name; - } - p.run = run; - p.next = next; - p.push = push; - p.size = size; - p.isEmpty = isEmpty; - p.toString = toString; -})(TestSuite.prototype); - Evidence.TestSuite = TestSuite; -function TestRunner() { -} - -TestRunner.displayName = 'TestRunner'; - -(function(p) { - function run(suite) { - suite.parent = null; - var result = this._makeResult(); - result.start(new Date()); - suite.run(result); - return result; - } - - function _makeResult() { - return new TestResult(); - } - - p.run = run; - p._makeResult = _makeResult; -})(TestRunner.prototype); - Evidence.TestRunner = TestRunner; -function TestLoader() { -} - -TestLoader.displayName = 'TestLoader'; - -(function(p) { - function loadTestsFromTestCase(testcaseClass) { - var suite = new TestSuite(testcaseClass.displayName), - props = this.getTestCaseNames(testcaseClass); - for (var i=0; i < props.length; i++) { - suite.push(new testcaseClass(props[i])); - } - return suite; - } - - function loadTestsFromTestCases(testcases) { - var suite = new TestSuite(getNameFromFile()); - for (var i = 0; i < testcases.length; i++) { - var testcase = testcases[i]; - var subSuite = defaultLoader.loadTestsFromTestCase(testcase); - if (!subSuite.isEmpty()) { suite.push(subSuite); } - } - return suite; - } - - function getTestCaseNames(testcaseClass) { - var results = [], - proto = testcaseClass.prototype, - prefix = this.testMethodPrefix; - - for (var property in proto) { - if (property.indexOf(prefix) === 0) { - results.push(property); - } - } - return results.sort(); - } - - function loadRegisteredTestCases() { - return loadTestsFromTestCases(TestCase.subclasses); - } - - p.loadTestsFromTestCase = loadTestsFromTestCase; - p.loadRegisteredTestCases = loadRegisteredTestCases; - p.loadTestsFromTestCases = loadTestsFromTestCases; - p.testMethodPrefix = 'test'; - p.getTestCaseNames = getTestCaseNames; - -})(TestLoader.prototype); - Evidence.TestLoader = TestLoader; -function AutoRunner() { - if (global.console && global.console.log) { - this.logger = Logger; - } else if (Object.prototype.toString.call(global.environment) === '[object Environment]' && global.print) { - this.logger = CommandLineLogger; - } else { - this.logger = PopupLogger; - } - this.autoRun = true; - this.verbosity = Logger.INFO; - this.runner = ConsoleTestRunner; -} - -(function() { - function run(options) { - var autoRunner = new this(); - options = options || autoRunner.retrieveOptions(); - autoRunner.processOptions(options); - if (autoRunner.autoRun) { autoRunner.run() }; - } - - AutoRunner.run = run; - AutoRunner.displayName = 'AutoRunner'; - AutoRunner.LOGGERS = { - console: Logger, - popup: PopupLogger, - command_line: CommandLineLogger - }; - - AutoRunner.RUNNERS = { - console: ConsoleTestRunner - }; -})(); - -(function(p) { - function run() { - var logger = new this.logger(this.verbosity), - runner = new this.runner(logger), - suite = defaultLoader.loadRegisteredTestCases(); - if (suite._tests.length <= 1) { - suite = suite._tests[0]; - } - return runner.run(suite); - } - - function processQueryString(str) { - var results = {}; - str = (str + '').match(/^(?:[^?#]*\?)([^#]+?)(?:#.*)?$/); - str = str && str[1]; - - if (!str) { return results; } - - var pairs = str.split('&'), - length = pairs.length; - if (!length) { return results; } - - for (var i = 0; i < length; i++) { - var pair = pairs[i].split('='), - key = decodeURIComponent(pair[0]), - value = pair[1]; - value = value ? decodeURIComponent(value) : true; - results[key] = value; - } - return results; - } - - function processArguments(args) { // RHINO - var results = {}; - - for (var i = 0; i < args.length; i++) { - var arg = args[i]; - if (arg.indexOf('-') === 0) { - var value = args[i + 1]; - if (value && value.indexOf('-') !== 0) { - i++; - } else { - value = true; - } - results[arg.substr(1)] = value; - } - } - return results; - } - - function retrieveOptions() { - if (global.location) { - return this.processQueryString(global.location); - } - if (global.arguments) { - return this.processArguments(global.arguments); - } - return {}; - } - - function processOptions(options) { - for(var key in options) { - var value = options[key]; - switch(key) { - case 'timeout': - TestCase.defaultTimeout = global.parseFloat(value) * 1000; - break; - case 'run': - this.autoRun = value === 'false' ? false : true; - break; - case 'logger': - this.logger = AutoRunner.LOGGERS[value]; - break; - case 'verbosity': - var i = global.parseInt(value); - this.verbosity = global.isNaN(i) ? Logger[value] : i; - break; - case 'runner': - this.runner = AutoRunner.RUNNERS[value]; - break; - } - } - } - - p.run = run; - p.processQueryString = processQueryString; - p.processArguments = processArguments; - p.retrieveOptions = retrieveOptions; - p.processOptions = processOptions; -})(AutoRunner.prototype); - Evidence.AutoRunner = AutoRunner; -function TestResult() { - this.testCount = 0; - this.assertionCount = 0; - this.skipCount = 0; - this.skips = []; - this.failureCount = 0; - this.failures = []; - this.errors = []; - this.errorCount = 0; - this.testCount = 0; -} - -TestResult.displayName = 'TestResult'; - -(function(p) { - function addAssertion() { - this.assertionCount++; - } - - function addSkip(testcase, reason) { - this.skipCount++; - this.skips.push(reason); - } - - function addFailure(testcase, reason) { - this.failureCount++; - this.failures.push(reason); - } - - function addError(testcase, error) { - this.errorCount++; - this.errors.push(error); - } - - function startTest(testcase) { - this.testCount++; - } - - function stopTest(testcase) {} - - function pauseTest(testcase) {} - - function restartTest(testcase) {} - - function startSuite(suite) {} - - function stopSuite(suite) {} - - function start(t0) { - this.t0 = t0; - } - - function stop(t1) { - this.t1 = t1; - } - - function toString() { - return this.testCount + ' tests, ' + - this.assertionCount + ' assertions, ' + - this.failureCount + ' failures, ' + - this.errorCount + ' errors, ' + - this.skipCount + ' skips'; - } - - p.addAssertion = addAssertion; - p.addSkip = addSkip; - p.addFailure = addFailure; - p.addError = addError; - p.startTest = startTest; - p.stopTest = stopTest; - p.pauseTest = pauseTest; - p.restartTest = restartTest; - p.startSuite = startSuite; - p.stopSuite = stopSuite; - p.start = start; - p.stop = stop; - p.toString = toString; -})(TestResult.prototype); - Evidence.TestResult = TestResult; -var Console = {}; - -function Logger(level) { - if (typeof level !== 'undefined') { - this.level = level; - } -} - -Logger.displayName = 'Logger'; -Logger.LEVELS = ['NOTSET', 'DEBUG', 'INFO', 'WARN', 'ERROR', 'CRITICAL']; -Logger.CRITICAL = 5; -Logger.ERROR = 4; -Logger.WARN = 3; -Logger.INFO = 2; -Logger.DEBUG = 1; -Logger.NOTSET = 0; - -(function(p) { - function critical(template, params) { - this.log(Logger.CRITICAL, template, params); - } - - function error(template, params) { - this.log(Logger.ERROR, template, params); - } - - function warn(template, params) { - this.log(Logger.WARN, template, params); - } - - function info(template, params) { - this.log(Logger.INFO, template, params); - } - - function debug(template, params) { - this.log(Logger.DEBUG, template, params); - } - - function log(level, template, params) { - level = level || Logger.NOTSET; - var c = global.console; - - var method = Logger.LEVELS[level].toLowerCase(); - if (method === 'critical') { method = 'error'; } - method = (method in c) ? method : 'log'; - - if (level >= this.level) { - if (params) { - params = params.slice(0); - params.unshift(template); - c[method].apply(c, params); - } else { - c[method](template); - } - } - } - - p.log = log; - p.critical = critical; - p.error = error; - p.warn = warn; - p.info = info; - p.debug = debug; - p.level = 0; -})(Logger.prototype); -Console.Logger = Logger; -function PopupLogger(level) { - Logger.call(this, level); -} - -chain(PopupLogger, Logger); -PopupLogger.displayName = 'PopupLogger'; - -(function(p) { - var BASIC_STYLES = 'color: #333; background-color: #fff; font-family: monospace; border-bottom: 1px solid #ccc;'; - var STYLES = { - WARN: 'color: #000; background-color: #fc6;', - ERROR: 'color: #f00; background-color: #fcc;', - CRITICAL: 'color: #fff; background-color: #000;' - }; - - function _cleanup(html) { - return html.replace(/</g,'<').replace(/>/g,'>').replace(/&/g,'&').replace(/[\n\r]+/, '
    '); - } - - function _makePopup() { - var popup = global.open('','popup','height=400,width=400'); - var doc = popup.document; - doc.write('\ - \ - \ - \ - Console\ - \ -
    \ - '); - doc.close(); - popup.focus(); - return popup; - } - - function _appendLine(level, msg) { - this.popup = this.popup || this._makePopup(); - var levelName = Logger.LEVELS[level]; - - var html = '
    '; - if (level > Logger.INFO) { - html += ''; - html += levelName; - html += ': '; - } - html += _cleanup(msg); - html += '
    '; - var doc = this.popup.document, - div = doc.createElement('div'); - div.innerHTML = html; - html = div.firstChild; - div = null; - doc.getElementById('evidence_console').appendChild(html); - } - - function log(level, msg, params) { - level = level || Logger.NOTSET; - if (level >= this.level) { - if (params) { - msg = UI.printf(msg, params); - } - this._appendLine(level, msg); - } - } - - p.log = log; - p._makePopup = _makePopup; - p._appendLine = _appendLine; -})(PopupLogger.prototype); -Console.PopupLogger = PopupLogger; -function CommandLineLogger(level) { - Logger.call(this, level); -} - -chain(CommandLineLogger, Logger); -CommandLineLogger.displayName = 'CommandLineLogger'; - -(function(p) { - - function log(level, msg, params) { - level = level || Logger.NOTSET; - if (level >= this.level) { - var prefix = ''; - if (level > Logger.INFO) { - prefix = Logger.LEVELS[level]+ ': '; - } - if (params) { - msg = UI.printf(msg, params); - } - global.print(prefix + msg); - } - } - - p.log = log; -})(CommandLineLogger.prototype); -Console.CommandLineLogger = CommandLineLogger; -function ConsoleTestRunner(logger) { - TestRunner.call(this); - this.logger = logger; -} - -chain(ConsoleTestRunner, TestRunner); -ConsoleTestRunner.displayName = 'ConsoleTestRunner'; - -(function(p) { - function _makeResult() { - return new ConsoleTestResult(this.logger); - } - - p._makeResult = _makeResult; -})(ConsoleTestRunner.prototype); -Console.TestRunner = ConsoleTestRunner; -function ConsoleTestResult(logger) { - TestResult.call(this); - this.logger = logger; -} - -chain(ConsoleTestResult, TestResult); -ConsoleTestResult.displayName = 'ConsoleTestResult'; - -(function(p) { - var _super = TestResult.prototype; - - function addAssertion() { - this.assertionCount++; - } - - function addSkip(testcase, msg) { - _super.addSkip.call(this, testcase, msg); - this.logger.warn('Skipping testcase ' + testcase + ': ' + msg.message); - } - - function addFailure(testcase, msg) { - _super.addFailure.call(this, testcase, msg); - this.logger.error(testcase + ': ' + msg.message + ' ' + msg.template, msg.args); - } - - function addError(testcase, error) { - _super.addError.call(this, testcase, error); - this.logger.error(testcase + ' threw an error. ' + error); - } - - function startTest(testcase) { - _super.startTest.call(this, testcase); - this.logger.debug('Started testcase ' + testcase + '.'); - } - - function stopTest(testcase) { - this.logger.debug('Completed testcase ' + testcase + '.'); - } - - function pauseTest(testcase) { - this.logger.info('Paused testcase ' + testcase + '.'); - } - - function restartTest(testcase) { - this.logger.info('Restarted testcase ' + testcase + '.'); - } - - function startSuite(suite) { - this.logger.info('Started suite ' + suite + '.'); - } - - function stopSuite(suite) { - this.logger.info('Completed suite ' + suite + '.'); - } - - function start(t0) { - _super.start.call(this, t0); - this.logger.info('Started tests.'); - } - - function stop(t1) { - _super.stop.call(this, t1); - this.logger.info('Completed tests in ' + ((t1 - this.t0)/1000) + 's.'); - this.logger.info(this.toString() + '.'); - } - - p.addAssertion = addAssertion; - p.addSkip = addSkip; - p.addFailure = addFailure; - p.addError = addError; - p.startTest = startTest; - p.stopTest = stopTest; - p.pauseTest = pauseTest; - p.restartTest = restartTest; - p.startSuite = startSuite; - p.stopSuite = stopSuite; - p.start = start; - p.stop = stop; -})(ConsoleTestResult.prototype); - - -Console.TestResult = ConsoleTestResult; -var UI = (function() { - function printf(template, args, inspector) { - var parts = [], m, - regexp = /(^%|.%)([a-zA-Z])/, - args = args.splice(0); // clone args - - inspector = inspector || String; - - if (template.length <= 0) { - return ''; - } - while (m = regexp.exec(template)) { - var match = m[0], index = m.index, type, arg; - - if (match.indexOf('%%') === 0) { - parts.push(template.substr(0, index)); - parts.push(match.substr(1)); - } else { - parts.push(template.substr(0, match.indexOf('%' === 0) ? index + 1 : index)); - type = m[2]; - arg = args.shift(); - arg = inspector(arg, type); - parts.push(arg); - } - template = template.substr(index + match.length); - } - parts.push(template); - return parts.join(''); - } - - return { - printf: printf, - Console: Console - }; -})(); - Evidence.UI = UI; - - var defaultLoader = new TestLoader(); - Evidence.defaultLoader = defaultLoader; - - global.Evidence = Evidence; - - if (global.location) { - global.onload = function() { - if (typeof originalOnload === 'function') { - originalOnload.call(global); - } - AutoRunner.run(); - }; - } else if (global.arguments) { - var runtime = java.lang.Runtime.getRuntime(); - var thread = new java.lang.Thread(function() { - AutoRunner.run(); - }); - runtime.addShutdownHook(thread); - } - -})(this); diff --git a/package.json b/package.json index caf944b..05df84f 100644 --- a/package.json +++ b/package.json @@ -1,32 +1,60 @@ { - "name": "bellows", - "repository" : { - "type" : "git", - "url" : "https://github.com/mobify/bellows.git" + "name": "bellows-ui", + "repository": { + "type": "git", + "url": "git+https://github.com/mobify/bellows.git" }, - "version": "5.1.2", - "description": "A mobile first accordion UI plugin", + "version": "6.0.0", + "description": "A mobile-first JavaScript-driven accordion UI plugin", "devDependencies": { - "grunt": "~0.4.x", - "grunt-contrib-uglify": "~0.1.1", - "grunt-css": "~0.5.4", - "grunt-shell": "~0.2.1", - "grunt-contrib-clean": "~0.5.0", - "grunt-contrib-connect": "~0.9.0", - "grunt-contrib-watch": "~0.5.1", - "grunt-contrib-copy": "~0.4.1", - "grunt-autoprefixer": "~2.0.0", - "grunt-contrib-sass": "~0.8.1", - "grunt-contrib-jshint": "0.10.0", - "grunt-version": "^0.3.0", - "jshint": "2.5.0", - "grunt-jscs-checker": "0.4.1", - "mobify-code-style": "0.0.3", - "grunt-mocha-phantomjs": "~0.3.2", - "grunt-open": "^0.2.3", - "mocha": "~1.14.0", - "chai": "~1.9.0", - "requirejs-glob": "git+ssh://git@github.com:mobify/requirejs-glob.git" + "chai": "1.9.2", + "gremlins.js": "0.1.0", + "grunt": "0.4.5", + "grunt-autoprefixer": "2.0.0", + "grunt-contrib-clean": "0.5.0", + "grunt-contrib-connect": "0.9.0", + "grunt-contrib-copy": "0.4.1", + "grunt-contrib-uglify": "0.8.1", + "grunt-contrib-watch": "0.5.3", + "grunt-eslint": "17.3.2", + "grunt-mocha-phantomjs": "0.3.2", + "grunt-open": "0.2.3", + "grunt-sass": "1.1.0", + "grunt-sass-lint": "git+https://github.com/mobify/grunt-sass-lint.git#toggle-rules-in-src", + "grunt-shell": "0.2.2", + "grunt-version": "0.3.3", + "mobify-code-style": "^2.4.2", + "mocha": "1.14.0", + "node-sass-import-once": "1.2.0", + "plugin": "git+https://github.com/mobify/plugin.git#3.1.0", + "requirejs": "2.2.0", + "requirejs-glob": "git+https://github.com/mobify/requirejs-glob.git", + "text": "requirejs/text" }, - "license": "MIT" + "license": "MIT", + "bugs": { + "url": "https://github.com/mobify/bellows/issues" + }, + "homepage": "https://github.com/mobify/bellows#readme", + "main": "dist/bellows.min.js", + "directories": { + "example": "examples", + "test": "tests" + }, + "scripts": { + "test": "grunt test" + }, + "keywords": [ + "accordion", + "mobile", + "first", + "mobile", + "toggle", + "mobify" + ], + "author": "Mobify", + "dependencies": { + "jquery": "2.2.2", + "velocity-animate": "1.2.3" + } } diff --git a/src/js/bellows.js b/src/js/bellows.js index ba2bc91..d781f0c 100644 --- a/src/js/bellows.js +++ b/src/js/bellows.js @@ -6,10 +6,10 @@ 'plugin' ], factory); } else { - var framework = window.Zepto || window.jQuery; + var framework = window.jQuery; factory(framework, framework.Velocity, window.Plugin); } -}(function($, Velocity, Plugin) { +})(function($, Velocity, Plugin) { var cssClasses = { ITEM: 'bellows__item', HEADER: 'bellows__header', @@ -29,9 +29,9 @@ CLICK: 'click.bellows' }; - function Bellows(element, options) { + var Bellows = function(element, options) { Bellows.__super__.call(this, element, options, Bellows.DEFAULTS); - } + }; Bellows.VERSION = '0'; @@ -66,7 +66,7 @@ /** * Ghetto Event Delegation™ - + TODO: Re-evalute this for new default of jQuery Zepto doesn't support descendant selectors in event delegation, so we compare against the closest bellows to ensure we are invoking the event from a direct child, not a bellows child from a nested bellows. @@ -254,4 +254,4 @@ $('[data-bellows]').bellows(); return $; -})); +}); diff --git a/src/style/bellows-theme.scss b/src/style/bellows-theme.scss index d99e03e..0d289b4 100644 --- a/src/style/bellows-theme.scss +++ b/src/style/bellows-theme.scss @@ -11,13 +11,13 @@ $active-header-background: #2980b9; padding: 15px 20px; border: 1px solid $active-header-background; border-width: 0 0 1px; - + background: $header-background; - + color: white; - + -webkit-tap-highlight-color: rgba(black, 0); - + &:active { background: $active-header-background; } @@ -25,22 +25,22 @@ $active-header-background: #2980b9; &::before, &::after { content: ''; - + position: absolute; top: 50%; right: 20px; z-index: 2; - + display: block; width: 16px; height: 4px; margin-top: -2px; - + background: white; - pointer-events: none; - transition: transform 0.25s ease-in-out; + + pointer-events: none; } &::before { @@ -55,18 +55,18 @@ $active-header-background: #2980b9; .bellows__item.bellows--is-open > &, .bellows__item.bellows--is-opening > & { - &::before { + &::before { transform: rotate(180deg); } &::after { transform: rotate(360deg); } - + } .bellows__item.bellows--is-closing > & { - + } .bellows__item:last-child > & { @@ -84,8 +84,8 @@ $active-header-background: #2980b9; .bellows__content { padding: 20px; border: 1px solid #ecf0f1; - + .bellows { margin-top: 20px; } -} \ No newline at end of file +} diff --git a/src/style/bellows.scss b/src/style/bellows.scss index 1d55ef3..26a5709 100644 --- a/src/style/bellows.scss +++ b/src/style/bellows.scss @@ -9,10 +9,10 @@ .bellows__item.bellows--is-closing { > .bellows__content-wrapper { // This declaration is necessary for items that are open by default - display: block + display: block; } } .bellows__content-wrapper { display: none; -} \ No newline at end of file +} diff --git a/tasks/config/cssmin.js b/tasks/config/cssmin.js deleted file mode 100644 index f0b595d..0000000 --- a/tasks/config/cssmin.js +++ /dev/null @@ -1,12 +0,0 @@ -module.exports = function(grunt) { - return { - core: { - src: 'dist/bellows.css', - dest: 'dist/bellows.min.css' - }, - style: { - src: 'dist/bellows-theme.css', - dest: 'dist/bellows-theme.min.css' - } - }; -}; \ No newline at end of file diff --git a/tasks/config/eslint.js b/tasks/config/eslint.js new file mode 100644 index 0000000..16f8c1f --- /dev/null +++ b/tasks/config/eslint.js @@ -0,0 +1,20 @@ +module.exports = function(grunt) { + var lint = require('../jslinting'); + + return { + prod: { + src: lint.targets, + options: { + reset: true, + config: require.resolve('mobify-code-style/javascript/.eslintrc-prod') + } + }, + dev: { + src: lint.targets, + options: { + reset: true, + config: require.resolve('mobify-code-style/javascript/.eslintrc') + } + } + }; +}; diff --git a/tasks/config/jscs.js b/tasks/config/jscs.js deleted file mode 100644 index 99a4683..0000000 --- a/tasks/config/jscs.js +++ /dev/null @@ -1,22 +0,0 @@ -module.exports = function(grunt) { - var jslint = require('../jslinting'); - - return { - prod: { - src: jslint.targets, - options: { - force: false, - config: 'node_modules/mobify-code-style/javascript/.jscsrc', - excludeFiles: jslint.excludes - } - }, - dev: { - src: jslint.targets, - options: { - force: true, - config: 'node_modules/mobify-code-style/javascript/.jscsrc', - excludeFiles: jslint.excludes - } - } - }; -}; \ No newline at end of file diff --git a/tasks/config/jshint.js b/tasks/config/jshint.js deleted file mode 100644 index 44b2e97..0000000 --- a/tasks/config/jshint.js +++ /dev/null @@ -1,23 +0,0 @@ -module.exports = function(grunt) { - var jslint = require('../jslinting'); - var jshintrcPath = 'node_modules/mobify-code-style/javascript/.jshintrc'; - - return { - prod: { - src: grunt.option('file') || jslint.targets, - options: { - force: false, - ignores: jslint.excludes, - jshintrc: jshintrcPath - } - }, - dev: { - src: grunt.option('file') || jslint.targets, - options: { - force: true, - ignores: jslint.excludes, - jshintrc: jshintrcPath - } - } - }; -}; \ No newline at end of file diff --git a/tasks/config/open.js b/tasks/config/open.js new file mode 100644 index 0000000..e0d1b13 --- /dev/null +++ b/tasks/config/open.js @@ -0,0 +1,12 @@ +module.exports = function(grunt) { + return { + examples: { + path: 'http://localhost:3000/examples', + app: 'Google Chrome' + }, + tests: { + path: 'http://localhost:8888/tests/runner', + app: 'Google Chrome' + } + }; +}; diff --git a/tasks/config/sass.js b/tasks/config/sass.js index 4bc0ce3..439f14f 100644 --- a/tasks/config/sass.js +++ b/tasks/config/sass.js @@ -1,17 +1,55 @@ module.exports = function(grunt) { + var importOnce = require('node-sass-import-once'); + return { - dist: { + min: { options: { - style: 'nested', - sourcemap: 'none' + outputStyle: 'compressed', + includePaths: [ + 'src/style/', + 'node_modules/' + ], + importer: importOnce, + importOnce: { + index: false, + css: false + } }, files: [{ expand: true, - cwd: 'src/style', - src: ['*.scss'], - dest: 'dist', - ext: '.css' + cwd: 'src/style/', + src: [ + '**/*.scss', + '!node_modules/**/*.scss' + ], + dest: 'dist/', + ext: '.min.css', + }] + }, + unmin: { + options: { + outputStyle: 'expanded', + includePaths: [ + 'src/style/', + 'node_modules/' + ], + importer: importOnce, + importOnce: { + index: false, + css: false + }, + indentWidth: 2 + }, + files: [{ + expand: true, + cwd: 'src/style/', + src: [ + '**/*.scss', + '!node_modules/**/*.scss' + ], + dest: 'dist/', + ext: '.css', }] } }; -}; \ No newline at end of file +}; diff --git a/tasks/config/sasslint.js b/tasks/config/sasslint.js new file mode 100644 index 0000000..34e954e --- /dev/null +++ b/tasks/config/sasslint.js @@ -0,0 +1,12 @@ +module.exports = function(grunt) { + var targets = [ + 'src/**/*.scss' + ]; + + return { + options: { + configFile: require.resolve('mobify-code-style/css/.sass-lint.yml') + }, + target: targets + }; +}; diff --git a/tasks/config/watch.js b/tasks/config/watch.js index fc42d68..f9745b4 100644 --- a/tasks/config/watch.js +++ b/tasks/config/watch.js @@ -1,6 +1,9 @@ module.exports = function(grunt) { return { - files: ["src/**/*"], + files: [ + 'src/**/*', + 'examples/**/*' + ], tasks: ['build'] }; }; diff --git a/tasks/eslint/tasks.js b/tasks/eslint/tasks.js new file mode 100644 index 0000000..b0009f9 --- /dev/null +++ b/tasks/eslint/tasks.js @@ -0,0 +1,6 @@ + +module.exports = function(grunt) { + grunt.registerTask('lint:dev', ['eslint:dev']); + grunt.registerTask('lint:prod', ['eslint:prod']); + grunt.registerTask('lint', ['lint:dev']); +}; diff --git a/tasks/jscs/tasks.js b/tasks/jscs/tasks.js deleted file mode 100644 index efa8b04..0000000 --- a/tasks/jscs/tasks.js +++ /dev/null @@ -1,4 +0,0 @@ - -module.exports = function(grunt) { - grunt.loadNpmTasks("grunt-jscs-checker"); -}; \ No newline at end of file diff --git a/tasks/jshint/tasks.js b/tasks/jshint/tasks.js deleted file mode 100644 index 41bcc80..0000000 --- a/tasks/jshint/tasks.js +++ /dev/null @@ -1,4 +0,0 @@ - -module.exports = function(grunt) { - grunt.loadNpmTasks('grunt-contrib-jshint'); -}; \ No newline at end of file diff --git a/tasks/jslinting.js b/tasks/jslinting.js index 41be6a7..9cd3f04 100644 --- a/tasks/jslinting.js +++ b/tasks/jslinting.js @@ -1,6 +1,5 @@ module.exports = { targets: [ - 'src/js/bellows.js' - ], - excludes: [] -}; \ No newline at end of file + 'src/**/*.js' + ] +}; diff --git a/tasks/lint/tasks.js b/tasks/lint/tasks.js deleted file mode 100644 index 5928284..0000000 --- a/tasks/lint/tasks.js +++ /dev/null @@ -1,6 +0,0 @@ - -module.exports = function(grunt) { - grunt.registerTask('lint:dev', ['jshint:dev', 'jscs:dev']); - grunt.registerTask('lint:prod', ['jshint:prod', 'jscs:prod']); - grunt.registerTask('lint', ['lint:dev']); -}; \ No newline at end of file diff --git a/tests/fixtures/sandbox.html b/tests/fixtures/sandbox.html index da297b5..474037f 100644 --- a/tests/fixtures/sandbox.html +++ b/tests/fixtures/sandbox.html @@ -7,6 +7,6 @@
    - - + + diff --git a/tests/gremlins/config.js b/tests/gremlins/config.js index ffcf159..da7bd82 100644 --- a/tests/gremlins/config.js +++ b/tests/gremlins/config.js @@ -1,10 +1,10 @@ require.config({ baseUrl: '../../', paths: { - 'text': 'bower_components/requirejs-text/text', - 'gremlins': 'bower_components/gremlins.js/gremlins.min', - '$': 'lib/zeptojs/dist/zepto.min', - 'velocity': 'bower_components/mobify-velocity/velocity', + 'text': 'node_modules/text/text', + 'gremlins': 'node_modules/gremlins.js/gremlins.min', + '$': 'node_modules/jquery/dist/jquery', + 'velocity': 'node_modules/velocity-animate/velocity', 'bellows': 'dist/bellows' }, 'shim': { diff --git a/tests/gremlins/index.html b/tests/gremlins/index.html index 7ca9815..5d3492d 100644 --- a/tests/gremlins/index.html +++ b/tests/gremlins/index.html @@ -55,7 +55,6 @@

    Header

    Lorem honeyed locusts sit amet, none so wise, sed do eiusmod never resting ut labore et dolore magna aliqua. Manhood death before disgrace warrior, feed it to the goats spare me your false courtesy commodo consequat. Mace aute irure dolor in reprehenderit poison is a woman's weapon lord of light tower dwarf. The last of the dragons royal, godswood garron sister betrothed officia deserunt mollit anim id est snow.

    - + - diff --git a/tests/runner/index.html b/tests/runner/index.html index 7a0acad..11fba93 100644 --- a/tests/runner/index.html +++ b/tests/runner/index.html @@ -3,12 +3,12 @@ Bellows Tests - +
    - + - \ No newline at end of file + diff --git a/tests/runner/sandbox-config.js b/tests/runner/sandbox-config.js index 2572918..3b63551 100644 --- a/tests/runner/sandbox-config.js +++ b/tests/runner/sandbox-config.js @@ -1,13 +1,13 @@ require.config({ baseUrl: '../../', paths: { - 'text': 'bower_components/requirejs-text/text', + 'text': 'node_modules/text/text', 'fixtures': 'tests/fixtures', - '$': 'lib/zeptojs/dist/zepto', - 'velocity': 'bower_components/mobify-velocity/velocity', + '$': 'node_modules/jquery/dist/jquery', + 'velocity': 'node_modules/velocity-animate/velocity', 'chai': 'node_modules/chai/chai', 'mocha': 'node_modules/mocha/mocha', - 'plugin': 'bower_components/plugin/dist/plugin', + 'plugin': 'node_modules/plugin/dist/plugin', 'bellows': 'dist/bellows' }, 'shim': { diff --git a/tests/runner/test-config.js b/tests/runner/test-config.js index 4a63d31..78ddfe1 100644 --- a/tests/runner/test-config.js +++ b/tests/runner/test-config.js @@ -1,10 +1,10 @@ require.config({ baseUrl: '../../', paths: { - 'text': 'bower_components/requirejs-text/text', + 'text': 'node_modules/text/text', 'glob': 'node_modules/requirejs-glob/lib/glob', 'fixtures': 'tests/fixtures', - '$': 'lib/zeptojs/dist/zepto.min', + '$': 'node_modules/jquery/dist/jquery', 'chai': 'node_modules/chai/chai', 'mocha': 'node_modules/mocha/mocha', 'test-sandbox': 'tests/utils/test-sandbox' diff --git a/tests/unit/plugin.js b/tests/unit/plugin.js index c59557c..d4be056 100644 --- a/tests/unit/plugin.js +++ b/tests/unit/plugin.js @@ -23,8 +23,8 @@ define([ testSandbox.setUp('sandbox', setUpComplete); }); - describe('binding to Zepto\'s fn', function() { - it('defines bellows in Zepto', function() { + describe('binding to jQuery\'s fn', function() { + it('defines bellows in jQuery', function() { var bellows = $.fn.bellows; expect(bellows).to.be.defined;