├── .gitignore ├── sample ├── extensions │ ├── hash │ │ ├── deck.hash.html │ │ ├── deck.hash.css │ │ ├── deck.hash.scss │ │ └── deck.hash.js │ ├── status │ │ ├── deck.status.html │ │ ├── deck.status.css │ │ ├── deck.status.scss │ │ └── deck.status.js │ ├── navigation │ │ ├── deck.navigation.html │ │ ├── deck.navigation.scss │ │ ├── deck.navigation.css │ │ └── deck.navigation.js │ ├── goto │ │ ├── deck.goto.html │ │ ├── deck.goto.scss │ │ ├── deck.goto.css │ │ └── deck.goto.js │ ├── scale │ │ ├── deck.scale.scss │ │ ├── deck.scale.css │ │ └── deck.scale.js │ ├── menu │ │ ├── deck.menu.scss │ │ ├── deck.menu.css │ │ └── deck.menu.js │ └── markdown │ │ └── deck.markdown.js ├── js │ ├── test.js │ └── modernizr.custom.js ├── core │ ├── deck.core.html │ ├── deck.core.scss │ ├── deck.core.css │ └── deck.core.js ├── themes │ ├── style │ │ ├── swiss.scss │ │ ├── swiss.css │ │ ├── neon.scss │ │ ├── neon.css │ │ ├── web-2.0.scss │ │ └── web-2.0.css │ └── transition │ │ ├── fade.scss │ │ ├── fade.css │ │ ├── horizontal-slide.scss │ │ ├── vertical-slide.scss │ │ ├── horizontal-slide.css │ │ └── vertical-slide.css └── testdeck.html ├── deck.markdown.js ├── deck.markdown.js └── Markdown.Converter.js └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | .sass-cache/ 3 | progress/ 4 | .idea/ -------------------------------------------------------------------------------- /sample/extensions/hash/deck.hash.html: -------------------------------------------------------------------------------- 1 | 2 | # -------------------------------------------------------------------------------- /sample/extensions/status/deck.status.html: -------------------------------------------------------------------------------- 1 | 2 |

3 | 4 | / 5 | 6 |

