├── CHANGELOG.md ├── .travis.yml ├── .npmignore ├── bin └── pony ├── config.json ├── workspace ├── images │ ├── linen.black.png │ ├── slide.thumb.png │ ├── linen.black@2x.png │ └── 404.sleepingpony.png ├── themes │ └── Ribbon │ │ ├── fonts │ │ ├── PTMono.woff │ │ ├── PTSans.woff │ │ ├── PTSans.Bold.woff │ │ ├── PTSans.Italic.woff │ │ ├── PTSans.Bold.Italic.woff │ │ └── PTSans.Narrow.Bold.woff │ │ ├── images │ │ ├── linen.png │ │ ├── linen@2x.png │ │ ├── ribbon.svg │ │ ├── grid-16x10.svg │ │ └── grid-4x3.svg │ │ ├── pictures │ │ ├── tall.png │ │ ├── wide.png │ │ ├── exact.png │ │ └── square.png │ │ ├── Readme.md │ │ ├── License.md │ │ ├── index.html │ │ └── styles │ │ └── screen.css ├── index.html ├── css │ └── main.css └── js │ └── main.js ├── lib ├── locales │ ├── cn.json │ ├── de.json │ ├── en.json │ ├── es.json │ ├── fr.json │ ├── it.json │ ├── jp.json │ ├── nl.json │ └── sv.json ├── spinner.js └── main.js ├── LICENSE ├── gulpfile.js ├── .gitignore ├── package.json └── README.md /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | support 2 | test 3 | examples 4 | .gitignore 5 | src -------------------------------------------------------------------------------- /bin/pony: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | // --debug-brk 3 | 4 | require('../lib/main'); -------------------------------------------------------------------------------- /config.json: -------------------------------------------------------------------------------- 1 | { 2 | "locale":"en", 3 | "theme": "deckset", 4 | "port": "8085", 5 | "wsport": 8081 6 | } -------------------------------------------------------------------------------- /workspace/images/linen.black.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Magic-Deck/ponyshow/HEAD/workspace/images/linen.black.png -------------------------------------------------------------------------------- /workspace/images/slide.thumb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Magic-Deck/ponyshow/HEAD/workspace/images/slide.thumb.png -------------------------------------------------------------------------------- /workspace/images/linen.black@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Magic-Deck/ponyshow/HEAD/workspace/images/linen.black@2x.png -------------------------------------------------------------------------------- /workspace/images/404.sleepingpony.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Magic-Deck/ponyshow/HEAD/workspace/images/404.sleepingpony.png -------------------------------------------------------------------------------- /workspace/themes/Ribbon/fonts/PTMono.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Magic-Deck/ponyshow/HEAD/workspace/themes/Ribbon/fonts/PTMono.woff -------------------------------------------------------------------------------- /workspace/themes/Ribbon/fonts/PTSans.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Magic-Deck/ponyshow/HEAD/workspace/themes/Ribbon/fonts/PTSans.woff -------------------------------------------------------------------------------- /workspace/themes/Ribbon/images/linen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Magic-Deck/ponyshow/HEAD/workspace/themes/Ribbon/images/linen.png -------------------------------------------------------------------------------- /workspace/themes/Ribbon/pictures/tall.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Magic-Deck/ponyshow/HEAD/workspace/themes/Ribbon/pictures/tall.png -------------------------------------------------------------------------------- /workspace/themes/Ribbon/pictures/wide.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Magic-Deck/ponyshow/HEAD/workspace/themes/Ribbon/pictures/wide.png -------------------------------------------------------------------------------- /workspace/themes/Ribbon/images/linen@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Magic-Deck/ponyshow/HEAD/workspace/themes/Ribbon/images/linen@2x.png -------------------------------------------------------------------------------- /workspace/themes/Ribbon/pictures/exact.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Magic-Deck/ponyshow/HEAD/workspace/themes/Ribbon/pictures/exact.png -------------------------------------------------------------------------------- /workspace/themes/Ribbon/pictures/square.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Magic-Deck/ponyshow/HEAD/workspace/themes/Ribbon/pictures/square.png -------------------------------------------------------------------------------- /workspace/themes/Ribbon/fonts/PTSans.Bold.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Magic-Deck/ponyshow/HEAD/workspace/themes/Ribbon/fonts/PTSans.Bold.woff -------------------------------------------------------------------------------- /workspace/themes/Ribbon/fonts/PTSans.Italic.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Magic-Deck/ponyshow/HEAD/workspace/themes/Ribbon/fonts/PTSans.Italic.woff -------------------------------------------------------------------------------- /workspace/themes/Ribbon/images/ribbon.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /workspace/themes/Ribbon/fonts/PTSans.Bold.Italic.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Magic-Deck/ponyshow/HEAD/workspace/themes/Ribbon/fonts/PTSans.Bold.Italic.woff -------------------------------------------------------------------------------- /workspace/themes/Ribbon/fonts/PTSans.Narrow.Bold.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Magic-Deck/ponyshow/HEAD/workspace/themes/Ribbon/fonts/PTSans.Narrow.Bold.woff -------------------------------------------------------------------------------- /lib/locales/cn.json: -------------------------------------------------------------------------------- 1 | { 2 | "guid": "guid", 3 | "title": "title", 4 | "filename": "filename", 5 | "version": "version", 6 | "description": "description", 7 | "screenshots": "screenshots", 8 | "main": "main", 9 | "repository": "repository", 10 | "author": "author", 11 | "license": "license", 12 | "path": "path", 13 | "theme": "theme", 14 | "repoUrl": "repoUrl", 15 | "locale": "locale" 16 | } -------------------------------------------------------------------------------- /lib/locales/de.json: -------------------------------------------------------------------------------- 1 | { 2 | "guid": "guid", 3 | "title": "title", 4 | "filename": "filename", 5 | "version": "version", 6 | "description": "description", 7 | "screenshots": "screenshots", 8 | "main": "main", 9 | "repository": "repository", 10 | "author": "author", 11 | "license": "license", 12 | "path": "path", 13 | "theme": "theme", 14 | "repoUrl": "repoUrl", 15 | "locale": "locale" 16 | } -------------------------------------------------------------------------------- /lib/locales/en.json: -------------------------------------------------------------------------------- 1 | { 2 | "guid": "guid", 3 | "title": "title", 4 | "filename": "filename", 5 | "version": "version", 6 | "description": "description", 7 | "screenshots": "screenshots", 8 | "main": "main", 9 | "repository": "repository", 10 | "author": "author", 11 | "license": "license", 12 | "path": "path", 13 | "theme": "theme", 14 | "repoUrl": "repoUrl", 15 | "locale": "locale" 16 | } -------------------------------------------------------------------------------- /lib/locales/es.json: -------------------------------------------------------------------------------- 1 | { 2 | "guid": "guid", 3 | "title": "title", 4 | "filename": "filename", 5 | "version": "version", 6 | "description": "description", 7 | "screenshots": "screenshots", 8 | "main": "main", 9 | "repository": "repository", 10 | "author": "author", 11 | "license": "license", 12 | "path": "path", 13 | "theme": "theme", 14 | "repoUrl": "repoUrl", 15 | "locale": "locale" 16 | } -------------------------------------------------------------------------------- /lib/locales/fr.json: -------------------------------------------------------------------------------- 1 | { 2 | "guid": "guid", 3 | "title": "title", 4 | "filename": "filename", 5 | "version": "version", 6 | "description": "description", 7 | "screenshots": "screenshots", 8 | "main": "main", 9 | "repository": "repository", 10 | "author": "author", 11 | "license": "license", 12 | "path": "path", 13 | "theme": "theme", 14 | "repoUrl": "repoUrl", 15 | "locale": "locale" 16 | } -------------------------------------------------------------------------------- /lib/locales/it.json: -------------------------------------------------------------------------------- 1 | { 2 | "guid": "guid", 3 | "title": "title", 4 | "filename": "filename", 5 | "version": "version", 6 | "description": "description", 7 | "screenshots": "screenshots", 8 | "main": "main", 9 | "repository": "repository", 10 | "author": "author", 11 | "license": "license", 12 | "path": "path", 13 | "theme": "theme", 14 | "repoUrl": "repoUrl", 15 | "locale": "locale" 16 | } -------------------------------------------------------------------------------- /lib/locales/jp.json: -------------------------------------------------------------------------------- 1 | { 2 | "guid": "guid", 3 | "title": "title", 4 | "filename": "filename", 5 | "version": "version", 6 | "description": "description", 7 | "screenshots": "screenshots", 8 | "main": "main", 9 | "repository": "repository", 10 | "author": "author", 11 | "license": "license", 12 | "path": "path", 13 | "theme": "theme", 14 | "repoUrl": "repoUrl", 15 | "locale": "locale" 16 | } -------------------------------------------------------------------------------- /lib/locales/nl.json: -------------------------------------------------------------------------------- 1 | { 2 | "guid": "guid", 3 | "title": "title", 4 | "filename": "filename", 5 | "version": "version", 6 | "description": "description", 7 | "screenshots": "screenshots", 8 | "main": "main", 9 | "repository": "repository", 10 | "author": "author", 11 | "license": "license", 12 | "path": "path", 13 | "theme": "theme", 14 | "repoUrl": "repoUrl", 15 | "locale": "locale" 16 | } -------------------------------------------------------------------------------- /lib/locales/sv.json: -------------------------------------------------------------------------------- 1 | { 2 | "guid": "guid", 3 | "title": "title", 4 | "filename": "filename", 5 | "version": "version", 6 | "description": "description", 7 | "screenshots": "screenshots", 8 | "main": "main", 9 | "repository": "repository", 10 | "author": "author", 11 | "license": "license", 12 | "path": "path", 13 | "theme": "theme", 14 | "repoUrl": "repoUrl", 15 | "locale": "locale" 16 | } -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2015 Semantic Press, Inc. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. -------------------------------------------------------------------------------- /gulpfile.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Ponyshow JS / CSS client library 3 | * To compile, run gulp 4 | */ 5 | 6 | var gulp = require('gulp'), 7 | fs = require('fs'); 8 | 9 | /* 10 | 11 | Gulp plugins 12 | 13 | */ 14 | var jshint = require('gulp-jshint'), 15 | concat = require('gulp-concat'), 16 | uglify = require('gulp-uglify'), 17 | rename = require('gulp-rename'), 18 | minifyCss = require("gulp-minify-css"), 19 | sourcemaps = require('gulp-sourcemaps'), 20 | header = require("gulp-header"), 21 | inject = require('gulp-inject'), 22 | clean = require('gulp-clean'), 23 | pkgJson = require('./package.json'); 24 | 25 | 26 | /* 27 | 28 | Default tasks 29 | 30 | */ 31 | gulp.task('default', []); -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Private dot files 2 | ._* 3 | .DS_Store 4 | 5 | # Temp dir 6 | tmp/ 7 | 8 | # Logs 9 | logs 10 | *.log 11 | npm-debug.log 12 | 13 | # Runtime data 14 | pids 15 | *.pid 16 | *.seed 17 | 18 | # Directory for instrumented libs generated by jscoverage/JSCover 19 | lib-cov 20 | 21 | # Coverage directory used by tools like istanbul 22 | coverage 23 | 24 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 25 | .grunt 26 | 27 | # node-waf configuration 28 | .lock-wscript 29 | 30 | # Compiled binary addons (http://nodejs.org/api/addons.html) 31 | build/Release 32 | 33 | # Dependency directory 34 | # https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git 35 | node_modules 36 | -------------------------------------------------------------------------------- /workspace/themes/Ribbon/Readme.md: -------------------------------------------------------------------------------- 1 | # Ribbon theme for Shower 2 | 3 | Follow [@shower_me](https://twitter.com/shower_me) for support and updates 4 | 5 | To see Ribbon theme for Shower in action: 6 | 7 | - Open [shwr.me/shower/themes/ribbon](http://shwr.me/shower/themes/ribbon/) 8 | - Click any slide to enter presentation mode 9 | - Use arrow keys or presenter remote to navigate 10 | - Press `Esc` to exit presentation mode 11 | 12 | Part of [Shower presentation template](https://github.com/shower/shower/). See [Wiki](https://github.com/shower/shower/wiki) for more information how to use Shower. 13 | 14 | --- 15 | Licensed under [MIT License](http://en.wikipedia.org/wiki/MIT_License), see [license page](https://github.com/shower/shower/wiki/MIT-License) for details. -------------------------------------------------------------------------------- /workspace/themes/Ribbon/images/grid-16x10.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /workspace/themes/Ribbon/images/grid-4x3.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /workspace/index.html: -------------------------------------------------------------------------------- 1 | Pony Show IDE
2 |

Welcome

3 |

Just a quick Ponyshow test.

4 |
5 | 6 |
7 |
8 |

Test 123

9 |
10 |
11 | 12 |
13 |
14 |

Slide 2

15 |
16 |
17 | 18 |
19 |
20 |

a

Welcome to Ponyshow

21 |
22 |
23 | 24 |
25 |
26 |

Slide 5

27 |

absolute top:30px;

