├── assets ├── logo.png ├── favicon.png ├── logo-cube.png ├── logo-cube.xcf ├── logo-text.xcf ├── logo-vertical.png ├── logo-vertical.xcf ├── logo-horizontal.png ├── logo-horizontal.xcf ├── what-is-webpack.png ├── logo-vertical-quadratic.png ├── github.css ├── style.css ├── landing.css ├── highlight.pack.js ├── jmpress.custom.min.js ├── HMR.svg └── jmpress.custom.js ├── README.md ├── 404.html └── index.html /assets/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/webpack/webpack.github.com/master/assets/logo.png -------------------------------------------------------------------------------- /assets/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/webpack/webpack.github.com/master/assets/favicon.png -------------------------------------------------------------------------------- /assets/logo-cube.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/webpack/webpack.github.com/master/assets/logo-cube.png -------------------------------------------------------------------------------- /assets/logo-cube.xcf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/webpack/webpack.github.com/master/assets/logo-cube.xcf -------------------------------------------------------------------------------- /assets/logo-text.xcf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/webpack/webpack.github.com/master/assets/logo-text.xcf -------------------------------------------------------------------------------- /assets/logo-vertical.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/webpack/webpack.github.com/master/assets/logo-vertical.png -------------------------------------------------------------------------------- /assets/logo-vertical.xcf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/webpack/webpack.github.com/master/assets/logo-vertical.xcf -------------------------------------------------------------------------------- /assets/logo-horizontal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/webpack/webpack.github.com/master/assets/logo-horizontal.png -------------------------------------------------------------------------------- /assets/logo-horizontal.xcf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/webpack/webpack.github.com/master/assets/logo-horizontal.xcf -------------------------------------------------------------------------------- /assets/what-is-webpack.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/webpack/webpack.github.com/master/assets/what-is-webpack.png -------------------------------------------------------------------------------- /assets/logo-vertical-quadratic.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/webpack/webpack.github.com/master/assets/logo-vertical-quadratic.png -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # webpack.github.com 2 | 3 | This is the source of the slides for [webpack.github.com](http://webpack.github.com). 4 | 5 | ## License 6 | 7 | Copyright 2012 Tobias Koppers 8 | 9 | MIT License -------------------------------------------------------------------------------- /404.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |

404