-------------------------------------------------------------------------------- /sample/extensions/navigation/deck.navigation.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /sample/extensions/status/deck.status.css: -------------------------------------------------------------------------------- 1 | .deck-container .deck-status { 2 | position: absolute; 3 | bottom: 10px; 4 | right: 5px; 5 | color: #888; 6 | z-index: 3; 7 | margin: 0; 8 | } 9 | 10 | @media print { 11 | .deck-status { 12 | display: none; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /sample/extensions/status/deck.status.scss: -------------------------------------------------------------------------------- 1 | .deck-container { 2 | .deck-status { 3 | position:absolute; 4 | bottom:10px; 5 | right:5px; 6 | color:#888; 7 | z-index:3; 8 | margin:0; 9 | } 10 | } 11 | 12 | @media print { 13 | .deck-status { 14 | display:none; 15 | } 16 | } -------------------------------------------------------------------------------- /sample/extensions/goto/deck.goto.html: -------------------------------------------------------------------------------- 1 | 2 |
3 | 4 | 5 | 6 |
-------------------------------------------------------------------------------- /sample/extensions/hash/deck.hash.css: -------------------------------------------------------------------------------- 1 | .deck-container .deck-permalink { 2 | display: none; 3 | position: absolute; 4 | z-index: 4; 5 | bottom: 30px; 6 | right: 0; 7 | width: 48px; 8 | text-align: center; 9 | } 10 | 11 | .no-history .deck-container:hover .deck-permalink { 12 | display: block; 13 | } 14 | -------------------------------------------------------------------------------- /sample/extensions/hash/deck.hash.scss: -------------------------------------------------------------------------------- 1 | .deck-container { 2 | .deck-permalink { 3 | display:none; 4 | position:absolute; 5 | z-index:4; 6 | bottom:30px; 7 | right:0; 8 | width:48px; 9 | text-align:center; 10 | } 11 | } 12 | 13 | .no-history .deck-container:hover .deck-permalink { 14 | display:block; 15 | } -------------------------------------------------------------------------------- /sample/js/test.js: -------------------------------------------------------------------------------- 1 | $(function() { 2 | $.deck('.slide'); 3 | 4 | $('#style-themes').change(function() { 5 | $('#style-theme-link').attr('href', $(this).val()); 6 | }); 7 | 8 | $('#transition-themes').change(function() { 9 | $('#transition-theme-link').attr('href', $(this).val()); 10 | }); 11 | }); 12 | 13 | -------------------------------------------------------------------------------- /sample/extensions/scale/deck.scale.scss: -------------------------------------------------------------------------------- 1 | .csstransforms .deck-container.deck-scale { 2 | width:auto; 3 | -webkit-transform-origin: 50% 0; 4 | -moz-transform-origin: 50% 0; 5 | -o-transform-origin: 50% 0; 6 | -ms-transform-origin: 50% 0; 7 | transform-origin: 50% 0; 8 | 9 | &.deck-menu { 10 | width:70%; 11 | -webkit-transform:none !important; 12 | -moz-transform:none !important; 13 | -o-transform:none !important; 14 | -ms-transform:none !important; 15 | transform:none !important; 16 | } 17 | } -------------------------------------------------------------------------------- /sample/extensions/menu/deck.menu.scss: -------------------------------------------------------------------------------- 1 | .deck-menu { 2 | > .slide { 3 | float:left; 4 | width:22%; 5 | height:22%; 6 | min-height:0; 7 | margin:1%; 8 | font-size:0.22em; 9 | overflow:hidden; 10 | padding:0 0.5%; 11 | } 12 | 13 | .slide { 14 | background:#eee; 15 | position:relative; 16 | left:0; 17 | top:0; 18 | visibility:visible; 19 | cursor:pointer; 20 | } 21 | 22 | iframe, img, video { 23 | max-width:100%; 24 | } 25 | 26 | .deck-current, .no-touch & .slide:hover { 27 | background:#ddf; 28 | } 29 | } -------------------------------------------------------------------------------- /sample/extensions/scale/deck.scale.css: -------------------------------------------------------------------------------- 1 | .csstransforms .deck-container.deck-scale { 2 | width: auto; 3 | -webkit-transform-origin: 50% 0; 4 | -moz-transform-origin: 50% 0; 5 | -o-transform-origin: 50% 0; 6 | -ms-transform-origin: 50% 0; 7 | transform-origin: 50% 0; 8 | } 9 | .csstransforms .deck-container.deck-scale.deck-menu { 10 | width: 70%; 11 | -webkit-transform: none !important; 12 | -moz-transform: none !important; 13 | -o-transform: none !important; 14 | -ms-transform: none !important; 15 | transform: none !important; 16 | } 17 | -------------------------------------------------------------------------------- /sample/extensions/menu/deck.menu.css: -------------------------------------------------------------------------------- 1 | .deck-menu > .slide { 2 | float: left; 3 | width: 22%; 4 | height: 22%; 5 | min-height: 0; 6 | margin: 1%; 7 | font-size: 0.22em; 8 | overflow: hidden; 9 | padding: 0 0.5%; 10 | } 11 | .deck-menu .slide { 12 | background: #eee; 13 | position: relative; 14 | left: 0; 15 | top: 0; 16 | visibility: visible; 17 | cursor: pointer; 18 | } 19 | .deck-menu iframe, .deck-menu img, .deck-menu video { 20 | max-width: 100%; 21 | } 22 | .deck-menu .deck-current, .no-touch .deck-menu .slide:hover { 23 | background: #ddf; 24 | } 25 | -------------------------------------------------------------------------------- /sample/extensions/goto/deck.goto.scss: -------------------------------------------------------------------------------- 1 | .deck-container { 2 | .goto-form { 3 | position:absolute; 4 | z-index:3; 5 | bottom:10px; 6 | left:50%; 7 | height:1.75em; 8 | margin:0 0 0 -7.125em; 9 | line-height:1.75em; 10 | padding:0.625em; 11 | display:none; 12 | background:#ccc; 13 | overflow:hidden; 14 | 15 | .borderradius & { 16 | -webkit-border-radius:10px; 17 | -moz-border-radius:10px; 18 | border-radius:10px; 19 | } 20 | 21 | label { 22 | font-weight:bold; 23 | } 24 | 25 | label, input { 26 | display:inline-block; 27 | font-family:inherit; 28 | } 29 | } 30 | } 31 | 32 | .deck-goto .goto-form { 33 | display:block; 34 | } 35 | 36 | #goto-slide { 37 | width:4.375em; 38 | margin:0 0.625em; 39 | height:1.4375em; 40 | } 41 | 42 | @media print { 43 | .goto-form, #goto-slide { 44 | display:none !important; 45 | } 46 | } -------------------------------------------------------------------------------- /sample/extensions/goto/deck.goto.css: -------------------------------------------------------------------------------- 1 | .deck-container .goto-form { 2 | position: absolute; 3 | z-index: 3; 4 | bottom: 10px; 5 | left: 50%; 6 | height: 1.75em; 7 | margin: 0 0 0 -7.125em; 8 | line-height: 1.75em; 9 | padding: 0.625em; 10 | display: none; 11 | background: #ccc; 12 | overflow: hidden; 13 | } 14 | .borderradius .deck-container .goto-form { 15 | -webkit-border-radius: 10px; 16 | -moz-border-radius: 10px; 17 | border-radius: 10px; 18 | } 19 | .deck-container .goto-form label { 20 | font-weight: bold; 21 | } 22 | .deck-container .goto-form label, .deck-container .goto-form input { 23 | display: inline-block; 24 | font-family: inherit; 25 | } 26 | 27 | .deck-goto .goto-form { 28 | display: block; 29 | } 30 | 31 | #goto-slide { 32 | width: 4.375em; 33 | margin: 0 0.625em; 34 | height: 1.4375em; 35 | } 36 | 37 | @media print { 38 | .goto-form, #goto-slide { 39 | display: none !important; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /sample/extensions/navigation/deck.navigation.scss: -------------------------------------------------------------------------------- 1 | @mixin border-radius($r) { 2 | -webkit-border-radius:$r; 3 | -moz-border-radius:$r; 4 | border-radius:$r; 5 | } 6 | 7 | .deck-container { 8 | .deck-prev-link, .deck-next-link { 9 | display:none; 10 | position:absolute; 11 | z-index:3; 12 | top:50%; 13 | width:32px; 14 | height:32px; 15 | margin-top:-16px; 16 | font-size:20px; 17 | font-weight:bold; 18 | line-height:32px; 19 | vertical-align:middle; 20 | text-align:center; 21 | text-decoration:none; 22 | color:#fff; 23 | background:#888; 24 | 25 | .borderradius & { 26 | @include border-radius(16px); 27 | } 28 | 29 | &:hover, &:focus, &:active, &:visited { 30 | color:#fff; 31 | } 32 | } 33 | 34 | .deck-prev-link { 35 | left:8px; 36 | } 37 | 38 | .deck-next-link { 39 | right:8px; 40 | } 41 | 42 | &:hover .deck-prev-link, &:hover .deck-next-link { 43 | display:block; 44 | 45 | &.deck-nav-disabled, .touch & { 46 | display:none; 47 | } 48 | } 49 | } 50 | 51 | 52 | @media print { 53 | .deck-prev-link, .deck-next-link { 54 | display:none !important; 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /deck.markdown.js/deck.markdown.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * Deck JS - deck.markdown - v1.0 3 | * Copyright (c) 2011 Tom Bruggeman 4 | * 5 | * Dependencie(s): 6 | * 1. PageDown Converter (http://code.google.com/p/pagedown/) 7 | * 8 | * This extension presumes that the content of a deck.js
element (or slide) is written in Markdown 9 | * and converts it on the fly to HTML to display the slide using the PageDown markdown converter. 10 | * 11 | * Feel free to provide (constructive) feedback! I'm certainly not a JavaScript specialist, so there's a real 12 | * posibility that I've done something stupid :-) 13 | * 14 | * Some changes by saintedlama 15 | */ 16 | 17 | (function($, deck, undefined) { 18 | var $d = $(document); 19 | var converter = new Markdown.Converter(); 20 | 21 | $d.bind('deck.init', function() { 22 | $.each($.deck("getSlides"), function(index, value) { 23 | var cssClass = value.attr('class'); 24 | // Prevent slides marked with no-md css class to be interpreted as markdown 25 | if (!cssClass || cssClass.indexOf('no-md') < 0) { 26 | value.html(converter.makeHtml(value.html())); 27 | } 28 | }); 29 | }); 30 | })(jQuery, 'deck'); -------------------------------------------------------------------------------- /sample/extensions/markdown/deck.markdown.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * Deck JS - deck.markdown - v1.0 3 | * Copyright (c) 2011 Tom Bruggeman 4 | * 5 | * Dependencie(s): 6 | * 1. PageDown Converter (http://code.google.com/p/pagedown/) 7 | * 8 | * This extension presumes that the content of a deck.js
element (or slide) is written in Markdown 9 | * and converts it on the fly to HTML to display the slide using the PageDown markdown converter. 10 | * 11 | * Feel free to provide (constructive) feedback! I'm certainly not a JavaScript specialist, so there's a real 12 | * posibility that I've done something stupid :-) 13 | * 14 | * Some changes by saintedlama 15 | */ 16 | 17 | (function($, deck, undefined) { 18 | var $d = $(document); 19 | var converter = new Markdown.Converter(); 20 | 21 | $d.bind('deck.init', function() { 22 | $.each($.deck("getSlides"), function(index, value) { 23 | var cssClass = value.attr('class'); 24 | // Prevent slides marked with no-md css class to be interpreted as markdown 25 | if (!cssClass || cssClass.indexOf('no-md') < 0) { 26 | value.html(converter.makeHtml(value.html())); 27 | } 28 | }); 29 | }); 30 | })(jQuery, 'deck'); -------------------------------------------------------------------------------- /sample/core/deck.core.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Deck Skeleton 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /sample/extensions/status/deck.status.js: -------------------------------------------------------------------------------- 1 | /*! 2 | Deck JS - deck.status 3 | Copyright (c) 2011 Caleb Troughton 4 | Dual licensed under the MIT license and GPL license. 5 | https://github.com/imakewebthings/deck.js/blob/master/MIT-license.txt 6 | https://github.com/imakewebthings/deck.js/blob/master/GPL-license.txt 7 | */ 8 | 9 | /* 10 | This module adds a (current)/(total) style status indicator to the deck. 11 | */ 12 | (function($, deck, undefined) { 13 | var $d = $(document); 14 | 15 | /* 16 | Extends defaults/options. 17 | 18 | options.selectors.statusCurrent 19 | The element matching this selector displays the current slide number. 20 | 21 | options.selectors.statusTotal 22 | The element matching this selector displays the total number of slides. 23 | */ 24 | $.extend(true, $[deck].defaults, { 25 | selectors: { 26 | statusCurrent: '.deck-status-current', 27 | statusTotal: '.deck-status-total' 28 | } 29 | }); 30 | 31 | $d.bind('deck.init', function() { 32 | // Start on first slide 33 | $($[deck]('getOptions').selectors.statusCurrent).text(1); 34 | // Set total slides once 35 | $($[deck]('getOptions').selectors.statusTotal).text($[deck]('getSlides').length); 36 | }) 37 | /* Update current slide number with each change event */ 38 | .bind('deck.change', function(e, from, to) { 39 | $($[deck]('getOptions').selectors.statusCurrent).text(to + 1); 40 | }); 41 | })(jQuery, 'deck'); 42 | 43 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # deck.js-markdown 2 | 3 | A small extension for [deck.js](https://github.com/imakewebthings/deck.js) that adds support for Markdown syntax in slides. When this extension is included 4 | in the slides HTML page, the content of every slide will be interpreted as Markdown and its HTML content will be replaced by the Markdown converter output. 5 | 6 | ## Dependencies 7 | 8 | This extension depends on the JavaScript [PageDown Converter] (http://code.google.com/p/pagedown) for Markdown conversion. 9 | 10 | ## Installation 11 | 12 | 1. Download `deck.markdown.js` 13 | 2. Download `Markdown.Converter.js` 14 | 3. Place the above files in: `\extensions\markdown` 15 | 4. Include both files in your deck.js slides page, for example: 16 | 17 | ```html 18 | 19 | 20 | ``` 21 | 22 | *Note:* the order of the JS imports matters! The PageDown Converter code **must** be included before the extension. 23 | 24 | ## Known Issues 25 | 26 | Check the [issues list](https://github.com/tmbrggmn/deck.js-markdown/issues) for any known or unresolved issues. 27 | 28 | ## Extensions 29 | 30 | Allows to write slides as HTML slides by adding the css class *no-md* to the slide section element 31 | 32 | ``` 33 |
34 |

This slide is not interpreted as markdown

35 |

Use this to prevent certain flaws when processing sub slides...

36 |
37 | ``` -------------------------------------------------------------------------------- /sample/extensions/navigation/deck.navigation.css: -------------------------------------------------------------------------------- 1 | .deck-container .deck-prev-link, .deck-container .deck-next-link { 2 | display: none; 3 | position: absolute; 4 | z-index: 3; 5 | top: 50%; 6 | width: 32px; 7 | height: 32px; 8 | margin-top: -16px; 9 | font-size: 20px; 10 | font-weight: bold; 11 | line-height: 32px; 12 | vertical-align: middle; 13 | text-align: center; 14 | text-decoration: none; 15 | color: #fff; 16 | background: #888; 17 | } 18 | .borderradius .deck-container .deck-prev-link, .borderradius .deck-container .deck-next-link { 19 | -webkit-border-radius: 16px; 20 | -moz-border-radius: 16px; 21 | border-radius: 16px; 22 | } 23 | .deck-container .deck-prev-link:hover, .deck-container .deck-prev-link:focus, .deck-container .deck-prev-link:active, .deck-container .deck-prev-link:visited, .deck-container .deck-next-link:hover, .deck-container .deck-next-link:focus, .deck-container .deck-next-link:active, .deck-container .deck-next-link:visited { 24 | color: #fff; 25 | } 26 | .deck-container .deck-prev-link { 27 | left: 8px; 28 | } 29 | .deck-container .deck-next-link { 30 | right: 8px; 31 | } 32 | .deck-container:hover .deck-prev-link, .deck-container:hover .deck-next-link { 33 | display: block; 34 | } 35 | .deck-container:hover .deck-prev-link.deck-nav-disabled, .touch .deck-container:hover .deck-prev-link, .deck-container:hover .deck-next-link.deck-nav-disabled, .touch .deck-container:hover .deck-next-link { 36 | display: none; 37 | } 38 | 39 | @media print { 40 | .deck-prev-link, .deck-next-link { 41 | display: none !important; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /sample/themes/style/swiss.scss: -------------------------------------------------------------------------------- 1 | .deck-container { 2 | font-family: "Helvetica Neue", sans-serif; 3 | font-size:1.25em; 4 | background:#fff; 5 | 6 | .slide { 7 | background:#fff; 8 | } 9 | 10 | h1 { 11 | color:#000; 12 | } 13 | 14 | h2 { 15 | color:#c00; 16 | border-bottom-color:#ccc; 17 | } 18 | 19 | h3 { 20 | color:#888; 21 | } 22 | 23 | pre { 24 | border-color:#ccc; 25 | } 26 | 27 | code { 28 | color:#888; 29 | } 30 | 31 | blockquote { 32 | font-size:2em; 33 | font-style:italic; 34 | padding:1em 2em; 35 | color:#000; 36 | border-left:5px solid #ccc; 37 | 38 | p { 39 | margin:0; 40 | } 41 | 42 | cite { 43 | font-size:.5em; 44 | font-style:normal; 45 | font-weight:bold; 46 | color:#888; 47 | } 48 | } 49 | 50 | ::-moz-selection{ background:#c00; color:#fff; } 51 | ::selection { background:#c00; color:#fff; } 52 | 53 | a { 54 | &, &:hover, &:focus, &:active, &:visited { 55 | color:#c00; 56 | text-decoration:none; 57 | } 58 | 59 | &:hover, &:focus { 60 | text-decoration:underline; 61 | } 62 | } 63 | 64 | .deck-prev-link, .deck-next-link { 65 | background:#ccc; 66 | font-family:serif; // sans-serif arrows x-browser fail 67 | 68 | &, &:hover, &:focus, &:active, &:visited { 69 | color:#fff; 70 | } 71 | 72 | &:hover, &:focus { 73 | background:#c00; 74 | text-decoration:none; 75 | } 76 | } 77 | 78 | .deck-status { 79 | font-size:0.6666em; 80 | } 81 | 82 | &.deck-menu { 83 | .slide { 84 | background:#eee; 85 | } 86 | 87 | .deck-current, .no-touch & .slide:hover { 88 | background:#ddf; 89 | } 90 | } 91 | } 92 | -------------------------------------------------------------------------------- /sample/themes/transition/fade.scss: -------------------------------------------------------------------------------- 1 | @mixin translate($x: 0, $y: 0, $z: 0) { 2 | -webkit-transform:translate3d($x, $y, $z); 3 | -moz-transform:translate($x, $y); 4 | -ms-transform:translate($x, $y); 5 | -o-transform:translate($x, $y); 6 | transform:translate3d($x, $y, $z); 7 | } 8 | 9 | @mixin transition($prop, $duration, $easing: ease-in-out, $delay: 0ms) { 10 | -webkit-transition:$prop $duration $easing $delay; 11 | -moz-transition:$prop $duration $easing $delay; 12 | -ms-transition:$prop $duration $easing $delay; 13 | -o-transition:$prop $duration $easing $delay; 14 | transition:$prop $duration $easing $delay; 15 | } 16 | 17 | .csstransitions.csstransforms { 18 | .deck-container .slide { 19 | @include transition(opacity, 500ms); 20 | } 21 | 22 | .deck-container:not(.deck-menu) { 23 | > .slide { 24 | position:absolute; 25 | top:0; 26 | left:0; 27 | -webkit-box-sizing: border-box; 28 | -moz-box-sizing: border-box; 29 | box-sizing: border-box; 30 | width:100%; 31 | padding:0 48px; 32 | 33 | .slide { 34 | position:relative; 35 | left:0; 36 | top:0; 37 | opacity:0; 38 | } 39 | 40 | .deck-before, .deck-previous { 41 | opacity:0.4; 42 | } 43 | 44 | .deck-current { 45 | opacity:1; 46 | } 47 | } 48 | 49 | > .deck-previous, > .deck-before, > .deck-next, > .deck-after { 50 | opacity:0; 51 | pointer-events:none; 52 | } 53 | 54 | > .deck-before, > .deck-previous { 55 | .slide { 56 | visibility:visible; 57 | } 58 | } 59 | 60 | > .deck-child-current { 61 | opacity:1; 62 | visibility:visible; 63 | pointer-events:auto; 64 | 65 | .deck-next, .deck-after { 66 | visibility:hidden; 67 | } 68 | } 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /sample/themes/transition/fade.css: -------------------------------------------------------------------------------- 1 | .csstransitions.csstransforms .deck-container .slide { 2 | -webkit-transition: opacity 500ms ease-in-out 0ms; 3 | -moz-transition: opacity 500ms ease-in-out 0ms; 4 | -ms-transition: opacity 500ms ease-in-out 0ms; 5 | -o-transition: opacity 500ms ease-in-out 0ms; 6 | transition: opacity 500ms ease-in-out 0ms; 7 | } 8 | .csstransitions.csstransforms .deck-container:not(.deck-menu) > .slide { 9 | position: absolute; 10 | top: 0; 11 | left: 0; 12 | -webkit-box-sizing: border-box; 13 | -moz-box-sizing: border-box; 14 | box-sizing: border-box; 15 | width: 100%; 16 | padding: 0 48px; 17 | } 18 | .csstransitions.csstransforms .deck-container:not(.deck-menu) > .slide .slide { 19 | position: relative; 20 | left: 0; 21 | top: 0; 22 | opacity: 0; 23 | } 24 | .csstransitions.csstransforms .deck-container:not(.deck-menu) > .slide .deck-before, .csstransitions.csstransforms .deck-container:not(.deck-menu) > .slide .deck-previous { 25 | opacity: 0.4; 26 | } 27 | .csstransitions.csstransforms .deck-container:not(.deck-menu) > .slide .deck-current { 28 | opacity: 1; 29 | } 30 | .csstransitions.csstransforms .deck-container:not(.deck-menu) > .deck-previous, .csstransitions.csstransforms .deck-container:not(.deck-menu) > .deck-before, .csstransitions.csstransforms .deck-container:not(.deck-menu) > .deck-next, .csstransitions.csstransforms .deck-container:not(.deck-menu) > .deck-after { 31 | opacity: 0; 32 | pointer-events: none; 33 | } 34 | .csstransitions.csstransforms .deck-container:not(.deck-menu) > .deck-before .slide, .csstransitions.csstransforms .deck-container:not(.deck-menu) > .deck-previous .slide { 35 | visibility: visible; 36 | } 37 | .csstransitions.csstransforms .deck-container:not(.deck-menu) > .deck-child-current { 38 | opacity: 1; 39 | visibility: visible; 40 | pointer-events: auto; 41 | } 42 | .csstransitions.csstransforms .deck-container:not(.deck-menu) > .deck-child-current .deck-next, .csstransitions.csstransforms .deck-container:not(.deck-menu) > .deck-child-current .deck-after { 43 | visibility: hidden; 44 | } 45 | -------------------------------------------------------------------------------- /sample/themes/style/swiss.css: -------------------------------------------------------------------------------- 1 | .deck-container { 2 | font-family: "Helvetica Neue", sans-serif; 3 | font-size: 1.25em; 4 | background: #fff; 5 | } 6 | .deck-container .slide { 7 | background: #fff; 8 | } 9 | .deck-container h1 { 10 | color: #000; 11 | } 12 | .deck-container h2 { 13 | color: #c00; 14 | border-bottom-color: #ccc; 15 | } 16 | .deck-container h3 { 17 | color: #888; 18 | } 19 | .deck-container pre { 20 | border-color: #ccc; 21 | } 22 | .deck-container code { 23 | color: #888; 24 | } 25 | .deck-container blockquote { 26 | font-size: 2em; 27 | font-style: italic; 28 | padding: 1em 2em; 29 | color: #000; 30 | border-left: 5px solid #ccc; 31 | } 32 | .deck-container blockquote p { 33 | margin: 0; 34 | } 35 | .deck-container blockquote cite { 36 | font-size: .5em; 37 | font-style: normal; 38 | font-weight: bold; 39 | color: #888; 40 | } 41 | .deck-container ::-moz-selection { 42 | background: #c00; 43 | color: #fff; 44 | } 45 | .deck-container ::selection { 46 | background: #c00; 47 | color: #fff; 48 | } 49 | .deck-container a, .deck-container a:hover, .deck-container a:focus, .deck-container a:active, .deck-container a:visited { 50 | color: #c00; 51 | text-decoration: none; 52 | } 53 | .deck-container a:hover, .deck-container a:focus { 54 | text-decoration: underline; 55 | } 56 | .deck-container .deck-prev-link, .deck-container .deck-next-link { 57 | background: #ccc; 58 | font-family: serif; 59 | } 60 | .deck-container .deck-prev-link, .deck-container .deck-prev-link:hover, .deck-container .deck-prev-link:focus, .deck-container .deck-prev-link:active, .deck-container .deck-prev-link:visited, .deck-container .deck-next-link, .deck-container .deck-next-link:hover, .deck-container .deck-next-link:focus, .deck-container .deck-next-link:active, .deck-container .deck-next-link:visited { 61 | color: #fff; 62 | } 63 | .deck-container .deck-prev-link:hover, .deck-container .deck-prev-link:focus, .deck-container .deck-next-link:hover, .deck-container .deck-next-link:focus { 64 | background: #c00; 65 | text-decoration: none; 66 | } 67 | .deck-container .deck-status { 68 | font-size: 0.6666em; 69 | } 70 | .deck-container.deck-menu .slide { 71 | background: #eee; 72 | } 73 | .deck-container.deck-menu .deck-current, .no-touch .deck-container.deck-menu .slide:hover { 74 | background: #ddf; 75 | } 76 | -------------------------------------------------------------------------------- /sample/themes/transition/horizontal-slide.scss: -------------------------------------------------------------------------------- 1 | @mixin translate($x: 0, $y: 0, $z: 0) { 2 | -webkit-transform:translate3d($x, $y, $z); 3 | -moz-transform:translate($x, $y); 4 | -ms-transform:translate($x, $y); 5 | -o-transform:translate($x, $y); 6 | transform:translate3d($x, $y, $z); 7 | } 8 | 9 | @mixin transition($prop, $duration, $easing: ease-in-out, $delay: 0ms) { 10 | -webkit-transition:$prop $duration $easing $delay; 11 | -moz-transition:$prop $duration $easing $delay; 12 | -ms-transition:$prop $duration $easing $delay; 13 | -o-transition:$prop $duration $easing $delay; 14 | transition:$prop $duration $easing $delay; 15 | } 16 | 17 | @mixin transform($val) { 18 | -webkit-transform:$val; 19 | -moz-transform:$val; 20 | -ms-transform:$val; 21 | -o-transform:$val; 22 | transform:$val; 23 | } 24 | 25 | .csstransitions.csstransforms { 26 | overflow-x:hidden; 27 | 28 | .deck-container > .slide { 29 | -webkit-transition:-webkit-transform 500ms ease-in-out; 30 | -moz-transition:-moz-transform 500ms ease-in-out; 31 | -ms-transition:-ms-transform 500ms ease-in-out; 32 | -o-transition:-o-transform 500ms ease-in-out; 33 | transition:transform 500ms ease-in-out; 34 | } 35 | 36 | .deck-container:not(.deck-menu) { 37 | > .slide { 38 | position:absolute; 39 | top:0; 40 | left:0; 41 | -webkit-box-sizing: border-box; 42 | -moz-box-sizing: border-box; 43 | box-sizing: border-box; 44 | width:100%; 45 | padding:0 48px; 46 | 47 | .slide { 48 | position:relative; 49 | left:0; 50 | top:0; 51 | -webkit-transition:-webkit-transform 500ms ease-in-out, opacity 500ms ease-in-out; 52 | -moz-transition:-moz-transform 500ms ease-in-out, opacity 500ms ease-in-out; 53 | -ms-transition:-ms-transform 500ms ease-in-out, opacity 500ms ease-in-out; 54 | -o-transition:-o-transform 500ms ease-in-out, opacity 500ms ease-in-out; 55 | transition:-webkit-transform 500ms ease-in-out, opacity 500ms ease-in-out; 56 | } 57 | 58 | .deck-next, .deck-after { 59 | visibility:visible; 60 | @include translate(200%); 61 | } 62 | 63 | .deck-before, .deck-previous { 64 | opacity:0.4; 65 | } 66 | } 67 | 68 | > .deck-previous { 69 | @include translate(-200%); 70 | } 71 | 72 | > .deck-before { 73 | @include translate(-400%); 74 | } 75 | 76 | > .deck-next { 77 | @include translate(200%); 78 | } 79 | 80 | > .deck-after { 81 | @include translate(400%); 82 | } 83 | 84 | > .deck-before, > .deck-previous { 85 | .slide { 86 | visibility:visible; 87 | } 88 | } 89 | 90 | > .deck-child-current { 91 | @include transform(none); 92 | } 93 | } 94 | } -------------------------------------------------------------------------------- /sample/extensions/navigation/deck.navigation.js: -------------------------------------------------------------------------------- 1 | /*! 2 | Deck JS - deck.navigation 3 | Copyright (c) 2011 Caleb Troughton 4 | Dual licensed under the MIT license and GPL license. 5 | https://github.com/imakewebthings/deck.js/blob/master/MIT-license.txt 6 | https://github.com/imakewebthings/deck.js/blob/master/GPL-license.txt 7 | */ 8 | 9 | /* 10 | This module adds clickable previous and next links to the deck. 11 | */ 12 | (function($, deck, undefined) { 13 | var $d = $(document); 14 | 15 | /* 16 | Extends defaults/options. 17 | 18 | options.classes.navDisabled 19 | This class is added to a navigation link when that action is disabled. 20 | It is added to the previous link when on the first slide, and to the 21 | next link when on the last slide. 22 | 23 | options.selectors.nextLink 24 | The elements that match this selector will move the deck to the next 25 | slide when clicked. 26 | 27 | options.selectors.previousLink 28 | The elements that match this selector will move to deck to the previous 29 | slide when clicked. 30 | */ 31 | $.extend(true, $[deck].defaults, { 32 | classes: { 33 | navDisabled: 'deck-nav-disabled' 34 | }, 35 | 36 | selectors: { 37 | nextLink: '.deck-next-link', 38 | previousLink: '.deck-prev-link' 39 | } 40 | }); 41 | 42 | $d.bind('deck.init', function() { 43 | var opts = $[deck]('getOptions'), 44 | nextSlide = $[deck]('getSlide', 1), 45 | nextId = nextSlide ? nextSlide.attr('id') : undefined; 46 | 47 | // Setup prev/next link events 48 | $(opts.selectors.previousLink) 49 | .unbind('click.decknavigation') 50 | .bind('click.decknavigation', function(e) { 51 | $[deck]('prev'); 52 | e.preventDefault(); 53 | }); 54 | 55 | $(opts.selectors.nextLink) 56 | .unbind('click.decknavigation') 57 | .bind('click.decknavigation', function(e) { 58 | $[deck]('next'); 59 | e.preventDefault(); 60 | }); 61 | 62 | // Start on first slide, previous link is disabled, set next link href 63 | $(opts.selectors.previousLink).addClass(opts.classes.navDisabled); 64 | $(opts.selectors.nextLink).attr('href', '#' + (nextId ? nextId : '')); 65 | }) 66 | /* Updates link hrefs, and disabled states if last/first slide */ 67 | .bind('deck.change', function(e, from, to) { 68 | var opts = $[deck]('getOptions'), 69 | last = $[deck]('getSlides').length - 1, 70 | prevSlide = $[deck]('getSlide', to - 1), 71 | nextSlide = $[deck]('getSlide', to + 1), 72 | prevId = prevSlide ? prevSlide.attr('id') : undefined; 73 | nextId = nextSlide ? nextSlide.attr('id') : undefined; 74 | 75 | $(opts.selectors.previousLink) 76 | .toggleClass(opts.classes.navDisabled, !to) 77 | .attr('href', '#' + (prevId ? prevId : '')); 78 | $(opts.selectors.nextLink) 79 | .toggleClass(opts.classes.navDisabled, to === last) 80 | .attr('href', '#' + (nextId ? nextId : '')); 81 | }); 82 | })(jQuery, 'deck'); 83 | 84 | -------------------------------------------------------------------------------- /sample/themes/style/neon.scss: -------------------------------------------------------------------------------- 1 | .deck-container { 2 | font-family: "Gill Sans", "Gill Sans MT", Calibri, sans-serif; 3 | font-size:1.25em; 4 | color:#aaa; 5 | background:#000; 6 | 7 | .slide { 8 | background:#000; 9 | } 10 | 11 | h1 { 12 | color:#0af; 13 | font-weight:normal; 14 | font-weight:100; 15 | text-shadow:0 0 50px #0af, 0 0 3px #fff; 16 | } 17 | 18 | h2 { 19 | color:#af0; 20 | border-bottom-color:#ccc; 21 | font-weight:normal; 22 | font-weight:100; 23 | text-shadow:0 0 15px #af0, 0 0 2px #fff; 24 | border-bottom:1px solid #333; 25 | } 26 | 27 | h3 { 28 | color:#fff; 29 | font-weight:normal; 30 | font-weight:100; 31 | text-shadow:0 0 10px #fff, 0 0 2px #fff; 32 | } 33 | 34 | pre { 35 | border-color:#333; 36 | 37 | code { 38 | color:#fff; 39 | } 40 | } 41 | 42 | code { 43 | color:#f0a; 44 | } 45 | 46 | blockquote { 47 | font-size:2em; 48 | padding:1em 2em; 49 | color:#fff; 50 | border-left:5px solid #fff; 51 | 52 | p { 53 | margin:0; 54 | } 55 | 56 | cite { 57 | font-size:.5em; 58 | font-style:normal; 59 | font-weight:normal; 60 | font-weight:100; 61 | color:#aaa; 62 | text-shadow:0 0 15px #fff, 0 0 2px #fff; 63 | } 64 | } 65 | 66 | ::-moz-selection{ background:#a0f; } 67 | ::selection { background:#a0f; } 68 | 69 | a { 70 | &, &:hover, &:focus, &:active, &:visited { 71 | color:#f0a; 72 | text-decoration:none; 73 | } 74 | 75 | &:hover, &:focus { 76 | text-decoration:underline; 77 | } 78 | } 79 | 80 | .deck-prev-link, .deck-next-link { 81 | background:#f0a; 82 | text-shadow:0 0 3px #fff; 83 | 84 | &, &:hover, &:focus, &:active, &:visited { 85 | color:#fff; 86 | } 87 | 88 | &:hover, &:focus { 89 | text-decoration:none; 90 | 91 | .boxshadow & { 92 | -webkit-box-shadow:0 0 20px #f0a, 0 0 5px #fff; 93 | -moz-box-shadow:0 0 20px #f0a, 0 0 5px #fff; 94 | box-shadow:0 0 20px #f0a, 0 0 5px #fff; 95 | } 96 | } 97 | } 98 | 99 | .deck-status { 100 | font-size:0.6666em; 101 | } 102 | 103 | .goto-form { 104 | background:#000; 105 | border:1px solid #f0a; 106 | 107 | label { 108 | color:#fff; 109 | } 110 | } 111 | 112 | &.deck-menu { 113 | .slide { 114 | background:#333; 115 | } 116 | 117 | .deck-current { 118 | background:#444; 119 | 120 | .boxshadow & { 121 | background:#000; 122 | -webkit-box-shadow:0 0 20px #f0a, 0 0 5px #fff; 123 | -moz-box-shadow:0 0 20px #f0a, 0 0 5px #fff; 124 | box-shadow:0 0 20px #f0a, 0 0 5px #fff; 125 | } 126 | } 127 | 128 | .no-touch & .slide:hover { 129 | background:#444; 130 | } 131 | 132 | .no-touch.boxshadow & .slide:hover { 133 | background:#000; 134 | -webkit-box-shadow:0 0 20px #f0a, 0 0 5px #fff; 135 | -moz-box-shadow:0 0 20px #f0a, 0 0 5px #fff; 136 | box-shadow:0 0 20px #f0a, 0 0 5px #fff; 137 | } 138 | } 139 | } 140 | -------------------------------------------------------------------------------- /sample/themes/transition/vertical-slide.scss: -------------------------------------------------------------------------------- 1 | @mixin translate($x: 0, $y: 0, $z: 0) { 2 | -webkit-transform:translate3d($x, $y, $z); 3 | -moz-transform:translate($x, $y); 4 | -ms-transform:translate($x, $y); 5 | -o-transform:translate($x, $y); 6 | transform:translate3d($x, $y, $z); 7 | } 8 | 9 | @mixin rotate($deg) { 10 | -webkit-transform:rotate($deg); 11 | -moz-transform:rotate($deg); 12 | -ms-transform:rotate($deg); 13 | -o-transform:rotate($deg); 14 | transform:rotate($deg); 15 | } 16 | 17 | @mixin transition($prop, $duration, $easing: ease-in-out, $delay: 0ms) { 18 | -webkit-transition:$prop $duration $easing $delay; 19 | -moz-transition:$prop $duration $easing $delay; 20 | -ms-transition:$prop $duration $easing $delay; 21 | -o-transition:$prop $duration $easing $delay; 22 | transition:$prop $duration $easing $delay; 23 | } 24 | 25 | @mixin transform($val) { 26 | -webkit-transform:$val; 27 | -moz-transform:$val; 28 | -ms-transform:$val; 29 | -o-transform:$val; 30 | transform:$val; 31 | } 32 | 33 | .csstransitions.csstransforms { 34 | .deck-container { 35 | overflow-y:hidden; 36 | 37 | > .slide { 38 | -webkit-transition:-webkit-transform 500ms ease-in-out; 39 | -moz-transition:-moz-transform 500ms ease-in-out; 40 | -ms-transition:-ms-transform 500ms ease-in-out; 41 | -o-transition:-o-transform 500ms ease-in-out; 42 | transition:transform 500ms ease-in-out; 43 | } 44 | } 45 | 46 | .deck-container:not(.deck-menu) { 47 | > .slide { 48 | position:absolute; 49 | top:0; 50 | left:0; 51 | -webkit-box-sizing: border-box; 52 | -moz-box-sizing: border-box; 53 | box-sizing: border-box; 54 | width:100%; 55 | padding:0 48px; 56 | 57 | .slide { 58 | position:relative; 59 | left:0; 60 | top:0; 61 | -webkit-transition:-webkit-transform 500ms ease-in-out, opacity 500ms ease-in-out; 62 | -moz-transition:-moz-transform 500ms ease-in-out, opacity 500ms ease-in-out; 63 | -ms-transition:-ms-transform 500ms ease-in-out, opacity 500ms ease-in-out; 64 | -o-transition:-o-transform 500ms ease-in-out, opacity 500ms ease-in-out; 65 | transition:-webkit-transform 500ms ease-in-out, opacity 500ms ease-in-out; 66 | } 67 | 68 | .deck-next, .deck-after { 69 | visibility:visible; 70 | @include translate(0, 1600px); 71 | } 72 | 73 | .deck-before, .deck-previous { 74 | opacity:0.4; 75 | } 76 | } 77 | 78 | > .deck-previous { 79 | @include translate(0, -200%); 80 | } 81 | 82 | > .deck-before { 83 | @include translate(0, -400%); 84 | } 85 | 86 | > .deck-next { 87 | @include translate(0, 200%); 88 | } 89 | 90 | > .deck-after { 91 | @include translate(0, 400%); 92 | } 93 | 94 | > .deck-before, > .deck-previous { 95 | .slide { 96 | visibility:visible; 97 | } 98 | } 99 | 100 | > .deck-child-current { 101 | @include transform(none); 102 | } 103 | } 104 | 105 | .deck-prev-link { 106 | left:auto; 107 | right:8px; 108 | top:59px; 109 | @include rotate(90deg); 110 | } 111 | 112 | .deck-next-link { 113 | top:99px; 114 | @include rotate(90deg); 115 | } 116 | } -------------------------------------------------------------------------------- /sample/themes/transition/horizontal-slide.css: -------------------------------------------------------------------------------- 1 | .csstransitions.csstransforms { 2 | overflow-x: hidden; 3 | } 4 | .csstransitions.csstransforms .deck-container > .slide { 5 | -webkit-transition: -webkit-transform 500ms ease-in-out; 6 | -moz-transition: -moz-transform 500ms ease-in-out; 7 | -ms-transition: -ms-transform 500ms ease-in-out; 8 | -o-transition: -o-transform 500ms ease-in-out; 9 | transition: transform 500ms ease-in-out; 10 | } 11 | .csstransitions.csstransforms .deck-container:not(.deck-menu) > .slide { 12 | position: absolute; 13 | top: 0; 14 | left: 0; 15 | -webkit-box-sizing: border-box; 16 | -moz-box-sizing: border-box; 17 | box-sizing: border-box; 18 | width: 100%; 19 | padding: 0 48px; 20 | } 21 | .csstransitions.csstransforms .deck-container:not(.deck-menu) > .slide .slide { 22 | position: relative; 23 | left: 0; 24 | top: 0; 25 | -webkit-transition: -webkit-transform 500ms ease-in-out, opacity 500ms ease-in-out; 26 | -moz-transition: -moz-transform 500ms ease-in-out, opacity 500ms ease-in-out; 27 | -ms-transition: -ms-transform 500ms ease-in-out, opacity 500ms ease-in-out; 28 | -o-transition: -o-transform 500ms ease-in-out, opacity 500ms ease-in-out; 29 | transition: -webkit-transform 500ms ease-in-out, opacity 500ms ease-in-out; 30 | } 31 | .csstransitions.csstransforms .deck-container:not(.deck-menu) > .slide .deck-next, .csstransitions.csstransforms .deck-container:not(.deck-menu) > .slide .deck-after { 32 | visibility: visible; 33 | -webkit-transform: translate3d(200%, 0, 0); 34 | -moz-transform: translate(200%, 0); 35 | -ms-transform: translate(200%, 0); 36 | -o-transform: translate(200%, 0); 37 | transform: translate3d(200%, 0, 0); 38 | } 39 | .csstransitions.csstransforms .deck-container:not(.deck-menu) > .slide .deck-before, .csstransitions.csstransforms .deck-container:not(.deck-menu) > .slide .deck-previous { 40 | opacity: 0.4; 41 | } 42 | .csstransitions.csstransforms .deck-container:not(.deck-menu) > .deck-previous { 43 | -webkit-transform: translate3d(-200%, 0, 0); 44 | -moz-transform: translate(-200%, 0); 45 | -ms-transform: translate(-200%, 0); 46 | -o-transform: translate(-200%, 0); 47 | transform: translate3d(-200%, 0, 0); 48 | } 49 | .csstransitions.csstransforms .deck-container:not(.deck-menu) > .deck-before { 50 | -webkit-transform: translate3d(-400%, 0, 0); 51 | -moz-transform: translate(-400%, 0); 52 | -ms-transform: translate(-400%, 0); 53 | -o-transform: translate(-400%, 0); 54 | transform: translate3d(-400%, 0, 0); 55 | } 56 | .csstransitions.csstransforms .deck-container:not(.deck-menu) > .deck-next { 57 | -webkit-transform: translate3d(200%, 0, 0); 58 | -moz-transform: translate(200%, 0); 59 | -ms-transform: translate(200%, 0); 60 | -o-transform: translate(200%, 0); 61 | transform: translate3d(200%, 0, 0); 62 | } 63 | .csstransitions.csstransforms .deck-container:not(.deck-menu) > .deck-after { 64 | -webkit-transform: translate3d(400%, 0, 0); 65 | -moz-transform: translate(400%, 0); 66 | -ms-transform: translate(400%, 0); 67 | -o-transform: translate(400%, 0); 68 | transform: translate3d(400%, 0, 0); 69 | } 70 | .csstransitions.csstransforms .deck-container:not(.deck-menu) > .deck-before .slide, .csstransitions.csstransforms .deck-container:not(.deck-menu) > .deck-previous .slide { 71 | visibility: visible; 72 | } 73 | .csstransitions.csstransforms .deck-container:not(.deck-menu) > .deck-child-current { 74 | -webkit-transform: none; 75 | -moz-transform: none; 76 | -ms-transform: none; 77 | -o-transform: none; 78 | transform: none; 79 | } 80 | -------------------------------------------------------------------------------- /sample/extensions/goto/deck.goto.js: -------------------------------------------------------------------------------- 1 | /*! 2 | Deck JS - deck.goto 3 | Copyright (c) 2011 Caleb Troughton 4 | Dual licensed under the MIT license and GPL license. 5 | https://github.com/imakewebthings/deck.js/blob/master/MIT-license.txt 6 | https://github.com/imakewebthings/deck.js/blob/master/GPL-license.txt 7 | */ 8 | 9 | /* 10 | This module adds the necessary methods and key bindings to show and hide a form 11 | for jumping to any slide number in the deck (and processes that form 12 | accordingly). The form-showing state is indicated by the presence of a class on 13 | the deck container. 14 | */ 15 | (function($, deck, undefined) { 16 | var $d = $(document); 17 | 18 | /* 19 | Extends defaults/options. 20 | 21 | options.classes.goto 22 | This class is added to the deck container when showing the Go To Slide 23 | form. 24 | 25 | options.selectors.gotoForm 26 | The element that matches this selector is the form that is submitted 27 | when a user hits enter after typing a slide number in the gotoInput 28 | element. 29 | 30 | options.selectors.gotoInput 31 | The element that matches this selector is the text input field for 32 | entering a slide number in the Go To Slide form. 33 | 34 | options.keys.goto 35 | The numeric keycode used to toggle between showing and hiding the Go To 36 | Slide form. 37 | */ 38 | $.extend(true, $[deck].defaults, { 39 | classes: { 40 | goto: 'deck-goto' 41 | }, 42 | 43 | selectors: { 44 | gotoForm: '.goto-form', 45 | gotoInput: '#goto-slide' 46 | }, 47 | 48 | keys: { 49 | goto: 71 // g 50 | } 51 | }); 52 | 53 | /* 54 | jQuery.deck('showGoTo') 55 | 56 | Shows the Go To Slide form by adding the class specified by the goto class 57 | option to the deck container. 58 | */ 59 | $[deck]('extend', 'showGoTo', function() { 60 | $[deck]('getContainer').addClass($[deck]('getOptions').classes.goto); 61 | $($[deck]('getOptions').selectors.gotoInput).focus(); 62 | }); 63 | 64 | /* 65 | jQuery.deck('hideGoTo') 66 | 67 | Hides the Go To Slide form by removing the class specified by the goto class 68 | option from the deck container. 69 | */ 70 | $[deck]('extend', 'hideGoTo', function() { 71 | $[deck]('getContainer').removeClass($[deck]('getOptions').classes.goto); 72 | $($[deck]('getOptions').selectors.gotoInput).blur(); 73 | }); 74 | 75 | /* 76 | jQuery.deck('toggleGoTo') 77 | 78 | Toggles between showing and hiding the Go To Slide form. 79 | */ 80 | $[deck]('extend', 'toggleGoTo', function() { 81 | $[deck]($[deck]('getContainer').hasClass($[deck]('getOptions').classes.goto) ? 'hideGoTo' : 'showGoTo'); 82 | }); 83 | 84 | $d.bind('deck.init', function() { 85 | // Bind key events 86 | $d.unbind('keydown.deckgoto').bind('keydown.deckgoto', function(e) { 87 | var key = $[deck]('getOptions').keys.goto; 88 | 89 | if (e.which === key ||$.inArray(e.which, key) > -1) { 90 | e.preventDefault(); 91 | $[deck]('toggleGoTo'); 92 | } 93 | }); 94 | 95 | // Process form submittal, go to the slide entered 96 | $($[deck]('getOptions').selectors.gotoForm) 97 | .unbind('submit.deckgoto') 98 | .bind('submit.deckgoto', function(e) { 99 | var $field = ($($[deck]('getOptions').selectors.gotoInput)), 100 | i = parseInt($field.val(), 10); 101 | 102 | if (!($.isNaN(i) || i < 1 || i > $[deck]('getSlides').length)) { 103 | $[deck]('go', i - 1); 104 | $[deck]('hideGoTo'); 105 | $field.val(''); 106 | } 107 | 108 | e.preventDefault(); 109 | }); 110 | 111 | $($[deck]('getOptions').selectors.gotoInput) 112 | .unbind('keydown.deckgoto') 113 | .bind('keydown.deckgoto', function(e) { 114 | e.stopPropagation(); 115 | }); 116 | }); 117 | })(jQuery, 'deck'); 118 | 119 | -------------------------------------------------------------------------------- /sample/themes/style/neon.css: -------------------------------------------------------------------------------- 1 | .deck-container { 2 | font-family: "Gill Sans", "Gill Sans MT", Calibri, sans-serif; 3 | font-size: 1.25em; 4 | color: #aaa; 5 | background: #000; 6 | } 7 | .deck-container .slide { 8 | background: #000; 9 | } 10 | .deck-container h1 { 11 | color: #0af; 12 | font-weight: normal; 13 | font-weight: 100; 14 | text-shadow: 0 0 50px #0af, 0 0 3px #fff; 15 | } 16 | .deck-container h2 { 17 | color: #af0; 18 | border-bottom-color: #ccc; 19 | font-weight: normal; 20 | font-weight: 100; 21 | text-shadow: 0 0 15px #af0, 0 0 2px #fff; 22 | border-bottom: 1px solid #333; 23 | } 24 | .deck-container h3 { 25 | color: #fff; 26 | font-weight: normal; 27 | font-weight: 100; 28 | text-shadow: 0 0 10px #fff, 0 0 2px #fff; 29 | } 30 | .deck-container pre { 31 | border-color: #333; 32 | } 33 | .deck-container pre code { 34 | color: #fff; 35 | } 36 | .deck-container code { 37 | color: #f0a; 38 | } 39 | .deck-container blockquote { 40 | font-size: 2em; 41 | padding: 1em 2em; 42 | color: #fff; 43 | border-left: 5px solid #fff; 44 | } 45 | .deck-container blockquote p { 46 | margin: 0; 47 | } 48 | .deck-container blockquote cite { 49 | font-size: .5em; 50 | font-style: normal; 51 | font-weight: normal; 52 | font-weight: 100; 53 | color: #aaa; 54 | text-shadow: 0 0 15px #fff, 0 0 2px #fff; 55 | } 56 | .deck-container ::-moz-selection { 57 | background: #a0f; 58 | } 59 | .deck-container ::selection { 60 | background: #a0f; 61 | } 62 | .deck-container a, .deck-container a:hover, .deck-container a:focus, .deck-container a:active, .deck-container a:visited { 63 | color: #f0a; 64 | text-decoration: none; 65 | } 66 | .deck-container a:hover, .deck-container a:focus { 67 | text-decoration: underline; 68 | } 69 | .deck-container .deck-prev-link, .deck-container .deck-next-link { 70 | background: #f0a; 71 | text-shadow: 0 0 3px #fff; 72 | } 73 | .deck-container .deck-prev-link, .deck-container .deck-prev-link:hover, .deck-container .deck-prev-link:focus, .deck-container .deck-prev-link:active, .deck-container .deck-prev-link:visited, .deck-container .deck-next-link, .deck-container .deck-next-link:hover, .deck-container .deck-next-link:focus, .deck-container .deck-next-link:active, .deck-container .deck-next-link:visited { 74 | color: #fff; 75 | } 76 | .deck-container .deck-prev-link:hover, .deck-container .deck-prev-link:focus, .deck-container .deck-next-link:hover, .deck-container .deck-next-link:focus { 77 | text-decoration: none; 78 | } 79 | .boxshadow .deck-container .deck-prev-link:hover, .boxshadow .deck-container .deck-prev-link:focus, .boxshadow .deck-container .deck-next-link:hover, .boxshadow .deck-container .deck-next-link:focus { 80 | -webkit-box-shadow: 0 0 20px #f0a, 0 0 5px #fff; 81 | -moz-box-shadow: 0 0 20px #f0a, 0 0 5px #fff; 82 | box-shadow: 0 0 20px #f0a, 0 0 5px #fff; 83 | } 84 | .deck-container .deck-status { 85 | font-size: 0.6666em; 86 | } 87 | .deck-container .goto-form { 88 | background: #000; 89 | border: 1px solid #f0a; 90 | } 91 | .deck-container .goto-form label { 92 | color: #fff; 93 | } 94 | .deck-container.deck-menu .slide { 95 | background: #333; 96 | } 97 | .deck-container.deck-menu .deck-current { 98 | background: #444; 99 | } 100 | .boxshadow .deck-container.deck-menu .deck-current { 101 | background: #000; 102 | -webkit-box-shadow: 0 0 20px #f0a, 0 0 5px #fff; 103 | -moz-box-shadow: 0 0 20px #f0a, 0 0 5px #fff; 104 | box-shadow: 0 0 20px #f0a, 0 0 5px #fff; 105 | } 106 | .no-touch .deck-container.deck-menu .slide:hover { 107 | background: #444; 108 | } 109 | .no-touch.boxshadow .deck-container.deck-menu .slide:hover { 110 | background: #000; 111 | -webkit-box-shadow: 0 0 20px #f0a, 0 0 5px #fff; 112 | -moz-box-shadow: 0 0 20px #f0a, 0 0 5px #fff; 113 | box-shadow: 0 0 20px #f0a, 0 0 5px #fff; 114 | } 115 | -------------------------------------------------------------------------------- /sample/extensions/menu/deck.menu.js: -------------------------------------------------------------------------------- 1 | /*! 2 | Deck JS - deck.menu 3 | Copyright (c) 2011 Caleb Troughton 4 | Dual licensed under the MIT license and GPL license. 5 | https://github.com/imakewebthings/deck.js/blob/master/MIT-license.txt 6 | https://github.com/imakewebthings/deck.js/blob/master/GPL-license.txt 7 | */ 8 | 9 | /* 10 | This module adds the methods and key binding to show and hide a menu of all 11 | slides in the deck. The deck menu state is indicated by the presence of a class 12 | on the deck container. 13 | */ 14 | (function($, deck, undefined) { 15 | var $d = $(document); 16 | 17 | /* 18 | Extends defaults/options. 19 | 20 | options.classes.menu 21 | This class is added to the deck container when showing the slide menu. 22 | 23 | options.keys.menu 24 | The numeric keycode used to toggle between showing and hiding the slide 25 | menu. 26 | 27 | options.touch.doubletapWindow 28 | Two consecutive touch events within this number of milliseconds will 29 | be considered a double tap, and will toggle the menu on touch devices. 30 | */ 31 | $.extend(true, $[deck].defaults, { 32 | classes: { 33 | menu: 'deck-menu' 34 | }, 35 | 36 | keys: { 37 | menu: 77 // m 38 | }, 39 | 40 | touch: { 41 | doubletapWindow: 400 42 | } 43 | }); 44 | 45 | /* 46 | jQuery.deck('showMenu') 47 | 48 | Shows the slide menu by adding the class specified by the menu class option 49 | to the deck container. 50 | */ 51 | $[deck]('extend', 'showMenu', function() { 52 | $[deck]('getContainer').addClass($[deck]('getOptions').classes.menu); 53 | $[deck]('getContainer').scrollTop($[deck]('getSlide').offset().top); 54 | }); 55 | 56 | /* 57 | jQuery.deck('hideMenu') 58 | 59 | Hides the slide menu by removing the class specified by the menu class 60 | option from the deck container. 61 | */ 62 | $[deck]('extend', 'hideMenu', function() { 63 | $[deck]('getContainer').removeClass($[deck]('getOptions').classes.menu); 64 | $[deck]('getContainer').scrollTop(0); 65 | }); 66 | 67 | /* 68 | jQuery.deck('toggleMenu') 69 | 70 | Toggles between showing and hiding the slide menu. 71 | */ 72 | $[deck]('extend', 'toggleMenu', function() { 73 | $[deck]('getContainer').hasClass($[deck]('getOptions').classes.menu) ? 74 | $[deck]('hideMenu') : $[deck]('showMenu'); 75 | }); 76 | 77 | $d.bind('deck.init', function() { 78 | var opts = $[deck]('getOptions'), 79 | touchEndTime = 0, 80 | currentSlide; 81 | 82 | // Bind key events 83 | $d.unbind('keydown.deckmenu').bind('keydown.deckmenu', function(e) { 84 | if (e.which === opts.keys.menu || $.inArray(e.which, opts.keys.menu) > -1) { 85 | $[deck]('toggleMenu'); 86 | e.preventDefault(); 87 | } 88 | }); 89 | 90 | // Double tap to toggle slide menu for touch devices 91 | $[deck]('getContainer').unbind('touchstart.deckmenu').bind('touchstart.deckmenu', function(e) { 92 | currentSlide = $[deck]('getSlide'); 93 | }) 94 | .unbind('touchend.deckmenu').bind('touchend.deckmenu', function(e) { 95 | var now = Date.now(); 96 | 97 | // Ignore this touch event if it caused a nav change (swipe) 98 | if (currentSlide !== $[deck]('getSlide')) return; 99 | 100 | if (now - touchEndTime < opts.touch.doubletapWindow) { 101 | $[deck]('toggleMenu'); 102 | e.preventDefault(); 103 | } 104 | touchEndTime = now; 105 | }); 106 | 107 | // Selecting slides from the menu 108 | $.each($[deck]('getSlides'), function(i, $s) { 109 | $s.unbind('click.deckmenu').bind('click.deckmenu', function(e) { 110 | if (!$[deck]('getContainer').hasClass(opts.classes.menu)) return; 111 | 112 | $[deck]('go', i); 113 | $[deck]('hideMenu'); 114 | e.stopPropagation(); 115 | e.preventDefault(); 116 | }); 117 | }); 118 | }) 119 | .bind('deck.change', function(e, from, to) { 120 | var container = $[deck]('getContainer'); 121 | 122 | if (container.hasClass($[deck]('getOptions').classes.menu)) { 123 | container.scrollTop($[deck]('getSlide', to).offset().top); 124 | } 125 | }); 126 | })(jQuery, 'deck'); 127 | 128 | -------------------------------------------------------------------------------- /sample/themes/transition/vertical-slide.css: -------------------------------------------------------------------------------- 1 | .csstransitions.csstransforms .deck-container { 2 | overflow-y: hidden; 3 | } 4 | .csstransitions.csstransforms .deck-container > .slide { 5 | -webkit-transition: -webkit-transform 500ms ease-in-out; 6 | -moz-transition: -moz-transform 500ms ease-in-out; 7 | -ms-transition: -ms-transform 500ms ease-in-out; 8 | -o-transition: -o-transform 500ms ease-in-out; 9 | transition: transform 500ms ease-in-out; 10 | } 11 | .csstransitions.csstransforms .deck-container:not(.deck-menu) > .slide { 12 | position: absolute; 13 | top: 0; 14 | left: 0; 15 | -webkit-box-sizing: border-box; 16 | -moz-box-sizing: border-box; 17 | box-sizing: border-box; 18 | width: 100%; 19 | padding: 0 48px; 20 | } 21 | .csstransitions.csstransforms .deck-container:not(.deck-menu) > .slide .slide { 22 | position: relative; 23 | left: 0; 24 | top: 0; 25 | -webkit-transition: -webkit-transform 500ms ease-in-out, opacity 500ms ease-in-out; 26 | -moz-transition: -moz-transform 500ms ease-in-out, opacity 500ms ease-in-out; 27 | -ms-transition: -ms-transform 500ms ease-in-out, opacity 500ms ease-in-out; 28 | -o-transition: -o-transform 500ms ease-in-out, opacity 500ms ease-in-out; 29 | transition: -webkit-transform 500ms ease-in-out, opacity 500ms ease-in-out; 30 | } 31 | .csstransitions.csstransforms .deck-container:not(.deck-menu) > .slide .deck-next, .csstransitions.csstransforms .deck-container:not(.deck-menu) > .slide .deck-after { 32 | visibility: visible; 33 | -webkit-transform: translate3d(0, 1600px, 0); 34 | -moz-transform: translate(0, 1600px); 35 | -ms-transform: translate(0, 1600px); 36 | -o-transform: translate(0, 1600px); 37 | transform: translate3d(0, 1600px, 0); 38 | } 39 | .csstransitions.csstransforms .deck-container:not(.deck-menu) > .slide .deck-before, .csstransitions.csstransforms .deck-container:not(.deck-menu) > .slide .deck-previous { 40 | opacity: 0.4; 41 | } 42 | .csstransitions.csstransforms .deck-container:not(.deck-menu) > .deck-previous { 43 | -webkit-transform: translate3d(0, -200%, 0); 44 | -moz-transform: translate(0, -200%); 45 | -ms-transform: translate(0, -200%); 46 | -o-transform: translate(0, -200%); 47 | transform: translate3d(0, -200%, 0); 48 | } 49 | .csstransitions.csstransforms .deck-container:not(.deck-menu) > .deck-before { 50 | -webkit-transform: translate3d(0, -400%, 0); 51 | -moz-transform: translate(0, -400%); 52 | -ms-transform: translate(0, -400%); 53 | -o-transform: translate(0, -400%); 54 | transform: translate3d(0, -400%, 0); 55 | } 56 | .csstransitions.csstransforms .deck-container:not(.deck-menu) > .deck-next { 57 | -webkit-transform: translate3d(0, 200%, 0); 58 | -moz-transform: translate(0, 200%); 59 | -ms-transform: translate(0, 200%); 60 | -o-transform: translate(0, 200%); 61 | transform: translate3d(0, 200%, 0); 62 | } 63 | .csstransitions.csstransforms .deck-container:not(.deck-menu) > .deck-after { 64 | -webkit-transform: translate3d(0, 400%, 0); 65 | -moz-transform: translate(0, 400%); 66 | -ms-transform: translate(0, 400%); 67 | -o-transform: translate(0, 400%); 68 | transform: translate3d(0, 400%, 0); 69 | } 70 | .csstransitions.csstransforms .deck-container:not(.deck-menu) > .deck-before .slide, .csstransitions.csstransforms .deck-container:not(.deck-menu) > .deck-previous .slide { 71 | visibility: visible; 72 | } 73 | .csstransitions.csstransforms .deck-container:not(.deck-menu) > .deck-child-current { 74 | -webkit-transform: none; 75 | -moz-transform: none; 76 | -ms-transform: none; 77 | -o-transform: none; 78 | transform: none; 79 | } 80 | .csstransitions.csstransforms .deck-prev-link { 81 | left: auto; 82 | right: 8px; 83 | top: 59px; 84 | -webkit-transform: rotate(90deg); 85 | -moz-transform: rotate(90deg); 86 | -ms-transform: rotate(90deg); 87 | -o-transform: rotate(90deg); 88 | transform: rotate(90deg); 89 | } 90 | .csstransitions.csstransforms .deck-next-link { 91 | top: 99px; 92 | -webkit-transform: rotate(90deg); 93 | -moz-transform: rotate(90deg); 94 | -ms-transform: rotate(90deg); 95 | -o-transform: rotate(90deg); 96 | transform: rotate(90deg); 97 | } 98 | -------------------------------------------------------------------------------- /sample/extensions/hash/deck.hash.js: -------------------------------------------------------------------------------- 1 | /*! 2 | Deck JS - deck.hash 3 | Copyright (c) 2011 Caleb Troughton 4 | Dual licensed under the MIT license and GPL license. 5 | https://github.com/imakewebthings/deck.js/blob/master/MIT-license.txt 6 | https://github.com/imakewebthings/deck.js/blob/master/GPL-license.txt 7 | */ 8 | 9 | /* 10 | This module adds deep linking to individual slides, enables internal links 11 | to slides within decks, and updates the address bar with the hash as the user 12 | moves through the deck. A permalink anchor is also updated. Standard themes 13 | hide this link in browsers that support the History API, and show it for 14 | those that do not. Slides that do not have an id are assigned one according to 15 | the hashPrefix option. In addition to the on-slide container state class 16 | kept by core, this module adds an on-slide state class that uses the id of each 17 | slide. 18 | */ 19 | (function ($, deck, window, undefined) { 20 | var $d = $(document), 21 | $window = $(window), 22 | 23 | /* Collection of internal fragment links in the deck */ 24 | $internals, 25 | 26 | /* 27 | Internal only function. Given a string, extracts the id from the hash, 28 | matches it to the appropriate slide, and navigates there. 29 | */ 30 | goByHash = function(str) { 31 | var id = str.substr(str.indexOf("#") + 1), 32 | slides = $[deck]('getSlides'); 33 | 34 | $.each(slides, function(i, $el) { 35 | if ($el.attr('id') === id) { 36 | $[deck]('go', i); 37 | return false; 38 | } 39 | }); 40 | 41 | // If we don't set these to 0 the container scrolls due to hashchange 42 | $[deck]('getContainer').scrollLeft(0).scrollTop(0); 43 | }; 44 | 45 | /* 46 | Extends defaults/options. 47 | 48 | options.selectors.hashLink 49 | The element matching this selector has its href attribute updated to 50 | the hash of the current slide as the user navigates through the deck. 51 | 52 | options.hashPrefix 53 | Every slide that does not have an id is assigned one at initialization. 54 | Assigned ids take the form of hashPrefix + slideIndex, e.g., slide-0, 55 | slide-12, etc. 56 | */ 57 | $.extend(true, $[deck].defaults, { 58 | selectors: { 59 | hashLink: '.deck-permalink' 60 | }, 61 | 62 | hashPrefix: 'slide-' 63 | }); 64 | 65 | 66 | $d.bind('deck.init', function() { 67 | var opts = $[deck]('getOptions'); 68 | $internals = $(); 69 | 70 | $.each($[deck]('getSlides'), function(i, $el) { 71 | var hash; 72 | 73 | /* Hand out ids to the unfortunate slides born without them */ 74 | if (!$el.attr('id')) { 75 | $el.attr('id', opts.hashPrefix + i); 76 | } 77 | 78 | hash ='#' + $el.attr('id'); 79 | 80 | /* Deep link to slides on init */ 81 | if (hash === window.location.hash) { 82 | $[deck]('go', i); 83 | } 84 | 85 | /* Add internal links to this slide */ 86 | $internals = $internals.add('a[href="' + hash + '"]'); 87 | }); 88 | 89 | if (!Modernizr.hashchange) { 90 | /* Set up internal links using click for the poor browsers 91 | without a hashchange event. */ 92 | $internals.unbind('click.deckhash').bind('click.deckhash', function(e) { 93 | goByHash($(this).attr('href')); 94 | }); 95 | } 96 | 97 | /* Set up first id container state class */ 98 | $[deck]('getContainer').addClass(opts.classes.onPrefix + $[deck]('getSlide').attr('id')); 99 | }) 100 | /* Update permalink, address bar, and state class on a slide change */ 101 | .bind('deck.change', function(e, from, to) { 102 | var hash = '#' + $[deck]('getSlide', to).attr('id'), 103 | opts = $[deck]('getOptions'), 104 | osp = opts.classes.onPrefix, 105 | $c = $[deck]('getContainer'); 106 | 107 | $c.removeClass(osp + $[deck]('getSlide', from).attr('id')); 108 | $c.addClass(osp + $[deck]('getSlide', to).attr('id')); 109 | 110 | $(opts.selectors.hashLink).attr('href', hash); 111 | if (Modernizr.history) { 112 | window.history.replaceState({}, "", hash); 113 | } 114 | }); 115 | 116 | /* Deals with internal links in modern browsers */ 117 | $window.bind('hashchange.deckhash', function(e) { 118 | if (e.originalEvent && e.originalEvent.newURL) { 119 | goByHash(e.originalEvent.newURL); 120 | } 121 | else { 122 | goByHash(window.location.hash); 123 | } 124 | }); 125 | })(jQuery, 'deck', this); -------------------------------------------------------------------------------- /sample/extensions/scale/deck.scale.js: -------------------------------------------------------------------------------- 1 | /*! 2 | Deck JS - deck.scale 3 | Copyright (c) 2011 Caleb Troughton 4 | Dual licensed under the MIT license and GPL license. 5 | https://github.com/imakewebthings/deck.js/blob/master/MIT-license.txt 6 | https://github.com/imakewebthings/deck.js/blob/master/GPL-license.txt 7 | */ 8 | 9 | /* 10 | This module adds automatic scaling to the deck. It should only be used on 11 | standalone decks where the body is the deck container. Slides are scaled down 12 | using CSS transforms to fit within the browser window. If the browser window 13 | is big enough to hold the slides without scaling, no scaling occurs. The user 14 | can disable and enable scaling with a keyboard shortcut. 15 | 16 | Note: CSS transforms make Flash videos render incorrectly. Presenters that 17 | need to use video will want to disable scaling to play them. HTML5 video 18 | works fine. 19 | */ 20 | (function($, deck, window, undefined) { 21 | var $d = $(document), 22 | $w = $(window), 23 | baseHeight, // Value to scale against 24 | timer, // Timeout id for debouncing 25 | 26 | /* 27 | Internal function to do all the dirty work of scaling the deck container. 28 | */ 29 | scaleDeck = function() { 30 | var obh = $[deck]('getOptions').baseHeight, 31 | $container = $[deck]('getContainer'), 32 | height = $w.height(), 33 | slides = $[deck]('getSlides'), 34 | scale, 35 | transform; 36 | 37 | // Don't scale if scaling disabled 38 | if (!$container.hasClass($[deck]('getOptions').classes.scale)) { 39 | scale = 1; 40 | } 41 | else { 42 | // Use tallest slide as base height if not set manually 43 | baseHeight = obh ? obh : (function() { 44 | var greatest = 0; 45 | 46 | $.each(slides, function(i, $slide) { 47 | greatest = Math.max(greatest, $slide.outerHeight()); 48 | }); 49 | 50 | return greatest; 51 | })(); 52 | 53 | scale = height / baseHeight; 54 | } 55 | 56 | // Scale, but don't scale up 57 | transform = scale >= 1 ? 'none' : 'scale(' + scale + ')'; 58 | $.each('Webkit Moz O ms Khtml'.split(' '), function(i, prefix) { 59 | $container.css(prefix + 'Transform', transform); 60 | }); 61 | }; 62 | 63 | /* 64 | Extends defaults/options. 65 | 66 | options.classes.scale 67 | This class is added to the deck container when scaling is enabled. 68 | It is enabled by default when the module is included. 69 | 70 | options.keys.scale 71 | The numeric keycode used to toggle enabling and disabling scaling. 72 | 73 | options.baseHeight 74 | When baseheight is falsy, as it is by default, the deck is scaled 75 | in proportion to the height of the slides. You may instead specify 76 | a height, and the deck will be scaled against this height regardless 77 | of the actual content height. 78 | 79 | options.scaleDebounce 80 | Scaling on the browser resize event is debounced. This number is the 81 | threshold in milliseconds. You can learn more about debouncing here: 82 | http://unscriptable.com/index.php/2009/03/20/debouncing-javascript-methods/ 83 | 84 | */ 85 | $.extend(true, $[deck].defaults, { 86 | classes: { 87 | scale: 'deck-scale' 88 | }, 89 | 90 | keys: { 91 | scale: 83 // s 92 | }, 93 | 94 | baseHeight: null, 95 | scaleDebounce: 200 96 | }); 97 | 98 | /* 99 | jQuery.deck('disableScale') 100 | 101 | Disables scaling and removes the scale class from the deck container. 102 | */ 103 | $[deck]('extend', 'disableScale', function() { 104 | $[deck]('getContainer').removeClass($[deck]('getOptions').classes.scale); 105 | scaleDeck(); 106 | }); 107 | 108 | /* 109 | jQuery.deck('enableScale') 110 | 111 | Enables scaling and adds the scale class to the deck container. 112 | */ 113 | $[deck]('extend', 'enableScale', function() { 114 | $[deck]('getContainer').addClass($[deck]('getOptions').classes.scale); 115 | scaleDeck(); 116 | }); 117 | 118 | /* 119 | jQuery.deck('toggleScale') 120 | 121 | Toggles between enabling and disabling scaling. 122 | */ 123 | $[deck]('extend', 'toggleScale', function() { 124 | var $c = $[deck]('getContainer'); 125 | $[deck]($c.hasClass($[deck]('getOptions').classes.scale) ? 126 | 'disableScale' : 'enableScale'); 127 | }); 128 | 129 | $d.bind('deck.init', function() { 130 | var opts = $[deck]('getOptions'); 131 | 132 | // Scaling enabled at start 133 | $[deck]('getContainer').addClass(opts.classes.scale); 134 | 135 | // Debounce the resize scaling 136 | $w.unbind('resize.deckscale').bind('resize.deckscale', function() { 137 | window.clearTimeout(timer); 138 | timer = window.setTimeout(scaleDeck, opts.scaleDebounce); 139 | }) 140 | // Scale once on load, in case images or something change layout 141 | .unbind('load.deckscale').bind('load.deckscale', scaleDeck); 142 | 143 | // Bind key events 144 | $d.unbind('keydown.deckscale').bind('keydown.deckscale', function(e) { 145 | if (e.which === opts.keys.scale || $.inArray(e.which, opts.keys.scale) > -1) { 146 | $[deck]('toggleScale'); 147 | e.preventDefault(); 148 | } 149 | }); 150 | 151 | // Scale once on init 152 | scaleDeck(); 153 | }); 154 | })(jQuery, 'deck', this); 155 | 156 | -------------------------------------------------------------------------------- /sample/themes/style/web-2.0.scss: -------------------------------------------------------------------------------- 1 | @mixin border-radius($r) { 2 | -webkit-border-radius:$r; 3 | -moz-border-radius:$r; 4 | border-radius:$r; 5 | } 6 | 7 | @mixin rotate($deg) { 8 | -webkit-transform:rotate($deg); 9 | -moz-transform:rotate($deg); 10 | -ms-transform:rotate($deg); 11 | -o-transform:rotate($deg); 12 | transform:rotate($deg); 13 | } 14 | 15 | @mixin box-shadow($x, $y, $blur, $color) { 16 | -webkit-box-shadow:$x $y $blur $color; 17 | -moz-box-shadow:$x $y $blur $color; 18 | box-shadow:$x $y $blur $color; 19 | } 20 | 21 | 22 | .deck-container { 23 | font-family: "Gill Sans", "Gill Sans MT", Calibri, sans-serif; 24 | font-size:1.25em; 25 | background: rgb(244,250,254); /* Old browsers */ 26 | background: -moz-linear-gradient(top, rgba(244,250,254,1) 0%, rgba(204,240,240,1) 100%); /* FF3.6+ */ 27 | background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(244,250,254,1)), color-stop(100%,rgba(204,240,240,1))); /* Chrome,Safari4+ */ 28 | background: -webkit-linear-gradient(top, rgba(244,250,254,1) 0%,rgba(204,240,240,1) 100%); /* Chrome10+,Safari5.1+ */ 29 | background: -o-linear-gradient(top, rgba(244,250,254,1) 0%,rgba(204,240,240,1) 100%); /* Opera11.10+ */ 30 | background: -ms-linear-gradient(top, rgba(244,250,254,1) 0%,rgba(204,240,240,1) 100%); /* IE10+ */ 31 | background: linear-gradient(top, rgba(244,250,254,1) 0%,rgba(204,240,240,1) 100%); /* W3C */ 32 | background-attachment: fixed; 33 | 34 | > .slide { 35 | text-shadow:1px 1px 1px rgba(255,255,255,.5); 36 | } 37 | 38 | h1, h2, h3, h4, h5, h6 { 39 | font-family: "Hoefler Text", Constantia, Palatino, "Palatino Linotype", "Book Antiqua", Georgia, serif; 40 | } 41 | 42 | h1 { 43 | color:#08455f; 44 | } 45 | 46 | h2 { 47 | color:#0b7495; 48 | border-bottom:0; 49 | 50 | .cssreflections & { 51 | line-height:1; 52 | -webkit-box-reflect:below -0.5555em -webkit-gradient(linear, left top, left bottom, from(transparent), color-stop(0.3, transparent), color-stop(0.7, rgba(255,255,255,.1)), to(transparent)); 53 | -moz-box-reflect:below -0.5555em -moz-linear-gradient(top, transparent 0%, transparent 30%, rgba(255,255,255,.3) 100%); 54 | } 55 | } 56 | 57 | h3 { 58 | color:#000; 59 | } 60 | 61 | pre { 62 | border-color:#cde; 63 | background:#fff; 64 | position:relative; 65 | 66 | .borderradius & { 67 | @include border-radius(5px); 68 | } 69 | 70 | /* http://nicolasgallagher.com/css-drop-shadows-without-images/ */ 71 | .csstransforms.boxshadow & { 72 | &:before, &:after { 73 | content:""; 74 | position:absolute; 75 | z-index:-1; 76 | bottom:15px; 77 | width:50%; 78 | height:20%; 79 | max-width:300px; 80 | @include box-shadow(0, 15px, 10px, rgba(0, 0, 0, 0.7)); 81 | } 82 | 83 | &:before { 84 | left:10px; 85 | @include rotate(-3deg); 86 | } 87 | 88 | &:after { 89 | right:10px; 90 | @include rotate(3deg); 91 | } 92 | } 93 | } 94 | 95 | code { 96 | color:#789; 97 | } 98 | 99 | blockquote { 100 | font-family: "Hoefler Text", Constantia, Palatino, "Palatino Linotype", "Book Antiqua", Georgia, serif; 101 | font-size:2em; 102 | padding:1em 2em .5em 2em; 103 | color:#000; 104 | background:#fff; 105 | position:relative; 106 | border:1px solid #cde; 107 | 108 | .borderradius & { 109 | @include border-radius(5px); 110 | } 111 | 112 | .boxshadow & { 113 | &:after { 114 | content:""; 115 | position:absolute; 116 | z-index:-1; 117 | top: 10px; 118 | bottom: 10px; 119 | left: 0; 120 | right: 50%; 121 | -moz-border-radius: 10px / 100px; 122 | border-radius: 10px / 100px; 123 | @include box-shadow(0, 0, 15px, rgba(0,0,0,0.6)); 124 | } 125 | } 126 | 127 | p { 128 | margin:0; 129 | } 130 | 131 | cite { 132 | font-size:.5em; 133 | font-style:normal; 134 | font-weight:bold; 135 | color:#888; 136 | } 137 | 138 | &:before { 139 | content:"“"; 140 | position:absolute; 141 | top:0; 142 | left:0; 143 | font-size:5em; 144 | line-height:1; 145 | color:#ccf0f0; 146 | z-index:1; 147 | } 148 | } 149 | 150 | .borderradius img { 151 | @include border-radius(5px); 152 | } 153 | 154 | ::-moz-selection{ background:#08455f; color:#fff; } 155 | ::selection { background:#08455f; color:#fff; } 156 | 157 | a { 158 | &, &:hover, &:focus, &:active, &:visited { 159 | color:#599; 160 | text-decoration:none; 161 | } 162 | 163 | &:hover, &:focus { 164 | text-decoration:underline; 165 | } 166 | } 167 | 168 | .deck-prev-link, .deck-next-link { 169 | background:#fff; 170 | opacity:0.5; 171 | 172 | &, &:hover, &:focus, &:active, &:visited { 173 | color:#599; 174 | } 175 | 176 | &:hover, &:focus { 177 | opacity:1; 178 | text-decoration:none; 179 | } 180 | } 181 | 182 | .deck-status { 183 | font-size:0.6666em; 184 | } 185 | 186 | &.deck-menu { 187 | .slide { 188 | background:transparent; 189 | @include border-radius(5px); 190 | 191 | .rgba & { 192 | background:rgba(0,0,0,.1); 193 | } 194 | 195 | &.deck-current, .rgba &.deck-current, .no-touch &:hover { 196 | background:#fff; 197 | } 198 | } 199 | } 200 | 201 | .goto-form { 202 | background:#fff; 203 | border:1px solid #cde; 204 | @include border-radius(5px); 205 | 206 | .boxshadow & { 207 | -webkit-box-shadow: 0 15px 10px -10px rgba(0, 0, 0, 0.5), 0 1px 4px rgba(0, 0, 0, 0.3), 0 0 40px rgba(0, 0, 0, 0.1) inset; 208 | -moz-box-shadow: 0 15px 10px -10px rgba(0, 0, 0, 0.5), 0 1px 4px rgba(0, 0, 0, 0.3), 0 0 40px rgba(0, 0, 0, 0.1) inset; 209 | box-shadow: 0 15px 10px -10px rgba(0, 0, 0, 0.5), 0 1px 4px rgba(0, 0, 0, 0.3), 0 0 40px rgba(0, 0, 0, 0.1) inset; 210 | } 211 | } 212 | } 213 | 214 | 215 | -------------------------------------------------------------------------------- /sample/testdeck.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | Test-deck 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 53 | 54 |
55 | # Getting Started with deck.js 56 |
57 | 58 |
59 |

This slide is not interpreted as markdown

60 |

Use this to prevent certain flaws when processing sub slides...

61 |
62 | 63 |
64 | ## How to Make a Deck 65 | 1. **Write Slides** 66 | 67 | Slide content is simple Markdown. 68 | 69 | 2. **Choose Themes** 70 | 71 | One for slide styles and one for deck transitions. 72 | 73 | 3. **Include Extensions** 74 | 75 | Add extra functionality to your deck, or leave it stripped down. 76 |
77 | 78 |
79 | ## The Markup 80 | Slides are just HTML elements with a class of `slide`. 81 | 82 | Test 83 | Test 84 | 85 |
86 | 87 |
88 | ## Style Themes 89 | Customizes the colors, typography, and layout of slide content. 90 | 91 | 92 | 93 | ## Transition Themes 94 | Defines transitions between slides using CSS3 transitions. Less capable browsers fall back to cutaways. But **you** aren't using *those* browsers to give your presentations, are you ... 95 | 96 | 97 |
98 | 99 |
100 | ## Extensions 101 | Core gives you basic slide functionality... 102 | 103 |
    104 |
  • 105 | deck.goto: Adds a shortcut key to jump to any slide number. Hit g, type in the slide number, and hit enter. 106 |
  • 107 |
  • ...
  • 108 |
  • ...
  • 109 |
  • ...
  • 110 |
111 |
112 | 113 |
114 | ## Other Elements: Images 115 | 116 | Kitties 117 | 118 | Kitties 119 |
120 | 121 |
122 | ## Other Elements: Blockquotes 123 | 124 | Food is an important part of a balanced diet. 125 | -Fran Lebowitz 126 | 127 |
128 |

Food is an important part of a balanced diet.

129 |

Fran Lebowitz

130 |
131 |
132 | 133 | 134 |
135 | ## Other Elements: Video Embeds 136 | Embed videos from your favorite online video service or with an HTML5 video element. 137 | 138 | 139 | 140 |
141 | 142 |
143 | ## Digging Deeper 144 | If you want to learn about making your own themes, extending deck.js, and more, check out the [documentation](http://docs). 145 |
146 | 147 | 148 | 149 | 150 |

151 | 152 | / 153 | 154 |

155 | 156 |
157 | 158 | 159 | 160 |
161 | 162 | # 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | -------------------------------------------------------------------------------- /sample/themes/style/web-2.0.css: -------------------------------------------------------------------------------- 1 | .deck-container { 2 | font-family: "Gill Sans", "Gill Sans MT", Calibri, sans-serif; 3 | font-size: 1.25em; 4 | background: #f4fafe; 5 | /* Old browsers */ 6 | background: -moz-linear-gradient(top, #f4fafe 0%, #ccf0f0 100%); 7 | /* FF3.6+ */ 8 | background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #f4fafe), color-stop(100%, #ccf0f0)); 9 | /* Chrome,Safari4+ */ 10 | background: -webkit-linear-gradient(top, #f4fafe 0%, #ccf0f0 100%); 11 | /* Chrome10+,Safari5.1+ */ 12 | background: -o-linear-gradient(top, #f4fafe 0%, #ccf0f0 100%); 13 | /* Opera11.10+ */ 14 | background: -ms-linear-gradient(top, #f4fafe 0%, #ccf0f0 100%); 15 | /* IE10+ */ 16 | background: linear-gradient(top, #f4fafe 0%, #ccf0f0 100%); 17 | /* W3C */ 18 | background-attachment: fixed; 19 | } 20 | .deck-container > .slide { 21 | text-shadow: 1px 1px 1px rgba(255, 255, 255, 0.5); 22 | } 23 | .deck-container h1, .deck-container h2, .deck-container h3, .deck-container h4, .deck-container h5, .deck-container h6 { 24 | font-family: "Hoefler Text", Constantia, Palatino, "Palatino Linotype", "Book Antiqua", Georgia, serif; 25 | } 26 | .deck-container h1 { 27 | color: #08455f; 28 | } 29 | .deck-container h2 { 30 | color: #0b7495; 31 | border-bottom: 0; 32 | } 33 | .cssreflections .deck-container h2 { 34 | line-height: 1; 35 | -webkit-box-reflect: below -0.556em -webkit-gradient(linear, left top, left bottom, from(transparent), color-stop(0.3, transparent), color-stop(0.7, rgba(255, 255, 255, 0.1)), to(transparent)); 36 | -moz-box-reflect: below -0.556em -moz-linear-gradient(top, transparent 0%, transparent 30%, rgba(255, 255, 255, 0.3) 100%); 37 | } 38 | .deck-container h3 { 39 | color: #000; 40 | } 41 | .deck-container pre { 42 | border-color: #cde; 43 | background: #fff; 44 | position: relative; 45 | /* http://nicolasgallagher.com/css-drop-shadows-without-images/ */ 46 | } 47 | .borderradius .deck-container pre { 48 | -webkit-border-radius: 5px; 49 | -moz-border-radius: 5px; 50 | border-radius: 5px; 51 | } 52 | .csstransforms.boxshadow .deck-container pre:before, .csstransforms.boxshadow .deck-container pre:after { 53 | content: ""; 54 | position: absolute; 55 | z-index: -1; 56 | bottom: 15px; 57 | width: 50%; 58 | height: 20%; 59 | max-width: 300px; 60 | -webkit-box-shadow: 0 15px 10px rgba(0, 0, 0, 0.7); 61 | -moz-box-shadow: 0 15px 10px rgba(0, 0, 0, 0.7); 62 | box-shadow: 0 15px 10px rgba(0, 0, 0, 0.7); 63 | } 64 | .csstransforms.boxshadow .deck-container pre:before { 65 | left: 10px; 66 | -webkit-transform: rotate(-3deg); 67 | -moz-transform: rotate(-3deg); 68 | -ms-transform: rotate(-3deg); 69 | -o-transform: rotate(-3deg); 70 | transform: rotate(-3deg); 71 | } 72 | .csstransforms.boxshadow .deck-container pre:after { 73 | right: 10px; 74 | -webkit-transform: rotate(3deg); 75 | -moz-transform: rotate(3deg); 76 | -ms-transform: rotate(3deg); 77 | -o-transform: rotate(3deg); 78 | transform: rotate(3deg); 79 | } 80 | .deck-container code { 81 | color: #789; 82 | } 83 | .deck-container blockquote { 84 | font-family: "Hoefler Text", Constantia, Palatino, "Palatino Linotype", "Book Antiqua", Georgia, serif; 85 | font-size: 2em; 86 | padding: 1em 2em .5em 2em; 87 | color: #000; 88 | background: #fff; 89 | position: relative; 90 | border: 1px solid #cde; 91 | } 92 | .borderradius .deck-container blockquote { 93 | -webkit-border-radius: 5px; 94 | -moz-border-radius: 5px; 95 | border-radius: 5px; 96 | } 97 | .boxshadow .deck-container blockquote:after { 98 | content: ""; 99 | position: absolute; 100 | z-index: -1; 101 | top: 10px; 102 | bottom: 10px; 103 | left: 0; 104 | right: 50%; 105 | -moz-border-radius: 10px/100px; 106 | border-radius: 10px/100px; 107 | -webkit-box-shadow: 0 0 15px rgba(0, 0, 0, 0.6); 108 | -moz-box-shadow: 0 0 15px rgba(0, 0, 0, 0.6); 109 | box-shadow: 0 0 15px rgba(0, 0, 0, 0.6); 110 | } 111 | .deck-container blockquote p { 112 | margin: 0; 113 | } 114 | .deck-container blockquote cite { 115 | font-size: .5em; 116 | font-style: normal; 117 | font-weight: bold; 118 | color: #888; 119 | } 120 | .deck-container blockquote:before { 121 | content: "“"; 122 | position: absolute; 123 | top: 0; 124 | left: 0; 125 | font-size: 5em; 126 | line-height: 1; 127 | color: #ccf0f0; 128 | z-index: 1; 129 | } 130 | .deck-container .borderradius img { 131 | -webkit-border-radius: 5px; 132 | -moz-border-radius: 5px; 133 | border-radius: 5px; 134 | } 135 | .deck-container ::-moz-selection { 136 | background: #08455f; 137 | color: #fff; 138 | } 139 | .deck-container ::selection { 140 | background: #08455f; 141 | color: #fff; 142 | } 143 | .deck-container a, .deck-container a:hover, .deck-container a:focus, .deck-container a:active, .deck-container a:visited { 144 | color: #599; 145 | text-decoration: none; 146 | } 147 | .deck-container a:hover, .deck-container a:focus { 148 | text-decoration: underline; 149 | } 150 | .deck-container .deck-prev-link, .deck-container .deck-next-link { 151 | background: #fff; 152 | opacity: 0.5; 153 | } 154 | .deck-container .deck-prev-link, .deck-container .deck-prev-link:hover, .deck-container .deck-prev-link:focus, .deck-container .deck-prev-link:active, .deck-container .deck-prev-link:visited, .deck-container .deck-next-link, .deck-container .deck-next-link:hover, .deck-container .deck-next-link:focus, .deck-container .deck-next-link:active, .deck-container .deck-next-link:visited { 155 | color: #599; 156 | } 157 | .deck-container .deck-prev-link:hover, .deck-container .deck-prev-link:focus, .deck-container .deck-next-link:hover, .deck-container .deck-next-link:focus { 158 | opacity: 1; 159 | text-decoration: none; 160 | } 161 | .deck-container .deck-status { 162 | font-size: 0.6666em; 163 | } 164 | .deck-container.deck-menu .slide { 165 | background: transparent; 166 | -webkit-border-radius: 5px; 167 | -moz-border-radius: 5px; 168 | border-radius: 5px; 169 | } 170 | .rgba .deck-container.deck-menu .slide { 171 | background: rgba(0, 0, 0, 0.1); 172 | } 173 | .deck-container.deck-menu .slide.deck-current, .rgba .deck-container.deck-menu .slide.deck-current, .no-touch .deck-container.deck-menu .slide:hover { 174 | background: #fff; 175 | } 176 | .deck-container .goto-form { 177 | background: #fff; 178 | border: 1px solid #cde; 179 | -webkit-border-radius: 5px; 180 | -moz-border-radius: 5px; 181 | border-radius: 5px; 182 | } 183 | .boxshadow .deck-container .goto-form { 184 | -webkit-box-shadow: 0 15px 10px -10px rgba(0, 0, 0, 0.5), 0 1px 4px rgba(0, 0, 0, 0.3), 0 0 40px rgba(0, 0, 0, 0.1) inset; 185 | -moz-box-shadow: 0 15px 10px -10px rgba(0, 0, 0, 0.5), 0 1px 4px rgba(0, 0, 0, 0.3), 0 0 40px rgba(0, 0, 0, 0.1) inset; 186 | box-shadow: 0 15px 10px -10px rgba(0, 0, 0, 0.5), 0 1px 4px rgba(0, 0, 0, 0.3), 0 0 40px rgba(0, 0, 0, 0.1) inset; 187 | } 188 | -------------------------------------------------------------------------------- /sample/core/deck.core.scss: -------------------------------------------------------------------------------- 1 | html { 2 | height:100%; 3 | } 4 | 5 | .deck-container { 6 | position:relative; 7 | height:100%; 8 | width:70%; 9 | margin:0 auto; 10 | padding:0 48px; 11 | font-size:16px; 12 | line-height:1.25; 13 | overflow:hidden; 14 | 15 | .js & { 16 | visibility:hidden; 17 | } 18 | 19 | .ready & { 20 | visibility:visible; 21 | } 22 | 23 | .touch & { 24 | -webkit-text-size-adjust:none; 25 | } 26 | 27 | /* Resets and base styles from HTML5 Boilerplate */ 28 | div, span, object, iframe, 29 | h1, h2, h3, h4, h5, h6, p, blockquote, pre, 30 | abbr, address, cite, code, del, dfn, em, img, ins, kbd, q, samp, 31 | small, strong, sub, sup, var, b, i, dl, dt, dd, ol, ul, li, 32 | fieldset, form, label, legend, 33 | table, caption, tbody, tfoot, thead, tr, th, td, 34 | article, aside, canvas, details, figcaption, figure, 35 | footer, header, hgroup, menu, nav, section, summary, 36 | time, mark, audio, video { 37 | margin: 0; 38 | padding: 0; 39 | border: 0; 40 | font-size: 100%; 41 | font: inherit; 42 | vertical-align: baseline; 43 | } 44 | 45 | article, aside, details, figcaption, figure, 46 | footer, header, hgroup, menu, nav, section { 47 | display: block; 48 | } 49 | 50 | blockquote, q { 51 | quotes:none; 52 | 53 | &:before, &:after { 54 | content:""; 55 | content:none; 56 | } 57 | } 58 | 59 | ins { 60 | background-color:#ff9; 61 | color:#000; 62 | text-decoration:none; 63 | } 64 | 65 | mark { 66 | background-color:#ff9; 67 | color:#000; 68 | font-style:italic; 69 | font-weight:bold; 70 | } 71 | 72 | del { 73 | text-decoration:line-through; 74 | } 75 | 76 | abbr[title], dfn[title] { 77 | border-bottom:1px dotted; 78 | cursor:help; 79 | } 80 | 81 | table { 82 | border-collapse:collapse; 83 | border-spacing:0; 84 | } 85 | 86 | hr { 87 | display:block; 88 | height:1px; 89 | border:0; 90 | border-top:1px solid #ccc; 91 | margin:1em 0; 92 | padding:0; 93 | } 94 | 95 | input, select { 96 | vertical-align:middle; 97 | } 98 | 99 | select, input, textarea, button { 100 | font:99% sans-serif; 101 | } 102 | 103 | pre, code, kbd, samp { 104 | font-family:monospace, sans-serif; 105 | } 106 | 107 | a { 108 | -webkit-tap-highlight-color:rgba(0,0,0,0); 109 | 110 | &:hover, &:active { 111 | outline:none; 112 | } 113 | } 114 | 115 | ul, ol { 116 | margin-left:2em; 117 | vertical-align:top; 118 | } 119 | 120 | ol { 121 | list-style-type:decimal; 122 | } 123 | 124 | nav { 125 | ul, li { 126 | margin:0; 127 | list-style:none; 128 | list-style-image:none; 129 | } 130 | } 131 | 132 | small { 133 | font-size:85%; 134 | } 135 | 136 | strong, th { 137 | font-weight:bold; 138 | } 139 | 140 | td { 141 | vertical-align:top; 142 | } 143 | 144 | sub, sup { 145 | font-size:75%; 146 | line-height:0; 147 | position:relative; 148 | } 149 | 150 | sup { 151 | top:-0.5em; 152 | } 153 | 154 | sub { bottom: -0.25em; } 155 | 156 | textarea { 157 | overflow:auto; 158 | } 159 | 160 | legend { 161 | .ie6 &, .ie7 & { 162 | margin-left:-7px; 163 | } 164 | } 165 | 166 | input[type="radio"] { 167 | vertical-align:text-bottom; 168 | } 169 | 170 | input[type="checkbox"] { 171 | vertical-align:bottom; 172 | } 173 | 174 | .ie7 input[type="checkbox"] { 175 | vertical-align:baseline; 176 | } 177 | 178 | .ie6 input { 179 | vertical-align:text-bottom; 180 | } 181 | 182 | label, input[type="button"], input[type="submit"], input[type="image"], button { 183 | cursor:pointer; 184 | } 185 | 186 | button, input, select, textarea { 187 | margin: 0; 188 | } 189 | 190 | input, textarea { 191 | &:invalid { 192 | border-radius:1px; 193 | -moz-box-shadow:0px 0px 5px red; 194 | -webkit-box-shadow:0px 0px 5px red; 195 | box-shadow: 0px 0px 5px red; 196 | 197 | .no-boxshadow { 198 | background-color: #f0dddd; 199 | } 200 | } 201 | } 202 | 203 | button { 204 | width:auto; 205 | overflow:visible; 206 | } 207 | 208 | .ie7 & img { 209 | -ms-interpolation-mode: bicubic; } 210 | 211 | &, select, input, textarea { 212 | color:#444; 213 | } 214 | 215 | a { 216 | color:#607890; 217 | 218 | &:hover, &:focus { 219 | color:#036; 220 | } 221 | 222 | &:link { 223 | -webkit-tap-highlight-color: #fff; 224 | } 225 | } 226 | /* End HTML5 Boilerplate adaptations */ 227 | 228 | h1 { 229 | font-size:4.5em; 230 | font-weight:bold; 231 | text-align:center; 232 | padding-top:1em; 233 | 234 | .csstransforms & { 235 | padding:0 48px; 236 | position:absolute; 237 | left:0; 238 | right:0; 239 | top:50%; 240 | -webkit-transform:translate3d(0, -50%, 0); 241 | -moz-transform:translate(0, -50%); 242 | -ms-transform:translate(0, -50%); 243 | -o-transform:translate(0, -50%); 244 | transform:translate3d(0, -50%, 0); 245 | } 246 | } 247 | 248 | h2 { 249 | font-size:2.25em; 250 | font-weight:bold; 251 | padding-top:.5em; 252 | margin:0 0 .66666em 0; 253 | border-bottom:3px solid #888; 254 | } 255 | 256 | h3 { 257 | font-size:1.4375em; 258 | font-weight:bold; 259 | margin-bottom:.30435em; 260 | } 261 | 262 | h4 { 263 | font-size:1.25em; 264 | font-weight:bold; 265 | margin-bottom:.25em; 266 | } 267 | 268 | h5 { 269 | font-size:1.125em; 270 | font-weight:bold; 271 | margin-bottom:.2222em; 272 | } 273 | 274 | h6 { 275 | font-size:1em; 276 | font-weight:bold; 277 | } 278 | 279 | img, iframe, video { 280 | display:block; 281 | max-width:100%; 282 | } 283 | 284 | video, iframe, img { 285 | display:block; 286 | margin:0 auto; 287 | } 288 | 289 | p, blockquote, iframe, img, ul, ol, pre, video { 290 | margin-bottom:1em; 291 | } 292 | 293 | pre { 294 | white-space:pre; 295 | white-space:pre-wrap; 296 | word-wrap:break-word; 297 | padding: 1em; 298 | border:1px solid #888; 299 | } 300 | 301 | em { 302 | font-style:italic; 303 | } 304 | 305 | li { 306 | padding:.25em 0; 307 | vertical-align:middle; 308 | } 309 | 310 | &.deck-loading { 311 | display:none; 312 | } 313 | } 314 | 315 | .slide { 316 | width:auto; 317 | min-height:100%; 318 | position:relative; 319 | } 320 | 321 | .deck-before, .deck-previous, .deck-next, .deck-after { 322 | position:absolute; 323 | left:-999em; 324 | top:-999em; 325 | } 326 | 327 | .deck-current { 328 | z-index:2; 329 | } 330 | 331 | .slide .slide { 332 | visibility:hidden; 333 | position:static; 334 | min-height:0; 335 | } 336 | 337 | .deck-child-current { 338 | position:static; 339 | z-index:2; 340 | 341 | .slide { 342 | visibility:hidden; 343 | } 344 | 345 | .deck-previous, .deck-before, .deck-current { 346 | visibility:visible; 347 | } 348 | } 349 | 350 | body.deck-container { 351 | overflow:visible; 352 | } 353 | 354 | @media all and (orientation:portrait) { 355 | 356 | } 357 | 358 | @media all and (orientation:landscape) { 359 | 360 | } 361 | 362 | @media screen and (max-device-width: 480px) { 363 | 364 | /* html { -webkit-text-size-adjust:none; -ms-text-size-adjust:none; } */ 365 | } 366 | 367 | 368 | @media print { 369 | * { 370 | background: transparent !important; 371 | color: black !important; 372 | text-shadow: none !important; 373 | filter:none !important; 374 | -ms-filter: none !important; 375 | -webkit-box-reflect:none !important; 376 | -moz-box-reflect:none !important; 377 | -webkit-box-shadow:none !important; 378 | -moz-box-shadow:none !important; 379 | box-shadow:none !important; 380 | 381 | :before, :after { 382 | display:none !important; 383 | } 384 | } 385 | a, a:visited { color: #444 !important; text-decoration: underline; } 386 | a[href]:after { content: " (" attr(href) ")"; } 387 | abbr[title]:after { content: " (" attr(title) ")"; } 388 | .ir a:after, a[href^="javascript:"]:after, a[href^="#"]:after { content: ""; } 389 | pre, blockquote { border: 1px solid #999; page-break-inside: avoid; } 390 | thead { display: table-header-group; } 391 | tr, img { page-break-inside: avoid; } 392 | @page { margin: 0.5cm; } 393 | p, h2, h3 { orphans: 3; widows: 3; } 394 | h2, h3{ page-break-after: avoid; } 395 | 396 | .slide { 397 | position:static !important; 398 | visibility:visible !important; 399 | display:block !important; 400 | -webkit-transform:none !important; 401 | -moz-transform:none !important; 402 | -o-transform:none !important; 403 | -ms-transform:none !important; 404 | transform:none !important; 405 | opacity:1 !important; 406 | } 407 | 408 | h1 { 409 | -webkit-transform:none !important; 410 | -moz-transform:none !important; 411 | -o-transform:none !important; 412 | -ms-transform:none !important; 413 | transform:none !important; 414 | padding:0 !important; 415 | position:static !important; 416 | } 417 | 418 | .deck-container > .slide { 419 | page-break-after: always; 420 | } 421 | 422 | .deck-container { 423 | width:100% !important; 424 | height:auto !important; 425 | padding:0 !important; 426 | display:block !important; 427 | } 428 | 429 | script { 430 | display:none; 431 | } 432 | } 433 | -------------------------------------------------------------------------------- /sample/core/deck.core.css: -------------------------------------------------------------------------------- 1 | html { 2 | height: 100%; 3 | } 4 | 5 | .deck-container { 6 | position: relative; 7 | height: 100%; 8 | width: 70%; 9 | margin: 0 auto; 10 | padding: 0 48px; 11 | font-size: 16px; 12 | line-height: 1.25; 13 | overflow: hidden; 14 | /* Resets and base styles from HTML5 Boilerplate */ 15 | /* End HTML5 Boilerplate adaptations */ 16 | } 17 | .js .deck-container { 18 | visibility: hidden; 19 | } 20 | .ready .deck-container { 21 | visibility: visible; 22 | } 23 | .touch .deck-container { 24 | -webkit-text-size-adjust: none; 25 | } 26 | .deck-container div, .deck-container span, .deck-container object, .deck-container iframe, 27 | .deck-container h1, .deck-container h2, .deck-container h3, .deck-container h4, .deck-container h5, .deck-container h6, .deck-container p, .deck-container blockquote, .deck-container pre, 28 | .deck-container abbr, .deck-container address, .deck-container cite, .deck-container code, .deck-container del, .deck-container dfn, .deck-container em, .deck-container img, .deck-container ins, .deck-container kbd, .deck-container q, .deck-container samp, 29 | .deck-container small, .deck-container strong, .deck-container sub, .deck-container sup, .deck-container var, .deck-container b, .deck-container i, .deck-container dl, .deck-container dt, .deck-container dd, .deck-container ol, .deck-container ul, .deck-container li, 30 | .deck-container fieldset, .deck-container form, .deck-container label, .deck-container legend, 31 | .deck-container table, .deck-container caption, .deck-container tbody, .deck-container tfoot, .deck-container thead, .deck-container tr, .deck-container th, .deck-container td, 32 | .deck-container article, .deck-container aside, .deck-container canvas, .deck-container details, .deck-container figcaption, .deck-container figure, 33 | .deck-container footer, .deck-container header, .deck-container hgroup, .deck-container menu, .deck-container nav, .deck-container section, .deck-container summary, 34 | .deck-container time, .deck-container mark, .deck-container audio, .deck-container video { 35 | margin: 0; 36 | padding: 0; 37 | border: 0; 38 | font-size: 100%; 39 | font: inherit; 40 | vertical-align: baseline; 41 | } 42 | .deck-container article, .deck-container aside, .deck-container details, .deck-container figcaption, .deck-container figure, 43 | .deck-container footer, .deck-container header, .deck-container hgroup, .deck-container menu, .deck-container nav, .deck-container section { 44 | display: block; 45 | } 46 | .deck-container blockquote, .deck-container q { 47 | quotes: none; 48 | } 49 | .deck-container blockquote:before, .deck-container blockquote:after, .deck-container q:before, .deck-container q:after { 50 | content: ""; 51 | content: none; 52 | } 53 | .deck-container ins { 54 | background-color: #ff9; 55 | color: #000; 56 | text-decoration: none; 57 | } 58 | .deck-container mark { 59 | background-color: #ff9; 60 | color: #000; 61 | font-style: italic; 62 | font-weight: bold; 63 | } 64 | .deck-container del { 65 | text-decoration: line-through; 66 | } 67 | .deck-container abbr[title], .deck-container dfn[title] { 68 | border-bottom: 1px dotted; 69 | cursor: help; 70 | } 71 | .deck-container table { 72 | border-collapse: collapse; 73 | border-spacing: 0; 74 | } 75 | .deck-container hr { 76 | display: block; 77 | height: 1px; 78 | border: 0; 79 | border-top: 1px solid #ccc; 80 | margin: 1em 0; 81 | padding: 0; 82 | } 83 | .deck-container input, .deck-container select { 84 | vertical-align: middle; 85 | } 86 | .deck-container select, .deck-container input, .deck-container textarea, .deck-container button { 87 | font: 99% sans-serif; 88 | } 89 | .deck-container pre, .deck-container code, .deck-container kbd, .deck-container samp { 90 | font-family: monospace, sans-serif; 91 | } 92 | .deck-container a { 93 | -webkit-tap-highlight-color: rgba(0, 0, 0, 0); 94 | } 95 | .deck-container a:hover, .deck-container a:active { 96 | outline: none; 97 | } 98 | .deck-container ul, .deck-container ol { 99 | margin-left: 2em; 100 | vertical-align: top; 101 | } 102 | .deck-container ol { 103 | list-style-type: decimal; 104 | } 105 | .deck-container nav ul, .deck-container nav li { 106 | margin: 0; 107 | list-style: none; 108 | list-style-image: none; 109 | } 110 | .deck-container small { 111 | font-size: 85%; 112 | } 113 | .deck-container strong, .deck-container th { 114 | font-weight: bold; 115 | } 116 | .deck-container td { 117 | vertical-align: top; 118 | } 119 | .deck-container sub, .deck-container sup { 120 | font-size: 75%; 121 | line-height: 0; 122 | position: relative; 123 | } 124 | .deck-container sup { 125 | top: -0.5em; 126 | } 127 | .deck-container sub { 128 | bottom: -0.25em; 129 | } 130 | .deck-container textarea { 131 | overflow: auto; 132 | } 133 | .ie6 .deck-container legend, .ie7 .deck-container legend { 134 | margin-left: -7px; 135 | } 136 | .deck-container input[type="radio"] { 137 | vertical-align: text-bottom; 138 | } 139 | .deck-container input[type="checkbox"] { 140 | vertical-align: bottom; 141 | } 142 | .deck-container .ie7 input[type="checkbox"] { 143 | vertical-align: baseline; 144 | } 145 | .deck-container .ie6 input { 146 | vertical-align: text-bottom; 147 | } 148 | .deck-container label, .deck-container input[type="button"], .deck-container input[type="submit"], .deck-container input[type="image"], .deck-container button { 149 | cursor: pointer; 150 | } 151 | .deck-container button, .deck-container input, .deck-container select, .deck-container textarea { 152 | margin: 0; 153 | } 154 | .deck-container input:invalid, .deck-container textarea:invalid { 155 | border-radius: 1px; 156 | -moz-box-shadow: 0px 0px 5px red; 157 | -webkit-box-shadow: 0px 0px 5px red; 158 | box-shadow: 0px 0px 5px red; 159 | } 160 | .deck-container input:invalid .no-boxshadow, .deck-container textarea:invalid .no-boxshadow { 161 | background-color: #f0dddd; 162 | } 163 | .deck-container button { 164 | width: auto; 165 | overflow: visible; 166 | } 167 | .ie7 .deck-container img { 168 | -ms-interpolation-mode: bicubic; 169 | } 170 | .deck-container, .deck-container select, .deck-container input, .deck-container textarea { 171 | color: #444; 172 | } 173 | .deck-container a { 174 | color: #607890; 175 | } 176 | .deck-container a:hover, .deck-container a:focus { 177 | color: #036; 178 | } 179 | .deck-container a:link { 180 | -webkit-tap-highlight-color: #fff; 181 | } 182 | .deck-container h1 { 183 | font-size: 4.5em; 184 | font-weight: bold; 185 | text-align: center; 186 | padding-top: 1em; 187 | } 188 | .csstransforms .deck-container h1 { 189 | padding: 0 48px; 190 | position: absolute; 191 | left: 0; 192 | right: 0; 193 | top: 50%; 194 | -webkit-transform: translate3d(0, -50%, 0); 195 | -moz-transform: translate(0, -50%); 196 | -ms-transform: translate(0, -50%); 197 | -o-transform: translate(0, -50%); 198 | transform: translate3d(0, -50%, 0); 199 | } 200 | .deck-container h2 { 201 | font-size: 2.25em; 202 | font-weight: bold; 203 | padding-top: .5em; 204 | margin: 0 0 .66666em 0; 205 | border-bottom: 3px solid #888; 206 | } 207 | .deck-container h3 { 208 | font-size: 1.4375em; 209 | font-weight: bold; 210 | margin-bottom: .30435em; 211 | } 212 | .deck-container h4 { 213 | font-size: 1.25em; 214 | font-weight: bold; 215 | margin-bottom: .25em; 216 | } 217 | .deck-container h5 { 218 | font-size: 1.125em; 219 | font-weight: bold; 220 | margin-bottom: .2222em; 221 | } 222 | .deck-container h6 { 223 | font-size: 1em; 224 | font-weight: bold; 225 | } 226 | .deck-container img, .deck-container iframe, .deck-container video { 227 | display: block; 228 | max-width: 100%; 229 | } 230 | .deck-container video, .deck-container iframe, .deck-container img { 231 | display: block; 232 | margin: 0 auto; 233 | } 234 | .deck-container p, .deck-container blockquote, .deck-container iframe, .deck-container img, .deck-container ul, .deck-container ol, .deck-container pre, .deck-container video { 235 | margin-bottom: 1em; 236 | } 237 | .deck-container pre { 238 | white-space: pre; 239 | white-space: pre-wrap; 240 | word-wrap: break-word; 241 | padding: 1em; 242 | border: 1px solid #888; 243 | } 244 | .deck-container em { 245 | font-style: italic; 246 | } 247 | .deck-container li { 248 | padding: .25em 0; 249 | vertical-align: middle; 250 | } 251 | .deck-container.deck-loading { 252 | display: none; 253 | } 254 | 255 | .slide { 256 | width: auto; 257 | min-height: 100%; 258 | position: relative; 259 | } 260 | 261 | .deck-before, .deck-previous, .deck-next, .deck-after { 262 | position: absolute; 263 | left: -999em; 264 | top: -999em; 265 | } 266 | 267 | .deck-current { 268 | z-index: 2; 269 | } 270 | 271 | .slide .slide { 272 | visibility: hidden; 273 | position: static; 274 | min-height: 0; 275 | } 276 | 277 | .deck-child-current { 278 | position: static; 279 | z-index: 2; 280 | } 281 | .deck-child-current .slide { 282 | visibility: hidden; 283 | } 284 | .deck-child-current .deck-previous, .deck-child-current .deck-before, .deck-child-current .deck-current { 285 | visibility: visible; 286 | } 287 | 288 | body.deck-container { 289 | overflow: visible; 290 | } 291 | 292 | @media all and (orientation:portrait) {} 293 | @media all and (orientation:landscape) {} 294 | @media screen and (max-device-width: 480px) { 295 | /* html { -webkit-text-size-adjust:none; -ms-text-size-adjust:none; } */ 296 | } 297 | 298 | @media print { 299 | * { 300 | background: transparent !important; 301 | color: black !important; 302 | text-shadow: none !important; 303 | filter: none !important; 304 | -ms-filter: none !important; 305 | -webkit-box-reflect: none !important; 306 | -moz-box-reflect: none !important; 307 | -webkit-box-shadow: none !important; 308 | -moz-box-shadow: none !important; 309 | box-shadow: none !important; 310 | } 311 | * :before, * :after { 312 | display: none !important; 313 | } 314 | 315 | a, a:visited { 316 | color: #444 !important; 317 | text-decoration: underline; 318 | } 319 | 320 | a[href]:after { 321 | content: " (" attr(href) ")"; 322 | } 323 | 324 | abbr[title]:after { 325 | content: " (" attr(title) ")"; 326 | } 327 | 328 | .ir a:after, a[href^="javascript:"]:after, a[href^="#"]:after { 329 | content: ""; 330 | } 331 | 332 | pre, blockquote { 333 | border: 1px solid #999; 334 | page-break-inside: avoid; 335 | } 336 | 337 | thead { 338 | display: table-header-group; 339 | } 340 | 341 | tr, img { 342 | page-break-inside: avoid; 343 | } 344 | 345 | @page { 346 | margin: 0.5cm; 347 | } 348 | 349 | p, h2, h3 { 350 | orphans: 3; 351 | widows: 3; 352 | } 353 | 354 | h2, h3 { 355 | page-break-after: avoid; 356 | } 357 | 358 | .slide { 359 | position: static !important; 360 | visibility: visible !important; 361 | display: block !important; 362 | -webkit-transform: none !important; 363 | -moz-transform: none !important; 364 | -o-transform: none !important; 365 | -ms-transform: none !important; 366 | transform: none !important; 367 | opacity:1 !important; 368 | } 369 | 370 | h1 { 371 | -webkit-transform: none !important; 372 | -moz-transform: none !important; 373 | -o-transform: none !important; 374 | -ms-transform: none !important; 375 | transform: none !important; 376 | padding: 0 !important; 377 | position: static !important; 378 | } 379 | 380 | .deck-container > .slide { 381 | page-break-after: always; 382 | } 383 | 384 | .deck-container { 385 | width: 100% !important; 386 | height: auto !important; 387 | padding: 0 !important; 388 | display: block !important; 389 | } 390 | 391 | script { 392 | display: none; 393 | } 394 | } 395 | -------------------------------------------------------------------------------- /sample/js/modernizr.custom.js: -------------------------------------------------------------------------------- 1 | /* Modernizr 2.0.6 (Custom Build) | MIT & BSD 2 | * Contains: fontface | backgroundsize | borderimage | borderradius | boxshadow | flexbox | hsla | multiplebgs | opacity | rgba | textshadow | cssanimations | csscolumns | generatedcontent | cssgradients | cssreflections | csstransforms | csstransforms3d | csstransitions | applicationcache | canvas | canvastext | draganddrop | hashchange | history | audio | video | indexeddb | input | inputtypes | localstorage | postmessage | sessionstorage | websockets | websqldatabase | webworkers | geolocation | inlinesvg | smil | svg | svgclippaths | touch | webgl | iepp | cssclasses | addtest | teststyles | testprop | testallprops | hasevent | prefixes | domprefixes | load 3 | */ 4 | ;window.Modernizr=function(a,b,c){function H(){e.input=function(a){for(var b=0,c=a.length;b",a,""].join(""),k.id=i,k.innerHTML+=f,g.appendChild(k),h=c(k,a),k.parentNode.removeChild(k);return!!h},w=function(){function d(d,e){e=e||b.createElement(a[d]||"div"),d="on"+d;var f=d in e;f||(e.setAttribute||(e=b.createElement("div")),e.setAttribute&&e.removeAttribute&&(e.setAttribute(d,""),f=C(e[d],"function"),C(e[d],c)||(e[d]=c),e.removeAttribute(d))),e=null;return f}var a={select:"input",change:"input",submit:"form",reset:"form",error:"img",load:"img",abort:"img"};return d}(),x,y={}.hasOwnProperty,z;!C(y,c)&&!C(y.call,c)?z=function(a,b){return y.call(a,b)}:z=function(a,b){return b in a&&C(a.constructor.prototype[b],c)};var G=function(c,d){var f=c.join(""),g=d.length;v(f,function(c,d){var f=b.styleSheets[b.styleSheets.length-1],h=f.cssRules&&f.cssRules[0]?f.cssRules[0].cssText:f.cssText||"",i=c.childNodes,j={};while(g--)j[i[g].id]=i[g];e.touch="ontouchstart"in a||j.touch.offsetTop===9,e.csstransforms3d=j.csstransforms3d.offsetLeft===9,e.generatedcontent=j.generatedcontent.offsetHeight>=1,e.fontface=/src/i.test(h)&&h.indexOf(d.split(" ")[0])===0},g,d)}(['@font-face {font-family:"font";src:url("https://")}',["@media (",o.join("touch-enabled),("),i,")","{#touch{top:9px;position:absolute}}"].join(""),["@media (",o.join("transform-3d),("),i,")","{#csstransforms3d{left:9px;position:absolute}}"].join(""),['#generatedcontent:after{content:"',m,'";visibility:hidden}'].join("")],["fontface","touch","csstransforms3d","generatedcontent"]);r.flexbox=function(){function c(a,b,c,d){a.style.cssText=o.join(b+":"+c+";")+(d||"")}function a(a,b,c,d){b+=":",a.style.cssText=(b+o.join(c+";"+b)).slice(0,-b.length)+(d||"")}var d=b.createElement("div"),e=b.createElement("div");a(d,"display","box","width:42px;padding:0;"),c(e,"box-flex","1","width:10px;"),d.appendChild(e),g.appendChild(d);var f=e.offsetWidth===42;d.removeChild(e),g.removeChild(d);return f},r.canvas=function(){var a=b.createElement("canvas");return!!a.getContext&&!!a.getContext("2d")},r.canvastext=function(){return!!e.canvas&&!!C(b.createElement("canvas").getContext("2d").fillText,"function")},r.webgl=function(){return!!a.WebGLRenderingContext},r.touch=function(){return e.touch},r.geolocation=function(){return!!navigator.geolocation},r.postmessage=function(){return!!a.postMessage},r.websqldatabase=function(){var b=!!a.openDatabase;return b},r.indexedDB=function(){for(var b=-1,c=p.length;++b7)},r.history=function(){return!!a.history&&!!history.pushState},r.draganddrop=function(){return w("dragstart")&&w("drop")},r.websockets=function(){for(var b=-1,c=p.length;++b";return(a.firstChild&&a.firstChild.namespaceURI)==q.svg},r.smil=function(){return!!b.createElementNS&&/SVG/.test(n.call(b.createElementNS(q.svg,"animate")))},r.svgclippaths=function(){return!!b.createElementNS&&/SVG/.test(n.call(b.createElementNS(q.svg,"clipPath")))};for(var I in r)z(r,I)&&(x=I.toLowerCase(),e[x]=r[I](),u.push((e[x]?"":"no-")+x));e.input||H(),e.addTest=function(a,b){if(typeof a=="object")for(var d in a)z(a,d)&&e.addTest(d,a[d]);else{a=a.toLowerCase();if(e[a]!==c)return;b=typeof b=="boolean"?b:!!b(),g.className+=" "+(b?"":"no-")+a,e[a]=b}return e},A(""),j=l=null,a.attachEvent&&function(){var a=b.createElement("div");a.innerHTML="";return a.childNodes.length!==1}()&&function(a,b){function s(a){var b=-1;while(++b 0) { 93 | slides[current-1].addClass(oc.previous); 94 | } 95 | if (current + 1 < slides.length) { 96 | slides[current+1].addClass(oc.next); 97 | } 98 | if (current > 1) { 99 | $.each(slides.slice(0, current - 1), function(i, el) { 100 | el.addClass(oc.before); 101 | }); 102 | } 103 | if (current + 2 < slides.length) { 104 | $.each(slides.slice(current+2), function(i, el) { 105 | el.addClass(oc.after); 106 | }); 107 | } 108 | }, 109 | 110 | /* Methods exposed in the jQuery.deck namespace */ 111 | methods = { 112 | 113 | /* 114 | jQuery.deck(selector, options) 115 | 116 | selector: string | jQuery | array 117 | options: object, optional 118 | 119 | Initializes the deck, using each element matched by selector as a slide. 120 | May also be passed an array of string selectors or jQuery objects, in 121 | which case each selector in the array is considered a slide. The second 122 | parameter is an optional options object which will extend the default 123 | values. 124 | 125 | $.deck('.slide'); 126 | 127 | or 128 | 129 | $.deck([ 130 | '#first-slide', 131 | '#second-slide', 132 | '#etc' 133 | ]); 134 | */ 135 | init: function(elements, opts) { 136 | var startTouch, 137 | $c, 138 | tolerance, 139 | esp = function(e) { 140 | e.stopPropagation(); 141 | }; 142 | 143 | options = $.extend(true, {}, $[deck].defaults, opts); 144 | slides = []; 145 | current = 0; 146 | $c = $[deck]('getContainer'); 147 | tolerance = options.touch.swipeTolerance; 148 | 149 | // Hide the deck while states are being applied to kill transitions 150 | $c.addClass(options.classes.loading); 151 | 152 | // Fill slides array depending on parameter type 153 | if ($.isArray(elements)) { 154 | $.each(elements, function(i, e) { 155 | slides.push($(e)); 156 | }); 157 | } 158 | else { 159 | $(elements).each(function(i, e) { 160 | slides.push($(e)); 161 | }); 162 | } 163 | 164 | /* Remove any previous bindings, and rebind key events */ 165 | $d.unbind('keydown.deck').bind('keydown.deck', function(e) { 166 | if (e.which === options.keys.next || $.inArray(e.which, options.keys.next) > -1) { 167 | methods.next(); 168 | e.preventDefault(); 169 | } 170 | else if (e.which === options.keys.previous || $.inArray(e.which, options.keys.previous) > -1) { 171 | methods.prev(); 172 | e.preventDefault(); 173 | } 174 | }); 175 | 176 | /* Bind touch events for swiping between slides on touch devices */ 177 | $c.unbind('touchstart.deck').bind('touchstart.deck', function(e) { 178 | if (!startTouch) { 179 | startTouch = $.extend({}, e.originalEvent.targetTouches[0]); 180 | } 181 | }) 182 | .unbind('touchmove.deck').bind('touchmove.deck', function(e) { 183 | $.each(e.originalEvent.changedTouches, function(i, t) { 184 | if (startTouch && t.identifier === startTouch.identifier) { 185 | if (t.screenX - startTouch.screenX > tolerance || t.screenY - startTouch.screenY > tolerance) { 186 | $[deck]('prev'); 187 | startTouch = undefined; 188 | } 189 | else if (t.screenX - startTouch.screenX < -1 * tolerance || t.screenY - startTouch.screenY < -1 * tolerance) { 190 | $[deck]('next'); 191 | startTouch = undefined; 192 | } 193 | return false; 194 | } 195 | }); 196 | e.preventDefault(); 197 | }) 198 | .unbind('touchend.deck').bind('touchend.deck', function(t) { 199 | $.each(t.originalEvent.changedTouches, function(i, t) { 200 | if (startTouch && t.identifier === startTouch.identifier) { 201 | startTouch = undefined; 202 | } 203 | }); 204 | }) 205 | .scrollLeft(0).scrollTop(0) 206 | /* Stop propagation of key events within editable elements of slides */ 207 | .undelegate('input, textarea, select, button, meter, progress, [contentEditable]', 'keydown', esp) 208 | .delegate('input, textarea, select, button, meter, progress, [contentEditable]', 'keydown', esp); 209 | 210 | /* 211 | Kick iframe videos, which dont like to redraw w/ transforms. 212 | Remove this if Webkit ever fixes it. 213 | */ 214 | $.each(slides, function(i, $el) { 215 | $el.unbind('webkitTransitionEnd.deck').bind('webkitTransitionEnd.deck', 216 | function(event) { 217 | if ($el.hasClass($[deck]('getOptions').classes.current)) { 218 | var embeds = $(this).find('iframe').css('opacity', 0); 219 | window.setTimeout(function() { 220 | embeds.css('opacity', 1); 221 | }, 100); 222 | } 223 | }); 224 | }); 225 | 226 | updateStates(); 227 | 228 | // Show deck again now that slides are in place 229 | $c.removeClass(options.classes.loading); 230 | $d.trigger(events.initialize); 231 | }, 232 | 233 | /* 234 | jQuery.deck('go', index) 235 | 236 | index: integer 237 | 238 | Moves to the slide at the specified index. Index is 0-based, so 239 | $.deck('go', 0); will move to the first slide. If index is out of bounds 240 | or not a number the call is ignored. 241 | */ 242 | go: function(index) { 243 | if (typeof index != 'number' || index < 0 || index >= slides.length) return; 244 | 245 | $d.trigger(events.change, [current, index]); 246 | current = index; 247 | updateStates(); 248 | }, 249 | 250 | /* 251 | jQuery.deck('next') 252 | 253 | Moves to the next slide. If the last slide is already active, the call 254 | is ignored. 255 | */ 256 | next: function() { 257 | methods.go(current+1); 258 | }, 259 | 260 | /* 261 | jQuery.deck('prev') 262 | 263 | Moves to the previous slide. If the first slide is already active, the 264 | call is ignored. 265 | */ 266 | prev: function() { 267 | methods.go(current-1); 268 | }, 269 | 270 | /* 271 | jQuery.deck('getSlide', index) 272 | 273 | index: integer, optional 274 | 275 | Returns a jQuery object containing the slide at index. If index is not 276 | specified, the current slide is returned. 277 | */ 278 | getSlide: function(index) { 279 | var i = typeof index !== 'undefined' ? index : current; 280 | if (typeof i != 'number' || i < 0 || i >= slides.length) return null; 281 | return slides[i]; 282 | }, 283 | 284 | /* 285 | jQuery.deck('getSlides') 286 | 287 | Returns all slides as an array of jQuery objects. 288 | */ 289 | getSlides: function() { 290 | return slides; 291 | }, 292 | 293 | /* 294 | jQuery.deck('getContainer') 295 | 296 | Returns a jQuery object containing the deck container as defined by the 297 | container option. 298 | */ 299 | getContainer: function() { 300 | return $(options.selectors.container); 301 | }, 302 | 303 | /* 304 | jQuery.deck('getOptions') 305 | 306 | Returns the options object for the deck, including any overrides that 307 | were defined at initialization. 308 | */ 309 | getOptions: function() { 310 | return options; 311 | }, 312 | 313 | /* 314 | jQuery.deck('extend', name, method) 315 | 316 | name: string 317 | method: function 318 | 319 | Adds method to the deck namespace with the key of name. This doesn’t 320 | give access to any private member data — public methods must still be 321 | used within method — but lets extension authors piggyback on the deck 322 | namespace rather than pollute jQuery. 323 | 324 | $.deck('extend', 'alert', function(msg) { 325 | alert(msg); 326 | }); 327 | 328 | // Alerts 'boom' 329 | $.deck('alert', 'boom'); 330 | */ 331 | extend: function(name, method) { 332 | methods[name] = method; 333 | } 334 | }; 335 | 336 | /* jQuery extension */ 337 | $[deck] = function(method, arg) { 338 | if (methods[method]) { 339 | return methods[method].apply(this, Array.prototype.slice.call(arguments, 1)); 340 | } 341 | else { 342 | return methods.init(method, arg); 343 | } 344 | }; 345 | 346 | /* 347 | The default settings object for a deck. All deck extensions should extend 348 | this object to add defaults for any of their options. 349 | 350 | options.classes.after 351 | This class is added to all slides that appear after the 'next' slide. 352 | 353 | options.classes.before 354 | This class is added to all slides that appear before the 'previous' 355 | slide. 356 | 357 | options.classes.childCurrent 358 | This class is added to all elements in the DOM tree between the 359 | 'current' slide and the deck container. For standard slides, this is 360 | mostly seen and used for nested slides. 361 | 362 | options.classes.current 363 | This class is added to the current slide. 364 | 365 | options.classes.loading 366 | This class is applied to the deck container during loading phases and is 367 | primarily used as a way to short circuit transitions between states 368 | where such transitions are distracting or unwanted. For example, this 369 | class is applied during deck initialization and then removed to prevent 370 | all the slides from appearing stacked and transitioning into place 371 | on load. 372 | 373 | options.classes.next 374 | This class is added to the slide immediately following the 'current' 375 | slide. 376 | 377 | options.classes.onPrefix 378 | This prefix, concatenated with the current slide index, is added to the 379 | deck container as you change slides. 380 | 381 | options.classes.previous 382 | This class is added to the slide immediately preceding the 'current' 383 | slide. 384 | 385 | options.selectors.container 386 | Elements matched by this CSS selector will be considered the deck 387 | container. The deck container is used to scope certain states of the 388 | deck, as with the onPrefix option, or with extensions such as deck.goto 389 | and deck.menu. 390 | 391 | options.keys.next 392 | The numeric keycode used to go to the next slide. 393 | 394 | options.keys.previous 395 | The numeric keycode used to go to the previous slide. 396 | 397 | options.touch.swipeTolerance 398 | The number of pixels the users finger must travel to produce a swipe 399 | gesture. 400 | */ 401 | $[deck].defaults = { 402 | classes: { 403 | after: 'deck-after', 404 | before: 'deck-before', 405 | childCurrent: 'deck-child-current', 406 | current: 'deck-current', 407 | loading: 'deck-loading', 408 | next: 'deck-next', 409 | onPrefix: 'on-slide-', 410 | previous: 'deck-previous' 411 | }, 412 | 413 | selectors: { 414 | container: '.deck-container' 415 | }, 416 | 417 | keys: { 418 | // enter, space, page down, right arrow, down arrow, 419 | next: [13, 32, 34, 39, 40], 420 | // backspace, page up, left arrow, up arrow 421 | previous: [8, 33, 37, 38] 422 | }, 423 | 424 | touch: { 425 | swipeTolerance: 60 426 | } 427 | }; 428 | 429 | $d.ready(function() { 430 | $('html').addClass('ready'); 431 | }); 432 | 433 | /* 434 | FF + Transforms + Flash video don't get along... 435 | Firefox will reload and start playing certain videos after a 436 | transform. Blanking the src when a previously shown slide goes out 437 | of view prevents this. 438 | */ 439 | $d.bind('deck.change', function(e, from, to) { 440 | var oldFrames = $[deck]('getSlide', from).find('iframe'), 441 | newFrames = $[deck]('getSlide', to).find('iframe'); 442 | 443 | oldFrames.each(function() { 444 | var $this = $(this), 445 | curSrc = $this.attr('src'); 446 | 447 | if(curSrc) { 448 | $this.data('deck-src', curSrc).attr('src', ''); 449 | } 450 | }); 451 | 452 | newFrames.each(function() { 453 | var $this = $(this), 454 | originalSrc = $this.data('deck-src'); 455 | 456 | if (originalSrc) { 457 | $this.attr('src', originalSrc); 458 | } 459 | }); 460 | }); 461 | })(jQuery, 'deck', document); 462 | -------------------------------------------------------------------------------- /deck.markdown.js/Markdown.Converter.js: -------------------------------------------------------------------------------- 1 | var Markdown; 2 | 3 | if (typeof exports === "object" && typeof require === "function") // we're in a CommonJS (e.g. Node.js) module 4 | Markdown = exports; 5 | else 6 | Markdown = {}; 7 | 8 | // The following text is included for historical reasons, but should 9 | // be taken with a pinch of salt; it's not all true anymore. 10 | 11 | // 12 | // Wherever possible, Showdown is a straight, line-by-line port 13 | // of the Perl version of Markdown. 14 | // 15 | // This is not a normal parser design; it's basically just a 16 | // series of string substitutions. It's hard to read and 17 | // maintain this way, but keeping Showdown close to the original 18 | // design makes it easier to port new features. 19 | // 20 | // More importantly, Showdown behaves like markdown.pl in most 21 | // edge cases. So web applications can do client-side preview 22 | // in Javascript, and then build identical HTML on the server. 23 | // 24 | // This port needs the new RegExp functionality of ECMA 262, 25 | // 3rd Edition (i.e. Javascript 1.5). Most modern web browsers 26 | // should do fine. Even with the new regular expression features, 27 | // We do a lot of work to emulate Perl's regex functionality. 28 | // The tricky changes in this file mostly have the "attacklab:" 29 | // label. Major or self-explanatory changes don't. 30 | // 31 | // Smart diff tools like Araxis Merge will be able to match up 32 | // this file with markdown.pl in a useful way. A little tweaking 33 | // helps: in a copy of markdown.pl, replace "#" with "//" and 34 | // replace "$text" with "text". Be sure to ignore whitespace 35 | // and line endings. 36 | // 37 | 38 | 39 | // 40 | // Usage: 41 | // 42 | // var text = "Markdown *rocks*."; 43 | // 44 | // var converter = new Markdown.Converter(); 45 | // var html = converter.makeHtml(text); 46 | // 47 | // alert(html); 48 | // 49 | // Note: move the sample code to the bottom of this 50 | // file before uncommenting it. 51 | // 52 | 53 | (function () { 54 | 55 | function identity(x) { return x; } 56 | function returnFalse(x) { return false; } 57 | 58 | function HookCollection() { } 59 | 60 | HookCollection.prototype = { 61 | 62 | chain: function (hookname, func) { 63 | var original = this[hookname]; 64 | if (!original) 65 | throw new Error("unknown hook " + hookname); 66 | 67 | if (original === identity) 68 | this[hookname] = func; 69 | else 70 | this[hookname] = function (x) { return func(original(x)); } 71 | }, 72 | set: function (hookname, func) { 73 | if (!this[hookname]) 74 | throw new Error("unknown hook " + hookname); 75 | this[hookname] = func; 76 | }, 77 | addNoop: function (hookname) { 78 | this[hookname] = identity; 79 | }, 80 | addFalse: function (hookname) { 81 | this[hookname] = returnFalse; 82 | } 83 | }; 84 | 85 | Markdown.HookCollection = HookCollection; 86 | 87 | // g_urls and g_titles allow arbitrary user-entered strings as keys. This 88 | // caused an exception (and hence stopped the rendering) when the user entered 89 | // e.g. [push] or [__proto__]. Adding a prefix to the actual key prevents this 90 | // (since no builtin property starts with "s_"). See 91 | // http://meta.stackoverflow.com/questions/64655/strange-wmd-bug 92 | // (granted, switching from Array() to Object() alone would have left only __proto__ 93 | // to be a problem) 94 | function SaveHash() { } 95 | SaveHash.prototype = { 96 | set: function (key, value) { 97 | this["s_" + key] = value; 98 | }, 99 | get: function (key) { 100 | return this["s_" + key]; 101 | } 102 | }; 103 | 104 | Markdown.Converter = function () { 105 | var pluginHooks = this.hooks = new HookCollection(); 106 | pluginHooks.addNoop("plainLinkText"); // given a URL that was encountered by itself (without markup), should return the link text that's to be given to this link 107 | pluginHooks.addNoop("preConversion"); // called with the orignal text as given to makeHtml. The result of this plugin hook is the actual markdown source that will be cooked 108 | pluginHooks.addNoop("postConversion"); // called with the final cooked HTML code. The result of this plugin hook is the actual output of makeHtml 109 | 110 | // 111 | // Private state of the converter instance: 112 | // 113 | 114 | // Global hashes, used by various utility routines 115 | var g_urls; 116 | var g_titles; 117 | var g_html_blocks; 118 | 119 | // Used to track when we're inside an ordered or unordered list 120 | // (see _ProcessListItems() for details): 121 | var g_list_level; 122 | 123 | this.makeHtml = function (text) { 124 | 125 | // 126 | // Main function. The order in which other subs are called here is 127 | // essential. Link and image substitutions need to happen before 128 | // _EscapeSpecialCharsWithinTagAttributes(), so that any *'s or _'s in the 129 | // and tags get encoded. 130 | // 131 | 132 | // This will only happen if makeHtml on the same converter instance is called from a plugin hook. 133 | // Don't do that. 134 | if (g_urls) 135 | throw new Error("Recursive call to converter.makeHtml"); 136 | 137 | // Create the private state objects. 138 | g_urls = new SaveHash(); 139 | g_titles = new SaveHash(); 140 | g_html_blocks = []; 141 | g_list_level = 0; 142 | 143 | text = pluginHooks.preConversion(text); 144 | 145 | // attacklab: Replace ~ with ~T 146 | // This lets us use tilde as an escape char to avoid md5 hashes 147 | // The choice of character is arbitray; anything that isn't 148 | // magic in Markdown will work. 149 | text = text.replace(/~/g, "~T"); 150 | 151 | // attacklab: Replace $ with ~D 152 | // RegExp interprets $ as a special character 153 | // when it's in a replacement string 154 | text = text.replace(/\$/g, "~D"); 155 | 156 | // Standardize line endings 157 | text = text.replace(/\r\n/g, "\n"); // DOS to Unix 158 | text = text.replace(/\r/g, "\n"); // Mac to Unix 159 | 160 | // Make sure text begins and ends with a couple of newlines: 161 | text = "\n\n" + text + "\n\n"; 162 | 163 | // Convert all tabs to spaces. 164 | text = _Detab(text); 165 | 166 | // Strip any lines consisting only of spaces and tabs. 167 | // This makes subsequent regexen easier to write, because we can 168 | // match consecutive blank lines with /\n+/ instead of something 169 | // contorted like /[ \t]*\n+/ . 170 | text = text.replace(/^[ \t]+$/mg, ""); 171 | 172 | // Turn block-level HTML blocks into hash entries 173 | text = _HashHTMLBlocks(text); 174 | 175 | // Strip link definitions, store in hashes. 176 | text = _StripLinkDefinitions(text); 177 | 178 | text = _RunBlockGamut(text); 179 | 180 | text = _UnescapeSpecialChars(text); 181 | 182 | // attacklab: Restore dollar signs 183 | text = text.replace(/~D/g, "$$"); 184 | 185 | // attacklab: Restore tildes 186 | text = text.replace(/~T/g, "~"); 187 | 188 | text = pluginHooks.postConversion(text); 189 | 190 | g_html_blocks = g_titles = g_urls = null; 191 | 192 | return text; 193 | }; 194 | 195 | function _StripLinkDefinitions(text) { 196 | // 197 | // Strips link definitions from text, stores the URLs and titles in 198 | // hash references. 199 | // 200 | 201 | // Link defs are in the form: ^[id]: url "optional title" 202 | 203 | /* 204 | text = text.replace(/ 205 | ^[ ]{0,3}\[(.+)\]: // id = $1 attacklab: g_tab_width - 1 206 | [ \t]* 207 | \n? // maybe *one* newline 208 | [ \t]* 209 | ? // url = $2 210 | (?=\s|$) // lookahead for whitespace instead of the lookbehind removed below 211 | [ \t]* 212 | \n? // maybe one newline 213 | [ \t]* 214 | ( // (potential) title = $3 215 | (\n*) // any lines skipped = $4 attacklab: lookbehind removed 216 | [ \t]+ 217 | ["(] 218 | (.+?) // title = $5 219 | [")] 220 | [ \t]* 221 | )? // title is optional 222 | (?:\n+|$) 223 | /gm, function(){...}); 224 | */ 225 | 226 | text = text.replace(/^[ ]{0,3}\[(.+)\]:[ \t]*\n?[ \t]*?(?=\s|$)[ \t]*\n?[ \t]*((\n*)["(](.+?)[")][ \t]*)?(?:\n+)/gm, 227 | function (wholeMatch, m1, m2, m3, m4, m5) { 228 | m1 = m1.toLowerCase(); 229 | g_urls.set(m1, _EncodeAmpsAndAngles(m2)); // Link IDs are case-insensitive 230 | if (m4) { 231 | // Oops, found blank lines, so it's not a title. 232 | // Put back the parenthetical statement we stole. 233 | return m3; 234 | } else if (m5) { 235 | g_titles.set(m1, m5.replace(/"/g, """)); 236 | } 237 | 238 | // Completely remove the definition from the text 239 | return ""; 240 | } 241 | ); 242 | 243 | return text; 244 | } 245 | 246 | function _HashHTMLBlocks(text) { 247 | 248 | // Hashify HTML blocks: 249 | // We only want to do this for block-level HTML tags, such as headers, 250 | // lists, and tables. That's because we still want to wrap

s around 251 | // "paragraphs" that are wrapped in non-block-level tags, such as anchors, 252 | // phrase emphasis, and spans. The list of tags we're looking for is 253 | // hard-coded: 254 | var block_tags_a = "p|div|h[1-6]|blockquote|pre|table|dl|ol|ul|script|noscript|form|fieldset|iframe|math|ins|del" 255 | var block_tags_b = "p|div|h[1-6]|blockquote|pre|table|dl|ol|ul|script|noscript|form|fieldset|iframe|math" 256 | 257 | // First, look for nested blocks, e.g.: 258 | //

259 | //
260 | // tags for inner block must be indented. 261 | //
262 | //
263 | // 264 | // The outermost tags must start at the left margin for this to match, and 265 | // the inner nested divs must be indented. 266 | // We need to do this before the next, more liberal match, because the next 267 | // match will start at the first `
` and stop at the first `
`. 268 | 269 | // attacklab: This regex can be expensive when it fails. 270 | 271 | /* 272 | text = text.replace(/ 273 | ( // save in $1 274 | ^ // start of line (with /m) 275 | <($block_tags_a) // start tag = $2 276 | \b // word break 277 | // attacklab: hack around khtml/pcre bug... 278 | [^\r]*?\n // any number of lines, minimally matching 279 | // the matching end tag 280 | [ \t]* // trailing spaces/tabs 281 | (?=\n+) // followed by a newline 282 | ) // attacklab: there are sentinel newlines at end of document 283 | /gm,function(){...}}; 284 | */ 285 | text = text.replace(/^(<(p|div|h[1-6]|blockquote|pre|table|dl|ol|ul|script|noscript|form|fieldset|iframe|math|ins|del)\b[^\r]*?\n<\/\2>[ \t]*(?=\n+))/gm, hashElement); 286 | 287 | // 288 | // Now match more liberally, simply from `\n` to `\n` 289 | // 290 | 291 | /* 292 | text = text.replace(/ 293 | ( // save in $1 294 | ^ // start of line (with /m) 295 | <($block_tags_b) // start tag = $2 296 | \b // word break 297 | // attacklab: hack around khtml/pcre bug... 298 | [^\r]*? // any number of lines, minimally matching 299 | .* // the matching end tag 300 | [ \t]* // trailing spaces/tabs 301 | (?=\n+) // followed by a newline 302 | ) // attacklab: there are sentinel newlines at end of document 303 | /gm,function(){...}}; 304 | */ 305 | text = text.replace(/^(<(p|div|h[1-6]|blockquote|pre|table|dl|ol|ul|script|noscript|form|fieldset|iframe|math)\b[^\r]*?.*<\/\2>[ \t]*(?=\n+)\n)/gm, hashElement); 306 | 307 | // Special case just for
. It was easier to make a special case than 308 | // to make the other regex more complicated. 309 | 310 | /* 311 | text = text.replace(/ 312 | \n // Starting after a blank line 313 | [ ]{0,3} 314 | ( // save in $1 315 | (<(hr) // start tag = $2 316 | \b // word break 317 | ([^<>])*? 318 | \/?>) // the matching end tag 319 | [ \t]* 320 | (?=\n{2,}) // followed by a blank line 321 | ) 322 | /g,hashElement); 323 | */ 324 | text = text.replace(/\n[ ]{0,3}((<(hr)\b([^<>])*?\/?>)[ \t]*(?=\n{2,}))/g, hashElement); 325 | 326 | // Special case for standalone HTML comments: 327 | 328 | /* 329 | text = text.replace(/ 330 | \n\n // Starting after a blank line 331 | [ ]{0,3} // attacklab: g_tab_width - 1 332 | ( // save in $1 333 | -]|-[^>])(?:[^-]|-[^-])*)--) // see http://www.w3.org/TR/html-markup/syntax.html#comments and http://meta.stackoverflow.com/q/95256 335 | > 336 | [ \t]* 337 | (?=\n{2,}) // followed by a blank line 338 | ) 339 | /g,hashElement); 340 | */ 341 | text = text.replace(/\n\n[ ]{0,3}(-]|-[^>])(?:[^-]|-[^-])*)--)>[ \t]*(?=\n{2,}))/g, hashElement); 342 | 343 | // PHP and ASP-style processor instructions ( and <%...%>) 344 | 345 | /* 346 | text = text.replace(/ 347 | (?: 348 | \n\n // Starting after a blank line 349 | ) 350 | ( // save in $1 351 | [ ]{0,3} // attacklab: g_tab_width - 1 352 | (?: 353 | <([?%]) // $2 354 | [^\r]*? 355 | \2> 356 | ) 357 | [ \t]* 358 | (?=\n{2,}) // followed by a blank line 359 | ) 360 | /g,hashElement); 361 | */ 362 | text = text.replace(/(?:\n\n)([ ]{0,3}(?:<([?%])[^\r]*?\2>)[ \t]*(?=\n{2,}))/g, hashElement); 363 | 364 | return text; 365 | } 366 | 367 | function hashElement(wholeMatch, m1) { 368 | var blockText = m1; 369 | 370 | // Undo double lines 371 | blockText = blockText.replace(/^\n+/, ""); 372 | 373 | // strip trailing blank lines 374 | blockText = blockText.replace(/\n+$/g, ""); 375 | 376 | // Replace the element text with a marker ("~KxK" where x is its key) 377 | blockText = "\n\n~K" + (g_html_blocks.push(blockText) - 1) + "K\n\n"; 378 | 379 | return blockText; 380 | } 381 | 382 | function _RunBlockGamut(text, doNotUnhash) { 383 | // 384 | // These are all the transformations that form block-level 385 | // tags like paragraphs, headers, and list items. 386 | // 387 | text = _DoHeaders(text); 388 | 389 | // Do Horizontal Rules: 390 | var replacement = "
\n"; 391 | text = text.replace(/^[ ]{0,2}([ ]?\*[ ]?){3,}[ \t]*$/gm, replacement); 392 | text = text.replace(/^[ ]{0,2}([ ]?-[ ]?){3,}[ \t]*$/gm, replacement); 393 | text = text.replace(/^[ ]{0,2}([ ]?_[ ]?){3,}[ \t]*$/gm, replacement); 394 | 395 | text = _DoLists(text); 396 | text = _DoCodeBlocks(text); 397 | text = _DoBlockQuotes(text); 398 | 399 | // We already ran _HashHTMLBlocks() before, in Markdown(), but that 400 | // was to escape raw HTML in the original Markdown source. This time, 401 | // we're escaping the markup we've just created, so that we don't wrap 402 | //

tags around block-level tags. 403 | text = _HashHTMLBlocks(text); 404 | text = _FormParagraphs(text, doNotUnhash); 405 | 406 | return text; 407 | } 408 | 409 | function _RunSpanGamut(text) { 410 | // 411 | // These are all the transformations that occur *within* block-level 412 | // tags like paragraphs, headers, and list items. 413 | // 414 | 415 | text = _DoCodeSpans(text); 416 | text = _EscapeSpecialCharsWithinTagAttributes(text); 417 | text = _EncodeBackslashEscapes(text); 418 | 419 | // Process anchor and image tags. Images must come first, 420 | // because ![foo][f] looks like an anchor. 421 | text = _DoImages(text); 422 | text = _DoAnchors(text); 423 | 424 | // Make links out of things like `` 425 | // Must come after _DoAnchors(), because you can use < and > 426 | // delimiters in inline links like [this](). 427 | text = _DoAutoLinks(text); 428 | 429 | text = text.replace(/~P/g, "://"); // put in place to prevent autolinking; reset now 430 | 431 | text = _EncodeAmpsAndAngles(text); 432 | text = _DoItalicsAndBold(text); 433 | 434 | // Do hard breaks: 435 | text = text.replace(/ +\n/g, "
\n"); 436 | 437 | return text; 438 | } 439 | 440 | function _EscapeSpecialCharsWithinTagAttributes(text) { 441 | // 442 | // Within tags -- meaning between < and > -- encode [\ ` * _] so they 443 | // don't conflict with their use in Markdown for code, italics and strong. 444 | // 445 | 446 | // Build a regex to find HTML tags and comments. See Friedl's 447 | // "Mastering Regular Expressions", 2nd Ed., pp. 200-201. 448 | 449 | // SE: changed the comment part of the regex 450 | 451 | var regex = /(<[a-z\/!$]("[^"]*"|'[^']*'|[^'">])*>|-]|-[^>])(?:[^-]|-[^-])*)--)>)/gi; 452 | 453 | text = text.replace(regex, function (wholeMatch) { 454 | var tag = wholeMatch.replace(/(.)<\/?code>(?=.)/g, "$1`"); 455 | tag = escapeCharacters(tag, wholeMatch.charAt(1) == "!" ? "\\`*_/" : "\\`*_"); // also escape slashes in comments to prevent autolinking there -- http://meta.stackoverflow.com/questions/95987 456 | return tag; 457 | }); 458 | 459 | return text; 460 | } 461 | 462 | function _DoAnchors(text) { 463 | // 464 | // Turn Markdown link shortcuts into XHTML
tags. 465 | // 466 | // 467 | // First, handle reference-style links: [link text] [id] 468 | // 469 | 470 | /* 471 | text = text.replace(/ 472 | ( // wrap whole match in $1 473 | \[ 474 | ( 475 | (?: 476 | \[[^\]]*\] // allow brackets nested one level 477 | | 478 | [^\[] // or anything else 479 | )* 480 | ) 481 | \] 482 | 483 | [ ]? // one optional space 484 | (?:\n[ ]*)? // one optional newline followed by spaces 485 | 486 | \[ 487 | (.*?) // id = $3 488 | \] 489 | ) 490 | ()()()() // pad remaining backreferences 491 | /g, writeAnchorTag); 492 | */ 493 | text = text.replace(/(\[((?:\[[^\]]*\]|[^\[\]])*)\][ ]?(?:\n[ ]*)?\[(.*?)\])()()()()/g, writeAnchorTag); 494 | 495 | // 496 | // Next, inline-style links: [link text](url "optional title") 497 | // 498 | 499 | /* 500 | text = text.replace(/ 501 | ( // wrap whole match in $1 502 | \[ 503 | ( 504 | (?: 505 | \[[^\]]*\] // allow brackets nested one level 506 | | 507 | [^\[\]] // or anything else 508 | )* 509 | ) 510 | \] 511 | \( // literal paren 512 | [ \t]* 513 | () // no id, so leave $3 empty 514 | ? 521 | [ \t]* 522 | ( // $5 523 | (['"]) // quote char = $6 524 | (.*?) // Title = $7 525 | \6 // matching quote 526 | [ \t]* // ignore any spaces/tabs between closing quote and ) 527 | )? // title is optional 528 | \) 529 | ) 530 | /g, writeAnchorTag); 531 | */ 532 | 533 | text = text.replace(/(\[((?:\[[^\]]*\]|[^\[\]])*)\]\([ \t]*()?[ \t]*((['"])(.*?)\6[ \t]*)?\))/g, writeAnchorTag); 534 | 535 | // 536 | // Last, handle reference-style shortcuts: [link text] 537 | // These must come last in case you've also got [link test][1] 538 | // or [link test](/foo) 539 | // 540 | 541 | /* 542 | text = text.replace(/ 543 | ( // wrap whole match in $1 544 | \[ 545 | ([^\[\]]+) // link text = $2; can't contain '[' or ']' 546 | \] 547 | ) 548 | ()()()()() // pad rest of backreferences 549 | /g, writeAnchorTag); 550 | */ 551 | text = text.replace(/(\[([^\[\]]+)\])()()()()()/g, writeAnchorTag); 552 | 553 | return text; 554 | } 555 | 556 | function writeAnchorTag(wholeMatch, m1, m2, m3, m4, m5, m6, m7) { 557 | if (m7 == undefined) m7 = ""; 558 | var whole_match = m1; 559 | var link_text = m2.replace(/:\/\//g, "~P"); // to prevent auto-linking withing the link. will be converted back after the auto-linker runs 560 | var link_id = m3.toLowerCase(); 561 | var url = m4; 562 | var title = m7; 563 | 564 | if (url == "") { 565 | if (link_id == "") { 566 | // lower-case and turn embedded newlines into spaces 567 | link_id = link_text.toLowerCase().replace(/ ?\n/g, " "); 568 | } 569 | url = "#" + link_id; 570 | 571 | if (g_urls.get(link_id) != undefined) { 572 | url = g_urls.get(link_id); 573 | if (g_titles.get(link_id) != undefined) { 574 | title = g_titles.get(link_id); 575 | } 576 | } 577 | else { 578 | if (whole_match.search(/\(\s*\)$/m) > -1) { 579 | // Special case for explicit empty url 580 | url = ""; 581 | } else { 582 | return whole_match; 583 | } 584 | } 585 | } 586 | url = encodeProblemUrlChars(url); 587 | url = escapeCharacters(url, "*_"); 588 | var result = ""; 597 | 598 | return result; 599 | } 600 | 601 | function _DoImages(text) { 602 | // 603 | // Turn Markdown image shortcuts into tags. 604 | // 605 | 606 | // 607 | // First, handle reference-style labeled images: ![alt text][id] 608 | // 609 | 610 | /* 611 | text = text.replace(/ 612 | ( // wrap whole match in $1 613 | !\[ 614 | (.*?) // alt text = $2 615 | \] 616 | 617 | [ ]? // one optional space 618 | (?:\n[ ]*)? // one optional newline followed by spaces 619 | 620 | \[ 621 | (.*?) // id = $3 622 | \] 623 | ) 624 | ()()()() // pad rest of backreferences 625 | /g, writeImageTag); 626 | */ 627 | text = text.replace(/(!\[(.*?)\][ ]?(?:\n[ ]*)?\[(.*?)\])()()()()/g, writeImageTag); 628 | 629 | // 630 | // Next, handle inline images: ![alt text](url "optional title") 631 | // Don't forget: encode * and _ 632 | 633 | /* 634 | text = text.replace(/ 635 | ( // wrap whole match in $1 636 | !\[ 637 | (.*?) // alt text = $2 638 | \] 639 | \s? // One optional whitespace character 640 | \( // literal paren 641 | [ \t]* 642 | () // no id, so leave $3 empty 643 | ? // src url = $4 644 | [ \t]* 645 | ( // $5 646 | (['"]) // quote char = $6 647 | (.*?) // title = $7 648 | \6 // matching quote 649 | [ \t]* 650 | )? // title is optional 651 | \) 652 | ) 653 | /g, writeImageTag); 654 | */ 655 | text = text.replace(/(!\[(.*?)\]\s?\([ \t]*()?[ \t]*((['"])(.*?)\6[ \t]*)?\))/g, writeImageTag); 656 | 657 | return text; 658 | } 659 | 660 | function attributeEncode(text) { 661 | // unconditionally replace angle brackets here -- what ends up in an attribute (e.g. alt or title) 662 | // never makes sense to have verbatim HTML in it (and the sanitizer would totally break it) 663 | return text.replace(/>/g, ">").replace(/" + _RunSpanGamut(m1) + "\n\n"; } 722 | ); 723 | 724 | text = text.replace(/^(.+)[ \t]*\n-+[ \t]*\n+/gm, 725 | function (matchFound, m1) { return "

" + _RunSpanGamut(m1) + "

\n\n"; } 726 | ); 727 | 728 | // atx-style headers: 729 | // # Header 1 730 | // ## Header 2 731 | // ## Header 2 with closing hashes ## 732 | // ... 733 | // ###### Header 6 734 | // 735 | 736 | /* 737 | text = text.replace(/ 738 | ^(\#{1,6}) // $1 = string of #'s 739 | [ \t]* 740 | (.+?) // $2 = Header text 741 | [ \t]* 742 | \#* // optional closing #'s (not counted) 743 | \n+ 744 | /gm, function() {...}); 745 | */ 746 | 747 | text = text.replace(/^(\#{1,6})[ \t]*(.+?)[ \t]*\#*\n+/gm, 748 | function (wholeMatch, m1, m2) { 749 | var h_level = m1.length; 750 | return "" + _RunSpanGamut(m2) + "\n\n"; 751 | } 752 | ); 753 | 754 | return text; 755 | } 756 | 757 | function _DoLists(text) { 758 | // 759 | // Form HTML ordered (numbered) and unordered (bulleted) lists. 760 | // 761 | 762 | // attacklab: add sentinel to hack around khtml/safari bug: 763 | // http://bugs.webkit.org/show_bug.cgi?id=11231 764 | text += "~0"; 765 | 766 | // Re-usable pattern to match any entirel ul or ol list: 767 | 768 | /* 769 | var whole_list = / 770 | ( // $1 = whole list 771 | ( // $2 772 | [ ]{0,3} // attacklab: g_tab_width - 1 773 | ([*+-]|\d+[.]) // $3 = first list item marker 774 | [ \t]+ 775 | ) 776 | [^\r]+? 777 | ( // $4 778 | ~0 // sentinel for workaround; should be $ 779 | | 780 | \n{2,} 781 | (?=\S) 782 | (?! // Negative lookahead for another list item marker 783 | [ \t]* 784 | (?:[*+-]|\d+[.])[ \t]+ 785 | ) 786 | ) 787 | ) 788 | /g 789 | */ 790 | var whole_list = /^(([ ]{0,3}([*+-]|\d+[.])[ \t]+)[^\r]+?(~0|\n{2,}(?=\S)(?![ \t]*(?:[*+-]|\d+[.])[ \t]+)))/gm; 791 | 792 | if (g_list_level) { 793 | text = text.replace(whole_list, function (wholeMatch, m1, m2) { 794 | var list = m1; 795 | var list_type = (m2.search(/[*+-]/g) > -1) ? "ul" : "ol"; 796 | 797 | var result = _ProcessListItems(list, list_type); 798 | 799 | // Trim any trailing whitespace, to put the closing `` 800 | // up on the preceding line, to get it past the current stupid 801 | // HTML block parser. This is a hack to work around the terrible 802 | // hack that is the HTML block parser. 803 | result = result.replace(/\s+$/, ""); 804 | result = "<" + list_type + ">" + result + "\n"; 805 | return result; 806 | }); 807 | } else { 808 | whole_list = /(\n\n|^\n?)(([ ]{0,3}([*+-]|\d+[.])[ \t]+)[^\r]+?(~0|\n{2,}(?=\S)(?![ \t]*(?:[*+-]|\d+[.])[ \t]+)))/g; 809 | text = text.replace(whole_list, function (wholeMatch, m1, m2, m3) { 810 | var runup = m1; 811 | var list = m2; 812 | 813 | var list_type = (m3.search(/[*+-]/g) > -1) ? "ul" : "ol"; 814 | var result = _ProcessListItems(list, list_type); 815 | result = runup + "<" + list_type + ">\n" + result + "\n"; 816 | return result; 817 | }); 818 | } 819 | 820 | // attacklab: strip sentinel 821 | text = text.replace(/~0/, ""); 822 | 823 | return text; 824 | } 825 | 826 | var _listItemMarkers = { ol: "\\d+[.]", ul: "[*+-]" }; 827 | 828 | function _ProcessListItems(list_str, list_type) { 829 | // 830 | // Process the contents of a single ordered or unordered list, splitting it 831 | // into individual list items. 832 | // 833 | // list_type is either "ul" or "ol". 834 | 835 | // The $g_list_level global keeps track of when we're inside a list. 836 | // Each time we enter a list, we increment it; when we leave a list, 837 | // we decrement. If it's zero, we're not in a list anymore. 838 | // 839 | // We do this because when we're not inside a list, we want to treat 840 | // something like this: 841 | // 842 | // I recommend upgrading to version 843 | // 8. Oops, now this line is treated 844 | // as a sub-list. 845 | // 846 | // As a single paragraph, despite the fact that the second line starts 847 | // with a digit-period-space sequence. 848 | // 849 | // Whereas when we're inside a list (or sub-list), that line will be 850 | // treated as the start of a sub-list. What a kludge, huh? This is 851 | // an aspect of Markdown's syntax that's hard to parse perfectly 852 | // without resorting to mind-reading. Perhaps the solution is to 853 | // change the syntax rules such that sub-lists must start with a 854 | // starting cardinal number; e.g. "1." or "a.". 855 | 856 | g_list_level++; 857 | 858 | // trim trailing blank lines: 859 | list_str = list_str.replace(/\n{2,}$/, "\n"); 860 | 861 | // attacklab: add sentinel to emulate \z 862 | list_str += "~0"; 863 | 864 | // In the original attacklab showdown, list_type was not given to this function, and anything 865 | // that matched /[*+-]|\d+[.]/ would just create the next
  • , causing this mismatch: 866 | // 867 | // Markdown rendered by WMD rendered by MarkdownSharp 868 | // ------------------------------------------------------------------ 869 | // 1. first 1. first 1. first 870 | // 2. second 2. second 2. second 871 | // - third 3. third * third 872 | // 873 | // We changed this to behave identical to MarkdownSharp. This is the constructed RegEx, 874 | // with {MARKER} being one of \d+[.] or [*+-], depending on list_type: 875 | 876 | /* 877 | list_str = list_str.replace(/ 878 | (^[ \t]*) // leading whitespace = $1 879 | ({MARKER}) [ \t]+ // list marker = $2 880 | ([^\r]+? // list item text = $3 881 | (\n+) 882 | ) 883 | (?= 884 | (~0 | \2 ({MARKER}) [ \t]+) 885 | ) 886 | /gm, function(){...}); 887 | */ 888 | 889 | var marker = _listItemMarkers[list_type]; 890 | var re = new RegExp("(^[ \\t]*)(" + marker + ")[ \\t]+([^\\r]+?(\\n+))(?=(~0|\\1(" + marker + ")[ \\t]+))", "gm"); 891 | var last_item_had_a_double_newline = false; 892 | list_str = list_str.replace(re, 893 | function (wholeMatch, m1, m2, m3) { 894 | var item = m3; 895 | var leading_space = m1; 896 | var ends_with_double_newline = /\n\n$/.test(item); 897 | var contains_double_newline = ends_with_double_newline || item.search(/\n{2,}/) > -1; 898 | 899 | if (contains_double_newline || last_item_had_a_double_newline) { 900 | item = _RunBlockGamut(_Outdent(item), /* doNotUnhash = */true); 901 | } 902 | else { 903 | // Recursion for sub-lists: 904 | item = _DoLists(_Outdent(item)); 905 | item = item.replace(/\n$/, ""); // chomp(item) 906 | item = _RunSpanGamut(item); 907 | } 908 | last_item_had_a_double_newline = ends_with_double_newline; 909 | return "
  • " + item + "
  • \n"; 910 | } 911 | ); 912 | 913 | // attacklab: strip sentinel 914 | list_str = list_str.replace(/~0/g, ""); 915 | 916 | g_list_level--; 917 | return list_str; 918 | } 919 | 920 | function _DoCodeBlocks(text) { 921 | // 922 | // Process Markdown `
    ` blocks.
     923 |             //  
     924 | 
     925 |             /*
     926 |             text = text.replace(/
     927 |                 (?:\n\n|^)
     928 |                 (                               // $1 = the code block -- one or more lines, starting with a space/tab
     929 |                     (?:
     930 |                         (?:[ ]{4}|\t)           // Lines must start with a tab or a tab-width of spaces - attacklab: g_tab_width
     931 |                         .*\n+
     932 |                     )+
     933 |                 )
     934 |                 (\n*[ ]{0,3}[^ \t\n]|(?=~0))    // attacklab: g_tab_width
     935 |             /g ,function(){...});
     936 |             */
     937 | 
     938 |             // attacklab: sentinel workarounds for lack of \A and \Z, safari\khtml bug
     939 |             text += "~0";
     940 | 
     941 |             text = text.replace(/(?:\n\n|^)((?:(?:[ ]{4}|\t).*\n+)+)(\n*[ ]{0,3}[^ \t\n]|(?=~0))/g,
     942 |                 function (wholeMatch, m1, m2) {
     943 |                     var codeblock = m1;
     944 |                     var nextChar = m2;
     945 | 
     946 |                     codeblock = _EncodeCode(_Outdent(codeblock));
     947 |                     codeblock = _Detab(codeblock);
     948 |                     codeblock = codeblock.replace(/^\n+/g, ""); // trim leading newlines
     949 |                     codeblock = codeblock.replace(/\n+$/g, ""); // trim trailing whitespace
     950 | 
     951 |                     codeblock = "
    " + codeblock + "\n
    "; 952 | 953 | return "\n\n" + codeblock + "\n\n" + nextChar; 954 | } 955 | ); 956 | 957 | // attacklab: strip sentinel 958 | text = text.replace(/~0/, ""); 959 | 960 | return text; 961 | } 962 | 963 | function hashBlock(text) { 964 | text = text.replace(/(^\n+|\n+$)/g, ""); 965 | return "\n\n~K" + (g_html_blocks.push(text) - 1) + "K\n\n"; 966 | } 967 | 968 | function _DoCodeSpans(text) { 969 | // 970 | // * Backtick quotes are used for spans. 971 | // 972 | // * You can use multiple backticks as the delimiters if you want to 973 | // include literal backticks in the code span. So, this input: 974 | // 975 | // Just type ``foo `bar` baz`` at the prompt. 976 | // 977 | // Will translate to: 978 | // 979 | //

    Just type foo `bar` baz at the prompt.

    980 | // 981 | // There's no arbitrary limit to the number of backticks you 982 | // can use as delimters. If you need three consecutive backticks 983 | // in your code, use four for delimiters, etc. 984 | // 985 | // * You can use spaces to get literal backticks at the edges: 986 | // 987 | // ... type `` `bar` `` ... 988 | // 989 | // Turns to: 990 | // 991 | // ... type `bar` ... 992 | // 993 | 994 | /* 995 | text = text.replace(/ 996 | (^|[^\\]) // Character before opening ` can't be a backslash 997 | (`+) // $2 = Opening run of ` 998 | ( // $3 = The code block 999 | [^\r]*? 1000 | [^`] // attacklab: work around lack of lookbehind 1001 | ) 1002 | \2 // Matching closer 1003 | (?!`) 1004 | /gm, function(){...}); 1005 | */ 1006 | 1007 | text = text.replace(/(^|[^\\])(`+)([^\r]*?[^`])\2(?!`)/gm, 1008 | function (wholeMatch, m1, m2, m3, m4) { 1009 | var c = m3; 1010 | c = c.replace(/^([ \t]*)/g, ""); // leading whitespace 1011 | c = c.replace(/[ \t]*$/g, ""); // trailing whitespace 1012 | c = _EncodeCode(c); 1013 | c = c.replace(/:\/\//g, "~P"); // to prevent auto-linking. Not necessary in code *blocks*, but in code spans. Will be converted back after the auto-linker runs. 1014 | return m1 + "" + c + ""; 1015 | } 1016 | ); 1017 | 1018 | return text; 1019 | } 1020 | 1021 | function _EncodeCode(text) { 1022 | // 1023 | // Encode/escape certain characters inside Markdown code runs. 1024 | // The point is that in code, these characters are literals, 1025 | // and lose their special Markdown meanings. 1026 | // 1027 | // Encode all ampersands; HTML entities are not 1028 | // entities within a Markdown code span. 1029 | text = text.replace(/&/g, "&"); 1030 | 1031 | // Do the angle bracket song and dance: 1032 | text = text.replace(//g, ">"); 1034 | 1035 | // Now, escape characters that are magic in Markdown: 1036 | text = escapeCharacters(text, "\*_{}[]\\", false); 1037 | 1038 | // jj the line above breaks this: 1039 | //--- 1040 | 1041 | //* Item 1042 | 1043 | // 1. Subitem 1044 | 1045 | // special char: * 1046 | //--- 1047 | 1048 | return text; 1049 | } 1050 | 1051 | function _DoItalicsAndBold(text) { 1052 | 1053 | // must go first: 1054 | text = text.replace(/([\W_]|^)(\*\*|__)(?=\S)([^\r]*?\S[\*_]*)\2([\W_]|$)/g, 1055 | "$1$3$4"); 1056 | 1057 | text = text.replace(/([\W_]|^)(\*|_)(?=\S)([^\r\*_]*?\S)\2([\W_]|$)/g, 1058 | "$1$3$4"); 1059 | 1060 | return text; 1061 | } 1062 | 1063 | function _DoBlockQuotes(text) { 1064 | 1065 | /* 1066 | text = text.replace(/ 1067 | ( // Wrap whole match in $1 1068 | ( 1069 | ^[ \t]*>[ \t]? // '>' at the start of a line 1070 | .+\n // rest of the first line 1071 | (.+\n)* // subsequent consecutive lines 1072 | \n* // blanks 1073 | )+ 1074 | ) 1075 | /gm, function(){...}); 1076 | */ 1077 | 1078 | text = text.replace(/((^[ \t]*>[ \t]?.+\n(.+\n)*\n*)+)/gm, 1079 | function (wholeMatch, m1) { 1080 | var bq = m1; 1081 | 1082 | // attacklab: hack around Konqueror 3.5.4 bug: 1083 | // "----------bug".replace(/^-/g,"") == "bug" 1084 | 1085 | bq = bq.replace(/^[ \t]*>[ \t]?/gm, "~0"); // trim one level of quoting 1086 | 1087 | // attacklab: clean up hack 1088 | bq = bq.replace(/~0/g, ""); 1089 | 1090 | bq = bq.replace(/^[ \t]+$/gm, ""); // trim whitespace-only lines 1091 | bq = _RunBlockGamut(bq); // recurse 1092 | 1093 | bq = bq.replace(/(^|\n)/g, "$1 "); 1094 | // These leading spaces screw with
     content, so we need to fix that:
    1095 |                     bq = bq.replace(
    1096 |                             /(\s*
    [^\r]+?<\/pre>)/gm,
    1097 |                         function (wholeMatch, m1) {
    1098 |                             var pre = m1;
    1099 |                             // attacklab: hack around Konqueror 3.5.4 bug:
    1100 |                             pre = pre.replace(/^  /mg, "~0");
    1101 |                             pre = pre.replace(/~0/g, "");
    1102 |                             return pre;
    1103 |                         });
    1104 | 
    1105 |                     return hashBlock("
    \n" + bq + "\n
    "); 1106 | } 1107 | ); 1108 | return text; 1109 | } 1110 | 1111 | function _FormParagraphs(text, doNotUnhash) { 1112 | // 1113 | // Params: 1114 | // $text - string to process with html

    tags 1115 | // 1116 | 1117 | // Strip leading and trailing lines: 1118 | text = text.replace(/^\n+/g, ""); 1119 | text = text.replace(/\n+$/g, ""); 1120 | 1121 | var grafs = text.split(/\n{2,}/g); 1122 | var grafsOut = []; 1123 | 1124 | var markerRe = /~K(\d+)K/; 1125 | 1126 | // 1127 | // Wrap

    tags. 1128 | // 1129 | var end = grafs.length; 1130 | for (var i = 0; i < end; i++) { 1131 | var str = grafs[i]; 1132 | 1133 | // if this is an HTML marker, copy it 1134 | if (markerRe.test(str)) { 1135 | grafsOut.push(str); 1136 | } 1137 | else if (/\S/.test(str)) { 1138 | str = _RunSpanGamut(str); 1139 | str = str.replace(/^([ \t]*)/g, "

    "); 1140 | str += "

    " 1141 | grafsOut.push(str); 1142 | } 1143 | 1144 | } 1145 | // 1146 | // Unhashify HTML blocks 1147 | // 1148 | if (!doNotUnhash) { 1149 | end = grafsOut.length; 1150 | for (var i = 0; i < end; i++) { 1151 | var foundAny = true; 1152 | while (foundAny) { // we may need several runs, since the data may be nested 1153 | foundAny = false; 1154 | grafsOut[i] = grafsOut[i].replace(/~K(\d+)K/g, function (wholeMatch, id) { 1155 | foundAny = true; 1156 | return g_html_blocks[id]; 1157 | }); 1158 | } 1159 | } 1160 | } 1161 | return grafsOut.join("\n\n"); 1162 | } 1163 | 1164 | function _EncodeAmpsAndAngles(text) { 1165 | // Smart processing for ampersands and angle brackets that need to be encoded. 1166 | 1167 | // Ampersand-encoding based entirely on Nat Irons's Amputator MT plugin: 1168 | // http://bumppo.net/projects/amputator/ 1169 | text = text.replace(/&(?!#?[xX]?(?:[0-9a-fA-F]+|\w+);)/g, "&"); 1170 | 1171 | // Encode naked <'s 1172 | text = text.replace(/<(?![a-z\/?\$!])/gi, "<"); 1173 | 1174 | return text; 1175 | } 1176 | 1177 | function _EncodeBackslashEscapes(text) { 1178 | // 1179 | // Parameter: String. 1180 | // Returns: The string, with after processing the following backslash 1181 | // escape sequences. 1182 | // 1183 | 1184 | // attacklab: The polite way to do this is with the new 1185 | // escapeCharacters() function: 1186 | // 1187 | // text = escapeCharacters(text,"\\",true); 1188 | // text = escapeCharacters(text,"`*_{}[]()>#+-.!",true); 1189 | // 1190 | // ...but we're sidestepping its use of the (slow) RegExp constructor 1191 | // as an optimization for Firefox. This function gets called a LOT. 1192 | 1193 | text = text.replace(/\\(\\)/g, escapeCharacters_callback); 1194 | text = text.replace(/\\([`*_{}\[\]()>#+-.!])/g, escapeCharacters_callback); 1195 | return text; 1196 | } 1197 | 1198 | function _DoAutoLinks(text) { 1199 | 1200 | // note that at this point, all other URL in the text are already hyperlinked as
    1201 | // *except* for the case 1202 | 1203 | // automatically add < and > around unadorned raw hyperlinks 1204 | // must be preceded by space/BOF and followed by non-word/EOF character 1205 | text = text.replace(/(^|\s)(https?|ftp)(:\/\/[-A-Z0-9+&@#\/%?=~_|\[\]\(\)!:,\.;]*[-A-Z0-9+&@#\/%=~_|\[\]])($|\W)/gi, "$1<$2$3>$4"); 1206 | 1207 | // autolink anything like 1208 | 1209 | var replacer = function (wholematch, m1) { return "" + pluginHooks.plainLinkText(m1) + ""; } 1210 | text = text.replace(/<((https?|ftp):[^'">\s]+)>/gi, replacer); 1211 | 1212 | // Email addresses: 1213 | /* 1214 | text = text.replace(/ 1215 | < 1216 | (?:mailto:)? 1217 | ( 1218 | [-.\w]+ 1219 | \@ 1220 | [-a-z0-9]+(\.[-a-z0-9]+)*\.[a-z]+ 1221 | ) 1222 | > 1223 | /gi, _DoAutoLinks_callback()); 1224 | */ 1225 | 1226 | /* disabling email autolinking, since we don't do that on the server, either 1227 | text = text.replace(/<(?:mailto:)?([-.\w]+\@[-a-z0-9]+(\.[-a-z0-9]+)*\.[a-z]+)>/gi, 1228 | function(wholeMatch,m1) { 1229 | return _EncodeEmailAddress( _UnescapeSpecialChars(m1) ); 1230 | } 1231 | ); 1232 | */ 1233 | return text; 1234 | } 1235 | 1236 | function _UnescapeSpecialChars(text) { 1237 | // 1238 | // Swap back in all the special characters we've hidden. 1239 | // 1240 | text = text.replace(/~E(\d+)E/g, 1241 | function (wholeMatch, m1) { 1242 | var charCodeToReplace = parseInt(m1); 1243 | return String.fromCharCode(charCodeToReplace); 1244 | } 1245 | ); 1246 | return text; 1247 | } 1248 | 1249 | function _Outdent(text) { 1250 | // 1251 | // Remove one level of line-leading tabs or spaces 1252 | // 1253 | 1254 | // attacklab: hack around Konqueror 3.5.4 bug: 1255 | // "----------bug".replace(/^-/g,"") == "bug" 1256 | 1257 | text = text.replace(/^(\t|[ ]{1,4})/gm, "~0"); // attacklab: g_tab_width 1258 | 1259 | // attacklab: clean up hack 1260 | text = text.replace(/~0/g, "") 1261 | 1262 | return text; 1263 | } 1264 | 1265 | function _Detab(text) { 1266 | if (!/\t/.test(text)) 1267 | return text; 1268 | 1269 | var spaces = [" ", " ", " ", " "], 1270 | skew = 0, 1271 | v; 1272 | 1273 | return text.replace(/[\n\t]/g, function (match, offset) { 1274 | if (match === "\n") { 1275 | skew = offset + 1; 1276 | return match; 1277 | } 1278 | v = (offset - skew) % 4; 1279 | skew = offset + 1; 1280 | return spaces[v]; 1281 | }); 1282 | } 1283 | 1284 | // 1285 | // attacklab: Utility functions 1286 | // 1287 | 1288 | var _problemUrlChars = /(?:["'*()[\]:]|~D)/g; 1289 | 1290 | // hex-encodes some unusual "problem" chars in URLs to avoid URL detection problems 1291 | function encodeProblemUrlChars(url) { 1292 | if (!url) 1293 | return ""; 1294 | 1295 | var len = url.length; 1296 | 1297 | return url.replace(_problemUrlChars, function (match, offset) { 1298 | if (match == "~D") // escape for dollar 1299 | return "%24"; 1300 | if (match == ":") { 1301 | if (offset == len - 1 || /[0-9\/]/.test(url.charAt(offset + 1))) 1302 | return ":" 1303 | } 1304 | return "%" + match.charCodeAt(0).toString(16); 1305 | }); 1306 | } 1307 | 1308 | 1309 | function escapeCharacters(text, charsToEscape, afterBackslash) { 1310 | // First we have to escape the escape characters so that 1311 | // we can build a character class out of them 1312 | var regexString = "([" + charsToEscape.replace(/([\[\]\\])/g, "\\$1") + "])"; 1313 | 1314 | if (afterBackslash) { 1315 | regexString = "\\\\" + regexString; 1316 | } 1317 | 1318 | var regex = new RegExp(regexString, "g"); 1319 | text = text.replace(regex, escapeCharacters_callback); 1320 | 1321 | return text; 1322 | } 1323 | 1324 | 1325 | function escapeCharacters_callback(wholeMatch, m1) { 1326 | var charCodeToEscape = m1.charCodeAt(0); 1327 | return "~E" + charCodeToEscape + "E"; 1328 | } 1329 | 1330 | }; // end of the Markdown.Converter constructor 1331 | 1332 | })(); 1333 | --------------------------------------------------------------------------------