├── media ├── 1.png ├── 2.png ├── 3.png ├── 4.png ├── 5.png ├── 6.png ├── icon.png ├── click.wav ├── icon16.png ├── icon36.png ├── icon48.png ├── icon72.png ├── icon96.png ├── icon100.png └── icon512.png ├── css ├── img │ └── share.png ├── style.css └── normalize.css ├── config ├── .jshintrc ├── .csslintrc └── .csscomb.json ├── config.xml ├── README.md ├── .gitattributes ├── .gitignore ├── README_ENG.md ├── MIT-LICENSE ├── package.json ├── js ├── storage.js ├── index.js ├── score.js ├── screen.js ├── main.js ├── require-min.js └── zepto.js ├── index.html └── Gruntfile.js /media/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yanhaijing/inverter/HEAD/media/1.png -------------------------------------------------------------------------------- /media/2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yanhaijing/inverter/HEAD/media/2.png -------------------------------------------------------------------------------- /media/3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yanhaijing/inverter/HEAD/media/3.png -------------------------------------------------------------------------------- /media/4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yanhaijing/inverter/HEAD/media/4.png -------------------------------------------------------------------------------- /media/5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yanhaijing/inverter/HEAD/media/5.png -------------------------------------------------------------------------------- /media/6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yanhaijing/inverter/HEAD/media/6.png -------------------------------------------------------------------------------- /media/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yanhaijing/inverter/HEAD/media/icon.png -------------------------------------------------------------------------------- /media/click.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yanhaijing/inverter/HEAD/media/click.wav -------------------------------------------------------------------------------- /media/icon16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yanhaijing/inverter/HEAD/media/icon16.png -------------------------------------------------------------------------------- /media/icon36.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yanhaijing/inverter/HEAD/media/icon36.png -------------------------------------------------------------------------------- /media/icon48.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yanhaijing/inverter/HEAD/media/icon48.png -------------------------------------------------------------------------------- /media/icon72.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yanhaijing/inverter/HEAD/media/icon72.png -------------------------------------------------------------------------------- /media/icon96.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yanhaijing/inverter/HEAD/media/icon96.png -------------------------------------------------------------------------------- /css/img/share.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yanhaijing/inverter/HEAD/css/img/share.png -------------------------------------------------------------------------------- /media/icon100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yanhaijing/inverter/HEAD/media/icon100.png -------------------------------------------------------------------------------- /media/icon512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yanhaijing/inverter/HEAD/media/icon512.png -------------------------------------------------------------------------------- /config/.jshintrc: -------------------------------------------------------------------------------- 1 | { 2 | "asi" : true, 3 | "boss" : true, 4 | "browser" : true, 5 | "debug" : true, 6 | "devel" : true, 7 | "eqeqeq" : false, 8 | "eqnull" : true, 9 | "expr" : true, 10 | "laxbreak" : true, 11 | "unused" : true, 12 | "validthis": true 13 | } 14 | -------------------------------------------------------------------------------- /config.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 变色方块 4 | 5 | 变色方块是一款休闲益智小游戏,适合所有人群,点击方块会改变方块颜色,将所有方块变为蓝色即为胜利。 6 | 7 | 8 | 颜海镜 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 变色方块 [![Built with Grunt](https://cdn.gruntjs.com/builtwith.png)](http://gruntjs.com/) [![license](http://img.shields.io/npm/l/express.svg)](https://github.com/yanhaijing/inverter/MIT-LICENSE) 2 | ======== 3 | 4 | 变色方块是一款休闲益智小游戏,适合所有人群,点击方块会改变方块颜色,将所有方块变为蓝色即为胜利,快快开动你的脑筋,来挑战吧,超有难度哦 5 | 6 | ## 联系方式 7 | 8 | - [Weibo](http://weibo.com/yanhaijing1234 "yanhaijing's Weibo") 9 | - [Email](http://yanhaijing@yeah.net "yanhaijing's Email") 10 | 11 | ## 协议 12 | [https://github.com/yanhaijing/inverter/MIT-LICENSE](MIT-LICENSE) 13 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | 4 | # Custom for Visual Studio 5 | *.cs diff=csharp 6 | *.sln merge=union 7 | *.csproj merge=union 8 | *.vbproj merge=union 9 | *.fsproj merge=union 10 | *.dbproj merge=union 11 | 12 | # Standard to msysgit 13 | *.doc diff=astextplain 14 | *.DOC diff=astextplain 15 | *.docx diff=astextplain 16 | *.DOCX diff=astextplain 17 | *.dot diff=astextplain 18 | *.DOT diff=astextplain 19 | *.pdf diff=astextplain 20 | *.PDF diff=astextplain 21 | *.rtf diff=astextplain 22 | *.RTF diff=astextplain 23 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Windows image file caches 2 | Thumbs.db 3 | ehthumbs.db 4 | 5 | # Folder config file 6 | Desktop.ini 7 | 8 | # Recycle Bin used on file shares 9 | $RECYCLE.BIN/ 10 | 11 | # Windows Installer files 12 | *.cab 13 | *.msi 14 | *.msm 15 | *.msp 16 | 17 | # ========================= 18 | # Operating System Files 19 | # ========================= 20 | 21 | # OSX 22 | # ========================= 23 | 24 | .DS_Store 25 | .AppleDouble 26 | .LSOverride 27 | 28 | # Icon must ends with two \r. 29 | Icon 30 | 31 | # Thumbnails 32 | ._* 33 | 34 | # Files that might appear on external disk 35 | .Spotlight-V100 36 | .Trashes 37 | .project 38 | node_modules 39 | node_modules/ 40 | -------------------------------------------------------------------------------- /README_ENG.md: -------------------------------------------------------------------------------- 1 | Inverter [![Built with Grunt](https://cdn.gruntjs.com/builtwith.png)](http://gruntjs.com/) [![license](http://img.shields.io/npm/l/express.svg)](https://github.com/yanhaijing/inverter/MIT-LICENSE) 2 | ======== 3 | 4 | Inverter is a leisure puzzle game, suitable for everyone. By clicking a square, the color of square block will change. Victory is achieved when all squares are turned to blue. Get your brains ready for this challenge, Inverter is very difficult. 5 | 6 | ## Contact Information 7 | 8 | - [Weibo](http://weibo.com/yanhaijing1234 "yanhaijing's Weibo") 9 | - [Email](http://yanhaijing@yeah.net "yanhaijing's Email") 10 | 11 | ## License 12 | [https://github.com/yanhaijing/inverter/MIT-LICENSE](MIT-LICENSE) 13 | -------------------------------------------------------------------------------- /config/.csslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "adjoining-classes": 2, 3 | "box-sizing": 2, 4 | "box-model": false, 5 | "compatible-vendor-prefixes": 2, 6 | "display-property-grouping": false, 7 | "duplicate-background-images": 2, 8 | "empty-rules": 2, 9 | "floats": false, 10 | "font-sizes": false, 11 | "fallback-colors": 2, 12 | "gradients": false, 13 | "important": false, 14 | "ids": false, 15 | "known-properties": 2, 16 | "non-link-hover": false, 17 | "outline-none": false, 18 | "overqualified-elements": 2, 19 | "qualified-headings": false, 20 | "regex-selectors": false, 21 | "shorthand": 2, 22 | "star-property-hack": false, 23 | "text-indent": false, 24 | "unique-headings": false, 25 | "universal-selector": false, 26 | "unqualified-attributes": false, 27 | "underscore-property-hack": false, 28 | "vendor-prefix": 2, 29 | "zero-units": 2 30 | } 31 | -------------------------------------------------------------------------------- /MIT-LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (C) 2014 yanhaijing 2 | 3 | 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: 4 | 5 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 6 | 7 | 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. -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "inverter", 3 | "version": "1.0.0", 4 | "description": "魔幻方块", 5 | "author": ["yanxuefeng"], 6 | "lastChange": "yanxuefeng", 7 | "path": { 8 | "src": { 9 | "less": "less/", 10 | "css": "style/", 11 | "js": "js/" 12 | }, 13 | "dest": { 14 | "less": "dist/css/", 15 | "css": "dist/css/", 16 | "js": "dist/js/" 17 | }, 18 | "build": { 19 | "less": "css/", 20 | "css": "css/", 21 | "js": "js/" 22 | } 23 | }, 24 | "devDependencies": { 25 | "grunt": "~0.4.2", 26 | "grunt-autoprefixer": "~0.7.3", 27 | "grunt-contrib-concat": "~0.4.0", 28 | "grunt-contrib-clean": "~0.5.0", 29 | "grunt-contrib-csslint": "~0.2.0", 30 | "grunt-contrib-cssmin": "~0.9.0", 31 | "grunt-contrib-less": "~0.11.0", 32 | "grunt-contrib-watch": "~0.6.1", 33 | "grunt-csscomb": "~2.0.1", 34 | "grunt-html-validation": "~0.1.15", 35 | "grunt-banner": "~0.2.2", 36 | "grunt-contrib-copy": "~0.5.0", 37 | "grunt-contrib-uglify": "~0.4.0", 38 | "grunt-html-validation": "~0.1.15", 39 | "grunt-contrib-jshint": "~0.10.0", 40 | "grunt-cssformat": "~0.1.0", 41 | "grunt-contrib-requirejs": "~0.4.4", 42 | "load-grunt-tasks": "~0.4.0" 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /js/storage.js: -------------------------------------------------------------------------------- 1 | define(function () { 2 | /** 3 | * 本地存储类 4 | * @class Storage 5 | * @constructor 6 | * @extends Storage.prototype 7 | */ 8 | var Storage = function(){ 9 | this.init(); 10 | }; 11 | 12 | /** 13 | * 本地存储类原型对象 14 | * @class Storage.prototype 15 | * @static 16 | */ 17 | Storage.prototype = { 18 | /** 19 | * 初始化 20 | * @method init 21 | */ 22 | init:function(){ 23 | function getLocalStorage(){ 24 | var result = false; 25 | if(typeof window.localStorage === 'object'){ 26 | result = localStorage; 27 | }else if(typeof window.globalStorage === 'object'){ 28 | result = window.globalStorage; 29 | } 30 | 31 | return result; 32 | } 33 | 34 | this.storage = getLocalStorage(); 35 | }, 36 | 37 | /** 38 | * 获取本地存储对象 39 | * @method getStorage 40 | * @return {Object} 本地存储对象 41 | */ 42 | getStorage:function(){ 43 | return this.storage; 44 | }, 45 | 46 | /** 47 | * 存储对象 48 | * @method save 49 | * @param {String} key 存的键 50 | * @param {String} value 要存的值 51 | * @return {Bollean} 存储是否成功 52 | */ 53 | save:function(key, value){ 54 | var 55 | storage = this.storage, 56 | list = false; 57 | if(storage !== false){ 58 | list = storage.setItem(key, value); 59 | } 60 | return list; 61 | }, 62 | 63 | /** 64 | * 载入值 65 | * @method getStorage 66 | * @param {String} key 要去得的键 67 | * @return {String} 获取成功返回键值,失败返回'' 68 | */ 69 | load:function(key){ 70 | var 71 | storage = this.storage, 72 | result = ''; 73 | if(storage !== false){ 74 | result = storage.getItem(key); 75 | } 76 | 77 | return result; 78 | } 79 | }; 80 | 81 | return Storage; 82 | }); -------------------------------------------------------------------------------- /js/index.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author YANXUEFENG 3 | */ 4 | 5 | require.config({ 6 | shim: { 7 | 'zepto': { 8 | exports: 'Zepto' 9 | } 10 | } 11 | }); 12 | require(['zepto', 'screen', 'score'], function ($, Screen, Score) { 13 | function ready() { 14 | var 15 | screen = new Screen, 16 | score = new Score, 17 | $pops = $('.js-pop'), 18 | media = new Media("/android_asset/www/media/click.wav", null, function mediaError() {}); 19 | $(function () { 20 | var level = score.getLevel(); 21 | screen.create(level); 22 | }); 23 | 24 | $(document).on('screen/success', function () { 25 | var level; 26 | $('#success-pop').show(); 27 | level = score.addLevel(); 28 | $('#success-pop').find('.js-pop-body').html('即将进入第' + level + '关') 29 | screen.create(level); 30 | window.setTimeout(function () { 31 | $('#success-pop').hide(); 32 | }, 2000); 33 | }).on('screen/click', function () { 34 | media.play(); 35 | score.addClick(); 36 | }).on('score/hightLevel', function () { 37 | $('#success-pop').hide(); 38 | $('#hightLevel-pop').show(); 39 | }); 40 | 41 | $pops.on('tap', function (e) { 42 | $(this).hide(); 43 | }); 44 | $('#restart-game').on('tap', function (e) { 45 | score.reset(); 46 | screen.create(1); 47 | e.preventDefault(); 48 | }); 49 | $('#pop-restart-game').on('tap', function (e) { 50 | $('#restart-game-pop').show(); 51 | e.preventDefault(); 52 | }); 53 | 54 | $('#restart-level').on('tap', function (e) { 55 | screen.create(score.resetLevel()); 56 | e.preventDefault(); 57 | }); 58 | $('#pop-restart-level').on('tap', function (e) { 59 | $('#restart-level-pop').show(); 60 | e.preventDefault(); 61 | }); 62 | 63 | $('#pop-intro').on('tap', function (e) { 64 | $('#intro-pop').show(); 65 | e.preventDefault(); 66 | }); 67 | $('#share').on('tap', function (e) { 68 | e.preventDefault(); 69 | window.plugins.socialsharing.share('变色方块 史上最难智力游戏,非常有趣,快快来体验吧 http://yanhaijing.com/inverter @颜海镜') 70 | }); 71 | $('#hight-share').on('tap', function (e) { 72 | e.preventDefault(); 73 | e.stopPropagation(); 74 | window.plugins.socialsharing.share('变色方块 史上最难智力游戏,我逆天用了' + score.supClick +'次点击,通过了第' + (score.supLevel - 1) + '关,你,你,你快快来挑战我吧,http://yanhaijing.com/inverter @颜海镜') 75 | }); 76 | } 77 | $(document).on('deviceready', ready); 78 | }); 79 | -------------------------------------------------------------------------------- /js/score.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author YANXUEFENG 3 | */ 4 | define(['zepto', 'storage'], function ($, Storage) { 5 | var 6 | Score = function () { 7 | this.init(); 8 | }; 9 | 10 | $.extend(Score.prototype, { 11 | init: function () { 12 | var 13 | storage = new Storage(), 14 | curLevel = parseInt(storage.load('curLevel'), 10) || 1, 15 | supLevel = parseInt(storage.load('supLevel'), 10) || 1, 16 | supClick = parseInt(storage.load('supClick'), 10) || 0, 17 | curClick = parseInt(storage.load('curClick'), 10) || 0, 18 | totalClick = parseInt(storage.load('totalClick'), 10) || 0, 19 | $curLevel = $('#cur-level'), 20 | $supLevel = $('#sup-level'), 21 | $curClick = $('#cur-click'), 22 | $totalClick = $('#total-click'); 23 | 24 | 25 | 26 | this.storage = storage; 27 | 28 | 29 | 30 | this.$curLevel = $curLevel; 31 | this.$supLevel = $supLevel; 32 | this.$curClick = $curClick; 33 | this.$totalClick = $totalClick; 34 | 35 | this.curLevel = curLevel; 36 | this.supLevel = supLevel; 37 | this.supClick = supClick; 38 | this.curClick = curClick; 39 | this.totalClick = totalClick; 40 | 41 | this.updateView(); 42 | }, 43 | getLevel: function () { 44 | return this.curLevel; 45 | }, 46 | addClick: function () { 47 | this.curClick += 1; 48 | this.totalClick += 1; 49 | 50 | this.updateView(); 51 | }, 52 | addLevel: function () { 53 | this.curLevel += 1; 54 | 55 | //判断是否破纪录 56 | if (this.curLevel > this.supLevel || (this.curLevel === this.supLevel && this.supClick > this.totalClick)) { 57 | this.supLevel = this.curLevel; 58 | this.supClick = this.totalClick; 59 | $(document).trigger('score/hightLevel'); 60 | } 61 | 62 | this.save(); 63 | this.updateView(); 64 | return this.curLevel; 65 | }, 66 | resetLevel: function () { 67 | var 68 | storage = this.storage; 69 | this.curLevel = parseInt(storage.load('curLevel'), 10) || 1; 70 | this.curClick = parseInt(storage.load('curClick'), 10) || 0; 71 | this.totalClick = parseInt(storage.load('totalClick'), 10) || 0; 72 | 73 | this.updateView(); 74 | 75 | return this.curLevel; 76 | }, 77 | 78 | reset: function () { 79 | this.curLevel = 1; 80 | this.curClick = 0; 81 | this.totalClick = 0; 82 | 83 | this.updateView(); 84 | }, 85 | save: function() { 86 | var 87 | storage = this.storage; 88 | storage.save('curLevel', this.curLevel); 89 | storage.save('supLevel', this.supLevel); 90 | storage.save('supClick', this.supClick); 91 | storage.save('curClick', this.curClick); 92 | storage.save('totalClick', this.totalClick); 93 | }, 94 | updateView: function () { 95 | this.$curLevel.html(this.curLevel); 96 | this.$supLevel.html(this.supLevel + '(' + this.supClick + '次点击)'); 97 | this.$curClick.html(this.curClick); 98 | this.$totalClick.html(this.totalClick); 99 | } 100 | }); 101 | 102 | return Score; 103 | }); 104 | -------------------------------------------------------------------------------- /css/style.css: -------------------------------------------------------------------------------- 1 | body{ 2 | background-color: #FAF8EF; 3 | } 4 | ul{ 5 | list-style:none; 6 | } 7 | a{ 8 | text-decoration: none; 9 | } 10 | .btn{ 11 | display: inline-block; 12 | margin-bottom: 0; 13 | font-weight: 400; 14 | text-align: center; 15 | vertical-align: middle; 16 | cursor: auto; 17 | background-image: none; 18 | border: 1px solid transparent; 19 | white-space: nowrap; 20 | padding: 6px 12px; 21 | font-size: 14px; 22 | line-height: 1.42857143; 23 | border-radius: 4px; 24 | -webkit-user-select: none; 25 | -moz-user-select: none; 26 | -ms-user-select: none; 27 | user-select: none; 28 | } 29 | .btn:hover, .btn:focus { 30 | color: #333; 31 | text-decoration: none; 32 | } 33 | .btn-primary{ 34 | color: #fff; 35 | background-color: #428bca; 36 | border-color: #357ebd; 37 | } 38 | .btn-success{ 39 | color: #fff; 40 | background-color: #5cb85c; 41 | border-color: #4cae4c; 42 | } 43 | 44 | .btn-primary:hover, .btn-primary:focus, .btn-primary:active{ 45 | color: #fff; 46 | background-color: #3276b1; 47 | border-color: #285e8e; 48 | } 49 | 50 | .btn-success:hover, .btn-success:focus, .btn-success:active{ 51 | color: #fff; 52 | background-color: #47a447; 53 | border-color: #398439; 54 | } 55 | .container{ 56 | margin:auto; 57 | padding:0 10px; 58 | max-width:600px; 59 | } 60 | h1{ 61 | font-family: Microsoft Yahei,tahoma,sans-serif; 62 | } 63 | .share{ 64 | display: inline-block; 65 | width: 20px; 66 | height: 20px; 67 | background: url('img/share.png'); 68 | background-size: 100% 100%; 69 | text-indent: -999px; 70 | vertical-align: middle; 71 | } 72 | .score{ 73 | float:right; 74 | margin-bottom:10px; 75 | } 76 | .score ul{ 77 | margin:0 78 | } 79 | .score span{ 80 | font-weight: bold; 81 | } 82 | .menu{ 83 | margin-bottom:10px; 84 | } 85 | .menu a{ 86 | margin-bottom: 5px; 87 | } 88 | .screen{ 89 | clear:both; 90 | padding:3px; 91 | border-radius:4px; 92 | background:#4D4D4D; 93 | } 94 | .row{ 95 | overflow: hidden; 96 | } 97 | .square{ 98 | float:left; 99 | margin:3px; 100 | border-radius: 3px; 101 | background-color: rgb(230, 171, 94); 102 | } 103 | .square-active{ 104 | background-color: rgb(92, 144, 255); 105 | } 106 | footer{ 107 | text-align:center; 108 | } 109 | .pop{ 110 | display: none; 111 | position: fixed; 112 | top:0; 113 | bottom: 0; 114 | left:0; 115 | right:0; 116 | z-index: 10000; 117 | background: rgba(0,0,0,0.5); 118 | } 119 | .pop-content{ 120 | margin:20% auto 0; 121 | max-width: 400px; 122 | background-color: #fff; 123 | border: 1px solid #999; 124 | border: 1px solid rgba(0,0,0,.2); 125 | border-radius: 6px; 126 | box-shadow: 0 3px 9px rgba(0,0,0,.5); 127 | background-clip: padding-box; 128 | outline: 0; 129 | } 130 | .pop header{ 131 | padding: 0 10px; 132 | border-bottom: 1px solid #e5e5e5; 133 | } 134 | .pop-body{ 135 | padding:15px; 136 | line-height: 1.5; 137 | } 138 | .pop-body li{ 139 | margin-bottom: 5px; 140 | } 141 | .pop footer{ 142 | padding: 10px 10px 10px; 143 | text-align: right; 144 | border-top: 1px solid #e5e5e5; 145 | } 146 | -------------------------------------------------------------------------------- /js/screen.js: -------------------------------------------------------------------------------- 1 | define(['zepto'], function ($) { 2 | 'use strict'; 3 | var 4 | Screen = function () { 5 | this.init(); 6 | }; 7 | 8 | $.extend(Screen.prototype, { 9 | init: function () { 10 | var 11 | $screen = $('#screen'), 12 | width = parseInt($screen.css('width'), 10); 13 | this.$screen = $screen; 14 | this.width = width; 15 | 16 | $screen.height(width); 17 | this.bindEvent(); 18 | }, 19 | reset: function() { 20 | this.$screen.empty(); 21 | this.$squares = $(); 22 | }, 23 | 24 | create: function (n) { 25 | var 26 | i, 27 | $screen = this.$screen, 28 | sWidth = (this.width - 6 * n) / n, 29 | $row = $('
'), 30 | $square = $('
'); 31 | 32 | if (this.n && this.n === n) { 33 | this.$squares.removeClass('square-active'); 34 | return 0; 35 | } 36 | 37 | this.reset(); 38 | this.n = n; 39 | $square.width(sWidth).height(sWidth); 40 | for(i = 0; i < n; i++) { 41 | $row.append($square.clone()); 42 | } 43 | 44 | for(i = 0; i < n; i++) { 45 | $screen.append($row.clone()); 46 | } 47 | 48 | this.$squares = $screen.find('.js-square'); 49 | }, 50 | bindEvent: function () { 51 | var 52 | $screen = this.$screen, 53 | self = this; 54 | 55 | function check($squares) { 56 | return $squares.not('.square-active').length > 0 ? false : true; 57 | } 58 | function find(i, n) { 59 | var 60 | y = Math.floor(i / n), 61 | x = i % n, 62 | res = []; 63 | 64 | res.push(i); 65 | if (y + 1 < n) { 66 | res.push((y + 1) * n + x); 67 | } 68 | 69 | if (y - 1 > -1) { 70 | res.push((y - 1) * n + x); 71 | } 72 | 73 | if (x - 1 > -1) { 74 | res.push(y * n + x - 1); 75 | } 76 | 77 | if (x + 1 < n) { 78 | res.push(y * n + x + 1); 79 | } 80 | 81 | return res; 82 | } 83 | function clickCallback($square, $squares, n) { 84 | var 85 | index = $squares.index($square), 86 | res = find(index, n); 87 | res.forEach(function (val) { 88 | $squares.eq(val).toggleClass('square-active'); 89 | }); 90 | $(document).trigger('screen/click');//派发点击事件 91 | 92 | //判断是否胜利 93 | if (check($squares)) { 94 | $(document).trigger('screen/success');//派发胜利事件事件 95 | } 96 | } 97 | 98 | $screen.on('tap', '.js-square', function (e) { 99 | var $this = $(this); 100 | clickCallback($this, self.$squares, self.n); 101 | }); 102 | } 103 | }); 104 | 105 | return Screen; 106 | }); 107 | -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 8 | 9 | 10 | 变色方块 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 |
23 |

24 | 变色方块 25 | 26 |

27 |
28 | 36 | 41 |
42 | 43 |
44 | 47 |
48 |
49 |
50 |

重玩游戏?

51 |
52 |
53 | 会把你传送到第一关哦?(注意:不会清除最高分数据哦) 54 |
55 |
56 | 57 |
58 |
59 |
60 |
61 |
62 |
63 |

重玩本关?

64 |
65 |
66 | 会把你传送到刚进入本关时的状态。 67 |
68 |
69 | 70 |
71 |
72 |
73 |
74 |
75 |
76 |

游戏介绍

77 |
78 |
79 |
    80 |
  1. 游戏玩法:点击色块,会改变其自身和上下左右相邻色块的颜色。
  2. 81 |
  3. 游戏规则:当全部色块变为蓝色时,即为胜利。
  4. 82 |
83 |
84 | 87 |
88 |
89 |
90 |
91 |
92 |

恭喜过关

93 |
94 |
95 | 即将进入第2关 96 |
97 | 100 |
101 |
102 |
103 |
104 |
105 |

新纪录

106 |
107 |
108 | 恭喜您创造了新记录 109 |
110 | 114 |
115 |
116 |
117 | 118 | 119 | 120 | 121 | -------------------------------------------------------------------------------- /js/main.js: -------------------------------------------------------------------------------- 1 | define("screen",["zepto"],function(e){var t=function(){this.init()};return e.extend(t.prototype,{init:function(){var t=e("#screen"),n=parseInt(t.css("width"),10);this.$screen=t,this.width=n,t.height(n),this.bindEvent()},reset:function(){this.$screen.empty(),this.$squares=e()},create:function(t){var n,r=this.$screen,i=(this.width-6*t)/t,s=e('
'),o=e('
');if(this.n&&this.n===t)return this.$squares.removeClass("square-active"),0;this.reset(),this.n=t,o.width(i).height(i);for(n=0;n0?!1:!0}function i(e,t){var n=Math.floor(e/t),r=e%t,i=[];return i.push(e),n+1-1&&i.push((n-1)*t+r),r-1>-1&&i.push(n*t+r-1),r+1this.supLevel||this.curLevel===this.supLevel&&this.supClick>this.totalClick)this.supLevel=this.curLevel,this.supClick=this.totalClick,e(document).trigger("score/hightLevel");return this.save(),this.updateView(),this.curLevel},resetLevel:function(){var e=this.storage;return this.curLevel=parseInt(e.load("curLevel"),10)||1,this.curClick=parseInt(e.load("curClick"),10)||0,this.totalClick=parseInt(e.load("totalClick"),10)||0,this.updateView(),this.curLevel},reset:function(){this.curLevel=1,this.curClick=0,this.totalClick=0,this.updateView()},save:function(){var e=this.storage;e.save("curLevel",this.curLevel),e.save("supLevel",this.supLevel),e.save("supClick",this.supClick),e.save("curClick",this.curClick),e.save("totalClick",this.totalClick)},updateView:function(){this.$curLevel.html(this.curLevel),this.$supLevel.html(this.supLevel+"("+this.supClick+"次点击)"),this.$curClick.html(this.curClick),this.$totalClick.html(this.totalClick)}}),n}),require.config({shim:{zepto:{exports:"Zepto"}}}),require(["zepto","screen","score"],function(e,t,n){function r(){var r=new t,i=new n,s=e(".js-pop"),o=new Media("/android_asset/www/media/click.wav",null,function(){});e(function(){var e=i.getLevel();r.create(e)}),e(document).on("screen/success",function(){var t;e("#success-pop").show(),t=i.addLevel(),e("#success-pop").find(".js-pop-body").html("即将进入第"+t+"关"),r.create(t),window.setTimeout(function(){e("#success-pop").hide()},2e3)}).on("screen/click",function(){o.play(),i.addClick()}).on("score/hightLevel",function(){e("#success-pop").hide(),e("#hightLevel-pop").show()}),s.on("tap",function(t){e(this).hide()}),e("#restart-game").on("tap",function(e){i.reset(),r.create(1),e.preventDefault()}),e("#pop-restart-game").on("tap",function(t){e("#restart-game-pop").show(),t.preventDefault()}),e("#restart-level").on("tap",function(e){r.create(i.resetLevel()),e.preventDefault()}),e("#pop-restart-level").on("tap",function(t){e("#restart-level-pop").show(),t.preventDefault()}),e("#pop-intro").on("tap",function(t){e("#intro-pop").show(),t.preventDefault()}),e("#share").on("tap",function(e){e.preventDefault(),window.plugins.socialsharing.share("变色方块 史上最难智力游戏,非常有趣,快快来体验吧 http://yanhaijing.com/inverter @颜海镜")}),e("#hight-share").on("tap",function(e){e.preventDefault(),e.stopPropagation(),window.plugins.socialsharing.share("变色方块 史上最难智力游戏,我逆天用了"+i.supClick+"次点击,通过了第"+(i.supLevel-1)+"关,你,你,你快快来挑战我吧,http://yanhaijing.com/inverter @颜海镜")})}e(document).on("deviceready",r)}),define("index",function(){}); -------------------------------------------------------------------------------- /config/.csscomb.json: -------------------------------------------------------------------------------- 1 | { 2 | "always-semicolon": true, 3 | "block-indent": 2, 4 | "colon-space": [0, 1], 5 | "color-case": "lower", 6 | "color-shorthand": true, 7 | 8 | 9 | 10 | 11 | "combinator-space": true, 12 | "element-case": "lower", 13 | "eof-newline": true, 14 | "leading-zero": false, 15 | "remove-empty-rulesets": true, 16 | "rule-indent": 2, 17 | "stick-brace": " ", 18 | "strip-spaces": true, 19 | "unitless-zero": true, 20 | "vendor-prefix-align": true, 21 | "sort-order": [ 22 | [ 23 | "position", 24 | "top", 25 | "right", 26 | "bottom", 27 | "left", 28 | "z-index", 29 | "display", 30 | "float", 31 | "width", 32 | "min-width", 33 | "max-width", 34 | "height", 35 | "min-height", 36 | "max-height", 37 | "-webkit-box-sizing", 38 | "-moz-box-sizing", 39 | "box-sizing", 40 | "-webkit-appearance", 41 | "padding", 42 | "padding-top", 43 | "padding-right", 44 | "padding-bottom", 45 | "padding-left", 46 | "margin", 47 | "margin-top", 48 | "margin-right", 49 | "margin-bottom", 50 | "margin-left", 51 | "overflow", 52 | "overflow-x", 53 | "overflow-y", 54 | "-webkit-overflow-scrolling", 55 | "-ms-overflow-x", 56 | "-ms-overflow-y", 57 | "-ms-overflow-style", 58 | "clip", 59 | "clear", 60 | "font", 61 | "font-family", 62 | "font-size", 63 | "font-style", 64 | "font-weight", 65 | "font-variant", 66 | "font-size-adjust", 67 | "font-stretch", 68 | "font-effect", 69 | "font-emphasize", 70 | "font-emphasize-position", 71 | "font-emphasize-style", 72 | "font-smooth", 73 | "-webkit-hyphens", 74 | "-moz-hyphens", 75 | "hyphens", 76 | "line-height", 77 | "color", 78 | "text-align", 79 | "-webkit-text-align-last", 80 | "-moz-text-align-last", 81 | "-ms-text-align-last", 82 | "text-align-last", 83 | "text-emphasis", 84 | "text-emphasis-color", 85 | "text-emphasis-style", 86 | "text-emphasis-position", 87 | "text-decoration", 88 | "text-indent", 89 | "text-justify", 90 | "text-outline", 91 | "-ms-text-overflow", 92 | "text-overflow", 93 | "text-overflow-ellipsis", 94 | "text-overflow-mode", 95 | "text-shadow", 96 | "text-transform", 97 | "text-wrap", 98 | "-webkit-text-size-adjust", 99 | "-ms-text-size-adjust", 100 | "letter-spacing", 101 | "-ms-word-break", 102 | "word-break", 103 | "word-spacing", 104 | "-ms-word-wrap", 105 | "word-wrap", 106 | "-moz-tab-size", 107 | "-o-tab-size", 108 | "tab-size", 109 | "white-space", 110 | "vertical-align", 111 | "list-style", 112 | "list-style-position", 113 | "list-style-type", 114 | "list-style-image", 115 | "pointer-events", 116 | "cursor", 117 | "visibility", 118 | "zoom", 119 | "flex-direction", 120 | "flex-order", 121 | "flex-pack", 122 | "flex-align", 123 | "table-layout", 124 | "empty-cells", 125 | "caption-side", 126 | "border-spacing", 127 | "border-collapse", 128 | "content", 129 | "quotes", 130 | "counter-reset", 131 | "counter-increment", 132 | "resize", 133 | "-webkit-user-select", 134 | "-moz-user-select", 135 | "-ms-user-select", 136 | "-o-user-select", 137 | "user-select", 138 | "nav-index", 139 | "nav-up", 140 | "nav-right", 141 | "nav-down", 142 | "nav-left", 143 | "background", 144 | "background-color", 145 | "background-image", 146 | "-ms-filter:\\'progid:DXImageTransform.Microsoft.gradient", 147 | "filter:progid:DXImageTransform.Microsoft.gradient", 148 | "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader", 149 | "filter", 150 | "background-repeat", 151 | "background-attachment", 152 | "background-position", 153 | "background-position-x", 154 | "background-position-y", 155 | "-webkit-background-clip", 156 | "-moz-background-clip", 157 | "background-clip", 158 | "background-origin", 159 | "-webkit-background-size", 160 | "-moz-background-size", 161 | "-o-background-size", 162 | "background-size", 163 | "border", 164 | "border-color", 165 | "border-style", 166 | "border-width", 167 | "border-top", 168 | "border-top-color", 169 | "border-top-style", 170 | "border-top-width", 171 | "border-right", 172 | "border-right-color", 173 | "border-right-style", 174 | "border-right-width", 175 | "border-bottom", 176 | "border-bottom-color", 177 | "border-bottom-style", 178 | "border-bottom-width", 179 | "border-left", 180 | "border-left-color", 181 | "border-left-style", 182 | "border-left-width", 183 | "border-radius", 184 | "border-top-left-radius", 185 | "border-top-right-radius", 186 | "border-bottom-right-radius", 187 | "border-bottom-left-radius", 188 | "-webkit-border-image", 189 | "-moz-border-image", 190 | "-o-border-image", 191 | "border-image", 192 | "-webkit-border-image-source", 193 | "-moz-border-image-source", 194 | "-o-border-image-source", 195 | "border-image-source", 196 | "-webkit-border-image-slice", 197 | "-moz-border-image-slice", 198 | "-o-border-image-slice", 199 | "border-image-slice", 200 | "-webkit-border-image-width", 201 | "-moz-border-image-width", 202 | "-o-border-image-width", 203 | "border-image-width", 204 | "-webkit-border-image-outset", 205 | "-moz-border-image-outset", 206 | "-o-border-image-outset", 207 | "border-image-outset", 208 | "-webkit-border-image-repeat", 209 | "-moz-border-image-repeat", 210 | "-o-border-image-repeat", 211 | "border-image-repeat", 212 | "outline", 213 | "outline-width", 214 | "outline-style", 215 | "outline-color", 216 | "outline-offset", 217 | "-webkit-box-shadow", 218 | "-moz-box-shadow", 219 | "box-shadow", 220 | "filter:progid:DXImageTransform.Microsoft.Alpha(Opacity", 221 | "-ms-filter:\\'progid:DXImageTransform.Microsoft.Alpha", 222 | "opacity", 223 | "-ms-interpolation-mode", 224 | "-webkit-transition", 225 | "-moz-transition", 226 | "-ms-transition", 227 | "-o-transition", 228 | "transition", 229 | "-webkit-transition-delay", 230 | "-moz-transition-delay", 231 | "-ms-transition-delay", 232 | "-o-transition-delay", 233 | "transition-delay", 234 | "-webkit-transition-timing-function", 235 | "-moz-transition-timing-function", 236 | "-ms-transition-timing-function", 237 | "-o-transition-timing-function", 238 | "transition-timing-function", 239 | "-webkit-transition-duration", 240 | "-moz-transition-duration", 241 | "-ms-transition-duration", 242 | "-o-transition-duration", 243 | "transition-duration", 244 | "-webkit-transition-property", 245 | "-moz-transition-property", 246 | "-ms-transition-property", 247 | "-o-transition-property", 248 | "transition-property", 249 | "-webkit-transform", 250 | "-moz-transform", 251 | "-ms-transform", 252 | "-o-transform", 253 | "transform", 254 | "-webkit-transform-origin", 255 | "-moz-transform-origin", 256 | "-ms-transform-origin", 257 | "-o-transform-origin", 258 | "transform-origin", 259 | "-webkit-animation", 260 | "-moz-animation", 261 | "-ms-animation", 262 | "-o-animation", 263 | "animation", 264 | "-webkit-animation-name", 265 | "-moz-animation-name", 266 | "-ms-animation-name", 267 | "-o-animation-name", 268 | "animation-name", 269 | "-webkit-animation-duration", 270 | "-moz-animation-duration", 271 | "-ms-animation-duration", 272 | "-o-animation-duration", 273 | "animation-duration", 274 | "-webkit-animation-play-state", 275 | "-moz-animation-play-state", 276 | "-ms-animation-play-state", 277 | "-o-animation-play-state", 278 | "animation-play-state", 279 | "-webkit-animation-timing-function", 280 | "-moz-animation-timing-function", 281 | "-ms-animation-timing-function", 282 | "-o-animation-timing-function", 283 | "animation-timing-function", 284 | "-webkit-animation-delay", 285 | "-moz-animation-delay", 286 | "-ms-animation-delay", 287 | "-o-animation-delay", 288 | "animation-delay", 289 | "-webkit-animation-iteration-count", 290 | "-moz-animation-iteration-count", 291 | "-ms-animation-iteration-count", 292 | "-o-animation-iteration-count", 293 | "animation-iteration-count", 294 | "-webkit-animation-direction", 295 | "-moz-animation-direction", 296 | "-ms-animation-direction", 297 | "-o-animation-direction", 298 | "animation-direction" 299 | ] 300 | ] 301 | } 302 | -------------------------------------------------------------------------------- /css/normalize.css: -------------------------------------------------------------------------------- 1 | /*! normalize.css v3.0.1 | MIT License | git.io/normalize */ 2 | 3 | /** 4 | * 1. Set default font family to sans-serif. 5 | * 2. Prevent iOS text size adjust after orientation change, without disabling 6 | * user zoom. 7 | */ 8 | 9 | html { 10 | font-family: sans-serif; 11 | /* 1 */ 12 | -ms-text-size-adjust: 100%; 13 | /* 2 */ 14 | -webkit-text-size-adjust: 100%; 15 | /* 2 */ 16 | } 17 | 18 | /** 19 | * Remove default margin. 20 | */ 21 | 22 | body { 23 | margin: 0; 24 | } 25 | 26 | /* HTML5 display definitions 27 | ========================================================================== */ 28 | 29 | /** 30 | * Correct `block` display not defined for any HTML5 element in IE 8/9. 31 | * Correct `block` display not defined for `details` or `summary` in IE 10/11 and Firefox. 32 | * Correct `block` display not defined for `main` in IE 11. 33 | */ 34 | 35 | article, 36 | aside, 37 | details, 38 | figcaption, 39 | figure, 40 | footer, 41 | header, 42 | hgroup, 43 | main, 44 | nav, 45 | section, 46 | summary { 47 | display: block; 48 | } 49 | 50 | /** 51 | * 1. Correct `inline-block` display not defined in IE 8/9. 52 | * 2. Normalize vertical alignment of `progress` in Chrome, Firefox, and Opera. 53 | */ 54 | 55 | audio, 56 | canvas, 57 | progress, 58 | video { 59 | display: inline-block; 60 | /* 1 */ 61 | vertical-align: baseline; 62 | /* 2 */ 63 | } 64 | 65 | /** 66 | * Prevent modern browsers from displaying `audio` without controls. 67 | * Remove excess height in iOS 5 devices. 68 | */ 69 | 70 | audio:not([controls]) { 71 | display: none; 72 | height: 0; 73 | } 74 | 75 | /** 76 | * Address `[hidden]` styling not present in IE 8/9/10. 77 | * Hide the `template` element in IE 8/9/11, Safari, and Firefox < 22. 78 | */ 79 | 80 | [hidden], 81 | template { 82 | display: none; 83 | } 84 | 85 | /* Links 86 | ========================================================================== */ 87 | 88 | /** 89 | * Remove the gray background color from active links in IE 10. 90 | */ 91 | 92 | a { 93 | background: transparent; 94 | } 95 | 96 | /** 97 | * Improve readability when focused and also mouse hovered in all browsers. 98 | */ 99 | 100 | a:active, 101 | a:hover { 102 | outline: 0; 103 | } 104 | 105 | /* Text-level semantics 106 | ========================================================================== */ 107 | 108 | /** 109 | * Address styling not present in IE 8/9/10/11, Safari, and Chrome. 110 | */ 111 | 112 | abbr[title] { 113 | border-bottom: 1px dotted; 114 | } 115 | 116 | /** 117 | * Address style set to `bolder` in Firefox 4+, Safari, and Chrome. 118 | */ 119 | 120 | b, 121 | strong { 122 | font-weight: bold; 123 | } 124 | 125 | /** 126 | * Address styling not present in Safari and Chrome. 127 | */ 128 | 129 | dfn { 130 | font-style: italic; 131 | } 132 | 133 | /** 134 | * Address variable `h1` font-size and margin within `section` and `article` 135 | * contexts in Firefox 4+, Safari, and Chrome. 136 | */ 137 | 138 | h1 { 139 | font-size: 2em; 140 | margin: 0.67em 0; 141 | } 142 | 143 | /** 144 | * Address styling not present in IE 8/9. 145 | */ 146 | 147 | mark { 148 | background: #ff0; 149 | color: #000; 150 | } 151 | 152 | /** 153 | * Address inconsistent and variable font size in all browsers. 154 | */ 155 | 156 | small { 157 | font-size: 80%; 158 | } 159 | 160 | /** 161 | * Prevent `sub` and `sup` affecting `line-height` in all browsers. 162 | */ 163 | 164 | sub, 165 | sup { 166 | font-size: 75%; 167 | line-height: 0; 168 | position: relative; 169 | vertical-align: baseline; 170 | } 171 | 172 | sup { 173 | top: -0.5em; 174 | } 175 | 176 | sub { 177 | bottom: -0.25em; 178 | } 179 | 180 | /* Embedded content 181 | ========================================================================== */ 182 | 183 | /** 184 | * Remove border when inside `a` element in IE 8/9/10. 185 | */ 186 | 187 | img { 188 | border: 0; 189 | } 190 | 191 | /** 192 | * Correct overflow not hidden in IE 9/10/11. 193 | */ 194 | 195 | svg:not(:root) { 196 | overflow: hidden; 197 | } 198 | 199 | /* Grouping content 200 | ========================================================================== */ 201 | 202 | /** 203 | * Address margin not present in IE 8/9 and Safari. 204 | */ 205 | 206 | figure { 207 | margin: 1em 40px; 208 | } 209 | 210 | /** 211 | * Address differences between Firefox and other browsers. 212 | */ 213 | 214 | hr { 215 | -moz-box-sizing: content-box; 216 | box-sizing: content-box; 217 | height: 0; 218 | } 219 | 220 | /** 221 | * Contain overflow in all browsers. 222 | */ 223 | 224 | pre { 225 | overflow: auto; 226 | } 227 | 228 | /** 229 | * Address odd `em`-unit font size rendering in all browsers. 230 | */ 231 | 232 | code, 233 | kbd, 234 | pre, 235 | samp { 236 | font-family: monospace, monospace; 237 | font-size: 1em; 238 | } 239 | 240 | /* Forms 241 | ========================================================================== */ 242 | 243 | /** 244 | * Known limitation: by default, Chrome and Safari on OS X allow very limited 245 | * styling of `select`, unless a `border` property is set. 246 | */ 247 | 248 | /** 249 | * 1. Correct color not being inherited. 250 | * Known issue: affects color of disabled elements. 251 | * 2. Correct font properties not being inherited. 252 | * 3. Address margins set differently in Firefox 4+, Safari, and Chrome. 253 | */ 254 | 255 | button, 256 | input, 257 | optgroup, 258 | select, 259 | textarea { 260 | color: inherit; 261 | /* 1 */ 262 | font: inherit; 263 | /* 2 */ 264 | margin: 0; 265 | /* 3 */ 266 | } 267 | 268 | /** 269 | * Address `overflow` set to `hidden` in IE 8/9/10/11. 270 | */ 271 | 272 | button { 273 | overflow: visible; 274 | } 275 | 276 | /** 277 | * Address inconsistent `text-transform` inheritance for `button` and `select`. 278 | * All other form control elements do not inherit `text-transform` values. 279 | * Correct `button` style inheritance in Firefox, IE 8/9/10/11, and Opera. 280 | * Correct `select` style inheritance in Firefox. 281 | */ 282 | 283 | button, 284 | select { 285 | text-transform: none; 286 | } 287 | 288 | /** 289 | * 1. Avoid the WebKit bug in Android 4.0.* where (2) destroys native `audio` 290 | * and `video` controls. 291 | * 2. Correct inability to style clickable `input` types in iOS. 292 | * 3. Improve usability and consistency of cursor style between image-type 293 | * `input` and others. 294 | */ 295 | 296 | button, 297 | html input[type="button"], /* 1 */ 298 | input[type="reset"], 299 | input[type="submit"] { 300 | -webkit-appearance: button; 301 | /* 2 */ 302 | cursor: pointer; 303 | /* 3 */ 304 | } 305 | 306 | /** 307 | * Re-set default cursor for disabled elements. 308 | */ 309 | 310 | button[disabled], 311 | html input[disabled] { 312 | cursor: default; 313 | } 314 | 315 | /** 316 | * Remove inner padding and border in Firefox 4+. 317 | */ 318 | 319 | button::-moz-focus-inner, 320 | input::-moz-focus-inner { 321 | border: 0; 322 | padding: 0; 323 | } 324 | 325 | /** 326 | * Address Firefox 4+ setting `line-height` on `input` using `!important` in 327 | * the UA stylesheet. 328 | */ 329 | 330 | input { 331 | line-height: normal; 332 | } 333 | 334 | /** 335 | * It's recommended that you don't attempt to style these elements. 336 | * Firefox's implementation doesn't respect box-sizing, padding, or width. 337 | * 338 | * 1. Address box sizing set to `content-box` in IE 8/9/10. 339 | * 2. Remove excess padding in IE 8/9/10. 340 | */ 341 | 342 | input[type="checkbox"], 343 | input[type="radio"] { 344 | box-sizing: border-box; 345 | /* 1 */ 346 | padding: 0; 347 | /* 2 */ 348 | } 349 | 350 | /** 351 | * Fix the cursor style for Chrome's increment/decrement buttons. For certain 352 | * `font-size` values of the `input`, it causes the cursor style of the 353 | * decrement button to change from `default` to `text`. 354 | */ 355 | 356 | input[type="number"]::-webkit-inner-spin-button, 357 | input[type="number"]::-webkit-outer-spin-button { 358 | height: auto; 359 | } 360 | 361 | /** 362 | * 1. Address `appearance` set to `searchfield` in Safari and Chrome. 363 | * 2. Address `box-sizing` set to `border-box` in Safari and Chrome 364 | * (include `-moz` to future-proof). 365 | */ 366 | 367 | input[type="search"] { 368 | -webkit-appearance: textfield; /* 1 */ 369 | -moz-box-sizing: content-box; 370 | -webkit-box-sizing: content-box; /* 2 */ 371 | box-sizing: content-box; 372 | } 373 | 374 | /** 375 | * Remove inner padding and search cancel button in Safari and Chrome on OS X. 376 | * Safari (but not Chrome) clips the cancel button when the search input has 377 | * padding (and `textfield` appearance). 378 | */ 379 | 380 | input[type="search"]::-webkit-search-cancel-button, 381 | input[type="search"]::-webkit-search-decoration { 382 | -webkit-appearance: none; 383 | } 384 | 385 | /** 386 | * Define consistent border, margin, and padding. 387 | */ 388 | 389 | fieldset { 390 | border: 1px solid #c0c0c0; 391 | margin: 0 2px; 392 | padding: 0.35em 0.625em 0.75em; 393 | } 394 | 395 | /** 396 | * 1. Correct `color` not being inherited in IE 8/9/10/11. 397 | * 2. Remove padding so people aren't caught out if they zero out fieldsets. 398 | */ 399 | 400 | legend { 401 | border: 0; 402 | /* 1 */ 403 | padding: 0; 404 | /* 2 */ 405 | } 406 | 407 | /** 408 | * Remove default vertical scrollbar in IE 8/9/10/11. 409 | */ 410 | 411 | textarea { 412 | overflow: auto; 413 | } 414 | 415 | /** 416 | * Don't inherit the `font-weight` (applied by a rule above). 417 | * NOTE: the default cannot safely be changed in Chrome and Safari on OS X. 418 | */ 419 | 420 | optgroup { 421 | font-weight: bold; 422 | } 423 | 424 | /* Tables 425 | ========================================================================== */ 426 | 427 | /** 428 | * Remove most spacing between table cells. 429 | */ 430 | 431 | table { 432 | border-collapse: collapse; 433 | border-spacing: 0; 434 | } 435 | 436 | td, 437 | th { 438 | padding: 0; 439 | } -------------------------------------------------------------------------------- /Gruntfile.js: -------------------------------------------------------------------------------- 1 | // 包装函数 2 | module.exports = function(grunt) { 3 | // 强制使用Unix换行符 4 | grunt.util.linefeed = '\n'; 5 | // 任务配置 6 | grunt.initConfig({ 7 | pkg: grunt.file.readJSON('package.json'), 8 | banner: '/*!\n' + 9 | ' * <%= pkg.name %>\n' + 10 | ' * Description: <%= pkg.description %>\n' + 11 | ' * Author: <%= pkg.author %>\n' + 12 | ' * Version: <%= pkg.version %>\n' + 13 | ' * Last Changed by <%= pkg.lastChange %>\n' + 14 | ' * Last Update : <%= grunt.template.today("yyyy-mm-dd hh:MM:ss") %>\n'+ 15 | ' */', 16 | clean:{ 17 | less: { 18 | files: [{src: ['<%= pkg.path.dest.less %>', '<%= pkg.path.build.less %>']}] 19 | }, 20 | css: { 21 | files: [{src: ['<%= pkg.path.dest.css %>', '<%= pkg.path.build.css %>']}] 22 | }, 23 | js: { 24 | files: [{src: ['<%= pkg.path.dest.js %>', '<%= pkg.path.build.js %>']}] 25 | } 26 | }, 27 | less: { 28 | compile: { 29 | options: { 30 | strictMath: true, 31 | strictUnits: true, 32 | sourceMap: true, 33 | outputSourceFiles: true, 34 | sourceMapURL: 'style.css.map', 35 | sourceMapFilename: '<%= pkg.path.dest.less %>style.css.map' 36 | }, 37 | files: [ 38 | {src: ['<%= pkg.path.src.less %>main.less'], dest: '<%= pkg.path.dest.less %>style.css'} 39 | ] 40 | }, 41 | ie: { 42 | options: { 43 | strictMath: true, 44 | strictUnits: true, 45 | sourceMap: true, 46 | outputSourceFiles: true, 47 | sourceMapURL: 'ie.css.map', 48 | sourceMapFilename: '<%= pkg.path.dest.less %>ie.css.map' 49 | }, 50 | files: [ 51 | {src: ['<%= pkg.path.src.less %>ie.less'], dest: '<%= pkg.path.dest.less %>ie.css'} 52 | ] 53 | } 54 | }, 55 | autoprefixer: { 56 | options: { 57 | browsers: ['last 2 versions', 'ie 7', 'ie 8', 'ie 9'], 58 | map: true 59 | }, 60 | less: { 61 | src: '<%= pkg.path.dest.less %>*.css' 62 | }, 63 | css: { 64 | src: '<%= pkg.path.dest.css %>*.css' 65 | } 66 | }, 67 | usebanner: { 68 | options: { 69 | position: 'top', 70 | banner: '<%= banner %>' 71 | }, 72 | less: { 73 | files: [ 74 | {src: ['<%= pkg.path.dest.less %>*.css']} 75 | ] 76 | }, 77 | css: { 78 | files: [ 79 | {src: ['<%= pkg.path.dest.css %>*.css']} 80 | ] 81 | } 82 | }, 83 | csscomb: { 84 | options: { 85 | config: 'config/.csscomb.json' 86 | }, 87 | less: { 88 | files: [ 89 | { 90 | expand: true, //启用动态扩展 91 | cwd: '<%= pkg.path.dest.less %>', //批匹配相对lib目录的src来源 92 | src: '**.css', //实际的匹配模式 93 | dest: '<%= pkg.path.dest.less %>', //目标路径前缀 94 | ext: '.css' //目标文件路径中文件的扩展名. 95 | } 96 | ] 97 | }, 98 | css: { 99 | files: [ 100 | { 101 | expand: true, //启用动态扩展 102 | cwd: '<%= pkg.path.dest.css %>', //批匹配相对lib目录的src来源 103 | src: '**.css', //实际的匹配模式 104 | dest: '<%= pkg.path.dest.css %>', //目标路径前缀 105 | ext: '.css' //目标文件路径中文件的扩展名. 106 | } 107 | ] 108 | } 109 | }, 110 | cssmin: { 111 | options: { 112 | compatibility: ['ie7', 'ie8'], 113 | keepSpecialComments: '*', 114 | keepBreaks: true 115 | }, 116 | less: { 117 | files: [ 118 | { 119 | expand: true, //启用动态扩展 120 | cwd: '<%= pkg.path.dest.less %>', //批匹配相对lib目录的src来源 121 | src: '**.css', //实际的匹配模式 122 | dest: '<%= pkg.path.dest.less %>', //目标路径前缀 123 | ext: '.min.css' //目标文件路径中文件的扩展名. 124 | } 125 | ] 126 | }, 127 | css: { 128 | files: [ 129 | { 130 | expand: true, //启用动态扩展 131 | cwd: '<%= pkg.path.dest.css %>', //批匹配相对lib目录的src来源 132 | src: '**.css', //实际的匹配模式 133 | dest: '<%= pkg.path.dest.css %>', //目标路径前缀 134 | ext: '.min.css' //目标文件路径中文件的扩展名. 135 | } 136 | ] 137 | } 138 | }, 139 | cssformat: { 140 | options: {indent: '\t'}, 141 | less: { 142 | files: [ 143 | { 144 | expand: true, //启用动态扩展 145 | cwd: '<%= pkg.path.dest.less %>', //批匹配相对lib目录的src来源 146 | src: '**.min.css', //实际的匹配模式 147 | dest: '<%= pkg.path.dest.less %>', //目标路径前缀 148 | ext: '.min.css' //目标文件路径中文件的扩展名. 149 | } 150 | ] 151 | }, 152 | css: { 153 | files: [ 154 | { 155 | expand: true, //启用动态扩展 156 | cwd: '<%= pkg.path.dest.css %>', //批匹配相对lib目录的src来源 157 | src: '**.min.css', //实际的匹配模式 158 | dest: '<%= pkg.path.dest.css %>', //目标路径前缀 159 | ext: '.min.css' //目标文件路径中文件的扩展名. 160 | } 161 | ] 162 | } 163 | }, 164 | csslint: { 165 | options: { 166 | csslintrc: 'config/.csslintrc' 167 | }, 168 | less: { 169 | files: [{ 170 | src: ['<%= pkg.path.dest.less %>**.css', '!<%= pkg.path.dest.less %>**.min.css'] 171 | }] 172 | }, 173 | css: { 174 | files: [{ 175 | src: ['<%= pkg.path.dest.css %>**.css', '!<%= pkg.path.dest.css %>**.min.css'] 176 | }] 177 | } 178 | }, 179 | copy: { 180 | less: { 181 | files: [ 182 | {src: ['<%= pkg.path.dest.less %>style.min.css'], dest: '<%= pkg.path.build.less %>style.css'}, 183 | {src: ['<%= pkg.path.dest.less %>ie.min.css'], dest: '<%= pkg.path.build.less %>ie.css'} 184 | ] 185 | }, 186 | devless: { 187 | files: [ 188 | {src: ['<%= pkg.path.dest.less %>style.css'], dest: '<%= pkg.path.build.less %>style.css'}, 189 | {src: ['<%= pkg.path.dest.less %>style.css.map'], dest: '<%= pkg.path.build.less %>style.css.map'}, 190 | {src: ['<%= pkg.path.dest.less %>ie.css'], dest: '<%= pkg.path.build.less %>ie.css'}, 191 | {src: ['<%= pkg.path.dest.less %>ie.css.map'], dest: '<%= pkg.path.build.less %>ie.css.map'} 192 | ] 193 | }, 194 | css: { 195 | files: [ 196 | {src: ['<%= pkg.path.dest.css %>style.min.css'], dest: '<%= pkg.path.build.css %>style.css'}, 197 | {src: ['<%= pkg.path.dest.css %>ie.min.css'], dest: '<%= pkg.path.build.css %>ie.css'} 198 | ] 199 | }, 200 | devcss: { 201 | files: [ 202 | {src: ['<%= pkg.path.dest.css %>style.min.css'], dest: '<%= pkg.path.build.css %>style.css'}, 203 | {src: ['<%= pkg.path.dest.css %>style.css.map'], dest: '<%= pkg.path.build.css %>style.css.map'}, 204 | {src: ['<%= pkg.path.dest.css %>ie.min.css'], dest: '<%= pkg.path.build.css %>ie.css'}, 205 | {src: ['<%= pkg.path.dest.css %>ie.css.map'], dest: '<%= pkg.path.build.css %>ie.css.map'} 206 | ] 207 | }, 208 | js: { 209 | files: [ 210 | {src: ['<%= pkg.path.dest.js %>js.min.js'], dest: '<%= pkg.path.build.js %>js.js'} 211 | ] 212 | } 213 | }, 214 | jshint: { 215 | options: { 216 | jshintrc: 'config/.jshintrc' 217 | }, 218 | src: { 219 | src: '<%= pkg.path.src.js %>**.js' 220 | } 221 | }, 222 | concat: { 223 | css: { 224 | files:[ 225 | {src: ['<%= pkg.path.src.css %>*.css', '!<%= pkg.path.src.css %>ie.css'], dest: '<%= pkg.path.dest.css %>style.css'}, 226 | {src: ['<%= pkg.path.src.css %>ie.css'], dest: '<%= pkg.path.dest.css %>ie.css'} 227 | ] 228 | }, 229 | js: { 230 | options: { 231 | banner: '<%= banner %>\n', 232 | stripBanners: false 233 | }, 234 | src: [ 235 | '<%= pkg.path.src.js %>**.js', 236 | ], 237 | dest: '<%= pkg.path.dest.js %>js.js' 238 | } 239 | }, 240 | uglify: { 241 | js: { 242 | options: { 243 | banner: '<%= banner %>\n' 244 | }, 245 | src: '<%= concat.js.dest %>', 246 | dest: '<%= pkg.path.dest.js %>js.min.js' 247 | } 248 | }, 249 | validation: { 250 | options: { 251 | charset: 'utf-8', 252 | doctype: 'HTML5', 253 | failHard: true, 254 | reset: true, 255 | relaxerror: [ 256 | 'Bad value X-UA-Compatible for attribute http-equiv on element meta.', 257 | 'Element img is missing required attribute src.' 258 | ] 259 | }, 260 | files: { 261 | src: '*.html' 262 | } 263 | }, 264 | watch: { 265 | less: { 266 | files: '<%= pkg.path.src.less %>**.less', 267 | tasks: 'dev-less' 268 | }, 269 | css: { 270 | files: '<%= pkg.path.src.css %>**.css', 271 | tasks: 'dev-css' 272 | } 273 | }, 274 | requirejs: { 275 | compile: { 276 | options: { 277 | baseUrl: '<%= pkg.path.src.js %>', 278 | paths: { 279 | zepto: "empty:" 280 | }, 281 | name: 'index', // assumes a production build using almond 282 | out: '<%= pkg.path.build.js %>main.js' 283 | } 284 | } 285 | } 286 | }); 287 | grunt.registerTask('addcss', function () { 288 | var input = grunt.file.read("./dist/css/style.min.css", {encoding: 'utf8'}); 289 | var output = input.replace(/\}/g, ";}"); 290 | grunt.file.write("./dist/css/style.min.css", output, {"./dist/css/style.min.css": 'utf8'}); 291 | }); 292 | // 任务加载 293 | require('load-grunt-tasks')(grunt, {scope: 'devDependencies'}); 294 | grunt.registerTask('dev-less', ['clean:less', 'less', 'autoprefixer:less', 'csscomb:less', 'csslint:less', 'copy:devless']); 295 | grunt.registerTask('build-less', ['clean:less', 'less', 'autoprefixer:less', 'csscomb:less', 'cssmin:less', 'cssformat:less', 'usebanner:less', 'csslint:less', 'copy:less']); 296 | grunt.registerTask('dev-css', ['clean:css', 'concat:css', 'autoprefixer:css', 'csscomb:css', 'cssmin:css', 'cssformat:css', 'csslint:css', 'copy:devcss']); 297 | grunt.registerTask('build-css', ['clean:css', 'concat:css', 'autoprefixer:css', 'csscomb:css', 'cssmin:css', 'cssformat:css', 'usebanner:css', 'csslint:css', 'copy:css']); 298 | grunt.registerTask('build-js', ['jshint', 'concat:js', 'uglify', 'copy:js']); 299 | }; -------------------------------------------------------------------------------- /js/require-min.js: -------------------------------------------------------------------------------- 1 | /* 2 | RequireJS 2.1.14 Copyright (c) 2010-2014, The Dojo Foundation All Rights Reserved. 3 | Available via the MIT or new BSD license. 4 | see: http://github.com/jrburke/requirejs for details 5 | */ 6 | var requirejs,require,define; 7 | (function(ba){function G(b){return"[object Function]"===K.call(b)}function H(b){return"[object Array]"===K.call(b)}function v(b,c){if(b){var d;for(d=0;dthis.depCount&&!this.defined){if(G(l)){if(this.events.error&&this.map.isDefine||g.onError!==ca)try{f=i.execCb(c,l,b,f)}catch(d){a=d}else f=i.execCb(c,l,b,f);this.map.isDefine&&void 0===f&&((b=this.module)?f=b.exports:this.usingExports&& 19 | (f=this.exports));if(a)return a.requireMap=this.map,a.requireModules=this.map.isDefine?[this.map.id]:null,a.requireType=this.map.isDefine?"define":"require",w(this.error=a)}else f=l;this.exports=f;if(this.map.isDefine&&!this.ignore&&(r[c]=f,g.onResourceLoad))g.onResourceLoad(i,this.map,this.depMaps);y(c);this.defined=!0}this.defining=!1;this.defined&&!this.defineEmitted&&(this.defineEmitted=!0,this.emit("defined",this.exports),this.defineEmitComplete=!0)}}else this.fetch()}},callPlugin:function(){var a= 20 | this.map,b=a.id,d=p(a.prefix);this.depMaps.push(d);q(d,"defined",u(this,function(f){var l,d;d=m(aa,this.map.id);var e=this.map.name,P=this.map.parentMap?this.map.parentMap.name:null,n=i.makeRequire(a.parentMap,{enableBuildCallback:!0});if(this.map.unnormalized){if(f.normalize&&(e=f.normalize(e,function(a){return c(a,P,!0)})||""),f=p(a.prefix+"!"+e,this.map.parentMap),q(f,"defined",u(this,function(a){this.init([],function(){return a},null,{enabled:!0,ignore:!0})})),d=m(h,f.id)){this.depMaps.push(f); 21 | if(this.events.error)d.on("error",u(this,function(a){this.emit("error",a)}));d.enable()}}else d?(this.map.url=i.nameToUrl(d),this.load()):(l=u(this,function(a){this.init([],function(){return a},null,{enabled:!0})}),l.error=u(this,function(a){this.inited=!0;this.error=a;a.requireModules=[b];B(h,function(a){0===a.map.id.indexOf(b+"_unnormalized")&&y(a.map.id)});w(a)}),l.fromText=u(this,function(f,c){var d=a.name,e=p(d),P=M;c&&(f=c);P&&(M=!1);s(e);t(j.config,b)&&(j.config[d]=j.config[b]);try{g.exec(f)}catch(h){return w(C("fromtexteval", 22 | "fromText eval for "+b+" failed: "+h,h,[b]))}P&&(M=!0);this.depMaps.push(e);i.completeLoad(d);n([d],l)}),f.load(a.name,n,l,j))}));i.enable(d,this);this.pluginMaps[d.id]=d},enable:function(){V[this.map.id]=this;this.enabling=this.enabled=!0;v(this.depMaps,u(this,function(a,b){var c,f;if("string"===typeof a){a=p(a,this.map.isDefine?this.map:this.map.parentMap,!1,!this.skipMap);this.depMaps[b]=a;if(c=m(L,a.id)){this.depExports[b]=c(this);return}this.depCount+=1;q(a,"defined",u(this,function(a){this.defineDep(b, 23 | a);this.check()}));this.errback&&q(a,"error",u(this,this.errback))}c=a.id;f=h[c];!t(L,c)&&(f&&!f.enabled)&&i.enable(a,this)}));B(this.pluginMaps,u(this,function(a){var b=m(h,a.id);b&&!b.enabled&&i.enable(a,this)}));this.enabling=!1;this.check()},on:function(a,b){var c=this.events[a];c||(c=this.events[a]=[]);c.push(b)},emit:function(a,b){v(this.events[a],function(a){a(b)});"error"===a&&delete this.events[a]}};i={config:j,contextName:b,registry:h,defined:r,urlFetched:S,defQueue:A,Module:Z,makeModuleMap:p, 24 | nextTick:g.nextTick,onError:w,configure:function(a){a.baseUrl&&"/"!==a.baseUrl.charAt(a.baseUrl.length-1)&&(a.baseUrl+="/");var b=j.shim,c={paths:!0,bundles:!0,config:!0,map:!0};B(a,function(a,b){c[b]?(j[b]||(j[b]={}),U(j[b],a,!0,!0)):j[b]=a});a.bundles&&B(a.bundles,function(a,b){v(a,function(a){a!==b&&(aa[a]=b)})});a.shim&&(B(a.shim,function(a,c){H(a)&&(a={deps:a});if((a.exports||a.init)&&!a.exportsFn)a.exportsFn=i.makeShimExports(a);b[c]=a}),j.shim=b);a.packages&&v(a.packages,function(a){var b, 25 | a="string"===typeof a?{name:a}:a;b=a.name;a.location&&(j.paths[b]=a.location);j.pkgs[b]=a.name+"/"+(a.main||"main").replace(ia,"").replace(Q,"")});B(h,function(a,b){!a.inited&&!a.map.unnormalized&&(a.map=p(b))});if(a.deps||a.callback)i.require(a.deps||[],a.callback)},makeShimExports:function(a){return function(){var b;a.init&&(b=a.init.apply(ba,arguments));return b||a.exports&&da(a.exports)}},makeRequire:function(a,e){function j(c,d,m){var n,q;e.enableBuildCallback&&(d&&G(d))&&(d.__requireJsBuild= 26 | !0);if("string"===typeof c){if(G(d))return w(C("requireargs","Invalid require call"),m);if(a&&t(L,c))return L[c](h[a.id]);if(g.get)return g.get(i,c,a,j);n=p(c,a,!1,!0);n=n.id;return!t(r,n)?w(C("notloaded",'Module name "'+n+'" has not been loaded yet for context: '+b+(a?"":". Use require([])"))):r[n]}J();i.nextTick(function(){J();q=s(p(null,a));q.skipMap=e.skipMap;q.init(c,d,m,{enabled:!0});D()});return j}e=e||{};U(j,{isBrowser:z,toUrl:function(b){var d,e=b.lastIndexOf("."),k=b.split("/")[0];if(-1!== 27 | e&&(!("."===k||".."===k)||1e.attachEvent.toString().indexOf("[native code"))&&!Y?(M=!0,e.attachEvent("onreadystatechange",b.onScriptLoad)): 34 | (e.addEventListener("load",b.onScriptLoad,!1),e.addEventListener("error",b.onScriptError,!1)),e.src=d,J=e,D?y.insertBefore(e,D):y.appendChild(e),J=null,e;if(ea)try{importScripts(d),b.completeLoad(c)}catch(m){b.onError(C("importscripts","importScripts failed for "+c+" at "+d,m,[c]))}};z&&!q.skipDataMain&&T(document.getElementsByTagName("script"),function(b){y||(y=b.parentNode);if(I=b.getAttribute("data-main"))return s=I,q.baseUrl||(E=s.split("/"),s=E.pop(),O=E.length?E.join("/")+"/":"./",q.baseUrl= 35 | O),s=s.replace(Q,""),g.jsExtRegExp.test(s)&&(s=I),q.deps=q.deps?q.deps.concat(s):[s],!0});define=function(b,c,d){var e,g;"string"!==typeof b&&(d=c,c=b,b=null);H(c)||(d=c,c=null);!c&&G(d)&&(c=[],d.length&&(d.toString().replace(ka,"").replace(la,function(b,d){c.push(d)}),c=(1===d.length?["require"]:["require","exports","module"]).concat(c)));if(M){if(!(e=J))N&&"interactive"===N.readyState||T(document.getElementsByTagName("script"),function(b){if("interactive"===b.readyState)return N=b}),e=N;e&&(b|| 36 | (b=e.getAttribute("data-requiremodule")),g=F[e.getAttribute("data-requirecontext")])}(g?g.defQueue:R).push([b,c,d])};define.amd={jQuery:!0};g.exec=function(b){return eval(b)};g(q)}})(this); -------------------------------------------------------------------------------- /js/zepto.js: -------------------------------------------------------------------------------- 1 | /* Zepto 1.1.3 - zepto event ajax form ie fx touch - zeptojs.com/license */ 2 | var Zepto=function(){function L(t){return null==t?String(t):T[j.call(t)]||"object"}function A(t){return"function"==L(t)}function D(t){return null!=t&&t==t.window}function _(t){return null!=t&&t.nodeType==t.DOCUMENT_NODE}function Z(t){return"object"==L(t)}function $(t){return Z(t)&&!D(t)&&Object.getPrototypeOf(t)==Object.prototype}function R(t){return"number"==typeof t.length}function k(t){return a.call(t,function(t){return null!=t})}function z(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 q(t){return t in f?f[t]:f[t]=new RegExp("(^|\\s)"+t+"(\\s|$)")}function U(t,e){return"number"!=typeof e||c[F(t)]?e:e+"px"}function H(t){var e,n;return u[t]||(e=s.createElement(t),s.body.appendChild(e),n=getComputedStyle(e,"").getPropertyValue("display"),e.parentNode.removeChild(e),"none"==n&&(n="block"),u[t]=n),u[t]}function I(t){return"children"in t?o.call(t.children):n.map(t.childNodes,function(t){return 1==t.nodeType?t:void 0})}function X(n,i,r){for(e in i)r&&($(i[e])||M(i[e]))?($(i[e])&&!$(n[e])&&(n[e]={}),M(i[e])&&!M(n[e])&&(n[e]=[]),X(n[e],i[e],r)):i[e]!==t&&(n[e]=i[e])}function V(t,e){return null==e?n(t):n(t).filter(e)}function Y(t,e,n,i){return A(e)?e.call(t,n,i):e}function B(t,e,n){null==n?t.removeAttribute(e):t.setAttribute(e,n)}function J(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 W(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,C,P,r=[],o=r.slice,a=r.filter,s=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,g=["val","css","html","text","data","width","height","offset"],v=["after","prepend","before","append"],y=s.createElement("table"),w=s.createElement("tr"),x={tr:s.createElement("tbody"),tbody:y,thead:y,tfoot:y,td:w,th:w,"*":s.createElement("div")},b=/complete|loaded|interactive/,E=/^[\w-]*$/,T={},j=T.toString,S={},N=s.createElement("div"),O={tabindex:"tabIndex",readonly:"readOnly","for":"htmlFor","class":"className",maxlength:"maxLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",rowspan:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder",contenteditable:"contentEditable"},M=Array.isArray||function(t){return t instanceof Array};return S.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=N).appendChild(t),i=~S.qsa(r,e).indexOf(t),o&&N.removeChild(t),i},C=function(t){return t.replace(/-+(.)?/g,function(t,e){return e?e.toUpperCase():""})},P=function(t){return a.call(t,function(e,n){return t.indexOf(e)==n})},S.fragment=function(e,i,r){var a,u,f;return h.test(e)&&(a=n(s.createElement(RegExp.$1))),a||(e.replace&&(e=e.replace(p,"<$1>")),i===t&&(i=l.test(e)&&RegExp.$1),i in x||(i="*"),f=x[i],f.innerHTML=""+e,a=n.each(o.call(f.childNodes),function(){f.removeChild(this)})),$(r)&&(u=n(a),n.each(r,function(t,e){g.indexOf(t)>-1?u[t](e):u.attr(t,e)})),a},S.Z=function(t,e){return t=t||[],t.__proto__=n.fn,t.selector=e||"",t},S.isZ=function(t){return t instanceof S.Z},S.init=function(e,i){var r;if(!e)return S.Z();if("string"==typeof e)if(e=e.trim(),"<"==e[0]&&l.test(e))r=S.fragment(e,RegExp.$1,i),e=null;else{if(i!==t)return n(i).find(e);r=S.qsa(s,e)}else{if(A(e))return n(s).ready(e);if(S.isZ(e))return e;if(M(e))r=k(e);else if(Z(e))r=[e],e=null;else if(l.test(e))r=S.fragment(e.trim(),RegExp.$1,i),e=null;else{if(i!==t)return n(i).find(e);r=S.qsa(s,e)}}return S.Z(r,e)},n=function(t,e){return S.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){X(t,n,e)}),t},S.qsa=function(t,e){var n,i="#"==e[0],r=!i&&"."==e[0],a=i||r?e.slice(1):e,s=E.test(a);return _(t)&&s&&i?(n=t.getElementById(a))?[n]:[]:1!==t.nodeType&&9!==t.nodeType?[]:o.call(s&&!i?r?t.getElementsByClassName(a):t.getElementsByTagName(e):t.querySelectorAll(e))},n.contains=function(t,e){return t!==e&&t.contains(e)},n.type=L,n.isFunction=A,n.isWindow=D,n.isArray=M,n.isPlainObject=$,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=C,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(R(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 A(t)?this.not(this.not(t)):n(a.call(this,function(e){return S.matches(e,t)}))},add:function(t,e){return n(P(this.concat(n(t,e))))},is:function(t){return this.length>0&&S.matches(this[0],t)},not:function(e){var i=[];if(A(e)&&e.call!==t)this.each(function(t){e.call(this,t)||i.push(this)});else{var r="string"==typeof e?this.filter(e):R(e)&&A(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 Z(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&&!Z(t)?t:n(t)},last:function(){var t=this[this.length-1];return t&&!Z(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(S.qsa(this[0],t)):this.map(function(){return S.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:S.matches(i,t));)i=i!==e&&!_(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)&&!_(t)&&e.indexOf(t)<0?(e.push(t),t):void 0});return V(e,t)},parent:function(t){return V(P(this.pluck("parentNode")),t)},children:function(t){return V(this.map(function(){return I(this)}),t)},contents:function(){return this.map(function(){return o.call(this.childNodes)})},siblings:function(t){return V(this.map(function(t,e){return a.call(I(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=H(this.nodeName))})},replaceWith:function(t){return this.before(t).remove()},wrap:function(t){var e=A(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=A(t);return this.each(function(i){var r=n(this),o=r.contents(),a=e?t.call(this,i):t;o.length?o.wrapAll(a):r.append(a)})},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(Y(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(Z(n))for(e in n)B(this,e,n[e]);else B(this,n,Y(this,i,t,this.getAttribute(n)))})},removeAttr:function(t){return this.each(function(){1===this.nodeType&&B(this,t)})},prop:function(e,n){return e=O[e]||e,n===t?this[0]&&this[0][e]:this.each(function(t){this[e]=Y(this,n,t,this[e])})},data:function(e,n){var i=this.attr("data-"+e.replace(m,"-$1").toLowerCase(),n);return null!==i?W(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=Y(this,t,e,this.value)})},offset:function(t){if(t)return this.each(function(e){var i=n(this),r=Y(this,t,e,i.offset()),o=i.offsetParent().offset(),a={top:r.top-o.top,left:r.left-o.left};"static"==i.css("position")&&(a.position="relative"),i.css(a)});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[C(t)]||o.getPropertyValue(t);if(M(t)){var a={};return n.each(M(t)?t:[t],function(t,e){a[e]=r.style[C(e)]||o.getPropertyValue(e)}),a}}var s="";if("string"==L(t))i||0===i?s=F(t)+":"+U(t,i):this.each(function(){this.style.removeProperty(F(t))});else for(e in t)t[e]||0===t[e]?s+=F(e)+":"+U(e,t[e])+";":this.each(function(){this.style.removeProperty(F(e))});return this.each(function(){this.style.cssText+=";"+s})},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(J(t))},q(t)):!1},addClass:function(t){return t?this.each(function(e){i=[];var r=J(this),o=Y(this,t,e,r);o.split(/\s+/g).forEach(function(t){n(this).hasClass(t)||i.push(t)},this),i.length&&J(this,r+(r?" ":"")+i.join(" "))}):this},removeClass:function(e){return this.each(function(n){return e===t?J(this,""):(i=J(this),Y(this,e,n,i).split(/\s+/g).forEach(function(t){i=i.replace(q(t)," ")}),void J(this,i.trim()))})},toggleClass:function(e,i){return e?this.each(function(r){var o=n(this),a=Y(this,e,r,J(this));a.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||s.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,a=this[0];return r===t?D(a)?a["inner"+i]:_(a)?a.documentElement["scroll"+i]:(o=this.offset())&&o[e]:this.each(function(t){a=n(this),a.css(e,Y(this,r,t,a[e]()))})}}),v.forEach(function(t,e){var i=e%2;n.fn[t]=function(){var t,o,r=n.map(arguments,function(e){return t=L(e),"object"==t||"array"==t||null==e?e:S.fragment(e)}),a=this.length>1;return r.length<1?this:this.each(function(t,s){o=i?s:s.parentNode,s=0==e?s.nextSibling:1==e?s.firstChild:2==e?s:null,r.forEach(function(t){if(a)t=t.cloneNode(!0);else if(!o)return n(t).remove();G(o.insertBefore(t,s),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}}),S.Z.prototype=n.fn,S.uniq=P,S.deserializeValue=W,n.zepto=S,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(a[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 g(t){return c[t]||u&&f[t]||t}function v(e,i,r,o,s,u,f){var h=l(e),d=a[h]||(a[h]=[]);i.split(/\s/).forEach(function(i){if("ready"==i)return t(document).ready(r);var a=p(i);a.fn=r,a.sel=s,a.e in c&&(r=function(e){var n=e.relatedTarget;return!n||n!==this&&!t.contains(this,n)?a.fn.apply(this,arguments):void 0}),a.del=u;var l=u||r;a.proxy=function(t){if(t=T(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}},a.i=d.length,d.push(a),"addEventListener"in e&&e.addEventListener(g(a.e),a.proxy,m(a,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 a[o][e.i],"removeEventListener"in t&&t.removeEventListener(g(e.e),e.proxy,m(e,r))})})}function T(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]=w,r&&r.apply(i,arguments)},e[n]=x}),(i.defaultPrevented!==n?i.defaultPrevented:"returnValue"in i?i.returnValue===!1:i.getPreventDefault&&i.getPreventDefault())&&(e.isDefaultPrevented=w)),e}function j(t){var e,i={originalEvent:t};for(e in t)b.test(e)||t[e]===n||(i[e]=t[e]);return T(i,t)}var n,e=1,i=Array.prototype.slice,r=t.isFunction,o=function(t){return"string"==typeof t},a={},s={},u="onfocusin"in window,f={focus:"focusin",blur:"focusout"},c={mouseenter:"mouseover",mouseleave:"mouseout"};s.click=s.mousedown=s.mouseup=s.mousemove="MouseEvents",t.event={add:v,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 w=function(){return!0},x=function(){return!1},b=/^([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,a,s,u,f){var c,l,h=this;return e&&!o(e)?(t.each(e,function(t,e){h.on(t,a,s,e,f)}),h):(o(a)||r(u)||u===!1||(u=s,s=a,a=n),(r(s)||s===!1)&&(u=s,s=n),u===!1&&(u=x),h.each(function(n,r){f&&(c=function(t){return y(r,t.type,u),u.apply(this,arguments)}),a&&(l=function(e){var n,o=t(e.target).closest(a,r).get(0);return o&&o!==r?(n=t.extend(j(e),{currentTarget:o,liveFired:r}),(c||u).apply(o,[n].concat(i.call(arguments,1)))):void 0}),v(r,e,u,s,a,l||c)}))},t.fn.off=function(e,i,a){var s=this;return e&&!o(e)?(t.each(e,function(t,e){s.off(t,i,e)}),s):(o(i)||r(a)||a===!1||(a=i,i=n),a===!1&&(a=x),s.each(function(){y(this,e,a,i)}))},t.fn.trigger=function(e,n){return e=o(e)||t.isPlainObject(e)?t.Event(e):T(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(a,s){i=j(o(e)?t.Event(e):e),i._args=n,i.target=s,t.each(h(s,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(s[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),T(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 g(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 v(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 w(){}function x(t){return t&&(t=t.split(";",2)[0]),t&&(t==f?"html":t==u?"json":a.test(t)?"script":s.test(t)&&"xml")||"text"}function b(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=b(e.url,e.data),e.data=void 0)}function T(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 S(e,n,i,r){var o,a=t.isArray(n),s=t.isPlainObject(n);t.each(n,function(n,u){o=t.type(u),r&&(n=i?r:r+"["+(s||"object"==o||"array"==o?n:"")+"]"),!r&&a?e.add(u.name,u.value):"array"==o||!i&&"object"==o?S(e,u,i,n):e.add(n,u)})}var i,r,e=0,n=window.document,o=/)<[^<]*)*<\/script>/gi,a=/^(?:text|application)\/javascript/i,s=/^(?: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,a=(t.isFunction(o)?o():o)||"jsonp"+ ++e,s=n.createElement("script"),u=window[a],c=function(e){t(s).triggerHandler("error",e||"abort")},l={abort:c};return r&&r.promise(l),t(s).on("load error",function(e,n){clearTimeout(h),t(s).off().remove(),"error"!=e.type&&f?g(f[0],l,i,r):v(null,n||"error",l,i,r),window[a]=u,f&&t.isFunction(u)&&u(f[0]),u=f=void 0}),m(l,i)===!1?(c("abort"),l):(window[a]=function(){f=arguments},s.src=i.url.replace(/\?(.+)=\?/,"?$1="+a),n.head.appendChild(s),i.timeout>0&&(h=setTimeout(function(){c("timeout")},i.timeout)),l)},t.ajaxSettings={type:"GET",beforeSend:w,success:w,error:w,complete:w,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=b(n.url,"_="+Date.now()));var a=n.dataType,s=/\?.+=\?/.test(n.url);if("jsonp"==a||s)return s||(n.url=b(n.url,n.jsonp?n.jsonp+"=?":n.jsonp===!1?"":"callback=?")),t.ajaxJSONP(n,o);var T,u=n.accepts[a],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=w,clearTimeout(T);var e,i=!1;if(d.status>=200&&d.status<300||304==d.status||0==d.status&&"file:"==h){a=a||x(n.mimeType||d.getResponseHeader("content-type")),e=d.responseText;try{"script"==a?(1,eval)(e):"xml"==a?e=d.responseXML:"json"==a&&(e=c.test(e)?null:t.parseJSON(e))}catch(r){i=r}i?v(i,"parsererror",d,n,o):g(e,d,n,o)}else v(d.statusText||null,d.status?"error":"abort",d,n,o)}},m(d,n)===!1)return d.abort(),v(null,"abort",d,n,o),d;if(n.xhrFields)for(r in n.xhrFields)d[r]=n.xhrFields[r];var j="async"in n?n.async:!0;d.open(n.type,n.url,j,n.username,n.password);for(r in f)y.apply(d,f[r]);return n.timeout>0&&(T=setTimeout(function(){d.onreadystatechange=w,d.abort(),v(null,"timeout",d,n,o)},n.timeout)),d.send(n.data?n.data:null),d},t.get=function(){return t.ajax(T.apply(null,arguments))},t.post=function(){var e=T.apply(null,arguments);return e.type="POST",t.ajax(e)},t.getJSON=function(){var e=T.apply(null,arguments);return e.dataType="json",t.ajax(e)},t.fn.load=function(e,n,i){if(!this.length)return this;var s,r=this,a=e.split(/\s/),u=T(e,n,i),f=u.success;return a.length>1&&(u.url=a[0],s=a[1]),u.success=function(e){r.html(s?t("
").html(e.replace(o,"")).find(s):e),f&&f.apply(r,arguments)},t.ajax(u),this};var j=encodeURIComponent;t.param=function(t,e){var n=[];return n.add=function(t,e){this.push(j(t)+"="+j(e))},S(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){"__proto__"in{}||t.extend(t.zepto,{Z:function(e,n){return e=e||[],t.extend(e,t.fn),e.selector=n||"",e.__Z=!0,e},isZ:function(e){return"array"===t.type(e)&&"__Z"in e}});try{getComputedStyle(void 0)}catch(e){var n=getComputedStyle;window.getComputedStyle=function(t){try{return n(t)}catch(e){return null}}}}(Zepto),function(t,e){function x(t){return t.replace(/([a-z])([A-Z])/,"$1-$2").toLowerCase()}function b(t){return i?i+t:t.toLowerCase()}var i,c,l,h,p,d,m,g,v,y,n="",a={Webkit:"webkit",Moz:"",O:"o"},s=window.document,u=s.createElement("div"),f=/^((translate|rotate|scale)(X|Y|Z|3d)?|matrix(3d)?|perspective|skew(X|Y)?)$/i,w={};t.each(a,function(t,r){return u.style[t+"TransitionProperty"]!==e?(n="-"+t.toLowerCase()+"-",i=r,!1):void 0}),c=n+"transform",w[l=n+"transition-property"]=w[h=n+"transition-duration"]=w[d=n+"transition-delay"]=w[p=n+"transition-timing-function"]=w[m=n+"animation-name"]=w[g=n+"animation-duration"]=w[y=n+"animation-delay"]=w[v=n+"animation-timing-function"]="",t.fx={off:i===e&&u.style.transitionProperty===e,speeds:{_default:400,fast:200,slow:600},cssPrefix:n,transitionEnd:b("TransitionEnd"),animationEnd:b("AnimationEnd")},t.fn.animate=function(n,i,r,o,a){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,a=i.delay,i=i.duration),i&&(i=("number"==typeof i?i:t.fx.speeds[i]||t.fx.speeds._default)/1e3),a&&(a=parseFloat(a)/1e3),this.anim(n,i,r,o,a)},t.fn.anim=function(n,i,r,o,a){var s,b,j,u={},E="",T=this,S=t.fx.transitionEnd,C=!1;if(i===e&&(i=t.fx.speeds._default/1e3),a===e&&(a=0),t.fx.off&&(i=0),"string"==typeof n)u[m]=n,u[g]=i+"s",u[y]=a+"s",u[v]=r||"linear",S=t.fx.animationEnd;else{b=[];for(s in n)f.test(s)?E+=s+"("+n[s]+") ":(u[s]=n[s],b.push(x(s)));E&&(u[c]=E,b.push(c)),i>0&&"object"==typeof n&&(u[l]=b.join(", "),u[h]=i+"s",u[d]=a+"s",u[p]=r||"linear")}return j=function(e){if("undefined"!=typeof e){if(e.target!==e.currentTarget)return;t(e.target).unbind(S,j)}else t(this).unbind(S,j);C=!0,t(this).css(w),o&&o.call(this)},i>0&&(this.bind(S,j),setTimeout(function(){C||j.call(T)},1e3*i+25)),this.size()&&this.get(0).clientLeft,this.css(u),0>=i&&setTimeout(function(){T.each(function(){j.call(this)})},0),this},u=null}(Zepto),function(t){function u(t,e,n,i){return Math.abs(t-e)>=Math.abs(n-i)?t-e>0?"Left":"Right":n-i>0?"Up":"Down"}function f(){o=null,e.last&&(e.el.trigger("longTap"),e={})}function c(){o&&clearTimeout(o),o=null}function l(){n&&clearTimeout(n),i&&clearTimeout(i),r&&clearTimeout(r),o&&clearTimeout(o),n=i=r=o=null,e={}}function h(t){return("touch"==t.pointerType||t.pointerType==t.MSPOINTER_TYPE_TOUCH)&&t.isPrimary}function p(t,e){return t.type=="pointer"+e||t.type.toLowerCase()=="mspointer"+e}var n,i,r,o,s,e={},a=750;t(document).ready(function(){var d,m,y,w,g=0,v=0;"MSGesture"in window&&(s=new MSGesture,s.target=document.body),t(document).bind("MSGestureEnd",function(t){var n=t.velocityX>1?"Right":t.velocityX<-1?"Left":t.velocityY>1?"Down":t.velocityY<-1?"Up":null;n&&(e.el.trigger("swipe"),e.el.trigger("swipe"+n))}).on("touchstart MSPointerDown pointerdown",function(i){(!(w=p(i,"down"))||h(i))&&(y=w?i:i.touches[0],i.touches&&1===i.touches.length&&e.x2&&(e.x2=void 0,e.y2=void 0),d=Date.now(),m=d-(e.last||d),e.el=t("tagName"in y.target?y.target:y.target.parentNode),n&&clearTimeout(n),e.x1=y.pageX,e.y1=y.pageY,m>0&&250>=m&&(e.isDoubleTap=!0),e.last=d,o=setTimeout(f,a),s&&w&&s.addPointer(i.pointerId))}).on("touchmove MSPointerMove pointermove",function(t){(!(w=p(t,"move"))||h(t))&&(y=w?t:t.touches[0],c(),e.x2=y.pageX,e.y2=y.pageY,g+=Math.abs(e.x1-e.x2),v+=Math.abs(e.y1-e.y2))}).on("touchend MSPointerUp pointerup",function(o){(!(w=p(o,"up"))||h(o))&&(c(),e.x2&&Math.abs(e.x1-e.x2)>30||e.y2&&Math.abs(e.y1-e.y2)>30?r=setTimeout(function(){e.el.trigger("swipe"),e.el.trigger("swipe"+u(e.x1,e.x2,e.y1,e.y2)),e={}},0):"last"in e&&(30>g&&30>v?i=setTimeout(function(){var i=t.Event("tap");i.cancelTouch=l,e.el.trigger(i),e.isDoubleTap?(e.el&&e.el.trigger("doubleTap"),e={}):n=setTimeout(function(){n=null,e.el&&e.el.trigger("singleTap"),e={}},250)},0):e={}),g=v=0)}).on("touchcancel MSPointerCancel pointercancel",l),t(window).on("scroll",l)}),["swipe","swipeLeft","swipeRight","swipeUp","swipeDown","doubleTap","tap","singleTap","longTap"].forEach(function(e){t.fn[e]=function(t){return this.on(e,t)}})}(Zepto); --------------------------------------------------------------------------------