9 | 10 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /assets/github.css: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | github.com style (c) Vasily Polovnyov 4 | 5 | */ 6 | 7 | pre code { 8 | display: block; padding: 0.5em; 9 | color: #000; 10 | background: #f8f8ff 11 | } 12 | 13 | pre .comment, 14 | pre .template_comment, 15 | pre .diff .header, 16 | pre .javadoc { 17 | color: #998; 18 | font-style: italic 19 | } 20 | 21 | pre .keyword, 22 | pre .css .rule .keyword, 23 | pre .winutils, 24 | pre .javascript .title, 25 | pre .lisp .title, 26 | pre .subst { 27 | color: #000; 28 | font-weight: bold 29 | } 30 | 31 | pre .number, 32 | pre .hexcolor { 33 | color: #40a070 34 | } 35 | 36 | pre .string, 37 | pre .tag .value, 38 | pre .phpdoc, 39 | pre .tex .formula { 40 | color: #d14 41 | } 42 | 43 | pre .title, 44 | pre .id { 45 | color: #900; 46 | font-weight: bold 47 | } 48 | 49 | pre .javascript .title, 50 | pre .lisp .title, 51 | pre .subst { 52 | font-weight: normal 53 | } 54 | 55 | pre .class .title, 56 | pre .haskell .label, 57 | pre .tex .command { 58 | color: #458; 59 | font-weight: bold 60 | } 61 | 62 | pre .tag, 63 | pre .tag .title, 64 | pre .rules .property, 65 | pre .django .tag .keyword { 66 | color: #000080; 67 | font-weight: normal 68 | } 69 | 70 | pre .attribute, 71 | pre .variable, 72 | pre .instancevar, 73 | pre .lisp .body { 74 | color: #008080 75 | } 76 | 77 | pre .regexp { 78 | color: #009926 79 | } 80 | 81 | pre .class { 82 | color: #458; 83 | font-weight: bold 84 | } 85 | 86 | pre .symbol, 87 | pre .ruby .symbol .string, 88 | pre .ruby .symbol .keyword, 89 | pre .ruby .symbol .keymethods, 90 | pre .lisp .keyword, 91 | pre .tex .special, 92 | pre .input_number { 93 | color: #990073 94 | } 95 | 96 | pre .builtin, 97 | pre .built_in, 98 | pre .lisp .title { 99 | color: #0086b3 100 | } 101 | 102 | pre .preprocessor, 103 | pre .pi, 104 | pre .doctype, 105 | pre .shebang, 106 | pre .cdata { 107 | color: #999; 108 | font-weight: bold 109 | } 110 | 111 | pre .deletion { 112 | background: #fdd 113 | } 114 | 115 | pre .addition { 116 | background: #dfd 117 | } 118 | 119 | pre .diff .change { 120 | background: #0086b3 121 | } 122 | 123 | pre .chunk { 124 | color: #aaa 125 | } 126 | 127 | pre .tex .formula { 128 | opacity: 0.5; 129 | } 130 | -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | webpack module bundler 7 | 8 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 |

OUTDATED

19 |
20 | 39 |
40 |
webpack
MODULE BUNDLER
41 | 42 |
43 |
44 |
45 |
46 |
47 | Getting started by reading the documentation, which also contains an introduction and a tutorial. 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 | Fork me on GitHub 80 | 81 | 99 | 100 | 101 | 102 | -------------------------------------------------------------------------------- /assets/style.css: -------------------------------------------------------------------------------- 1 | /* 2 | * http://meyerweb.com/eric/tools/css/reset/ 3 | * v2.0 | 20110126 4 | * License: none (public domain) 5 | */ 6 | html, body, div, span, applet, object, iframe, 7 | h1, h2, h3, h4, h5, h6, p, blockquote, pre, 8 | a, abbr, acronym, address, big, cite, code, 9 | del, dfn, em, img, ins, kbd, q, s, samp, 10 | small, strike, strong, sub, sup, tt, var, 11 | b, u, i, center, 12 | dl, dt, dd, ol, ul, li, 13 | fieldset, form, label, legend, 14 | table, caption, tbody, tfoot, thead, tr, th, td, 15 | article, aside, canvas, details, embed, 16 | figure, figcaption, footer, header, hgroup, 17 | menu, nav, output, ruby, section, summary, 18 | time, mark, audio, video { 19 | margin: 0; 20 | padding: 0; 21 | border: 0; 22 | font-size: 100%; 23 | font: inherit; 24 | vertical-align: baseline; 25 | } 26 | 27 | /* HTML5 display-role reset for older browsers */ 28 | article, aside, details, figcaption, figure, 29 | footer, header, hgroup, menu, nav, section { 30 | display: block; 31 | } 32 | html { 33 | width: 100%; 34 | } 35 | body { 36 | line-height: 1; 37 | border-width: 0px !important; 38 | } 39 | ol, ul { 40 | list-style: none; 41 | } 42 | blockquote, q { 43 | quotes: none; 44 | } 45 | blockquote:before, blockquote:after, 46 | q:before, q:after { 47 | content: ''; 48 | content: none; 49 | } 50 | table { 51 | border-collapse: collapse; 52 | border-spacing: 0; 53 | } 54 | 55 | /* ========================================== */ 56 | 57 | .will-fade { 58 | -webkit-transition: opacity 1s; 59 | -moz-transition: opacity 1s; 60 | -ms-transition: opacity 1s; 61 | -o-transition: opacity 1s; 62 | transition: opacity 1s; 63 | 64 | opacity: 0; 65 | } 66 | .do-fade { 67 | opacity: 1; 68 | } 69 | 70 | 71 | /* ========================================== */ 72 | 73 | body { 74 | font-family: 'Open Sans', sans-serif; 75 | font-size: 20px; 76 | background-color: #eee; 77 | -webkit-font-smoothing: antialiased; 78 | -webkit-transform: translate3d(0,0,1px); 79 | -moz-transform: translate3d(0,0,1px); 80 | -ms-transform: translate3d(0,0,1px); 81 | -o-transform: translate3d(0,0,1px); 82 | transform: translate3d(0,0,1px); 83 | } 84 | h1 { font-size: 150%; font-weight: 800; } 85 | h2 { font-size: 140%; font-weight: 700; } 86 | h3 { font-size: 130%; font-weight: 700; } 87 | h4 { font-size: 120%; font-weight: 700; } 88 | h5 { font-size: 110%; font-weight: 700; } 89 | p { font-size: 100%; } 90 | .smaller { font-size: 80%; } 91 | ul { padding-left: 20px; } 92 | li { font-size: 20px; list-style: circle; } 93 | strong { font-weight: 700; } 94 | em { font-style: italic; } 95 | pre { font-family: monospace; font-size: 20px; } 96 | code { font-family: monospace; } 97 | 98 | section { 99 | padding: 40px; 100 | 101 | line-height: 1.5; 102 | font-size: 30px; 103 | } 104 | 105 | .jmpress-initialized section { 106 | width: 980px; 107 | height: 640px; 108 | 109 | -webkit-box-sizing: border-box; 110 | -moz-box-sizing: border-box; 111 | -ms-box-sizing: border-box; 112 | -o-box-sizing: border-box; 113 | box-sizing: border-box; 114 | 115 | pointer-events: auto; 116 | } 117 | 118 | .jmpress-only { 119 | display: none; 120 | } 121 | 122 | .jmpress-initialized .jmpress-only { 123 | display: inherit; 124 | } 125 | 126 | .global-next, .global-prev { 127 | position: fixed; 128 | bottom: 50%; 129 | display: none; 130 | padding: 0px; 131 | background: #333; 132 | border-radius: 100%; 133 | width: 100px; 134 | height: 100px; 135 | cursor: pointer; 136 | 137 | pointer-events: auto; 138 | } 139 | 140 | .global-prev { 141 | left: -50px; 142 | border-top-left-radius: 0px; 143 | border-bottom-left-radius: 0px; 144 | } 145 | 146 | .global-next { 147 | right: -50px; 148 | border-top-right-radius: 0px; 149 | border-bottom-right-radius: 0px; 150 | } 151 | 152 | .global-down { 153 | position: fixed; 154 | top: 60%; 155 | right: -500px; 156 | border-radius: 50px; 157 | border-top-right-radius: 0px; 158 | border-bottom-right-radius: 0px; 159 | display: none; 160 | padding: 40px; 161 | padding-right: 90px; 162 | background: #333; 163 | height: 100px; 164 | cursor: pointer; 165 | color: white; 166 | 167 | -webkit-box-sizing: border-box; 168 | -moz-box-sizing: border-box; 169 | -ms-box-sizing: border-box; 170 | -o-box-sizing: border-box; 171 | box-sizing: border-box; 172 | 173 | -webkit-transition: right 1s; 174 | -moz-transition: right 1s; 175 | -ms-transition: right 1s; 176 | -o-transition: right 1s; 177 | transition: right 1s; 178 | 179 | pointer-events: auto; 180 | } 181 | 182 | .global-down.active { 183 | right: -50px; 184 | } 185 | 186 | .jmpress-initialized .global-down, .jmpress-initialized .global-next, .jmpress-initialized .global-prev { 187 | display: block; 188 | } 189 | 190 | footer { 191 | position: fixed; 192 | bottom: 0px; 193 | left: 0px; 194 | right: 0px; 195 | padding: 5px; 196 | } 197 | 198 | .strike-if-on.on { 199 | text-decoration: line-through; 200 | } 201 | 202 | .strike-if-off.off { 203 | text-decoration: line-through; 204 | } 205 | 206 | table.compare { 207 | width: 100%; 208 | } 209 | 210 | table.compare th { 211 | text-align: left; 212 | font-weight: 800; 213 | } 214 | 215 | table.compare td { 216 | font-size: 20px; 217 | } 218 | 219 | table.compare td.plus { 220 | color: #393; 221 | } 222 | 223 | table.compare td.minus { 224 | color: #933; 225 | } 226 | -------------------------------------------------------------------------------- /assets/landing.css: -------------------------------------------------------------------------------- 1 | @import url(//fonts.googleapis.com/css?family=Averia+Sans+Libre:400,700,400italic,700italic|Ubuntu+Mono:400,700|Kreon:400,700);@keyframes slowspin{0%{transform:rotateX(-33.5deg) rotateY(45deg)}10%,to{transform:rotateX(-33.5deg) rotateY(225deg)}}@keyframes fastspin{0%{transform:rotateX(-33.5deg) rotateY(45deg)}10%,to{transform:rotateX(-33.5deg) rotateY(-315deg)}}a,abbr,acronym,address,applet,big,blockquote,body,caption,cite,code,dd,del,dfn,div,dl,dt,em,fieldset,form,h1,h2,h3,h4,h5,h6,html,iframe,img,ins,kbd,label,legend,li,object,ol,p,pre,q,s,samp,small,span,strike,strong,sub,sup,table,tbody,td,tfoot,th,thead,tr,tt,ul,var{margin:0;padding:0;border:0;outline:0;font-weight:inherit;font-style:inherit;font-family:inherit;font-size:100%;vertical-align:baseline}body{line-height:1;color:#000;background:#fff}ol,ul{list-style:none}table{border-collapse:separate;border-spacing:0}caption,table,td,th{vertical-align:middle}caption,td,th{text-align:left;font-weight:400}a img{border:none}body{font-size:1pc;background-color:#fff;line-height:1.4;color:#333;font-family:Helvetica,Arial,freesans,clean,sans-serif}h1{font-size:30px;text-transform:uppercase;border-bottom:1px solid #ddd}h2{font-size:24px;font-weight:700}h3{font-size:22px;font-weight:400}h4{font-size:18px}h1,h2,h3{margin-top:20px}h1,h2,h3,h4,h5,h6{margin-bottom:10px}h4,h5,h6{margin-top:10px}h1,h2,h3,h4,h5,h6{font-family:Helvetica,Arial,freesans,clean,sans-serif;font-weight:500;line-height:1.1}.page-header{padding:0;margin:40px 0 20px;text-transform:uppercase;text-align:right;background-color:#eee;border-right:10px solid #ddd;padding:.5em;color:#333}.page-header h1{margin:0;padding:0;border:none}a{color:#006a86;text-decoration:none}a:active,a:hover{outline:0}a:focus,a:hover{color:#004a5e;text-decoration:underline}hr{margin-top:20px;margin-bottom:20px;border:none;border-top:1px dashed #999;color:#fff;background-color:#fff;height:1px}p{margin-bottom:10px}ul{display:block;list-style-type:disc;-webkit-margin-before:1em;-webkit-margin-after:1em;-webkit-margin-start:0;-webkit-margin-end:0;-webkit-padding-start:40px}ol{list-style-type:decimal}ol li{margin-left:35px}ol,ul{margin-top:0;margin-bottom:10px}li{display:list-item;text-align:-webkit-match-parent}code,pre{color:#333;background-color:#f5f5f5;border-radius:4px}code{padding:2px 4px;font-size:90%;white-space:nowrap}pre{display:block;padding:9.5px;margin:0 0 10px;font-size:13px;word-break:break-all;word-wrap:break-word;border:1px solid #ccc}pre code{padding:0;font-size:inherit;color:inherit;white-space:pre-wrap;background-color:transparent;border-radius:0}code{font-family:Ubuntu Mono,Courier New,monospace}strong{font-weight:700}.pull-right{float:right!important}.table{border:1px solid #ddd;width:100%;max-width:100%;margin-bottom:20px}.table>thead>tr>th{border-bottom-width:2px;border-bottom:2px solid #ddd;font-weight:700}.table>tbody>tr>td,.table>thead>tr>th{border:1px solid #ddd;vertical-align:bottom;padding:8px;border-top:0}.table>tbody>tr:nth-child(odd)>td,blockquote{background-color:#f9f9f9}blockquote{padding:5px 20px;margin:.5em 0 1em;border-left:5px solid #ddd;font-style:italic}.panel{margin-bottom:20px;background-color:#fff;border-radius:4px;box-shadow:0 1px 1px rgba(0,0,0,.05);border:1px solid transparent}.panel.panel-add{border-color:#d6e9c6;background-color:#dff0d8;color:#468847}.panel.panel-update{border-color:#bce8f1;background-color:#d9edf7;color:#3a87ad}.panel>pre{margin:0}.panel>.panel-title{padding:10px 15px;border-bottom:1px solid transparent;border-top-right-radius:3px;border-top-left-radius:3px;margin-top:0;margin-bottom:0;font-size:1pc}p>img{max-width:100%}.announcement{text-align:center}.announcement .announcement-inner{display:inline-block;border-left:1px solid #333;border-right:1px solid #333;border-bottom:1px solid #333;border-bottom-left-radius:5px;border-bottom-right-radius:5px;padding:4px 10px 3px;font-weight:700;background:#f9f9f9}.announcement .announcement-inner em{font-weight:400;font-style:italic;font-size:70%}@media (min-width:992px){.row{display:-ms-flexbox;display:flex}.row .col-md-3,.row .col-md-6,.row .col-md-9,.row .col-md-12{padding-left:15px;padding-right:15px}.row .col-md-3{-ms-flex:3;flex:3;min-width:0}.row .col-md-6{-ms-flex:6;flex:6;min-width:0}.row .col-md-9{-ms-flex:9;flex:9;min-width:0}.row .col-md-12{-ms-flex:12;flex:12;min-width:0}}.nav{background-color:#eee}.sidebar{font-size:.8em}.sidebar h1{font-size:18pt}.sidebar ul{margin:0;padding:0}.sidebar ul li{text-transform:uppercase;padding:0;margin:0 0 1em;list-style:none;color:#333}.sidebar ul li ul{margin:0;padding:0;border-top:1px solid #ddd}.sidebar ul li ul li{margin:0;padding:.5em 0 0 1em;text-transform:none;border:none;color:#000;font-size:1.2em}.sidebar ul li ul li li{font-size:1em}.sidebar .active{font-weight:700;color:#333;display:block;border-right:4px solid #ddd}.searchbox{margin:20px 0 15px}.logo{width:100%;height:220px;position:relative;overflow:hidden}.name{font-size:2em;font-weight:700;margin-left:-70px;line-height:1.2em}.name,.tagline{font-family:Averia Sans Libre,Arial,freesans,clean,sans-serif;padding-left:50%}.tagline{font-size:.8em;margin-left:-30px}.cube{width:100%;height:100%;padding:0;margin:-50px 0;transform-origin:50px 50px;transform:rotateX(-33.5deg) rotateY(45deg);transform-style:preserve-3d;animation:slowspin 10s ease-in-out infinite 2s;margin:-50px 0 0 -50px;top:50%;left:50%}.cube,.cube li{position:absolute;display:block}.cube li{width:75pt;height:75pt;transition:transform 1s ease-in-out}.cube .back,.cube .front,.cube .left,.cube .right,.cube .top{background:radial-gradient(transparent 30%,rgba(16,47,91,.2) 100%)}.cube li:after{content:"";display:block;position:absolute;width:75pt;height:75pt;backface-visibility:hidden;background-color:rgba(126,169,232,.5);transition:transform 1s ease-in-out}.cube .front{transform:translateZ(50px)}.cube .back{transform:rotateX(-180deg) translateZ(50px)}.cube .right{transform:rotateY(90deg) translateZ(50px)}.cube .left{transform:rotateY(-90deg) translateZ(50px)}.cube .top{transform:rotateX(90deg) translateZ(50px)}.cube .top:after{background-color:rgba(152,186,237,.5)}.cube .bottom{transform:rotateX(-90deg) translateZ(50px)}.cube .floor:after{display:none}.cube .floor{box-shadow:-300px 0 50px rgba(0,0,0,.3);backface-visibility:visible;width:110px;height:110px;left:295px;background-color:transparent;transform:rotateX(-90deg) translateZ(60px)}.cube-inner{width:100%;height:100%;padding:0;margin:-25px 0;top:50%;left:50%;transform-origin:25px 25px;margin:-25px 0 0 -25px;transform:rotateX(-33.5deg) rotateY(45deg);transform-style:preserve-3d;animation:fastspin 10s ease-in-out infinite 2s}.cube-inner,.cube-inner li{position:absolute;display:block}.cube-inner li{width:50px;height:50px;transition:transform 1s ease-in-out}.cube-inner .back,.cube-inner .front,.cube-inner .left,.cube-inner .right,.cube-inner .top{background:radial-gradient(transparent 30%,rgba(5,17,53,.2) 100%)}.cube-inner li:after{content:"";display:block;position:absolute;width:50px;height:50px;backface-visibility:hidden;background-color:rgba(16,58,177,.5);transition:transform 1s ease-in-out}.cube-inner .front{transform:translateZ(25px)}.cube-inner .back{transform:rotateX(-180deg) translateZ(25px)}.cube-inner .right{transform:rotateY(90deg) translateZ(25px)}.cube-inner .left{transform:rotateY(-90deg) translateZ(25px)}.cube-inner .top{transform:rotateX(90deg) translateZ(25px)}.cube-inner .top:after{background-color:rgba(22,78,234,.5)}.cube-inner .bottom{transform:rotateX(-90deg) translateZ(25px)}.cube-inner .floor:after{display:none}.cube-inner .floor{box-shadow:-300px 0 50px rgba(0,0,0,.3);backface-visibility:visible;width:60px;height:60px;left:295px;background-color:transparent;transform:rotateX(-90deg) translateZ(35px)}.deprecation{border:1px solid red;padding:2em;font-size:1.2em;font-weight:400;margin-bottom:1em}.intro{margin:30px 0 50px;font-size:1.5em;text-align:center}.intro strong{font-family:Averia Sans Libre,Arial,freesans,clean,sans-serif}.intro .types{display:inline-block;position:relative;top:51px;padding:0 5px;margin:0}.intro .types li{list-style:none;padding:0;margin:0}.feature{border:2px solid #ccc;background:#f5f5f5;padding:5px;margin:10px} 2 | -------------------------------------------------------------------------------- /assets/highlight.pack.js: -------------------------------------------------------------------------------- 1 | var hljs=new function(){function m(p){return p.replace(/&/gm,"&").replace(/"}while(y.length||z.length){var v=u().splice(0,1)[0];w+=m(x.substr(r,v.offset-r));r=v.offset;if(v.event=="start"){w+=s(v.node);t.push(v.node)}else{if(v.event=="stop"){var p,q=t.length;do{q--;p=t[q];w+=("")}while(p!=v.node);t.splice(q,1);while(q'+L[0]+""}else{N+=L[0]}P=O.lR.lastIndex;L=O.lR.exec(M)}return N+M.substr(P,M.length-P)}function K(r,M){if(M.sL&&d[M.sL]){var L=e(M.sL,r);t+=L.keyword_count;return L.value}else{return F(r,M)}}function I(M,r){var L=M.cN?'':"";if(M.rB){q+=L;M.buffer=""}else{if(M.eB){q+=m(r)+L;M.buffer=""}else{q+=L;M.buffer=r}}C.push(M);B+=M.r}function E(O,L,Q){var R=C[C.length-1];if(Q){q+=K(R.buffer+O,R);return false}var M=z(L,R);if(M){q+=K(R.buffer+O,R);I(M,L);return M.rB}var r=w(C.length-1,L);if(r){var N=R.cN?"":"";if(R.rE){q+=K(R.buffer+O,R)+N}else{if(R.eE){q+=K(R.buffer+O,R)+N+m(L)}else{q+=K(R.buffer+O+L,R)+N}}while(r>1){N=C[C.length-2].cN?"":"";q+=N;r--;C.length--}var P=C[C.length-1];C.length--;C[C.length-1].buffer="";if(P.starts){I(P.starts,"")}return R.rE}if(x(L,R)){throw"Illegal"}}var H=d[J];var C=[H.dM];var B=0;var t=0;var q="";try{var y,v=0;H.dM.buffer="";do{y=s(D,v);var u=E(y[0],y[1],y[2]);v+=y[0].length;if(!u){v+=y[1].length}}while(!y[2]);if(C.length>1){throw"Illegal"}return{r:B,keyword_count:t,value:q}}catch(G){if(G=="Illegal"){return{r:0,keyword_count:0,value:m(D)}}else{throw G}}}function f(t){var r={keyword_count:0,r:0,value:m(t)};var q=r;for(var p in d){if(!d.hasOwnProperty(p)){continue}var s=e(p,t);s.language=p;if(s.keyword_count+s.r>q.keyword_count+q.r){q=s}if(s.keyword_count+s.r>r.keyword_count+r.r){q=r;r=s}}if(q.language){r.second_best=q}return r}function h(r,q,p){if(q){r=r.replace(/^((<[^>]+>|\t)+)/gm,function(t,w,v,u){return w.replace(/\t/g,q)})}if(p){r=r.replace(/\n/g,"
")}return r}function o(u,x,q){var y=g(u,q);var s=a(u);var w,r;if(s=="no-highlight"){return}if(s){w=e(s,y)}else{w=f(y);s=w.language}var p=b(u);if(p.length){r=document.createElement("pre");r.innerHTML=w.value;w.value=l(p,b(r),y)}w.value=h(w.value,x,q);var t=u.className;if(!t.match("(\\s|^)(language-)?"+s+"(\\s|$)")){t=t?(t+" "+s):s}if(/MSIE [678]/.test(navigator.userAgent)&&u.tagName=="CODE"&&u.parentNode.tagName=="PRE"){r=u.parentNode;var v=document.createElement("div");v.innerHTML="
"+w.value+"
";u=v.firstChild.firstChild;v.firstChild.cN=r.cN;r.parentNode.replaceChild(v.firstChild,r)}else{u.innerHTML=w.value}u.className=t;u.result={language:s,kw:w.keyword_count,re:w.r};if(w.second_best){u.second_best={language:w.second_best.language,kw:w.second_best.keyword_count,re:w.second_best.r}}}function k(){if(k.called){return}k.called=true;var r=document.getElementsByTagName("pre");for(var p=0;p|>=|>>|>>=|>>>|>>>=|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~";this.BE={b:"\\\\.",r:0};this.ASM={cN:"string",b:"'",e:"'",i:"\\n",c:[this.BE],r:0};this.QSM={cN:"string",b:'"',e:'"',i:"\\n",c:[this.BE],r:0};this.CLCM={cN:"comment",b:"//",e:"$"};this.CBLCLM={cN:"comment",b:"/\\*",e:"\\*/"};this.HCM={cN:"comment",b:"#",e:"$"};this.NM={cN:"number",b:this.NR,r:0};this.CNM={cN:"number",b:this.CNR,r:0};this.BINARY_NUMBER_MODE={cN:"number",b:this.BINARY_NUMBER_RE,r:0};this.inherit=function(p,s){var r={};for(var q in p){r[q]=p[q]}if(s){for(var q in s){r[q]=s[q]}}return r}}();hljs.LANGUAGES.javascript={dM:{k:{keyword:{"in":1,"if":1,"for":1,"while":1,"finally":1,"var":1,"new":1,"function":1,"do":1,"return":1,"void":1,"else":1,"break":1,"catch":1,"instanceof":1,"with":1,"throw":1,"case":1,"default":1,"try":1,"this":1,"switch":1,"continue":1,"typeof":1,"delete":1},literal:{"true":1,"false":1,"null":1}},c:[hljs.ASM,hljs.QSM,hljs.CLCM,hljs.CBLCLM,hljs.CNM,{b:"("+hljs.RSR+"|case|return|throw)\\s*",k:{"return":1,"throw":1,"case":1},c:[hljs.CLCM,hljs.CBLCLM,{cN:"regexp",b:"/",e:"/[gim]*",c:[{b:"\\\\/"}]}],r:0},{cN:"function",b:"\\bfunction\\b",e:"{",k:{"function":1},c:[{cN:"title",b:"[A-Za-z$_][0-9A-Za-z$_]*"},{cN:"params",b:"\\(",e:"\\)",c:[hljs.ASM,hljs.QSM,hljs.CLCM,hljs.CBLCLM]}]}]}};hljs.LANGUAGES.css=function(){var a={cN:"function",b:hljs.IR+"\\(",e:"\\)",c:[{eW:true,eE:true,c:[hljs.NM,hljs.ASM,hljs.QSM]}]};return{cI:true,dM:{i:"[=/|']",c:[hljs.CBLCLM,{cN:"id",b:"\\#[A-Za-z0-9_-]+"},{cN:"class",b:"\\.[A-Za-z0-9_-]+",r:0},{cN:"attr_selector",b:"\\[",e:"\\]",i:"$"},{cN:"pseudo",b:":(:)?[a-zA-Z0-9\\_\\-\\+\\(\\)\\\"\\']+"},{cN:"at_rule",b:"@(font-face|page)",l:"[a-z-]+",k:{"font-face":1,page:1}},{cN:"at_rule",b:"@",e:"[{;]",eE:true,k:{"import":1,page:1,media:1,charset:1},c:[a,hljs.ASM,hljs.QSM,hljs.NM]},{cN:"tag",b:hljs.IR,r:0},{cN:"rules",b:"{",e:"}",i:"[^\\s]",r:0,c:[hljs.CBLCLM,{cN:"rule",b:"[^\\s]",rB:true,e:";",eW:true,c:[{cN:"attribute",b:"[A-Z\\_\\.\\-]+",e:":",eE:true,i:"[^\\s]",starts:{cN:"value",eW:true,eE:true,c:[a,hljs.NM,hljs.QSM,hljs.ASM,hljs.CBLCLM,{cN:"hexcolor",b:"\\#[0-9A-F]+"},{cN:"important",b:"!important"}]}}]}]}]}}}();hljs.LANGUAGES.xml=function(){var b="[A-Za-z0-9\\._:-]+";var a={eW:true,c:[{cN:"attribute",b:b,r:0},{b:'="',rB:true,e:'"',c:[{cN:"value",b:'"',eW:true}]},{b:"='",rB:true,e:"'",c:[{cN:"value",b:"'",eW:true}]},{b:"=",c:[{cN:"value",b:"[^\\s/>]+"}]}]};return{cI:true,dM:{c:[{cN:"pi",b:"<\\?",e:"\\?>",r:10},{cN:"doctype",b:"",r:10,c:[{b:"\\[",e:"\\]"}]},{cN:"comment",b:"",r:10},{cN:"cdata",b:"<\\!\\[CDATA\\[",e:"\\]\\]>",r:10},{cN:"tag",b:"|$)",e:">",k:{title:{style:1}},c:[a],starts:{cN:"css",e:"",rE:true,sL:"css"}},{cN:"tag",b:"|$)",e:">",k:{title:{script:1}},c:[a],starts:{cN:"javascript",e:"<\/script>",rE:true,sL:"javascript"}},{cN:"vbscript",b:"<%",e:"%>",sL:"vbscript"},{cN:"tag",b:"",c:[{cN:"title",b:"[^ />]+"},a]}]}}}(); -------------------------------------------------------------------------------- /assets/jmpress.custom.min.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * jmpress.js v0.4.3 3 | * http://shama.github.com/jmpress.js 4 | * 5 | * A jQuery plugin to build a website on the infinite canvas. 6 | * 7 | * Copyright 112 Kyle Robinson Young @shama & Tobias Koppers @sokra 8 | * Licensed MIT 9 | * http://www.opensource.org/licenses/mit-license.php 10 | * 11 | * Based on the foundation laid by Bartek Szopka @bartaz 12 | *//*! 13 | * core.js 14 | * The core of jmpress.js 15 | */(function(e,t,n,r){"use strict";function s(e){if(!e)return;var t=1+e.substr(1).search(/[A-Z]/),n=e.substr(0,t).toLowerCase(),r=e.substr(t).toLowerCase();return"-"+n+"-"+r}function o(e){return e?e+",":""}function l(i){function E(t,n){var r=d(t),i={oldStyle:e(t).attr("style")||""},s={data:r,stepData:i};N.call(this,"beforeInitStep",e(t),s),i.delegate=r.delegate,N.call(this,"initStep",e(t),s),e(t).data("stepData",i),e(t).attr("id")||e(t).attr("id","step-"+(n+1)),N.call(this,"applyStep",e(t),s)}function S(t){var n=e(t).data("stepData");e(t).attr("style",n.oldStyle),N.call(this,"unapplyStep",e(t),{stepData:n})}function x(t){N.call(this,"unapplyStep",e(t),{stepData:t.data("stepData")}),N.call(this,"applyStep",e(t),{stepData:t.data("stepData")})}function T(){y&&N.call(this,"setInactive",y,{stepData:e(y).data("stepData"),reason:"deinit"}),g.jmpressClass&&e(l).removeClass(g.jmpressClass),N.call(this,"beforeDeinit",e(this),{}),e(f.stepSelector,l).each(function(e){S.call(l,this)}),c.attr("style",v.container),f.fullscreen&&e("html").attr("style",""),h.attr("style",v.area),e(m).children().each(function(){l.append(e(this))}),f.fullscreen?m.remove():(m.remove(),h.remove()),N.call(this,"afterDeinit",e(this),{}),e(l).data("jmpressmethods",!1)}function N(t,n,r){r.settings=f,r.current=g,r.container=c,r.parents=n?C(n):null,r.current=g,r.jmpress=this;var i={};return e.each(f[t],function(e,t){i.value=t.call(l,n,r)||i.value}),i.value}function C(t){return e(t).parentsUntil(l).not(l).filter(f.stepSelector)}function k(e){return L({step:y,substep:b},e)}function L(t,n){var i;e.isPlainObject(t)&&(i=t.substep,t=t.step),typeof t=="string"&&(t=l.find(t).first());if(!t||!e(t).data("stepData"))return!1;A.call(this);var s=e(t).data("stepData"),o=!1;N.call(this,"beforeChange",t,{stepData:s,reason:n,cancel:function(){o=!0}});if(o)return r;var u={},a=t;e(t).data("stepData").delegate&&(a=e(t).parentsUntil(l).filter(f.stepSelector).filter(s.delegate)||e(t).near(s.delegate)||e(t).near(s.delegate,!0)||e(s.delegate,l),s=a.data("stepData")),w&&N.call(this,"setInactive",w,{stepData:e(w).data("stepData"),delegatedFrom:y,reason:n,target:u,nextStep:a,nextSubstep:i,nextStepData:s});var c={stepData:s,delegatedFrom:t,reason:n,target:u,substep:i,prevStep:w,prevSubstep:b,prevStepData:w&&e(w).data("stepData")};return N.call(this,"beforeActive",a,c),N.call(this,"setActive",a,c),g.jmpressClass&&e(l).removeClass(g.jmpressClass),e(l).addClass(g.jmpressClass="step-"+e(a).attr("id")),g.jmpressDelegatedClass&&e(l).removeClass(g.jmpressDelegatedClass),e(l).addClass(g.jmpressDelegatedClass="delegating-step-"+e(t).attr("id")),N.call(this,"applyTarget",a,e.extend({canvas:m,area:h,beforeActive:w},c)),y=t,b=c.substep,w=a,g.idleTimeout&&clearTimeout(g.idleTimeout),g.idleTimeout=setTimeout(function(){N.call(this,"idle",a,c)},Math.max(1,f.transitionDuration-100)),a}function A(){function t(){function i(){(e(c).scrollTop()!==0||e(c).scrollLeft()!==0)&&t()}if(e(c)[0].tagName==="BODY")try{n.scrollTo(0,0)}catch(r){}e(c).scrollTop(0),e(c).scrollLeft(0),setTimeout(i,1),setTimeout(i,10),setTimeout(i,100),setTimeout(i,200),setTimeout(i,400)}t()}function O(e){return L.call(this,e,"jump")}function M(){return L.call(this,N.call(this,"selectNext",y,{stepData:e(y).data("stepData"),substep:b}),"next")}function _(){return L.call(this,N.call(this,"selectPrev",y,{stepData:e(y).data("stepData"),substep:b}),"prev")}function D(){return L.call(this,N.call(this,"selectHome",y,{stepData:e(y).data("stepData")}),"home")}function P(){return L.call(this,N.call(this,"selectEnd",y,{stepData:e(y).data("stepData")}),"end")}function H(t){return p(m,t||{}),e(m)}function B(){return w&&e(w)}function j(t,n,r){if(!!a[t])return N.call(this,t,n,r);e.error("callback "+t+" is not registered.")}function F(){var e=navigator.userAgent.toLowerCase(),t=e.search(/(iphone)|(ipod)|(android)/)===-1;return t}i=e.extend(!0,{},i||{});var s={},o=null;for(o in a)s[o]=e.isFunction(i[o])?[i[o]]:i[o],i[o]=[];var f=e.extend(!0,{},u,i);for(o in a)s[o]&&Array.prototype.push.apply(f[o],s[o]);var l=e(this),c=null,h=null,v={container:"",area:""},m=null,g=null,y=!1,b=null,w=!1;l.data("jmpressmethods",{select:L,reselect:k,scrollFix:A,goTo:O,next:M,prev:_,home:D,end:P,canvas:H,container:function(){return c},settings:function(){return f},active:B,current:function(){return g},fire:j,init:function(t){E.call(this,e(t),g.nextIdNumber++)},deinit:function(t){t?S.call(this,e(t)):T.call(this)},reapply:x});if(F()===!1){f.notSupportedClass&&l.addClass(f.notSupportedClass);return}f.notSupportedClass&&l.removeClass(f.notSupportedClass);var I=e(f.stepSelector,l);c=l,h=e("
"),m=e("
"),e(l).children().filter(I).each(function(){m.append(e(this))}),f.fullscreen&&(c=e("body"),e("html").css({overflow:"hidden"}),h=l),v.area=h.attr("style")||"",v.container=c.attr("style")||"",f.fullscreen?(c.css({height:"100%"}),l.append(m)):(c.css({position:"relative"}),h.append(m),l.append(h)),e(c).addClass(f.containerClass),e(h).addClass(f.areaClass),e(m).addClass(f.canvasClass),t.documentElement.style.height="100%",c.css({overflow:"hidden"});var q={position:"absolute",transitionDuration:"0s"};q=e.extend({},f.animation,q),p(h,q),p(h,{top:"50%",left:"50%",perspective:"1000px"}),p(m,q),g={},N.call(this,"beforeInit",null,{}),I.each(function(e){E.call(l,this,e)}),g.nextIdNumber=I.length,N.call(this,"afterInit",null,{}),L.call(this,N.call(this,"selectInitialStep","init",{})),f.initClass&&e(I).removeClass(f.initClass)}function c(){return u}function h(t,n){e.isFunction(n)?m[t]?e.error("function "+t+" is already registered."):m[t]=n:a[t]?e.error("callback "+t+" is already registered."):(a[t]=1,u[t]=[])}function p(t,n){var r,s,o={};for(r in n)n.hasOwnProperty(r)&&(s=i(r),s!==null&&(o[s]=n[r]));return e(t).css(o),t}function d(t){function n(e){e=e.split("-");for(var t=1;t0&&e.jmpress("css",e(t),{top:"50%",left:"50%"});var r=n.stepData,i=[["translate",r.x||r.r*Math.sin(r.phi*Math.PI/180),r.y||-r.r*Math.cos(r.phi*Math.PI/180),r.z],["rotate",r.rotateX,r.rotateY,r.rotateZ||r.rotate,!0],["scale",r.scaleX||r.scale,r.scaleY||r.scale,r.scaleZ||r.scale]];u.transform(t,i)}),e.jmpress("setActive",function(t,n){var i=n.target,s=n.stepData,o=i.transform=[];i.perspectiveScale=1;for(var u=n.current.maxNestedDepth;u>(n.parents.length||0);u--)o.push(["scale"],["rotate"],["translate"]);o.push(["scale",1/(s.scaleX||s.scale),1/(s.scaleY||s.scale),1/s.scaleZ]),o.push(["rotate",-s.rotateX,-s.rotateY,-(s.rotateZ||s.rotate)]),o.push(["translate",-(s.x||s.r*Math.sin(s.phi*Math.PI/180)),-(s.y||-s.r*Math.cos(s.phi*Math.PI/180)),-s.z]),i.perspectiveScale*=s.scaleX||s.scale,e.each(n.parents,function(t,n){var r=e(n).data("stepData");o.push(["scale",1/(r.scaleX||r.scale),1/(r.scaleY||r.scale),1/r.scaleZ]),o.push(["rotate",-r.rotateX,-r.rotateY,-(r.rotateZ||r.rotate)]),o.push(["translate",-(r.x||r.r*Math.sin(r.phi*Math.PI/180)),-(r.y||-r.r*Math.cos(r.phi*Math.PI/180)),-r.z]),i.perspectiveScale*=r.scaleX||r.scale}),e.each(o,function(e,t){function i(i){n.current["rotate"+i+"-"+e]===r&&(n.current["rotate"+i+"-"+e]=t[i]||0);var s=n.current["rotate"+i+"-"+e],o=t[i]||0,u=s%360,a=o%360;u<0&&(u+=360),a<0&&(a+=360);var f=a-u;f<-180?f+=360:f>180&&(f-=360),n.current["rotate"+i+"-"+e]=t[i]=s+f}if(t[0]!=="rotate")return;i(1),i(2),i(3)})}),e.jmpress("applyTarget",function(t,n){var r=n.target,i,s=n.stepData,o=n.settings,a=r.perspectiveScale*1.3n.current.perspectiveScale*1.3,l=-1;e.each(r.transform,function(e,t){if(t.length<=1)return;if(t[0]==="rotate"&&t[1]%360===0&&t[2]%360===0&&t[3]%360===0)return;if(t[0]!=="scale")return!1;l=e}),l!==n.current.oldLastScale&&(a=f=!1,n.current.oldLastScale=l);var c=[];if(l!==-1)while(l>=0)r.transform[l][0]==="scale"&&(c.push(r.transform[l]),r.transform[l]=["scale"]),l--;var h=o.animation;o.reasonableAnimation[n.reason]&&(h=e.extend({},h,o.reasonableAnimation[n.reason])),i={perspective:Math.round(r.perspectiveScale*1e3)+"px"},i=e.extend({},h,i),a||(i.transitionDelay="0s"),n.beforeActive||(i.transitionDuration="0s",i.transitionDelay="0s"),e.jmpress("css",n.area,i),u.transform(n.area,c),i=e.extend({},h),f||(i.transitionDelay="0s"),n.beforeActive||(i.transitionDuration="0s",i.transitionDelay="0s"),n.current.perspectiveScale=r.perspectiveScale,e.jmpress("css",n.canvas,i),u.transform(n.canvas,r.transform)})}(jQuery,document,window),function(e,t,n,r){"use strict";var i=e.jmpress,s="activeClass",o="nestedActiveClass",u=i("defaults");u[o]="nested-active",u[s]="active",i("setInactive",function(t,n){var r=n.settings,i=r[s],u=r[o];i&&e(t).removeClass(i),u&&e.each(n.parents,function(t,n){e(n).removeClass(u)})}),i("setActive",function(t,n){var r=n.settings,i=r[s],u=r[o];i&&e(t).addClass(i),u&&e.each(n.parents,function(t,n){e(n).addClass(u)})})}(jQuery,document,window),function(e,t,n,r){"use strict";function s(t,n){return e(this).find(n.settings.stepSelector).first()}function o(t,n,r,i){if(!n)return!1;var s=r.settings.stepSelector;n=e(n);do{var o=n.near(s,i);if(o.length===0||o.closest(t).length===0)o=e(t).find(s)[i?"last":"first"]();if(!o.length)return!1;n=o}while(n.data("stepData").exclude);return n}var i=e.jmpress;i("initStep",function(e,t){t.stepData.exclude=t.data.exclude&&["false","no"].indexOf(t.data.exclude)===-1}),i("selectInitialStep",s),i("selectHome",s),i("selectEnd",function(t,n){return e(this).find(n.settings.stepSelector).last()}),i("selectPrev",function(e,t){return o(this,e,t,!0)}),i("selectNext",function(e,t){return o(this,e,t)})}(jQuery,document,window),function(e,t,n,r){"use strict";function s(){return""+Math.round(Math.random()*1e5,0)}function o(t,n,r){for(var i=0;i0&&i.is(t.stepSelector)?i:r}catch(s){}}function a(e){var t="#/"+e;n.history&&n.history.pushState?n.location.hash!==t&&n.history.pushState({},"",t):n.location.hash!==t&&(n.location.hash=t)}var i=e.jmpress,s="a[href^=#]";i("defaults").hash={use:!0,update:!0,bindChange:!0},i("selectInitialStep",function(t,r){var i=r.settings,f=i.hash,l=r.current,c=e(this);r.current.hashNamespace=".jmpress-"+o();if(f.use)return f.bindChange&&(e(n).bind("hashchange"+l.hashNamespace,function(e){var t=u(i);c.jmpress("initialized")&&c.jmpress("scrollFix"),t&&t.length&&(t.attr("id")!==c.jmpress("active").attr("id")&&c.jmpress("select",t),a(t.attr("id"))),e.preventDefault()}),e(s).on("click"+l.hashNamespace,function(t){var n=e(this).attr("href");try{e(n).is(i.stepSelector)&&(c.jmpress("select",n),t.preventDefault(),t.stopPropagation())}catch(r){}})),u(i)}),i("afterDeinit",function(t,r){e(s).off(r.current.hashNamespace),e(n).unbind(r.current.hashNamespace)}),i("setActive",function(t,n){var r=n.settings,i=n.current;r.hash.use&&r.hash.update&&(clearTimeout(i.hashtimeout),i.hashtimeout=setTimeout(function(){a(e(n.delegatedFrom).attr("id"))},r.transitionDuration+200))})}(jQuery,document,window),function(e,t,n,r){"use strict";function u(){return""+Math.round(Math.random()*1e5,0)}function a(e){e.preventDefault(),e.stopPropagation()}var i=e.jmpress,s="next",o="prev";i("defaults").keyboard={use:!0,keys:{33:o,37:o,38:o,9:s+":"+o,32:s,34:s,39:s,40:s,36:"home",35:"end"},ignore:{INPUT:[32,37,38,39,40],TEXTAREA:[32,37,38,39,40],SELECT:[38,40]},tabSelector:"a[href]:visible, :input:visible"},i("afterInit",function(n,i){var s=i.settings,o=s.keyboard,f=o.ignore,l=i.current,c=e(this);s.fullscreen||c.attr("tabindex",0),l.keyboardNamespace=".jmpress-"+u(),e(s.fullscreen?t:c).bind("keypress"+l.keyboardNamespace,function(e){for(var t in f)if(e.target.nodeName===t&&f[t].indexOf(e.which)!==-1)return;(e.which>=37&&e.which<=40||e.which===32)&&a(e)}),e(s.fullscreen?t:c).bind("keydown"+l.keyboardNamespace,function(t){var n=e(t.target);if(!s.fullscreen&&!n.closest(c).length||!o.use)return;for(var i in f)if(n[0].nodeName===i&&f[i].indexOf(t.which)!==-1)return;var u=!1,l;if(t.which===9){n.closest(c.jmpress("active")).length?(l=n.near(o.tabSelector,t.shiftKey),e(l).closest(s.stepSelector).is(c.jmpress("active"))||(l=r)):t.shiftKey?u=!0:l=c.jmpress("active").find("a[href], :input").filter(":visible").first();if(l&&l.length>0){l.focus(),c.jmpress("scrollFix"),a(t);return}t.shiftKey&&(u=!0)}var h=o.keys[t.which];typeof h=="string"?(h.indexOf(":")!==-1&&(h=h.split(":"),h=t.shiftKey?h[1]:h[0]),c.jmpress(h),a(t)):e.isFunction(h)?h.call(c,t):h&&(c.jmpress.apply(c,h),a(t)),u&&(l=c.jmpress("active").find("a[href], :input").filter(":visible").last(),l.focus(),c.jmpress("scrollFix"))})}),i("afterDeinit",function(n,r){e(t).unbind(r.current.keyboardNamespace)})}(jQuery,document,window),function(e,t,n,r){"use strict";function i(){return""+Math.round(Math.random()*1e5,0)}function u(e,t){return Math.max(Math.min(e,t),-t)}function a(t,n,r){var i=e(this).jmpress("current"),s=e(this).jmpress("settings"),o=e(this).jmpress("active").data("stepData"),a=e(this).jmpress("container");if(i.userZoom===0&&r<0)return;var f=o.viewPortZoomable||s.viewPort.zoomable;if(i.userZoom===f&&r>0)return;i.userZoom+=r;var l=e(a).innerWidth()/2,c=e(a).innerHeight()/2;t=t?t-l:t,n=n?n-c:n,i.userTranslateX=u(i.userTranslateX-r*t/i.zoomOriginWindowScale/f,l*i.userZoom*i.userZoom/f),i.userTranslateY=u(i.userTranslateY-r*n/i.zoomOriginWindowScale/f,c*i.userZoom*i.userZoom/f),e(this).jmpress("reselect","zoom")}var s=e.jmpress("defaults");s.viewPort={width:!1,height:!1,maxScale:0,minScale:0,zoomable:0,zoomBindMove:!0,zoomBindWheel:!0};var o=s.keyboard.keys;o[e.browser.mozilla?107:187]="zoomIn",o[e.browser.mozilla?109:189]="zoomOut",s.reasonableAnimation.resize={transitionDuration:"0s",transitionDelay:"0ms"},s.reasonableAnimation.zoom={transitionDuration:"0s",transitionDelay:"0ms"},e.jmpress("initStep",function(e,t){for(var n in{viewPortHeight:1,viewPortWidth:1,viewPortMinScale:1,viewPortMaxScale:1,viewPortZoomable:1})t.stepData[n]=t.data[n]&&parseFloat(t.data[n])}),e.jmpress("afterInit",function(s,o){var u=this;o.current.viewPortNamespace=".jmpress-"+i(),e(n).bind("resize"+o.current.viewPortNamespace,function(t){e(u).jmpress("reselect","resize")}),o.current.userZoom=0,o.current.userTranslateX=0,o.current.userTranslateY=0,o.settings.viewPort.zoomBindWheel&&e(o.settings.fullscreen?t:this).bind("mousewheel"+o.current.viewPortNamespace+" DOMMouseScroll"+o.current.viewPortNamespace,function(t,n){n=n||t.originalEvent.wheelDelta||-t.originalEvent.detail;var r=n/Math.abs(n);return r<0?e(o.jmpress).jmpress("zoomOut",t.originalEvent.x,t.originalEvent.y):r>0&&e(o.jmpress).jmpress("zoomIn",t.originalEvent.x,t.originalEvent.y),!1}),o.settings.viewPort.zoomBindMove&&e(o.settings.fullscreen?t:this).bind("mousedown"+o.current.viewPortNamespace,function(e){o.current.userZoom&&(o.current.userTranslating={x:e.clientX,y:e.clientY},e.preventDefault(),e.stopImmediatePropagation())}).bind("mousemove"+o.current.viewPortNamespace,function(t){var n=o.current.userTranslating;n&&(e(u).jmpress("zoomTranslate",t.clientX-n.x,t.clientY-n.y),n.x=t.clientX,n.y=t.clientY,t.preventDefault(),t.stopImmediatePropagation())}).bind("mouseup"+o.current.viewPortNamespace,function(e){o.current.userTranslating&&(o.current.userTranslating=r,e.preventDefault(),e.stopImmediatePropagation())})}),e.jmpress("register","zoomIn",function(e,t){a.call(this,e||0,t||0,1)}),e.jmpress("register","zoomOut",function(e,t){a.call(this,e||0,t||0,-1)}),e.jmpress("register","zoomTranslate",function(t,n){var r=e(this).jmpress("current"),i=e(this).jmpress("settings"),s=e(this).jmpress("active").data("stepData"),o=e(this).jmpress("container"),a=s.viewPortZoomable||i.viewPort.zoomable,f=e(o).innerWidth(),l=e(o).innerHeight();r.userTranslateX=u(r.userTranslateX+t/r.zoomOriginWindowScale,f*r.userZoom*r.userZoom/a),r.userTranslateY=u(r.userTranslateY+n/r.zoomOriginWindowScale,l*r.userZoom*r.userZoom/a),e(this).jmpress("reselect","zoom")}),e.jmpress("afterDeinit",function(t,r){e(n).unbind(r.current.viewPortNamespace)}),e.jmpress("setActive",function(t,n){var r=n.settings.viewPort,i=n.stepData.viewPortHeight||r.height,s=n.stepData.viewPortWidth||r.width,o=n.stepData.viewPortMaxScale||r.maxScale,u=n.stepData.viewPortMinScale||r.minScale,a=i&&e(n.container).innerHeight()/i,f=s&&e(n.container).innerWidth()/s,l=(f||a)&&Math.min(f||a,a||f);if(l){l=l||1,o&&(l=Math.min(l,o)),u&&(l=Math.max(l,u));var c=n.stepData.viewPortZoomable||n.settings.viewPort.zoomable;if(c){var h=1/l-1/o;h/=c,l=1/(1/l-h*n.current.userZoom)}n.target.transform.reverse(),n.current.userTranslateX&&n.current.userTranslateY?n.target.transform.push(["translate",n.current.userTranslateX,n.current.userTranslateY,0]):n.target.transform.push(["translate"]),n.target.transform.push(["scale",l,l,1]),n.target.transform.reverse(),n.target.perspectiveScale/=l}n.current.zoomOriginWindowScale=l}),e.jmpress("setInactive",function(t,n){if(!n.nextStep||!t||e(n.nextStep).attr("id")!==e(t).attr("id"))n.current.userZoom=0,n.current.userTranslateX=0,n.current.userTranslateY=0})}(jQuery,document,window),function(e,t,n,r){"use strict";function s(){return""+Math.round(Math.random()*1e5,0)}var i=e.jmpress;i("defaults").mouse={clickSelects:!0},i("afterInit",function(t,n){var r=n.settings,i=r.stepSelector,o=n.current,u=e(this);o.clickableStepsNamespace=".jmpress-"+s(),u.bind("click"+o.clickableStepsNamespace,function(t){if(!r.mouse.clickSelects||o.userZoom)return;var n=e(t.target).closest(i);if(n.is(u.jmpress("active")))return;n.length&&(u.jmpress("select",n[0],"click"),t.preventDefault(),t.stopPropagation())})}),i("afterDeinit",function(t,n){e(this).unbind(n.current.clickableStepsNamespace)})}(jQuery,document,window),function(e,t,n,r){"use strict";function s(){return""+Math.round(Math.random()*1e5,0)}var i=e.jmpress;i("afterInit",function(n,r){var i=r.settings,o=r.current,u=r.jmpress;o.mobileNamespace=".jmpress-"+s();var a,f=[0,0];e(i.fullscreen?t:u).bind("touchstart"+o.mobileNamespace,function(e){a=e.originalEvent.touches[0],f=[a.pageX,a.pageY]}).bind("touchmove"+o.mobileNamespace,function(e){return a=e.originalEvent.touches[0],e.preventDefault(),!1}).bind("touchend"+o.mobileNamespace,function(t){var n=[a.pageX,a.pageY],r=[n[0]-f[0],n[1]-f[1]];if(Math.max(Math.abs(r[0]),Math.abs(r[1]))>50)return r=Math.abs(r[0])>Math.abs(r[1])?r[0]:r[1],e(u).jmpress(r>0?"prev":"next"),t.preventDefault(),!1})}),i("afterDeinit",function(n,r){var i=r.settings,s=r.current,o=r.jmpress;e(i.fullscreen?t:o).unbind(s.mobileNamespace)})}(jQuery,document,window),function(e,t,n,r){"use strict";function a(){return""+Math.round(Math.random()*1e5,0)}function f(t,n,i){for(var s in n){var o=s;i&&(o=i+o.substr(0,1).toUpperCase()+o.substr(1)),e.isPlainObject(n[s])?f(t,n[s],o):t[o]===r&&(t[o]=n[s])}}function l(t,n){e.isArray(n)?n.length0)return{step:t,substep:n.substep-1}})}(jQuery,document,window); -------------------------------------------------------------------------------- /assets/HMR.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 18 | 20 | 27 | 32 | 33 | 40 | 45 | 46 | 53 | 59 | 60 | 61 | 79 | 86 | 99 | 100 | 102 | 103 | 105 | image/svg+xml 106 | 108 | 109 | 110 | 111 | 112 | 116 | 119 | 128 | Entry 0 139 | 140 | 143 | 152 | Chunk 1 163 | 164 | 167 | 176 | Chunk 2 187 | 188 | 191 | 200 | Chunk 3 211 | 212 | 215 | 224 | Chunk 4 235 | 236 | 239 | 248 | 0 259 | 260 | 263 | 272 | 2 283 | 284 | 287 | 296 | 1 307 | 308 | 311 | 320 | 3 331 | 332 | 335 | 344 | 4 355 | 356 | 359 | 368 | 7 379 | 380 | 383 | 392 | 6 403 | 404 | 407 | 416 | 5 427 | 428 | 431 | 440 | 8 451 | 452 | 455 | 464 | 10 475 | 476 | 479 | 488 | 11 499 | 500 | 503 | 512 | 9 523 | 524 | 529 | 535 | 541 | 547 | 553 | 559 | 565 | 571 | 577 | 583 | 589 | 595 | 601 | 607 | 613 | 619 | 625 | 631 | 637 | 643 | 649 | 655 | 661 | 667 | 673 | 679 | 685 | 691 | 697 | 703 | 709 | 715 | 721 | 727 | 733 | 739 | 742 | 751 | Entry 0 762 | 763 | 766 | 775 | Chunk 1 786 | 787 | 790 | 799 | Chunk 2 810 | 811 | 814 | 823 | Chunk 3 834 | 835 | 838 | 847 | 0 858 | 859 | 862 | 871 | 2 882 | 883 | 886 | 895 | 1 906 | 907 | 910 | 919 | 3 930 | 931 | 934 | 943 | 4* 954 | 955 | 958 | 967 | 7 978 | 979 | 982 | 991 | 6 1002 | 1003 | 1006 | 1015 | 5 1026 | 1027 | 1030 | 1039 | 8 1050 | 1051 | 1054 | 1063 | 9* 1074 | 1075 | 1080 | 1086 | 1092 | 1098 | 1104 | 1110 | 1116 | 1122 | 1128 | 1134 | 1140 | 1146 | 1152 | 1158 | 1164 | 1170 | 1176 | 1182 | 1188 | 1194 | 1200 | 1206 | 1212 | 1218 | 1224 | 1230 | 1236 | 1242 | 1248 | 1251 | 1260 | Update Chunk 1 1271 | 4: f() {...} 1282 | 1283 | 1286 | 1295 | Update Chunk 4 1306 | 10: false, 11: false 1317 | 1318 | 1321 | 1330 | Update Main 0 1341 | chunks: [1, 3, 4] 1352 | 1353 | 1358 | 1364 | 1367 | 1376 | Chunk Y 1387 | 1388 | 1391 | 1400 | X 1411 | 1412 | 1415 | 1424 | X* 1435 | 1436 | module 1447 | updated module 1458 | 1461 | 1470 | Update Chunk Y 1481 | 1482 | 1485 | 1494 | 12 1505 | 1506 | 1512 | 1515 | 1524 | Update Chunk 3 1535 | 9: f() {...}, 12: f() {...} 1546 | 1547 | 1548 | 1549 | -------------------------------------------------------------------------------- /assets/jmpress.custom.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * jmpress.js v0.4.3 3 | * http://shama.github.com/jmpress.js 4 | * 5 | * A jQuery plugin to build a website on the infinite canvas. 6 | * 7 | * Copyright 112 Kyle Robinson Young @shama & Tobias Koppers @sokra 8 | * Licensed MIT 9 | * http://www.opensource.org/licenses/mit-license.php 10 | * 11 | * Based on the foundation laid by Bartek Szopka @bartaz 12 | */ 13 | /*! 14 | * core.js 15 | * The core of jmpress.js 16 | */ 17 | (function( $, document, window, undefined ) { 18 | 19 | 'use strict'; 20 | 21 | /** 22 | * Set supported prefixes 23 | * 24 | * @access protected 25 | * @return Function to get prefixed property 26 | */ 27 | var pfx = (function () { 28 | var style = document.createElement('dummy').style, 29 | prefixes = 'Webkit Moz O ms Khtml'.split(' '), 30 | memory = {}; 31 | return function ( prop ) { 32 | if ( typeof memory[ prop ] === "undefined" ) { 33 | var ucProp = prop.charAt(0).toUpperCase() + prop.substr(1), 34 | props = (prop + ' ' + prefixes.join(ucProp + ' ') + ucProp).split(' '); 35 | memory[ prop ] = null; 36 | for ( var i in props ) { 37 | if ( style[ props[i] ] !== undefined ) { 38 | memory[ prop ] = props[i]; 39 | break; 40 | } 41 | } 42 | } 43 | return memory[ prop ]; 44 | }; 45 | }()); 46 | 47 | /** 48 | * map ex. "WebkitTransform" to "-webkit-transform" 49 | */ 50 | function mapProperty( name ) { 51 | if(!name) { 52 | return; 53 | } 54 | var index = 1 + name.substr(1).search(/[A-Z]/); 55 | var prefix = name.substr(0, index).toLowerCase(); 56 | var postfix = name.substr(index).toLowerCase(); 57 | return "-" + prefix + "-" + postfix; 58 | } 59 | function addComma( attribute ) { 60 | if(!attribute) { 61 | return ""; 62 | } 63 | return attribute + ","; 64 | } 65 | 66 | /** 67 | * Default Settings 68 | */ 69 | var defaults = { 70 | /* CLASSES */ 71 | stepSelector: '.step' 72 | ,containerClass: '' 73 | ,canvasClass: '' 74 | ,areaClass: '' 75 | ,notSupportedClass: 'not-supported' 76 | 77 | /* CONFIG */ 78 | ,fullscreen: true 79 | 80 | /* ANIMATION */ 81 | ,animation: { 82 | transformOrigin: 'top left' 83 | ,transitionProperty: addComma(mapProperty(pfx('transform'))) + addComma(mapProperty(pfx('perspective'))) + 'opacity' 84 | ,transitionDuration: '1s' 85 | ,transitionDelay: '500ms' 86 | ,transitionTimingFunction: 'ease-in-out' 87 | ,transformStyle: "preserve-3d" 88 | } 89 | ,transitionDuration: 1500 90 | }; 91 | var callbacks = { 92 | 'beforeChange': 1 93 | ,'beforeInitStep': 1 94 | ,'initStep': 1 95 | ,'beforeInit': 1 96 | ,'afterInit': 1 97 | ,'beforeDeinit': 1 98 | ,'afterDeinit': 1 99 | ,'applyStep': 1 100 | ,'unapplyStep': 1 101 | ,'setInactive': 1 102 | ,'beforeActive': 1 103 | ,'setActive': 1 104 | ,'selectInitialStep': 1 105 | ,'selectPrev': 1 106 | ,'selectNext': 1 107 | ,'selectHome': 1 108 | ,'selectEnd': 1 109 | ,'idle': 1 110 | ,'applyTarget': 1 111 | }; 112 | for(var callbackName in callbacks) { 113 | defaults[callbackName] = []; 114 | } 115 | 116 | 117 | /** 118 | * Initialize jmpress 119 | */ 120 | function init( args ) { 121 | args = $.extend(true, {}, args || {}); 122 | 123 | // accept functions and arrays of functions as callbacks 124 | var callbackArgs = {}; 125 | var callbackName = null; 126 | for (callbackName in callbacks) { 127 | callbackArgs[callbackName] = $.isFunction( args[callbackName] ) ? 128 | [ args[callbackName] ] : 129 | args[callbackName]; 130 | args[callbackName] = []; 131 | } 132 | 133 | // MERGE SETTINGS 134 | var settings = $.extend(true, {}, defaults, args); 135 | 136 | for (callbackName in callbacks) { 137 | if (callbackArgs[callbackName]) { 138 | Array.prototype.push.apply(settings[callbackName], callbackArgs[callbackName]); 139 | } 140 | } 141 | 142 | /*** MEMBER VARS ***/ 143 | 144 | var jmpress = $( this ) 145 | ,container = null 146 | ,area = null 147 | ,oldStyle = { 148 | container: "" 149 | ,area: "" 150 | } 151 | ,canvas = null 152 | ,current = null 153 | ,active = false 154 | ,activeSubstep = null 155 | ,activeDelegated = false; 156 | 157 | 158 | /*** MEMBER FUNCTIONS ***/ 159 | // functions have to be called with this 160 | 161 | /** 162 | * Init a single step 163 | * 164 | * @param element the element of the step 165 | * @param idx number of step 166 | */ 167 | function doStepInit( element, idx ) { 168 | var data = dataset( element ); 169 | var step = { 170 | oldStyle: $(element).attr("style") || "" 171 | }; 172 | 173 | var callbackData = { 174 | data: data 175 | ,stepData: step 176 | }; 177 | callCallback.call(this, 'beforeInitStep', $(element), callbackData); 178 | step.delegate = data.delegate; 179 | callCallback.call(this, 'initStep', $(element), callbackData); 180 | 181 | $(element).data('stepData', step); 182 | 183 | if ( !$(element).attr('id') ) { 184 | $(element).attr('id', 'step-' + (idx + 1)); 185 | } 186 | 187 | callCallback.call(this, 'applyStep', $(element), callbackData); 188 | } 189 | /** 190 | * Deinit a single step 191 | * 192 | * @param element the element of the step 193 | */ 194 | function doStepDeinit( element ) { 195 | var stepData = $(element).data('stepData'); 196 | 197 | $(element).attr("style", stepData.oldStyle); 198 | 199 | callCallback.call(this, 'unapplyStep', $(element), { 200 | stepData: stepData 201 | }); 202 | } 203 | /** 204 | * Reapplies stepData to the element 205 | * 206 | * @param element 207 | */ 208 | function doStepReapply( element ) { 209 | callCallback.call(this, 'unapplyStep', $(element), { 210 | stepData: element.data("stepData") 211 | }); 212 | 213 | callCallback.call(this, 'applyStep', $(element), { 214 | stepData: element.data("stepData") 215 | }); 216 | } 217 | /** 218 | * Completly deinit jmpress 219 | * 220 | */ 221 | function deinit() { 222 | if ( active ) { 223 | callCallback.call(this, 'setInactive', active, { 224 | stepData: $(active).data('stepData') 225 | ,reason: "deinit" 226 | } ); 227 | } 228 | if (current.jmpressClass) { 229 | $(jmpress).removeClass(current.jmpressClass); 230 | } 231 | 232 | callCallback.call(this, 'beforeDeinit', $(this), {}); 233 | 234 | $(settings.stepSelector, jmpress).each(function( idx ) { 235 | doStepDeinit.call(jmpress, this ); 236 | }); 237 | 238 | container.attr("style", oldStyle.container); 239 | if(settings.fullscreen) { 240 | $("html").attr("style", ""); 241 | } 242 | area.attr("style", oldStyle.area); 243 | $(canvas).children().each(function() { 244 | jmpress.append( $( this ) ); 245 | }); 246 | if( settings.fullscreen ) { 247 | canvas.remove(); 248 | } else { 249 | canvas.remove(); 250 | area.remove(); 251 | } 252 | 253 | callCallback.call(this, 'afterDeinit', $(this), {}); 254 | 255 | $(jmpress).data("jmpressmethods", false); 256 | } 257 | /** 258 | * Call a callback 259 | * 260 | * @param callbackName String callback which should be called 261 | * @param element some arguments to the callback 262 | * @param eventData 263 | */ 264 | function callCallback( callbackName, element, eventData ) { 265 | eventData.settings = settings; 266 | eventData.current = current; 267 | eventData.container = container; 268 | eventData.parents = element ? getStepParents(element) : null; 269 | eventData.current = current; 270 | eventData.jmpress = this; 271 | var result = {}; 272 | $.each( settings[callbackName], function(idx, callback) { 273 | result.value = callback.call( jmpress, element, eventData ) || result.value; 274 | }); 275 | return result.value; 276 | } 277 | /** 278 | * 279 | */ 280 | function getStepParents( el ) { 281 | return $(el).parentsUntil(jmpress).not(jmpress).filter(settings.stepSelector); 282 | } 283 | /** 284 | * Reselect the active step 285 | * 286 | * @param String type reason of reselecting step 287 | */ 288 | function reselect( type ) { 289 | return select( { step: active, substep: activeSubstep }, type); 290 | } 291 | /** 292 | * Select a given step 293 | * 294 | * @param el element to select 295 | * @param type reason of changing step 296 | * @return Object element selected 297 | */ 298 | function select( el, type ) { 299 | var substep; 300 | if ( $.isPlainObject( el ) ) { 301 | substep = el.substep; 302 | el = el.step; 303 | } 304 | if ( typeof el === 'string') { 305 | el = jmpress.find( el ).first(); 306 | } 307 | if ( !el || !$(el).data('stepData') ) { 308 | return false; 309 | } 310 | 311 | // Sometimes it's possible to trigger focus on first link with some keyboard action. 312 | // Browser in such a case tries to scroll the page to make this element visible 313 | // (even that body overflow is set to hidden) and it breaks our careful positioning. 314 | // 315 | // So, as a lousy (and lazy) workaround we will make the page scroll back to the top 316 | // whenever slide is selected 317 | // 318 | // If you are reading this and know any better way to handle it, I'll be glad to hear about it! 319 | scrollFix.call(this); 320 | 321 | var step = $(el).data('stepData'); 322 | 323 | var cancelSelect = false; 324 | callCallback.call(this, "beforeChange", el, { 325 | stepData: step 326 | ,reason: type 327 | ,cancel: function() { 328 | cancelSelect = true; 329 | } 330 | }); 331 | if (cancelSelect) { 332 | return undefined; 333 | } 334 | 335 | var target = {}; 336 | 337 | var delegated = el; 338 | if($(el).data("stepData").delegate) { 339 | delegated = $(el).parentsUntil(jmpress).filter(settings.stepSelector).filter(step.delegate) || 340 | $(el).near(step.delegate) || 341 | $(el).near(step.delegate, true) || 342 | $(step.delegate, jmpress); 343 | step = delegated.data("stepData"); 344 | } 345 | if ( activeDelegated ) { 346 | callCallback.call(this, 'setInactive', activeDelegated, { 347 | stepData: $(activeDelegated).data('stepData') 348 | ,delegatedFrom: active 349 | ,reason: type 350 | ,target: target 351 | ,nextStep: delegated 352 | ,nextSubstep: substep 353 | ,nextStepData: step 354 | } ); 355 | } 356 | var callbackData = { 357 | stepData: step 358 | ,delegatedFrom: el 359 | ,reason: type 360 | ,target: target 361 | ,substep: substep 362 | ,prevStep: activeDelegated 363 | ,prevSubstep: activeSubstep 364 | ,prevStepData: activeDelegated && $(activeDelegated).data('stepData') 365 | }; 366 | callCallback.call(this, 'beforeActive', delegated, callbackData); 367 | callCallback.call(this, 'setActive', delegated, callbackData); 368 | 369 | // Set on step class on root element 370 | if (current.jmpressClass) { 371 | $(jmpress).removeClass(current.jmpressClass); 372 | } 373 | $(jmpress).addClass(current.jmpressClass = 'step-' + $(delegated).attr('id') ); 374 | if (current.jmpressDelegatedClass) { 375 | $(jmpress).removeClass(current.jmpressDelegatedClass); 376 | } 377 | $(jmpress).addClass(current.jmpressDelegatedClass = 'delegating-step-' + $(el).attr('id') ); 378 | 379 | callCallback.call(this, "applyTarget", delegated, $.extend({ 380 | canvas: canvas 381 | ,area: area 382 | ,beforeActive: activeDelegated 383 | }, callbackData)); 384 | 385 | active = el; 386 | activeSubstep = callbackData.substep; 387 | activeDelegated = delegated; 388 | 389 | if(current.idleTimeout) { 390 | clearTimeout(current.idleTimeout); 391 | } 392 | current.idleTimeout = setTimeout(function() { 393 | callCallback.call(this, 'idle', delegated, callbackData); 394 | }, Math.max(1, settings.transitionDuration - 100)); 395 | 396 | return delegated; 397 | } 398 | /** 399 | * This should fix ANY kind of buggy scrolling 400 | */ 401 | function scrollFix() { 402 | function fix() { 403 | if ($(container)[0].tagName === "BODY") { 404 | try { 405 | window.scrollTo(0, 0); 406 | } catch(e) {} 407 | } 408 | $(container).scrollTop(0); 409 | $(container).scrollLeft(0); 410 | function check() { 411 | if ($(container).scrollTop() !== 0 || 412 | $(container).scrollLeft() !== 0) { 413 | fix(); 414 | } 415 | } 416 | setTimeout(check, 1); 417 | setTimeout(check, 10); 418 | setTimeout(check, 100); 419 | setTimeout(check, 200); 420 | setTimeout(check, 400); 421 | } 422 | fix(); 423 | } 424 | /** 425 | * Alias for select 426 | */ 427 | function goTo( el ) { 428 | return select.call(this, el, "jump" ); 429 | } 430 | /** 431 | * Goto Next Slide 432 | * 433 | * @return Object newly active slide 434 | */ 435 | function next() { 436 | return select.call(this, callCallback.call(this, 'selectNext', active, { 437 | stepData: $(active).data('stepData') 438 | ,substep: activeSubstep 439 | }), "next" ); 440 | } 441 | /** 442 | * Goto Previous Slide 443 | * 444 | * @return Object newly active slide 445 | */ 446 | function prev() { 447 | return select.call(this, callCallback.call(this, 'selectPrev', active, { 448 | stepData: $(active).data('stepData') 449 | ,substep: activeSubstep 450 | }), "prev" ); 451 | } 452 | /** 453 | * Goto First Slide 454 | * 455 | * @return Object newly active slide 456 | */ 457 | function home() { 458 | return select.call(this, callCallback.call(this, 'selectHome', active, { 459 | stepData: $(active).data('stepData') 460 | }), "home" ); 461 | } 462 | /** 463 | * Goto Last Slide 464 | * 465 | * @return Object newly active slide 466 | */ 467 | function end() { 468 | return select.call(this, callCallback.call(this, 'selectEnd', active, { 469 | stepData: $(active).data('stepData') 470 | }), "end" ); 471 | } 472 | /** 473 | * Manipulate the canvas 474 | * 475 | * @param props 476 | * @return Object 477 | */ 478 | function canvasMod( props ) { 479 | css(canvas, props || {}); 480 | return $(canvas); 481 | } 482 | /** 483 | * Return current step 484 | * 485 | * @return Object 486 | */ 487 | function getActive() { 488 | return activeDelegated && $(activeDelegated); 489 | } 490 | /** 491 | * fire a callback 492 | * 493 | * @param callbackName 494 | * @param element 495 | * @param eventData 496 | * @return void 497 | */ 498 | function fire( callbackName, element, eventData ) { 499 | if( !callbacks[callbackName] ) { 500 | $.error( "callback " + callbackName + " is not registered." ); 501 | } else { 502 | return callCallback.call(this, callbackName, element, eventData); 503 | } 504 | } 505 | 506 | /** 507 | * PUBLIC METHODS LIST 508 | */ 509 | jmpress.data("jmpressmethods", { 510 | select: select 511 | ,reselect: reselect 512 | ,scrollFix: scrollFix 513 | ,goTo: goTo 514 | ,next: next 515 | ,prev: prev 516 | ,home: home 517 | ,end: end 518 | ,canvas: canvasMod 519 | ,container: function() { return container; } 520 | ,settings: function() { return settings; } 521 | ,active: getActive 522 | ,current: function() { return current; } 523 | ,fire: fire 524 | ,init: function(step) { 525 | doStepInit.call(this, $(step), current.nextIdNumber++); 526 | } 527 | ,deinit: function(step) { 528 | if(step) { 529 | doStepDeinit.call(this, $(step)); 530 | } else { 531 | deinit.call(this); 532 | } 533 | } 534 | ,reapply: doStepReapply 535 | }); 536 | 537 | /** 538 | * Check for support 539 | * This will be removed in near future, when support is coming 540 | * 541 | * @access protected 542 | * @return void 543 | */ 544 | function checkSupport() { 545 | var ua = navigator.userAgent.toLowerCase(); 546 | var supported = ( ua.search(/(iphone)|(ipod)|(android)/) === -1 ); 547 | return supported; 548 | } 549 | 550 | // BEGIN INIT 551 | 552 | // CHECK FOR SUPPORT 553 | if (checkSupport() === false) { 554 | if (settings.notSupportedClass) { 555 | jmpress.addClass(settings.notSupportedClass); 556 | } 557 | return; 558 | } else { 559 | if (settings.notSupportedClass) { 560 | jmpress.removeClass(settings.notSupportedClass); 561 | } 562 | } 563 | 564 | // grabbing all steps 565 | var steps = $(settings.stepSelector, jmpress); 566 | 567 | // GERNERAL INIT OF FRAME 568 | container = jmpress; 569 | area = $('
'); 570 | canvas = $('
'); 571 | $(jmpress).children().filter(steps).each(function() { 572 | canvas.append( $( this ) ); 573 | }); 574 | if(settings.fullscreen) { 575 | container = $('body'); 576 | $("html").css({ 577 | overflow: 'hidden' 578 | }); 579 | area = jmpress; 580 | } 581 | oldStyle.area = area.attr("style") || ""; 582 | oldStyle.container = container.attr("style") || ""; 583 | if(settings.fullscreen) { 584 | container.css({ 585 | height: '100%' 586 | }); 587 | jmpress.append( canvas ); 588 | } else { 589 | container.css({ 590 | position: "relative" 591 | }); 592 | area.append( canvas ); 593 | jmpress.append( area ); 594 | } 595 | 596 | $(container).addClass(settings.containerClass); 597 | $(area).addClass(settings.areaClass); 598 | $(canvas).addClass(settings.canvasClass); 599 | 600 | document.documentElement.style.height = "100%"; 601 | container.css({ 602 | overflow: 'hidden' 603 | }); 604 | 605 | var props = { 606 | position: "absolute" 607 | ,transitionDuration: '0s' 608 | }; 609 | props = $.extend({}, settings.animation, props); 610 | css(area, props); 611 | css(area, { 612 | top: '50%' 613 | ,left: '50%' 614 | ,perspective: '1000px' 615 | }); 616 | css(canvas, props); 617 | 618 | current = {}; 619 | 620 | callCallback.call(this, 'beforeInit', null, {}); 621 | 622 | // INITIALIZE EACH STEP 623 | steps.each(function( idx ) { 624 | doStepInit.call(jmpress, this, idx ); 625 | }); 626 | current.nextIdNumber = steps.length; 627 | 628 | callCallback.call(this, 'afterInit', null, {}); 629 | 630 | // START 631 | select.call(this, callCallback.call(this, 'selectInitialStep', "init", {}) ); 632 | 633 | if (settings.initClass) { 634 | $(steps).removeClass(settings.initClass); 635 | } 636 | } 637 | /** 638 | * Return default settings 639 | * 640 | * @return Object 641 | */ 642 | function getDefaults() { 643 | return defaults; 644 | } 645 | /** 646 | * Register a callback or a jmpress function 647 | * 648 | * @access public 649 | * @param name String the name of the callback or function 650 | * @param func Function? the function to be added 651 | */ 652 | function register(name, func) { 653 | if( $.isFunction(func) ) { 654 | if( methods[name] ) { 655 | $.error( "function " + name + " is already registered." ); 656 | } else { 657 | methods[name] = func; 658 | } 659 | } else { 660 | if( callbacks[name] ) { 661 | $.error( "callback " + name + " is already registered." ); 662 | } else { 663 | callbacks[name] = 1; 664 | defaults[name] = []; 665 | } 666 | } 667 | } 668 | /** 669 | * Set CSS on element w/ prefixes 670 | * 671 | * @return Object element which properties were set 672 | * 673 | * TODO: Consider bypassing pfx and blindly set as jQuery 674 | * already checks for support 675 | */ 676 | function css( el, props ) { 677 | var key, pkey, cssObj = {}; 678 | for ( key in props ) { 679 | if ( props.hasOwnProperty(key) ) { 680 | pkey = pfx(key); 681 | if ( pkey !== null ) { 682 | cssObj[pkey] = props[key]; 683 | } 684 | } 685 | } 686 | $(el).css(cssObj); 687 | return el; 688 | } 689 | /** 690 | * Return dataset for element 691 | * 692 | * @param el element 693 | * @return Object 694 | */ 695 | function dataset( el ) { 696 | if ( $(el)[0].dataset ) { 697 | return $.extend({}, $(el)[0].dataset); 698 | } 699 | function toCamelcase( str ) { 700 | str = str.split( '-' ); 701 | for( var i = 1; i < str.length; i++ ) { 702 | str[i] = str[i].substr(0, 1).toUpperCase() + str[i].substr(1); 703 | } 704 | return str.join( '' ); 705 | } 706 | var returnDataset = {}; 707 | var attrs = $(el)[0].attributes; 708 | $.each(attrs, function ( idx, attr ) { 709 | if ( attr.nodeName.substr(0, 5) === "data-" ) { 710 | returnDataset[ toCamelcase(attr.nodeName.substr(5)) ] = attr.nodeValue; 711 | } 712 | }); 713 | return returnDataset; 714 | } 715 | /** 716 | * Returns true, if jmpress is initialized 717 | * 718 | * @return bool 719 | */ 720 | function initialized() { 721 | return !!$(this).data("jmpressmethods"); 722 | } 723 | 724 | 725 | /** 726 | * PUBLIC STATIC METHODS LIST 727 | */ 728 | var methods = { 729 | init: init 730 | ,initialized: initialized 731 | ,deinit: function() {} 732 | ,css: css 733 | ,pfx: pfx 734 | ,defaults: getDefaults 735 | ,register: register 736 | ,dataset: dataset 737 | }; 738 | 739 | /** 740 | * $.jmpress() 741 | */ 742 | $.fn.jmpress = function( method ) { 743 | function f() { 744 | var jmpressmethods = $(this).data("jmpressmethods"); 745 | if ( jmpressmethods && jmpressmethods[method] ) { 746 | return jmpressmethods[method].apply( this, Array.prototype.slice.call( arguments, 1 )); 747 | } else if ( methods[method] ) { 748 | return methods[method].apply( this, Array.prototype.slice.call( arguments, 1 )); 749 | } else if ( callbacks[method] && jmpressmethods ) { 750 | var settings = jmpressmethods.settings(); 751 | var func = Array.prototype.slice.call( arguments, 1 )[0]; 752 | if ($.isFunction( func )) { 753 | settings[method] = settings[method] || []; 754 | settings[method].push(func); 755 | } 756 | } else if ( typeof method === 'object' || ! method ) { 757 | return init.apply( this, arguments ); 758 | } else { 759 | $.error( 'Method ' + method + ' does not exist on jQuery.jmpress' ); 760 | } 761 | // to allow chaining 762 | return this; 763 | } 764 | var args = arguments; 765 | var result; 766 | $(this).each(function(idx, element) { 767 | result = f.apply(element, args); 768 | }); 769 | return result; 770 | }; 771 | $.extend({ 772 | jmpress: function( method ) { 773 | if ( methods[method] ) { 774 | return methods[method].apply( this, Array.prototype.slice.call( arguments, 1 )); 775 | } else if ( callbacks[method] ) { 776 | // plugin interface 777 | var func = Array.prototype.slice.call( arguments, 1 )[0]; 778 | if ($.isFunction( func )) { 779 | defaults[method].push(func); 780 | } else { 781 | $.error( 'Second parameter should be a function: $.jmpress( callbackName, callbackFunction )' ); 782 | } 783 | } else { 784 | $.error( 'Method ' + method + ' does not exist on jQuery.jmpress' ); 785 | } 786 | } 787 | }); 788 | 789 | }(jQuery, document, window)); 790 | /*! 791 | * near.js 792 | * Find steps near each other 793 | */ 794 | (function( $, document, window, undefined ) { 795 | 796 | 'use strict'; 797 | 798 | // add near( selector, backwards = false) to jquery 799 | 800 | 801 | function checkAndGo( elements, func, selector, backwards ) { 802 | var next; 803 | elements.each(function(idx, element) { 804 | if(backwards) { 805 | next = func(element, selector, backwards); 806 | if (next) { 807 | return false; 808 | } 809 | } 810 | if( $(element).is(selector) ) { 811 | next = element; 812 | return false; 813 | } 814 | if(!backwards) { 815 | next = func(element, selector, backwards); 816 | if (next) { 817 | return false; 818 | } 819 | } 820 | }); 821 | return next; 822 | } 823 | function findNextInChildren(item, selector, backwards) { 824 | var children = $(item).children(); 825 | if(backwards) { 826 | children = $(children.get().reverse()); 827 | } 828 | return checkAndGo( children, findNextInChildren, selector, backwards ); 829 | } 830 | function findNextInSiblings(item, selector, backwards) { 831 | return checkAndGo( 832 | $(item)[backwards ? "prevAll" : "nextAll"](), 833 | findNextInChildren, selector, backwards ); 834 | } 835 | function findNextInParents(item, selector, backwards) { 836 | var next; 837 | var parents = $(item).parents(); 838 | parents = $(parents.get()); 839 | $.each(parents.get(), function(idx, element) { 840 | if( backwards && $(element).is(selector) ) { 841 | next = element; 842 | return false; 843 | } 844 | next = findNextInSiblings(element, selector, backwards); 845 | if(next) { 846 | return false; 847 | } 848 | }); 849 | return next; 850 | } 851 | 852 | $.fn.near = function( selector, backwards ) { 853 | var array = []; 854 | $(this).each(function(idx, element) { 855 | var near = (backwards ? 856 | false : 857 | findNextInChildren( element, selector, backwards )) || 858 | findNextInSiblings( element, selector, backwards ) || 859 | findNextInParents( element, selector, backwards ); 860 | if( near ) { 861 | array.push(near); 862 | } 863 | }); 864 | return $(array); 865 | }; 866 | }(jQuery, document, window)); 867 | /*! 868 | * transform.js 869 | * The engine that powers the transforms or falls back to other methods 870 | */ 871 | (function( $, document, window, undefined ) { 872 | 873 | 'use strict'; 874 | 875 | /* FUNCTIONS */ 876 | function randomString() { 877 | return "" + Math.round(Math.random() * 100000, 0); 878 | } 879 | function toCssNumber(number) { 880 | return (Math.round(10000*number)/10000)+""; 881 | } 882 | 883 | /** 884 | * 3D and 2D engines 885 | */ 886 | var engines = { 887 | 3: { 888 | transform: function( el, data ) { 889 | var transform = 'translate(-50%,-50%)'; 890 | $.each(data, function(idx, item) { 891 | var coord = ["X", "Y", "Z"]; 892 | var i; 893 | if(item[0] === "translate") { // ["translate", x, y, z] 894 | transform += " translate3d(" + toCssNumber(item[1] || 0) + "px," + toCssNumber(item[2] || 0) + "px," + toCssNumber(item[3] || 0) + "px)"; 895 | } else if(item[0] === "rotate") { 896 | var order = item[4] ? [1, 2, 3] : [3, 2, 1]; 897 | for(i = 0; i < 3; i++) { 898 | transform += " rotate" + coord[order[i]-1] + "(" + toCssNumber(item[order[i]] || 0) + "deg)"; 899 | } 900 | } else if(item[0] === "scale") { 901 | for(i = 0; i < 3; i++) { 902 | transform += " scale" + coord[i] + "(" + toCssNumber(item[i+1] || 1) + ")"; 903 | } 904 | } 905 | }); 906 | $.jmpress("css", el, $.extend({}, { transform: transform })); 907 | } 908 | } 909 | ,2: { 910 | transform: function( el, data ) { 911 | var transform = 'translate(-50%,-50%)'; 912 | $.each(data, function(idx, item) { 913 | var coord = ["X", "Y"]; 914 | if(item[0] === "translate") { // ["translate", x, y, z] 915 | transform += " translate(" + toCssNumber(item[1] || 0) + "px," + toCssNumber(item[2] || 0) + "px)"; 916 | } else if(item[0] === "rotate") { 917 | transform += " rotate(" + toCssNumber(item[3] || 0) + "deg)"; 918 | } else if(item[0] === "scale") { 919 | for(var i = 0; i < 2; i++) { 920 | transform += " scale" + coord[i] + "(" + toCssNumber(item[i+1] || 1) + ")"; 921 | } 922 | } 923 | }); 924 | $.jmpress("css", el, $.extend({}, { transform: transform })); 925 | } 926 | } 927 | ,1: { 928 | // CHECK IF SUPPORT IS REALLY NEEDED? 929 | // this not even work without scaling... 930 | // it may better to display the normal view 931 | transform: function( el, data ) { 932 | var anitarget = { top: 0, left: 0 }; 933 | $.each(data, function(idx, item) { 934 | var coord = ["X", "Y"]; 935 | if(item[0] === "translate") { // ["translate", x, y, z] 936 | anitarget.left = Math.round(item[1] || 0) + "px"; 937 | anitarget.top = Math.round(item[2] || 0) + "px"; 938 | } 939 | }); 940 | el.animate(anitarget, 1000); // TODO: Use animation duration 941 | } 942 | } 943 | }; 944 | 945 | /** 946 | * Engine to power cross-browser translate, scale and rotate. 947 | */ 948 | var engine = (function() { 949 | if ($.jmpress("pfx", "perspective")) { 950 | return engines[3]; 951 | } else if ($.jmpress("pfx", "transform")) { 952 | return engines[2]; 953 | } else { 954 | // CHECK IF SUPPORT IS REALLY NEEDED? 955 | return engines[1]; 956 | } 957 | }()); 958 | 959 | $.jmpress("defaults").reasonableAnimation = {}; 960 | $.jmpress("initStep", function( step, eventData ) { 961 | var data = eventData.data; 962 | var stepData = eventData.stepData; 963 | var pf = parseFloat; 964 | $.extend(stepData, { 965 | x: pf(data.x) || 0 966 | ,y: pf(data.y) || 0 967 | ,z: pf(data.z) || 0 968 | ,r: pf(data.r) || 0 969 | ,phi: pf(data.phi) || 0 970 | ,rotate: pf(data.rotate) || 0 971 | ,rotateX: pf(data.rotateX) || 0 972 | ,rotateY: pf(data.rotateY) || 0 973 | ,rotateZ: pf(data.rotateZ) || 0 974 | ,revertRotate: false 975 | ,scale: pf(data.scale) || 1 976 | ,scaleX: pf(data.scaleX) || false 977 | ,scaleY: pf(data.scaleY) || false 978 | ,scaleZ: pf(data.scaleZ) || 1 979 | }); 980 | }); 981 | $.jmpress("afterInit", function( nil, eventData ) { 982 | var stepSelector = eventData.settings.stepSelector, 983 | current = eventData.current; 984 | current.perspectiveScale = 1; 985 | current.maxNestedDepth = 0; 986 | var nestedSteps = $(eventData.jmpress).find(stepSelector).children(stepSelector); 987 | while(nestedSteps.length) { 988 | current.maxNestedDepth++; 989 | nestedSteps = nestedSteps.children(stepSelector); 990 | } 991 | }); 992 | $.jmpress("applyStep", function( step, eventData ) { 993 | $.jmpress("css", $(step), { 994 | position: "absolute" 995 | ,transformStyle: "preserve-3d" 996 | }); 997 | if ( eventData.parents.length > 0 ) { 998 | $.jmpress("css", $(step), { 999 | top: "50%" 1000 | ,left: "50%" 1001 | }); 1002 | } 1003 | var sd = eventData.stepData; 1004 | var transform = [ 1005 | ["translate", 1006 | sd.x || (sd.r * Math.sin(sd.phi*Math.PI/180)), 1007 | sd.y || (-sd.r * Math.cos(sd.phi*Math.PI/180)), 1008 | sd.z], 1009 | ["rotate", 1010 | sd.rotateX, 1011 | sd.rotateY, 1012 | sd.rotateZ || sd.rotate, 1013 | true], 1014 | ["scale", 1015 | sd.scaleX || sd.scale, 1016 | sd.scaleY || sd.scale, 1017 | sd.scaleZ || sd.scale] 1018 | ]; 1019 | engine.transform( step, transform ); 1020 | }); 1021 | $.jmpress("setActive", function( element, eventData ) { 1022 | var target = eventData.target; 1023 | var step = eventData.stepData; 1024 | var tf = target.transform = []; 1025 | target.perspectiveScale = 1; 1026 | 1027 | for(var i = eventData.current.maxNestedDepth; i > (eventData.parents.length || 0); i--) { 1028 | tf.push(["scale"], ["rotate"], ["translate"]); 1029 | } 1030 | 1031 | tf.push(["scale", 1032 | 1 / (step.scaleX || step.scale), 1033 | 1 / (step.scaleY || step.scale), 1034 | 1 / (step.scaleZ)]); 1035 | tf.push(["rotate", 1036 | -step.rotateX, 1037 | -step.rotateY, 1038 | -(step.rotateZ || step.rotate)]); 1039 | tf.push(["translate", 1040 | -(step.x || (step.r * Math.sin(step.phi*Math.PI/180))), 1041 | -(step.y || (-step.r * Math.cos(step.phi*Math.PI/180))), 1042 | -step.z]); 1043 | target.perspectiveScale *= (step.scaleX || step.scale); 1044 | 1045 | $.each(eventData.parents, function(idx, element) { 1046 | var step = $(element).data("stepData"); 1047 | tf.push(["scale", 1048 | 1 / (step.scaleX || step.scale), 1049 | 1 / (step.scaleY || step.scale), 1050 | 1 / (step.scaleZ)]); 1051 | tf.push(["rotate", 1052 | -step.rotateX, 1053 | -step.rotateY, 1054 | -(step.rotateZ || step.rotate)]); 1055 | tf.push(["translate", 1056 | -(step.x || (step.r * Math.sin(step.phi*Math.PI/180))), 1057 | -(step.y || (-step.r * Math.cos(step.phi*Math.PI/180))), 1058 | -step.z]); 1059 | target.perspectiveScale *= (step.scaleX || step.scale); 1060 | }); 1061 | 1062 | $.each(tf, function(idx, item) { 1063 | if(item[0] !== "rotate") { 1064 | return; 1065 | } 1066 | function lowRotate(name) { 1067 | if(eventData.current["rotate"+name+"-"+idx] === undefined) { 1068 | eventData.current["rotate"+name+"-"+idx] = item[name] || 0; 1069 | } 1070 | var cur = eventData.current["rotate"+name+"-"+idx], tar = item[name] || 0, 1071 | curmod = cur % 360, tarmod = tar % 360; 1072 | if(curmod < 0) { 1073 | curmod += 360; 1074 | } 1075 | if(tarmod < 0) { 1076 | tarmod += 360; 1077 | } 1078 | var diff = tarmod - curmod; 1079 | if(diff < -180) { 1080 | diff += 360; 1081 | } else if(diff > 180) { 1082 | diff -= 360; 1083 | } 1084 | eventData.current["rotate"+name+"-"+idx] = item[name] = cur + diff; 1085 | } 1086 | lowRotate(1); 1087 | lowRotate(2); 1088 | lowRotate(3); 1089 | }); 1090 | }); 1091 | $.jmpress("applyTarget", function( active, eventData ) { 1092 | 1093 | var target = eventData.target, 1094 | props, step = eventData.stepData, 1095 | settings = eventData.settings, 1096 | zoomin = target.perspectiveScale * 1.3 < eventData.current.perspectiveScale, 1097 | zoomout = target.perspectiveScale > eventData.current.perspectiveScale * 1.3; 1098 | 1099 | // extract first scale from transform 1100 | var lastScale = -1; 1101 | $.each(target.transform, function(idx, item) { 1102 | if(item.length <= 1) { 1103 | return; 1104 | } 1105 | if(item[0] === "rotate" && 1106 | item[1] % 360 === 0 && 1107 | item[2] % 360 === 0 && 1108 | item[3] % 360 === 0) { 1109 | return; 1110 | } 1111 | if(item[0] === "scale") { 1112 | lastScale = idx; 1113 | } else { 1114 | return false; 1115 | } 1116 | }); 1117 | 1118 | if(lastScale !== eventData.current.oldLastScale) { 1119 | zoomin = zoomout = false; 1120 | eventData.current.oldLastScale = lastScale; 1121 | } 1122 | 1123 | var extracted = []; 1124 | if(lastScale !== -1) { 1125 | while(lastScale >= 0) { 1126 | if(target.transform[lastScale][0] === "scale") { 1127 | extracted.push(target.transform[lastScale]); 1128 | target.transform[lastScale] = ["scale"]; 1129 | } 1130 | lastScale--; 1131 | } 1132 | } 1133 | 1134 | var animation = settings.animation; 1135 | if(settings.reasonableAnimation[eventData.reason]) { 1136 | animation = $.extend({}, 1137 | animation, 1138 | settings.reasonableAnimation[eventData.reason]); 1139 | } 1140 | 1141 | props = { 1142 | // to keep the perspective look similar for different scales 1143 | // we need to 'scale' the perspective, too 1144 | perspective: Math.round(target.perspectiveScale * 1000) + "px" 1145 | }; 1146 | props = $.extend({}, animation, props); 1147 | if (!zoomin) { 1148 | props.transitionDelay = '0s'; 1149 | } 1150 | if (!eventData.beforeActive) { 1151 | props.transitionDuration = '0s'; 1152 | props.transitionDelay = '0s'; 1153 | } 1154 | $.jmpress("css", eventData.area, props); 1155 | engine.transform(eventData.area, extracted); 1156 | 1157 | props = $.extend({}, animation); 1158 | if (!zoomout) { 1159 | props.transitionDelay = '0s'; 1160 | } 1161 | if (!eventData.beforeActive) { 1162 | props.transitionDuration = '0s'; 1163 | props.transitionDelay = '0s'; 1164 | } 1165 | 1166 | eventData.current.perspectiveScale = target.perspectiveScale; 1167 | 1168 | $.jmpress("css", eventData.canvas, props); 1169 | engine.transform(eventData.canvas, target.transform); 1170 | }); 1171 | 1172 | }(jQuery, document, window)); 1173 | /*! 1174 | * active.js 1175 | * Set the active classes on steps 1176 | */ 1177 | (function( $, document, window, undefined ) { 1178 | 1179 | 'use strict'; 1180 | var $jmpress = $.jmpress; 1181 | 1182 | /* DEFINES */ 1183 | var activeClass = 'activeClass', 1184 | nestedActiveClass = 'nestedActiveClass'; 1185 | 1186 | /* DEFAULTS */ 1187 | var defaults = $jmpress( 'defaults' ); 1188 | defaults[nestedActiveClass] = "nested-active"; 1189 | defaults[activeClass] = "active"; 1190 | 1191 | /* HOOKS */ 1192 | $jmpress( 'setInactive', function( step, eventData ) { 1193 | var settings = eventData.settings, 1194 | activeClassSetting = settings[activeClass], 1195 | nestedActiveClassSettings = settings[nestedActiveClass]; 1196 | if(activeClassSetting) { 1197 | $(step).removeClass( activeClassSetting ); 1198 | } 1199 | if(nestedActiveClassSettings) { 1200 | $.each(eventData.parents, function(idx, element) { 1201 | $(element).removeClass(nestedActiveClassSettings); 1202 | }); 1203 | } 1204 | }); 1205 | $jmpress( 'setActive', function( step, eventData ) { 1206 | var settings = eventData.settings, 1207 | activeClassSetting = settings[activeClass], 1208 | nestedActiveClassSettings = settings[nestedActiveClass]; 1209 | if(activeClassSetting) { 1210 | $(step).addClass( activeClassSetting ); 1211 | } 1212 | if(nestedActiveClassSettings) { 1213 | $.each(eventData.parents, function(idx, element) { 1214 | $(element).addClass(nestedActiveClassSettings); 1215 | }); 1216 | } 1217 | }); 1218 | 1219 | }(jQuery, document, window)); 1220 | /*! 1221 | * circular.js 1222 | * Repeat from start after end 1223 | */ 1224 | (function( $, document, window, undefined ) { 1225 | 1226 | 'use strict'; 1227 | var $jmpress = $.jmpress; 1228 | 1229 | /* FUNCTIONS */ 1230 | function firstSlide( step, eventData ) { 1231 | return $(this).find(eventData.settings.stepSelector).first(); 1232 | } 1233 | function prevOrNext( jmpress, step, eventData, prev) { 1234 | if (!step) { 1235 | return false; 1236 | } 1237 | var stepSelector = eventData.settings.stepSelector; 1238 | step = $(step); 1239 | do { 1240 | var item = step.near( stepSelector, prev ); 1241 | if (item.length === 0 || item.closest(jmpress).length === 0) { 1242 | item = $(jmpress).find(stepSelector)[prev?"last":"first"](); 1243 | } 1244 | if (!item.length) { 1245 | return false; 1246 | } 1247 | step = item; 1248 | } while( step.data("stepData").exclude ); 1249 | return step; 1250 | } 1251 | 1252 | /* HOOKS */ 1253 | $jmpress( 'initStep', function( step, eventData ) { 1254 | eventData.stepData.exclude = eventData.data.exclude && ["false", "no"].indexOf(eventData.data.exclude) === -1; 1255 | }); 1256 | $jmpress( 'selectInitialStep', firstSlide); 1257 | $jmpress( 'selectHome', firstSlide); 1258 | $jmpress( 'selectEnd', function( step, eventData ) { 1259 | return $(this).find(eventData.settings.stepSelector).last(); 1260 | }); 1261 | $jmpress( 'selectPrev', function( step, eventData ) { 1262 | return prevOrNext(this, step, eventData, true); 1263 | }); 1264 | $jmpress( 'selectNext', function( step, eventData ) { 1265 | return prevOrNext(this, step, eventData); 1266 | }); 1267 | }(jQuery, document, window)); 1268 | /*! 1269 | * ways.js 1270 | * Control the flow of the steps 1271 | */ 1272 | (function( $, document, window, undefined ) { 1273 | 1274 | 'use strict'; 1275 | var $jmpress = $.jmpress; 1276 | 1277 | /* FUNCTIONS */ 1278 | function randomString() { 1279 | return "" + Math.round(Math.random() * 100000, 0); 1280 | } 1281 | function routeFunc( jmpress, route, type ) { 1282 | for(var i = 0; i < route.length - 1; i++) { 1283 | var from = route[i]; 1284 | var to = route[i+1]; 1285 | if($(jmpress).jmpress("initialized")) { 1286 | $(from, jmpress).data("stepData")[type] = to; 1287 | } else { 1288 | $(from, jmpress).attr('data-' + type, to); 1289 | } 1290 | } 1291 | } 1292 | function selectPrevOrNext( step, eventData, attr, prev ) { 1293 | var stepData = eventData.stepData; 1294 | if(stepData[attr]) { 1295 | var near = $(step).near(stepData[attr], prev); 1296 | if(near && near.length) { 1297 | return near; 1298 | } 1299 | near = $(stepData[attr], this)[prev?"last":"first"](); 1300 | if(near && near.length) { 1301 | return near; 1302 | } 1303 | } 1304 | } 1305 | 1306 | /* EXPORTED FUNCTIONS */ 1307 | $jmpress( 'register', 'route', function( route, unidirectional, reversedRoute ) { 1308 | if( typeof route === "string" ) { 1309 | route = [route, route]; 1310 | } 1311 | routeFunc(this, route, reversedRoute ? "prev" : "next"); 1312 | if (!unidirectional) { 1313 | routeFunc(this, route.reverse(), reversedRoute ? "next" : "prev"); 1314 | } 1315 | }); 1316 | 1317 | /* HOOKS */ 1318 | $jmpress( 'initStep', function( step, eventData ) { 1319 | for(var attr in {next:1,prev:1}) { 1320 | eventData.stepData[attr] = eventData.data[attr]; 1321 | } 1322 | }); 1323 | $jmpress( 'selectNext', function( step, eventData ) { 1324 | return selectPrevOrNext.call(this, step, eventData, "next"); 1325 | }); 1326 | $jmpress( 'selectPrev', function( step, eventData ) { 1327 | return selectPrevOrNext.call(this, step, eventData, "prev", true); 1328 | }); 1329 | 1330 | }(jQuery, document, window)); 1331 | /*! 1332 | * hash.js 1333 | * Detect and set the URL hash 1334 | */ 1335 | (function( $, document, window, undefined ) { 1336 | 1337 | 'use strict'; 1338 | var $jmpress = $.jmpress, 1339 | hashLink = "a[href^=#]"; 1340 | 1341 | /* FUNCTIONS */ 1342 | function randomString() { 1343 | return "" + Math.round(Math.random() * 100000, 0); 1344 | } 1345 | /** 1346 | * getElementFromUrl 1347 | * 1348 | * @return String or undefined 1349 | */ 1350 | function getElementFromUrl(settings) { 1351 | // get id from url # by removing `#` or `#/` from the beginning, 1352 | // so both "fallback" `#slide-id` and "enhanced" `#/slide-id` will work 1353 | // TODO SECURITY check user input to be valid! 1354 | try { 1355 | var el = $( '#' + window.location.hash.replace(/^#\/?/,"") ); 1356 | return el.length > 0 && el.is(settings.stepSelector) ? el : undefined; 1357 | } catch(e) {} 1358 | } 1359 | function setHash(stepid) { 1360 | var shouldBeHash = "#/" + stepid; 1361 | if(window.history && window.history.pushState) { 1362 | // shouldBeHash = "#" + stepid; 1363 | // consider this for future versions 1364 | // it has currently issues, when startup with a link with hash (webkit) 1365 | if(window.location.hash !== shouldBeHash) { 1366 | window.history.pushState({}, '', shouldBeHash); 1367 | } 1368 | } else { 1369 | if(window.location.hash !== shouldBeHash) { 1370 | window.location.hash = shouldBeHash; 1371 | } 1372 | } 1373 | } 1374 | 1375 | /* DEFAULTS */ 1376 | $jmpress('defaults').hash = { 1377 | use: true 1378 | ,update: true 1379 | ,bindChange: true 1380 | // NOTICE: {use: true, update: false, bindChange: true} 1381 | // will cause a error after clicking on a link to the current step 1382 | }; 1383 | 1384 | /* HOOKS */ 1385 | $jmpress('selectInitialStep', function( step, eventData ) { 1386 | var settings = eventData.settings, 1387 | hashSettings = settings.hash, 1388 | current = eventData.current, 1389 | jmpress = $(this); 1390 | eventData.current.hashNamespace = ".jmpress-"+randomString(); 1391 | // HASH CHANGE EVENT 1392 | if ( hashSettings.use ) { 1393 | if ( hashSettings.bindChange ) { 1394 | $(window).bind('hashchange'+current.hashNamespace, function(event) { 1395 | var urlItem = getElementFromUrl(settings); 1396 | if ( jmpress.jmpress('initialized') ) { 1397 | jmpress.jmpress("scrollFix"); 1398 | } 1399 | if(urlItem && urlItem.length) { 1400 | if(urlItem.attr("id") !== jmpress.jmpress("active").attr("id")) { 1401 | jmpress.jmpress('select', urlItem); 1402 | } 1403 | setHash(urlItem.attr("id")); 1404 | } 1405 | event.preventDefault(); 1406 | }); 1407 | $(hashLink).on("click"+current.hashNamespace, function(event) { 1408 | var href = $(this).attr("href"); 1409 | try { 1410 | if($(href).is(settings.stepSelector)) { 1411 | jmpress.jmpress("select", href); 1412 | event.preventDefault(); 1413 | event.stopPropagation(); 1414 | } 1415 | } catch(e) {} 1416 | }); 1417 | } 1418 | return getElementFromUrl(settings); 1419 | } 1420 | }); 1421 | $jmpress('afterDeinit', function( nil, eventData ) { 1422 | $(hashLink).off(eventData.current.hashNamespace); 1423 | $(window).unbind(eventData.current.hashNamespace); 1424 | }); 1425 | $jmpress('setActive', function( step, eventData ) { 1426 | var settings = eventData.settings, 1427 | current = eventData.current; 1428 | // `#/step-id` is used instead of `#step-id` to prevent default browser 1429 | // scrolling to element in hash 1430 | if ( settings.hash.use && settings.hash.update ) { 1431 | clearTimeout(current.hashtimeout); 1432 | current.hashtimeout = setTimeout(function() { 1433 | setHash($(eventData.delegatedFrom).attr('id')); 1434 | }, settings.transitionDuration + 200); 1435 | } 1436 | }); 1437 | 1438 | }(jQuery, document, window)); 1439 | /*! 1440 | * keyboard.js 1441 | * Keyboard event mapping and default keyboard actions 1442 | */ 1443 | (function( $, document, window, undefined ) { 1444 | 1445 | 'use strict'; 1446 | var $jmpress = $.jmpress, 1447 | jmpressNext = "next", 1448 | jmpressPrev = "prev"; 1449 | 1450 | /* FUNCTIONS */ 1451 | function randomString() { 1452 | return "" + Math.round(Math.random() * 100000, 0); 1453 | } 1454 | function stopEvent(event) { 1455 | event.preventDefault(); 1456 | event.stopPropagation(); 1457 | } 1458 | 1459 | /* DEFAULTS */ 1460 | $jmpress('defaults').keyboard = { 1461 | use: true 1462 | ,keys: { 1463 | 33: jmpressPrev // pg up 1464 | ,37: jmpressPrev // left 1465 | ,38: jmpressPrev // up 1466 | 1467 | ,9: jmpressNext+":"+jmpressPrev // tab 1468 | ,32: jmpressNext // space 1469 | ,34: jmpressNext // pg down 1470 | ,39: jmpressNext // right 1471 | ,40: jmpressNext // down 1472 | 1473 | ,36: "home" // home 1474 | 1475 | ,35: "end" // end 1476 | } 1477 | ,ignore: { 1478 | "INPUT": [ 1479 | 32 // space 1480 | ,37 // left 1481 | ,38 // up 1482 | ,39 // right 1483 | ,40 // down 1484 | ] 1485 | ,"TEXTAREA": [ 1486 | 32 // space 1487 | ,37 // left 1488 | ,38 // up 1489 | ,39 // right 1490 | ,40 // down 1491 | ] 1492 | ,"SELECT": [ 1493 | 38 // up 1494 | ,40 // down 1495 | ] 1496 | } 1497 | ,tabSelector: "a[href]:visible, :input:visible" 1498 | }; 1499 | 1500 | /* HOOKS */ 1501 | $jmpress('afterInit', function( nil, eventData ) { 1502 | var settings = eventData.settings, 1503 | keyboardSettings = settings.keyboard, 1504 | ignoreKeyboardSettings = keyboardSettings.ignore, 1505 | current = eventData.current, 1506 | jmpress = $(this); 1507 | 1508 | // tabindex make it focusable so that it can recieve key events 1509 | if(!settings.fullscreen) { 1510 | jmpress.attr("tabindex", 0); 1511 | } 1512 | 1513 | current.keyboardNamespace = ".jmpress-"+randomString(); 1514 | 1515 | // KEYPRESS EVENT: this fixes a Opera bug 1516 | $(settings.fullscreen ? document : jmpress) 1517 | .bind("keypress"+current.keyboardNamespace, function( event ) { 1518 | 1519 | for( var nodeName in ignoreKeyboardSettings ) { 1520 | if ( event.target.nodeName === nodeName && ignoreKeyboardSettings[nodeName].indexOf(event.which) !== -1 ) { 1521 | return; 1522 | } 1523 | } 1524 | if(event.which >= 37 && event.which <= 40 || event.which === 32) { 1525 | stopEvent(event); 1526 | } 1527 | }); 1528 | // KEYDOWN EVENT 1529 | $(settings.fullscreen ? document : jmpress) 1530 | .bind("keydown"+current.keyboardNamespace, function( event ) { 1531 | var eventTarget = $(event.target); 1532 | 1533 | if ( !settings.fullscreen && !eventTarget.closest(jmpress).length || !keyboardSettings.use ) { 1534 | return; 1535 | } 1536 | 1537 | for( var nodeName in ignoreKeyboardSettings ) { 1538 | if ( eventTarget[0].nodeName === nodeName && ignoreKeyboardSettings[nodeName].indexOf(event.which) !== -1 ) { 1539 | return; 1540 | } 1541 | } 1542 | 1543 | var reverseSelect = false; 1544 | var nextFocus; 1545 | if (event.which === 9) { 1546 | // tab 1547 | if ( !eventTarget.closest( jmpress.jmpress('active') ).length ) { 1548 | if ( !event.shiftKey ) { 1549 | nextFocus = jmpress.jmpress('active').find("a[href], :input").filter(":visible").first(); 1550 | } else { 1551 | reverseSelect = true; 1552 | } 1553 | } else { 1554 | nextFocus = eventTarget.near( keyboardSettings.tabSelector, event.shiftKey ); 1555 | if( !$(nextFocus) 1556 | .closest( settings.stepSelector ) 1557 | .is(jmpress.jmpress('active') ) ) { 1558 | nextFocus = undefined; 1559 | } 1560 | } 1561 | if( nextFocus && nextFocus.length > 0 ) { 1562 | nextFocus.focus(); 1563 | jmpress.jmpress("scrollFix"); 1564 | stopEvent(event); 1565 | return; 1566 | } else { 1567 | if(event.shiftKey) { 1568 | reverseSelect = true; 1569 | } 1570 | } 1571 | } 1572 | 1573 | var action = keyboardSettings.keys[ event.which ]; 1574 | if ( typeof action === "string" ) { 1575 | if (action.indexOf(":") !== -1) { 1576 | action = action.split(":"); 1577 | action = event.shiftKey ? action[1] : action[0]; 1578 | } 1579 | jmpress.jmpress( action ); 1580 | stopEvent(event); 1581 | } else if ( $.isFunction(action) ) { 1582 | action.call(jmpress, event); 1583 | } else if ( action ) { 1584 | jmpress.jmpress.apply( jmpress, action ); 1585 | stopEvent(event); 1586 | } 1587 | 1588 | if (reverseSelect) { 1589 | // tab 1590 | nextFocus = jmpress.jmpress('active').find("a[href], :input").filter(":visible").last(); 1591 | nextFocus.focus(); 1592 | jmpress.jmpress("scrollFix"); 1593 | } 1594 | }); 1595 | }); 1596 | $jmpress('afterDeinit', function( nil, eventData ) { 1597 | $(document).unbind(eventData.current.keyboardNamespace); 1598 | }); 1599 | 1600 | 1601 | }(jQuery, document, window)); 1602 | /*! 1603 | * viewport.js 1604 | * Scale to fit a given viewport 1605 | */ 1606 | (function( $, document, window, undefined ) { 1607 | 1608 | 'use strict'; 1609 | 1610 | function randomString() { 1611 | return "" + Math.round(Math.random() * 100000, 0); 1612 | } 1613 | 1614 | var defaults = $.jmpress("defaults"); 1615 | defaults.viewPort = { 1616 | width: false 1617 | ,height: false 1618 | ,maxScale: 0 1619 | ,minScale: 0 1620 | ,zoomable: 0 1621 | ,zoomBindMove: true 1622 | ,zoomBindWheel: true 1623 | }; 1624 | var keys = defaults.keyboard.keys; 1625 | keys[$.browser.mozilla?107:187] = "zoomIn"; // + 1626 | keys[$.browser.mozilla?109:189] = "zoomOut"; // - 1627 | defaults.reasonableAnimation.resize = { 1628 | transitionDuration: '0s' 1629 | ,transitionDelay: '0ms' 1630 | }; 1631 | defaults.reasonableAnimation.zoom = { 1632 | transitionDuration: '0s' 1633 | ,transitionDelay: '0ms' 1634 | }; 1635 | $.jmpress("initStep", function( step, eventData ) { 1636 | for(var variable in {"viewPortHeight":1, "viewPortWidth":1, "viewPortMinScale":1, "viewPortMaxScale":1, "viewPortZoomable":1}) { 1637 | eventData.stepData[variable] = eventData.data[variable] && parseFloat(eventData.data[variable]); 1638 | } 1639 | }); 1640 | $.jmpress("afterInit", function( nil, eventData ) { 1641 | var jmpress = this; 1642 | eventData.current.viewPortNamespace = ".jmpress-"+randomString(); 1643 | $(window).bind("resize"+eventData.current.viewPortNamespace, function (event) { 1644 | $(jmpress).jmpress("reselect", "resize"); 1645 | }); 1646 | eventData.current.userZoom = 0; 1647 | eventData.current.userTranslateX = 0; 1648 | eventData.current.userTranslateY = 0; 1649 | if(eventData.settings.viewPort.zoomBindWheel) { 1650 | $(eventData.settings.fullscreen ? document : this) 1651 | .bind("mousewheel"+eventData.current.viewPortNamespace+" DOMMouseScroll"+eventData.current.viewPortNamespace, function( event, delta ) { 1652 | delta = delta || event.originalEvent.wheelDelta || -event.originalEvent.detail /* mozilla */; 1653 | var direction = (delta / Math.abs(delta)); 1654 | if(direction < 0) { 1655 | $(eventData.jmpress).jmpress("zoomOut", event.originalEvent.x, event.originalEvent.y); 1656 | } else if(direction > 0) { 1657 | $(eventData.jmpress).jmpress("zoomIn", event.originalEvent.x, event.originalEvent.y); 1658 | } 1659 | return false; 1660 | }); 1661 | } 1662 | if(eventData.settings.viewPort.zoomBindMove) { 1663 | $(eventData.settings.fullscreen ? document : this).bind("mousedown"+eventData.current.viewPortNamespace, function (event) { 1664 | if(eventData.current.userZoom) { 1665 | eventData.current.userTranslating = { x: event.clientX, y: event.clientY }; 1666 | event.preventDefault(); 1667 | event.stopImmediatePropagation(); 1668 | } 1669 | }).bind("mousemove"+eventData.current.viewPortNamespace, function (event) { 1670 | var userTranslating = eventData.current.userTranslating; 1671 | if(userTranslating) { 1672 | $(jmpress).jmpress("zoomTranslate", event.clientX - userTranslating.x, event.clientY - userTranslating.y); 1673 | userTranslating.x = event.clientX; 1674 | userTranslating.y = event.clientY; 1675 | event.preventDefault(); 1676 | event.stopImmediatePropagation(); 1677 | } 1678 | }).bind("mouseup"+eventData.current.viewPortNamespace, function (event) { 1679 | if(eventData.current.userTranslating) { 1680 | eventData.current.userTranslating = undefined; 1681 | event.preventDefault(); 1682 | event.stopImmediatePropagation(); 1683 | } 1684 | }); 1685 | } 1686 | }); 1687 | function maxAbs(value, range) { 1688 | return Math.max(Math.min(value, range), -range); 1689 | } 1690 | function zoom(x, y, direction) { 1691 | var current = $(this).jmpress("current"), 1692 | settings = $(this).jmpress("settings"), 1693 | stepData = $(this).jmpress("active").data("stepData"), 1694 | container = $(this).jmpress("container"); 1695 | if(current.userZoom === 0 && direction < 0) { 1696 | return; 1697 | } 1698 | var zoomableSteps = stepData.viewPortZoomable || settings.viewPort.zoomable; 1699 | if(current.userZoom === zoomableSteps && direction > 0) { 1700 | return; 1701 | } 1702 | current.userZoom += direction; 1703 | 1704 | var halfWidth = $(container).innerWidth()/2, 1705 | halfHeight = $(container).innerHeight()/2; 1706 | 1707 | x = x ? x - halfWidth : x; 1708 | y = y ? y - halfHeight : y; 1709 | 1710 | // TODO this is not perfect... too much math... :( 1711 | current.userTranslateX = 1712 | maxAbs(current.userTranslateX - direction * x / current.zoomOriginWindowScale / zoomableSteps, 1713 | halfWidth * current.userZoom * current.userZoom / zoomableSteps); 1714 | current.userTranslateY = 1715 | maxAbs(current.userTranslateY - direction * y / current.zoomOriginWindowScale / zoomableSteps, 1716 | halfHeight * current.userZoom * current.userZoom / zoomableSteps); 1717 | 1718 | $(this).jmpress("reselect", "zoom"); 1719 | } 1720 | $.jmpress("register", "zoomIn", function(x, y) { 1721 | zoom.call(this, x||0, y||0, 1); 1722 | }); 1723 | $.jmpress("register", "zoomOut", function(x, y) { 1724 | zoom.call(this, x||0, y||0, -1); 1725 | }); 1726 | $.jmpress("register", "zoomTranslate", function(x, y) { 1727 | var current = $(this).jmpress("current"), 1728 | settings = $(this).jmpress("settings"), 1729 | stepData = $(this).jmpress("active").data("stepData"), 1730 | container = $(this).jmpress("container"); 1731 | var zoomableSteps = stepData.viewPortZoomable || settings.viewPort.zoomable; 1732 | var halfWidth = $(container).innerWidth(), 1733 | halfHeight = $(container).innerHeight(); 1734 | current.userTranslateX = 1735 | maxAbs(current.userTranslateX + x / current.zoomOriginWindowScale, 1736 | halfWidth * current.userZoom * current.userZoom / zoomableSteps); 1737 | current.userTranslateY = 1738 | maxAbs(current.userTranslateY + y / current.zoomOriginWindowScale, 1739 | halfHeight * current.userZoom * current.userZoom / zoomableSteps); 1740 | $(this).jmpress("reselect", "zoom"); 1741 | }); 1742 | $.jmpress('afterDeinit', function( nil, eventData ) { 1743 | $(window).unbind(eventData.current.viewPortNamespace); 1744 | }); 1745 | $.jmpress("setActive", function( step, eventData ) { 1746 | var viewPort = eventData.settings.viewPort; 1747 | var viewPortHeight = eventData.stepData.viewPortHeight || viewPort.height; 1748 | var viewPortWidth = eventData.stepData.viewPortWidth || viewPort.width; 1749 | var viewPortMaxScale = eventData.stepData.viewPortMaxScale || viewPort.maxScale; 1750 | var viewPortMinScale = eventData.stepData.viewPortMinScale || viewPort.minScale; 1751 | // Correct the scale based on the window's size 1752 | var windowScaleY = viewPortHeight && $(eventData.container).innerHeight()/viewPortHeight; 1753 | var windowScaleX = viewPortWidth && $(eventData.container).innerWidth()/viewPortWidth; 1754 | var windowScale = (windowScaleX || windowScaleY) && Math.min( windowScaleX || windowScaleY, windowScaleY || windowScaleX ); 1755 | 1756 | if(windowScale) { 1757 | windowScale = windowScale || 1; 1758 | if(viewPortMaxScale) { 1759 | windowScale = Math.min(windowScale, viewPortMaxScale); 1760 | } 1761 | if(viewPortMinScale) { 1762 | windowScale = Math.max(windowScale, viewPortMinScale); 1763 | } 1764 | 1765 | var zoomableSteps = eventData.stepData.viewPortZoomable || eventData.settings.viewPort.zoomable; 1766 | if(zoomableSteps) { 1767 | var diff = (1/windowScale) - (1/viewPortMaxScale); 1768 | diff /= zoomableSteps; 1769 | windowScale = 1/((1/windowScale) - diff * eventData.current.userZoom); 1770 | } 1771 | 1772 | eventData.target.transform.reverse(); 1773 | if(eventData.current.userTranslateX && eventData.current.userTranslateY) { 1774 | eventData.target.transform.push(["translate", eventData.current.userTranslateX, eventData.current.userTranslateY, 0]); 1775 | } else { 1776 | eventData.target.transform.push(["translate"]); 1777 | } 1778 | eventData.target.transform.push(["scale", 1779 | windowScale, 1780 | windowScale, 1781 | 1]); 1782 | eventData.target.transform.reverse(); 1783 | eventData.target.perspectiveScale /= windowScale; 1784 | } 1785 | eventData.current.zoomOriginWindowScale = windowScale; 1786 | }); 1787 | $.jmpress("setInactive", function( step, eventData ) { 1788 | if(!eventData.nextStep || !step || $(eventData.nextStep).attr("id") !== $(step).attr("id")) { 1789 | eventData.current.userZoom = 0; 1790 | eventData.current.userTranslateX = 0; 1791 | eventData.current.userTranslateY = 0; 1792 | } 1793 | }); 1794 | 1795 | }(jQuery, document, window)); 1796 | /*! 1797 | * mouse.js 1798 | * Clicking to select a step 1799 | */ 1800 | (function( $, document, window, undefined ) { 1801 | 1802 | 'use strict'; 1803 | var $jmpress = $.jmpress; 1804 | 1805 | /* FUNCTIONS */ 1806 | function randomString() { 1807 | return "" + Math.round(Math.random() * 100000, 0); 1808 | } 1809 | 1810 | /* DEFAULTS */ 1811 | $jmpress("defaults").mouse = { 1812 | clickSelects: true 1813 | }; 1814 | 1815 | /* HOOKS */ 1816 | $jmpress("afterInit", function( nil, eventData ) { 1817 | var settings = eventData.settings, 1818 | stepSelector = settings.stepSelector, 1819 | current = eventData.current, 1820 | jmpress = $(this); 1821 | current.clickableStepsNamespace = ".jmpress-"+randomString(); 1822 | jmpress.bind("click"+current.clickableStepsNamespace, function(event) { 1823 | if (!settings.mouse.clickSelects || current.userZoom) { 1824 | return; 1825 | } 1826 | 1827 | // get clicked step 1828 | var clickedStep = $(event.target).closest(stepSelector); 1829 | 1830 | // clicks on the active step do default 1831 | if ( clickedStep.is( jmpress.jmpress("active") ) ) { 1832 | return; 1833 | } 1834 | 1835 | if (clickedStep.length) { 1836 | // select the clicked step 1837 | jmpress.jmpress("select", clickedStep[0], "click"); 1838 | event.preventDefault(); 1839 | event.stopPropagation(); 1840 | } 1841 | }); 1842 | }); 1843 | $jmpress('afterDeinit', function( nil, eventData ) { 1844 | $(this).unbind(eventData.current.clickableStepsNamespace); 1845 | }); 1846 | 1847 | }(jQuery, document, window)); 1848 | /*! 1849 | * mobile.js 1850 | * Adds support for swipe on touch supported browsers 1851 | */ 1852 | (function( $, document, window, undefined ) { 1853 | 1854 | 'use strict'; 1855 | var $jmpress = $.jmpress; 1856 | 1857 | /* FUNCTIONS */ 1858 | function randomString() { 1859 | return "" + Math.round(Math.random() * 100000, 0); 1860 | } 1861 | 1862 | /* HOOKS */ 1863 | $jmpress( 'afterInit', function( step, eventData ) { 1864 | var settings = eventData.settings, 1865 | current = eventData.current, 1866 | jmpress = eventData.jmpress; 1867 | current.mobileNamespace = ".jmpress-"+randomString(); 1868 | var data, start = [0,0]; 1869 | $(settings.fullscreen ? document : jmpress) 1870 | .bind("touchstart"+current.mobileNamespace, function( event ) { 1871 | 1872 | data = event.originalEvent.touches[0]; 1873 | start = [ data.pageX, data.pageY ]; 1874 | 1875 | }).bind("touchmove"+current.mobileNamespace, function( event ) { 1876 | data = event.originalEvent.touches[0]; 1877 | event.preventDefault(); 1878 | return false; 1879 | }).bind("touchend"+current.mobileNamespace, function( event ) { 1880 | var end = [ data.pageX, data.pageY ], 1881 | diff = [ end[0]-start[0], end[1]-start[1] ]; 1882 | 1883 | if(Math.max(Math.abs(diff[0]), Math.abs(diff[1])) > 50) { 1884 | diff = Math.abs(diff[0]) > Math.abs(diff[1]) ? diff[0] : diff[1]; 1885 | $(jmpress).jmpress(diff > 0 ? "prev" : "next"); 1886 | event.preventDefault(); 1887 | return false; 1888 | } 1889 | }); 1890 | }); 1891 | $jmpress('afterDeinit', function( nil, eventData ) { 1892 | var settings = eventData.settings, 1893 | current = eventData.current, 1894 | jmpress = eventData.jmpress; 1895 | $(settings.fullscreen ? document : jmpress).unbind(current.mobileNamespace); 1896 | }); 1897 | 1898 | }(jQuery, document, window)); 1899 | /*! 1900 | * templates.js 1901 | * The amazing template engine 1902 | */ 1903 | (function( $, document, window, undefined ) { 1904 | 1905 | 'use strict'; 1906 | var $jmpress = $.jmpress, 1907 | templateFromParentIdent = "_template_", 1908 | templateFromApplyIdent = "_applied_template_"; 1909 | 1910 | /* STATIC VARS */ 1911 | var templates = {}; 1912 | 1913 | /* FUNCTIONS */ 1914 | function randomString() { 1915 | return "" + Math.round(Math.random() * 100000, 0); 1916 | } 1917 | function addUndefined( target, values, prefix ) { 1918 | for( var name in values ) { 1919 | var targetName = name; 1920 | if ( prefix ) { 1921 | targetName = prefix + targetName.substr(0, 1).toUpperCase() + targetName.substr(1); 1922 | } 1923 | if ( $.isPlainObject(values[name]) ) { 1924 | addUndefined( target, values[name], targetName ); 1925 | } else if( target[targetName] === undefined ) { 1926 | target[targetName] = values[name]; 1927 | } 1928 | } 1929 | } 1930 | function applyChildrenTemplates( children, templateChildren ) { 1931 | if ($.isArray(templateChildren)) { 1932 | if (templateChildren.length < children.length) { 1933 | $.error("more nested steps than children in template"); 1934 | } else { 1935 | children.each(function(idx, child) { 1936 | child = $(child); 1937 | var tmpl = child.data(templateFromParentIdent) || {}; 1938 | addUndefined(tmpl, templateChildren[idx]); 1939 | child.data(templateFromParentIdent, tmpl); 1940 | }); 1941 | } 1942 | } else if($.isFunction(templateChildren)) { 1943 | children.each(function(idx, child) { 1944 | child = $(child); 1945 | var tmpl = child.data(templateFromParentIdent) || {}; 1946 | addUndefined(tmpl, templateChildren(idx, child, children)); 1947 | child.data(templateFromParentIdent, tmpl); 1948 | }); 1949 | } // TODO: else if(object) 1950 | } 1951 | function applyTemplate( data, element, template, eventData ) { 1952 | if (template.children) { 1953 | var children = element.children( eventData.settings.stepSelector ); 1954 | applyChildrenTemplates( children, template.children ); 1955 | } 1956 | applyTemplateData( data, template ); 1957 | } 1958 | function applyTemplateData( data, template ) { 1959 | addUndefined(data, template); 1960 | } 1961 | 1962 | /* HOOKS */ 1963 | $jmpress("beforeInitStep", function( step, eventData ) { 1964 | step = $(step); 1965 | var data = eventData.data, 1966 | templateFromAttr = data.template, 1967 | templateFromApply = step.data(templateFromApplyIdent), 1968 | templateFromParent = step.data(templateFromParentIdent); 1969 | if(templateFromAttr) { 1970 | $.each(templateFromAttr.split(" "), function(idx, tmpl) { 1971 | var template = templates[tmpl]; 1972 | applyTemplate( data, step, template, eventData ); 1973 | }); 1974 | } 1975 | if (templateFromApply) { 1976 | applyTemplate( data, step, templateFromApply, eventData ); 1977 | } 1978 | if (templateFromParent) { 1979 | applyTemplate( data, step, templateFromParent, eventData ); 1980 | step.data(templateFromParentIdent, null); 1981 | if(templateFromParent.template) { 1982 | $.each(templateFromParent.template.split(" "), function(idx, tmpl) { 1983 | var template = templates[tmpl]; 1984 | applyTemplate( data, step, template, eventData ); 1985 | }); 1986 | } 1987 | } 1988 | }); 1989 | $jmpress("beforeInit", function( nil, eventData ) { 1990 | var data = $jmpress("dataset", this), 1991 | dataTemplate = data.template, 1992 | stepSelector = eventData.settings.stepSelector; 1993 | if (dataTemplate) { 1994 | var template = templates[dataTemplate]; 1995 | applyChildrenTemplates( $(this).find(stepSelector).filter(function() { 1996 | return !$(this).parent().is(stepSelector); 1997 | }), template.children ); 1998 | } 1999 | }); 2000 | 2001 | /* EXPORTED FUNCTIONS */ 2002 | $jmpress("register", "template", function( name, tmpl ) { 2003 | if (templates[name]) { 2004 | templates[name] = $.extend(true, {}, templates[name], tmpl); 2005 | } else { 2006 | templates[name] = $.extend(true, {}, tmpl); 2007 | } 2008 | }); 2009 | $jmpress("register", "apply", function( selector, tmpl ) { 2010 | if( !tmpl ) { 2011 | // TODO ERROR because settings not found 2012 | var stepSelector = $(this).jmpress("settings").stepSelector; 2013 | applyChildrenTemplates( $(this).find(stepSelector).filter(function() { 2014 | return !$(this).parent().is(stepSelector); 2015 | }), selector ); 2016 | } else if($.isArray(tmpl)) { 2017 | applyChildrenTemplates( $(selector), tmpl ); 2018 | } else { 2019 | var template; 2020 | if(typeof tmpl === "string") { 2021 | template = templates[tmpl]; 2022 | } else { 2023 | template = $.extend(true, {}, tmpl); 2024 | } 2025 | $(selector).each(function(idx, element) { 2026 | element = $(element); 2027 | var tmpl = element.data(templateFromApplyIdent) || {}; 2028 | addUndefined(tmpl, template); 2029 | element.data(templateFromApplyIdent, tmpl); 2030 | }); 2031 | } 2032 | }); 2033 | 2034 | }(jQuery, document, window)); 2035 | /*! 2036 | * animation.js 2037 | * Apply custom animations to steps 2038 | */ 2039 | (function( $, document, window, undefined ) { 2040 | 2041 | 'use strict'; 2042 | 2043 | function randomString() { 2044 | return "" + Math.round(Math.random() * 100000, 0); 2045 | } 2046 | 2047 | function parseSubstepInfo(str) { 2048 | var arr = str.split(" "); 2049 | var className = arr[0]; 2050 | var config = { willClass: "will-"+className, doClass: "do-"+className, hasClass: "has-"+className }; 2051 | var state = ""; 2052 | for(var i = 1; i < arr.length; i++) { 2053 | var s = arr[i]; 2054 | switch(state) { 2055 | case "": 2056 | if(s === "after") { 2057 | state = "after"; 2058 | } else { 2059 | $.warn("unknown keyword in '"+str+"'. '"+s+"' unknown."); 2060 | } 2061 | break; 2062 | case "after": 2063 | if(s.match(/^[1-9][0-9]*m?s?/)) { 2064 | var value = parseFloat(s); 2065 | if(s.indexOf("ms") !== -1) { 2066 | value *= 1; 2067 | } else if(s.indexOf("s") !== -1) { 2068 | value *= 1000; 2069 | } else if(s.indexOf("m") !== -1) { 2070 | value *= 60000; 2071 | } 2072 | config.delay = value; 2073 | } else { 2074 | config.after = Array.prototype.slice.call(arr, i).join(" "); 2075 | } 2076 | } 2077 | } 2078 | return config; 2079 | } 2080 | function find(array, selector, start, end) { 2081 | end = end || (array.length - 1); 2082 | start = start || 0; 2083 | for(var i = start; i < end + 1; i++) { 2084 | if($(array[i].element).is(selector)) { 2085 | return i; 2086 | } 2087 | } 2088 | } 2089 | function addOn(list, substep, delay) { 2090 | $.each(substep._on, function(idx, child) { 2091 | list.push({substep: child.substep, delay: child.delay + delay}); 2092 | addOn(list, child.substep, child.delay + delay); 2093 | }); 2094 | } 2095 | $.jmpress("defaults").customAnimationDataAttribute = "jmpress"; 2096 | $.jmpress("afterInit", function( nil, eventData ) { 2097 | eventData.current.animationTimeouts = []; 2098 | eventData.current.animationCleanupWaiting = []; 2099 | }); 2100 | $.jmpress("applyStep", function( step, eventData ) { 2101 | // read custom animation from elements 2102 | var substepsData = {}; 2103 | var listOfSubsteps = []; 2104 | $(step).find("[data-"+eventData.settings.customAnimationDataAttribute+"]") 2105 | .each(function(idx, element) { 2106 | if($(element).closest(eventData.settings.stepSelector).is(step)) { 2107 | listOfSubsteps.push({element: element}); 2108 | } 2109 | }); 2110 | if(listOfSubsteps.length === 0) { 2111 | return; 2112 | } 2113 | $.each(listOfSubsteps, function(idx, substep) { 2114 | substep.info = parseSubstepInfo( 2115 | $(substep.element).data(eventData.settings.customAnimationDataAttribute)); 2116 | $(substep.element).addClass(substep.info.willClass); 2117 | substep._on = []; 2118 | substep._after = null; 2119 | }); 2120 | var current = {_after: undefined, _on: [], info: {}}; // virtual zero step 2121 | $.each(listOfSubsteps, function(idx, substep) { 2122 | var other = substep.info.after; 2123 | if(other) { 2124 | if(other === "step") { 2125 | other = current; 2126 | } else if(other === "prev") { 2127 | other = listOfSubsteps[idx-1]; 2128 | } else { 2129 | var index = find(listOfSubsteps, other, 0, idx - 1); 2130 | if(index === -1) { 2131 | index = find(listOfSubsteps, other); 2132 | } 2133 | other = (index === -1 || index === idx) ? listOfSubsteps[idx-1] : listOfSubsteps[index]; 2134 | } 2135 | } else { 2136 | other = listOfSubsteps[idx-1]; 2137 | } 2138 | if(other) { 2139 | if(!substep.info.delay) { 2140 | if(!other._after) { 2141 | other._after = substep; 2142 | return; 2143 | } 2144 | other = other._after; 2145 | } 2146 | other._on.push({substep: substep, delay: substep.info.delay || 0}); 2147 | } 2148 | }); 2149 | if(current._after === undefined && current._on.length === 0) { 2150 | var startStep = find(listOfSubsteps, eventData.stepData.startSubstep) || 0; 2151 | current._after = listOfSubsteps[startStep]; 2152 | } 2153 | var substepsInOrder = []; 2154 | function findNextFunc(idx, item) { 2155 | if(item.substep._after) { 2156 | current = item.substep._after; 2157 | return false; 2158 | } 2159 | } 2160 | do { 2161 | var substepList = [{substep: current, delay: 0}]; 2162 | addOn(substepList, current, 0); 2163 | substepsInOrder.push(substepList); 2164 | current = null; 2165 | $.each(substepList, findNextFunc); 2166 | } while(current); 2167 | substepsData.list = substepsInOrder; 2168 | $(step).data("substepsData", substepsData); 2169 | }); 2170 | $.jmpress("unapplyStep", function( step, eventData ) { 2171 | var substepsData = $(step).data("substepsData"); 2172 | if(substepsData) { 2173 | $.each(substepsData.list, function(idx, activeSubsteps) { 2174 | $.each(activeSubsteps, function(idx, substep) { 2175 | if(substep.substep.info.willClass) { 2176 | $(substep.substep.element).removeClass(substep.substep.info.willClass); 2177 | } 2178 | if(substep.substep.info.hasClass) { 2179 | $(substep.substep.element).removeClass(substep.substep.info.hasClass); 2180 | } 2181 | if(substep.substep.info.doClass) { 2182 | $(substep.substep.element).removeClass(substep.substep.info.doClass); 2183 | } 2184 | }); 2185 | }); 2186 | } 2187 | }); 2188 | $.jmpress("setActive", function(step, eventData) { 2189 | var substepsData = $(step).data("substepsData"); 2190 | if(!substepsData) { 2191 | return; 2192 | } 2193 | if(eventData.substep === undefined) { 2194 | eventData.substep = 2195 | (eventData.reason === "prev" ? 2196 | substepsData.list.length-1 : 2197 | 0 2198 | ); 2199 | } 2200 | var substep = eventData.substep; 2201 | $.each(eventData.current.animationTimeouts, function(idx, timeout) { 2202 | clearTimeout(timeout); 2203 | }); 2204 | eventData.current.animationTimeouts = []; 2205 | $.each(substepsData.list, function(idx, activeSubsteps) { 2206 | var applyHas = idx < substep; 2207 | var applyDo = idx <= substep; 2208 | $.each(activeSubsteps, function(idx, substep) { 2209 | if(substep.substep.info.hasClass) { 2210 | $(substep.substep.element)[(applyHas?"add":"remove")+"Class"](substep.substep.info.hasClass); 2211 | } 2212 | function applyIt() { 2213 | $(substep.substep.element).addClass(substep.substep.info.doClass); 2214 | } 2215 | if(applyDo && !applyHas && substep.delay && eventData.reason !== "prev") { 2216 | if(substep.substep.info.doClass) { 2217 | $(substep.substep.element).removeClass(substep.substep.info.doClass); 2218 | eventData.current.animationTimeouts.push(setTimeout(applyIt, substep.delay)); 2219 | } 2220 | } else { 2221 | if(substep.substep.info.doClass) { 2222 | $(substep.substep.element)[(applyDo?"add":"remove")+"Class"](substep.substep.info.doClass); 2223 | } 2224 | } 2225 | }); 2226 | }); 2227 | }); 2228 | $.jmpress("setInactive", function(step, eventData) { 2229 | if(eventData.nextStep === step) { 2230 | return; 2231 | } 2232 | function cleanupAnimation( substepsData ) { 2233 | $.each(substepsData.list, function(idx, activeSubsteps) { 2234 | $.each(activeSubsteps, function(idx, substep) { 2235 | if(substep.substep.info.hasClass) { 2236 | $(substep.substep.element).removeClass(substep.substep.info.hasClass); 2237 | } 2238 | if(substep.substep.info.doClass) { 2239 | $(substep.substep.element).removeClass(substep.substep.info.doClass); 2240 | } 2241 | }); 2242 | }); 2243 | } 2244 | $.each(eventData.current.animationCleanupWaiting, function(idx, item) { 2245 | cleanupAnimation(item); 2246 | }); 2247 | eventData.current.animationCleanupWaiting = []; 2248 | var substepsData = $(step).data("substepsData"); 2249 | if(substepsData) { 2250 | eventData.current.animationCleanupWaiting.push( substepsData ); 2251 | } 2252 | }); 2253 | $.jmpress("selectNext", function( step, eventData ) { 2254 | if(eventData.substep === undefined) { 2255 | return; 2256 | } 2257 | var substepsData = $(step).data("substepsData"); 2258 | if(!substepsData) { 2259 | return; 2260 | } 2261 | if(eventData.substep < substepsData.list.length-1) { 2262 | return {step: step, substep: eventData.substep+1}; 2263 | } 2264 | }); 2265 | $.jmpress("selectPrev", function( step, eventData ) { 2266 | if(eventData.substep === undefined) { 2267 | return; 2268 | } 2269 | var substepsData = $(step).data("substepsData"); 2270 | if(!substepsData) { 2271 | return; 2272 | } 2273 | if(eventData.substep > 0) { 2274 | return {step: step, substep: eventData.substep-1}; 2275 | } 2276 | }); 2277 | 2278 | }(jQuery, document, window)); --------------------------------------------------------------------------------