30 |
-------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ponyshow", 3 | "version": "0.1.1", 4 | "description": "An app for creating beautiful presentations using markdown.", 5 | "scripts": { 6 | "test": "echo \"Error: no test specified\" && exit 1" 7 | }, 8 | "repository": { 9 | "type": "git", 10 | "url": "git://github.com/ponyshow/ponyshow.git" 11 | }, 12 | "preferGlobal": true, 13 | "author": "TZ Martin (http://semanticpress.com)", 14 | "license": "Apache Public License v2", 15 | "bin": { 16 | "pony": "./bin/pony", 17 | "ponyshow": "./bin/pony" 18 | }, 19 | "main": "./lib/main", 20 | "directories": { 21 | "lib": "./lib" 22 | }, 23 | "engines": { 24 | "node": ">=0.10" 25 | }, 26 | "bundledDependencies": [ 27 | "ascii-banner" 28 | ], 29 | "dependencies": { 30 | "ascii-banner": "0.0.2", 31 | "browser-launcher2": "^0.4.5", 32 | "colors": "^1.1.2", 33 | "compression": "^1.5.1", 34 | "cpr": "^0.4.1", 35 | "express": "^4.13.1", 36 | "fields": "^0.1.24", 37 | "fsmonitor": "^0.2.4", 38 | "gift": "^0.6.0", 39 | "i18n": "^0.5.0", 40 | "lodash": "^3.10.0", 41 | "longjohn": "^0.2.4", 42 | "mkdirp": "^0.5.1", 43 | "nconf": "^0.7.1", 44 | "node-uuid": "^1.4.7", 45 | "nomnom": "^1.8.1", 46 | "pony-render": "*", 47 | "prettyjson": "^1.1.2", 48 | "readdirp": "^1.3.0", 49 | "replacestream": "^4.0.0", 50 | "request": "^2.58.0", 51 | "rimraf": "^2.4.1", 52 | "semver": "^4.3.6", 53 | "tar": "^2.1.1", 54 | "write": "^0.2.0", 55 | "ws": "^0.7.2" 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /workspace/css/main.css: -------------------------------------------------------------------------------- 1 | code[class*=language-],pre[class*=language-]{color:#000;text-shadow:0 1px #fff;font-family:Consolas,Monaco,'Andale Mono',monospace;direction:ltr;text-align:left;white-space:pre;word-spacing:normal;word-break:normal;line-height:1.5;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-hyphens:none;-moz-hyphens:none;-ms-hyphens:none;hyphens:none}code[class*=language-] ::-moz-selection,code[class*=language-]::-moz-selection,pre[class*=language-] ::-moz-selection,pre[class*=language-]::-moz-selection{text-shadow:none;background:#b3d4fc}code[class*=language-] ::selection,code[class*=language-]::selection,pre[class*=language-] ::selection,pre[class*=language-]::selection{text-shadow:none;background:#b3d4fc}@media print{code[class*=language-],pre[class*=language-]{text-shadow:none}}pre[class*=language-]{padding:1em;margin:.5em 0;overflow:auto}:not(pre)>code[class*=language-],pre[class*=language-]{background:0 0}:not(pre)>code[class*=language-]{padding:.1em;border-radius:.3em}.token.cdata,.token.comment,.token.doctype,.token.prolog{color:#bfbfbf}.token.punctuation{color:#999}.namespace{opacity:.7}.token.boolean,.token.constant,.token.deleted,.token.number,.token.property,.token.symbol,.token.tag{color:#905}.token.attr-name,.token.builtin,.token.char,.token.inserted,.token.selector,.token.string{color:#090}.language-css .token.string,.style .token.string,.token.entity,.token.operator,.token.url{color:#a67f59}.token.atrule,.token.attr-value,.token.function,.token.keyword{color:#00f}.token.important,.token.regex,.token.variable{color:#e90}.token.bold,.token.important{font-weight:700}.token.italic{font-style:italic}.token.entity{cursor:help} -------------------------------------------------------------------------------- /workspace/themes/Ribbon/License.md: -------------------------------------------------------------------------------- 1 | # The MIT License 2 | 3 | Copyright © 2010–2014 Vadim Makeev, http://pepelsbey.net/ 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 6 | 7 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 8 | 9 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 10 | 11 | --- 12 | 13 | # Лицензия MIT 14 | 15 | Copyright © 2010–2014 Вадим Макеев, http://pepelsbey.net/ 16 | 17 | Данная лицензия разрешает лицам, получившим копию данного программного обеспечения и сопутствующей документации (в дальнейшем именуемыми «Программное Обеспечение»), безвозмездно использовать Программное Обеспечение без ограничений, включая неограниченное право на использование, копирование, изменение, добавление, публикацию, распространение, сублицензирование и/или продажу копий Программного Обеспечения, также как и лицам, которым предоставляется данное Программное Обеспечение, при соблюдении следующих условий: 18 | 19 | Указанное выше уведомление об авторском праве и данные условия должны быть включены во все копии или значимые части данного Программного Обеспечения. 20 | 21 | ДАННОЕ ПРОГРАММНОЕ ОБЕСПЕЧЕНИЕ ПРЕДОСТАВЛЯЕТСЯ «КАК ЕСТЬ», БЕЗ КАКИХ-ЛИБО ГАРАНТИЙ, ЯВНО ВЫРАЖЕННЫХ ИЛИ ПОДРАЗУМЕВАЕМЫХ, ВКЛЮЧАЯ, НО НЕ ОГРАНИЧИВАЯСЬ ГАРАНТИЯМИ ТОВАРНОЙ ПРИГОДНОСТИ, СООТВЕТСТВИЯ ПО ЕГО КОНКРЕТНОМУ НАЗНАЧЕНИЮ И ОТСУТСТВИЯ НАРУШЕНИЙ ПРАВ. НИ В КАКОМ СЛУЧАЕ АВТОРЫ ИЛИ ПРАВООБЛАДАТЕЛИ НЕ НЕСУТ ОТВЕТСТВЕННОСТИ ПО ИСКАМ О ВОЗМЕЩЕНИИ УЩЕРБА, УБЫТКОВ ИЛИ ДРУГИХ ТРЕБОВАНИЙ ПО ДЕЙСТВУЮЩИМ КОНТРАКТАМ, ДЕЛИКТАМ ИЛИ ИНОМУ, ВОЗНИКШИМ ИЗ, ИМЕЮЩИМ ПРИЧИНОЙ ИЛИ СВЯЗАННЫМ С ПРОГРАММНЫМ ОБЕСПЕЧЕНИЕМ ИЛИ ИСПОЛЬЗОВАНИЕМ ПРОГРАММНОГО ОБЕСПЕЧЕНИЯ ИЛИ ИНЫМИ ДЕЙСТВИЯМИ С ПРОГРАММНЫМ ОБЕСПЕЧЕНИЕМ. -------------------------------------------------------------------------------- /lib/spinner.js: -------------------------------------------------------------------------------- 1 | var readline = require('readline'); 2 | 3 | var defaultSpinnerString = 0; 4 | var defaultSpinnerDelay = 60; 5 | 6 | var Spinner = function(textToShow){ 7 | this.text = textToShow || ''; 8 | this.setSpinnerString(defaultSpinnerString); 9 | this.setSpinnerDelay(defaultSpinnerDelay); 10 | }; 11 | 12 | Spinner.spinners = [ 13 | '|/-\\', 14 | '⠂-–—–-', 15 | '◐◓◑◒', 16 | '←↖↑↗→↘↓↙', 17 | '┤┘┴└├┌┬┐', 18 | '◢◣◤◥', 19 | '.oO°Oo.', 20 | '.oO@*', 21 | '☱☲☴', 22 | '⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏', 23 | '⠋⠙⠚⠞⠖⠦⠴⠲⠳⠓', 24 | '⠄⠆⠇⠋⠙⠸⠰⠠⠰⠸⠙⠋⠇⠆', 25 | '⠋⠙⠚⠒⠂⠂⠒⠲⠴⠦⠖⠒⠐⠐⠒⠓⠋', 26 | '⠁⠉⠙⠚⠒⠂⠂⠒⠲⠴⠤⠄⠄⠤⠴⠲⠒⠂⠂⠒⠚⠙⠉⠁', 27 | '⠈⠉⠋⠓⠒⠐⠐⠒⠖⠦⠤⠠⠠⠤⠦⠖⠒⠐⠐⠒⠓⠋⠉⠈', 28 | '⠁⠁⠉⠙⠚⠒⠂⠂⠒⠲⠴⠤⠄⠄⠤⠠⠠⠤⠦⠖⠒⠐⠐⠒⠓⠋⠉⠈⠈', 29 | '⢄⢂⢁⡁⡈⡐⡠', 30 | '⢹⢺⢼⣸⣇⡧⡗⡏', 31 | '⣾⣽⣻⢿⡿⣟⣯⣷', 32 | '⠁⠂⠄⡀⢀⠠⠐⠈' 33 | ]; 34 | 35 | 36 | Spinner.setDefaultSpinnerString = function(value) { 37 | defaultSpinnerString = value; 38 | }; 39 | 40 | Spinner.setDefaultSpinnerDelay = function(value) { 41 | defaultSpinnerDelay = value; 42 | }; 43 | 44 | Spinner.prototype.start = function() { 45 | var current = 0; 46 | var self = this; 47 | var hasPos = self.text.indexOf('%s') > -1; 48 | this.id = setInterval(function() { 49 | var msg = hasPos ? self.text.replace('%s', self.chars[current]) : self.chars[current] + ' ' + self.text; 50 | clearLine(); 51 | process.stdout.write(msg); 52 | current = ++current % self.chars.length; 53 | }, this.delay); 54 | }; 55 | 56 | Spinner.prototype.setSpinnerDelay = function(n) { 57 | this.delay = n; 58 | }; 59 | 60 | Spinner.prototype.setText = function(str) { 61 | this.text = str; 62 | } 63 | 64 | Spinner.prototype.setSpinnerString = function(str) { 65 | this.chars = mapToSpinner(str, this.spinners).split(''); 66 | }; 67 | 68 | Spinner.prototype.stop = function(clear) { 69 | clearInterval(this.id); 70 | if (clear) { 71 | clearLine(); 72 | } 73 | }; 74 | 75 | // Helpers 76 | 77 | function isInt(value) { 78 | return (typeof value==='number' && (value%1)===0); 79 | } 80 | 81 | function mapToSpinner(value, spinners) { 82 | // Not an integer, return as strng 83 | if (!isInt(value)) { 84 | return value + ''; 85 | } 86 | 87 | // Check if index is within bounds 88 | value = (value >= Spinner.spinners.length) ? 0 : value; 89 | // If negative, count from the end 90 | value = (value < 0) ? Spinner.spinners.length + value : value; 91 | 92 | return Spinner.spinners[value]; 93 | } 94 | 95 | function clearLine() { 96 | readline.clearLine(process.stdout, 0); 97 | readline.cursorTo(process.stdout, 0); 98 | } 99 | 100 | exports.Spinner = Spinner; -------------------------------------------------------------------------------- /workspace/themes/Ribbon/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Ribbon theme for Shower 5 | 6 | 7 | 8 | 9 | 10 | 11 | 15 |
16 |

Presentation Title

17 |

Yours Truly, Famous Inc.

18 |
19 |
20 |

Header

21 |

Typewriter etsy messenger bag fingerstache, aesthetic vinyl semiotics twee DIY forage chillwave. Thundercats ennui messenger bag, squid carles chillwave shoreditch pickled cliche letterpress. DIY beard locavore occupy salvia, whatever single-origin <coffee> fanny pack 3 wolf moon typewriter gastropub1 kale H20 chips. Ennui keffiyeh thundercats jean shorts biodiesel. Terry richardson, swag blog locavore umami vegan helvetica. Fingerstache kale chips.

22 |
23 |

Typewriter etsy messenger bag fingerstache, aesthetic vinyl semiotics twee DIY forage chillwave. Thundercats ennui messenger bag, squid carles chillwave shoreditch pickled cliche letterpress. DIY beard locavore occupy salvia, whatever single-origin <coffee> fanny pack 3 wolf moon typewriter gastropub1 kale H20 chips. Ennui keffiyeh thundercats jean shorts biodiesel. Terry richardson, swag blog locavore umami vegan helvetica. Fingerstache kale chips.

24 |
25 |
26 |
27 |

Header

28 |

Thundercats ennui messenger bag, squid carles chillwave shoreditch pickled cliche letterpress. DIY beard locavore occupy salvia, whatever single-origin coffee fanny pack 3 wolf moon typewriter gastropub kale chips. Ennui keffiyeh thundercats jean shorts biodiesel. Terry richardson, swag blog locavore umami vegan helvetica. Fingerstache kale chips.

29 |

Typewriter etsy messenger bag fingerstache.

30 |
31 |

Typewriter etsy messenger bag fingerstache, aesthetic vinyl semiotics twee DIY forage chillwave. Thundercats ennui messenger bag, squid carles chillwave shoreditch pickled cliche letterpress.

32 |

DIY beard locavore occupy salvia, whatever single-origin coffee fanny pack 3 wolf moon typewriter gastropub kale chips. Ennui keffiyeh thundercats jean shorts biodiesel.

33 |
34 |
35 |
36 |

Lists in English typography

37 |
    38 |
  • Ennui keffiyeh thundercats
  • 39 |
  • Jean shorts biodiesel
  • 40 |
  • Terry richardson, swag blog 41 |
      42 |
    1. Locavore umami vegan helvetica
    2. 43 |
    3. Fingerstache kale chips
    4. 44 |
    5. Keytar sriracha gluten-free
    6. 45 |
    46 |
  • 47 |
  • Before they sold out master
  • 48 |
49 |
50 |
51 |

Lists in Russian typography

52 |
    53 |
  • Ennui keffiyeh thundercats
  • 54 |
  • Jean shorts biodiesel
  • 55 |
  • Terry richardson, swag blog 56 |
      57 |
    1. Locavore umami vegan helvetica
    2. 58 |
    3. Fingerstache kale chips
    4. 59 |
    5. Keytar sriracha gluten-free
    6. 60 |
    61 |
  • 62 |
  • Before they sold out master
  • 63 |
64 |
65 |
66 |

Lists in English typography

67 |
    68 |
  1. Locavore umami vegan helvetica
  2. 69 |
  3. Fingerstache kale chips
  4. 70 |
  5. Keytar sriracha gluten-free
  6. 71 |
72 |
    73 |
  • Ennui keffiyeh thundercats
  • 74 |
  • Jean shorts biodiesel
  • 75 |
  • Terry richardson, swag blog
  • 76 |
77 |
78 |
79 |

Quote

80 |
81 |
82 |

Typewriter etsy messenger bag fingerstache, aesthetic vinyl semiotics twee DIY forage chillwave. Thundercats ennui messenger bag, squid carles chillwave shoreditch pickled cliche letterpress.

83 |
84 |
Author Name
85 |
86 |

DIY beard locavore occupy salvia, whatever single-origin coffee fanny pack 3 wolf moon typewriter gastropub kale chips.

87 |
88 |
89 |

Table

90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 |
LocavoreUmamiHelveticaVegan
FingerstacheKaleChipsKeytar
SrirachaGluten-freeEnnuiKeffiyeh
ThundercatsJeanShortsBiodiesel
TerryRichardsonSwagBlog
122 |

Typewriter etsy messenger bag fingerstache.

123 |
124 |
125 |

Numbered code listing

126 |
127 | 			<html lang="en">
128 | 			<head> <!--Comment-->
129 | 				<title>Shower</title>
130 | 				<meta charset="UTF-8">
131 | 				<link rel="stylesheet" href="s/screen.css">
132 | 				<script src="j/jquery.js"></script>
133 | 			</head>
134 | 		
135 |
136 |
137 |

Plain code listing

138 |
<html lang="en">
139 | <head> <!--Comment-->
140 | 	<title>Shower</title>
141 | 	<meta charset="UTF-8">
142 | 	<link rel="stylesheet" href="s/screen.css">
143 | 	<script src="j/jquery.js"></script>
144 | </head>
145 |
146 |
147 |

148 | You Can
149 | Shout This Way 150 |

151 |
152 |

Typewriter etsy messenger bag fingerstache.

153 |
154 |
155 |
156 |

Linked Shout

157 |
158 |
159 |

Growing Shout

160 |
161 |
162 |

Shrinking Shout

163 |
164 |
165 | 166 |
167 |
168 | 169 |
170 |
171 | 172 |
173 |

Typewriter etsy messenger bag fingerstache.

174 |
175 |
176 |
177 | 178 |
179 |
180 | 181 |
182 |
183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 |
193 |
194 |

Timer

195 |

Three seconds to go.

196 |
197 |
198 |

List navigation

199 |
    200 |
  1. Ennui keffiyeh thundercats
  2. 201 | 202 | 203 | 204 | 205 |
206 |

Before they sold out master

207 |
208 |

Fork me on Github

209 | 213 |
214 | 215 | 216 | 217 | 218 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Ponyshow - Create great-looking slides from simple Markdown files 2 | 3 | ![Screenshot](https://monosnap.com/file/ALl3i8lgPtuH1UQz1sgZesR1F7pSFa.png) 4 | 5 | > Note: This project is in active development and will change (or break). Consider it alpha / beta. 6 | 7 | Ponyshow is an app for turning your markdown files into beautiful presentations. It's a simpler, faster way to create, view and share high quality presentations. 8 | 9 | Write down your thoughts in your favorite markdown / text editor, and Ponyshow will convert them into beautiful presentations on the fly. Make a change.. it's instantly visible. 10 | 11 | Features include: 12 | 13 | - "Live" view rendering 14 | - Custom themes 15 | - Localization 16 | - Code snippet support with syntax highlighting 17 | - Image positioning and styling 18 | - Background images 19 | - Dynamic text styling 20 | - Websockets 21 | - Slide configuration options 22 | - Slide timer for auto transitioning 23 | - Build steps to present bullet points one step at at time 24 | 25 | Roadmap: 26 | 27 | - Auto layouts 28 | - Video player support 29 | - Real-time collaborative editing 30 | - Interactive components: polls, exams, etc 31 | - Export to PDF 32 | 33 | ## "Ponyshow is a Deckset killer". 34 | 35 | If you've used [Deckset](http://www.decksetapp.com/), you are going to love Ponyshow.. especially if you have been wanting custom themes and more control over the final rendering. Ponyshow gives you FULL control over content, rendering and delivery. 36 | 37 | There's many more possibilities with Ponyshow. Run, pony run! 38 | 39 | ## Install 40 | 41 | Requires node.js. 42 | 43 | [![Get it on npm](https://nodei.co/npm/ponyshow.png)](https://nodei.co/npm/ponyshow/) 44 | 45 | Install globally and use the ```pony``` command. 46 | 47 | > You may need to update pony periodically, as the underlying rendering engine is in active development. 48 | 49 | ``` 50 | $ npm install ponyshow -g 51 | 52 | $ pony 53 | 54 | // if needed.. 55 | $ npm update 56 | ``` 57 | 58 | ## Usage 59 | 60 | Example commands 61 | 62 | ``` 63 | $ pony run [path] // renders a single presentation or displays a list to choose from 64 | $ pony run --locale en // set localization to English 65 | $ pony new slide // create a new deck 66 | $ pony config // display global configs 67 | $ pony config set foo=bar // set a global 68 | $ pony install theme // view available themes from the Ponyshow Registry 69 | $ pony install theme http://.. // install a specific theme 70 | ``` 71 | 72 | ## Ponyshow Decks 73 | 74 | A Ponyshow deck is a compressed folder consisting of: 75 | 76 | ``` 77 | deck-directory/ 78 | |-- package.json // deck configuration 79 | |-- deck.md // master slide deck 80 | |-- assets/ // relative dependencies, images, media, etc 81 | `-- locales/ // localization files that contain ISO 3166-1 country codes (2 alpha) 82 | ``` 83 | 84 | ### Deck Configuration 85 | 86 | You can enable capabilities and configuration for a markdown file. These properties must be defined before any section `---` declaration. 87 | 88 | - `theme `: Set the theme name for custom rendering purposes 89 | - `slidenumbers `: Hide/show slide numbers. Custom themes can override this. Options: `true`|`false` 90 | - `timing `: Set any value to automatically advance to the next slide after given time. 91 | - `footer `: Set a string visible on each slide footer. Custom themes can override this. 92 | - `error `: Set a fail html string that will be displayed as the `innerText` value of the `rendererror` element. 93 | - `tableclass `: Set the class name for a table. Example: `striped` 94 | - `format `: Set either `widescreen` (1920 x 1080) or `standard` (1024 x 768). Default is `standard`. It's possible to set a custom format by setting a custom property that specific themes will respond to. The sets a class name to each slide `
`. 95 | - `progress `: Show / hide the progress bar. Options: `true`|`false` 96 | - 'build-list': Allows you to step through list bullets one by one to keep your audience focused on what you’re currently talking about. 97 | 98 | > If you want additional properties please open a ticket. Ideas are welcomed! Or, (better yet) fork and send a pull request. 99 | 100 | ### Creating Slides 101 | 102 | A new slide is defined by three dashes `---`, typed on a single line, with an empty line above and below. 103 | 104 | Slides are rendered as `
` HTML nodes. 105 | 106 | You can set a `class` or `id` property as part of the triple dash. Classes do NOT have a dot notation and are included by default. IDs require a hash symbol. 107 | 108 | > Note: It's preferred to use classes for styling since you can have multiple classes defined. IDs must be unique and are to URL navigation schemes. Only use IDs if you are sure it will be uniquely referenced. 109 | 110 | **Examples** 111 | 112 | ``` 113 | 114 | ---cover 115 | 116 | ---section 117 | 118 | ---#notes 119 | 120 | ``` 121 | 122 | This will produce three slides. 123 | 124 | ## Writing Content 125 | 126 | You write content using standard [markdown](http://daringfireball.net/projects/markdown/syntax), Kramdown and Ponyshow-flavor markdown. Ponyshow introduces additional syntax tokens that make authoring slides easy. To get started you can create a new deck to see a rendered output. 127 | 128 | Refer to the [`pony-render`](https://github.com/Ponyshow/pony-render) project for the latest rendering engine updates. 129 | 130 | Here's an example deck: 131 | 132 | ``` 133 | theme:appcelerator-training 134 | progress:true 135 | timing:8 136 | 137 | #Welcome 138 | 139 | just a test 140 | 141 | ---cover 142 | 143 | # Test Slide 144 | 145 | --- 146 | 147 | # Slide 2 148 | 149 | ---section 150 | 151 | # Welcome to Ponyshow 152 | 153 | --- 154 | 155 | # Slide 4 156 | 157 | ![](http://placehold.it/600x100) 158 | 159 | - This is a list 160 | - So is this 161 | ``` 162 | 163 | Here's a rendered deck preview: 164 | 165 | ![](https://monosnap.com/file/FwGI97CZIR8TCPThKqHpstsxpSQxEQ.png) 166 | 167 | ### Editing 168 | 169 | The entry point for rendering is ```deck.md```, a markdown file that comprises individual slides. This file is considered your **master** file and will be converted into HTML. You will want to edit this file in your preferred text editor. 170 | 171 | You can write vanilla markdown along with Ponyshow syntax to render beautiful presentations. All other markdown files will be ignored. In future releases, there will be support for adding rendering multiple files into one deck. 172 | 173 | **Live View** 174 | 175 | During editing, changes will immediately reflect in the browser viewer enabling you to see "live" changes. 176 | 177 | Note: if the browser doesn't update, simply manually refresh. 178 | 179 | ### Localization Files 180 | 181 | Ponyshow supports rendering localized versions of a master deck. You can set localization for the master deck in the ```package.json``` file, or at run time using the following command: 182 | 183 | ``` 184 | $ pony run --locale es 185 | ``` 186 | 187 | If a localization file doesn't exist, you will be prompted to create one. This will simply copy the master and create a new file with the naming convention of ```locales/[country-code].md```. The renderer will explicitly look for 2-alpha country code files. 188 | 189 | Ponyshow also supports i18n for configuration files (coming soon). 190 | 191 | 192 | # Pony what? 193 | 194 | Ever heard of the expression, "[dog and pony show](https://en.wikipedia.org/wiki/Dog_and_pony_show)"? An ode to Shakespeare, *The Show Of Mr. Dogg And Mr. Poneigh* "bringest the butts to the seats." That is to say, it's the best damn show on earth. This is the spirit of Ponyshow, a command-line tool that converts markdown into HTML. 195 | 196 | The best dog and pony shows incorporate bad jokes and over the top excitement in presenting information. Hence the terrible terrible name for such a cool tool. 197 | 198 | In reality, Ponyshow reduced cognitive load by using markdown to organize content and web development for rendering slides. Because it's web-enabled, you have greater flexibility with customizing the final output without the hassle of managing master files, versions, assets, proprietary formats, etc. Plus the rendering engine is on par with Keynote, Google Slides and Powerpoint. 199 | 200 | Point blank: It's the best damn show on earth... especially if you're a developer needing to write presentations. 201 | 202 | 203 | ## Contribution and License Agreement 204 | 205 | If you contribute code to this project, you are implicitly allowing your code 206 | to be distributed under the Apache 2 license. You are also implicitly verifying that 207 | all code is your original work. `` 208 | 209 | ## Author 210 | 211 | TZ Martin 212 | 213 | ## License 214 | 215 | Copyright (c) 2015, Semantic Press (Apache 2 Licensed) 216 | 217 | Ponyshow is made possible by the [Shower](https://github.com/shower/shower) open source project and other [open source software](https://github.com/Ponyshow/ponyshow/wiki/Credits). 218 | 219 | See LICENSE for more info. 220 | 221 | website statistics -------------------------------------------------------------------------------- /workspace/themes/Ribbon/styles/screen.css: -------------------------------------------------------------------------------- 1 | /** 2 | * Ribbon theme for Shower HTML presentation engine 3 | * shower-ribbon v1.0.10, https://github.com/shower/ribbon 4 | * Copyright © 2010–2014 Vadim Makeev, http://pepelsbey.net 5 | * Licensed under MIT license: github.com/shower/shower/wiki/MIT-License 6 | */ 7 | @font-face{font-family:'PT Sans';src:url(../fonts/PTSans.woff) format('woff')}@font-face{font-weight:700;font-family:'PT Sans';src:url(../fonts/PTSans.Bold.woff) format('woff')}@font-face{font-style:italic;font-family:'PT Sans';src:url(../fonts/PTSans.Italic.woff) format('woff')}@font-face{font-style:italic;font-weight:700;font-family:'PT Sans';src:url(../fonts/PTSans.Bold.Italic.woff) format('woff')}@font-face{font-family:'PT Sans Narrow';font-weight:700;src:url(../fonts/PTSans.Narrow.Bold.woff) format('woff')}@font-face{font-family:'PT Mono';src:url(../fonts/PTMono.woff) format('woff')}html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt,var,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td,article,aside,canvas,details,embed,figure,figcaption,footer,header,hgroup,menu,nav,output,ruby,section,summary,time,mark,audio,video{margin:0;padding:0;border:0;font-size:100%;font:inherit;vertical-align:baseline}article,aside,details,figcaption,figure,footer,header,hgroup,menu,nav,section{display:block}body{line-height:1}ol,ul{list-style:none}blockquote,q{quotes:none}blockquote:before,blockquote:after,q:before,q:after{content:'';content:none}table{border-collapse:collapse;border-spacing:0}body{counter-reset:slide;font:25px/2 'PT Sans',sans-serif}@media print{body{text-rendering:geometricPrecision}}a{color:#4B86C2;background:-webkit-linear-gradient(bottom,currentColor,currentColor .09em,transparent .09em,transparent)repeat-x;background:linear-gradient(to top,currentColor,currentColor .09em,transparent .09em,transparent)repeat-x;text-decoration:none}.caption{display:none;margin:0 0 50px;color:#3C3D40;text-shadow:0 1px 1px #8D8E90}.caption h1{font:700 50px/1 'PT Sans Narrow',sans-serif}.caption a{text-shadow:0 -1px 1px #1F3F60;background:0 0}.caption a:hover{color:#5e93c8}.badge{position:absolute;top:0;right:0;display:none;overflow:hidden;visibility:hidden;width:11em;height:11em;line-height:2.5;font-size:15px}.badge a{position:absolute;bottom:50%;right:-50%;left:-50%;visibility:visible;background:#4B86C2;box-shadow:0 0 1em rgba(0,0,0,.3);color:#FFF;text-decoration:none;text-align:center;-webkit-transform-origin:50% 100%;-ms-transform-origin:50% 100%;transform-origin:50% 100%;-webkit-transform:rotate(45deg)translateY(-1em);-ms-transform:rotate(45deg)translateY(-1em);transform:rotate(45deg)translateY(-1em)}.badge a:hover{background:#568ec6}.live-region{display:none}.slide{position:relative;width:1024px;height:640px;background:#FFF;color:#000;-webkit-print-color-adjust:exact;-webkit-text-size-adjust:none;-moz-text-size-adjust:none;-ms-text-size-adjust:none}@media print{.slide{page-break-before:always}}.slide:after{position:absolute;top:0;right:119px;padding:20px 0 0;width:50px;height:80px;background:url(../images/ribbon.svg) no-repeat;color:#FFF;counter-increment:slide;content:counter(slide);text-align:center;font-size:20px}.slide>div{position:absolute;top:0;left:0;overflow:hidden;padding:105px 120px 0;width:784px;height:535px}.slide h2{margin:0 0 37px;color:#666;font:700 50px/1 'PT Sans Narrow',sans-serif}.slide p{margin:0 0 50px}.slide p.note{color:#999}.slide b,.slide strong{font-weight:700}.slide i,.slide em{font-style:italic}.slide code,.slide kbd,.slide mark,.slide samp{padding:3px 8px;border-radius:8px;color:#000}.slide kbd,.slide code,.slide samp{background:rgba(0,0,0,.07);color:#000;line-height:1;font-family:'PT Mono',monospace}.slide mark{background:#FAFAA2}.slide sub,.slide sup{position:relative;line-height:0;font-size:75%}.slide sub{bottom:-.25em}.slide sup{top:-.5em}.slide blockquote{font-style:italic}.slide blockquote:before{position:absolute;margin:-16px 0 0 -80px;color:#CCC;font:200px/1 'PT Sans',sans-serif;content:'\201C'}.slide blockquote+figcaption{margin:-50px 0 50px;font-style:italic;font-weight:700}.slide ol,.slide ul{margin:0 0 50px;counter-reset:list}.slide ol li,.slide ul li{text-indent:-2em}.slide ol li:before,.slide ul li:before{display:inline-block;width:2em;color:#BBB;text-align:right}.slide ol ol,.slide ol ul,.slide ul ol,.slide ul ul{margin:0 0 0 2em}.slide ul>li:before{content:'\2022\00A0\00A0'}.slide ul>li:lang(ru):before{content:'\2014\00A0\00A0'}.slide ol>li:before{counter-increment:list;content:counter(list)'.\00A0'}.slide pre{margin:0 0 49px;padding:1px 0 0;counter-reset:code;white-space:normal;-moz-tab-size:4;-o-tab-size:4;tab-size:4}.slide pre code{display:block;padding:0;background:0 0;white-space:pre;line-height:2}.slide pre code:before{position:absolute;margin-left:-50px;color:#BBB;counter-increment:code;content:counter(code,decimal-leading-zero)'.'}.slide pre code:only-child:before{content:''}.slide pre mark.important{background:#C00;color:#FFF}.slide pre mark.comment{padding:0;background:0 0;color:#999}.slide table{margin:0 0 50px;width:100%;border-collapse:collapse;border-spacing:0}.slide table th,.slide table td{background:-webkit-linear-gradient(bottom,#BBB,#BBB .055em,transparent .055em,transparent)repeat-x;background:linear-gradient(to top,#BBB,#BBB .055em,transparent .055em,transparent)repeat-x}.slide table th{text-align:left;font-weight:700}.slide table.striped tr:nth-child(even){background:#EEE}.slide.cover,.slide.shout{z-index:1}.slide.cover:after,.slide.shout:after{visibility:hidden}.slide.cover{background:#000}.slide.cover img,.slide.cover svg,.slide.cover video,.slide.cover object,.slide.cover canvas,.slide.cover iframe{position:absolute;top:0;left:0;z-index:-1}.slide.cover.w img,.slide.cover.w svg,.slide.cover.w video,.slide.cover.w object,.slide.cover.w canvas,.slide.cover.w iframe{top:50%;width:100%;-webkit-transform:translateY(-50%);-ms-transform:translateY(-50%);transform:translateY(-50%)}.slide.cover.h img,.slide.cover.h svg,.slide.cover.h video,.slide.cover.h object,.slide.cover.h canvas,.slide.cover.h iframe{left:50%;height:100%;-webkit-transform:translateX(-50%);-ms-transform:translateX(-50%);transform:translateX(-50%)}.slide.cover.w.h img,.slide.cover.w.h svg,.slide.cover.w.h video,.slide.cover.w.h object,.slide.cover.w.h canvas,.slide.cover.w.h iframe{top:0;left:0;-webkit-transform:none;-ms-transform:none;transform:none}.slide.shout h2{position:absolute;top:50%;left:0;width:100%;text-align:center;line-height:1;font-size:150px;-webkit-transform:translateY(-50%);-ms-transform:translateY(-50%);transform:translateY(-50%)}.slide.shout h2 a{background:-webkit-linear-gradient(bottom,currentColor,currentColor .11em,transparent .11em,transparent)repeat-x;background:linear-gradient(to top,currentColor,currentColor .11em,transparent .11em,transparent)repeat-x}.slide .place{position:absolute;top:50%;left:50%;-webkit-transform:translate(-50%,-50%);-ms-transform:translate(-50%,-50%);transform:translate(-50%,-50%)}.slide .place.t.l,.slide .place.t.r,.slide .place.b.r,.slide .place.b.l{-webkit-transform:none;-ms-transform:none;transform:none}.slide .place.t,.slide .place.b{-webkit-transform:translate(-50%,0);-ms-transform:translate(-50%,0);transform:translate(-50%,0)}.slide .place.l,.slide .place.r{-webkit-transform:translate(0,-50%);-ms-transform:translate(0,-50%);transform:translate(0,-50%)}.slide .place.t,.slide .place.t.l,.slide .place.t.r{top:0}.slide .place.r{right:0;left:auto}.slide .place.b,.slide .place.b.r,.slide .place.b.l{top:auto;bottom:0}.slide .place.l{left:0}.slide footer{position:absolute;left:0;right:0;bottom:-640px;z-index:1;display:none;padding:20px 120px 4px;background:#FAFAA2;box-shadow:0 0 0 2px #f0efac inset;-webkit-transition:bottom .3s;transition:bottom .3s}.slide footer p{margin:0 0 16px}.slide footer mark{background:rgba(255,255,255,.7)}.slide:hover footer{bottom:0}@media screen{.list{position:absolute;clip:rect(0,auto,auto,0);padding:80px 0 40px 100px;background:#585A5E url(../images/linen.png)}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){.list{background-image:url(../images/linen@2x.png);background-size:256px}}.list .caption,.list .badge{display:block}.list .slide{float:left;margin:0 -412px -220px 0;-webkit-transform-origin:0 0;-ms-transform-origin:0 0;transform-origin:0 0;-webkit-transform:scale(.5);-ms-transform:scale(.5);transform:scale(.5)}@media (max-width:1324px){.list .slide{margin:0 -688px -400px 0;-webkit-transform:scale(.25);-ms-transform:scale(.25);transform:scale(.25)}}.list .slide:before{position:absolute;top:0;left:0;z-index:-1;width:512px;height:320px;box-shadow:0 0 30px rgba(0,0,0,.005),0 20px 50px rgba(42,43,45,.6);border-radius:2px;content:'';-webkit-transform-origin:0 0;-ms-transform-origin:0 0;transform-origin:0 0;-webkit-transform:scale(2);-ms-transform:scale(2);transform:scale(2)}@media (max-width:1324px){.list .slide:before{width:256px;height:160px;-webkit-transform:scale(4);-ms-transform:scale(4);transform:scale(4)}}.list .slide:after{top:auto;right:auto;bottom:-80px;left:120px;padding:0;width:auto;height:auto;background:0 0;color:#3C3D40;text-shadow:0 1px 1px #8D8E90;font-weight:700;-webkit-transform-origin:0 0;-ms-transform-origin:0 0;transform-origin:0 0;-webkit-transform:scale(2);-ms-transform:scale(2);transform:scale(2)}@media (max-width:1324px){.list .slide:after{bottom:-104px;-webkit-transform:scale(4);-ms-transform:scale(4);transform:scale(4)}}.list .slide:hover:before{box-shadow:0 0 0 10px rgba(42,43,45,.3),0 20px 50px rgba(42,43,45,.6)}.list .slide:target:before{box-shadow:0 0 0 1px #376da3,0 0 0 10px #4B86C2,0 20px 50px rgba(42,43,45,.6)}@media (max-width:1324px){.list .slide:target:before{box-shadow:0 0 0 1px #376da3,0 0 0 10px #4B86C2,0 20px 50px rgba(42,43,45,.6)}}.list .slide:target:after{text-shadow:0 1px 1px rgba(42,43,45,.6);color:#4B86C2}.list .slide>div:before{position:absolute;top:0;right:0;bottom:0;left:0;z-index:2;content:''}.list .slide.cover:after,.list .slide.shout:after{visibility:visible}.list .slide footer{display:block}.full{position:absolute;top:50%;left:50%;overflow:hidden;margin:-320px 0 0 -512px;width:1024px;height:640px;background:#000}.full.debug:after{position:absolute;top:0;right:0;bottom:0;left:0;z-index:2;background:url(../images/grid-16x10.svg) no-repeat;content:''}.full .live-region{position:absolute;clip:rect(0 0 0 0);overflow:hidden;margin:-1px;padding:0;width:1px;height:1px;border:none;display:block}.full .slide{position:absolute;top:0;left:0;margin-left:150%}.full .slide .next{visibility:hidden}.full .slide .next.active{visibility:visible}.full .slide:target{margin:0}.full .slide.shout.grow h2,.full .slide.shout.shrink h2{opacity:0;-webkit-transition:all .4s ease-out;transition:all .4s ease-out}.full .slide.shout.grow:target h2,.full .slide.shout.shrink:target h2{opacity:1;-webkit-transform:scale(1)translateY(-50%);-ms-transform:scale(1)translateY(-50%);transform:scale(1)translateY(-50%)}.full .slide.shout.grow h2{-webkit-transform:scale(.1)translateY(-50%);-ms-transform:scale(.1)translateY(-50%);transform:scale(.1)translateY(-50%)}.full .slide.shout.shrink h2{-webkit-transform:scale(10)translateY(-50%);-ms-transform:scale(10)translateY(-50%);transform:scale(10)translateY(-50%)}.full .progress{position:absolute;right:0;bottom:0;left:0;overflow:hidden;height:10px;z-index:1}.full .progress div{position:absolute;left:-20px;top:-10px;width:0;height:0;border:10px solid transparent;border-bottom-color:#4B86C2;-webkit-transition:width .2s linear;transition:width .2s linear}.full .progress div[style*='100%']{left:0}}@page{margin:0;size:1024px 640px} -------------------------------------------------------------------------------- /lib/main.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Main entry point for the Ponyshow. Responsible for loading the command line 3 | * configuration, initializing the i18n system, defining global options and 4 | * flags, and running the main logic. 5 | * 6 | * @module ponyshow 7 | * 8 | * @copyright 9 | * Copyright (c) 2015 by Semantic Press, Inc. All Rights Reserved. 10 | * 11 | * @license 12 | * Licensed under the terms of the Apache Public License 13 | * Please see the LICENSE included with this distribution for details. 14 | * 15 | */ 16 | 17 | var Pony = require('pony-render'), 18 | fs = require('fs'), 19 | request = require('request'), 20 | zlib = require('zlib'), 21 | path = require('path'), 22 | util = require('util'), 23 | _ = require('lodash'), 24 | tar = require('tar'), 25 | replaceStream = require('replacestream'), 26 | i18n = require('i18n'), 27 | rimraf = require('rimraf'), 28 | uuid = require('node-uuid'), 29 | prettyjson = require('prettyjson'), 30 | colors = require('colors'), 31 | fields = require('fields'), 32 | conf = require('nconf'), 33 | parser = require("nomnom"), 34 | cpr = require('cpr').cpr, 35 | readdirp = require('readdirp'), 36 | mkdirp = require('mkdirp'), 37 | express = require('express'), 38 | fsmonitor = require('fsmonitor'), 39 | compression = require('compression'), 40 | AsciiBanner = require('ascii-banner'), 41 | launcher = require('browser-launcher2'), 42 | WebSocketServer = require('ws').Server, 43 | git = require('gift'), 44 | pkgJson = require('../package.json'), 45 | Spinner = require('./spinner').Spinner; 46 | 47 | 48 | var ponypath = getUserHome()+'/.ponyshow'; 49 | var workspace = ponypath+'/workspace'; 50 | 51 | conf.use('file', { file: ponypath+'/config.json' }); 52 | conf.defaults({ 53 | 'theme': 'default', 54 | 'port': 8080, 55 | 'wsport': 8081 56 | }); 57 | conf.load(); 58 | 59 | var Decks = []; 60 | var wss = new WebSocketServer({ port: conf.get('wsport') }); 61 | var wsctx = false; 62 | var spinnerctx = false; 63 | 64 | 65 | // set path.existsSync to make old modules designed for <=0.6 happy 66 | path.existsSync = fs.existsSync || path.existsSync; 67 | 68 | if (typeof exports === 'object' && typeof define !== 'function') { 69 | var define = function (factory) { 70 | factory(require, exports, module); 71 | }; 72 | } 73 | 74 | function onError(err) { 75 | console.error('\nAn error occurred:', err); 76 | process.exit(0); 77 | } 78 | 79 | function getUserHome() { 80 | return process.env[(process.platform == 'win32') ? 'USERPROFILE' : 'HOME']; 81 | } 82 | 83 | function rmDir(path) { 84 | if( fs.existsSync(path) ) { 85 | fs.readdirSync(path).forEach(function(file,index){ 86 | var curPath = path + "/" + file; 87 | if(fs.lstatSync(curPath).isDirectory()) { // recurse 88 | rmDir(curPath); 89 | } else { // delete file 90 | fs.unlinkSync(curPath); 91 | } 92 | }); 93 | fs.rmdirSync(path); 94 | } 95 | }; 96 | 97 | function runExampleDeck(args) { 98 | process.exit(0); 99 | } 100 | 101 | function banner(json) { 102 | json = json||{banner:'small'}; 103 | 104 | var out = AsciiBanner; 105 | 106 | // check if console exists 107 | if (process.stdout.isTTY) { 108 | 109 | // asciimo: https://github.com/Marak/asciimo 110 | out.write('Pony Show'); 111 | 112 | if (process.stdout.columns < 100) { 113 | out.font('Thin'); 114 | } 115 | 116 | if (json.font) { 117 | out.font(json.font); 118 | } 119 | 120 | switch(json.banner) { 121 | case 'large': 122 | out 123 | .color('yellow') 124 | .after('>v'+pkgJson.version, 'yellow'); 125 | 126 | break; 127 | 128 | case 'small': 129 | out 130 | .color('yellow') 131 | .after('>v'+pkgJson.version, 'yellow'); 132 | 133 | break; 134 | } 135 | 136 | return out; 137 | 138 | } 139 | 140 | } 141 | 142 | function isOnline(cb) { 143 | require('dns').lookup('google.com',function(err) { 144 | if (err && err.code == "ENOTFOUND") { 145 | cb(false); 146 | } else { 147 | cb(true); 148 | } 149 | }) 150 | } 151 | 152 | function promptForFile(args) { 153 | options = []; 154 | for (var x in Decks) { 155 | options.push({id:parseInt(x)+1, meta:Decks[x]}); 156 | } 157 | 158 | fields.select({ 159 | title: 'Found '+options.length+' presentations', 160 | promptLabel: 'Choose a deck', 161 | formatters: { 162 | option: function (opt, idx, num) { 163 | return opt.id + ') ' + opt.meta.ponyfile.filename.cyan; 164 | } 165 | }, 166 | complete: true, 167 | numbered: false, 168 | relistOnError: true, 169 | complete: ['id', 'name'], 170 | completeIgnoreCase: true, 171 | suggest: false, 172 | optionLabel: 'name', 173 | optionValue: 'id', 174 | options: options 175 | }).prompt(function (err, i) { 176 | if (err) { 177 | process.stdout.write('\n'); 178 | process.exit(0); 179 | } else { 180 | renderFile(options[i-1].meta,start); 181 | } 182 | }); 183 | 184 | } 185 | 186 | function clearScreen(args) { 187 | // clear screen 188 | var lines = process.stdout.getWindowSize()[1]; 189 | for(var i = 0; i < lines; i++) { 190 | console.log('\r\n'); 191 | } 192 | } 193 | 194 | function renderFile(dp,_cb) { 195 | 196 | //console.log(dp); 197 | if (spinnerctx) { 198 | spinnerctx.setText('%s Rendering'); 199 | } 200 | 201 | var file = dp.fullPath; 202 | 203 | if (dp.args) { 204 | // check if different from deck locale 205 | if (dp.args.hasOwnProperty('locale')) { 206 | if (dp.args.locale != dp.ponyfile['locale']) { 207 | // modify source file to localized version based on command line args 208 | file = dp.fullParentDir+'/locales/'+dp.args['locale']+'.md'; 209 | } 210 | } 211 | } 212 | 213 | 214 | if (!fs.existsSync(file)) { 215 | 216 | // Prompt to create a lang file 217 | fields.text({ 218 | title: 'File doesn\'t exist for language "'+dp.args['locale']+'"', 219 | promptLabel:'Create a new language file?', 220 | default:"No", 221 | validate: function (value, callback) { 222 | callback(!value.length, value); 223 | } 224 | }).prompt(function (err, val) { 225 | if (err) { 226 | process.stdout.write('\n'); 227 | process.exit(0); 228 | } else { 229 | if (val != "No") { 230 | 231 | // create file 232 | fs.writeFileSync(file, fs.readFileSync(dp.fullPath)); 233 | console.log('File created. You can now localize this file.'); 234 | 235 | } 236 | 237 | process.exit(0); 238 | } 239 | }); 240 | 241 | } else { 242 | 243 | // Open deck.md file 244 | fs.readFile(file, 'utf8', function (err, str) { 245 | if (err) console.log(err); 246 | 247 | // Get configuration file 248 | var dat = JSON.parse(fs.readFileSync(ponypath+'/config.json').toString()); 249 | 250 | var html = Pony.render(str,dat); 251 | 252 | if (html) { 253 | 254 | html = "\n\n"+html; 255 | 256 | // Save source contents 257 | fs.writeFile(workspace+'/index.html',html,{'flags': 'w+'},function(err){ 258 | if (err) { 259 | throw err; 260 | } else { 261 | 262 | var target1 = path.dirname(dp.fullPath)+'/assets'; 263 | var target2 = workspace+'/assets'; 264 | 265 | // Copy deck assets if avail 266 | if(fs.existsSync(target1)) { 267 | // copy assets over 268 | cpr(target1, target2, function (err) { 269 | if (err) { 270 | return console.error(err); 271 | } 272 | }); 273 | }; 274 | 275 | // Monitor file to detect change events 276 | fsmonitor.watch(path.dirname(dp.fullPath), null, function(change) { 277 | renderFile(dp, function() { 278 | if (wsctx) { 279 | try{ 280 | wsctx.send("reload"); 281 | } catch(e) { 282 | console.error(e); 283 | } 284 | } 285 | }); 286 | 287 | }); 288 | 289 | // Start server 290 | if (typeof _cb == "function") { 291 | _cb(dp); 292 | } 293 | 294 | } 295 | }); 296 | } else { 297 | console.log('Error ponifying content'); 298 | console.log(html); 299 | } 300 | 301 | }); 302 | 303 | } 304 | 305 | } 306 | 307 | function start(dp) { 308 | 309 | try { 310 | 311 | var app = express(); 312 | var port = process.env.PORT || conf.get('port'); 313 | 314 | // Serve workspace dir 315 | app.locals.pretty = true; 316 | app.use(compression()); 317 | app.use("/", express.static(workspace, { maxAge: 0 })); 318 | app.listen(port); 319 | 320 | wss.on('connection', function connection(ws) { 321 | wsctx = ws; 322 | wsctx.send('Socket server is running'); 323 | }); 324 | 325 | launcher(function (err, launch) { 326 | if (err) return console.error(err); 327 | launch('http://127.0.0.1:'+port, launch.browsers[0].name, function (err, instance) { 328 | if (err) return console.error(err); 329 | instance.on( 'stop', function( code ) { 330 | console.log( 'Browser stopped ('+code+')'); 331 | process.exit(0); 332 | }); 333 | }); 334 | }); 335 | 336 | if (spinnerctx) { 337 | spinnerctx.stop(true); 338 | } 339 | 340 | // Get deck meta 341 | var json = JSON.parse(fs.readFileSync(path.dirname(dp.fullPath)+'/package.json')); 342 | 343 | // Set locale 344 | json.locale = (dp.args['locale']) ? dp.args['locale'] : conf.get('locale'); 345 | 346 | // Display details 347 | console.log 348 | console.log('Title: '+json.filename+' - '+json.title) 349 | console.log('Description: '+json.description) 350 | console.log('Author: '+(json.author||"n/a")) 351 | console.log(String('Localization: '+json.locale).yellow) 352 | console.log('') 353 | console.log(String('http://127.0.0.1:'+port).yellow); 354 | 355 | } catch (err) { 356 | console.error(err); 357 | } 358 | 359 | } 360 | 361 | function promptForNewDeck(args) { 362 | 363 | // detect if current dir is ponyfile 364 | readdirp({ root: workspace+'/themes', fileFilter: [ 'package.json' ] },function(entry) {}, function (err, res) { 365 | if (err) console.error(err); 366 | 367 | // Phrases 368 | var phrases = [ 369 | '\nDeck title', 370 | 'This will become a repository', 371 | '\nEnter deck absolute path', 372 | 'Enter the deck title', 373 | 'Please enter a title', 374 | 'Enter a description', 375 | 'Available themes', 376 | 'Select a theme', 377 | 'Enter the git repository url', 378 | 'Enter an author', 379 | 'License' 380 | ]; 381 | 382 | // for (var x in phrases) { 383 | // i18n.__({phrase:phrases[x]}) 384 | // } 385 | 386 | fields.text({ 387 | title:phrases[0], 388 | promptLabel: '', 389 | validate: function (value, callback) { 390 | callback(!value.length, value); 391 | } 392 | }).prompt(function (err, _title) { 393 | if (err) { 394 | process.stdout.write('\n'); 395 | process.exit(0); 396 | } else { 397 | 398 | var title = _title; 399 | var folder = title.replace(' ','-').toLowerCase(); 400 | 401 | fields.set({ 402 | 403 | path: fields.text({ 404 | title:phrases[2], 405 | promptLabel: '', 406 | default:process.cwd()+"/"+folder, 407 | validate: function (value, callback) { 408 | callback(!value.length, value); 409 | } 410 | }), 411 | 412 | description: fields.text({ 413 | title:phrases[5], 414 | promptLabel: '', 415 | validate: function (value, callback) { 416 | callback(!value.length, value); 417 | } 418 | }), 419 | 420 | theme: fields.select({ 421 | title: phrases[6], 422 | desc:phrases[7], 423 | promptLabel: '', 424 | formatters: { 425 | option: function (opt, idx, num) { 426 | return num + opt.parentDir.cyan; 427 | } 428 | }, 429 | numbered: true, 430 | relistOnError: true, 431 | complete: true, 432 | suggest: false, 433 | options: res.files, 434 | complete: ['parentDir'], 435 | optionLabel: 'parentDir', 436 | optionValue: 'parentDir', 437 | default:res.files[0].parentDir, 438 | next: function (err, value, callback) { 439 | return null; 440 | } 441 | }), 442 | 443 | locale: fields.text({ 444 | title:'Default language', 445 | promptLabel:'', 446 | desc: 'ISO 3166-1 country codes (2 alpha)', 447 | default:conf.get('locale') 448 | }), 449 | 450 | repoUrl: fields.text({ 451 | title:phrases[8], 452 | promptLabel: '', 453 | default:'http://', 454 | validate: function (value, callback) { 455 | // verify url 456 | callback(!value.length, value); 457 | } 458 | }), 459 | 460 | author: fields.text({ 461 | title:phrases[9], 462 | promptLabel: '' 463 | }), 464 | 465 | license: fields.text({ 466 | title:phrases[10], 467 | promptLabel: '', 468 | default:'MIT', 469 | validate: function (value, callback) { 470 | callback(!value.length, value); 471 | } 472 | }) 473 | 474 | }).prompt(function (err, value) { 475 | if (err) { 476 | process.stdout.write('\n'); 477 | console.log('Goodbye!'); 478 | } else { 479 | 480 | spinnerctx = new Spinner('%s Processing'); 481 | spinnerctx.setSpinnerString('|/-\\'); 482 | spinnerctx.start(); 483 | 484 | // Set values 485 | value.guid = uuid.v1(); 486 | value.title = title; 487 | value.filename = folder; 488 | 489 | // Check if online 490 | isOnline(function(online) { 491 | 492 | if (online) { 493 | 494 | // Set req options 495 | var opts = { 496 | url: 'https://api.github.com/repos/ponyshow/deck-default/releases/latest', 497 | headers: { 498 | 'User-Agent': 'request' 499 | } 500 | }; 501 | 502 | spinnerctx.setText('%s Downloading default deck'); 503 | 504 | // Get latest default theme 505 | request.get(opts, function (error, response, body) { 506 | if (!error && response.statusCode == 200) { 507 | 508 | var json = JSON.parse(body); 509 | 510 | // Set download url 511 | opts.url = json.tarball_url; 512 | 513 | // Set filesystem target 514 | //var target = path.join(process.cwd(), folder); 515 | var target = value.path; 516 | 517 | // Download and extract 518 | // Note: Github tarballs are gzip-compressed 519 | request.get(opts) 520 | .pipe(zlib.Unzip()).pipe(tar.Extract({path:target,strip: 1})) 521 | .on('end',function() { 522 | 523 | // update default 524 | spinnerctx.setText('%s Merging properties'); 525 | 526 | 527 | // Replace all the instances 528 | var fsdeck = path.join(target, '.deck'); 529 | var fspkg = path.join(target, 'package.json'); 530 | 531 | var read1 = fs.createReadStream(fsdeck) 532 | .pipe(replaceStream('<%= title %>', value.title)) 533 | .pipe(replaceStream('<%= description %>', value.description)) 534 | .pipe(replaceStream('<%= theme %>', value.theme)) 535 | .pipe(fs.createWriteStream(path.join(target, 'deck.md'))); 536 | 537 | read1.on("finish", function() { 538 | 539 | var json = JSON.parse(fs.readFileSync(fspkg, 'utf8')); 540 | json.repository.url = value.repoUrl; 541 | 542 | fs.writeFileSync(fspkg, JSON.stringify(_.merge(json,value), null, '\t')); 543 | 544 | spinnerctx.stop(true); 545 | fs.unlinkSync(fsdeck); 546 | 547 | console.log('Deck generated: '+target.yellow); 548 | console.log('Run Ponyshow to view the deck.'); 549 | process.exit(0); 550 | }); 551 | 552 | 553 | }); 554 | 555 | } else { 556 | console.log('Error fetching url: '+opts.url); 557 | process.exit(0); 558 | } 559 | }); 560 | 561 | 562 | } else { 563 | 564 | console.log('Not online'); 565 | process.exit(0); 566 | } 567 | 568 | }); 569 | 570 | } 571 | 572 | }); 573 | 574 | } 575 | }); 576 | 577 | 578 | 579 | }); 580 | 581 | } 582 | 583 | function promptForNewTheme(args) { 584 | 585 | fields.set({ 586 | title: fields.text({ 587 | title: '\nTheme title', 588 | promptLabel: '', 589 | validate: function (value, callback) { 590 | callback(!value.length, value); 591 | } 592 | }), 593 | 594 | description: fields.text({ 595 | title:'Description', 596 | promptLabel: '' 597 | }), 598 | 599 | author: fields.text({ 600 | title:'Author', 601 | promptLabel: '' 602 | }), 603 | 604 | license: fields.text({ 605 | title:'License', 606 | promptLabel: '', 607 | default:'MIT', 608 | validate: function (value, callback) { 609 | callback(!value.length, value); 610 | } 611 | }) 612 | }).prompt(function (err, value) { 613 | if (err) { 614 | process.stdout.write('\n'); 615 | process.exit(0); 616 | } else { 617 | 618 | spinnerctx = new Spinner('%s Processing'); 619 | spinnerctx.setSpinnerString('|/-\\'); 620 | spinnerctx.start(); 621 | 622 | var pre = 'ponyshow-theme-'; 623 | var name = value.title||''; 624 | var folder = name.replace(' ','-').toLowerCase(); 625 | 626 | // Prepend name convention for npm purposes 627 | value.name = pre+name; 628 | 629 | rimraf(workspace+'/themes/'+name, function(){ 630 | 631 | isOnline(function(online) { 632 | 633 | if (online) { 634 | 635 | var opts = { 636 | url: 'https://api.github.com/repos/ponyshow/theme-default/releases/latest', 637 | headers: { 638 | 'User-Agent': 'request' 639 | } 640 | }; 641 | 642 | spinnerctx.setText('%s Downloading latest theme'); 643 | 644 | // Get latest default theme 645 | request.get(opts, function (error, response, body) { 646 | if (!error && response.statusCode == 200) { 647 | 648 | var json = JSON.parse(body); 649 | 650 | // Set download url 651 | opts.url = json.tarball_url; 652 | 653 | var target = workspace+'/themes/'+folder; 654 | 655 | // Download and extract 656 | // Note: Github tarballs are gzip-compressed 657 | request.get(opts) 658 | .pipe(zlib.Unzip()).pipe(tar.Extract({path:target,strip: 1})) 659 | .on('end',function() { 660 | 661 | // update default 662 | spinnerctx.setText('%s Merging properties'); 663 | 664 | // Replace all the instances 665 | var fscopyright = path.join(target, '.copyright'); 666 | var fslicense = path.join(target, '.license'); 667 | var fsreadme = path.join(target, '.readme'); 668 | var fspkg = path.join(target, 'package.json'); 669 | 670 | var read1 = fs.createReadStream(fscopyright) 671 | .pipe(replaceStream('<%= author %>', value.author)) 672 | .pipe(replaceStream('<%= version %>', value.version)) 673 | .pipe(fs.createWriteStream(path.join(target, 'Copyright'))); 674 | 675 | var read2 = fs.createReadStream(fslicense) 676 | .pipe(replaceStream('<%= author %>', value.author)) 677 | .pipe(fs.createWriteStream(path.join(target, 'LICENSE.md'))); 678 | 679 | var read3 = fs.createReadStream(fsreadme) 680 | .pipe(replaceStream('<%= name %>', value.author)) 681 | .pipe(fs.createWriteStream(path.join(target, 'README.md'))); 682 | 683 | read3.on("finish", function() { 684 | 685 | var json = JSON.parse(fs.readFileSync(fspkg, 'utf8')); 686 | fs.writeFileSync(fspkg, JSON.stringify(_.merge(json,value), null, '\t')); 687 | 688 | spinnerctx.stop(true); 689 | fs.unlinkSync(fscopyright); 690 | fs.unlinkSync(fslicense); 691 | fs.unlinkSync(fsreadme); 692 | 693 | console.log('Theme created!\n') 694 | console.log(' Theme: '.yellow+name); 695 | console.log(' Location: '.yellow+target); 696 | console.log('\n Tip: You can run \'ponyshow themes\' to see installed themes'.grey); 697 | 698 | process.exit(0); 699 | }); 700 | 701 | 702 | }); 703 | 704 | } else { 705 | console.log('Error fetching url: '+opts.url); 706 | process.exit(0); 707 | } 708 | }); 709 | 710 | } else { 711 | 712 | console.log('Sorry, not online. You must have internet access to remote themes.'); 713 | process.exit(0); 714 | 715 | } 716 | 717 | 718 | }); 719 | 720 | }); 721 | 722 | } 723 | }); 724 | 725 | } 726 | 727 | function runFirstRun(args) { 728 | 729 | clearScreen(); 730 | 731 | console.log('\nHowdy partner. Welcome to Ponyshow!\n'.white); 732 | 733 | console.log('You can read the docs here: http://www.ponyshow.com/docs'.yellow); 734 | 735 | console.log('Or, install an example deck by running:'.yellow); 736 | console.log('\npony run example'.grey); 737 | console.log('\nThere are other commands you can run, so fee free to go wild.'); 738 | console.log('Email me if you have any questions at martin@semanticpress.com'); 739 | console.log('\n(Run pony again to continue)'.grey); 740 | console.log('\nGiddyup!'); 741 | 742 | process.exit(0); 743 | 744 | } 745 | 746 | function runNewCommand(opt) { 747 | switch(opt) { 748 | case "deck": 749 | promptForNewDeck(); 750 | break; 751 | case "theme": 752 | promptForNewTheme(); 753 | break; 754 | } 755 | } 756 | 757 | function Module(_opts) { 758 | 759 | var self = this; 760 | self.installed = false; 761 | self.callee = _opts.callee; 762 | 763 | // set global fields configuration 764 | fields.setup({ 765 | colors:true, 766 | formatters: { 767 | error: function (err) { 768 | if (err instanceof Error) { 769 | return ('[ERROR] ' + err.message).red + '\n'; 770 | } 771 | err = '' + err; 772 | return '\n' + (/^(\[ERROR\])/i.test(err) ? err : '[ERROR] ' + err.replace(/^Error\:/i, '').trim()).red; 773 | } 774 | } 775 | }); 776 | 777 | 778 | // locale config 779 | i18n.configure({ 780 | // setup some locales - other locales default to en silently 781 | locales:['en', 'es', 'it', 'de', 'fr', 'sv', 'nl', 'jp', 'cn' ], 782 | 783 | // you may alter a site wide default locale 784 | defaultLocale: 'en', 785 | 786 | // sets a custom cookie name to parse locale settings from - defaults to NULL 787 | cookie: 'ponyshowrocks', 788 | 789 | // where to store json files - defaults to './locales' relative to modules directory 790 | directory: path.join(__dirname, 'locales'), 791 | 792 | // whether to write new locale information to disk - defaults to true 793 | updateFiles: true, 794 | 795 | // enable object notation 796 | objectNotation: true 797 | }); 798 | 799 | i18n.setLocale(conf.get('locale')); 800 | 801 | 802 | // check that we're using Node.js 0.10 or newer 803 | try { 804 | if (semver.lt(process.version, '0.10.0')) { 805 | console.error(pkgJson.about.name.cyan.bold + ', CLI version ' + pkgJson.version + '\n' + pkgJson.about.copyright + '\n\n' + 806 | 'ERROR: Titanium requires Node.js 0.10 or newer.'.red + '\n\n' + 807 | 'Visit ' + 'http://nodejs.org/'.cyan + ' to download a newer version.\n'); 808 | process.exit(1); 809 | } 810 | } catch (e) {} 811 | 812 | 813 | function init(_opts) { 814 | 815 | clearScreen(); 816 | 817 | process.env.locale = "en_US"; 818 | 819 | // strip the node executable from the args 820 | var args = process.argv.slice(); 821 | if (args[0].replace(/\\/g, '/').split('/').pop().replace(/\.exe$/, '') == process.execPath.replace(/\\/g, '/').split('/').pop().replace(/\.exe$/, '')) { 822 | args.shift(); 823 | } 824 | 825 | args.shift(); 826 | 827 | 828 | // Run command line parser 829 | parser.script('pony'); 830 | 831 | parser.command('version') 832 | .callback(this.version).help('display version'); 833 | parser.command('new') 834 | .callback(this.new).help("new deck or theme"); 835 | parser.command('run') 836 | .callback(this.run).help("run a presentation file(s)"); 837 | parser.command('install') 838 | .callback(this.install).help("install themes and projects"); 839 | parser.command('themes') 840 | .callback(this.themes).help("view installed themes"); 841 | parser.command('config') 842 | .callback(this.config).help("Get or set global settings"); 843 | parser.option('locale', { abbr: 'l', flag: true, help: 'Set localization country code'}); 844 | 845 | 846 | // Set install state 847 | if (!fs.existsSync(ponypath)) { 848 | self.firstrun = true; 849 | } 850 | 851 | // Ensure ponypath and workspace are installed 852 | mkdirp.sync(ponypath); 853 | mkdirp.sync(ponypath+'/tmp'); 854 | mkdirp.sync(ponypath+'/workspace'); 855 | 856 | // Create config if not avail 857 | if (!fs.existsSync(ponypath+'/config.json')) { 858 | fs.writeFileSync(ponypath+'/config.json', fs.readFileSync(path.join(__dirname,'../config.json'))); 859 | } 860 | 861 | // synchronize workspace assets 862 | cpr(path.join(__dirname,'../workspace'), workspace, function (err, files) { 863 | if (err) { 864 | return console.log('Goodbye!'); 865 | } 866 | 867 | if (self.firstrun) { 868 | self.firstrun = false; 869 | runFirstRun(); 870 | } else { 871 | banner().out(function() { 872 | parser.parse(); 873 | }); 874 | } 875 | 876 | }); 877 | 878 | }; 879 | 880 | function config(_opts) { 881 | 882 | var args = _opts||{}; 883 | 884 | // CLI 885 | if (args.hasOwnProperty('_') && self.callee == "cli") { 886 | 887 | if (args['_'].length <= 1) { 888 | 889 | var data = JSON.parse(fs.readFileSync(ponypath+'/config.json')); 890 | console.log(prettyjson.render({Settings:data},{ 891 | keysColor: 'yellow', 892 | stringColor: 'white' 893 | })); 894 | process.exit(0); 895 | 896 | } else { 897 | 898 | if(args['_'].length == 2) { 899 | console.log('Nothing to set'); 900 | process.exit(0); 901 | } else { 902 | 903 | args = args['_'][2].split('='); 904 | 905 | conf.set(args[0], args[1]); 906 | 907 | switch(args[0]) { 908 | case 'locale': 909 | i18n.setLocale(args[1]); 910 | break; 911 | } 912 | } 913 | } 914 | } else { 915 | 916 | // Set properties 917 | for(var x in args) { 918 | conf.set(x, args[x]); 919 | } 920 | 921 | } 922 | 923 | // Save 924 | conf.save(function (err) { 925 | if (err) { return console.error(err.message) }; 926 | console.log('Config was updated successfully'); 927 | process.exit(0); 928 | }); 929 | 930 | }; 931 | 932 | function install(_opts, _cb) { 933 | 934 | clearScreen(); 935 | 936 | if (_opts['_'].length <= 1) { 937 | console.log('\nMissing argument for install.'.red); 938 | 939 | fields.select({ 940 | title: 'Available commands', 941 | complete: true, 942 | numbered: false, 943 | options: ['theme'] 944 | }).prompt(function (err, i) { 945 | process.exit(0); 946 | }); 947 | process.exit(0); 948 | } else { 949 | 950 | if (_opts[1] == "theme") { 951 | 952 | if (!_opts[2]) { 953 | console.log('\nYou must specify a repository url'.red); 954 | console.log('\nUsage: '); 955 | console.log('\n pony install theme http://path/to/git/repo'); 956 | process.exit(0); 957 | return; 958 | } 959 | 960 | // install from url 961 | var url = _opts[2]; 962 | var name = path.basename(url).split('.')[0].replace('theme-',''); 963 | 964 | rimraf(workspace+'/themes/'+name, function(){ 965 | 966 | git.clone(url, workspace+'/themes/'+name, function(err, _repo){ 967 | if (err) { 968 | console.error(err); 969 | } else { 970 | console.log('Theme installed: '+_repo.path); 971 | } 972 | process.exit(0); 973 | 974 | }); 975 | 976 | }); 977 | 978 | } 979 | 980 | } 981 | 982 | }; 983 | 984 | function themes(_opts, _cb) { 985 | 986 | spinnerctx = new Spinner('%s Looking for themes..'); 987 | spinnerctx.setSpinnerString('|/-\\'); 988 | spinnerctx.start(); 989 | 990 | // detect if current dir is ponyfile 991 | readdirp({ root: workspace + '/themes', fileFilter: [ 'package.json' ] },function(entry) { 992 | 993 | try { 994 | // stash commands for future deck functions 995 | entry.args = _opts||{}; 996 | entry.theme = JSON.parse(fs.readFileSync(entry.fullParentDir+'/package.json')) 997 | } catch (err) { 998 | console.error(err); 999 | } 1000 | 1001 | }, function (err, res) { 1002 | 1003 | spinnerctx.stop(true); 1004 | 1005 | if (!res) { 1006 | if (dest) 1007 | console.error('Doesn\'t exist: '+dest); 1008 | process.exit(0); 1009 | return false; 1010 | } 1011 | 1012 | if (res.files.length > 0) { 1013 | 1014 | console.log('Installed themes:'.yellow+'\n'); 1015 | 1016 | for (var x in res.files) { 1017 | console.log('\t'+res.files[x].theme.name.replace('ponyshow-theme-','')); 1018 | } 1019 | 1020 | process.exit(0); 1021 | 1022 | } else { 1023 | 1024 | console.log('No themes installed'); 1025 | process.exit(0); 1026 | } 1027 | 1028 | }); 1029 | 1030 | } 1031 | 1032 | function newFile(_opts, _cb) { 1033 | 1034 | var options = [ 1035 | 'deck', 1036 | 'theme' 1037 | ]; 1038 | 1039 | // Run command line field inputs 1040 | try { 1041 | 1042 | if (_opts['_'].length >= 2) { 1043 | 1044 | runNewCommand(_opts['_'][1]); 1045 | 1046 | } else { 1047 | fields.select({ 1048 | title: '\nAvailable options..'.yellow, 1049 | desc: '(This will bootstrap a new component)', 1050 | promptLabel:'\nSelect an option', 1051 | complete: true, 1052 | numbered: true, 1053 | options: options 1054 | }).prompt(function (err, i) { 1055 | runNewCommand(i); 1056 | }); 1057 | } 1058 | 1059 | }catch(e) { 1060 | console.error('There was an error!\n' + e); 1061 | } 1062 | 1063 | } 1064 | 1065 | function run(_opts) { 1066 | 1067 | //console.log(_opts); 1068 | if (!_opts) { 1069 | return false; 1070 | } 1071 | 1072 | if (_opts[1] == "example") { 1073 | runExampleDeck(); 1074 | return; 1075 | } 1076 | 1077 | var dest = process.cwd()+(_opts[1] ? '/'+_opts[1] : ''); 1078 | 1079 | spinnerctx = new Spinner('%s Looking for decks..'); 1080 | spinnerctx.setSpinnerString('|/-\\'); 1081 | spinnerctx.start(); 1082 | 1083 | // detect if current dir is ponyfile 1084 | readdirp({ root: dest, fileFilter: [ 'deck.md' ] },function(entry) { 1085 | 1086 | try { 1087 | // stash commands for future deck functions 1088 | entry.args = _opts||{}; 1089 | entry.ponyfile = JSON.parse(fs.readFileSync(entry.fullParentDir+'/package.json')) 1090 | } catch (err) { 1091 | console.error(err); 1092 | } 1093 | 1094 | }, function (err, res) { 1095 | 1096 | spinnerctx.stop(true); 1097 | 1098 | if (!res) { 1099 | if (dest) 1100 | console.error('Doesn\'t exist: '+dest); 1101 | process.exit(0); 1102 | return false; 1103 | } 1104 | 1105 | Decks = res.files; 1106 | 1107 | // Attempt to sort decks array. Alphanumeric may not be consistent 1108 | Decks.sort(function(a, b) { 1109 | return a.ponyfile.filename.localeCompare(b.ponyfile.filename); 1110 | }); 1111 | 1112 | if (Decks.length > 0) { 1113 | 1114 | if (Decks.length > 1) { 1115 | // Show selector 1116 | promptForFile(); 1117 | 1118 | } else { 1119 | 1120 | // Render file 1121 | renderFile(Decks[0],start); 1122 | } 1123 | 1124 | } else { 1125 | 1126 | console.log('No decks found from this path'); 1127 | process.exit(0); 1128 | } 1129 | 1130 | }); 1131 | 1132 | } 1133 | 1134 | function version() { 1135 | if (self.callee == "cli") { 1136 | console.log('version '+pkgJson.version); 1137 | process.exit(0); 1138 | } 1139 | return pkgJson.version; 1140 | } 1141 | 1142 | return { 1143 | installed: self.installed, 1144 | callee: self.callee, 1145 | init: init, 1146 | config: config, 1147 | install: install, 1148 | themes: themes, 1149 | new: newFile, 1150 | run: run, 1151 | version: version 1152 | } 1153 | 1154 | } 1155 | 1156 | 1157 | define(function (require, exports, module) { 1158 | module.exports = function() { 1159 | if(require.main === module) { 1160 | // called directly 1161 | var Pony = new Module({ 1162 | callee:'cli' 1163 | }); 1164 | Pony.init(); 1165 | } else { 1166 | // required as a module 1167 | return new Module({ 1168 | callee:'module' 1169 | }); 1170 | } 1171 | }(); 1172 | }); 1173 | -------------------------------------------------------------------------------- /workspace/js/main.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Ponyshow Web Client 3 | * A command line interface for creating and viewing Ponyshow (Markdown-to-html) presentation files 4 | * 5 | * Download the Ponyshow App: http://www.semanticpress.com/ponyshow 6 | * 7 | * JS/CSS Client v0.0.1 8 | * Full source at https://github.com/Ponyshow/ponyshow 9 | * 10 | * Author: TZ Martin, 11 | * Copyright © 2015 Semantic Press, Inc. All rights reserved. 12 | * Licensed under Apache 2.0 license: http://www.apache.org/licenses/LICENSE-2.0 13 | */ 14 | function fireEvent(t){window.hasOwnProperty("postMessageToHost")?window.postMessageToHost(JSON.stringify(t)):console.log({fireEvent:t.event,data:t.data})}function isElementInViewport(t){var e=t.getBoundingClientRect();return e.top>=0&&e.left>=0&&e.bottom<=(window.innerHeight||document.documentElement.clientHeight)&&e.right<=(window.innerWidth||document.documentElement.clientWidth)}function getPosition(t){if(!t)var t=window.event;return{x:t.clientX,y:t.clientY}}console.log=function(t){return function(){var e=Array.prototype.slice.call(arguments);e.unshift((new Date).getTime().toString().substr(7,6)),window.hasOwnProperty("postMessageToHost")?window.postMessageToHost(JSON.stringify({event:"WKWebViewLog",data:e.join(" - ")})):t.apply(console,e)}}(console.log),window.onerror=function(t,e,n){var r=t+" Script: "+e+" Line: "+n;window.hasOwnProperty("postMessageToHost")?window.postMessageToHost(JSON.stringify({event:"WKWebViewError",data:r})):console.log(r)};var exampleSocket=new WebSocket("ws://127.0.0.1:8081");exampleSocket.onmessage=function(t){switch(console.log("received event.."),t.data){case"reload":location.reload();break;default:console.log(t.data)}},Element.prototype.isVisible=function(){"use strict";function t(r,i,o,s,a,c,l){var u=r.parentNode,d=2;return n(r)?9===u.nodeType?!0:"0"===e(r,"opacity")||"none"===e(r,"display")||"hidden"===e(r,"visibility")?!1:(("undefined"==typeof i||"undefined"==typeof o||"undefined"==typeof s||"undefined"==typeof a||"undefined"==typeof c||"undefined"==typeof l)&&(i=r.offsetTop,a=r.offsetLeft,s=i+r.offsetHeight,o=a+r.offsetWidth,c=r.offsetWidth,l=r.offsetHeight),u?"hidden"!==e(u,"overflow")&&"scroll"!==e(u,"overflow")||!(a+d>u.offsetWidth+u.scrollLeft||a+c-du.offsetHeight+u.scrollTop||i+l-d=this.innerLength},process:function(t){return this.timing?(this.initTimer(t),this):(this.next(t),this)},initTimer:function(t){var e=this;return e.timing?(e.stopTimer(),r=e.isFinished()?setInterval(function(){e.stopTimer(),t.next()},e.timing*(e.innerLength||1)):setInterval(function(){e.isFinished()?(e.stopTimer(),t.next()):e.next(t)},e.timing),this):!1},stopTimer:function(){return r&&(clearInterval(r),r=!1),this},prev:function(t){var n,r=this;return!r.hasInnerNavigation||r.isFinished()||0===r.innerComplete?(t.prev(),!1):(n=e.getElementById(r.id).querySelectorAll(".next.active"),!n||n.length<1?!1:(r.innerComplete>0?(r.innerComplete--,n[n.length-1].classList.remove("active")):t.prev(),this))},next:function(t){var n,r=this;return!r.hasInnerNavigation||r.isFinished()?(t.next(),!1):(r.isFinished()||(n=e.getElementById(r.id).querySelectorAll(".next:not(.active)"),n[0].classList.add("active"),r.innerComplete++),this)}},i._getData=function(t,e){return t.dataset?t.dataset[e]:t.getAttribute("data-"+e)},i.slideList=[],i.init=function(t,r){var o;i.debugMode&&(e.body.classList.add("debug"),s.log("Debug mode on")),t=t||".slide",r=r||"div.progress div";var a=e.createElement("section");a.className="live-region",a.setAttribute("role","region"),a.setAttribute("aria-live","assertive"),a.setAttribute("aria-relevant","additions"),a.setAttribute("aria-label","Slide Content: Auto-updating"),e.body.appendChild(a),c=e.querySelectorAll(t),l=e.querySelector(r);for(var u=0;u=0&&i.go(t),n&&i.enterSlideMode()},i._getTransform=function(){var n=Math.max(e.body.clientWidth/t.innerWidth,e.body.clientHeight/t.innerHeight);return"scale("+1/n+")"},i._applyTransform=function(t){return["WebkitTransform","MozTransform","msTransform","OTransform","transform"].forEach(function(n){e.body.style[n]=t}),!0},i._isNumber=function(t){return!isNaN(parseFloat(t))&&isFinite(t)},i._normalizeSlideNumber=function(t){if(!i._isNumber(t))throw new Error("Gimme slide number as Number, baby!");return 0>t&&(t=0),t>=i.slideList.length&&(t=i.slideList.length-1),t},i._getSlideIdByEl=function(t){for(;"BODY"!==t.nodeName&&"HTML"!==t.nodeName;){if(t.classList.contains("slide"))return t.id;t=t.parentNode}return""},i._checkInteractiveElement=function(t){return"A"===t.target.nodeName},i.getSlideNumber=function(t){var e,n=i.slideList.length-1;for(""===t&&(e=0);n>=0;--n)if(t===i.slideList[n].id){e=n;break}return e},i.go=function(t,e){var n;if(!i._isNumber(t))throw new Error("Gimme slide number as Number, baby!");return i.slideList[t]?(o.hash=i.getSlideHash(t),i.updateProgress(t),i.updateActiveAndVisitedSlides(t),i.isSlideMode()&&(i.showPresenterNotes(t),n=i.slideList[t],n.timing&&n.initTimer(i)),"function"==typeof e&&e(),t):!1},i.next=function(t){var e=i.getCurrentSlideNumber(),n=i.slideList[e+1];return n?(i.go(e+1),"function"==typeof t&&t(),this):!1},i._turnNextSlide=function(t){var e=i.getCurrentSlideNumber(),n=i.slideList[e];i.isSlideMode()?(n.stopTimer(),n.next(i)):i.go(e+1),"function"==typeof t&&t()},i.prev=i.previous=function(t){var e=i.getCurrentSlideNumber();return 1>e?!1:(i.go(e-1),"function"==typeof t&&t(),!0)},i._turnPreviousSlide=function(t){var e=i.getCurrentSlideNumber(),n=i.slideList[e];return n.stopTimer(),i.isSlideMode()?n.prev(i):i.go(e-1),"function"==typeof t&&t(),!0},i.first=function(t){var e=i.slideList[i.getCurrentSlideNumber()];e&&e.timing&&e.stopTimer(),i.go(0),"function"==typeof t&&t()},i.last=function(t){var e=i.slideList[i.getCurrentSlideNumber()];e&&e.timing&&e.stopTimer(),i.go(i.slideList.length-1),"function"==typeof t&&t()},i.enterSlideMode=function(t){var n=i.getCurrentSlideNumber();return e.body.classList.remove("list"),e.body.classList.add("full"),i.isListMode()&&u&&history.pushState(null,null,o.pathname+"?full"+i.getSlideHash(n)),i._applyTransform(i._getTransform()),"function"==typeof t&&t(),!0},i.enterListMode=function(t){var n;return e.body.classList.remove("full"),e.body.classList.add("list"),i.clearPresenterNotes(),i._applyTransform("none"),i.isListMode()?!1:(n=i.getCurrentSlideNumber(),i.slideList[n].stopTimer(),i.isSlideMode()&&u&&history.pushState(null,null,o.pathname+i.getSlideHash(n)),i.scrollToSlide(n),"function"==typeof t&&t(),!0)},i.toggleMode=function(t){return i.isListMode()?i.enterSlideMode():i.enterListMode(),"function"==typeof t&&t(),!0},i.getCurrentSlideNumber=function(){var t=i.slideList.length-1,e=o.hash.substr(1);if(""===e)return-1;for(;t>=0;--t)if(e===i.slideList[t].id)return t;return-1},i.scrollToSlide=function(n){var r,o=!1;if(!i._isNumber(n))throw new Error("Gimme slide number as Number, baby!");if(i.isSlideMode())throw new Error("You can't scroll to because you in slide mode. Please, switch to list mode.");if(-1===n)return o;if(!i.slideList[n])throw new Error("There is no slide with number "+n);return r=e.getElementById(i.slideList[n].id),t.scrollTo(0,r.offsetTop),o=!0,o},i.isListMode=function(){return u?!/^full.*/.test(o.search.substr(1)):e.body.classList.contains("list")},i.isSlideMode=function(){return u?/^full.*/.test(o.search.substr(1)):e.body.classList.contains("full")},i.updateProgress=function(t){if(null===l)return!1;if(!i._isNumber(t))throw new Error("Gimme slide number as Number, baby!");return progressVal=(100/(i.slideList.length-1)*i._normalizeSlideNumber(t)).toFixed(2)+"%",l.style.width=progressVal,l.setAttribute("role","progressbar"),l.setAttribute("aria-valuenow",progressVal),l.setAttribute("aria-valuemin","0"),l.setAttribute("aria-valuemax","100"),l.setAttribute("aria-valuetext","Slideshow Progress: "+progressVal),!0},i.updateActiveAndVisitedSlides=function(t){var n,r,o=i.slideList.length;if(t=i._normalizeSlideNumber(t),!i._isNumber(t))throw new Error("Gimme slide number as Number, baby!");for(n=0;o>n;++n)r=e.getElementById(i.slideList[n].id),t>n?(r.classList.remove("active"),r.classList.add("visited")):n>t?(r.classList.remove("visited"),r.classList.remove("active")):(r.classList.remove("visited"),r.classList.add("active"),e.querySelector(".live-region").innerHTML=r.innerHTML);return!0},i.clearPresenterNotes=function(){i.isSlideMode()&&s&&s.clear&&!i.debugMode&&s.clear()},i.showPresenterNotes=function(t){if(i.clearPresenterNotes(),s){t=i._normalizeSlideNumber(t);var n=i.slideList[t].id,r=e.getElementById(n).querySelector("footer");r&&r.innerHTML&&s.info(r.innerHTML.replace(/\n\s+/g,"\n"));var o=i._getSlideTitle(t+1);o&&s.info("NEXT: "+o)}},i._getSlideTitle=function(t){if(!i.slideList[t])return"";var n=i.slideList[t].id,r=e.getElementById(n).querySelector("h2");return r?r.textContent.replace(/\s+/g," ").replace(/^\s+|\s+$/g,""):void 0},i.getSlideHash=function(t){if(!i._isNumber(t))throw new Error("Gimme slide number as Number, baby!");return t=i._normalizeSlideNumber(t),"#"+i.slideList[t].id};for(var d in t.shower)i[d]=t.shower[d];return t.addEventListener("DOMContentLoaded",function(){i.init().run();var t=e.getElementsByTagName("img");s.log(t.length);for(var n=0;nt.innerWidth/2?i._turnNextSlide():i._turnPreviousSlide()),i.isListMode()&&(n=i.getSlideNumber(s),i.go(n),i.enterSlideMode(),i.showPresenterNotes(n),r=i.slideList[n],r.timing&&r.initTimer(i)))},!1),e.addEventListener("touchmove",function(t){i.isSlideMode()&&t.preventDefault()},!1),i}(this,this.document));var Canvas2Image=function(){function t(t,e,n){var r=t.width,i=t.height;void 0==e&&(e=r),void 0==n&&(n=i);var o=document.createElement("canvas"),s=o.getContext("2d");return o.width=e,o.height=n,s.drawImage(t,0,0,r,i,0,0,e,n),o}function e(e,n,r,i){return e=t(e,r,i),e.toDataURL(n)}function n(t){document.location.href=t}function r(t){var e=document.createElement("img");return e.src=t,e}function i(t){t=t.toLowerCase().replace(/jpg/i,"jpeg");var e=t.match(/png|jpeg|bmp|gif/)[0];return"image/"+e}function o(t){if(!window.btoa)throw"btoa undefined";var e="";if("string"==typeof t)e=t;else for(var n=0;n>8&255,i>>16&255,i>>24&255,0,0,0,0,54,0,0,0],a=[40,0,0,0,255&e,e>>8&255,e>>16&255,e>>24&255,255&n,n>>8&255,n>>16&255,n>>24&255,1,0,24,0,0,0,0,0,255&r,r>>8&255,r>>16&255,r>>24&255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],c=(4-3*e%4)%4,l=t.data,u="",d=e<<2,h=n,p=String.fromCharCode;do{for(var f=d*(h-1),g="",m=0;e>m;m++){var y=m<<2;g+=p(l[f+y+2])+p(l[f+y+1])+p(l[f+y])}for(var v=0;c>v;v++)g+=String.fromCharCode(0);u+=g}while(--h);var w=o(s.concat(a))+o(u);return w},d=function(r,o,d,h){if(c.canvas&&c.dataURL)if("string"==typeof r&&(r=document.getElementById(r)),void 0==h&&(h="png"),h=i(h),/bmp/.test(h)){var p=s(t(r,o,d)),f=u(p);n(a(f,l))}else{var f=e(r,h,o,d);n(f.replace(h,l))}},h=function(n,o,l,d){if(c.canvas&&c.dataURL){if("string"==typeof n&&(n=document.getElementById(n)),void 0==d&&(d="png"),d=i(d),/bmp/.test(d)){var h=s(t(n,o,l)),p=u(h);return r(a(p,"image/bmp"))}var p=e(n,d,o,l);return r(p)}};return{saveAsImage:d,saveAsPNG:function(t,e,n){return d(t,e,n,"png")},saveAsJPEG:function(t,e,n){return d(t,e,n,"jpeg")},saveAsGIF:function(t,e,n){return d(t,e,n,"gif")},saveAsBMP:function(t,e,n){return d(t,e,n,"bmp")},convertToImage:h,convertToPNG:function(t,e,n){return h(t,e,n,"png")},convertToJPEG:function(t,e,n){return h(t,e,n,"jpeg")},convertToGIF:function(t,e,n){return h(t,e,n,"gif")},convertToBMP:function(t,e,n){return h(t,e,n,"bmp")}}}();!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var e;"undefined"!=typeof window?e=window:"undefined"!=typeof global?e=global:"undefined"!=typeof self&&(e=self),e.html2canvas=t()}}(function(){var t;return function e(t,n,r){function i(s,a){if(!n[s]){if(!t[s]){var c="function"==typeof require&&require;if(!a&&c)return c(s,!0);if(o)return o(s,!0);var l=new Error("Cannot find module '"+s+"'");throw l.code="MODULE_NOT_FOUND",l}var u=n[s]={exports:{}};t[s][0].call(u.exports,function(e){var n=t[s][1][e];return i(n?n:e)},u,u.exports,e,t,n,r)}return n[s].exports}for(var o="function"==typeof require&&require,s=0;st;t+=2){var e=z[t],n=z[t+1];e(n),z[t]=void 0,z[t+1]=void 0}W=0}function p(){}function f(){return new TypeError("You cannot resolve a promise with itself")}function g(){return new TypeError("A promises callback cannot return that same promise.")}function m(t){try{return t.then}catch(e){return K.error=e,K}}function y(t,e,n,r){try{t.call(e,n,r)}catch(i){return i}}function v(t,e,n){F(function(t){var r=!1,i=y(n,e,function(n){r||(r=!0,e!==n?x(t,n):S(t,n))},function(e){r||(r=!0,T(t,e))},"Settle: "+(t._label||" unknown promise"));!r&&i&&(r=!0,T(t,i))},t)}function w(t,e){e._state===q?S(t,e._result):t._state===G?T(t,e._result):k(e,void 0,function(e){x(t,e)},function(e){T(t,e)})}function b(t,e){if(e.constructor===t.constructor)w(t,e);else{var n=m(e);n===K?T(t,K.error):void 0===n?S(t,e):o(n)?v(t,e,n):S(t,e)}}function x(t,e){t===e?T(t,f()):i(e)?b(t,e):S(t,e)}function E(t){t._onerror&&t._onerror(t._result),C(t)}function S(t,e){t._state===U&&(t._result=e,t._state=q,0===t._subscribers.length||F(C,t))}function T(t,e){t._state===U&&(t._state=G,t._result=e,F(E,t))}function k(t,e,n,r){var i=t._subscribers,o=i.length;t._onerror=null,i[o]=e,i[o+q]=n,i[o+G]=r,0===o&&t._state&&F(C,t)}function C(t){var e=t._subscribers,n=t._state;if(0!==e.length){for(var r,i,o=t._result,s=0;s1)throw new Error("Second argument not supported");if("object"!=typeof t)throw new TypeError("Argument must be an object");return a.prototype=t,new a},0),F=function(t,e){z[W]=t,z[W+1]=e,W+=2,2===W&&D()},H="undefined"!=typeof window?window:{},j=H.MutationObserver||H.WebKitMutationObserver,V="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel,z=new Array(1e3);D="undefined"!=typeof e&&"[object process]"==={}.toString.call(e)?c():j?l():V?u():d();var U=void 0,q=1,G=2,K=new L,X=new L;M.prototype._validateInput=function(t){return B(t)},M.prototype._validationError=function(){return new Error("Array Methods must be provided an Array")},M.prototype._init=function(){this._result=new Array(this.length)};var Y=M;M.prototype._enumerate=function(){for(var t=this.length,e=this.promise,n=this._input,r=0;e._state===U&&t>r;r++)this._eachEntry(n[r],r)},M.prototype._eachEntry=function(t,e){var n=this._instanceConstructor;s(t)?t.constructor===n&&t._state!==U?(t._onerror=null,this._settledAt(t._state,e,t._result)):this._willSettleAt(n.resolve(t),e):(this._remaining--,this._result[e]=this._makeResult(q,e,t))},M.prototype._settledAt=function(t,e,n){var r=this.promise;r._state===U&&(this._remaining--,this._abortOnReject&&t===G?T(r,n):this._result[e]=this._makeResult(t,e,n)),0===this._remaining&&S(r,this._result)},M.prototype._makeResult=function(t,e,n){return n},M.prototype._willSettleAt=function(t,e){var n=this;k(t,void 0,function(t){n._settledAt(q,e,t)},function(t){n._settledAt(G,e,t)})};var $=function(t,e){return new Y(this,t,!0,e).promise},J=function(t,e){function n(t){x(o,t)}function r(t){T(o,t)}var i=this,o=new i(p,e);if(!B(t))return T(o,new TypeError("You must pass an array to race.")),o;for(var s=t.length,a=0;o._state===U&&s>a;a++)k(i.resolve(t[a]),void 0,n,r);return o},Q=function(t,e){var n=this;if(t&&"object"==typeof t&&t.constructor===n)return t;var r=new n(p,e);return x(r,t),r},Z=function(t,e){var n=this,r=new n(p,e);return T(r,t),r},te=0,ee=P;P.all=$,P.race=J,P.resolve=Q,P.reject=Z,P.prototype={constructor:P,then:function(t,e){var n=this,r=n._state;if(r===q&&!t||r===G&&!e)return this;var i=new this.constructor(p),o=n._result;if(r){var s=arguments[r-1];F(function(){_(r,i,s,o)})}else k(n,i,t,e);return i},"catch":function(t){return this.then(null,t)}};var ne=function(){var t;t="undefined"!=typeof r?r:"undefined"!=typeof window&&window.document?window:self;var e="Promise"in t&&"resolve"in t.Promise&&"reject"in t.Promise&&"all"in t.Promise&&"race"in t.Promise&&function(){var e;return new t.Promise(function(t){e=t}),o(e)}();e||(t.Promise=ee)},re={Promise:ee,polyfill:ne};"function"==typeof t&&t.amd?t(function(){return re}):"undefined"!=typeof n&&n.exports?n.exports=re:"undefined"!=typeof this&&(this.ES6Promise=re)}).call(this)}).call(this,e("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{_process:2}],2:[function(t,e){function n(){if(!s){s=!0;for(var t,e=o.length;e;){t=o,o=[];for(var n=-1;++ni;)e=t.charCodeAt(i++),e>=55296&&56319>=e&&o>i?(n=t.charCodeAt(i++),56320==(64512&n)?r.push(((1023&e)<<10)+(1023&n)+65536):(r.push(e),i--)):r.push(e);return r}function l(t){return s(t,function(t){var e="";return t>65535&&(t-=65536,e+=B(t>>>10&1023|55296),t=56320|1023&t),e+=B(t)}).join("")}function u(t){return 10>t-48?t-22:26>t-65?t-65:26>t-97?t-97:S}function d(t,e){return t+22+75*(26>t)-((0!=e)<<5)}function h(t,e,n){var r=0;for(t=n?D(t/L):t>>1,t+=D(t/e);t>R*k>>1;r+=S)t=D(t/R);return D(r+(R+1)*t/(t+C))}function p(t){var e,n,r,i,s,a,c,d,p,f,g=[],m=t.length,y=0,v=_,w=I;for(n=t.lastIndexOf(N),0>n&&(n=0),r=0;n>r;++r)t.charCodeAt(r)>=128&&o("not-basic"),g.push(t.charCodeAt(r));for(i=n>0?n+1:0;m>i;){for(s=y,a=1,c=S;i>=m&&o("invalid-input"),d=u(t.charCodeAt(i++)),(d>=S||d>D((E-y)/a))&&o("overflow"),y+=d*a,p=w>=c?T:c>=w+k?k:c-w,!(p>d);c+=S)f=S-p,a>D(E/f)&&o("overflow"),a*=f;e=g.length+1,w=h(y-s,e,0==s),D(y/e)>E-v&&o("overflow"),v+=D(y/e),y%=e,g.splice(y++,0,v)}return l(g)}function f(t){var e,n,r,i,s,a,l,u,p,f,g,m,y,v,w,b=[];for(t=c(t),m=t.length,e=_,n=0,s=I,a=0;m>a;++a)g=t[a],128>g&&b.push(B(g));for(r=i=b.length,i&&b.push(N);m>r;){for(l=E,a=0;m>a;++a)g=t[a],g>=e&&l>g&&(l=g);for(y=r+1,l-e>D((E-n)/y)&&o("overflow"),n+=(l-e)*y,e=l,a=0;m>a;++a)if(g=t[a],e>g&&++n>E&&o("overflow"),g==e){for(u=n,p=S;f=s>=p?T:p>=s+k?k:p-s,!(f>u);p+=S)w=u-f,v=S-f,b.push(B(d(f+w%v,0))),u=D(w/v);b.push(B(d(u,0))),s=h(n,y,r==i),n=0,++r}++n,++e}return b.join("")}function g(t){return a(t,function(t){return M.test(t)?p(t.slice(4).toLowerCase()):t})}function m(t){return a(t,function(t){return A.test(t)?"xn--"+f(t):t})}var y="object"==typeof r&&r,v="object"==typeof n&&n&&n.exports==y&&n,w="object"==typeof e&&e;(w.global===w||w.window===w)&&(i=w);var b,x,E=2147483647,S=36,T=1,k=26,C=38,L=700,I=72,_=128,N="-",M=/^xn--/,A=/[^ -~]/,O=/\x2E|\u3002|\uFF0E|\uFF61/g,P={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},R=S-T,D=Math.floor,B=String.fromCharCode;if(b={version:"1.2.4",ucs2:{decode:c,encode:l},decode:p,encode:f,toASCII:m,toUnicode:g},"function"==typeof t&&"object"==typeof t.amd&&t.amd)t("punycode",function(){return b});else if(y&&!y.nodeType)if(v)v.exports=b;else for(x in b)b.hasOwnProperty(x)&&(y[x]=b[x]);else i.punycode=b}(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],4:[function(t,e){function n(t,e,n){!t.defaultView||e===t.defaultView.pageXOffset&&n===t.defaultView.pageYOffset||t.defaultView.scrollTo(e,n)}function r(t,e){try{e&&(e.width=t.width,e.height=t.height,e.getContext("2d").putImageData(t.getContext("2d").getImageData(0,0,t.width,t.height),0,0))}catch(n){s("Unable to copy canvas content from",t,n)}}function i(t,e){for(var n=3===t.nodeType?document.createTextNode(t.nodeValue):t.cloneNode(!1),o=t.firstChild;o;)(e===!0||1!==o.nodeType||"SCRIPT"!==o.nodeName)&&n.appendChild(i(o,e)),o=o.nextSibling;return 1===t.nodeType&&(n._scrollTop=t.scrollTop,n._scrollLeft=t.scrollLeft,"CANVAS"===t.nodeName?r(t,n):("TEXTAREA"===t.nodeName||"SELECT"===t.nodeName)&&(n.value=t.value)),n}function o(t){if(1===t.nodeType){t.scrollTop=t._scrollTop,t.scrollLeft=t._scrollLeft;for(var e=t.firstChild;e;)o(e),e=e.nextSibling}}var s=t("./log"),a=t("./promise");e.exports=function(t,e,r,s,c,l,u){var d=i(t.documentElement,c.javascriptEnabled),h=e.createElement("iframe");return h.className="html2canvas-container",h.style.visibility="hidden",h.style.position="fixed",h.style.left="-10000px",h.style.top="0px",h.style.border="0",h.width=r,h.height=s,h.scrolling="no",e.body.appendChild(h),new a(function(e){var r=h.contentWindow.document;h.contentWindow.onload=h.onload=function(){var t=setInterval(function(){r.body.childNodes.length>0&&(o(r.documentElement),clearInterval(t),"view"===c.type&&(h.contentWindow.scrollTo(l,u),!/(iPad|iPhone|iPod)/g.test(navigator.userAgent)||h.contentWindow.scrollY===u&&h.contentWindow.scrollX===l||(r.documentElement.style.top=-u+"px",r.documentElement.style.left=-l+"px",r.documentElement.style.position="absolute")),e(h))},50)},r.open(),r.write(""),n(t,l,u),r.replaceChild(r.adoptNode(d),r.documentElement),r.close()})}},{"./log":15,"./promise":18}],5:[function(t,e){function n(t){this.r=0,this.g=0,this.b=0,this.a=null;this.fromArray(t)||this.namedColor(t)||this.rgb(t)||this.rgba(t)||this.hex6(t)||this.hex3(t)}n.prototype.darken=function(t){var e=1-t;return new n([Math.round(this.r*e),Math.round(this.g*e),Math.round(this.b*e),this.a])},n.prototype.isTransparent=function(){return 0===this.a},n.prototype.isBlack=function(){return 0===this.r&&0===this.g&&0===this.b},n.prototype.fromArray=function(t){return Array.isArray(t)&&(this.r=Math.min(t[0],255),this.g=Math.min(t[1],255),this.b=Math.min(t[2],255),t.length>3&&(this.a=t[3])),Array.isArray(t)};var r=/^#([a-f0-9]{3})$/i;n.prototype.hex3=function(t){var e=null;return null!==(e=t.match(r))&&(this.r=parseInt(e[1][0]+e[1][0],16),this.g=parseInt(e[1][1]+e[1][1],16),this.b=parseInt(e[1][2]+e[1][2],16)),null!==e};var i=/^#([a-f0-9]{6})$/i;n.prototype.hex6=function(t){var e=null;return null!==(e=t.match(i))&&(this.r=parseInt(e[1].substring(0,2),16),this.g=parseInt(e[1].substring(2,4),16),this.b=parseInt(e[1].substring(4,6),16)),null!==e};var o=/^rgb\((\d{1,3}) *, *(\d{1,3}) *, *(\d{1,3})\)$/;n.prototype.rgb=function(t){var e=null;return null!==(e=t.match(o))&&(this.r=Number(e[1]),this.g=Number(e[2]),this.b=Number(e[3])),null!==e};var s=/^rgba\((\d{1,3}) *, *(\d{1,3}) *, *(\d{1,3}) *, *(\d+\.?\d*)\)$/;n.prototype.rgba=function(t){var e=null;return null!==(e=t.match(s))&&(this.r=Number(e[1]),this.g=Number(e[2]),this.b=Number(e[3]),this.a=Number(e[4])),null!==e},n.prototype.toString=function(){return null!==this.a&&1!==this.a?"rgba("+[this.r,this.g,this.b,this.a].join(",")+")":"rgb("+[this.r,this.g,this.b].join(",")+")"},n.prototype.namedColor=function(t){var e=a[t.toLowerCase()];if(e)this.r=e[0],this.g=e[1],this.b=e[2];else if("transparent"===t.toLowerCase())return this.r=this.g=this.b=this.a=0,!0;return!!e},n.prototype.isColor=!0;var a={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]}; 15 | e.exports=n},{}],6:[function(t,e){function n(t,e){var n=E++;if(e=e||{},e.logging&&(window.html2canvas.logging=!0,window.html2canvas.start=Date.now()),e.async="undefined"==typeof e.async?!0:e.async,e.allowTaint="undefined"==typeof e.allowTaint?!1:e.allowTaint,e.removeContainer="undefined"==typeof e.removeContainer?!0:e.removeContainer,e.javascriptEnabled="undefined"==typeof e.javascriptEnabled?!1:e.javascriptEnabled,e.imageTimeout="undefined"==typeof e.imageTimeout?1e4:e.imageTimeout,e.renderer="function"==typeof e.renderer?e.renderer:h,e.strict=!!e.strict,"string"==typeof t){if("string"!=typeof e.proxy)return u.reject("Proxy must be used when rendering url");var o=null!=e.width?e.width:window.innerWidth,s=null!=e.height?e.height:window.innerHeight;return w(l(t),e.proxy,document,o,s,e).then(function(t){return i(t.contentWindow.document.documentElement,t,e,o,s)})}var a=(void 0===t?[document.documentElement]:t.length?t:[t])[0];return a.setAttribute(x+n,n),r(a.ownerDocument,e,a.ownerDocument.defaultView.innerWidth,a.ownerDocument.defaultView.innerHeight,n).then(function(t){return"function"==typeof e.onrendered&&(m("options.onrendered is deprecated, html2canvas returns a Promise containing the canvas"),e.onrendered(t)),t})}function r(t,e,n,r,o){return v(t,t,n,r,e,t.defaultView.pageXOffset,t.defaultView.pageYOffset).then(function(s){m("Document cloned");var a=x+o,c="["+a+"='"+o+"']";t.querySelector(c).removeAttribute(a);var l=s.contentWindow,d=l.document.querySelector(c),h=u.resolve("function"==typeof e.onclone?e.onclone(l.document):!0);return h.then(function(){return i(d,s,e,n,r)})})}function i(t,e,n,r,i){var l=e.contentWindow,u=new d(l.document),h=new p(n,u),g=b(t),y="view"===n.type?r:a(l.document),v="view"===n.type?i:c(l.document),w=new n.renderer(y,v,h,n,document),x=new f(t,w,u,h,n);return x.ready.then(function(){m("Finished rendering");var r;return r="view"===n.type?s(w.canvas,{width:w.canvas.width,height:w.canvas.height,top:0,left:0,x:0,y:0}):t===l.document.body||t===l.document.documentElement||null!=n.canvas?w.canvas:s(w.canvas,{width:null!=n.width?n.width:g.width,height:null!=n.height?n.height:g.height,top:g.top,left:g.left,x:l.pageXOffset,y:l.pageYOffset}),o(e,n),r})}function o(t,e){e.removeContainer&&(t.parentNode.removeChild(t),m("Cleaned up container"))}function s(t,e){var n=document.createElement("canvas"),r=Math.min(t.width-1,Math.max(0,e.left)),i=Math.min(t.width,Math.max(1,e.left+e.width)),o=Math.min(t.height-1,Math.max(0,e.top)),s=Math.min(t.height,Math.max(1,e.top+e.height));return n.width=e.width,n.height=e.height,m("Cropping canvas at:","left:",e.left,"top:",e.top,"width:",i-r,"height:",s-o),m("Resulting crop with width",e.width,"and height",e.height," with x",r,"and y",o),n.getContext("2d").drawImage(t,r,o,i-r,s-o,e.x,e.y,i-r,s-o),n}function a(t){return Math.max(Math.max(t.body.scrollWidth,t.documentElement.scrollWidth),Math.max(t.body.offsetWidth,t.documentElement.offsetWidth),Math.max(t.body.clientWidth,t.documentElement.clientWidth))}function c(t){return Math.max(Math.max(t.body.scrollHeight,t.documentElement.scrollHeight),Math.max(t.body.offsetHeight,t.documentElement.offsetHeight),Math.max(t.body.clientHeight,t.documentElement.clientHeight))}function l(t){var e=document.createElement("a");return e.href=t,e.href=e.href,e}var u=t("./promise"),d=t("./support"),h=t("./renderers/canvas"),p=t("./imageloader"),f=t("./nodeparser"),g=t("./nodecontainer"),m=t("./log"),y=t("./utils"),v=t("./clone"),w=t("./proxy").loadUrlDocument,b=y.getBounds,x="data-html2canvas-node",E=0;n.Promise=u,n.CanvasRenderer=h,n.NodeContainer=g,n.log=m,n.utils=y,e.exports="undefined"==typeof document||"function"!=typeof Object.create||"function"!=typeof document.createElement("canvas").getContext?function(){return u.reject("No canvas support")}:n},{"./clone":4,"./imageloader":13,"./log":15,"./nodecontainer":16,"./nodeparser":17,"./promise":18,"./proxy":19,"./renderers/canvas":23,"./support":25,"./utils":29}],7:[function(t,e){function n(t){if(this.src=t,i("DummyImageContainer for",t),!this.promise||!this.image){i("Initiating DummyImageContainer"),n.prototype.image=new Image;var e=this.image;n.prototype.promise=new r(function(t,n){e.onload=t,e.onerror=n,e.src=o(),e.complete===!0&&t(e)})}}var r=t("./promise"),i=t("./log"),o=t("./utils").smallImage;e.exports=n},{"./log":15,"./promise":18,"./utils":29}],8:[function(t,e){function n(t,e){var n,i,o=document.createElement("div"),s=document.createElement("img"),a=document.createElement("span"),c="Hidden Text";o.style.visibility="hidden",o.style.fontFamily=t,o.style.fontSize=e,o.style.margin=0,o.style.padding=0,document.body.appendChild(o),s.src=r(),s.width=1,s.height=1,s.style.margin=0,s.style.padding=0,s.style.verticalAlign="baseline",a.style.fontFamily=t,a.style.fontSize=e,a.style.margin=0,a.style.padding=0,a.appendChild(document.createTextNode(c)),o.appendChild(a),o.appendChild(s),n=s.offsetTop-a.offsetTop+1,o.removeChild(a),o.appendChild(document.createTextNode(c)),o.style.lineHeight="normal",s.style.verticalAlign="super",i=s.offsetTop-o.offsetTop+1,document.body.removeChild(o),this.baseline=n,this.lineWidth=1,this.middle=i}var r=t("./utils").smallImage;e.exports=n},{"./utils":29}],9:[function(t,e){function n(){this.data={}}var r=t("./font");n.prototype.getMetrics=function(t,e){return void 0===this.data[t+"-"+e]&&(this.data[t+"-"+e]=new r(t,e)),this.data[t+"-"+e]},e.exports=n},{"./font":8}],10:[function(t,e){function n(e,n,r){this.image=null,this.src=e;var s=this,a=o(e);this.promise=(n?new i(function(t){"about:blank"===e.contentWindow.document.URL||null==e.contentWindow.document.documentElement?e.contentWindow.onload=e.onload=function(){t(e)}:t(e)}):this.proxyLoad(r.proxy,a,r)).then(function(e){var n=t("./core");return n(e.contentWindow.document.documentElement,{type:"view",width:e.width,height:e.height,proxy:r.proxy,javascriptEnabled:r.javascriptEnabled,removeContainer:r.removeContainer,allowTaint:r.allowTaint,imageTimeout:r.imageTimeout/2})}).then(function(t){return s.image=t})}var r=t("./utils"),i=t("./promise"),o=r.getBounds,s=t("./proxy").loadUrlDocument;n.prototype.proxyLoad=function(t,e,n){var r=this.src;return s(r.src,t,r.ownerDocument,e.width,e.height,n)},e.exports=n},{"./core":6,"./promise":18,"./proxy":19,"./utils":29}],11:[function(t,e){function n(t){this.src=t.value,this.colorStops=[],this.type=null,this.x0=.5,this.y0=.5,this.x1=.5,this.y1=.5,this.promise=r.resolve(!0)}var r=t("./promise");n.prototype.TYPES={LINEAR:1,RADIAL:2},e.exports=n},{"./promise":18}],12:[function(t,e){function n(t,e){this.src=t,this.image=new Image;var n=this;this.tainted=null,this.promise=new r(function(r,i){n.image.onload=r,n.image.onerror=i,e&&(n.image.crossOrigin="anonymous"),n.image.src=t,n.image.complete===!0&&r(n.image)})}var r=t("./promise");e.exports=n},{"./promise":18}],13:[function(t,e){function n(t,e){this.link=null,this.options=t,this.support=e,this.origin=this.getOrigin(window.location.href)}var r=t("./promise"),i=t("./log"),o=t("./imagecontainer"),s=t("./dummyimagecontainer"),a=t("./proxyimagecontainer"),c=t("./framecontainer"),l=t("./svgcontainer"),u=t("./svgnodecontainer"),d=t("./lineargradientcontainer"),h=t("./webkitgradientcontainer"),p=t("./utils").bind;n.prototype.findImages=function(t){var e=[];return t.reduce(function(t,e){switch(e.node.nodeName){case"IMG":return t.concat([{args:[e.node.src],method:"url"}]);case"svg":case"IFRAME":return t.concat([{args:[e.node],method:e.node.nodeName}])}return t},[]).forEach(this.addImage(e,this.loadImage),this),e},n.prototype.findBackgroundImage=function(t,e){return e.parseBackgroundImages().filter(this.hasImageBackground).forEach(this.addImage(t,this.loadImage),this),t},n.prototype.addImage=function(t,e){return function(n){n.args.forEach(function(r){this.imageExists(t,r)||(t.splice(0,0,e.call(this,n)),i("Added image #"+t.length,"string"==typeof r?r.substring(0,100):r))},this)}},n.prototype.hasImageBackground=function(t){return"none"!==t.method},n.prototype.loadImage=function(t){if("url"===t.method){var e=t.args[0];return!this.isSVG(e)||this.support.svg||this.options.allowTaint?e.match(/data:image\/.*;base64,/i)?new o(e.replace(/url\(['"]{0,}|['"]{0,}\)$/gi,""),!1):this.isSameOrigin(e)||this.options.allowTaint===!0||this.isSVG(e)?new o(e,!1):this.support.cors&&!this.options.allowTaint&&this.options.useCORS?new o(e,!0):this.options.proxy?new a(e,this.options.proxy):new s(e):new l(e)}return"linear-gradient"===t.method?new d(t):"gradient"===t.method?new h(t):"svg"===t.method?new u(t.args[0],this.support.svg):"IFRAME"===t.method?new c(t.args[0],this.isSameOrigin(t.args[0].src),this.options):new s(t)},n.prototype.isSVG=function(t){return"svg"===t.substring(t.length-3).toLowerCase()||l.prototype.isInline(t)},n.prototype.imageExists=function(t,e){return t.some(function(t){return t.src===e})},n.prototype.isSameOrigin=function(t){return this.getOrigin(t)===this.origin},n.prototype.getOrigin=function(t){var e=this.link||(this.link=document.createElement("a"));return e.href=t,e.href=e.href,e.protocol+e.hostname+e.port},n.prototype.getPromise=function(t){return this.timeout(t,this.options.imageTimeout)["catch"](function(){var e=new s(t.src);return e.promise.then(function(e){t.image=e})})},n.prototype.get=function(t){var e=null;return this.images.some(function(n){return(e=n).src===t})?e:null},n.prototype.fetch=function(t){return this.images=t.reduce(p(this.findBackgroundImage,this),this.findImages(t)),this.images.forEach(function(t,e){t.promise.then(function(){i("Succesfully loaded image #"+(e+1),t)},function(n){i("Failed loading image #"+(e+1),t,n)})}),this.ready=r.all(this.images.map(this.getPromise,this)),i("Finished searching images"),this},n.prototype.timeout=function(t,e){var n,o=r.race([t.promise,new r(function(r,o){n=setTimeout(function(){i("Timed out loading image",t),o(t)},e)})]).then(function(t){return clearTimeout(n),t});return o["catch"](function(){clearTimeout(n)}),o},e.exports=n},{"./dummyimagecontainer":7,"./framecontainer":10,"./imagecontainer":12,"./lineargradientcontainer":14,"./log":15,"./promise":18,"./proxyimagecontainer":20,"./svgcontainer":26,"./svgnodecontainer":27,"./utils":29,"./webkitgradientcontainer":30}],14:[function(t,e){function n(t){r.apply(this,arguments),this.type=this.TYPES.LINEAR;var e=null===t.args[0].match(this.stepRegExp);e?t.args[0].split(" ").reverse().forEach(function(t){switch(t){case"left":this.x0=0,this.x1=1;break;case"top":this.y0=0,this.y1=1;break;case"right":this.x0=1,this.x1=0;break;case"bottom":this.y0=1,this.y1=0;break;case"to":var e=this.y0,n=this.x0;this.y0=this.y1,this.x0=this.x1,this.x1=n,this.y1=e}},this):(this.y0=0,this.y1=1),this.colorStops=t.args.slice(e?1:0).map(function(t){var e=t.match(/((?:rgb|rgba)\(\d{1,3},\s\d{1,3},\s\d{1,3}(?:,\s[0-9\.]+)?\)|\w+)\s*(\d{1,3})?(%|px)?/);return{color:new i(e[1]),stop:"%"===e[3]?e[2]/100:null}},this),null===this.colorStops[0].stop&&(this.colorStops[0].stop=0),null===this.colorStops[this.colorStops.length-1].stop&&(this.colorStops[this.colorStops.length-1].stop=1),this.colorStops.forEach(function(t,e){null===t.stop&&this.colorStops.slice(e).some(function(n,r){return null!==n.stop?(t.stop=(n.stop-this.colorStops[e-1].stop)/(r+1)+this.colorStops[e-1].stop,!0):!1},this)},this)}var r=t("./gradientcontainer"),i=t("./color");n.prototype=Object.create(r.prototype),n.prototype.stepRegExp=/((?:rgb|rgba)\(\d{1,3},\s\d{1,3},\s\d{1,3}(?:,\s[0-9\.]+)?\))\s*(\d{1,3})?(%|px)?/,e.exports=n},{"./color":5,"./gradientcontainer":11}],15:[function(t,e){e.exports=function(){window.html2canvas.logging&&window.console&&window.console.log&&Function.prototype.bind.call(window.console.log,window.console).apply(window.console,[Date.now()-window.html2canvas.start+"ms","html2canvas:"].concat([].slice.call(arguments,0)))}},{}],16:[function(t,e){function n(t,e){this.node=t,this.parent=e,this.stack=null,this.bounds=null,this.borders=null,this.clip=[],this.backgroundClip=[],this.offsetBounds=null,this.visible=null,this.computedStyles=null,this.colors={},this.styles={},this.backgroundImages=null,this.transformData=null,this.transformMatrix=null,this.isPseudoElement=!1,this.opacity=null}function r(t){var e=t.options[t.selectedIndex||0];return e?e.text||"":""}function i(t){if(t&&"matrix"===t[1])return t[2].split(",").map(function(t){return parseFloat(t.trim())});if(t&&"matrix3d"===t[1]){var e=t[2].split(",").map(function(t){return parseFloat(t.trim())});return[e[0],e[1],e[4],e[5],e[12],e[13]]}}function o(t){return-1!==t.toString().indexOf("%")}function s(t){return t.replace("px","")}function a(t){return parseFloat(t)}var c=t("./color"),l=t("./utils"),u=l.getBounds,d=l.parseBackgrounds,h=l.offsetBounds;n.prototype.cloneTo=function(t){t.visible=this.visible,t.borders=this.borders,t.bounds=this.bounds,t.clip=this.clip,t.backgroundClip=this.backgroundClip,t.computedStyles=this.computedStyles,t.styles=this.styles,t.backgroundImages=this.backgroundImages,t.opacity=this.opacity},n.prototype.getOpacity=function(){return null===this.opacity?this.opacity=this.cssFloat("opacity"):this.opacity},n.prototype.assignStack=function(t){this.stack=t,t.children.push(this)},n.prototype.isElementVisible=function(){return this.node.nodeType===Node.TEXT_NODE?this.parent.visible:"none"!==this.css("display")&&"hidden"!==this.css("visibility")&&!this.node.hasAttribute("data-html2canvas-ignore")&&("INPUT"!==this.node.nodeName||"hidden"!==this.node.getAttribute("type"))},n.prototype.css=function(t){return this.computedStyles||(this.computedStyles=this.isPseudoElement?this.parent.computedStyle(this.before?":before":":after"):this.computedStyle(null)),this.styles[t]||(this.styles[t]=this.computedStyles[t])},n.prototype.prefixedCss=function(t){var e=["webkit","moz","ms","o"],n=this.css(t);return void 0===n&&e.some(function(e){return n=this.css(e+t.substr(0,1).toUpperCase()+t.substr(1)),void 0!==n},this),void 0===n?null:n},n.prototype.computedStyle=function(t){return this.node.ownerDocument.defaultView.getComputedStyle(this.node,t)},n.prototype.cssInt=function(t){var e=parseInt(this.css(t),10);return isNaN(e)?0:e},n.prototype.color=function(t){return this.colors[t]||(this.colors[t]=new c(this.css(t)))},n.prototype.cssFloat=function(t){var e=parseFloat(this.css(t));return isNaN(e)?0:e},n.prototype.fontWeight=function(){var t=this.css("fontWeight");switch(parseInt(t,10)){case 401:t="bold";break;case 400:t="normal"}return t},n.prototype.parseClip=function(){var t=this.css("clip").match(this.CLIP);return t?{top:parseInt(t[1],10),right:parseInt(t[2],10),bottom:parseInt(t[3],10),left:parseInt(t[4],10)}:null},n.prototype.parseBackgroundImages=function(){return this.backgroundImages||(this.backgroundImages=d(this.css("backgroundImage")))},n.prototype.cssList=function(t,e){var n=(this.css(t)||"").split(",");return n=n[e||0]||n[0]||"auto",n=n.trim().split(" "),1===n.length&&(n=[n[0],o(n[0])?"auto":n[0]]),n},n.prototype.parseBackgroundSize=function(t,e,n){var r,i,s=this.cssList("backgroundSize",n);if(o(s[0]))r=t.width*parseFloat(s[0])/100;else{if(/contain|cover/.test(s[0])){var a=t.width/t.height,c=e.width/e.height;return c>a^"contain"===s[0]?{width:t.height*c,height:t.height}:{width:t.width,height:t.width/c}}r=parseInt(s[0],10)}return i="auto"===s[0]&&"auto"===s[1]?e.height:"auto"===s[1]?r/e.width*e.height:o(s[1])?t.height*parseFloat(s[1])/100:parseInt(s[1],10),"auto"===s[0]&&(r=i/e.height*e.width),{width:r,height:i}},n.prototype.parseBackgroundPosition=function(t,e,n,r){var i,s,a=this.cssList("backgroundPosition",n);return i=o(a[0])?(t.width-(r||e).width)*(parseFloat(a[0])/100):parseInt(a[0],10),s="auto"===a[1]?i/e.width*e.height:o(a[1])?(t.height-(r||e).height)*parseFloat(a[1])/100:parseInt(a[1],10),"auto"===a[0]&&(i=s/e.height*e.width),{left:i,top:s}},n.prototype.parseBackgroundRepeat=function(t){return this.cssList("backgroundRepeat",t)[0]},n.prototype.parseTextShadows=function(){var t=this.css("textShadow"),e=[];if(t&&"none"!==t)for(var n=t.match(this.TEXT_SHADOW_PROPERTY),r=0;n&&r0?(this.renderIndex=0,this.asyncRenderer(this.renderQueue,t)):t():(this.renderQueue.forEach(this.paint,this),t())},this))},this))}function r(t){return t.parent&&t.parent.clip.length}function i(t){return t.replace(/(\-[a-z])/g,function(t){return t.toUpperCase().replace("-","")})}function o(){}function s(t,e,n,r){return t.map(function(i,o){if(i.width>0){var s=e.left,a=e.top,c=e.width,l=e.height-t[2].width;switch(o){case 0:l=t[0].width,i.args=u({c1:[s,a],c2:[s+c,a],c3:[s+c-t[1].width,a+l],c4:[s+t[3].width,a+l]},r[0],r[1],n.topLeftOuter,n.topLeftInner,n.topRightOuter,n.topRightInner);break;case 1:s=e.left+e.width-t[1].width,c=t[1].width,i.args=u({c1:[s+c,a],c2:[s+c,a+l+t[2].width],c3:[s,a+l],c4:[s,a+t[0].width]},r[1],r[2],n.topRightOuter,n.topRightInner,n.bottomRightOuter,n.bottomRightInner);break;case 2:a=a+e.height-t[2].width,l=t[2].width,i.args=u({c1:[s+c,a+l],c2:[s,a+l],c3:[s+t[3].width,a],c4:[s+c-t[3].width,a]},r[2],r[3],n.bottomRightOuter,n.bottomRightInner,n.bottomLeftOuter,n.bottomLeftInner);break;case 3:c=t[3].width,i.args=u({c1:[s,a+l+t[2].width],c2:[s,a],c3:[s+c,a+t[0].width],c4:[s+c,a+l]},r[3],r[0],n.bottomLeftOuter,n.bottomLeftInner,n.topLeftOuter,n.topLeftInner)}}return i})}function a(t,e,n,r){var i=4*((Math.sqrt(2)-1)/3),o=n*i,s=r*i,a=t+n,c=e+r;return{topLeft:l({x:t,y:c},{x:t,y:c-s},{x:a-o,y:e},{x:a,y:e}),topRight:l({x:t,y:e},{x:t+o,y:e},{x:a,y:c-s},{x:a,y:c}),bottomRight:l({x:a,y:e},{x:a,y:e+s},{x:t+o,y:c},{x:t,y:c}),bottomLeft:l({x:a,y:c},{x:a-o,y:c},{x:t,y:e+s},{x:t,y:e})}}function c(t,e,n){var r=t.left,i=t.top,o=t.width,s=t.height,c=e[0][0],l=e[0][1],u=e[1][0],d=e[1][1],h=e[2][0],p=e[2][1],f=e[3][0],g=e[3][1],m=o-u,y=s-p,v=o-h,w=s-g;return{topLeftOuter:a(r,i,c,l).topLeft.subdivide(.5),topLeftInner:a(r+n[3].width,i+n[0].width,Math.max(0,c-n[3].width),Math.max(0,l-n[0].width)).topLeft.subdivide(.5),topRightOuter:a(r+m,i,u,d).topRight.subdivide(.5),topRightInner:a(r+Math.min(m,o+n[3].width),i+n[0].width,m>o+n[3].width?0:u-n[3].width,d-n[0].width).topRight.subdivide(.5),bottomRightOuter:a(r+v,i+y,h,p).bottomRight.subdivide(.5),bottomRightInner:a(r+Math.min(v,o-n[3].width),i+Math.min(y,s+n[0].width),Math.max(0,h-n[1].width),p-n[2].width).bottomRight.subdivide(.5),bottomLeftOuter:a(r,i+w,f,g).bottomLeft.subdivide(.5),bottomLeftInner:a(r+n[3].width,i+w,Math.max(0,f-n[3].width),g-n[2].width).bottomLeft.subdivide(.5)}}function l(t,e,n,r){var i=function(t,e,n){return{x:t.x+(e.x-t.x)*n,y:t.y+(e.y-t.y)*n}};return{start:t,startControl:e,endControl:n,end:r,subdivide:function(o){var s=i(t,e,o),a=i(e,n,o),c=i(n,r,o),u=i(s,a,o),d=i(a,c,o),h=i(u,d,o);return[l(t,s,u,h),l(h,d,c,r)]},curveTo:function(t){t.push(["bezierCurve",e.x,e.y,n.x,n.y,r.x,r.y])},curveToReversed:function(r){r.push(["bezierCurve",n.x,n.y,e.x,e.y,t.x,t.y])}}}function u(t,e,n,r,i,o,s){var a=[];return e[0]>0||e[1]>0?(a.push(["line",r[1].start.x,r[1].start.y]),r[1].curveTo(a)):a.push(["line",t.c1[0],t.c1[1]]),n[0]>0||n[1]>0?(a.push(["line",o[0].start.x,o[0].start.y]),o[0].curveTo(a),a.push(["line",s[0].end.x,s[0].end.y]),s[0].curveToReversed(a)):(a.push(["line",t.c2[0],t.c2[1]]),a.push(["line",t.c3[0],t.c3[1]])),e[0]>0||e[1]>0?(a.push(["line",i[1].end.x,i[1].end.y]),i[1].curveToReversed(a)):a.push(["line",t.c4[0],t.c4[1]]),a}function d(t,e,n,r,i,o,s){e[0]>0||e[1]>0?(t.push(["line",r[0].start.x,r[0].start.y]),r[0].curveTo(t),r[1].curveTo(t)):t.push(["line",o,s]),(n[0]>0||n[1]>0)&&t.push(["line",i[0].start.x,i[0].start.y])}function h(t){return t.cssInt("zIndex")<0}function p(t){return t.cssInt("zIndex")>0}function f(t){return 0===t.cssInt("zIndex")}function g(t){return-1!==["inline","inline-block","inline-table"].indexOf(t.css("display"))}function m(t){return t instanceof K}function y(t){return t.node.data.trim().length>0}function v(t){return/^(normal|none|0px)$/.test(t.parent.css("letterSpacing"))}function w(t){return["TopLeft","TopRight","BottomRight","BottomLeft"].map(function(e){var n=t.css("border"+e+"Radius"),r=n.split(" ");return r.length<=1&&(r[1]=r[0]),r.map(M)})}function b(t){return t.nodeType===Node.TEXT_NODE||t.nodeType===Node.ELEMENT_NODE}function x(t){var e=t.css("position"),n=-1!==["absolute","relative","fixed"].indexOf(e)?t.css("zIndex"):"auto";return"auto"!==n}function E(t){return"static"!==t.css("position")}function S(t){return"none"!==t.css("float")}function T(t){return-1!==["inline-block","inline-table"].indexOf(t.css("display"))}function k(t){var e=this;return function(){return!t.apply(e,arguments)}}function C(t){return t.node.nodeType===Node.ELEMENT_NODE}function L(t){return t.isPseudoElement===!0}function I(t){return t.node.nodeType===Node.TEXT_NODE}function _(t){return function(e,n){return e.cssInt("zIndex")+t.indexOf(e)/t.length-(n.cssInt("zIndex")+t.indexOf(n)/t.length)}}function N(t){return t.getOpacity()<1}function M(t){return parseInt(t,10)}function A(t){return t.width}function O(t){return t.node.nodeType!==Node.ELEMENT_NODE||-1===["SCRIPT","HEAD","TITLE","OBJECT","BR","OPTION"].indexOf(t.node.nodeName)}function P(t){return[].concat.apply([],t)}function R(t){var e=t.substr(0,1);return e===t.substr(t.length-1)&&e.match(/'|"/)?t.substr(1,t.length-2):t}function D(t){for(var e,n=[],r=0,i=!1;t.length;)B(t[r])===i?(e=t.splice(0,r),e.length&&n.push(H.ucs2.encode(e)),i=!i,r=0):r++,r>=t.length&&(e=t.splice(0,r),e.length&&n.push(H.ucs2.encode(e)));return n}function B(t){return-1!==[32,13,10,9,45].indexOf(t)}function W(t){return/[^\u0000-\u00ff]/.test(t)}var F=t("./log"),H=t("punycode"),j=t("./nodecontainer"),V=t("./textcontainer"),z=t("./pseudoelementcontainer"),U=t("./fontmetrics"),q=t("./color"),G=t("./promise"),K=t("./stackingcontext"),X=t("./utils"),Y=X.bind,$=X.getBounds,J=X.parseBackgrounds,Q=X.offsetBounds;n.prototype.calculateOverflowClips=function(){this.nodes.forEach(function(t){if(C(t)){L(t)&&t.appendToDOM(),t.borders=this.parseBorders(t);var e="hidden"===t.css("overflow")?[t.borders.clip]:[],n=t.parseClip();n&&-1!==["absolute","fixed"].indexOf(t.css("position"))&&e.push([["rect",t.bounds.left+n.left,t.bounds.top+n.top,n.right-n.left,n.bottom-n.top]]),t.clip=r(t)?t.parent.clip.concat(e):e,t.backgroundClip="hidden"!==t.css("overflow")?t.clip.concat([t.borders.clip]):t.clip,L(t)&&t.cleanDOM()}else I(t)&&(t.clip=r(t)?t.parent.clip:[]);L(t)||(t.bounds=null)},this)},n.prototype.asyncRenderer=function(t,e,n){n=n||Date.now(),this.paint(t[this.renderIndex++]),t.length===this.renderIndex?e():n+20>Date.now()?this.asyncRenderer(t,e,n):setTimeout(Y(function(){this.asyncRenderer(t,e)},this),0)},n.prototype.createPseudoHideStyles=function(t){this.createStyles(t,"."+z.prototype.PSEUDO_HIDE_ELEMENT_CLASS_BEFORE+':before { content: "" !important; display: none !important; }.'+z.prototype.PSEUDO_HIDE_ELEMENT_CLASS_AFTER+':after { content: "" !important; display: none !important; }')},n.prototype.disableAnimations=function(t){this.createStyles(t,"* { -webkit-animation: none !important; -moz-animation: none !important; -o-animation: none !important; animation: none !important; -webkit-transition: none !important; -moz-transition: none !important; -o-transition: none !important; transition: none !important;}")},n.prototype.createStyles=function(t,e){var n=t.createElement("style");n.innerHTML=e,t.body.appendChild(n)},n.prototype.getPseudoElements=function(t){var e=[[t]];if(t.node.nodeType===Node.ELEMENT_NODE){var n=this.getPseudoElement(t,":before"),r=this.getPseudoElement(t,":after");n&&e.push(n),r&&e.push(r)}return P(e)},n.prototype.getPseudoElement=function(t,e){var n=t.computedStyle(e);if(!n||!n.content||"none"===n.content||"-moz-alt-content"===n.content||"none"===n.display)return null;for(var r=R(n.content),o="url"===r.substr(0,3),s=document.createElement(o?"img":"html2canvaspseudoelement"),a=new z(s,t,e),c=n.length-1;c>=0;c--){var l=i(n.item(c));s.style[l]=n[l]}if(s.className=z.prototype.PSEUDO_HIDE_ELEMENT_CLASS_BEFORE+" "+z.prototype.PSEUDO_HIDE_ELEMENT_CLASS_AFTER,o)return s.src=J(r)[0].args[0],[a];var u=document.createTextNode(r);return s.appendChild(u),[a,new V(u,a)]},n.prototype.getChildren=function(t){return P([].filter.call(t.node.childNodes,b).map(function(e){var n=[e.nodeType===Node.TEXT_NODE?new V(e,t):new j(e,t)].filter(O);return e.nodeType===Node.ELEMENT_NODE&&n.length&&"TEXTAREA"!==e.tagName?n[0].isElementVisible()?n.concat(this.getChildren(n[0])):[]:n},this))},n.prototype.newStackingContext=function(t,e){var n=new K(e,t.getOpacity(),t.node,t.parent);t.cloneTo(n);var r=e?n.getParentStack(this):n.parent.stack;r.contexts.push(n),t.stack=n},n.prototype.createStackingContexts=function(){this.nodes.forEach(function(t){C(t)&&(this.isRootElement(t)||N(t)||x(t)||this.isBodyWithTransparentRoot(t)||t.hasTransform())?this.newStackingContext(t,!0):C(t)&&(E(t)&&f(t)||T(t)||S(t))?this.newStackingContext(t,!1):t.assignStack(t.parent.stack)},this)},n.prototype.isBodyWithTransparentRoot=function(t){return"BODY"===t.node.nodeName&&t.parent.color("backgroundColor").isTransparent()},n.prototype.isRootElement=function(t){return null===t.parent},n.prototype.sortStackingContexts=function(t){t.contexts.sort(_(t.contexts.slice(0))),t.contexts.forEach(this.sortStackingContexts,this)},n.prototype.parseTextBounds=function(t){return function(e,n,r){if("none"!==t.parent.css("textDecoration").substr(0,4)||0!==e.trim().length){if(this.support.rangeBounds&&!t.parent.hasTransform()){var i=r.slice(0,n).join("").length;return this.getRangeBounds(t.node,i,e.length)}if(t.node&&"string"==typeof t.node.data){var o=t.node.splitText(e.length),s=this.getWrapperBounds(t.node,t.parent.hasTransform());return t.node=o,s}}else(!this.support.rangeBounds||t.parent.hasTransform())&&(t.node=t.node.splitText(e.length));return{}}},n.prototype.getWrapperBounds=function(t,e){var n=t.ownerDocument.createElement("html2canvaswrapper"),r=t.parentNode,i=t.cloneNode(!0);n.appendChild(t.cloneNode(!0)),r.replaceChild(n,t);var o=e?Q(n):$(n);return r.replaceChild(i,n),o},n.prototype.getRangeBounds=function(t,e,n){var r=this.range||(this.range=t.ownerDocument.createRange());return r.setStart(t,e),r.setEnd(t,e+n),r.getBoundingClientRect()},n.prototype.parse=function(t){var e=t.contexts.filter(h),n=t.children.filter(C),r=n.filter(k(S)),i=r.filter(k(E)).filter(k(g)),s=n.filter(k(E)).filter(S),a=r.filter(k(E)).filter(g),c=t.contexts.concat(r.filter(E)).filter(f),l=t.children.filter(I).filter(y),u=t.contexts.filter(p);e.concat(i).concat(s).concat(a).concat(c).concat(l).concat(u).forEach(function(t){this.renderQueue.push(t),m(t)&&(this.parse(t),this.renderQueue.push(new o))},this)},n.prototype.paint=function(t){try{t instanceof o?this.renderer.ctx.restore():I(t)?(L(t.parent)&&t.parent.appendToDOM(),this.paintText(t),L(t.parent)&&t.parent.cleanDOM()):this.paintNode(t)}catch(e){if(F(e),this.options.strict)throw e}},n.prototype.paintNode=function(t){m(t)&&(this.renderer.setOpacity(t.opacity),this.renderer.ctx.save(),t.hasTransform()&&this.renderer.setTransform(t.parseTransform())),"INPUT"===t.node.nodeName&&"checkbox"===t.node.type?this.paintCheckbox(t):"INPUT"===t.node.nodeName&&"radio"===t.node.type?this.paintRadio(t):this.paintElement(t)},n.prototype.paintElement=function(t){var e=t.parseBounds();this.renderer.clip(t.backgroundClip,function(){this.renderer.renderBackground(t,e,t.borders.borders.map(A))},this),this.renderer.clip(t.clip,function(){this.renderer.renderBorders(t.borders.borders)},this),this.renderer.clip(t.backgroundClip,function(){switch(t.node.nodeName){case"svg":case"IFRAME":var n=this.images.get(t.node);n?this.renderer.renderImage(t,e,t.borders,n):F("Error loading <"+t.node.nodeName+">",t.node);break;case"IMG":var r=this.images.get(t.node.src);r?this.renderer.renderImage(t,e,t.borders,r):F("Error loading ",t.node.src);break;case"CANVAS":this.renderer.renderImage(t,e,t.borders,{image:t.node});break;case"SELECT":case"INPUT":case"TEXTAREA":this.paintFormValue(t)}},this)},n.prototype.paintCheckbox=function(t){var e=t.parseBounds(),n=Math.min(e.width,e.height),r={width:n-1,height:n-1,top:e.top,left:e.left},i=[3,3],o=[i,i,i,i],a=[1,1,1,1].map(function(t){return{color:new q("#A5A5A5"),width:t}}),l=c(r,o,a);this.renderer.clip(t.backgroundClip,function(){this.renderer.rectangle(r.left+1,r.top+1,r.width-2,r.height-2,new q("#DEDEDE")),this.renderer.renderBorders(s(a,r,l,o)),t.node.checked&&(this.renderer.font(new q("#424242"),"normal","normal","bold",n-3+"px","arial"),this.renderer.text("✔",r.left+n/6,r.top+n-1))},this)},n.prototype.paintRadio=function(t){var e=t.parseBounds(),n=Math.min(e.width,e.height)-2;this.renderer.clip(t.backgroundClip,function(){this.renderer.circleStroke(e.left+1,e.top+1,n,new q("#DEDEDE"),1,new q("#A5A5A5")),t.node.checked&&this.renderer.circle(Math.ceil(e.left+n/4)+1,Math.ceil(e.top+n/4)+1,Math.floor(n/2),new q("#424242"))},this)},n.prototype.paintFormValue=function(t){var e=t.getValue();if(e.length>0){var n=t.node.ownerDocument,r=n.createElement("html2canvaswrapper"),i=["lineHeight","textAlign","fontFamily","fontWeight","fontSize","color","paddingLeft","paddingTop","paddingRight","paddingBottom","width","height","borderLeftStyle","borderTopStyle","borderLeftWidth","borderTopWidth","boxSizing","whiteSpace","wordWrap"]; 16 | i.forEach(function(e){try{r.style[e]=t.css(e)}catch(n){F("html2canvas: Parse: Exception caught in renderFormValue: "+n.message)}});var o=t.parseBounds();r.style.position="fixed",r.style.left=o.left+"px",r.style.top=o.top+"px",r.textContent=e,n.body.appendChild(r),this.paintText(new V(r.firstChild,t)),n.body.removeChild(r)}},n.prototype.paintText=function(t){t.applyTextTransform();var e=H.ucs2.decode(t.node.data),n=this.options.letterRendering&&!v(t)||W(t.node.data)?e.map(function(t){return H.ucs2.encode([t])}):D(e),r=t.parent.fontWeight(),i=t.parent.css("fontSize"),o=t.parent.css("fontFamily"),s=t.parent.parseTextShadows();this.renderer.font(t.parent.color("color"),t.parent.css("fontStyle"),t.parent.css("fontVariant"),r,i,o),s.length?this.renderer.fontShadow(s[0].color,s[0].offsetX,s[0].offsetY,s[0].blur):this.renderer.clearShadow(),this.renderer.clip(t.parent.clip,function(){n.map(this.parseTextBounds(t),this).forEach(function(e,r){e&&(this.renderer.text(n[r],e.left,e.bottom),this.renderTextDecoration(t.parent,e,this.fontMetrics.getMetrics(o,i)))},this)},this)},n.prototype.renderTextDecoration=function(t,e,n){switch(t.css("textDecoration").split(" ")[0]){case"underline":this.renderer.rectangle(e.left,Math.round(e.top+n.baseline+n.lineWidth),e.width,1,t.color("color"));break;case"overline":this.renderer.rectangle(e.left,Math.round(e.top),e.width,1,t.color("color"));break;case"line-through":this.renderer.rectangle(e.left,Math.ceil(e.top+n.middle+n.lineWidth),e.width,1,t.color("color"))}};var Z={inset:[["darken",.6],["darken",.1],["darken",.1],["darken",.6]]};n.prototype.parseBorders=function(t){var e=t.parseBounds(),n=w(t),r=["Top","Right","Bottom","Left"].map(function(e,n){var r=t.css("border"+e+"Style"),i=t.color("border"+e+"Color");"inset"===r&&i.isBlack()&&(i=new q([255,255,255,i.a]));var o=Z[r]?Z[r][n]:null;return{width:t.cssInt("border"+e+"Width"),color:o?i[o[0]](o[1]):i,args:null}}),i=c(e,n,r);return{clip:this.parseBackgroundClip(t,i,r,n,e),borders:s(r,e,i,n)}},n.prototype.parseBackgroundClip=function(t,e,n,r,i){var o=t.css("backgroundClip"),s=[];switch(o){case"content-box":case"padding-box":d(s,r[0],r[1],e.topLeftInner,e.topRightInner,i.left+n[3].width,i.top+n[0].width),d(s,r[1],r[2],e.topRightInner,e.bottomRightInner,i.left+i.width-n[1].width,i.top+n[0].width),d(s,r[2],r[3],e.bottomRightInner,e.bottomLeftInner,i.left+i.width-n[1].width,i.top+i.height-n[2].width),d(s,r[3],r[0],e.bottomLeftInner,e.topLeftInner,i.left+n[3].width,i.top+i.height-n[2].width);break;default:d(s,r[0],r[1],e.topLeftOuter,e.topRightOuter,i.left,i.top),d(s,r[1],r[2],e.topRightOuter,e.bottomRightOuter,i.left+i.width,i.top),d(s,r[2],r[3],e.bottomRightOuter,e.bottomLeftOuter,i.left+i.width,i.top+i.height),d(s,r[3],r[0],e.bottomLeftOuter,e.topLeftOuter,i.left,i.top+i.height)}return s},e.exports=n},{"./color":5,"./fontmetrics":9,"./log":15,"./nodecontainer":16,"./promise":18,"./pseudoelementcontainer":21,"./stackingcontext":24,"./textcontainer":28,"./utils":29,punycode:3}],18:[function(t,e){e.exports=t("es6-promise").Promise},{"es6-promise":1}],19:[function(t,e,n){function r(t,e,n){var r="withCredentials"in new XMLHttpRequest;if(!e)return u.reject("No proxy configured");var i=s(r),c=a(e,t,i);return r?d(c):o(n,c,i).then(function(t){return g(t.content)})}function i(t,e,n){var r="crossOrigin"in new Image,i=s(r),c=a(e,t,i);return r?u.resolve(c):o(n,c,i).then(function(t){return"data:"+t.type+";base64,"+t.content})}function o(t,e,n){return new u(function(r,i){var o=t.createElement("script"),s=function(){delete window.html2canvas.proxy[n],t.body.removeChild(o)};window.html2canvas.proxy[n]=function(t){s(),r(t)},o.src=e,o.onerror=function(t){s(),i(t)},t.body.appendChild(o)})}function s(t){return t?"":"html2canvas_"+Date.now()+"_"+ ++m+"_"+Math.round(1e5*Math.random())}function a(t,e,n){return t+"?url="+encodeURIComponent(e)+(n.length?"&callback=html2canvas.proxy."+n:"")}function c(t){return function(e){var n,r=new DOMParser;try{n=r.parseFromString(e,"text/html")}catch(i){p("DOMParser not supported, falling back to createHTMLDocument"),n=document.implementation.createHTMLDocument("");try{n.open(),n.write(e),n.close()}catch(o){p("createHTMLDocument write not supported, falling back to document.body.innerHTML"),n.body.innerHTML=e}}var s=n.querySelector("base");if(!s||!s.href.host){var a=n.createElement("base");a.href=t,n.head.insertBefore(a,n.head.firstChild)}return n}}function l(t,e,n,i,o,s){return new r(t,e,window.document).then(c(t)).then(function(t){return f(t,n,i,o,s,0,0)})}var u=t("./promise"),d=t("./xhr"),h=t("./utils"),p=t("./log"),f=t("./clone"),g=h.decode64,m=0;n.Proxy=r,n.ProxyURL=i,n.loadUrlDocument=l},{"./clone":4,"./log":15,"./promise":18,"./utils":29,"./xhr":31}],20:[function(t,e){function n(t,e){var n=document.createElement("a");n.href=t,t=n.href,this.src=t,this.image=new Image;var o=this;this.promise=new i(function(n,i){o.image.crossOrigin="Anonymous",o.image.onload=n,o.image.onerror=i,new r(t,e,document).then(function(t){o.image.src=t})["catch"](i)})}var r=t("./proxy").ProxyURL,i=t("./promise");e.exports=n},{"./promise":18,"./proxy":19}],21:[function(t,e){function n(t,e,n){r.call(this,t,e),this.isPseudoElement=!0,this.before=":before"===n}var r=t("./nodecontainer");n.prototype.cloneTo=function(t){n.prototype.cloneTo.call(this,t),t.isPseudoElement=!0,t.before=this.before},n.prototype=Object.create(r.prototype),n.prototype.appendToDOM=function(){this.before?this.parent.node.insertBefore(this.node,this.parent.node.firstChild):this.parent.node.appendChild(this.node),this.parent.node.className+=" "+this.getHideClass()},n.prototype.cleanDOM=function(){this.node.parentNode.removeChild(this.node),this.parent.node.className=this.parent.node.className.replace(this.getHideClass(),"")},n.prototype.getHideClass=function(){return this["PSEUDO_HIDE_ELEMENT_CLASS_"+(this.before?"BEFORE":"AFTER")]},n.prototype.PSEUDO_HIDE_ELEMENT_CLASS_BEFORE="___html2canvas___pseudoelement_before",n.prototype.PSEUDO_HIDE_ELEMENT_CLASS_AFTER="___html2canvas___pseudoelement_after",e.exports=n},{"./nodecontainer":16}],22:[function(t,e){function n(t,e,n,r,i){this.width=t,this.height=e,this.images=n,this.options=r,this.document=i}var r=t("./log");n.prototype.renderImage=function(t,e,n,r){var i=t.cssInt("paddingLeft"),o=t.cssInt("paddingTop"),s=t.cssInt("paddingRight"),a=t.cssInt("paddingBottom"),c=n.borders,l=e.width-(c[1].width+c[3].width+i+s),u=e.height-(c[0].width+c[2].width+o+a);this.drawImage(r,0,0,r.image.width||l,r.image.height||u,e.left+i+c[3].width,e.top+o+c[0].width,l,u)},n.prototype.renderBackground=function(t,e,n){e.height>0&&e.width>0&&(this.renderBackgroundColor(t,e),this.renderBackgroundImage(t,e,n))},n.prototype.renderBackgroundColor=function(t,e){var n=t.color("backgroundColor");n.isTransparent()||this.rectangle(e.left,e.top,e.width,e.height,n)},n.prototype.renderBorders=function(t){t.forEach(this.renderBorder,this)},n.prototype.renderBorder=function(t){t.color.isTransparent()||null===t.args||this.drawShape(t.args,t.color)},n.prototype.renderBackgroundImage=function(t,e,n){var i=t.parseBackgroundImages();i.reverse().forEach(function(i,o,s){switch(i.method){case"url":var a=this.images.get(i.args[0]);a?this.renderBackgroundRepeating(t,e,a,s.length-(o+1),n):r("Error loading background-image",i.args[0]);break;case"linear-gradient":case"gradient":var c=this.images.get(i.value);c?this.renderBackgroundGradient(c,e,n):r("Error loading background-image",i.args[0]);break;case"none":break;default:r("Unknown background-image type",i.args[0])}},this)},n.prototype.renderBackgroundRepeating=function(t,e,n,r,i){var o=t.parseBackgroundSize(e,n.image,r),s=t.parseBackgroundPosition(e,n.image,r,o),a=t.parseBackgroundRepeat(r);switch(a){case"repeat-x":case"repeat no-repeat":this.backgroundRepeatShape(n,s,o,e,e.left+i[3],e.top+s.top+i[0],99999,o.height,i);break;case"repeat-y":case"no-repeat repeat":this.backgroundRepeatShape(n,s,o,e,e.left+s.left+i[3],e.top+i[0],o.width,99999,i);break;case"no-repeat":this.backgroundRepeatShape(n,s,o,e,e.left+s.left+i[3],e.top+s.top+i[0],o.width,o.height,i);break;default:this.renderBackgroundRepeat(n,s,o,{top:e.top,left:e.left},i[3],i[0])}},e.exports=n},{"./log":15}],23:[function(t,e){function n(t,e){i.apply(this,arguments),this.canvas=this.options.canvas||this.document.createElement("canvas"),this.options.canvas||(this.canvas.width=t,this.canvas.height=e),this.ctx=this.canvas.getContext("2d"),this.taintCtx=this.document.createElement("canvas").getContext("2d"),this.ctx.textBaseline="bottom",this.variables={},s("Initialized CanvasRenderer with size",t,"x",e)}function r(t){return t.length>0}var i=t("../renderer"),o=t("../lineargradientcontainer"),s=t("../log");n.prototype=Object.create(i.prototype),n.prototype.setFillStyle=function(t){return this.ctx.fillStyle="object"==typeof t&&t.isColor?t.toString():t,this.ctx},n.prototype.rectangle=function(t,e,n,r,i){this.setFillStyle(i).fillRect(t,e,n,r)},n.prototype.circle=function(t,e,n,r){this.setFillStyle(r),this.ctx.beginPath(),this.ctx.arc(t+n/2,e+n/2,n/2,0,2*Math.PI,!0),this.ctx.closePath(),this.ctx.fill()},n.prototype.circleStroke=function(t,e,n,r,i,o){this.circle(t,e,n,r),this.ctx.strokeStyle=o.toString(),this.ctx.stroke()},n.prototype.drawShape=function(t,e){this.shape(t),this.setFillStyle(e).fill()},n.prototype.taints=function(t){if(null===t.tainted){this.taintCtx.drawImage(t.image,0,0);try{this.taintCtx.getImageData(0,0,1,1),t.tainted=!1}catch(e){this.taintCtx=document.createElement("canvas").getContext("2d"),t.tainted=!0}}return t.tainted},n.prototype.drawImage=function(t,e,n,r,i,o,s,a,c){(!this.taints(t)||this.options.allowTaint)&&this.ctx.drawImage(t.image,e,n,r,i,o,s,a,c)},n.prototype.clip=function(t,e,n){this.ctx.save(),t.filter(r).forEach(function(t){this.shape(t).clip()},this),e.call(n),this.ctx.restore()},n.prototype.shape=function(t){return this.ctx.beginPath(),t.forEach(function(t,e){"rect"===t[0]?this.ctx.rect.apply(this.ctx,t.slice(1)):this.ctx[0===e?"moveTo":t[0]+"To"].apply(this.ctx,t.slice(1))},this),this.ctx.closePath(),this.ctx},n.prototype.font=function(t,e,n,r,i,o){this.setFillStyle(t).font=[e,n,r,i,o].join(" ").split(",")[0]},n.prototype.fontShadow=function(t,e,n,r){this.setVariable("shadowColor",t.toString()).setVariable("shadowOffsetY",e).setVariable("shadowOffsetX",n).setVariable("shadowBlur",r)},n.prototype.clearShadow=function(){this.setVariable("shadowColor","rgba(0,0,0,0)")},n.prototype.setOpacity=function(t){this.ctx.globalAlpha=t},n.prototype.setTransform=function(t){this.ctx.translate(t.origin[0],t.origin[1]),this.ctx.transform.apply(this.ctx,t.matrix),this.ctx.translate(-t.origin[0],-t.origin[1])},n.prototype.setVariable=function(t,e){return this.variables[t]!==e&&(this.variables[t]=this.ctx[t]=e),this},n.prototype.text=function(t,e,n){this.ctx.fillText(t,e,n)},n.prototype.backgroundRepeatShape=function(t,e,n,r,i,o,s,a,c){var l=[["line",Math.round(i),Math.round(o)],["line",Math.round(i+s),Math.round(o)],["line",Math.round(i+s),Math.round(a+o)],["line",Math.round(i),Math.round(a+o)]];this.clip([l],function(){this.renderBackgroundRepeat(t,e,n,r,c[3],c[0])},this)},n.prototype.renderBackgroundRepeat=function(t,e,n,r,i,o){var s=Math.round(r.left+e.left+i),a=Math.round(r.top+e.top+o);this.setFillStyle(this.ctx.createPattern(this.resizeImage(t,n),"repeat")),this.ctx.translate(s,a),this.ctx.fill(),this.ctx.translate(-s,-a)},n.prototype.renderBackgroundGradient=function(t,e){if(t instanceof o){var n=this.ctx.createLinearGradient(e.left+e.width*t.x0,e.top+e.height*t.y0,e.left+e.width*t.x1,e.top+e.height*t.y1);t.colorStops.forEach(function(t){n.addColorStop(t.stop,t.color.toString())}),this.rectangle(e.left,e.top,e.width,e.height,n)}},n.prototype.resizeImage=function(t,e){var n=t.image;if(n.width===e.width&&n.height===e.height)return n;var r,i=document.createElement("canvas");return i.width=e.width,i.height=e.height,r=i.getContext("2d"),r.drawImage(n,0,0,n.width,n.height,0,0,e.width,e.height),i},e.exports=n},{"../lineargradientcontainer":14,"../log":15,"../renderer":22}],24:[function(t,e){function n(t,e,n,i){r.call(this,n,i),this.ownStacking=t,this.contexts=[],this.children=[],this.opacity=(this.parent?this.parent.stack.opacity:1)*e}var r=t("./nodecontainer");n.prototype=Object.create(r.prototype),n.prototype.getParentStack=function(t){var e=this.parent?this.parent.stack:null;return e?e.ownStacking?e:e.getParentStack(t):t.stack},e.exports=n},{"./nodecontainer":16}],25:[function(t,e){function n(t){this.rangeBounds=this.testRangeBounds(t),this.cors=this.testCORS(),this.svg=this.testSVG()}n.prototype.testRangeBounds=function(t){var e,n,r,i,o=!1;return t.createRange&&(e=t.createRange(),e.getBoundingClientRect&&(n=t.createElement("boundtest"),n.style.height="123px",n.style.display="block",t.body.appendChild(n),e.selectNode(n),r=e.getBoundingClientRect(),i=r.height,123===i&&(o=!0),t.body.removeChild(n))),o},n.prototype.testCORS=function(){return"undefined"!=typeof(new Image).crossOrigin},n.prototype.testSVG=function(){var t=new Image,e=document.createElement("canvas"),n=e.getContext("2d");t.src="data:image/svg+xml,";try{n.drawImage(t,0,0),e.toDataURL()}catch(r){return!1}return!0},e.exports=n},{}],26:[function(t,e){function n(t){this.src=t,this.image=null;var e=this;this.promise=this.hasFabric().then(function(){return e.isInline(t)?r.resolve(e.inlineFormatting(t)):i(t)}).then(function(t){return new r(function(n){window.html2canvas.svg.fabric.loadSVGFromString(t,e.createCanvas.call(e,n))})})}var r=t("./promise"),i=t("./xhr"),o=t("./utils").decode64;n.prototype.hasFabric=function(){return window.html2canvas.svg&&window.html2canvas.svg.fabric?r.resolve():r.reject(new Error("html2canvas.svg.js is not loaded, cannot render svg"))},n.prototype.inlineFormatting=function(t){return/^data:image\/svg\+xml;base64,/.test(t)?this.decode64(this.removeContentType(t)):this.removeContentType(t)},n.prototype.removeContentType=function(t){return t.replace(/^data:image\/svg\+xml(;base64)?,/,"")},n.prototype.isInline=function(t){return/^data:image\/svg\+xml/i.test(t)},n.prototype.createCanvas=function(t){var e=this;return function(n,r){var i=new window.html2canvas.svg.fabric.StaticCanvas("c");e.image=i.lowerCanvasEl,i.setWidth(r.width).setHeight(r.height).add(window.html2canvas.svg.fabric.util.groupSVGElements(n,r)).renderAll(),t(i.lowerCanvasEl)}},n.prototype.decode64=function(t){return"function"==typeof window.atob?window.atob(t):o(t)},e.exports=n},{"./promise":18,"./utils":29,"./xhr":31}],27:[function(t,e){function n(t,e){this.src=t,this.image=null;var n=this;this.promise=e?new i(function(e,r){n.image=new Image,n.image.onload=e,n.image.onerror=r,n.image.src="data:image/svg+xml,"+(new XMLSerializer).serializeToString(t),n.image.complete===!0&&e(n.image)}):this.hasFabric().then(function(){return new i(function(e){window.html2canvas.svg.fabric.parseSVGDocument(t,n.createCanvas.call(n,e))})})}var r=t("./svgcontainer"),i=t("./promise");n.prototype=Object.create(r.prototype),e.exports=n},{"./promise":18,"./svgcontainer":26}],28:[function(t,e){function n(t,e){i.call(this,t,e)}function r(t,e,n){return t.length>0?e+n.toUpperCase():void 0}var i=t("./nodecontainer");n.prototype=Object.create(i.prototype),n.prototype.applyTextTransform=function(){this.node.data=this.transform(this.parent.css("textTransform"))},n.prototype.transform=function(t){var e=this.node.data;switch(t){case"lowercase":return e.toLowerCase();case"capitalize":return e.replace(/(^|\s|:|-|\(|\))([a-z])/g,r);case"uppercase":return e.toUpperCase();default:return e}},e.exports=n},{"./nodecontainer":16}],29:[function(t,e,n){n.smallImage=function(){return"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"},n.bind=function(t,e){return function(){return t.apply(e,arguments)}},n.decode64=function(t){var e,n,r,i,o,s,a,c,l="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",u=t.length,d="";for(e=0;u>e;e+=4)n=l.indexOf(t[e]),r=l.indexOf(t[e+1]),i=l.indexOf(t[e+2]),o=l.indexOf(t[e+3]),s=n<<2|r>>4,a=(15&r)<<4|i>>2,c=(3&i)<<6|o,d+=64===i?String.fromCharCode(s):64===o||-1===o?String.fromCharCode(s,a):String.fromCharCode(s,a,c);return d},n.getBounds=function(t){if(t.getBoundingClientRect){var e=t.getBoundingClientRect(),n=null==t.offsetWidth?e.width:t.offsetWidth;return{top:e.top,bottom:e.bottom||e.top+e.height,right:e.left+n,left:e.left,width:n,height:null==t.offsetHeight?e.height:t.offsetHeight}}return{}},n.offsetBounds=function(t){var e=t.offsetParent?n.offsetBounds(t.offsetParent):{top:0,left:0};return{top:t.offsetTop+e.top,bottom:t.offsetTop+t.offsetHeight+e.top,right:t.offsetLeft+e.left+t.offsetWidth,left:t.offsetLeft+e.left,width:t.offsetWidth,height:t.offsetHeight}},n.parseBackgrounds=function(t){var e,n,r,i,o,s,a,c=" \r\n ",l=[],u=0,d=0,h=function(){e&&('"'===n.substr(0,1)&&(n=n.substr(1,n.length-2)),n&&a.push(n),"-"===e.substr(0,1)&&(i=e.indexOf("-",1)+1)>0&&(r=e.substr(0,i),e=e.substr(i)),l.push({prefix:r,method:e.toLowerCase(),value:o,args:a,image:null})),a=[],e=r=n=o=""};return a=[],e=r=n=o="",t.split("").forEach(function(t){if(!(0===u&&c.indexOf(t)>-1)){switch(t){case'"':s?s===t&&(s=null):s=t;break;case"(":if(s)break;if(0===u)return u=1,void(o+=t);d++;break;case")":if(s)break;if(1===u){if(0===d)return u=0,o+=t,void h();d--}break;case",":if(s)break;if(0===u)return void h();if(1===u&&0===d&&!e.match(/^url$/i))return a.push(n),n="",void(o+=t)}o+=t,0===u?e+=t:n+=t}}),h(),l}},{}],30:[function(t,e){function n(t){r.apply(this,arguments),this.type="linear"===t.args[0]?this.TYPES.LINEAR:this.TYPES.RADIAL}var r=t("./gradientcontainer");n.prototype=Object.create(r.prototype),e.exports=n},{"./gradientcontainer":11}],31:[function(t,e){function n(t){return new r(function(e,n){var r=new XMLHttpRequest;r.open("GET",t),r.onload=function(){200===r.status?e(r.responseText):n(new Error(r.statusText))},r.onerror=function(){n(new Error("Network Error"))},r.send()})}var r=t("./promise");e.exports=n},{"./promise":18}]},{},[6])(6)}),self="undefined"!=typeof window?window:"undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope?self:{};var Prism=function(){var t=/\blang(?:uage)?-(?!\*)(\w+)\b/i,e=self.Prism={util:{encode:function(t){return t instanceof n?new n(t.type,e.util.encode(t.content),t.alias):"Array"===e.util.type(t)?t.map(e.util.encode):t.replace(/&/g,"&").replace(/t.length)break t;if(!(g instanceof r)){l.lastIndex=0;var m=l.exec(g);if(m){d&&(h=m[1].length);var y=m.index-1+h,m=m[0].slice(h),v=m.length,w=y+v,b=g.slice(0,y+1),x=g.slice(w+1),E=[f,1];b&&E.push(b);var S=new r(s,u?e.tokenize(m,u):m,p);E.push(S),x&&E.push(x),Array.prototype.splice.apply(i,E)}}}}}return i},hooks:{all:{},add:function(t,n){var r=e.hooks.all;r[t]=r[t]||[],r[t].push(n)},run:function(t,n){var r=e.hooks.all[t];if(r&&r.length)for(var i,o=0;i=r[o++];)i(n)}}},n=e.Token=function(t,e,n){this.type=t,this.content=e,this.alias=n};if(n.stringify=function(t,r,i){if("string"==typeof t)return t;if("Array"===e.util.type(t))return t.map(function(e){return n.stringify(e,r,t)}).join("");var o={type:t.type,content:n.stringify(t.content,r,i),tag:"span",classes:["token",t.type],attributes:{},language:r,parent:i};if("comment"==o.type&&(o.attributes.spellcheck="true"),t.alias){var s="Array"===e.util.type(t.alias)?t.alias:[t.alias];Array.prototype.push.apply(o.classes,s)}e.hooks.run("wrap",o);var a="";for(var c in o.attributes)a+=c+'="'+(o.attributes[c]||"")+'"';return"<"+o.tag+' class="'+o.classes.join(" ")+'" '+a+">"+o.content+""},!self.document)return self.addEventListener?(self.addEventListener("message",function(t){var n=JSON.parse(t.data),r=n.language,i=n.code;self.postMessage(JSON.stringify(e.util.encode(e.tokenize(i,e.languages[r])))),self.close()},!1),self.Prism):self.Prism;var r=document.getElementsByTagName("script");return r=r[r.length-1],r&&(e.filename=r.src,document.addEventListener&&!r.hasAttribute("data-manual")&&document.addEventListener("DOMContentLoaded",e.highlightAll)),self.Prism}();"undefined"!=typeof module&&module.exports&&(module.exports=Prism),Prism.languages.markup={comment://,prolog:/<\?.+?\?>/,doctype://,cdata://i,tag:{pattern:/<\/?[\w:-]+\s*(?:\s+[\w:-]+(?:=(?:("|')(\\?[\w\W])*?\1|[^\s'">=]+))?\s*)*\/?>/i,inside:{tag:{pattern:/^<\/?[\w:-]+/i,inside:{punctuation:/^<\/?/,namespace:/^[\w-]+?:/}},"attr-value":{pattern:/=(?:('|")[\w\W]*?(\1)|[^\s>]+)/i,inside:{punctuation:/=|>|"/}},punctuation:/\/?>/,"attr-name":{pattern:/[\w:-]+/,inside:{namespace:/^[\w-]+?:/}}}},entity:/&#?[\da-z]{1,8};/i},Prism.hooks.add("wrap",function(t){"entity"===t.type&&(t.attributes.title=t.content.replace(/&/,"&"))}),Prism.languages.css={comment:/\/\*[\w\W]*?\*\//,atrule:{pattern:/@[\w-]+?.*?(;|(?=\s*\{))/i,inside:{punctuation:/[;:]/}},url:/url\((?:(["'])(\\\n|\\?.)*?\1|.*?)\)/i,selector:/[^\{\}\s][^\{\};]*(?=\s*\{)/,string:/("|')(\\\n|\\?.)*?\1/,property:/(\b|\B)[\w-]+(?=\s*:)/i,important:/\B!important\b/i,punctuation:/[\{\};:]/,"function":/[-a-z0-9]+(?=\()/i},Prism.languages.markup&&(Prism.languages.insertBefore("markup","tag",{style:{pattern:/[\w\W]*?<\/style>/i,inside:{tag:{pattern:/|<\/style>/i,inside:Prism.languages.markup.tag.inside},rest:Prism.languages.css},alias:"language-css"}}),Prism.languages.insertBefore("inside","attr-value",{"style-attr":{pattern:/\s*style=("|').*?\1/i,inside:{"attr-name":{pattern:/^\s*style/i,inside:Prism.languages.markup.tag.inside},punctuation:/^\s*=\s*['"]|['"]\s*$/,"attr-value":{pattern:/.+/i,inside:Prism.languages.css}},alias:"language-css"}},Prism.languages.markup.tag)),Prism.languages.clike={comment:[{pattern:/(^|[^\\])\/\*[\w\W]*?\*\//,lookbehind:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0}],string:/("|')(\\\n|\\?.)*?\1/,"class-name":{pattern:/((?:(?:class|interface|extends|implements|trait|instanceof|new)\s+)|(?:catch\s+\())[a-z0-9_\.\\]+/i,lookbehind:!0,inside:{punctuation:/(\.|\\)/}},keyword:/\b(if|else|while|do|for|return|in|instanceof|function|new|try|throw|catch|finally|null|break|continue)\b/,"boolean":/\b(true|false)\b/,"function":{pattern:/[a-z0-9_]+\(/i,inside:{punctuation:/\(/}},number:/\b-?(0x[\dA-Fa-f]+|\d*\.?\d+([Ee]-?\d+)?)\b/,operator:/[-+]{1,2}|!|<=?|>=?|={1,3}|&{1,2}|\|?\||\?|\*|\/|~|\^|%/,ignore:/&(lt|gt|amp);/i,punctuation:/[{}[\];(),.:]/},Prism.languages.javascript=Prism.languages.extend("clike",{keyword:/\b(break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|false|finally|for|function|get|if|implements|import|in|instanceof|interface|let|new|null|package|private|protected|public|return|set|static|super|switch|this|throw|true|try|typeof|var|void|while|with|yield)\b/,number:/\b-?(0x[\dA-Fa-f]+|\d*\.?\d+([Ee][+-]?\d+)?|NaN|-?Infinity)\b/,"function":/(?!\d)[a-z0-9_$]+(?=\()/i}),Prism.languages.insertBefore("javascript","keyword",{regex:{pattern:/(^|[^/])\/(?!\/)(\[.+?]|\\.|[^/\r\n])+\/[gim]{0,3}(?=\s*($|[\r\n,.;})]))/,lookbehind:!0}}),Prism.languages.markup&&Prism.languages.insertBefore("markup","tag",{script:{pattern:/[\w\W]*?<\/script>/i,inside:{tag:{pattern:/|<\/script>/i,inside:Prism.languages.markup.tag.inside},rest:Prism.languages.javascript},alias:"language-javascript"}}); --------------------------------------------------------------------------------