From 1013e61ece599bab3ed9924cf52b1a24dbcd5e08 Mon Sep 17 00:00:00 2001 From: "M.J" <1069988144@qq.com> Date: Wed, 15 Jul 2015 13:52:59 +0800 Subject: [PATCH] Ver 1.0.0 --- css/Mexam.css | 373 ++++++++++++++++++++++++ css/normalize.css | 424 +++++++++++++++++++++++++++ fonts/Mexam.eot | Bin 0 -> 6780 bytes fonts/Mexam.svg | 55 ++++ fonts/Mexam.ttf | Bin 0 -> 6496 bytes fonts/Mexam.woff | Bin 0 -> 4268 bytes gulpfile.js | 22 ++ index.html | 114 ++++++++ js/Mexam.js | 721 ++++++++++++++++++++++++++++++++++++++++++++++ js/Mexam.min.js | 14 + js/zepto.min.js | 2 + 11 files changed, 1725 insertions(+) create mode 100644 css/Mexam.css create mode 100644 css/normalize.css create mode 100644 fonts/Mexam.eot create mode 100644 fonts/Mexam.svg create mode 100644 fonts/Mexam.ttf create mode 100644 fonts/Mexam.woff create mode 100644 gulpfile.js create mode 100644 index.html create mode 100644 js/Mexam.js create mode 100644 js/Mexam.min.js create mode 100644 js/zepto.min.js diff --git a/css/Mexam.css b/css/Mexam.css new file mode 100644 index 0000000..dc78648 --- /dev/null +++ b/css/Mexam.css @@ -0,0 +1,373 @@ +/** + * @name Mexam + * @desc 移动端题库做题插件,只支持,单选题,多选题,判断题 + * @depend Zepto + * @author M.J + * @date 2015-07-09 + * @URL http://webjyh.com + * @reutn {Mexam} + * @version 1.0.0 + * @license MIT + * + * @PS If you have any questions, please don't look for me, I don't know anything. thank you. + */ +@font-face { + font-family: "Mexam"; + src: url('../fonts/Mexam.eot'); /* IE9*/ + src: url('../fonts/Mexam.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */ + url('../fonts/Mexam.woff') format('woff'), /* chrome、firefox */ + url('../fonts/Mexam.ttf') format('truetype'), /* chrome、firefox、opera、Safari, Android, iOS 4.2+*/ + url('../fonts/Mexam.svg#iconfont') format('svg'); /* iOS 4.1- */ +} +.Mexam-icon { + font-family: "Mexam" !important; + font-size: 16px; + font-style: normal; + -webkit-font-smoothing: antialiased; + -webkit-text-stroke-width: 0.2px; + -moz-osx-font-smoothing: grayscale; +} +.Mexam-liebiao:before { content: "\e602"; } +.Mexam-shijian:before { content: "\e600"; } +.Mexam-loading:before { content: "\e603"; } + +.ui-Mexam-wrapper { + background-color: #FFF; + font-family: 'Open Sans', 'Helvetica Neue', Arial, 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif; + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; + z-index: 10000; + visibility: visible; + -webkit-text-size-adjust: none; + text-size-adjust: none; +} + +.ui-Mexam-wrapper > header { + position: absolute; + top: 0px; + left: 0; + width: 100%; + height: 44px; + background-color: #31bcc1; +} + +.ui-Mexam-back, +.ui-Mexam-preview { + height: 44px; + line-height: 44px; + left: 0; + position: absolute; + top: 0; + width: 44px; +} + +.ui-Mexam-preview { + left: auto; + right: 0px; +} + +.ui-Mexam-back > a, +.ui-Mexam-preview > a { + display: block; + width: 100%; + height: 100%; + text-align: center; + color: #FFF; + text-decoration: none; + text-indent: -12px; + font-size: 24px; + -webkit-transition: background .3s; + transition: background .3s; +} + +.ui-Mexam-preview > a { + text-indent: 0; +} + +.ui-Mexam-back a:active, +.ui-Mexam-preview a:active { + background-color: rgba(0, 0, 0, 0.2); +} + +.ui-Mexam-time { + position: absolute; + top: 0; + left: 40px; + right: 40px; + height: 44px; + line-height: 44px; + height: 100%; + text-align: center; + margin: 0; + padding: 0; + font-size: 24px; + color: #FFF; + font-weight: normal; +} +.ui-Mexam-time > .Mexam-icon { + font-size: 24px; +} + +.ui-Mexam-title { + position: absolute; + top: 44px; + left: 0px; + right: 0px; + padding: 0px 10px; + height: 40px; + font-size: 16px; + border-bottom: 3px solid #e0e0e0; + overflow: hidden; +} + +.ui-Mexam-title > h3 { + margin: 0; + padding: 0; + font-weight: normal; + font-size: 16px; + line-height: 40px; + overflow: hidden; + white-space: nowrap; + text-overflow: ellipsis; +} + +.ui-Mexam-title > span { + float: right; + display: block; + height: 40px; + line-height: 40px; +} + +.ui-Mexam-title > span > em { + color: #31bcc1; + font-size: 20px; + font-style: normal; + padding-right: 5px; +} +.ui-Mexam-title > span i { + padding-left: 5px; +} + +.ui-Mexam-main, +.ui-Mexam-loading { + position: absolute; + top: 87px; + left: 0px; + right: 0px; + bottom: 0px; + z-index: 10; + overflow: hidden; +} + +.ui-Mexam-loading { + z-index: 20; + background: #FFF; + opacity: 0; + visibility: hidden; + -webkit-transition: all .3s; + transition: all .3s; +} + +.ui-Mexam-loading.ui-Mexam-show { + opacity: 1; + visibility: visible; +} + +.ui-Mexam-loading > span { + position: absolute; + top: 50%; + left: 50%; + width: 36px; + height: 36px; + line-height: 36px; + text-align: center; + font-size: 36px; + margin: -18px 0px 0px -18px; + color: #666; + -webkit-animation: MexamRotate .8s linear infinite; + animation: doRotate .8s linear infinite; +} + +.ui-Mexam-view, +.ui-Mexam-list { + list-style: none; + padding: 0; + margin: 0; + width: 100%; + height: 100%; +} + +.ui-Mexam-list { + position: absolute; + top: 0; + left: 0; + overflow: hidden; +} + +.ui-Mexam-list > li { + padding: 0px; + width: 100%; + height: 100%; + display: inline-block; + overflow: hidden; + vertical-align: top; + -webkit-tap-highlight-color: rgba(0, 0, 0, 0); +} + +.ui-Mexam-list > li > div > h2 { + font-weight: normal; + padding: 15px 15px 0px; + margin: 0 0 20px 0; + font-size: 18px; + line-height: 1.6; +} + +.ui-Mexam-list > li > div > ol { + list-style: none; + padding: 0 0 20px 0; + margin: 0; + -webkit-transition: background 0.3s; + transition: background 0.3s; +} + +.ui-Mexam-list > li > div > ol > li { + padding: 10px 15px; +} + +.ui-Mexam-list > li > div > ol > li + li { + margin-top: 10px; +} + +.ui-Mexam-list > li > div > ol > li:active { + background-color: rgba(0, 0, 0, 0.05); +} + +.ui-Mexam-list > li > div > ol > li > span { + display: block; + float: left; + width: 35px; + height: 35px; + border-radius: 50%; + text-align: center; + line-height: 35px; + border: 1px solid #31bcc1; + color: #31bcc1; +} + +.ui-Mexam-list > li > div > ol > li.active > span { + background-color: #31bcc1; + color: #FFF; +} + +.ui-Mexam-list > li > div > ol > li > p { + margin: 0 0 0 45px; + font-size: 16px; + display: table; + min-height: 35px; + color: #666; + line-height: 1.6; +} + +.ui-Mexam-list > li > div > ol > li > p > span { + display: table-cell; + vertical-align: middle; +} + +.ui-Mexam-buttom { + padding: 0px 0px 20px; +} + +.ui-Mexam-buttom a { + display: block; + width: 200px; + margin: 0px auto; + text-align: center; + height: 45px; + line-height: 45px; + border-radius: 5px; + background-color: #31bcc1; + color: #FFF; + text-decoration: none; +} +.ui-Mexam-buttom a:active { + box-shadow: inset 0px 5px 20px rgba(0, 0, 0, 0.15); +} + +.ui-Mexam-card { + position: absolute; + top: 100%; + left: 0; + width: 100%; + height: 100%; + z-index: 10; + background-color: #FFF; + -webkit-transition: -webkit-transform 500ms ease-in-out 0s; + transition: -webkit-transform 500ms ease-in-out 0s; +} + +.ui-Mexam-card.ui-Mexam-show { + -webkit-transform: translate3d(0px, -100%, 0px); + transform: translate3d(0px, -100%, 0px); +} + +.ui-Mexam-card > ul { + margin: 0; + padding: 20px 0px; + overflow-y: auto; + -webkit-overflow-scrolling: touch; + -webkit-tap-highlight-color: rgba(0, 0, 0, 0); +} + +.ui-Mexam-card > ul:after { + clear: both; + display: table; + content: ''; +} + +.ui-Mexam-card > ul > li { + float: left; + width: 20%; + text-align: center; + list-style: none; + margin-bottom: 20px; +} +.ui-Mexam-card > ul > li a { + display: block; + margin: 0px auto; + color: #31bcc1; + width: 35px; + height: 35px; + line-height: 35px; + border-radius: 50%; + border: 1px solid #31bcc1; + -webkit-transition: background 0.3s; + transition: background 0.3s; + text-decoration: none; +} + +.ui-Mexam-card > ul > li.active a, +.ui-Mexam-card > ul > li a:active { + background: #31bcc1; + color: #FFF; +} + +/* doRotate */ +@-webkit-keyframes MexamRotate { + 0% { -webkit-transform: rotateZ(0); } + 100% { -webkit-transform: rotateZ(360deg); } +} +@-moz-keyframes MexamRotate { + 0% { -moz-transform: rotateZ(0); } + 100% { -moz-transform: rotateZ(360deg); } +} +@-o-keyframes MexamRotate { + 0% { -o-transform: rotateZ(0); } + 100% { -o-transform: rotateZ(360deg); } +} +@keyframes MexamRotate { + 0% { transform: rotateZ(0); } + 100% { transform: rotateZ(360deg); } +} \ No newline at end of file diff --git a/css/normalize.css b/css/normalize.css new file mode 100644 index 0000000..5e5e3c8 --- /dev/null +++ b/css/normalize.css @@ -0,0 +1,424 @@ +/*! normalize.css v3.0.3 | MIT License | github.com/necolas/normalize.css */ + +/** + * 1. Set default font family to sans-serif. + * 2. Prevent iOS and IE text size adjust after device orientation change, + * without disabling user zoom. + */ + +html { + font-family: sans-serif; /* 1 */ + -ms-text-size-adjust: 100%; /* 2 */ + -webkit-text-size-adjust: 100%; /* 2 */ +} + +/** + * Remove default margin. + */ + +body { + margin: 0; +} + +/* HTML5 display definitions + ========================================================================== */ + +/** + * Correct `block` display not defined for any HTML5 element in IE 8/9. + * Correct `block` display not defined for `details` or `summary` in IE 10/11 + * and Firefox. + * Correct `block` display not defined for `main` in IE 11. + */ + +article, +aside, +details, +figcaption, +figure, +footer, +header, +hgroup, +main, +menu, +nav, +section, +summary { + display: block; +} + +/** + * 1. Correct `inline-block` display not defined in IE 8/9. + * 2. Normalize vertical alignment of `progress` in Chrome, Firefox, and Opera. + */ + +audio, +canvas, +progress, +video { + display: inline-block; /* 1 */ + vertical-align: baseline; /* 2 */ +} + +/** + * Prevent modern browsers from displaying `audio` without controls. + * Remove excess height in iOS 5 devices. + */ + +audio:not([controls]) { + display: none; + height: 0; +} + +/** + * Address `[hidden]` styling not present in IE 8/9/10. + * Hide the `template` element in IE 8/9/10/11, Safari, and Firefox < 22. + */ + +[hidden], +template { + display: none; +} + +/* Links + ========================================================================== */ + +/** + * Remove the gray background color from active links in IE 10. + */ + +a { + background-color: transparent; +} + +/** + * Improve readability of focused elements when they are also in an + * active/hover state. + */ + +a:active, +a:hover { + outline: 0; +} + +/* Text-level semantics + ========================================================================== */ + +/** + * Address styling not present in IE 8/9/10/11, Safari, and Chrome. + */ + +abbr[title] { + border-bottom: 1px dotted; +} + +/** + * Address style set to `bolder` in Firefox 4+, Safari, and Chrome. + */ + +b, +strong { + font-weight: bold; +} + +/** + * Address styling not present in Safari and Chrome. + */ + +dfn { + font-style: italic; +} + +/** + * Address variable `h1` font-size and margin within `section` and `article` + * contexts in Firefox 4+, Safari, and Chrome. + */ + +h1 { + font-size: 2em; + margin: 0.67em 0; +} + +/** + * Address styling not present in IE 8/9. + */ + +mark { + background: #ff0; + color: #000; +} + +/** + * Address inconsistent and variable font size in all browsers. + */ + +small { + font-size: 80%; +} + +/** + * Prevent `sub` and `sup` affecting `line-height` in all browsers. + */ + +sub, +sup { + font-size: 75%; + line-height: 0; + position: relative; + vertical-align: baseline; +} + +sup { + top: -0.5em; +} + +sub { + bottom: -0.25em; +} + +/* Embedded content + ========================================================================== */ + +/** + * Remove border when inside `a` element in IE 8/9/10. + */ + +img { + border: 0; +} + +/** + * Correct overflow not hidden in IE 9/10/11. + */ + +svg:not(:root) { + overflow: hidden; +} + +/* Grouping content + ========================================================================== */ + +/** + * Address margin not present in IE 8/9 and Safari. + */ + +figure { + margin: 1em 40px; +} + +/** + * Address differences between Firefox and other browsers. + */ + +hr { + box-sizing: content-box; + height: 0; +} + +/** + * Contain overflow in all browsers. + */ + +pre { + overflow: auto; +} + +/** + * Address odd `em`-unit font size rendering in all browsers. + */ + +code, +kbd, +pre, +samp { + font-family: monospace, monospace; + font-size: 1em; +} + +/* Forms + ========================================================================== */ + +/** + * Known limitation: by default, Chrome and Safari on OS X allow very limited + * styling of `select`, unless a `border` property is set. + */ + +/** + * 1. Correct color not being inherited. + * Known issue: affects color of disabled elements. + * 2. Correct font properties not being inherited. + * 3. Address margins set differently in Firefox 4+, Safari, and Chrome. + */ + +button, +input, +optgroup, +select, +textarea { + color: inherit; /* 1 */ + font: inherit; /* 2 */ + margin: 0; /* 3 */ +} + +/** + * Address `overflow` set to `hidden` in IE 8/9/10/11. + */ + +button { + overflow: visible; +} + +/** + * Address inconsistent `text-transform` inheritance for `button` and `select`. + * All other form control elements do not inherit `text-transform` values. + * Correct `button` style inheritance in Firefox, IE 8/9/10/11, and Opera. + * Correct `select` style inheritance in Firefox. + */ + +button, +select { + text-transform: none; +} + +/** + * 1. Avoid the WebKit bug in Android 4.0.* where (2) destroys native `audio` + * and `video` controls. + * 2. Correct inability to style clickable `input` types in iOS. + * 3. Improve usability and consistency of cursor style between image-type + * `input` and others. + */ + +button, +html input[type="button"], /* 1 */ +input[type="reset"], +input[type="submit"] { + -webkit-appearance: button; /* 2 */ + cursor: pointer; /* 3 */ +} + +/** + * Re-set default cursor for disabled elements. + */ + +button[disabled], +html input[disabled] { + cursor: default; +} + +/** + * Remove inner padding and border in Firefox 4+. + */ + +button::-moz-focus-inner, +input::-moz-focus-inner { + border: 0; + padding: 0; +} + +/** + * Address Firefox 4+ setting `line-height` on `input` using `!important` in + * the UA stylesheet. + */ + +input { + line-height: normal; +} + +/** + * It's recommended that you don't attempt to style these elements. + * Firefox's implementation doesn't respect box-sizing, padding, or width. + * + * 1. Address box sizing set to `content-box` in IE 8/9/10. + * 2. Remove excess padding in IE 8/9/10. + */ + +input[type="checkbox"], +input[type="radio"] { + box-sizing: border-box; /* 1 */ + padding: 0; /* 2 */ +} + +/** + * Fix the cursor style for Chrome's increment/decrement buttons. For certain + * `font-size` values of the `input`, it causes the cursor style of the + * decrement button to change from `default` to `text`. + */ + +input[type="number"]::-webkit-inner-spin-button, +input[type="number"]::-webkit-outer-spin-button { + height: auto; +} + +/** + * 1. Address `appearance` set to `searchfield` in Safari and Chrome. + * 2. Address `box-sizing` set to `border-box` in Safari and Chrome. + */ + +input[type="search"] { + -webkit-appearance: textfield; /* 1 */ + box-sizing: content-box; /* 2 */ +} + +/** + * Remove inner padding and search cancel button in Safari and Chrome on OS X. + * Safari (but not Chrome) clips the cancel button when the search input has + * padding (and `textfield` appearance). + */ + +input[type="search"]::-webkit-search-cancel-button, +input[type="search"]::-webkit-search-decoration { + -webkit-appearance: none; +} + +/** + * Define consistent border, margin, and padding. + */ + +fieldset { + border: 1px solid #c0c0c0; + margin: 0 2px; + padding: 0.35em 0.625em 0.75em; +} + +/** + * 1. Correct `color` not being inherited in IE 8/9/10/11. + * 2. Remove padding so people aren't caught out if they zero out fieldsets. + */ + +legend { + border: 0; /* 1 */ + padding: 0; /* 2 */ +} + +/** + * Remove default vertical scrollbar in IE 8/9/10/11. + */ + +textarea { + overflow: auto; +} + +/** + * Don't inherit the `font-weight` (applied by a rule above). + * NOTE: the default cannot safely be changed in Chrome and Safari on OS X. + */ + +optgroup { + font-weight: bold; +} + +/* Tables + ========================================================================== */ + +/** + * Remove most spacing between table cells. + */ + +table { + border-collapse: collapse; + border-spacing: 0; +} + +td, +th { + padding: 0; +} diff --git a/fonts/Mexam.eot b/fonts/Mexam.eot new file mode 100644 index 0000000000000000000000000000000000000000..1864b6c61905cb368e96e03f1c5a7c69a6b9d6cd GIT binary patch literal 6780 zcmd5=YiwM{b)LEJdw2Kl`#~;AUGC-bp}o5zmk&`CMKN4HBvG_UQIdB>N8S}5l49!t zk+$i^fStrj9X7TF#8zRujf2!dixfp?r5bQjH!)h+$Pc4I(O>=106`lCZtK7STojFC zvESU?rR7Ikr^t_9?!EKPoNvyVIdkURxqP&lka80tln8`h0#QU4pyfTv(b0LgAS6(0 z=iJ)$;!EGR8f_nz0dk%!lS||xS#zHo5P8WQStTowJV-8}{&jK^^($l@Eu3kQK9VE7 zDEH&uz~36FfV%y~d0?(DOE&TB zLl2H0#xn(Z%B`)r&vlIF)5eTuirY^fCnC8#J$-!c(i@+D6D_~S-E#Nhp8P%cEWHC# z0`>Cph05hyP4C=|`X=sU%MWc>-sf&V3I$%sJJv3rz0ms~-+T`BUPAQiXDjQM(GH*b zC6wCP2Oe1~PCxrPR^Tnj+s>_4R+K-v4Sk+}gM8>58q_uM2z=RrddIm78=J;^1p2&( zP)|H?X}Kc(M12tTGU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h9gfMFB0anC#*8GzG9jbIc#ELt6cR;8FqgrnZo={ zKJHAG`JF1|Wx%NlybL;3k(VK-D)BN5$MQ1bR25!EovO;qm{Zkw8F#8WFB1+^GoR6R z6Kp5Yrx~_+nS^a#w!k(oTVb1*ZLrPDU9ind3$}UL4%@s;!8R{#2QxLxRsmitbJyXw zP_(U4RBaYoZQ*gAWgQN)GtAzdWogHauZ*9%kGuS-EGnfOT*w7BeIT==R*kv&U zAAT-{DN~u%t(iTtLb18&lXb|iO< zfIV2Wr^`$#AW*TFNT!ynghF}6W@4eTg2)#Nl_YSvgpB}N1%{Cm?di&J(uSUCzI=MY z)ddwbRj`1ZfC_w)VKTOb%=@ArG9eNL*N!JLVA5_ceW($u*URT)!G_#fpN~C?Y4*9z zOvfg%tZ5s5%OD7{EbmSqBNOW0A;*h3YZSS<7FKnS!2FK;(iqHPNGps^E!#DZ*K(R& z_bSGeW&L%Fg@#+p{KbG-G(11x*jA2De;Qe8w3MrM&*ZHyz>h)8EU zfz_De{~kFrzge(w@9@1kY7Zyd?^w9@Qhg-*`IH;38|AZX=lXl=(J zQ)6?4b8I&@$k>0=eh_(pM#3xu&bY&}C_cx1GX?Ki)5zluZ%jBmuGr_`yn=IskP(1M z0LsCXbA!4q(*SPE4Cm~J=n&^{aF}yAIKnv`%yQ0NfTNtl!5rssa2Mxra5v}d1DNL= z4i-3vgJYb-!6N630vzWY4o+|m2PZj)gL^n<7@){G9F#bRgHxQt!IHyzcien0udo3$ zf8IrdK&RcPLGutQ_c^R@hh63smtAoYXPi|B2Ha%5vQJYSpN?7 z9Iv?4^Dg4lFSv+P?{_jxTV-O${3cJ|Swd!CB|kb=tWx@P>3jSi=gSt7 + + + +Created by FontForge 20120731 at Thu Jul 9 16:12:44 2015 + By Ads + + + + + + + + + + + + + + diff --git a/fonts/Mexam.ttf b/fonts/Mexam.ttf new file mode 100644 index 0000000000000000000000000000000000000000..27a8dbd733c226ea346a2d1d797456a70e256b1e GIT binary patch literal 6496 zcmb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@W>BMNqcpkCN4qK*NsLB}S6kubWz3?j8Ddu(%vT@A6^B=BQRY*!^l0W=TtIIcH zTMtu@(mqXi=K@QV<7+d?z*s+Lwpo>za?Jc#MQ%w;WW_28&B;lG@#)p)AJG^8SAzg{DOEp2eja&riW3?{A9eNh z1h~yLjzq95(+@H#3saIaVVD8^zci%(`Lhmpy5T+D0NLPG1cKENA_QpIli|Ud1>z5I zg989D0|4?h00jjAMnD;m0ww7Rbmwk>43GiPfIB!Fg9Mxl zf%#!i+8%T(!!_OnC13;$rzLqRBJEx`IV9cTG%3?d>w@X@W}N_vQMb%83^31UKke5` z3gDU=oC0c{wh>)Cit|Nb9JG5_{9_1TR$JivDettrtDnMphiaA}u|qdA^>-p~^87aY z#5o?({9S|A1FuQUUQ!f3Y?ALH;E_Er3hz?Baph)#UyTGUPYkZC=shLq4n#LdFInx|r^UjikWe#OyjaUh&xwfhOChUU3X8x;!l_D6OTK0Ex7 zs`%2I=$KwVkZ2j2TA$IXKcQ!}DWNZ+=<0bzU!4=nSDk@Lx~o-$FX*G!DCo7qmlzv; z?Fc#pn3*jo&!3YW@c4{Ki>93f}LzPG_WpgPGhl$4Ro|_$_Q4k%?yJ zI5J*a97MyO#|}rvquy|VngS}+aDnE$r=tgZi+U(OwT3Ymxd?*_)xjX@b=M&AM&>x> kc=I|Kxq2PnIctFe=M + + + + + + Mexam 移动端在线做题组件,现只支持单选,多选,判断题类型。 + + + + + + + + + + + + + +

Mexam 移动端在线做题组件

+
+
    +
  1. 本页面只适用于手机端查看
  2. +
  3. 点击按钮答题
  4. +
  5. GitHub地址 [这里]
  6. +
  7. 作者Blog http://webjyh.com
  8. +
+ + +
+ + + + + \ No newline at end of file diff --git a/js/Mexam.js b/js/Mexam.js new file mode 100644 index 0000000..e6d421f --- /dev/null +++ b/js/Mexam.js @@ -0,0 +1,721 @@ +/** + * @name Mexam + * @desc 移动端题库做题插件,只支持,单选题,多选题,判断题 + * @depend Zepto + * @author M.J + * @date 2015-07-09 + * @URL http://webjyh.com + * @reutn {Mexam} + * @version 1.0.0 + * @license MIT + * + * @PS If you have any questions, please don't look for me, I don't know anything. thank you. + */ +(function(root, factory) { + "use strict"; + if (typeof define === 'function' && define.amd) { + //AMD. + define(['zepto'], factory); + } else if (typeof exports === 'object') { + //CMD. + module.exports = factory(require('zepto')); + } else { + // Browser globals (root is window) + root.Mexam = factory(root.Zepto); + } +}(this, function($) { + + "use strict"; + + var scaleReg = /scale(?:3d)?\(([^\)]+)\)/, + translateReg = /translate(?:3d)?\(([^\)]+)\)/, + letter = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'], + config = { + title: '', + data: null, + wrap: 'body', + send: function() {}, + init: null, + close: null + }, + innerHTML = ['
', + '
', + ' ', + '

00:00

', + '
', + '
', + '
', + ' 01/{{pageCoumt}}', + '

{{title}}

', + '
', + '
', + '
    ', + '
    ', + '
      ', + ' ', + '
      ', + '
      ', + '
      ', + '
      '].join(""); + + /** + * 构造函数 + * @param 用户配置项 + * @returns {Mexam} + * @constructor {Mexam} + */ + var Mexam = function(options) { + return new Mexam.fn.init(options); + }; + + Mexam.fn = Mexam.prototype = { + constructor: Mexam, + init: function(options) { + if (!options.data || !options.data.length) return; + + this.config = $.extend(config, options); //默认配置项 + this.index = 0; //当前题目 + this.DOM = {}; //组件DOM + this.topics = {}; //存放当前订阅内容 + this.titleHeight = null; //存放当前Title高度 + this.next = false; //是否为 next 预加载下一题 + this.time = 0; //记录当前做题时间 + this.answer = new Array(this.config.data.length); //已答题的题目 + this.resize = typeof window.orientation == 'number' ? 'orientationchange.mexam' : 'resize.mexam'; //支持旋转的事件名 + this.screen = { + width: window.innerWidth, + height: window.innerHeight + }; + + if ($.isFunction(this.config.init)) { + this.config.init(); + } + + //载入订阅 + this.loadTopics() + .publish('init') + .publish('touch') + .publish('answer') + .publish('topicJump') + .publish('events') + .publish('time'); + }, + + /** + * @name 格式化当前页的数字 + * @param val {Number} 默认用户的参数 + * @return {String} + */ + formatNumber: function(val) { + return val.toString().length < 2 ? '0' + val : val; + }, + + /** + * @name 订阅发布 + * @type {Function} + * @parmas {key} 订阅的名称 + * @params {val} 订阅的内容 + * @return this + */ + subscribe: function(key, val) { + if (!this.topics[key]) { + this.topics[key] = []; + } + this.topics[key].push(val); + return this; + }, + + /** + * @name 退订发布 + * @type {Function} + * @params {key} 要退订的名称 + * @return this + */ + unsubscribe: function(key) { + if (this.topics[key]) { + delete this.topics[key]; + } + return this; + }, + + /** + * @name 发布订阅的 + * @type {Function} + * @return this + */ + publish: function(key) { + if (!this.topics[key]) { + return false; + } + + var subscribers = this.topics[key], + len = subscribers ? subscribers.length : 0, + args = [].slice.call(arguments); + + args.shift(); + for (var i = 0; i < len; i++) { + subscribers[i].apply(this, args); + } + + return this; + }, + + /** + * 创建 HTML + * @params {Number} start 从当前第几个开始创建,包含 start + * @params {length} len 要创建的个数 + * @returns {string} + */ + create: function(start, len) { + var html = '', + tpl = '
    • {{title}}

      ', + olStart = '
        ', + list = '
      1. {{key}}

        {{item}}

      2. ', + olEnd = '
      ', + button = ''; + + for (var i = 0; i < len; i++) { + var answer = this.answer[start + i] || [], + data = this.config.data[start + i]; + if (!data.content) break; + + var temp = tpl.replace('{{title}}', data.title) + olStart; + $.each(data.content, function (index, item) { + var active = '', key = letter[index]; + if ($.inArray(key, answer) > -1) active = 'active'; + temp += list.replace(/{{key}}/g, key).replace('{{item}}', item).replace('{{active}}', active); + }); + temp += olEnd; + if (data.type == 2) temp += button; + html += temp + '
    • '; + } + + return html; + }, + + /** + * 获取当前元素 CSS3 属性值 + * @param {Elements} elem + * @param {String} name + * @return {Object} + */ + getTransform: function(e, name) { + e = $(e); + + var val = e.css("transform") || e.css("-webkit-transform"), + has = val === 'none', + arr, x, y, reg; + + if (name === 'translate') { + reg = translateReg; + if (has || !val || val.indexOf(name) == -1) { + has = true; + x = y = 0; + } + } else if(name === "scale") { + reg = scaleReg; + if (has || !val || val.indexOf(name) == -1) { + has = true; + x = y = 1; + } + } + + if (!has) { + arr = val.match(reg); + arr = arr[1].split(','); + x = parseFloat(arr[0]); + y = parseFloat(arr[1]); + } + + return { + x: x, + y: y + }; + }, + + /** + * 设置当前元素 CSS3 属性值 + * @param {Elements} elem + * @param {Object} val + * @return this; + */ + setTransform: function(elem, val) { + if (!elem) return; + + var css = '', + style = elem.style, + key, + value; + + for (key in val) { + value = val[key]; + if (key === 'translate') { + css += " translate3d(" + value.x + "px, " + value.y + "px, 0)"; + } else if (key === 'scale') { + css += " scale3d(" + value.x + ", " + value.y + ", 1)"; + } else { + css += value; + } + } + + style.transform = style.webkitTransform = $.trim(css); + }, + + /** + * 设置当前元素 CSS3 属性值 + * @param {Elements} elem + * @param {Object} val + * @return this; + */ + setTransition: function(elem, val) { + if (!elem) return; + var style = elem.style, + key, + value; + for (key in val) { + value = val[key]; + value.easing = value.easing || "ease"; + if (key === 'transform') { + style.transition = style.webkitTransition = '-webkit-' + key + ' ' + value.duration + ' ' + value.easing; + } + style.transition = style.webkitTransition = key + ' ' + value.duration + ' ' + value.easing; + } + }, + + /** + * 销毁组件并执行关闭毁掉 + * @return null + */ + destroy: function() { + if ($.isFunction(this.config.close)) { + var has = this.config.close.apply(this); + if (has === false) return false; + } + + $(this.config.wrap).empty(); + $(document).off('touchstart.mexam'); + $(window).off(this.resize); + }, + /** + * 默认载入已订阅的主题 + * @return null + */ + loadTopics: function() { + + // 创建DOM + this.subscribe('init', function() { + var _this = this, + $wrap = $(this.config.wrap), + html = innerHTML.replace('{{pageCoumt}}', this.formatNumber(this.config.data.length)) + .replace('{{title}}', this.config.title); + // 写入元素 + $wrap.html(html); + var $elem = $wrap.find('*'); + $elem.each(function(index, item) { + if (item.className.indexOf('ui-Mexam-') > -1) { + var key = $.trim(item.className.replace('ui-Mexam-', '').replace('ui-Mexam-show', '')); + _this.DOM[key] = $(item); + } + }); + + this.titleHeight = this.DOM.title.height() + this.DOM.time.height(); + $(document).on('touchstart.mexam', function(e) { e.preventDefault(); }); + }); + + // 构建题库列表 + this.subscribe('init', function() { + var DOM = this.DOM, + len = this.config.data.length > 2 ? 3 : this.config.data.length, + html = this.create(0, len); + + DOM.list.css({width: this.screen.width * len, left: 0}).html(html); + this.setTransition(DOM.list[0], {transform: {duration: '0ms'}}); + this.setTransform(DOM.list[0], {translate: {x: 0, y: 0}}); + + setTimeout(function() { + DOM.loading.removeClass('ui-Mexam-show'); + }, 200); + }); + + // 构建答题卡列表 + this.subscribe('init', function() { + var DOM = this.DOM.cardList, + html = '', + tpl = '
    • {{i}}
    • ', + len = this.config.data.length; + + for (var i = 0; i < len; i++) { + html += tpl.replace('{{index}}', i).replace('{{i}}', i+1); + } + + DOM.html(html); + }); + + // 加载当前题目的 上一题或下一题 + this.subscribe('preloading', function(direction) { + var DOM = this.DOM, + MaxLen = this.config.data.length - 1, + index = direction == 'next' ? (this.index + 1) : (this.index - 1), + $elem = DOM.list.children(); + + // 判断是否为头或尾 + if (index < 0 || index > MaxLen) return; + if (direction == 'next' && this.index === 1) return; + if (direction == 'prev' && this.index === MaxLen - 1) return; + + // 移除DOM 创建DOM + var html = this.create(index, 1); + $elem[direction == 'next' ? 'first' : 'last']().remove(); + DOM.list[direction == 'next' ? 'append' : 'prepend'](html); + }); + + // 设置当前题目数 + this.subscribe('setPage', function() { + this.DOM.title.find('em').text(this.formatNumber(this.index+1)); + }); + + // 跳转到下一题 + this.subscribe('next', function() { + var elem = this.DOM.list[0], + len = this.config.data.length - 1, + isShowCard = this.index === len, + index = (this.index + 1 > len) ? len : (this.index + 1), + scroll= -(index * this.screen.width); + + // 进行预加载下一题 + this.next = true; + this.index = index; + this.publish('setPage'); + + // 到最后题提交完,跳转到答题卡; + if (isShowCard) this.publish('showCard', true); + + // 下一题, + this.setTransition(elem, {transform: {duration: '300ms', easing: 'ease-out'}}); + this.setTransform(elem, {translate: {x: scroll, y: 0}}); + }); + + // 手势滑动 上一题,下一题 + this.subscribe('touch', function(){ + var _this = this, + DOM = this.DOM, + len = this.config.data.length - 1, + minTx = parseInt(this.screen.width / 3, 10), + $elem, startTx, startTy, defaultXY, listX, has, direction, height; + + // 滑动开始 + DOM.list.on('touchstart', function(e) { + e.preventDefault(); + $elem = $(e.target).parents('li > div'); + startTx = e.touches[0].clientX; + startTy = e.touches[0].clientY; + if ($elem.length) { + height = $elem.height() - _this.screen.height + _this.titleHeight; + defaultXY = _this.getTransform($elem[0], 'translate'); + listX = _this.getTransform(this, 'translate').x; + } + }); + // 滑动中 + DOM.list.on('touchmove', function(e) { + e.preventDefault(); + var scroll, + currentTx = e.touches[0].clientX, + currentTy = e.touches[0].clientY, + diff = startTx - currentTx, + distanceX = startTx - currentTx, + distanceY = startTy - currentTy, + fix = _this.index * _this.screen.width; + + //横向滚动 上一题下一题 + if (Math.abs(distanceX) >= Math.abs(distanceY)) { + // 滚动差值 + direction = diff > 0 ? true : false; + if (!direction && _this.index === 0) { + scroll = Math.abs(diff); + } else { + scroll = direction ? -(Math.abs(diff) + fix) : -(fix - Math.abs(diff)); + } + // 拖动时滚动 + _this.setTransition(this, {transform: {duration: '0ms'}}); + _this.setTransform(this, {translate: {x: scroll, y: 0}}); + } else { + if (!$elem.length || $elem.height() < (_this.screen.height - _this.titleHeight)) return; + diff = defaultXY.y - distanceY; + _this.setTransform(this, {translate: {x: listX, y: 0}}); + _this.setTransition($elem[0], {transform: {duration: '0ms'}}); + _this.setTransform($elem[0], {translate: {x: 0, y: diff}}); + } + }); + // 滑动结束 + DOM.list.on('touchend', function(e) { + e.preventDefault(); + var endTx = e.changedTouches[0].clientX, + endTy = e.changedTouches[0].clientY, + distanceX = startTx - endTx, + distanceY = startTy - endTy; + has = Math.abs(startTx - endTx) > minTx; + + if (Math.abs(distanceX) >= Math.abs(distanceY)) { + // 设置 _this.index + if (has) { + direction ? (_this.index++) : (_this.index--); + } + if (_this.index < 0) _this.index = 0; + if (_this.index > len) _this.index = len; + + // 设置滚动 + var scroll = -(_this.index * _this.screen.width); + _this.setTransition(this, {transform: {duration: '300ms', easing: 'ease-out'}}); + _this.setTransform(this, {translate: {x: scroll, y: 0}}); + + if (has) _this.publish('setPage'); + } else { + if (!$elem.length || $elem.height() < (_this.screen.height - _this.titleHeight)) return; + var y = _this.getTransform($elem[0], 'translate').y; + _this.setTransition($elem[0], {transform: {duration: '300ms', easing: 'ease-out'}}); + if ( y > 0 && Math.abs(y) > 0) _this.setTransform($elem[0], {translate: {x: 0, y: 0}}); + if (y < 0 && Math.abs(y) > height) _this.setTransform($elem[0], {translate: {x: 0, y: -height}}); + } + }); + + // 动画结束回调 + DOM.list.on('webkitTransitionEnd transtionend', function() { + if (has || _this.next) { + if (_this.next) direction = 'next'; + _this.publish('preloading', direction ? 'next' : 'prev'); + var diff = _this.index * _this.screen.width - _this.screen.width; + if (_this.index === 0) diff = 0; + if (_this.index === _this.config.data.length - 1) diff = diff - _this.screen.width; + $(this).css('left', diff < 0 ? 0 : diff); + has = false; + _this.next = false; + } + }); + }); + + // 做题 + this.subscribe('answer', function() { + var isExec = false, + isBtn = false, + DOM = this.DOM, + _this = this; + + // 答题事件 + DOM.list.on('tap', 'ol > li', function(e) { + e.preventDefault(); + var $elem = $(this), + type = _this.config.data[_this.index].type; + + if (isExec) return; + isExec = true; + + setTimeout(function() { isExec = false; }, 100); + switch (type) { + case 1: + case 4: single($elem); break; + case 2: multi($elem); break; + default: single($elem); break; + } + }); + + // 下一题按钮事件 + DOM.list.on('tap', '.ui-Mexam-buttom > a', function(e) { + e.preventDefault(); + if (isBtn) return; + + isBtn = true; + setTimeout(function() { + isBtn = false; + _this.publish('next'); + }, 200); + }); + + // 同步答题卡 + function setAnswerCard(val) { + DOM.cardList.find('li').eq(_this.index)[val ? 'addClass' : 'removeClass']('active'); + }; + + // 单选题 + function single(elem) { + var $elem = elem, + answer = $elem.attr('data-answer'); + + // 设置答案,添加选中,设置答题卡 + _this.answer[_this.index] = answer; + $elem.addClass('active').siblings().removeClass('active'); + if (_this.answer) setAnswerCard(true); + + setTimeout(function() { + _this.publish('next'); + }, 200); + } + + // 多选题 + function multi(elem) { + var $elem = elem, + select = _this.answer[_this.index] || [], + answer = $elem.attr('data-answer'), + index = $.inArray(answer, select); + + index > -1 ? + (select.splice(index, 1)) + : + (select.push(answer)); + + // 设置答案,添加选中,设置答题卡 + select.sort(); //按字母排序 + _this.answer[_this.index] = select; + $elem[index > -1 ? 'removeClass' : 'addClass']('active'); + setAnswerCard(select.length ? true : false); + } + }); + + // 答题卡跳转 + this.subscribe('topicJump', function() { + var DOM = this.DOM, + _this = this, + isExec = false, + len = this.config.data.length; + + DOM.cardList.on('tap', 'li', function(e) { + e.preventDefault(); + var html, scroll, left, length = len < 3 ? len : 3, + $elem = $(this), + defaultIndex = parseInt($elem.text(), 10), + index = defaultIndex; + + if (isExec) return; + + if (len <= 3) { + index = 0; + } else { + index = index - 2; + if (index < 1 || len === 1) index = 0; + if (index >= len-2) index = (len-1) - 2; + } + + // 获取TPL + html = _this.create(index, length); + _this.index = defaultIndex - 1; + left = _this.index * _this.screen.width - _this.screen.width; + scroll= -(_this.index * _this.screen.width); + if (_this.index === 0) left = 0; + if (_this.index === len - 1) left = left - _this.screen.width; + + //设置DOM + DOM.card.removeClass('ui-Mexam-show'); + DOM.list.css('left', left < 0 ? 0 : left).html(html); + _this.setTransition(DOM.list[0], {transform: {duration: '300ms', easing: 'ease-out'}}); + _this.setTransform(DOM.list[0], {translate: {x: scroll, y: 0}}); + _this.publish('setPage'); + + setTimeout(function() { isExec = false; }, 100); + }); + + }); + + // 显示答题卡 + this.subscribe('showCard', function(val) { + var DOM = this.DOM; + DOM.card[val ? 'addClass' : 'removeClass']('ui-Mexam-show'); + }); + + // 组件事件 + this.subscribe('events', function() { + var cle, DOM = this.DOM, + _this = this; + + // 展现答题卡 + DOM.preview.on('touchstart', function(e) { + e.preventDefault(); + var has = DOM.card.hasClass('ui-Mexam-show'); + DOM.card[has ? 'removeClass' : 'addClass']('ui-Mexam-show'); + }); + + // 提交答题卡 + DOM.card.on('touchstart', '.ui-Mexam-buttom > a', function(e) { + e.preventDefault(); + + var answer = []; + $.each(_this.answer, function(i, item) { + answer.push({ + id: _this.config.data[i].id, + answer: item + }); + }); + + if ($.isFunction(_this.config.send)) { + var send = _this.config.send.apply(_this, [answer, _this.time]); + if (send === false) { + return false; + } + _this.destroy(); + } + }); + + // 返回按钮事件 + DOM.back.on('touchstart', function(e) { + e.preventDefault(); + _this.destroy(); + }); + + $(window).on(this.resize, function() { + clearInterval(cle); + cle = setTimeout(function() { + _this.publish('resize'); + }, 300); + }); + }); + + // 页面计时器 + this.subscribe('time', function() { + var time, _this = this, + minute = 0, + second = 0, + DOM = this.DOM.time.find('span'); + var timing = function() { + second++; + if (second == 60) { + second = 0; + minute++; + } + _this.time = (minute * 60) + second; + DOM.text(_this.formatNumber(minute) + ':' + _this.formatNumber(second)); + }; + setInterval(timing, 1000); + }); + + // Resize + this.subscribe('resize', function() { + this.next = false; + this.screen = { + width: window.innerWidth, + height: window.innerHeight + }; + + var DOM = this.DOM, + len = this.config.data.length > 2 ? 3 : this.config.data.length, + left = this.index * this.screen.width - this.screen.width, + translate = -(this.index * this.screen.width); + if (this.index === 0) left = 0; + if (this.index === len - 1) left = left - this.screen.width; + + this.setTransition(DOM.list[0], {transform: {duration: '0ms'}}); + this.setTransform(DOM.list[0], {translate: {x: translate, y: 0}}); + DOM.list.css({ width: this.screen.width * len, left: left }) + .children() + .css({width: this.screen.width, height: this.screen.height}) + .children() + .removeAttr('style'); + }); + + return this; + } + }; + + // 将 init.prototype 指向 Mexam.prototype + Mexam.fn.init.prototype = Mexam.fn; + + // 扩展至全局 + return Mexam; +})); \ No newline at end of file diff --git a/js/Mexam.min.js b/js/Mexam.min.js new file mode 100644 index 0000000..e5e84d4 --- /dev/null +++ b/js/Mexam.min.js @@ -0,0 +1,14 @@ +/** + * @name Mexam + * @desc 移动端题库做题插件,只支持,单选题,多选题,判断题 + * @depend Zepto + * @author M.J + * @date 2015-07-09 + * @URL http://webjyh.com + * @reutn {Mexam} + * @version 1.0.0 + * @license MIT + * + * @PS If you have any questions, please don't look for me, I don't know anything. thank you. + */ +!function(t,i){"use strict";"function"==typeof define&&define.amd?define(["zepto"],i):"object"==typeof exports?module.exports=i(require("zepto")):t.Mexam=i(t.Zepto)}(this,function(t){"use strict";var i=/scale(?:3d)?\(([^\)]+)\)/,e=/translate(?:3d)?\(([^\)]+)\)/,s=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"],n={title:"",data:null,wrap:"body",send:function(){},init:null,close:null},a=['
      ',"
      ",' ','

      00:00

      ','
      ',"
      ",'
      '," 01/{{pageCoumt}}","

      {{title}}

      ","
      ",'
      ','
        ','
        ','
          ',' ',"
          ","
          ",'
          ',"
          "].join(""),r=function(t){return new r.fn.init(t)};return r.fn=r.prototype={constructor:r,init:function(i){i.data&&i.data.length&&(this.config=t.extend(n,i),this.index=0,this.DOM={},this.topics={},this.titleHeight=null,this.next=!1,this.time=0,this.answer=new Array(this.config.data.length),this.resize="number"==typeof window.orientation?"orientationchange.mexam":"resize.mexam",this.screen={width:window.innerWidth,height:window.innerHeight},t.isFunction(this.config.init)&&this.config.init(),this.loadTopics().publish("init").publish("touch").publish("answer").publish("topicJump").publish("events").publish("time"))},formatNumber:function(t){return t.toString().length<2?"0"+t:t},subscribe:function(t,i){return this.topics[t]||(this.topics[t]=[]),this.topics[t].push(i),this},unsubscribe:function(t){return this.topics[t]&&delete this.topics[t],this},publish:function(t){if(!this.topics[t])return!1;var i=this.topics[t],e=i?i.length:0,s=[].slice.call(arguments);s.shift();for(var n=0;e>n;n++)i[n].apply(this,s);return this},create:function(i,e){for(var n="",a='
        • {{title}}

          ',r="
            ",h='
          1. {{key}}

            {{item}}

          2. ',o="
          ",c='',l=0;e>l;l++){var u=this.answer[i+l]||[],d=this.config.data[i+l];if(!d.content)break;var f=a.replace("{{title}}",d.title)+r;t.each(d.content,function(i,e){var n="",a=s[i];t.inArray(a,u)>-1&&(n="active"),f+=h.replace(/{{key}}/g,a).replace("{{item}}",e).replace("{{active}}",n)}),f+=o,2==d.type&&(f+=c),n+=f+"
        • "}return n},getTransform:function(s,n){s=t(s);var a,r,h,o,c=s.css("transform")||s.css("-webkit-transform"),l="none"===c;return"translate"===n?(o=e,(l||!c||-1==c.indexOf(n))&&(l=!0,r=h=0)):"scale"===n&&(o=i,(l||!c||-1==c.indexOf(n))&&(l=!0,r=h=1)),l||(a=c.match(o),a=a[1].split(","),r=parseFloat(a[0]),h=parseFloat(a[1])),{x:r,y:h}},setTransform:function(i,e){if(i){var s,n,a="",r=i.style;for(s in e)n=e[s],a+="translate"===s?" translate3d("+n.x+"px, "+n.y+"px, 0)":"scale"===s?" scale3d("+n.x+", "+n.y+", 1)":n;r.transform=r.webkitTransform=t.trim(a)}},setTransition:function(t,i){if(t){var e,s,n=t.style;for(e in i)s=i[e],s.easing=s.easing||"ease","transform"===e&&(n.transition=n.webkitTransition="-webkit-"+e+" "+s.duration+" "+s.easing),n.transition=n.webkitTransition=e+" "+s.duration+" "+s.easing}},destroy:function(){if(t.isFunction(this.config.close)){var i=this.config.close.apply(this);if(i===!1)return!1}t(this.config.wrap).empty(),t(document).off("touchstart.mexam"),t(window).off(this.resize)},loadTopics:function(){return this.subscribe("init",function(){var i=this,e=t(this.config.wrap),s=a.replace("{{pageCoumt}}",this.formatNumber(this.config.data.length)).replace("{{title}}",this.config.title);e.html(s);var n=e.find("*");n.each(function(e,s){if(s.className.indexOf("ui-Mexam-")>-1){var n=t.trim(s.className.replace("ui-Mexam-","").replace("ui-Mexam-show",""));i.DOM[n]=t(s)}}),this.titleHeight=this.DOM.title.height()+this.DOM.time.height(),t(document).on("touchstart.mexam",function(t){t.preventDefault()})}),this.subscribe("init",function(){var t=this.DOM,i=this.config.data.length>2?3:this.config.data.length,e=this.create(0,i);t.list.css({width:this.screen.width*i,left:0}).html(e),this.setTransition(t.list[0],{transform:{duration:"0ms"}}),this.setTransform(t.list[0],{translate:{x:0,y:0}}),setTimeout(function(){t.loading.removeClass("ui-Mexam-show")},200)}),this.subscribe("init",function(){for(var t=this.DOM.cardList,i="",e='
        • {{i}}
        • ',s=this.config.data.length,n=0;s>n;n++)i+=e.replace("{{index}}",n).replace("{{i}}",n+1);t.html(i)}),this.subscribe("preloading",function(t){var i=this.DOM,e=this.config.data.length-1,s="next"==t?this.index+1:this.index-1,n=i.list.children();if(!(0>s||s>e||"next"==t&&1===this.index||"prev"==t&&this.index===e-1)){var a=this.create(s,1);n["next"==t?"first":"last"]().remove(),i.list["next"==t?"append":"prepend"](a)}}),this.subscribe("setPage",function(){this.DOM.title.find("em").text(this.formatNumber(this.index+1))}),this.subscribe("next",function(){var t=this.DOM.list[0],i=this.config.data.length-1,e=this.index===i,s=this.index+1>i?i:this.index+1,n=-(s*this.screen.width);this.next=!0,this.index=s,this.publish("setPage"),e&&this.publish("showCard",!0),this.setTransition(t,{transform:{duration:"300ms",easing:"ease-out"}}),this.setTransform(t,{translate:{x:n,y:0}})}),this.subscribe("touch",function(){var i,e,s,n,a,r,h,o,c=this,l=this.DOM,u=this.config.data.length-1,d=parseInt(this.screen.width/3,10);l.list.on("touchstart",function(r){r.preventDefault(),i=t(r.target).parents("li > div"),e=r.touches[0].clientX,s=r.touches[0].clientY,i.length&&(o=i.height()-c.screen.height+c.titleHeight,n=c.getTransform(i[0],"translate"),a=c.getTransform(this,"translate").x)}),l.list.on("touchmove",function(t){t.preventDefault();var r,o=t.touches[0].clientX,l=t.touches[0].clientY,u=e-o,d=e-o,f=s-l,m=c.index*c.screen.width;if(Math.abs(d)>=Math.abs(f))h=u>0?!0:!1,r=h||0!==c.index?h?-(Math.abs(u)+m):-(m-Math.abs(u)):Math.abs(u),c.setTransition(this,{transform:{duration:"0ms"}}),c.setTransform(this,{translate:{x:r,y:0}});else{if(!i.length||i.height()d,Math.abs(l)>=Math.abs(f)){r&&(h?c.index++:c.index--),c.index<0&&(c.index=0),c.index>u&&(c.index=u);var m=-(c.index*c.screen.width);c.setTransition(this,{transform:{duration:"300ms",easing:"ease-out"}}),c.setTransform(this,{translate:{x:m,y:0}}),r&&c.publish("setPage")}else{if(!i.length||i.height()0&&Math.abs(p)>0&&c.setTransform(i[0],{translate:{x:0,y:0}}),0>p&&Math.abs(p)>o&&c.setTransform(i[0],{translate:{x:0,y:-o}})}}),l.list.on("webkitTransitionEnd transtionend",function(){if(r||c.next){c.next&&(h="next"),c.publish("preloading",h?"next":"prev");var i=c.index*c.screen.width-c.screen.width;0===c.index&&(i=0),c.index===c.config.data.length-1&&(i-=c.screen.width),t(this).css("left",0>i?0:i),r=!1,c.next=!1}})}),this.subscribe("answer",function(){function i(t){r.cardList.find("li").eq(h.index)[t?"addClass":"removeClass"]("active")}function e(t){var e=t,s=e.attr("data-answer");h.answer[h.index]=s,e.addClass("active").siblings().removeClass("active"),h.answer&&i(!0),setTimeout(function(){h.publish("next")},200)}function s(e){var s=e,n=h.answer[h.index]||[],a=s.attr("data-answer"),r=t.inArray(a,n);r>-1?n.splice(r,1):n.push(a),n.sort(),h.answer[h.index]=n,s[r>-1?"removeClass":"addClass"]("active"),i(n.length?!0:!1)}var n=!1,a=!1,r=this.DOM,h=this;r.list.on("tap","ol > li",function(i){i.preventDefault();var a=t(this),r=h.config.data[h.index].type;if(!n)switch(n=!0,setTimeout(function(){n=!1},100),r){case 1:case 4:e(a);break;case 2:s(a);break;default:e(a)}}),r.list.on("tap",".ui-Mexam-buttom > a",function(t){t.preventDefault(),a||(a=!0,setTimeout(function(){a=!1,h.publish("next")},200))})}),this.subscribe("topicJump",function(){var i=this.DOM,e=this,s=!1,n=this.config.data.length;i.cardList.on("tap","li",function(a){a.preventDefault();var r,h,o,c=3>n?n:3,l=t(this),u=parseInt(l.text(),10),d=u;s||(3>=n?d=0:(d-=2,(1>d||1===n)&&(d=0),d>=n-2&&(d=n-1-2)),r=e.create(d,c),e.index=u-1,o=e.index*e.screen.width-e.screen.width,h=-(e.index*e.screen.width),0===e.index&&(o=0),e.index===n-1&&(o-=e.screen.width),i.card.removeClass("ui-Mexam-show"),i.list.css("left",0>o?0:o).html(r),e.setTransition(i.list[0],{transform:{duration:"300ms",easing:"ease-out"}}),e.setTransform(i.list[0],{translate:{x:h,y:0}}),e.publish("setPage"),setTimeout(function(){s=!1},100))})}),this.subscribe("showCard",function(t){var i=this.DOM;i.card[t?"addClass":"removeClass"]("ui-Mexam-show")}),this.subscribe("events",function(){var i,e=this.DOM,s=this;e.preview.on("touchstart",function(t){t.preventDefault();var i=e.card.hasClass("ui-Mexam-show");e.card[i?"removeClass":"addClass"]("ui-Mexam-show")}),e.card.on("touchstart",".ui-Mexam-buttom > a",function(i){i.preventDefault();var e=[];if(t.each(s.answer,function(t,i){e.push({id:s.config.data[t].id,answer:i})}),t.isFunction(s.config.send)){var n=s.config.send.apply(s,[e,s.time]);if(n===!1)return!1;s.destroy()}}),e.back.on("touchstart",function(t){t.preventDefault(),s.destroy()}),t(window).on(this.resize,function(){clearInterval(i),i=setTimeout(function(){s.publish("resize")},300)})}),this.subscribe("time",function(){var t=this,i=0,e=0,s=this.DOM.time.find("span"),n=function(){e++,60==e&&(e=0,i++),t.time=60*i+e,s.text(t.formatNumber(i)+":"+t.formatNumber(e))};setInterval(n,1e3)}),this.subscribe("resize",function(){this.next=!1,this.screen={width:window.innerWidth,height:window.innerHeight};var t=this.DOM,i=this.config.data.length>2?3:this.config.data.length,e=this.index*this.screen.width-this.screen.width,s=-(this.index*this.screen.width);0===this.index&&(e=0),this.index===i-1&&(e-=this.screen.width),this.setTransition(t.list[0],{transform:{duration:"0ms"}}),this.setTransform(t.list[0],{translate:{x:s,y:0}}),t.list.css({width:this.screen.width*i,left:e}).children().css({width:this.screen.width,height:this.screen.height}).children().removeAttr("style")}),this}},r.fn.init.prototype=r.fn,r}); \ No newline at end of file diff --git a/js/zepto.min.js b/js/zepto.min.js new file mode 100644 index 0000000..9e680a8 --- /dev/null +++ b/js/zepto.min.js @@ -0,0 +1,2 @@ +/* Zepto v1.1.6 - zepto event ajax form ie touch fx - zeptojs.com/license */ +var Zepto=function(){function t(t){return null==t?String(t):V[Y.call(t)]||"object"}function e(e){return"function"==t(e)}function n(t){return null!=t&&t==t.window}function i(t){return null!=t&&t.nodeType==t.DOCUMENT_NODE}function r(e){return"object"==t(e)}function o(t){return r(t)&&!n(t)&&Object.getPrototypeOf(t)==Object.prototype}function a(t){return"number"==typeof t.length}function s(t){return O.call(t,function(t){return null!=t})}function u(t){return t.length>0?T.fn.concat.apply([],t):t}function c(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 l(t){return t in A?A[t]:A[t]=new RegExp("(^|\\s)"+t+"(\\s|$)")}function f(t,e){return"number"!=typeof e||D[c(t)]?e:e+"px"}function h(t){var e,n;return L[t]||(e=M.createElement(t),M.body.appendChild(e),n=getComputedStyle(e,"").getPropertyValue("display"),e.parentNode.removeChild(e),"none"==n&&(n="block"),L[t]=n),L[t]}function p(t){return"children"in t?N.call(t.children):T.map(t.childNodes,function(t){return 1==t.nodeType?t:void 0})}function d(t,e,n){for(E in e)n&&(o(e[E])||G(e[E]))?(o(e[E])&&!o(t[E])&&(t[E]={}),G(e[E])&&!G(t[E])&&(t[E]=[]),d(t[E],e[E],n)):e[E]!==b&&(t[E]=e[E])}function m(t,e){return null==e?T(t):T(t).filter(e)}function g(t,n,i,r){return e(n)?n.call(t,i,r):n}function v(t,e,n){null==n?t.removeAttribute(e):t.setAttribute(e,n)}function y(t,e){var n=t.className||"",i=n&&n.baseVal!==b;return e===b?i?n.baseVal:n:void(i?n.baseVal=e:t.className=e)}function x(t){try{return t?"true"==t||("false"==t?!1:"null"==t?null:+t+""==t?+t:/^[\[\{]/.test(t)?T.parseJSON(t):t):t}catch(e){return t}}function w(t,e){e(t);for(var n=0,i=t.childNodes.length;i>n;n++)w(t.childNodes[n],e)}var b,E,T,j,S,C,P=[],N=P.slice,O=P.filter,M=window.document,L={},A={},D={"column-count":1,columns:1,"font-weight":1,"line-height":1,opacity:1,"z-index":1,zoom:1},_=/^\s*<(\w+|!)[^>]*>/,Z=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,$=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,R=/^(?:body|html)$/i,k=/([A-Z])/g,z=["val","css","html","text","data","width","height","offset"],F=["after","prepend","before","append"],q=M.createElement("table"),H=M.createElement("tr"),U={tr:M.createElement("tbody"),tbody:q,thead:q,tfoot:q,td:H,th:H,"*":M.createElement("div")},X=/complete|loaded|interactive/,I=/^[\w-]*$/,V={},Y=V.toString,B={},J=M.createElement("div"),W={tabindex:"tabIndex",readonly:"readOnly","for":"htmlFor","class":"className",maxlength:"maxLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",rowspan:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder",contenteditable:"contentEditable"},G=Array.isArray||function(t){return t instanceof Array};return B.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=J).appendChild(t),i=~B.qsa(r,e).indexOf(t),o&&J.removeChild(t),i},S=function(t){return t.replace(/-+(.)?/g,function(t,e){return e?e.toUpperCase():""})},C=function(t){return O.call(t,function(e,n){return t.indexOf(e)==n})},B.fragment=function(t,e,n){var i,r,a;return Z.test(t)&&(i=T(M.createElement(RegExp.$1))),i||(t.replace&&(t=t.replace($,"<$1>")),e===b&&(e=_.test(t)&&RegExp.$1),e in U||(e="*"),a=U[e],a.innerHTML=""+t,i=T.each(N.call(a.childNodes),function(){a.removeChild(this)})),o(n)&&(r=T(i),T.each(n,function(t,e){z.indexOf(t)>-1?r[t](e):r.attr(t,e)})),i},B.Z=function(t,e){return t=t||[],t.__proto__=T.fn,t.selector=e||"",t},B.isZ=function(t){return t instanceof B.Z},B.init=function(t,n){var i;if(!t)return B.Z();if("string"==typeof t)if(t=t.trim(),"<"==t[0]&&_.test(t))i=B.fragment(t,RegExp.$1,n),t=null;else{if(n!==b)return T(n).find(t);i=B.qsa(M,t)}else{if(e(t))return T(M).ready(t);if(B.isZ(t))return t;if(G(t))i=s(t);else if(r(t))i=[t],t=null;else if(_.test(t))i=B.fragment(t.trim(),RegExp.$1,n),t=null;else{if(n!==b)return T(n).find(t);i=B.qsa(M,t)}}return B.Z(i,t)},T=function(t,e){return B.init(t,e)},T.extend=function(t){var e,n=N.call(arguments,1);return"boolean"==typeof t&&(e=t,t=n.shift()),n.forEach(function(n){d(t,n,e)}),t},B.qsa=function(t,e){var n,r="#"==e[0],o=!r&&"."==e[0],a=r||o?e.slice(1):e,s=I.test(a);return i(t)&&s&&r?(n=t.getElementById(a))?[n]:[]:1!==t.nodeType&&9!==t.nodeType?[]:N.call(s&&!r?o?t.getElementsByClassName(a):t.getElementsByTagName(e):t.querySelectorAll(e))},T.contains=M.documentElement.contains?function(t,e){return t!==e&&t.contains(e)}:function(t,e){for(;e&&(e=e.parentNode);)if(e===t)return!0;return!1},T.type=t,T.isFunction=e,T.isWindow=n,T.isArray=G,T.isPlainObject=o,T.isEmptyObject=function(t){var e;for(e in t)return!1;return!0},T.inArray=function(t,e,n){return P.indexOf.call(e,t,n)},T.camelCase=S,T.trim=function(t){return null==t?"":String.prototype.trim.call(t)},T.uuid=0,T.support={},T.expr={},T.map=function(t,e){var n,i,r,o=[];if(a(t))for(i=0;i=0?t:t+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 P.every.call(this,function(e,n){return t.call(e,n,e)!==!1}),this},filter:function(t){return e(t)?this.not(this.not(t)):T(O.call(this,function(e){return B.matches(e,t)}))},add:function(t,e){return T(C(this.concat(T(t,e))))},is:function(t){return this.length>0&&B.matches(this[0],t)},not:function(t){var n=[];if(e(t)&&t.call!==b)this.each(function(e){t.call(this,e)||n.push(this)});else{var i="string"==typeof t?this.filter(t):a(t)&&e(t.item)?N.call(t):T(t);this.forEach(function(t){i.indexOf(t)<0&&n.push(t)})}return T(n)},has:function(t){return this.filter(function(){return r(t)?T.contains(this,t):T(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&&!r(t)?t:T(t)},last:function(){var t=this[this.length-1];return t&&!r(t)?t:T(t)},find:function(t){var e,n=this;return e=t?"object"==typeof t?T(t).filter(function(){var t=this;return P.some.call(n,function(e){return T.contains(e,t)})}):1==this.length?T(B.qsa(this[0],t)):this.map(function(){return B.qsa(this,t)}):T()},closest:function(t,e){var n=this[0],r=!1;for("object"==typeof t&&(r=T(t));n&&!(r?r.indexOf(n)>=0:B.matches(n,t));)n=n!==e&&!i(n)&&n.parentNode;return T(n)},parents:function(t){for(var e=[],n=this;n.length>0;)n=T.map(n,function(t){return(t=t.parentNode)&&!i(t)&&e.indexOf(t)<0?(e.push(t),t):void 0});return m(e,t)},parent:function(t){return m(C(this.pluck("parentNode")),t)},children:function(t){return m(this.map(function(){return p(this)}),t)},contents:function(){return this.map(function(){return N.call(this.childNodes)})},siblings:function(t){return m(this.map(function(t,e){return O.call(p(e.parentNode),function(t){return t!==e})}),t)},empty:function(){return this.each(function(){this.innerHTML=""})},pluck:function(t){return T.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 n=e(t);if(this[0]&&!n)var i=T(t).get(0),r=i.parentNode||this.length>1;return this.each(function(e){T(this).wrapAll(n?t.call(this,e):r?i.cloneNode(!0):i)})},wrapAll:function(t){if(this[0]){T(this[0]).before(t=T(t));for(var e;(e=t.children()).length;)t=e.first();T(t).append(this)}return this},wrapInner:function(t){var n=e(t);return this.each(function(e){var i=T(this),r=i.contents(),o=n?t.call(this,e):t;r.length?r.wrapAll(o):i.append(o)})},unwrap:function(){return this.parent().each(function(){T(this).replaceWith(T(this).children())}),this},clone:function(){return this.map(function(){return this.cloneNode(!0)})},hide:function(){return this.css("display","none")},toggle:function(t){return this.each(function(){var e=T(this);(t===b?"none"==e.css("display"):t)?e.show():e.hide()})},prev:function(t){return T(this.pluck("previousElementSibling")).filter(t||"*")},next:function(t){return T(this.pluck("nextElementSibling")).filter(t||"*")},html:function(t){return 0 in arguments?this.each(function(e){var n=this.innerHTML;T(this).empty().append(g(this,t,e,n))}):0 in this?this[0].innerHTML:null},text:function(t){return 0 in arguments?this.each(function(e){var n=g(this,t,e,this.textContent);this.textContent=null==n?"":""+n}):0 in this?this[0].textContent:null},attr:function(t,e){var n;return"string"!=typeof t||1 in arguments?this.each(function(n){if(1===this.nodeType)if(r(t))for(E in t)v(this,E,t[E]);else v(this,t,g(this,e,n,this.getAttribute(t)))}):this.length&&1===this[0].nodeType?!(n=this[0].getAttribute(t))&&t in this[0]?this[0][t]:n:b},removeAttr:function(t){return this.each(function(){1===this.nodeType&&t.split(" ").forEach(function(t){v(this,t)},this)})},prop:function(t,e){return t=W[t]||t,1 in arguments?this.each(function(n){this[t]=g(this,e,n,this[t])}):this[0]&&this[0][t]},data:function(t,e){var n="data-"+t.replace(k,"-$1").toLowerCase(),i=1 in arguments?this.attr(n,e):this.attr(n);return null!==i?x(i):b},val:function(t){return 0 in arguments?this.each(function(e){this.value=g(this,t,e,this.value)}):this[0]&&(this[0].multiple?T(this[0]).find("option").filter(function(){return this.selected}).pluck("value"):this[0].value)},offset:function(t){if(t)return this.each(function(e){var n=T(this),i=g(this,t,e,n.offset()),r=n.offsetParent().offset(),o={top:i.top-r.top,left:i.left-r.left};"static"==n.css("position")&&(o.position="relative"),n.css(o)});if(!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(e,n){if(arguments.length<2){var i,r=this[0];if(!r)return;if(i=getComputedStyle(r,""),"string"==typeof e)return r.style[S(e)]||i.getPropertyValue(e);if(G(e)){var o={};return T.each(e,function(t,e){o[e]=r.style[S(e)]||i.getPropertyValue(e)}),o}}var a="";if("string"==t(e))n||0===n?a=c(e)+":"+f(e,n):this.each(function(){this.style.removeProperty(c(e))});else for(E in e)e[E]||0===e[E]?a+=c(E)+":"+f(E,e[E])+";":this.each(function(){this.style.removeProperty(c(E))});return this.each(function(){this.style.cssText+=";"+a})},index:function(t){return t?this.indexOf(T(t)[0]):this.parent().children().indexOf(this[0])},hasClass:function(t){return t?P.some.call(this,function(t){return this.test(y(t))},l(t)):!1},addClass:function(t){return t?this.each(function(e){if("className"in this){j=[];var n=y(this),i=g(this,t,e,n);i.split(/\s+/g).forEach(function(t){T(this).hasClass(t)||j.push(t)},this),j.length&&y(this,n+(n?" ":"")+j.join(" "))}}):this},removeClass:function(t){return this.each(function(e){if("className"in this){if(t===b)return y(this,"");j=y(this),g(this,t,e,j).split(/\s+/g).forEach(function(t){j=j.replace(l(t)," ")}),y(this,j.trim())}})},toggleClass:function(t,e){return t?this.each(function(n){var i=T(this),r=g(this,t,n,y(this));r.split(/\s+/g).forEach(function(t){(e===b?!i.hasClass(t):e)?i.addClass(t):i.removeClass(t)})}):this},scrollTop:function(t){if(this.length){var e="scrollTop"in this[0];return t===b?e?this[0].scrollTop:this[0].pageYOffset:this.each(e?function(){this.scrollTop=t}:function(){this.scrollTo(this.scrollX,t)})}},scrollLeft:function(t){if(this.length){var e="scrollLeft"in this[0];return t===b?e?this[0].scrollLeft:this[0].pageXOffset:this.each(e?function(){this.scrollLeft=t}:function(){this.scrollTo(t,this.scrollY)})}},position:function(){if(this.length){var t=this[0],e=this.offsetParent(),n=this.offset(),i=R.test(e[0].nodeName)?{top:0,left:0}:e.offset();return n.top-=parseFloat(T(t).css("margin-top"))||0,n.left-=parseFloat(T(t).css("margin-left"))||0,i.top+=parseFloat(T(e[0]).css("border-top-width"))||0,i.left+=parseFloat(T(e[0]).css("border-left-width"))||0,{top:n.top-i.top,left:n.left-i.left}}},offsetParent:function(){return this.map(function(){for(var t=this.offsetParent||M.body;t&&!R.test(t.nodeName)&&"static"==T(t).css("position");)t=t.offsetParent;return t})}},T.fn.detach=T.fn.remove,["width","height"].forEach(function(t){var e=t.replace(/./,function(t){return t[0].toUpperCase()});T.fn[t]=function(r){var o,a=this[0];return r===b?n(a)?a["inner"+e]:i(a)?a.documentElement["scroll"+e]:(o=this.offset())&&o[t]:this.each(function(e){a=T(this),a.css(t,g(this,r,e,a[t]()))})}}),F.forEach(function(e,n){var i=n%2;T.fn[e]=function(){var e,r,o=T.map(arguments,function(n){return e=t(n),"object"==e||"array"==e||null==n?n:B.fragment(n)}),a=this.length>1;return o.length<1?this:this.each(function(t,e){r=i?e:e.parentNode,e=0==n?e.nextSibling:1==n?e.firstChild:2==n?e:null;var s=T.contains(M.documentElement,r);o.forEach(function(t){if(a)t=t.cloneNode(!0);else if(!r)return T(t).remove();r.insertBefore(t,e),s&&w(t,function(t){null==t.nodeName||"SCRIPT"!==t.nodeName.toUpperCase()||t.type&&"text/javascript"!==t.type||t.src||window.eval.call(window,t.innerHTML)})})})},T.fn[i?e+"To":"insert"+(n?"Before":"After")]=function(t){return T(t)[e](this),this}}),B.Z.prototype=T.fn,B.uniq=C,B.deserializeValue=x,T.zepto=B,T}();window.Zepto=Zepto,void 0===window.$&&(window.$=Zepto),function(t){function e(t){return t._zid||(t._zid=h++)}function n(t,n,o,a){if(n=i(n),n.ns)var s=r(n.ns);return(g[e(t)]||[]).filter(function(t){return!(!t||n.e&&t.e!=n.e||n.ns&&!s.test(t.ns)||o&&e(t.fn)!==e(o)||a&&t.sel!=a)})}function i(t){var e=(""+t).split(".");return{e:e[0],ns:e.slice(1).sort().join(" ")}}function r(t){return new RegExp("(?:^| )"+t.replace(" "," .* ?")+"(?: |$)")}function o(t,e){return t.del&&!y&&t.e in x||!!e}function a(t){return w[t]||y&&x[t]||t}function s(n,r,s,u,l,h,p){var d=e(n),m=g[d]||(g[d]=[]);r.split(/\s/).forEach(function(e){if("ready"==e)return t(document).ready(s);var r=i(e);r.fn=s,r.sel=l,r.e in w&&(s=function(e){var n=e.relatedTarget;return!n||n!==this&&!t.contains(this,n)?r.fn.apply(this,arguments):void 0}),r.del=h;var d=h||s;r.proxy=function(t){if(t=c(t),!t.isImmediatePropagationStopped()){t.data=u;var e=d.apply(n,t._args==f?[t]:[t].concat(t._args));return e===!1&&(t.preventDefault(),t.stopPropagation()),e}},r.i=m.length,m.push(r),"addEventListener"in n&&n.addEventListener(a(r.e),r.proxy,o(r,p))})}function u(t,i,r,s,u){var c=e(t);(i||"").split(/\s/).forEach(function(e){n(t,e,r,s).forEach(function(e){delete g[c][e.i],"removeEventListener"in t&&t.removeEventListener(a(e.e),e.proxy,o(e,u))})})}function c(e,n){return(n||!e.isDefaultPrevented)&&(n||(n=e),t.each(j,function(t,i){var r=n[t];e[t]=function(){return this[i]=b,r&&r.apply(n,arguments)},e[i]=E}),(n.defaultPrevented!==f?n.defaultPrevented:"returnValue"in n?n.returnValue===!1:n.getPreventDefault&&n.getPreventDefault())&&(e.isDefaultPrevented=b)),e}function l(t){var e,n={originalEvent:t};for(e in t)T.test(e)||t[e]===f||(n[e]=t[e]);return c(n,t)}var f,h=1,p=Array.prototype.slice,d=t.isFunction,m=function(t){return"string"==typeof t},g={},v={},y="onfocusin"in window,x={focus:"focusin",blur:"focusout"},w={mouseenter:"mouseover",mouseleave:"mouseout"};v.click=v.mousedown=v.mouseup=v.mousemove="MouseEvents",t.event={add:s,remove:u},t.proxy=function(n,i){var r=2 in arguments&&p.call(arguments,2);if(d(n)){var o=function(){return n.apply(i,r?r.concat(p.call(arguments)):arguments)};return o._zid=e(n),o}if(m(i))return r?(r.unshift(n[i],n),t.proxy.apply(null,r)):t.proxy(n[i],n);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 b=function(){return!0},E=function(){return!1},T=/^([A-Z]|returnValue$|layer[XY]$)/,j={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,n,i,r,o){var a,c,h=this;return e&&!m(e)?(t.each(e,function(t,e){h.on(t,n,i,e,o)}),h):(m(n)||d(r)||r===!1||(r=i,i=n,n=f),(d(i)||i===!1)&&(r=i,i=f),r===!1&&(r=E),h.each(function(f,h){o&&(a=function(t){return u(h,t.type,r),r.apply(this,arguments)}),n&&(c=function(e){var i,o=t(e.target).closest(n,h).get(0);return o&&o!==h?(i=t.extend(l(e),{currentTarget:o,liveFired:h}),(a||r).apply(o,[i].concat(p.call(arguments,1)))):void 0}),s(h,e,r,i,n,c||a)}))},t.fn.off=function(e,n,i){var r=this;return e&&!m(e)?(t.each(e,function(t,e){r.off(t,n,e)}),r):(m(n)||d(i)||i===!1||(i=n,n=f),i===!1&&(i=E),r.each(function(){u(this,e,i,n)}))},t.fn.trigger=function(e,n){return e=m(e)||t.isPlainObject(e)?t.Event(e):c(e),e._args=n,this.each(function(){e.type in x&&"function"==typeof this[e.type]?this[e.type]():"dispatchEvent"in this?this.dispatchEvent(e):t(this).triggerHandler(e,n)})},t.fn.triggerHandler=function(e,i){var r,o;return this.each(function(a,s){r=l(m(e)?t.Event(e):e),r._args=i,r.target=s,t.each(n(s,e.type||e),function(t,e){return o=e.proxy(r),r.isImmediatePropagationStopped()?!1:void 0})}),o},"focusin focusout focus blur 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 0 in arguments?this.bind(e,t):this.trigger(e)}}),t.Event=function(t,e){m(t)||(e=t,t=e.type);var n=document.createEvent(v[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),c(n)}}(Zepto),function(t){function e(e,n,i){var r=t.Event(n);return t(e).trigger(r,i),!r.isDefaultPrevented()}function n(t,n,i,r){return t.global?e(n||y,i,r):void 0}function i(e){e.global&&0===t.active++&&n(e,null,"ajaxStart")}function r(e){e.global&&!--t.active&&n(e,null,"ajaxStop")}function o(t,e){var i=e.context;return e.beforeSend.call(i,t,e)===!1||n(e,i,"ajaxBeforeSend",[t,e])===!1?!1:void n(e,i,"ajaxSend",[t,e])}function a(t,e,i,r){var o=i.context,a="success";i.success.call(o,t,a,e),r&&r.resolveWith(o,[t,a,e]),n(i,o,"ajaxSuccess",[e,i,t]),u(a,e,i)}function s(t,e,i,r,o){var a=r.context;r.error.call(a,i,e,t),o&&o.rejectWith(a,[i,e,t]),n(r,a,"ajaxError",[i,r,t||e]),u(e,i,r)}function u(t,e,i){var o=i.context;i.complete.call(o,e,t),n(i,o,"ajaxComplete",[e,i]),r(i)}function c(){}function l(t){return t&&(t=t.split(";",2)[0]),t&&(t==T?"html":t==E?"json":w.test(t)?"script":b.test(t)&&"xml")||"text"}function f(t,e){return""==e?t:(t+"&"+e).replace(/[&?]{1,2}/,"?")}function h(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=f(e.url,e.data),e.data=void 0)}function p(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 d(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?d(e,u,i,n):e.add(n,u)})}var m,g,v=0,y=window.document,x=/)<[^<]*)*<\/script>/gi,w=/^(?:text|application)\/javascript/i,b=/^(?:text|application)\/xml/i,E="application/json",T="text/html",j=/^\s*$/,S=y.createElement("a");S.href=window.location.href,t.active=0,t.ajaxJSONP=function(e,n){if(!("type"in e))return t.ajax(e);var i,r,u=e.jsonpCallback,c=(t.isFunction(u)?u():u)||"jsonp"+ ++v,l=y.createElement("script"),f=window[c],h=function(e){t(l).triggerHandler("error",e||"abort")},p={abort:h};return n&&n.promise(p),t(l).on("load error",function(o,u){clearTimeout(r),t(l).off().remove(),"error"!=o.type&&i?a(i[0],p,e,n):s(null,u||"error",p,e,n),window[c]=f,i&&t.isFunction(f)&&f(i[0]),f=i=void 0}),o(p,e)===!1?(h("abort"),p):(window[c]=function(){i=arguments},l.src=e.url.replace(/\?(.+)=\?/,"?$1="+c),y.head.appendChild(l),e.timeout>0&&(r=setTimeout(function(){h("timeout")},e.timeout)),p)},t.ajaxSettings={type:"GET",beforeSend:c,success:c,error:c,complete:c,context:null,global:!0,xhr:function(){return new window.XMLHttpRequest},accepts:{script:"text/javascript, application/javascript, application/x-javascript",json:E,xml:"application/xml, text/xml",html:T,text:"text/plain"},crossDomain:!1,timeout:0,processData:!0,cache:!0},t.ajax=function(e){var n,r=t.extend({},e||{}),u=t.Deferred&&t.Deferred();for(m in t.ajaxSettings)void 0===r[m]&&(r[m]=t.ajaxSettings[m]);i(r),r.crossDomain||(n=y.createElement("a"),n.href=r.url,n.href=n.href,r.crossDomain=S.protocol+"//"+S.host!=n.protocol+"//"+n.host),r.url||(r.url=window.location.toString()),h(r);var p=r.dataType,d=/\?.+=\?/.test(r.url);if(d&&(p="jsonp"),r.cache!==!1&&(e&&e.cache===!0||"script"!=p&&"jsonp"!=p)||(r.url=f(r.url,"_="+Date.now())),"jsonp"==p)return d||(r.url=f(r.url,r.jsonp?r.jsonp+"=?":r.jsonp===!1?"":"callback=?")),t.ajaxJSONP(r,u);var v,x=r.accepts[p],w={},b=function(t,e){w[t.toLowerCase()]=[t,e]},E=/^([\w-]+:)\/\//.test(r.url)?RegExp.$1:window.location.protocol,T=r.xhr(),C=T.setRequestHeader;if(u&&u.promise(T),r.crossDomain||b("X-Requested-With","XMLHttpRequest"),b("Accept",x||"*/*"),(x=r.mimeType||x)&&(x.indexOf(",")>-1&&(x=x.split(",",2)[0]),T.overrideMimeType&&T.overrideMimeType(x)),(r.contentType||r.contentType!==!1&&r.data&&"GET"!=r.type.toUpperCase())&&b("Content-Type",r.contentType||"application/x-www-form-urlencoded"),r.headers)for(g in r.headers)b(g,r.headers[g]);if(T.setRequestHeader=b,T.onreadystatechange=function(){if(4==T.readyState){T.onreadystatechange=c,clearTimeout(v);var e,n=!1;if(T.status>=200&&T.status<300||304==T.status||0==T.status&&"file:"==E){p=p||l(r.mimeType||T.getResponseHeader("content-type")),e=T.responseText;try{"script"==p?(1,eval)(e):"xml"==p?e=T.responseXML:"json"==p&&(e=j.test(e)?null:t.parseJSON(e))}catch(i){n=i}n?s(n,"parsererror",T,r,u):a(e,T,r,u)}else s(T.statusText||null,T.status?"error":"abort",T,r,u)}},o(T,r)===!1)return T.abort(),s(null,"abort",T,r,u),T;if(r.xhrFields)for(g in r.xhrFields)T[g]=r.xhrFields[g];var P="async"in r?r.async:!0;T.open(r.type,r.url,P,r.username,r.password);for(g in w)C.apply(T,w[g]);return r.timeout>0&&(v=setTimeout(function(){T.onreadystatechange=c,T.abort(),s(null,"timeout",T,r,u)},r.timeout)),T.send(r.data?r.data:null),T},t.get=function(){return t.ajax(p.apply(null,arguments))},t.post=function(){var e=p.apply(null,arguments);return e.type="POST",t.ajax(e)},t.getJSON=function(){var e=p.apply(null,arguments);return e.dataType="json",t.ajax(e)},t.fn.load=function(e,n,i){if(!this.length)return this;var r,o=this,a=e.split(/\s/),s=p(e,n,i),u=s.success;return a.length>1&&(s.url=a[0],r=a[1]),s.success=function(e){o.html(r?t("
          ").html(e.replace(x,"")).find(r):e),u&&u.apply(o,arguments)},t.ajax(s),this};var C=encodeURIComponent;t.param=function(e,n){var i=[];return i.add=function(e,n){t.isFunction(n)&&(n=n()),null==n&&(n=""),this.push(C(e)+"="+C(n))},d(i,e,n),i.join("&").replace(/%20/g,"+")}}(Zepto),function(t){t.fn.serializeArray=function(){var e,n,i=[],r=function(t){return t.forEach?t.forEach(r):void i.push({name:e,value:t})};return this[0]&&t.each(this[0].elements,function(i,o){n=o.type,e=o.name,e&&"fieldset"!=o.nodeName.toLowerCase()&&!o.disabled&&"submit"!=n&&"reset"!=n&&"button"!=n&&"file"!=n&&("radio"!=n&&"checkbox"!=n||o.checked)&&r(t(o).val())}),i},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(0 in arguments)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){function e(t,e,n,i){return Math.abs(t-e)>=Math.abs(n-i)?t-e>0?"Left":"Right":n-i>0?"Up":"Down"}function n(){l=null,h.last&&(h.el.trigger("longTap"),h={})}function i(){l&&clearTimeout(l),l=null}function r(){s&&clearTimeout(s),u&&clearTimeout(u),c&&clearTimeout(c),l&&clearTimeout(l),s=u=c=l=null,h={}}function o(t){return("touch"==t.pointerType||t.pointerType==t.MSPOINTER_TYPE_TOUCH)&&t.isPrimary}function a(t,e){return t.type=="pointer"+e||t.type.toLowerCase()=="mspointer"+e}var s,u,c,l,f,h={},p=750;t(document).ready(function(){var d,m,g,v,y=0,x=0;"MSGesture"in window&&(f=new MSGesture,f.target=document.body),t(document).bind("MSGestureEnd",function(t){var e=t.velocityX>1?"Right":t.velocityX<-1?"Left":t.velocityY>1?"Down":t.velocityY<-1?"Up":null;e&&(h.el.trigger("swipe"),h.el.trigger("swipe"+e))}).on("touchstart MSPointerDown pointerdown",function(e){(!(v=a(e,"down"))||o(e))&&(g=v?e:e.touches[0],e.touches&&1===e.touches.length&&h.x2&&(h.x2=void 0,h.y2=void 0),d=Date.now(),m=d-(h.last||d),h.el=t("tagName"in g.target?g.target:g.target.parentNode),s&&clearTimeout(s),h.x1=g.pageX,h.y1=g.pageY,m>0&&250>=m&&(h.isDoubleTap=!0),h.last=d,l=setTimeout(n,p),f&&v&&f.addPointer(e.pointerId))}).on("touchmove MSPointerMove pointermove",function(t){(!(v=a(t,"move"))||o(t))&&(g=v?t:t.touches[0],i(),h.x2=g.pageX,h.y2=g.pageY,y+=Math.abs(h.x1-h.x2),x+=Math.abs(h.y1-h.y2))}).on("touchend MSPointerUp pointerup",function(n){(!(v=a(n,"up"))||o(n))&&(i(),h.x2&&Math.abs(h.x1-h.x2)>30||h.y2&&Math.abs(h.y1-h.y2)>30?c=setTimeout(function(){h.el.trigger("swipe"),h.el.trigger("swipe"+e(h.x1,h.x2,h.y1,h.y2)),h={}},0):"last"in h&&(30>y&&30>x?u=setTimeout(function(){var e=t.Event("tap");e.cancelTouch=r,h.el.trigger(e),h.isDoubleTap?(h.el&&h.el.trigger("doubleTap"),h={}):s=setTimeout(function(){s=null,h.el&&h.el.trigger("singleTap"),h={}},250)},0):h={}),y=x=0)}).on("touchcancel MSPointerCancel pointercancel",r),t(window).on("scroll",r)}),["swipe","swipeLeft","swipeRight","swipeUp","swipeDown","doubleTap","tap","singleTap","longTap"].forEach(function(e){t.fn[e]=function(t){return this.on(e,t)}})}(Zepto),function(t,e){function n(t){return t.replace(/([a-z])([A-Z])/,"$1-$2").toLowerCase()}function i(t){return r?r+t:t.toLowerCase()}var r,o,a,s,u,c,l,f,h,p,d="",m={Webkit:"webkit",Moz:"",O:"o"},g=window.document,v=g.createElement("div"),y=/^((translate|rotate|scale)(X|Y|Z|3d)?|matrix(3d)?|perspective|skew(X|Y)?)$/i,x={};t.each(m,function(t,n){return v.style[t+"TransitionProperty"]!==e?(d="-"+t.toLowerCase()+"-",r=n,!1):void 0}),o=d+"transform",x[a=d+"transition-property"]=x[s=d+"transition-duration"]=x[c=d+"transition-delay"]=x[u=d+"transition-timing-function"]=x[l=d+"animation-name"]=x[f=d+"animation-duration"]=x[p=d+"animation-delay"]=x[h=d+"animation-timing-function"]="",t.fx={off:r===e&&v.style.transitionProperty===e,speeds:{_default:400,fast:200,slow:600},cssPrefix:d,transitionEnd:i("TransitionEnd"),animationEnd:i("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(i,r,d,m,g){var v,w,b,E={},T="",j=this,S=t.fx.transitionEnd,C=!1;if(r===e&&(r=t.fx.speeds._default/1e3),g===e&&(g=0),t.fx.off&&(r=0),"string"==typeof i)E[l]=i,E[f]=r+"s",E[p]=g+"s",E[h]=d||"linear",S=t.fx.animationEnd;else{w=[];for(v in i)y.test(v)?T+=v+"("+i[v]+") ":(E[v]=i[v],w.push(n(v)));T&&(E[o]=T,w.push(o)),r>0&&"object"==typeof i&&(E[a]=w.join(", "),E[s]=r+"s",E[c]=g+"s",E[u]=d||"linear")}return b=function(e){if("undefined"!=typeof e){if(e.target!==e.currentTarget)return;t(e.target).unbind(S,b)}else t(this).unbind(S,b);C=!0,t(this).css(x),m&&m.call(this)},r>0&&(this.bind(S,b),setTimeout(function(){C||b.call(j)},1e3*(r+g)+25)),this.size()&&this.get(0).clientLeft,this.css(E),0>=r&&setTimeout(function(){j.each(function(){b.call(this)})},0),this},v=null}(Zepto); \ No newline at end of file