From 77d338f93ae9ef443949ffe962732eeffc4964f8 Mon Sep 17 00:00:00 2001 From: Josh Nichols Date: Sat, 8 Sep 2012 21:53:43 -0400 Subject: Open notes in new window, instead of printing to console It can be tedious to load up the speaker notes, with the whole having to open the javascript console, and clicking on the link. This simplifies it by automatically opening the notes in a new window. Most browsers will warn that it's trying to open a pop-up, but it's easy enough to allow it. --- plugin/speakernotes/client.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'plugin') diff --git a/plugin/speakernotes/client.js b/plugin/speakernotes/client.js index 1aba8b8..a97ad46 100644 --- a/plugin/speakernotes/client.js +++ b/plugin/speakernotes/client.js @@ -5,7 +5,7 @@ var socket = io.connect(window.location.origin); var socketId = Math.random().toString().slice(2); - console.log('View slide notes at ' + window.location.origin + '/notes/' + socketId); + window.open(window.location.origin + '/notes/' + socketId, 'notes-' + socketId) Reveal.addEventListener( 'slidechanged', function( event ) { var nextindexh; -- cgit v1.2.3 From a8a3765bec9a490b285f3422be2dd06e5acb65d4 Mon Sep 17 00:00:00 2001 From: Josh Nichols Date: Sat, 8 Sep 2012 22:05:19 -0400 Subject: Support markdown in speaker notes It's pretty nice to have markdown in slides. It's even nicer to have markdown in speaker notes too :) --- plugin/speakernotes/client.js | 4 +++- plugin/speakernotes/notes.html | 9 ++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) (limited to 'plugin') diff --git a/plugin/speakernotes/client.js b/plugin/speakernotes/client.js index 1aba8b8..9e657d6 100644 --- a/plugin/speakernotes/client.js +++ b/plugin/speakernotes/client.js @@ -27,7 +27,9 @@ indexv : event.indexv, nextindexh : nextindexh, nextindexv : nextindexv, - socketId : socketId + socketId : socketId, + markdown : notes ? notes.getAttribute('data-markdown') != null : false + }; socket.emit('slidechanged', slideData); diff --git a/plugin/speakernotes/notes.html b/plugin/speakernotes/notes.html index 88924c0..f61501d 100644 --- a/plugin/speakernotes/notes.html +++ b/plugin/speakernotes/notes.html @@ -87,6 +87,7 @@
+ + + +
+ + + + + + + Follow @rvlio +
+ + Fork me on GitHub + + + + + + + diff --git a/js/reveal.js b/js/reveal.js index 3372029..c1ffb8f 100644 --- a/js/reveal.js +++ b/js/reveal.js @@ -1,5 +1,5 @@ /*! - * reveal.js 2.1 r32 + * reveal.js 2.1 r33 * http://lab.hakim.se/reveal-js * MIT licensed * @@ -285,18 +285,6 @@ var Reveal = (function(){ dom.progress.style.display = 'block'; } - // Load the theme in the config, if it's not already loaded - if( config.theme && dom.theme ) { - var themeURL = dom.theme.getAttribute( 'href' ); - var themeFinder = /[^\/]*?(?=\.css)/; - var themeName = themeURL.match(themeFinder)[0]; - - if( config.theme !== themeName ) { - themeURL = themeURL.replace(themeFinder, config.theme); - dom.theme.setAttribute( 'href', themeURL ); - } - } - if( config.transition !== 'default' ) { dom.wrapper.classList.add( config.transition ); } @@ -306,12 +294,27 @@ var Reveal = (function(){ document.addEventListener( 'mousewheel', onDocumentMouseScroll, false ); } + // 3D links if( config.rollingLinks ) { - // Add some 3D magic to our anchors linkify(); } + + // Load the theme in the config, if it's not already loaded + if( config.theme && dom.theme ) { + var themeURL = dom.theme.getAttribute( 'href' ); + var themeFinder = /[^\/]*?(?=\.css)/; + var themeName = themeURL.match(themeFinder)[0]; + + if( config.theme !== themeName ) { + themeURL = themeURL.replace(themeFinder, config.theme); + dom.theme.setAttribute( 'href', themeURL ); + } + } } + /** + * Binds all event listeners. + */ function addEventListeners() { document.addEventListener( 'touchstart', onDocumentTouchStart, false ); document.addEventListener( 'touchmove', onDocumentTouchMove, false ); @@ -330,6 +333,9 @@ var Reveal = (function(){ } } + /** + * Unbinds all event listeners. + */ function removeEventListeners() { document.removeEventListener( 'keydown', onDocumentKeyDown, false ); document.removeEventListener( 'touchstart', onDocumentTouchStart, false ); @@ -403,210 +409,6 @@ var Reveal = (function(){ extend( event, properties ); dom.wrapper.dispatchEvent( event ); } - - /** - * Handler for the document level 'keydown' event. - * - * @param {Object} event - */ - function onDocumentKeyDown( event ) { - // Disregard the event if the target is editable or a - // modifier is present - if ( document.querySelector( ':focus' ) !== null || event.shiftKey || event.altKey || event.ctrlKey || event.metaKey ) return; - - var triggered = true; - - switch( event.keyCode ) { - // p, page up - case 80: case 33: navigatePrev(); break; - // n, page down - case 78: case 34: navigateNext(); break; - // h, left - case 72: case 37: navigateLeft(); break; - // l, right - case 76: case 39: navigateRight(); break; - // k, up - case 75: case 38: navigateUp(); break; - // j, down - case 74: case 40: navigateDown(); break; - // home - case 36: navigateTo( 0 ); break; - // end - case 35: navigateTo( Number.MAX_VALUE ); break; - // space - case 32: isOverviewActive() ? deactivateOverview() : navigateNext(); break; - // return - case 13: isOverviewActive() ? deactivateOverview() : triggered = false; break; - // b, period - case 66: case 190: togglePause(); break; - // f - case 70: enterFullscreen(); break; - default: - triggered = false; - } - - // If the input resulted in a triggered action we should prevent - // the browsers default behavior - if( triggered ) { - event.preventDefault(); - } - else if ( event.keyCode === 27 && supports3DTransforms ) { - toggleOverview(); - - event.preventDefault(); - } - - // If auto-sliding is enabled we need to cue up - // another timeout - cueAutoSlide(); - - } - - /** - * Handler for the document level 'touchstart' event, - * enables support for swipe and pinch gestures. - */ - function onDocumentTouchStart( event ) { - touch.startX = event.touches[0].clientX; - touch.startY = event.touches[0].clientY; - touch.startCount = event.touches.length; - - // If there's two touches we need to memorize the distance - // between those two points to detect pinching - if( event.touches.length === 2 && config.overview ) { - touch.startSpan = distanceBetween( { - x: event.touches[1].clientX, - y: event.touches[1].clientY - }, { - x: touch.startX, - y: touch.startY - } ); - } - } - - /** - * Handler for the document level 'touchmove' event. - */ - function onDocumentTouchMove( event ) { - // Each touch should only trigger one action - if( !touch.handled ) { - var currentX = event.touches[0].clientX; - var currentY = event.touches[0].clientY; - - // If the touch started off with two points and still has - // two active touches; test for the pinch gesture - if( event.touches.length === 2 && touch.startCount === 2 && config.overview ) { - - // The current distance in pixels between the two touch points - var currentSpan = distanceBetween( { - x: event.touches[1].clientX, - y: event.touches[1].clientY - }, { - x: touch.startX, - y: touch.startY - } ); - - // If the span is larger than the desire amount we've got - // ourselves a pinch - if( Math.abs( touch.startSpan - currentSpan ) > touch.threshold ) { - touch.handled = true; - - if( currentSpan < touch.startSpan ) { - activateOverview(); - } - else { - deactivateOverview(); - } - } - - event.preventDefault(); - - } - // There was only one touch point, look for a swipe - else if( event.touches.length === 1 && touch.startCount !== 2 ) { - - var deltaX = currentX - touch.startX, - deltaY = currentY - touch.startY; - - if( deltaX > touch.threshold && Math.abs( deltaX ) > Math.abs( deltaY ) ) { - touch.handled = true; - navigateLeft(); - } - else if( deltaX < -touch.threshold && Math.abs( deltaX ) > Math.abs( deltaY ) ) { - touch.handled = true; - navigateRight(); - } - else if( deltaY > touch.threshold ) { - touch.handled = true; - navigateUp(); - } - else if( deltaY < -touch.threshold ) { - touch.handled = true; - navigateDown(); - } - - event.preventDefault(); - - } - } - // There's a bug with swiping on some Android devices unless - // the default action is always prevented - else if( navigator.userAgent.match( /android/gi ) ) { - event.preventDefault(); - } - } - - /** - * Handler for the document level 'touchend' event. - */ - function onDocumentTouchEnd( event ) { - touch.handled = false; - } - - /** - * Handles mouse wheel scrolling, throttled to avoid - * skipping multiple slides. - */ - function onDocumentMouseScroll( event ){ - clearTimeout( mouseWheelTimeout ); - - mouseWheelTimeout = setTimeout( function() { - var delta = event.detail || -event.wheelDelta; - if( delta > 0 ) { - navigateNext(); - } - else { - navigatePrev(); - } - }, 100 ); - } - - /** - * Handler for the window level 'hashchange' event. - * - * @param {Object} event - */ - function onWindowHashChange( event ) { - readURL(); - } - - /** - * Invoked when a slide is and we're in the overview. - */ - function onOverviewSlideClicked( event ) { - // TODO There's a bug here where the event listeners are not - // removed after deactivating the overview. - if( isOverviewActive() ) { - event.preventDefault(); - - deactivateOverview(); - - indexh = this.getAttribute( 'data-index-h' ); - indexv = this.getAttribute( 'data-index-v' ); - - slide(); - } - } /** * Wrap all links in 3D goodness. @@ -795,109 +597,14 @@ var Reveal = (function(){ function isPaused() { return dom.wrapper.classList.contains( 'paused' ); } - + /** - * Updates one dimension of slides by showing the slide - * with the specified index. - * - * @param {String} selector A CSS selector that will fetch - * the group of slides we are working with - * @param {Number} index The index of the slide that should be - * shown - * - * @return {Number} The index of the slide that is now shown, - * might differ from the passed in index if it was out of - * bounds. - */ - function updateSlides( selector, index ) { - // Select all slides and convert the NodeList result to - // an array - var slides = Array.prototype.slice.call( document.querySelectorAll( selector ) ), - slidesLength = slides.length; - - if( slidesLength ) { - - // Should the index loop? - if( config.loop ) { - index %= slidesLength; - - if( index < 0 ) { - index = slidesLength + index; - } - } - - // Enforce max and minimum index bounds - index = Math.max( Math.min( index, slidesLength - 1 ), 0 ); - - for( var i = 0; i < slidesLength; i++ ) { - var slide = slides[i]; - - // Optimization; hide all slides that are three or more steps - // away from the present slide - if( isOverviewActive() === false ) { - // The distance loops so that it measures 1 between the first - // and last slides - var distance = Math.abs( ( index - i ) % ( slidesLength - 3 ) ) || 0; - - slide.style.display = distance > 3 ? 'none' : 'block'; - } - - slides[i].classList.remove( 'past' ); - slides[i].classList.remove( 'present' ); - slides[i].classList.remove( 'future' ); - - if( i < index ) { - // Any element previous to index is given the 'past' class - slides[i].classList.add( 'past' ); - } - else if( i > index ) { - // Any element subsequent to index is given the 'future' class - slides[i].classList.add( 'future' ); - } - - // If this element contains vertical slides - if( slide.querySelector( 'section' ) ) { - slides[i].classList.add( 'stack' ); - } - } - - // Mark the current slide as present - slides[index].classList.add( 'present' ); - - // If this slide has a state associated with it, add it - // onto the current state of the deck - var slideState = slides[index].getAttribute( 'data-state' ); - if( slideState ) { - state = state.concat( slideState.split( ' ' ) ); - } - - // If this slide has a data-autoslide attribtue associated use this as - // autoSlide value otherwise use the global configured time - var slideAutoSlide = slides[index].getAttribute( 'data-autoslide' ); - if( slideAutoSlide ) { - autoSlide = parseInt( slideAutoSlide ); - } else { - autoSlide = config.autoSlide - } - - } - else { - // Since there are no slides we can't be anywhere beyond the - // zeroth index - index = 0; - } - - return index; - - } - - /** - * Steps from the current point in the presentation to the - * slide which matches the specified horizontal and vertical - * indices. - * - * @param {int} h Horizontal index of the target slide - * @param {int} v Vertical index of the target slide + * Steps from the current point in the presentation to the + * slide which matches the specified horizontal and vertical + * indices. + * + * @param {int} h Horizontal index of the target slide + * @param {int} v Vertical index of the target slide */ function slide( h, v ) { // Remember where we were at before @@ -986,26 +693,121 @@ var Reveal = (function(){ } } + /** + * Updates one dimension of slides by showing the slide + * with the specified index. + * + * @param {String} selector A CSS selector that will fetch + * the group of slides we are working with + * @param {Number} index The index of the slide that should be + * shown + * + * @return {Number} The index of the slide that is now shown, + * might differ from the passed in index if it was out of + * bounds. + */ + function updateSlides( selector, index ) { + // Select all slides and convert the NodeList result to + // an array + var slides = Array.prototype.slice.call( document.querySelectorAll( selector ) ), + slidesLength = slides.length; + + if( slidesLength ) { + + // Should the index loop? + if( config.loop ) { + index %= slidesLength; + + if( index < 0 ) { + index = slidesLength + index; + } + } + + // Enforce max and minimum index bounds + index = Math.max( Math.min( index, slidesLength - 1 ), 0 ); + + for( var i = 0; i < slidesLength; i++ ) { + var element = slides[i]; + + // Optimization; hide all slides that are three or more steps + // away from the present slide + if( isOverviewActive() === false ) { + // The distance loops so that it measures 1 between the first + // and last slides + var distance = Math.abs( ( index - i ) % ( slidesLength - 3 ) ) || 0; + + element.style.display = distance > 3 ? 'none' : 'block'; + } + + slides[i].classList.remove( 'past' ); + slides[i].classList.remove( 'present' ); + slides[i].classList.remove( 'future' ); + + if( i < index ) { + // Any element previous to index is given the 'past' class + slides[i].classList.add( 'past' ); + } + else if( i > index ) { + // Any element subsequent to index is given the 'future' class + slides[i].classList.add( 'future' ); + } + + // If this element contains vertical slides + if( element.querySelector( 'section' ) ) { + slides[i].classList.add( 'stack' ); + } + } + + // Mark the current slide as present + slides[index].classList.add( 'present' ); + + // If this slide has a state associated with it, add it + // onto the current state of the deck + var slideState = slides[index].getAttribute( 'data-state' ); + if( slideState ) { + state = state.concat( slideState.split( ' ' ) ); + } + + // If this slide has a data-autoslide attribtue associated use this as + // autoSlide value otherwise use the global configured time + var slideAutoSlide = slides[index].getAttribute( 'data-autoslide' ); + if( slideAutoSlide ) { + autoSlide = parseInt( slideAutoSlide ); + } else { + autoSlide = config.autoSlide + } + + } + else { + // Since there are no slides we can't be anywhere beyond the + // zeroth index + index = 0; + } + + return index; + + } + /** * Updates the state and link pointers of the controls. */ function updateControls() { - if ( !config.controls || !dom.controls ) { - return; + if ( config.controls && dom.controls ) { + + var routes = availableRoutes(); + + // Remove the 'enabled' class from all directions + [ dom.controlsLeft, dom.controlsRight, dom.controlsUp, dom.controlsDown ].forEach( function( node ) { + node.classList.remove( 'enabled' ); + } ); + + // Add the 'enabled' class to the available routes + if( routes.left ) dom.controlsLeft.classList.add( 'enabled' ); + if( routes.right ) dom.controlsRight.classList.add( 'enabled' ); + if( routes.up ) dom.controlsUp.classList.add( 'enabled' ); + if( routes.down ) dom.controlsDown.classList.add( 'enabled' ); + } - - var routes = availableRoutes(); - - // Remove the 'enabled' class from all directions - [ dom.controlsLeft, dom.controlsRight, dom.controlsUp, dom.controlsDown ].forEach( function( node ) { - node.classList.remove( 'enabled' ); - } ); - - // Add the 'enabled' class to the available routes - if( routes.left ) dom.controlsLeft.classList.add( 'enabled' ); - if( routes.right ) dom.controlsRight.classList.add( 'enabled' ); - if( routes.up ) dom.controlsUp.classList.add( 'enabled' ); - if( routes.down ) dom.controlsDown.classList.add( 'enabled' ); } /** @@ -1039,16 +841,16 @@ var Reveal = (function(){ // assume that this is a named link if( isNaN( parseInt( bits[0], 10 ) ) && name.length ) { // Find the slide with the specified name - var slide = document.querySelector( '#' + name ); + var element = document.querySelector( '#' + name ); - if( slide ) { + if( element ) { // Find the position of the named slide and navigate to it - var indices = Reveal.getIndices( slide ); - navigateTo( indices.h, indices.v ); + var indices = Reveal.getIndices( element ); + slide( indices.h, indices.v ); } // If the slide doesn't exist, navigate to the current slide else { - navigateTo( indexh, indexv ); + slide( indexh, indexv ); } } else { @@ -1056,7 +858,7 @@ var Reveal = (function(){ var h = parseInt( bits[0], 10 ) || 0, v = parseInt( bits[1], 10 ) || 0; - navigateTo( h, v ); + slide( h, v ); } } @@ -1077,6 +879,41 @@ var Reveal = (function(){ } } + /** + * Retrieves the h/v location of the current, or specified, + * slide. + * + * @param {HTMLElement} slide If specified, the returned + * index will be for this slide rather than the currently + * active one + * + * @return {Object} { h: , v: } + */ + function getIndices( slide ) { + // By default, return the current indices + var h = indexh, + v = indexv; + + // If a slide is specified, return the indices of that slide + if( slide ) { + var isVertical = !!slide.parentNode.nodeName.match( /section/gi ); + var slideh = isVertical ? slide.parentNode : slide; + + // Select all horizontal slides + var horizontalSlides = Array.prototype.slice.call( document.querySelectorAll( HORIZONTAL_SLIDES_SELECTOR ) ); + + // Now that we know which the horizontal slide is, get its index + h = Math.max( horizontalSlides.indexOf( slideh ), 0 ); + + // If this is a vertical slide, grab the vertical index + if( isVertical ) { + v = Math.max( Array.prototype.slice.call( slide.parentNode.children ).indexOf( slide ), 0 ); + } + } + + return { h: h, v: v }; + } + /** * Navigate to the next slide fragment. * @@ -1155,16 +992,6 @@ var Reveal = (function(){ } } - /** - * Triggers a navigation to the specified indices. - * - * @param {Number} h The horizontal index of the slide to show - * @param {Number} v The vertical index of the slide to show - */ - function navigateTo( h, v ) { - slide( h, v ); - } - function navigateLeft() { // Prioritize hiding fragments if( isOverviewActive() || previousFragment() === false ) { @@ -1232,16 +1059,244 @@ var Reveal = (function(){ cueAutoSlide(); } - // Expose some methods publicly + + // --------------------------------------------------------------------// + // ----------------------------- EVENTS -------------------------------// + // --------------------------------------------------------------------// + + + /** + * Handler for the document level 'keydown' event. + * + * @param {Object} event + */ + function onDocumentKeyDown( event ) { + // Disregard the event if the target is editable or a + // modifier is present + if ( document.querySelector( ':focus' ) !== null || event.shiftKey || event.altKey || event.ctrlKey || event.metaKey ) return; + + var triggered = true; + + switch( event.keyCode ) { + // p, page up + case 80: case 33: navigatePrev(); break; + // n, page down + case 78: case 34: navigateNext(); break; + // h, left + case 72: case 37: navigateLeft(); break; + // l, right + case 76: case 39: navigateRight(); break; + // k, up + case 75: case 38: navigateUp(); break; + // j, down + case 74: case 40: navigateDown(); break; + // home + case 36: slide( 0 ); break; + // end + case 35: slide( Number.MAX_VALUE ); break; + // space + case 32: isOverviewActive() ? deactivateOverview() : navigateNext(); break; + // return + case 13: isOverviewActive() ? deactivateOverview() : triggered = false; break; + // b, period + case 66: case 190: togglePause(); break; + // f + case 70: enterFullscreen(); break; + default: + triggered = false; + } + + // If the input resulted in a triggered action we should prevent + // the browsers default behavior + if( triggered ) { + event.preventDefault(); + } + else if ( event.keyCode === 27 && supports3DTransforms ) { + toggleOverview(); + + event.preventDefault(); + } + + // If auto-sliding is enabled we need to cue up + // another timeout + cueAutoSlide(); + + } + + /** + * Handler for the document level 'touchstart' event, + * enables support for swipe and pinch gestures. + */ + function onDocumentTouchStart( event ) { + touch.startX = event.touches[0].clientX; + touch.startY = event.touches[0].clientY; + touch.startCount = event.touches.length; + + // If there's two touches we need to memorize the distance + // between those two points to detect pinching + if( event.touches.length === 2 && config.overview ) { + touch.startSpan = distanceBetween( { + x: event.touches[1].clientX, + y: event.touches[1].clientY + }, { + x: touch.startX, + y: touch.startY + } ); + } + } + + /** + * Handler for the document level 'touchmove' event. + */ + function onDocumentTouchMove( event ) { + // Each touch should only trigger one action + if( !touch.handled ) { + var currentX = event.touches[0].clientX; + var currentY = event.touches[0].clientY; + + // If the touch started off with two points and still has + // two active touches; test for the pinch gesture + if( event.touches.length === 2 && touch.startCount === 2 && config.overview ) { + + // The current distance in pixels between the two touch points + var currentSpan = distanceBetween( { + x: event.touches[1].clientX, + y: event.touches[1].clientY + }, { + x: touch.startX, + y: touch.startY + } ); + + // If the span is larger than the desire amount we've got + // ourselves a pinch + if( Math.abs( touch.startSpan - currentSpan ) > touch.threshold ) { + touch.handled = true; + + if( currentSpan < touch.startSpan ) { + activateOverview(); + } + else { + deactivateOverview(); + } + } + + event.preventDefault(); + + } + // There was only one touch point, look for a swipe + else if( event.touches.length === 1 && touch.startCount !== 2 ) { + + var deltaX = currentX - touch.startX, + deltaY = currentY - touch.startY; + + if( deltaX > touch.threshold && Math.abs( deltaX ) > Math.abs( deltaY ) ) { + touch.handled = true; + navigateLeft(); + } + else if( deltaX < -touch.threshold && Math.abs( deltaX ) > Math.abs( deltaY ) ) { + touch.handled = true; + navigateRight(); + } + else if( deltaY > touch.threshold ) { + touch.handled = true; + navigateUp(); + } + else if( deltaY < -touch.threshold ) { + touch.handled = true; + navigateDown(); + } + + event.preventDefault(); + + } + } + // There's a bug with swiping on some Android devices unless + // the default action is always prevented + else if( navigator.userAgent.match( /android/gi ) ) { + event.preventDefault(); + } + } + + /** + * Handler for the document level 'touchend' event. + */ + function onDocumentTouchEnd( event ) { + touch.handled = false; + } + + /** + * Handles mouse wheel scrolling, throttled to avoid + * skipping multiple slides. + */ + function onDocumentMouseScroll( event ){ + clearTimeout( mouseWheelTimeout ); + + mouseWheelTimeout = setTimeout( function() { + var delta = event.detail || -event.wheelDelta; + if( delta > 0 ) { + navigateNext(); + } + else { + navigatePrev(); + } + }, 100 ); + } + + /** + * Handler for the window level 'hashchange' event. + * + * @param {Object} event + */ + function onWindowHashChange( event ) { + readURL(); + } + + /** + * Invoked when a slide is and we're in the overview. + */ + function onOverviewSlideClicked( event ) { + // TODO There's a bug here where the event listeners are not + // removed after deactivating the overview. + if( isOverviewActive() ) { + event.preventDefault(); + + deactivateOverview(); + + indexh = this.getAttribute( 'data-index-h' ); + indexv = this.getAttribute( 'data-index-v' ); + + slide(); + } + } + + + // --------------------------------------------------------------------// + // ------------------------------- API --------------------------------// + // --------------------------------------------------------------------// + + return { initialize: initialize, - navigateTo: navigateTo, + + // Navigation methods + slide: slide, + left: navigateLeft, + right: navigateRight, + up: navigateUp, + down: navigateDown, + prev: navigatePrev, + next: navigateNext, + + // Deprecated aliases + navigateTo: slide, navigateLeft: navigateLeft, navigateRight: navigateRight, navigateUp: navigateUp, navigateDown: navigateDown, navigatePrev: navigatePrev, navigateNext: navigateNext, + + // Toggles the overview mode on/off toggleOverview: toggleOverview, // Adds or removes all internal event listeners (such as keyboard) @@ -1249,30 +1304,7 @@ var Reveal = (function(){ removeEventListeners: removeEventListeners, // Returns the indices of the current, or specified, slide - getIndices: function( slide ) { - // By default, return the current indices - var h = indexh, - v = indexv; - - // If a slide is specified, return the indices of that slide - if( slide ) { - var isVertical = !!slide.parentNode.nodeName.match( /section/gi ); - var slideh = isVertical ? slide.parentNode : slide; - - // Select all horizontal slides - var horizontalSlides = Array.prototype.slice.call( document.querySelectorAll( HORIZONTAL_SLIDES_SELECTOR ) ); - - // Now that we know which the horizontal slide is, get its index - h = Math.max( horizontalSlides.indexOf( slideh ), 0 ); - - // If this is a vertical slide, grab the vertical index - if( isVertical ) { - v = Math.max( Array.prototype.slice.call( slide.parentNode.children ).indexOf( slide ), 0 ); - } - } - - return { h: h, v: v }; - }, + getIndices: getIndices, // Returns the previous slide element, may be null getPreviousSlide: function() { diff --git a/js/reveal.min.js b/js/reveal.min.js index b4f4083..8f25320 100644 --- a/js/reveal.min.js +++ b/js/reveal.min.js @@ -1,5 +1,5 @@ /*! - * reveal.js 2.1 r32 + * reveal.js 2.1 r33 * http://lab.hakim.se/reveal-js * MIT licensed * @@ -18,28 +18,18 @@ f.controlsDown=document.querySelector(".reveal .controls .down");}}function d(){ document.body.style.height="120%";window.addEventListener("load",ad,false);window.addEventListener("orientationchange",ad,false);}}function V(){var al=[],ap=[]; for(var am=0,ak=R.dependencies.length;amac.threshold){ac.handled=true;if(aoac.threshold&&Math.abs(al)>Math.abs(ak)){ac.handled=true;B();}else{if(al<-ac.threshold&&Math.abs(al)>Math.abs(ak)){ac.handled=true;j();}else{if(ak>ac.threshold){ac.handled=true; -u();}else{if(ak<-ac.threshold){ac.handled=true;F();}}}}ap.preventDefault();}}}else{if(navigator.userAgent.match(/android/gi)){ap.preventDefault();}}}function W(ak){ac.handled=false; -}function p(ak){clearTimeout(z);z=setTimeout(function(){var al=ak.detail||-ak.wheelDelta;if(al>0){x();}else{Z();}},100);}function w(ak){J();}function C(ak){if(L()){ak.preventDefault(); -ae();m=this.getAttribute("data-index-h");e=this.getAttribute("data-index-v");a();}}function M(){if(T&&!("msPerspective" in document.body.style)){var al=document.querySelectorAll(".reveal .slides section a:not(.image)"); +t(am,ak);f.wrapper.dispatchEvent(am);}function N(){if(T&&!("msPerspective" in document.body.style)){var al=document.querySelectorAll(".reveal .slides section a:not(.image)"); for(var am=0,ak=al.length;am'+an.innerHTML+"";}}}}function I(){if(R.overview){f.wrapper.classList.add("overview");var ak=document.querySelectorAll(l); for(var ap=0,an=ak.length;ap3?"none":"block";}al[ap].classList.remove("past"); -al[ap].classList.remove("present");al[ap].classList.remove("future");if(apat){al[ap].classList.add("future"); +}}function c(){f.wrapper.classList.add("paused");}function p(){f.wrapper.classList.remove("paused");}function aa(){if(ag()){p();}else{c();}}function ag(){return f.wrapper.classList.contains("paused"); +}function a(aq,av){y=G;var an=aj.concat();aj.length=0;var au=m,al=e;m=ai(l,aq===undefined?m:aq);e=ai(b,av===undefined?e:av);stateLoop:for(var ao=0,ar=aj.length; +ao3?"none":"block"; +}al[ap].classList.remove("past");al[ap].classList.remove("present");al[ap].classList.remove("future");if(apat){al[ap].classList.add("future"); }}if(aq.querySelector("section")){al[ap].classList.add("stack");}}al[at].classList.add("present");var am=al[at].getAttribute("data-state");if(am){aj=aj.concat(am.split(" ")); -}var ao=al[at].getAttribute("data-autoslide");if(ao){Y=parseInt(ao);}else{Y=R.autoSlide;}}else{at=0;}return at;}function a(aq,av){y=G;var an=aj.concat(); -aj.length=0;var au=m,al=e;m=ai(l,aq===undefined?m:aq);e=ai(b,av===undefined?e:av);stateLoop:for(var ao=0,ar=aj.length;ao0,right:m0,down:e0||e>0){ak+=m;}if(e>0){ak+="/"+e;}window.location.hash=ak;}}function v(){if(document.querySelector(b+".present")){var al=document.querySelectorAll(b+".present .fragment:not(.visible)"); -if(al.length){al[0].classList.add("visible");r("fragmentshown",{fragment:al[0]});return true;}}else{var ak=document.querySelectorAll(l+".present .fragment:not(.visible)"); -if(ak.length){ak[0].classList.add("visible");r("fragmentshown",{fragment:ak[0]});return true;}}return false;}function Q(){if(document.querySelector(b+".present")){var al=document.querySelectorAll(b+".present .fragment.visible"); +}var ao=al[at].getAttribute("data-autoslide");if(ao){Y=parseInt(ao);}else{Y=R.autoSlide;}}else{at=0;}return at;}function s(){if(R.controls&&f.controls){var ak=g(); +[f.controlsLeft,f.controlsRight,f.controlsUp,f.controlsDown].forEach(function(al){al.classList.remove("enabled");});if(ak.left){f.controlsLeft.classList.add("enabled"); +}if(ak.right){f.controlsRight.classList.add("enabled");}if(ak.up){f.controlsUp.classList.add("enabled");}if(ak.down){f.controlsDown.classList.add("enabled"); +}}}function g(){var ak=document.querySelectorAll(l),al=document.querySelectorAll(b);return{left:m>0,right:m0,down:e0||e>0){ak+=m; +}if(e>0){ak+="/"+e;}window.location.hash=ak;}}function M(ak){var ao=m,am=e;if(ak){var ap=!!ak.parentNode.nodeName.match(/section/gi);var an=ap?ak.parentNode:ak; +var al=Array.prototype.slice.call(document.querySelectorAll(l));ao=Math.max(al.indexOf(an),0);if(ap){am=Math.max(Array.prototype.slice.call(ak.parentNode.children).indexOf(ak),0); +}}return{h:ao,v:am};}function v(){if(document.querySelector(b+".present")){var al=document.querySelectorAll(b+".present .fragment:not(.visible)");if(al.length){al[0].classList.add("visible"); +r("fragmentshown",{fragment:al[0]});return true;}}else{var ak=document.querySelectorAll(l+".present .fragment:not(.visible)");if(ak.length){ak[0].classList.add("visible"); +r("fragmentshown",{fragment:ak[0]});return true;}}return false;}function Q(){if(document.querySelector(b+".present")){var al=document.querySelectorAll(b+".present .fragment.visible"); if(al.length){al[al.length-1].classList.remove("visible");r("fragmenthidden",{fragment:al[al.length-1]});return true;}}else{var ak=document.querySelectorAll(l+".present .fragment.visible"); -if(ak.length){ak[ak.length-1].classList.remove("visible");r("fragmenthidden",{fragment:ak[ak.length-1]});return true;}}return false;}function N(){clearTimeout(k); -if(Y){k=setTimeout(x,Y);}}function O(al,ak){a(al,ak);}function B(){if(L()||Q()===false){a(m-1,0);}}function j(){if(L()||v()===false){a(m+1,0);}}function u(){if(L()||Q()===false){a(m,e-1); +if(ak.length){ak[ak.length-1].classList.remove("visible");r("fragmenthidden",{fragment:ak[ak.length-1]});return true;}}return false;}function O(){clearTimeout(k); +if(Y){k=setTimeout(x,Y);}}function B(){if(L()||Q()===false){a(m-1,0);}}function j(){if(L()||v()===false){a(m+1,0);}}function u(){if(L()||Q()===false){a(m,e-1); }}function F(){if(L()||v()===false){a(m,e+1);}}function Z(){if(Q()===false){if(g().up){u();}else{var ak=document.querySelector(".reveal .slides>section.past:nth-child("+m+")"); -if(ak){e=(ak.querySelectorAll("section").length+1)||0;m--;a();}}}}function x(){if(v()===false){g().down?F():j();}N();}return{initialize:i,navigateTo:O,navigateLeft:B,navigateRight:j,navigateUp:u,navigateDown:F,navigatePrev:Z,navigateNext:x,toggleOverview:X,addEventListeners:E,removeEventListeners:U,getIndices:function(ak){var ao=m,am=e; -if(ak){var ap=!!ak.parentNode.nodeName.match(/section/gi);var an=ap?ak.parentNode:ak;var al=Array.prototype.slice.call(document.querySelectorAll(l));ao=Math.max(al.indexOf(an),0); -if(ap){am=Math.max(Array.prototype.slice.call(ak.parentNode.children).indexOf(ak),0);}}return{h:ao,v:am};},getPreviousSlide:function(){return y;},getCurrentSlide:function(){return G; -},getQueryHash:function(){var ak={};location.search.replace(/[A-Z0-9]+?=(\w*)/gi,function(al){ak[al.split("=").shift()]=al.split("=").pop();});return ak; -},addEventListener:function(al,am,ak){if("addEventListener" in window){(f.wrapper||document.querySelector(".reveal")).addEventListener(al,am,ak);}},removeEventListener:function(al,am,ak){if("addEventListener" in window){(f.wrapper||document.querySelector(".reveal")).removeEventListener(al,am,ak); +if(ak){e=(ak.querySelectorAll("section").length+1)||0;m--;a();}}}}function x(){if(v()===false){g().down?F():j();}O();}function ah(al){if(document.querySelector(":focus")!==null||al.shiftKey||al.altKey||al.ctrlKey||al.metaKey){return; +}var ak=true;switch(al.keyCode){case 80:case 33:Z();break;case 78:case 34:x();break;case 72:case 37:B();break;case 76:case 39:j();break;case 75:case 38:u(); +break;case 74:case 40:F();break;case 36:a(0);break;case 35:a(Number.MAX_VALUE);break;case 32:L()?ae():x();break;case 13:L()?ae():ak=false;break;case 66:case 190:aa(); +break;case 70:ab();break;default:ak=false;}if(ak){al.preventDefault();}else{if(al.keyCode===27&&T){X();al.preventDefault();}}O();}function A(ak){ac.startX=ak.touches[0].clientX; +ac.startY=ak.touches[0].clientY;ac.startCount=ak.touches.length;if(ak.touches.length===2&&R.overview){ac.startSpan=S({x:ak.touches[1].clientX,y:ak.touches[1].clientY},{x:ac.startX,y:ac.startY}); +}}function af(ap){if(!ac.handled){var an=ap.touches[0].clientX;var am=ap.touches[0].clientY;if(ap.touches.length===2&&ac.startCount===2&&R.overview){var ao=S({x:ap.touches[1].clientX,y:ap.touches[1].clientY},{x:ac.startX,y:ac.startY}); +if(Math.abs(ac.startSpan-ao)>ac.threshold){ac.handled=true;if(aoac.threshold&&Math.abs(al)>Math.abs(ak)){ac.handled=true;B();}else{if(al<-ac.threshold&&Math.abs(al)>Math.abs(ak)){ac.handled=true;j();}else{if(ak>ac.threshold){ac.handled=true; +u();}else{if(ak<-ac.threshold){ac.handled=true;F();}}}}ap.preventDefault();}}}else{if(navigator.userAgent.match(/android/gi)){ap.preventDefault();}}}function W(ak){ac.handled=false; +}function o(ak){clearTimeout(z);z=setTimeout(function(){var al=ak.detail||-ak.wheelDelta;if(al>0){x();}else{Z();}},100);}function w(ak){J();}function C(ak){if(L()){ak.preventDefault(); +ae();m=this.getAttribute("data-index-h");e=this.getAttribute("data-index-v");a();}}return{initialize:i,slide:a,left:B,right:j,up:u,down:F,prev:Z,next:x,navigateTo:a,navigateLeft:B,navigateRight:j,navigateUp:u,navigateDown:F,navigatePrev:Z,navigateNext:x,toggleOverview:X,addEventListeners:E,removeEventListeners:U,getIndices:M,getPreviousSlide:function(){return y; +},getCurrentSlide:function(){return G;},getQueryHash:function(){var ak={};location.search.replace(/[A-Z0-9]+?=(\w*)/gi,function(al){ak[al.split("=").shift()]=al.split("=").pop(); +});return ak;},addEventListener:function(al,am,ak){if("addEventListener" in window){(f.wrapper||document.querySelector(".reveal")).addEventListener(al,am,ak); +}},removeEventListener:function(al,am,ak){if("addEventListener" in window){(f.wrapper||document.querySelector(".reveal")).removeEventListener(al,am,ak); }}};})(); \ No newline at end of file diff --git a/plugin/speakernotes/notes.html b/plugin/speakernotes/notes.html index 1106233..13f043d 100644 --- a/plugin/speakernotes/notes.html +++ b/plugin/speakernotes/notes.html @@ -119,8 +119,8 @@ notes.innerHTML = data.notes; } - currentSlide.contentWindow.Reveal.navigateTo(data.indexh, data.indexv); - nextSlide.contentWindow.Reveal.navigateTo(data.nextindexh, data.nextindexv); + currentSlide.contentWindow.Reveal.slide(data.indexh, data.indexv); + nextSlide.contentWindow.Reveal.slide(data.nextindexh, data.nextindexv); }); -- cgit v1.2.3 From f70dcd3c9f26c09169d8f58443898661d9fea179 Mon Sep 17 00:00:00 2001 From: Eric J. Duran Date: Tue, 16 Oct 2012 17:48:34 -0400 Subject: Adding images directory to staticDir so we can search images --- images/readme.md | 1 + plugin/speakernotes/index.js | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) create mode 100644 images/readme.md (limited to 'plugin') diff --git a/images/readme.md b/images/readme.md new file mode 100644 index 0000000..c3df390 --- /dev/null +++ b/images/readme.md @@ -0,0 +1 @@ +Images directory diff --git a/plugin/speakernotes/index.js b/plugin/speakernotes/index.js index e8c8023..17314f3 100644 --- a/plugin/speakernotes/index.js +++ b/plugin/speakernotes/index.js @@ -21,7 +21,7 @@ io.sockets.on('connection', function(socket) { }); app.configure(function() { - [ 'css', 'js', 'plugin', 'lib' ].forEach(function(dir) { + [ 'css', 'js', 'images', 'plugin', 'lib' ].forEach(function(dir) { app.use('/' + dir, staticDir(opts.baseDir + dir)); }); }); @@ -43,8 +43,8 @@ app.get("/notes/:socketId", function(req, res) { // Actually listen app.listen(opts.port || null); -var brown = '\033[33m', - green = '\033[32m', +var brown = '\033[33m', + green = '\033[32m', reset = '\033[0m'; var slidesLocation = "http://localhost" + ( opts.port ? ( ':' + opts.port ) : '' ); -- cgit v1.2.3 From 070a1e3ee5bbe44b6f3cdadedb031f3eee433ac6 Mon Sep 17 00:00:00 2001 From: Eric J. Duran Date: Wed, 17 Oct 2012 17:46:43 -0400 Subject: Replacing speakernotes plugin with a simple postMessage system --- index.html | 31 +++++++++- notes.html | 121 ++++++++++++++++++++++++++++++++++++++ plugin/speakernotes/client.js | 38 ------------ plugin/speakernotes/index.js | 55 ------------------ plugin/speakernotes/notes.html | 128 ----------------------------------------- 5 files changed, 151 insertions(+), 222 deletions(-) create mode 100644 notes.html delete mode 100644 plugin/speakernotes/client.js delete mode 100644 plugin/speakernotes/index.js delete mode 100644 plugin/speakernotes/notes.html (limited to 'plugin') diff --git a/index.html b/index.html index 3ea2412..43d8b38 100644 --- a/index.html +++ b/index.html @@ -350,7 +350,36 @@ function linkify( selector ) { { src: 'plugin/speakernotes/client.js', async: true, condition: function() { return window.location.host === 'localhost:1947'; } } ] }); - + + // Set up simple postMessage notes system. + var url = window.location.href; + if(url.indexOf('?' + 'notes' + '=') !== 'true') { + var notesPopup = window.open('notes.html'); + Reveal.addEventListener('slidechanged', function(event) { + var nextindexh; + var nextindexv; + var slideElement = event.currentSlide; + + if (slideElement.nextElementSibling && slideElement.parentNode.nodeName == 'SECTION') { + nextindexh = event.indexh; + nextindexv = event.indexv + 1; + } else { + nextindexh = event.indexh + 1; + nextindexv = 0; + } + + var notes = slideElement.querySelector('aside.notes'); + var slideData = { + notes : notes ? notes.innerHTML : '', + indexh : event.indexh, + indexv : event.indexv, + nextindexh : nextindexh, + nextindexv : nextindexv, + markdown : notes ? typeof notes.getAttribute('data-markdown') === 'string' : false + }; + notesPopup.postMessage(JSON.stringify(slideData), '*'); + }); + } diff --git a/notes.html b/notes.html new file mode 100644 index 0000000..4dbc986 --- /dev/null +++ b/notes.html @@ -0,0 +1,121 @@ + + + + + + reveal.js - Slide Notes + + + + + + +
+ +
+ +
+ + UPCOMING: +
+
+ + + + + diff --git a/plugin/speakernotes/client.js b/plugin/speakernotes/client.js deleted file mode 100644 index ad1bd46..0000000 --- a/plugin/speakernotes/client.js +++ /dev/null @@ -1,38 +0,0 @@ -(function() { - // don't emit events from inside the previews themselves - if ( window.location.search.match( /receiver/gi ) ) { return; } - - var socket = io.connect(window.location.origin); - var socketId = Math.random().toString().slice(2); - - console.log('View slide notes at ' + window.location.origin + '/notes/' + socketId); - window.open(window.location.origin + '/notes/' + socketId, 'notes-' + socketId) - - Reveal.addEventListener( 'slidechanged', function( event ) { - var nextindexh; - var nextindexv; - var slideElement = event.currentSlide; - - if (slideElement.nextElementSibling && slideElement.parentNode.nodeName == 'SECTION') { - nextindexh = event.indexh; - nextindexv = event.indexv + 1; - } else { - nextindexh = event.indexh + 1; - nextindexv = 0; - } - - var notes = slideElement.querySelector('aside.notes'); - var slideData = { - notes : notes ? notes.innerHTML : '', - indexh : event.indexh, - indexv : event.indexv, - nextindexh : nextindexh, - nextindexv : nextindexv, - socketId : socketId, - markdown : notes ? typeof notes.getAttribute('data-markdown') === 'string' : false - - }; - - socket.emit('slidechanged', slideData); - } ); -}()); diff --git a/plugin/speakernotes/index.js b/plugin/speakernotes/index.js deleted file mode 100644 index e8c8023..0000000 --- a/plugin/speakernotes/index.js +++ /dev/null @@ -1,55 +0,0 @@ -var express = require('express'); -var fs = require('fs'); -var io = require('socket.io'); -var _ = require('underscore'); -var Mustache = require('mustache'); - -var app = express.createServer(); -var staticDir = express.static; - -io = io.listen(app); - -var opts = { - port : 1947, - baseDir : __dirname + '/../../' -}; - -io.sockets.on('connection', function(socket) { - socket.on('slidechanged', function(slideData) { - socket.broadcast.emit('slidedata', slideData); - }); -}); - -app.configure(function() { - [ 'css', 'js', 'plugin', 'lib' ].forEach(function(dir) { - app.use('/' + dir, staticDir(opts.baseDir + dir)); - }); -}); - -app.get("/", function(req, res) { - fs.createReadStream(opts.baseDir + '/index.html').pipe(res); -}); - -app.get("/notes/:socketId", function(req, res) { - - fs.readFile(opts.baseDir + 'plugin/speakernotes/notes.html', function(err, data) { - res.send(Mustache.to_html(data.toString(), { - socketId : req.params.socketId - })); - }); - // fs.createReadStream(opts.baseDir + 'speakernotes/notes.html').pipe(res); -}); - -// Actually listen -app.listen(opts.port || null); - -var brown = '\033[33m', - green = '\033[32m', - reset = '\033[0m'; - -var slidesLocation = "http://localhost" + ( opts.port ? ( ':' + opts.port ) : '' ); - -console.log( brown + "reveal.js - Speaker Notes" + reset ); -console.log( "1. Open the slides at " + green + slidesLocation + reset ); -console.log( "2. Click on the link your JS console to go to the notes page" ); -console.log( "3. Advance through your slides and your notes will advance automatically" ); diff --git a/plugin/speakernotes/notes.html b/plugin/speakernotes/notes.html deleted file mode 100644 index 13f043d..0000000 --- a/plugin/speakernotes/notes.html +++ /dev/null @@ -1,128 +0,0 @@ - - - - - - reveal.js - Slide Notes - - - - - - -
- -
- -
- - UPCOMING: -
-
- - - - - - - - -- cgit v1.2.3 From cbdbfc07f49d883ffcd432eac53303933deafe42 Mon Sep 17 00:00:00 2001 From: Michael Kühnel Date: Thu, 18 Oct 2012 23:55:06 +0200 Subject: Fix indentation --- plugin/speakernotes/notes.html | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'plugin') diff --git a/plugin/speakernotes/notes.html b/plugin/speakernotes/notes.html index 13f043d..c051879 100644 --- a/plugin/speakernotes/notes.html +++ b/plugin/speakernotes/notes.html @@ -112,12 +112,12 @@ // ignore data from sockets that aren't ours if (data.socketId !== socketId) { return; } - if (data.markdown) { - notes.innerHTML = (new Showdown.converter()).makeHtml(data.notes); - } - else { - notes.innerHTML = data.notes; - } + if (data.markdown) { + notes.innerHTML = (new Showdown.converter()).makeHtml(data.notes); + } + else { + notes.innerHTML = data.notes; + } currentSlide.contentWindow.Reveal.slide(data.indexh, data.indexv); nextSlide.contentWindow.Reveal.slide(data.nextindexh, data.nextindexv); -- cgit v1.2.3 From 409c0dfbcc889017813a526b21ffd0a42aa5e804 Mon Sep 17 00:00:00 2001 From: Michael Kühnel Date: Thu, 18 Oct 2012 23:56:51 +0200 Subject: Add missing semicolon --- plugin/speakernotes/client.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'plugin') diff --git a/plugin/speakernotes/client.js b/plugin/speakernotes/client.js index ad1bd46..43dc126 100644 --- a/plugin/speakernotes/client.js +++ b/plugin/speakernotes/client.js @@ -6,7 +6,7 @@ var socketId = Math.random().toString().slice(2); console.log('View slide notes at ' + window.location.origin + '/notes/' + socketId); - window.open(window.location.origin + '/notes/' + socketId, 'notes-' + socketId) + window.open(window.location.origin + '/notes/' + socketId, 'notes-' + socketId); Reveal.addEventListener( 'slidechanged', function( event ) { var nextindexh; -- cgit v1.2.3 From 46e270e59f9aae7a3528fcd3f9d2287f341c0be7 Mon Sep 17 00:00:00 2001 From: Michael Kühnel Date: Thu, 18 Oct 2012 23:59:43 +0200 Subject: Broadcast fragmentdata --- plugin/speakernotes/index.js | 3 +++ 1 file changed, 3 insertions(+) (limited to 'plugin') diff --git a/plugin/speakernotes/index.js b/plugin/speakernotes/index.js index 17314f3..7387f5d 100644 --- a/plugin/speakernotes/index.js +++ b/plugin/speakernotes/index.js @@ -18,6 +18,9 @@ io.sockets.on('connection', function(socket) { socket.on('slidechanged', function(slideData) { socket.broadcast.emit('slidedata', slideData); }); + socket.on('fragmentchanged', function(fragmentData) { + socket.broadcast.emit('fragmentdata', fragmentData); + }); }); app.configure(function() { -- cgit v1.2.3 From c46486b3df7db25912bc085c7d84612b0724a7cc Mon Sep 17 00:00:00 2001 From: Michael Kühnel Date: Fri, 19 Oct 2012 00:04:40 +0200 Subject: Add event listener 'fragmentshown' and 'fragmenthidden' And emit 'fragmentchanged' with the appropriate fragmentData to show or hide fragments. --- plugin/speakernotes/client.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'plugin') diff --git a/plugin/speakernotes/client.js b/plugin/speakernotes/client.js index 43dc126..757e6cd 100644 --- a/plugin/speakernotes/client.js +++ b/plugin/speakernotes/client.js @@ -8,6 +8,25 @@ console.log('View slide notes at ' + window.location.origin + '/notes/' + socketId); window.open(window.location.origin + '/notes/' + socketId, 'notes-' + socketId); + // Fires when a fragment is shown + Reveal.addEventListener( 'fragmentshown', function( event ) { + var fragmentData = { + showFragment : true, + socketId : socketId + }; + socket.emit('fragmentchanged', fragmentData); + } ); + + // Fires when a fragment is hidden + Reveal.addEventListener( 'fragmenthidden', function( event ) { + var fragmentData = { + hideFragment : true, + socketId : socketId + }; + socket.emit('fragmentchanged', fragmentData); + } ); + + // Fires when slide is changed Reveal.addEventListener( 'slidechanged', function( event ) { var nextindexh; var nextindexv; -- cgit v1.2.3 From d02e64adbd986d44dd02a70aec54aac606cdf7ab Mon Sep 17 00:00:00 2001 From: Michael Kühnel Date: Fri, 19 Oct 2012 00:07:26 +0200 Subject: get 'fragmentdata' and react by showing/hiding the corresponding fragments --- plugin/speakernotes/notes.html | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'plugin') diff --git a/plugin/speakernotes/notes.html b/plugin/speakernotes/notes.html index c051879..af42480 100644 --- a/plugin/speakernotes/notes.html +++ b/plugin/speakernotes/notes.html @@ -110,6 +110,7 @@ socket.on('slidedata', function(data) { // ignore data from sockets that aren't ours + console.dir(data); if (data.socketId !== socketId) { return; } if (data.markdown) { @@ -122,6 +123,18 @@ currentSlide.contentWindow.Reveal.slide(data.indexh, data.indexv); nextSlide.contentWindow.Reveal.slide(data.nextindexh, data.nextindexv); }); + socket.on('fragmentdata', function(data) { + // ignore data from sockets that aren't ours + console.dir(data); + if (data.socketId !== socketId) { return; } + + if (data.showFragment === true) { + currentSlide.contentWindow.Reveal.nextFragment(); + } + else if (data.hideFragment === true) { + currentSlide.contentWindow.Reveal.previousFragment(); + } + }); -- cgit v1.2.3 From 82bd8e4fb07c789d54aca58198963e977ffbd589 Mon Sep 17 00:00:00 2001 From: Michael Kühnel Date: Fri, 19 Oct 2012 00:12:53 +0200 Subject: Renaming key within fragmentData Might be better to use one variable with different values. --- plugin/speakernotes/client.js | 4 ++-- plugin/speakernotes/notes.html | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'plugin') diff --git a/plugin/speakernotes/client.js b/plugin/speakernotes/client.js index 757e6cd..156cb9a 100644 --- a/plugin/speakernotes/client.js +++ b/plugin/speakernotes/client.js @@ -11,7 +11,7 @@ // Fires when a fragment is shown Reveal.addEventListener( 'fragmentshown', function( event ) { var fragmentData = { - showFragment : true, + fragment : 'next', socketId : socketId }; socket.emit('fragmentchanged', fragmentData); @@ -20,7 +20,7 @@ // Fires when a fragment is hidden Reveal.addEventListener( 'fragmenthidden', function( event ) { var fragmentData = { - hideFragment : true, + fragment : 'previous', socketId : socketId }; socket.emit('fragmentchanged', fragmentData); diff --git a/plugin/speakernotes/notes.html b/plugin/speakernotes/notes.html index af42480..f3b610d 100644 --- a/plugin/speakernotes/notes.html +++ b/plugin/speakernotes/notes.html @@ -128,10 +128,10 @@ console.dir(data); if (data.socketId !== socketId) { return; } - if (data.showFragment === true) { + if (data.fragment === 'next') { currentSlide.contentWindow.Reveal.nextFragment(); } - else if (data.hideFragment === true) { + else if (data.fragment === 'previous') { currentSlide.contentWindow.Reveal.previousFragment(); } }); -- cgit v1.2.3 From c39f5fc0b0ba4f32854b5e58c71beda6fb295270 Mon Sep 17 00:00:00 2001 From: Michael Kühnel Date: Fri, 19 Oct 2012 00:14:46 +0200 Subject: Oops. Delete console output. --- plugin/speakernotes/notes.html | 2 -- 1 file changed, 2 deletions(-) (limited to 'plugin') diff --git a/plugin/speakernotes/notes.html b/plugin/speakernotes/notes.html index f3b610d..9198386 100644 --- a/plugin/speakernotes/notes.html +++ b/plugin/speakernotes/notes.html @@ -110,7 +110,6 @@ socket.on('slidedata', function(data) { // ignore data from sockets that aren't ours - console.dir(data); if (data.socketId !== socketId) { return; } if (data.markdown) { @@ -125,7 +124,6 @@ }); socket.on('fragmentdata', function(data) { // ignore data from sockets that aren't ours - console.dir(data); if (data.socketId !== socketId) { return; } if (data.fragment === 'next') { -- cgit v1.2.3 From ff8ccbb02e4375c1601028db322fae4934342955 Mon Sep 17 00:00:00 2001 From: Michael Kühnel Date: Fri, 19 Oct 2012 00:35:23 +0200 Subject: Update renamed API method See b957d0b8580bafb35fbb808ef1d7acf424f73895 --- plugin/speakernotes/notes.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'plugin') diff --git a/plugin/speakernotes/notes.html b/plugin/speakernotes/notes.html index 9198386..d71d7f8 100644 --- a/plugin/speakernotes/notes.html +++ b/plugin/speakernotes/notes.html @@ -130,7 +130,7 @@ currentSlide.contentWindow.Reveal.nextFragment(); } else if (data.fragment === 'previous') { - currentSlide.contentWindow.Reveal.previousFragment(); + currentSlide.contentWindow.Reveal.prevFragment(); } }); -- cgit v1.2.3 From 8bdeb360ce55fa13efcf2529ba42e38bb7d790d1 Mon Sep 17 00:00:00 2001 From: Hakim El Hattab Date: Sat, 20 Oct 2012 21:05:14 -0400 Subject: clean up trailing whitespace (closes #197) --- js/reveal.js | 224 +++++++++++++++++++++++++------------------------- js/reveal.min.js | 2 +- plugin/notes/notes.js | 4 +- 3 files changed, 115 insertions(+), 115 deletions(-) (limited to 'plugin') diff --git a/js/reveal.js b/js/reveal.js index 14e4fd7..0ae2ad1 100644 --- a/js/reveal.js +++ b/js/reveal.js @@ -2,17 +2,17 @@ * reveal.js 2.1 r35 * http://lab.hakim.se/reveal-js * MIT licensed - * + * * Copyright (C) 2011-2012 Hakim El Hattab, http://hakim.se */ var Reveal = (function(){ 'use strict'; - + var HORIZONTAL_SLIDES_SELECTOR = '.reveal .slides>section', VERTICAL_SLIDES_SELECTOR = '.reveal .slides>section.present>section', - // Configurations defaults, can be overridden at initialization time + // Configurations defaults, can be overridden at initialization time config = { // Display controls in the bottom right corner controls: true, @@ -32,7 +32,7 @@ var Reveal = (function(){ // Loop the presentation loop: false, - // Number of milliseconds between automatically proceeding to the + // Number of milliseconds between automatically proceeding to the // next slide, disabled when set to 0, this value can be overwritten // by using a data-autoslide attribute on your slides autoSlide: 0, @@ -44,7 +44,7 @@ var Reveal = (function(){ rollingLinks: true, // Transition style (see /css/theme) - theme: null, + theme: null, // Transition style transition: 'default', // default/cube/page/concave/zoom/linear/none @@ -65,8 +65,8 @@ var Reveal = (function(){ previousSlide, currentSlide, - // Slides may hold a data-state attribute which we pick up and apply - // as a class to the body. This list contains the combined state of + // Slides may hold a data-state attribute which we pick up and apply + // as a class to the body. This list contains the combined state of // all current slides. state = [], @@ -79,13 +79,13 @@ var Reveal = (function(){ 'msPerspective' in document.body.style || 'OPerspective' in document.body.style || 'perspective' in document.body.style, - + supports2DTransforms = 'WebkitTransform' in document.body.style || 'MozTransform' in document.body.style || 'msTransform' in document.body.style || 'OTransform' in document.body.style || 'transform' in document.body.style, - + // Throttles mouse wheel navigation mouseWheelTimeout = 0, @@ -104,7 +104,7 @@ var Reveal = (function(){ handled: false, threshold: 80 }; - + /** * Starts up the presentation if the client is capable. */ @@ -112,7 +112,7 @@ var Reveal = (function(){ if( ( !supports2DTransforms && !supports3DTransforms ) ) { document.body.setAttribute( 'class', 'no-transforms' ); - // If the browser doesn't support core features we won't be + // If the browser doesn't support core features we won't be // using JavaScript to control the presentation return; } @@ -125,12 +125,12 @@ var Reveal = (function(){ // Loads the dependencies and continues to #start() once done load(); - + } /** - * Finds and stores references to DOM elements which are - * required by the presentation. If a required element is + * Finds and stores references to DOM elements which are + * required by the presentation. If a required element is * not found, it is created. */ function setupDOM() { @@ -200,10 +200,10 @@ var Reveal = (function(){ } /** - * Loads the dependencies of reveal.js. Dependencies are - * defined via the configuration option 'dependencies' - * and will be loaded prior to starting/binding reveal.js. - * Some dependencies may have an 'async' flag, if so they + * Loads the dependencies of reveal.js. Dependencies are + * defined via the configuration option 'dependencies' + * and will be loaded prior to starting/binding reveal.js. + * Some dependencies may have an 'async' flag, if so they * will load after reveal.js has been started up. */ function load() { @@ -233,7 +233,7 @@ var Reveal = (function(){ function proceed() { // Load asynchronous scripts head.js.apply( null, scriptsAsync ); - + start(); } @@ -249,13 +249,13 @@ var Reveal = (function(){ } /** - * Starts up reveal.js by binding input events and navigating + * Starts up reveal.js by binding input events and navigating * to the current URL deeplink if there is one. */ function start() { // Make sure we've got all the DOM elements we need setupDOM(); - + // Subscribe to input addEventListeners(); @@ -340,7 +340,7 @@ var Reveal = (function(){ dom.controlsLeft.addEventListener( 'click', preventAndForward( navigateLeft ), false ); dom.controlsRight.addEventListener( 'click', preventAndForward( navigateRight ), false ); dom.controlsUp.addEventListener( 'click', preventAndForward( navigateUp ), false ); - dom.controlsDown.addEventListener( 'click', preventAndForward( navigateDown ), false ); + dom.controlsDown.addEventListener( 'click', preventAndForward( navigateDown ), false ); } } @@ -357,7 +357,7 @@ var Reveal = (function(){ if ( config.progress && dom.progress ) { dom.progress.removeEventListener( 'click', preventAndForward( onProgressClick ), false ); } - + if ( config.controls && dom.controls ) { dom.controlsLeft.removeEventListener( 'click', preventAndForward( navigateLeft ), false ); dom.controlsRight.removeEventListener( 'click', preventAndForward( navigateRight ), false ); @@ -367,7 +367,7 @@ var Reveal = (function(){ } /** - * Extend object a with the properties of object b. + * Extend object a with the properties of object b. * If there's a conflict, object b takes precedence. */ function extend( a, b ) { @@ -378,8 +378,8 @@ var Reveal = (function(){ /** * Measures the distance in pixels between point a - * and point b. - * + * and point b. + * * @param {Object} a point with x/y properties * @param {Object} b point with x/y properties */ @@ -391,10 +391,10 @@ var Reveal = (function(){ } /** - * Prevents an events defaults behavior calls the + * Prevents an events defaults behavior calls the * specified delegate. - * - * @param {Function} delegate The method to call + * + * @param {Function} delegate The method to call * after the wrapper has been executed */ function preventAndForward( delegate ) { @@ -405,7 +405,7 @@ var Reveal = (function(){ } /** - * Causes the address bar to hide on mobile devices, + * Causes the address bar to hide on mobile devices, * more vertical space ftw. */ function removeAddressBar() { @@ -415,7 +415,7 @@ var Reveal = (function(){ } /** - * Dispatches an event of the specified type from the + * Dispatches an event of the specified type from the * reveal DOM element. */ function dispatchEvent( type, properties ) { @@ -434,7 +434,7 @@ var Reveal = (function(){ for( var i = 0, len = nodes.length; i < len; i++ ) { var node = nodes[i]; - + if( node.textContent && !node.querySelector( 'img' ) && ( !node.className || !node.classList.contains( node, 'roll' ) ) ) { node.classList.add( 'roll' ); node.innerHTML = '' + node.innerHTML + ''; @@ -444,17 +444,17 @@ var Reveal = (function(){ } /** - * Displays the overview of slides (quick nav) by + * Displays the overview of slides (quick nav) by * scaling down and arranging all slide elements. - * - * Experimental feature, might be dropped if perf + * + * Experimental feature, might be dropped if perf * can't be improved. */ function activateOverview() { // Only proceed if enabled in config if( config.overview ) { - + dom.wrapper.classList.add( 'overview' ); var horizontalSlides = document.querySelectorAll( HORIZONTAL_SLIDES_SELECTOR ); @@ -462,7 +462,7 @@ var Reveal = (function(){ for( var i = 0, len1 = horizontalSlides.length; i < len1; i++ ) { var hslide = horizontalSlides[i], htransform = 'translateZ(-2500px) translate(' + ( ( i - indexh ) * 105 ) + '%, 0%)'; - + hslide.setAttribute( 'data-index-h', i ); hslide.style.display = 'block'; hslide.style.WebkitTransform = htransform; @@ -470,12 +470,12 @@ var Reveal = (function(){ hslide.style.msTransform = htransform; hslide.style.OTransform = htransform; hslide.style.transform = htransform; - + if( !hslide.classList.contains( 'stack' ) ) { // Navigate to this slide on click hslide.addEventListener( 'click', onOverviewSlideClicked, true ); } - + var verticalSlides = hslide.querySelectorAll( 'section' ); for( var j = 0, len2 = verticalSlides.length; j < len2; j++ ) { @@ -494,19 +494,19 @@ var Reveal = (function(){ // Navigate to this slide on click vslide.addEventListener( 'click', onOverviewSlideClicked, true ); } - + } } } - + /** * Exits the slide overview and enters the currently * active slide. */ function deactivateOverview() { - + // Only proceed if enabled in config if( config.overview ) { @@ -529,15 +529,15 @@ var Reveal = (function(){ } slide(); - + } } /** * Toggles the slide overview mode on and off. * - * @param {Boolean} override Optional flag which overrides the - * toggle logic and forcibly sets the desired state. True means + * @param {Boolean} override Optional flag which overrides the + * toggle logic and forcibly sets the desired state. True means * overview is open, false means it's closed. */ function toggleOverview( override ) { @@ -551,7 +551,7 @@ var Reveal = (function(){ /** * Checks if the overview is currently active. - * + * * @return {Boolean} true if the overview is active, * false otherwise */ @@ -561,26 +561,26 @@ var Reveal = (function(){ /** * Handling the fullscreen functionality via the fullscreen API - * - * @see http://fullscreen.spec.whatwg.org/ - * @see https://developer.mozilla.org/en-US/docs/DOM/Using_fullscreen_mode + * + * @see http://fullscreen.spec.whatwg.org/ + * @see https://developer.mozilla.org/en-US/docs/DOM/Using_fullscreen_mode */ function enterFullscreen() { var element = document.body; - + // Check which implementation is available var requestMethod = element.requestFullScreen || element.webkitRequestFullScreen || element.mozRequestFullScreen || element.msRequestFullScreen; - + if( requestMethod ) { requestMethod.apply( element ); } } /** - * Enters the paused mode which fades everything on screen to + * Enters the paused mode which fades everything on screen to * black. */ function pause() { @@ -612,11 +612,11 @@ var Reveal = (function(){ function isPaused() { return dom.wrapper.classList.contains( 'paused' ); } - + /** - * Steps from the current point in the presentation to the - * slide which matches the specified horizontal and vertical - * indices. + * Steps from the current point in the presentation to the + * slide which matches the specified horizontal and vertical + * indices. * * @param {int} h Horizontal index of the target slide * @param {int} v Vertical index of the target slide @@ -640,7 +640,7 @@ var Reveal = (function(){ // Apply the new state stateLoop: for( var i = 0, len = state.length; i < len; i++ ) { - // Check if this state existed on the previous slide. If it + // Check if this state existed on the previous slide. If it // did, we will avoid adding it repeatedly. for( var j = 0; j < stateBefore.length; j++ ) { if( stateBefore[j] === state[i] ) { @@ -671,7 +671,7 @@ var Reveal = (function(){ } updateControls(); - + // Update the URL hash after a delay since updating it mid-transition // is likely to cause visual lag clearTimeout( writeURLTimeout ); @@ -691,7 +691,7 @@ var Reveal = (function(){ // Dispatch an event if the slide changed if( indexh !== indexhBefore || indexv !== indexvBefore ) { dispatchEvent( 'slidechanged', { - 'indexh': indexh, + 'indexh': indexh, 'indexv': indexv, 'previousSlide': previousSlide, 'currentSlide': currentSlide @@ -702,8 +702,8 @@ var Reveal = (function(){ previousSlide = null; } - // Solves an edge case where the previous slide maintains the - // 'present' class when navigating between adjacent vertical + // Solves an edge case where the previous slide maintains the + // 'present' class when navigating between adjacent vertical // stacks if( previousSlide ) { previousSlide.classList.remove( 'present' ); @@ -713,14 +713,14 @@ var Reveal = (function(){ /** * Updates one dimension of slides by showing the slide * with the specified index. - * + * * @param {String} selector A CSS selector that will fetch * the group of slides we are working with * @param {Number} index The index of the slide that should be * shown - * + * * @return {Number} The index of the slide that is now shown, - * might differ from the passed in index if it was out of + * might differ from the passed in index if it was out of * bounds. */ function updateSlides( selector, index ) { @@ -728,7 +728,7 @@ var Reveal = (function(){ // an array var slides = Array.prototype.slice.call( document.querySelectorAll( selector ) ), slidesLength = slides.length; - + if( slidesLength ) { // Should the index loop? @@ -739,14 +739,14 @@ var Reveal = (function(){ index = slidesLength + index; } } - + // Enforce max and minimum index bounds index = Math.max( Math.min( index, slidesLength - 1 ), 0 ); - + for( var i = 0; i < slidesLength; i++ ) { var element = slides[i]; - // Optimization; hide all slides that are three or more steps + // Optimization; hide all slides that are three or more steps // away from the present slide if( isOverviewActive() === false ) { // The distance loops so that it measures 1 between the first @@ -785,7 +785,7 @@ var Reveal = (function(){ state = state.concat( slideState.split( ' ' ) ); } - // If this slide has a data-autoslide attribtue associated use this as + // If this slide has a data-autoslide attribtue associated use this as // autoSlide value otherwise use the global configured time var slideAutoSlide = slides[index].getAttribute( 'data-autoslide' ); if( slideAutoSlide ) { @@ -796,13 +796,13 @@ var Reveal = (function(){ } else { - // Since there are no slides we can't be anywhere beyond the + // Since there are no slides we can't be anywhere beyond the // zeroth index index = 0; } - + return index; - + } /** @@ -810,7 +810,7 @@ var Reveal = (function(){ */ function updateControls() { if ( config.controls && dom.controls ) { - + var routes = availableRoutes(); // Remove the 'enabled' class from all directions @@ -829,7 +829,7 @@ var Reveal = (function(){ /** * Determine what available routes there are for navigation. - * + * * @return {Object} containing four booleans: left/right/up/down */ function availableRoutes() { @@ -843,7 +843,7 @@ var Reveal = (function(){ down: indexv < verticalSlides.length - 1 }; } - + /** * Reads the current URL (hash) and navigates accordingly. */ @@ -854,7 +854,7 @@ var Reveal = (function(){ var bits = hash.slice( 2 ).split( '/' ), name = hash.replace( /#|\//gi, '' ); - // If the first bit is invalid and there is a name we can + // If the first bit is invalid and there is a name we can // assume that this is a named link if( isNaN( parseInt( bits[0], 10 ) ) && name.length ) { // Find the slide with the specified name @@ -878,32 +878,32 @@ var Reveal = (function(){ slide( h, v ); } } - + /** * Updates the page URL (hash) to reflect the current - * state. + * state. */ function writeURL() { if( config.history ) { var url = '/'; - + // Only include the minimum possible number of components in // the URL if( indexh > 0 || indexv > 0 ) url += indexh; if( indexv > 0 ) url += '/' + indexv; - + window.location.hash = url; } } /** - * Retrieves the h/v location of the current, or specified, + * Retrieves the h/v location of the current, or specified, * slide. - * - * @param {HTMLElement} slide If specified, the returned - * index will be for this slide rather than the currently + * + * @param {HTMLElement} slide If specified, the returned + * index will be for this slide rather than the currently * active one - * + * * @return {Object} { h: , v: } */ function getIndices( slide ) { @@ -933,7 +933,7 @@ var Reveal = (function(){ /** * Navigate to the next slide fragment. - * + * * @return {Boolean} true if there was a next fragment, * false otherwise */ @@ -966,7 +966,7 @@ var Reveal = (function(){ /** * Navigate to the previous slide fragment. - * + * * @return {Boolean} true if there was a previous fragment, * false otherwise */ @@ -993,7 +993,7 @@ var Reveal = (function(){ return true; } } - + return false; } @@ -1008,7 +1008,7 @@ var Reveal = (function(){ autoSlideTimeout = setTimeout( navigateNext, autoSlide ); } } - + function navigateLeft() { // Prioritize hiding fragments if( isOverviewActive() || previousFragment() === false ) { @@ -1071,7 +1071,7 @@ var Reveal = (function(){ availableRoutes().down ? navigateDown() : navigateRight(); } - // If auto-sliding is enabled we need to cue up + // If auto-sliding is enabled we need to cue up // another timeout cueAutoSlide(); } @@ -1084,11 +1084,11 @@ var Reveal = (function(){ /** * Handler for the document level 'keydown' event. - * + * * @param {Object} event */ function onDocumentKeyDown( event ) { - // Disregard the event if the target is editable or a + // Disregard the event if the target is editable or a // modifier is present if ( document.querySelector( ':focus' ) !== null || event.shiftKey || event.altKey || event.ctrlKey || event.metaKey ) return; @@ -1096,7 +1096,7 @@ var Reveal = (function(){ switch( event.keyCode ) { // p, page up - case 80: case 33: navigatePrev(); break; + case 80: case 33: navigatePrev(); break; // n, page down case 78: case 34: navigateNext(); break; // h, left @@ -1123,18 +1123,18 @@ var Reveal = (function(){ triggered = false; } - // If the input resulted in a triggered action we should prevent + // If the input resulted in a triggered action we should prevent // the browsers default behavior if( triggered ) { event.preventDefault(); } else if ( event.keyCode === 27 && supports3DTransforms ) { toggleOverview(); - + event.preventDefault(); } - // If auto-sliding is enabled we need to cue up + // If auto-sliding is enabled we need to cue up // another timeout cueAutoSlide(); @@ -1149,7 +1149,7 @@ var Reveal = (function(){ touch.startY = event.touches[0].clientY; touch.startCount = event.touches.length; - // If there's two touches we need to memorize the distance + // If there's two touches we need to memorize the distance // between those two points to detect pinching if( event.touches.length === 2 && config.overview ) { touch.startSpan = distanceBetween( { @@ -1161,7 +1161,7 @@ var Reveal = (function(){ } ); } } - + /** * Handler for the document level 'touchmove' event. */ @@ -1171,7 +1171,7 @@ var Reveal = (function(){ var currentX = event.touches[0].clientX; var currentY = event.touches[0].clientY; - // If the touch started off with two points and still has + // If the touch started off with two points and still has // two active touches; test for the pinch gesture if( event.touches.length === 2 && touch.startCount === 2 && config.overview ) { @@ -1184,7 +1184,7 @@ var Reveal = (function(){ y: touch.startY } ); - // If the span is larger than the desire amount we've got + // If the span is larger than the desire amount we've got // ourselves a pinch if( Math.abs( touch.startSpan - currentSpan ) > touch.threshold ) { touch.handled = true; @@ -1209,15 +1209,15 @@ var Reveal = (function(){ if( deltaX > touch.threshold && Math.abs( deltaX ) > Math.abs( deltaY ) ) { touch.handled = true; navigateLeft(); - } + } else if( deltaX < -touch.threshold && Math.abs( deltaX ) > Math.abs( deltaY ) ) { touch.handled = true; navigateRight(); - } + } else if( deltaY > touch.threshold ) { touch.handled = true; navigateUp(); - } + } else if( deltaY < -touch.threshold ) { touch.handled = true; navigateDown(); @@ -1227,7 +1227,7 @@ var Reveal = (function(){ } } - // There's a bug with swiping on some Android devices unless + // There's a bug with swiping on some Android devices unless // the default action is always prevented else if( navigator.userAgent.match( /android/gi ) ) { event.preventDefault(); @@ -1242,7 +1242,7 @@ var Reveal = (function(){ } /** - * Handles mouse wheel scrolling, throttled to avoid skipping + * Handles mouse wheel scrolling, throttled to avoid skipping * multiple slides. */ function onDocumentMouseScroll( event ){ @@ -1260,7 +1260,7 @@ var Reveal = (function(){ } /** - * Clicking on the progress bar results in a navigation to the + * Clicking on the progress bar results in a navigation to the * closest approximate horizontal slide using this equation: * * ( clickX / presentationWidth ) * numberOfSlides @@ -1271,10 +1271,10 @@ var Reveal = (function(){ slide( slideIndex ); } - + /** * Handler for the window level 'hashchange' event. - * + * * @param {Object} event */ function onWindowHashChange( event ) { @@ -1285,7 +1285,7 @@ var Reveal = (function(){ * Invoked when a slide is and we're in the overview. */ function onOverviewSlideClicked( event ) { - // TODO There's a bug here where the event listeners are not + // TODO There's a bug here where the event listeners are not // removed after deactivating the overview. if( isOverviewActive() ) { event.preventDefault(); @@ -1299,7 +1299,7 @@ var Reveal = (function(){ } } - + // --------------------------------------------------------------------// // ------------------------------- API --------------------------------// // --------------------------------------------------------------------// @@ -1307,7 +1307,7 @@ var Reveal = (function(){ return { initialize: initialize, - + // Navigation methods slide: slide, left: navigateLeft, @@ -1369,5 +1369,5 @@ var Reveal = (function(){ } } }; - + })(); \ No newline at end of file diff --git a/js/reveal.min.js b/js/reveal.min.js index b7ffeab..7fb4f9a 100644 --- a/js/reveal.min.js +++ b/js/reveal.min.js @@ -2,7 +2,7 @@ * reveal.js 2.1 r35 * http://lab.hakim.se/reveal-js * MIT licensed - * + * * Copyright (C) 2011-2012 Hakim El Hattab, http://hakim.se */ var Reveal=(function(){var l=".reveal .slides>section",b=".reveal .slides>section.present>section",R={controls:true,progress:true,history:false,keyboard:true,overview:true,loop:false,autoSlide:0,mouseWheel:true,rollingLinks:true,theme:null,transition:"default",dependencies:[]},Y=R.autoSlide,m=0,e=0,y,G,ak=[],f={},T="WebkitPerspective" in document.body.style||"MozPerspective" in document.body.style||"msPerspective" in document.body.style||"OPerspective" in document.body.style||"perspective" in document.body.style,n="WebkitTransform" in document.body.style||"MozTransform" in document.body.style||"msTransform" in document.body.style||"OTransform" in document.body.style||"transform" in document.body.style,z=0,k=0,D=0,ac={startX:0,startY:0,startSpan:0,startCount:0,handled:false,threshold:80}; diff --git a/plugin/notes/notes.js b/plugin/notes/notes.js index 58c26e0..729dad3 100644 --- a/plugin/notes/notes.js +++ b/plugin/notes/notes.js @@ -39,7 +39,7 @@ var RevealNotes = (function() { notesPopup.postMessage( JSON.stringify( slideData ), '*' ); } - // The main presentation is kept in sync when navigating the + // The main presentation is kept in sync when navigating the // note slides so that the popup may be used as a remote window.addEventListener( 'message', function( event ) { var data = JSON.parse( event.data ); @@ -60,7 +60,7 @@ var RevealNotes = (function() { // Open the notes when the 's' key is hit document.addEventListener( 'keydown', function( event ) { - // Disregard the event if the target is editable or a + // Disregard the event if the target is editable or a // modifier is present if ( document.querySelector( ':focus' ) !== null || event.shiftKey || event.altKey || event.ctrlKey || event.metaKey ) return; -- cgit v1.2.3 From 296242f8d3d5f5513d5278e72941ef868c3cb4e5 Mon Sep 17 00:00:00 2001 From: Michael Kühnel Date: Wed, 24 Oct 2012 14:33:16 +0200 Subject: Make the fragments visible in speaker notes --- plugin/notes/notes.html | 23 ++++++++++++----- plugin/notes/notes.js | 67 ++++++++++++++++++++++++++++++++++++------------- 2 files changed, 67 insertions(+), 23 deletions(-) (limited to 'plugin') diff --git a/plugin/notes/notes.html b/plugin/notes/notes.html index 485edec..c69950b 100644 --- a/plugin/notes/notes.html +++ b/plugin/notes/notes.html @@ -109,12 +109,15 @@ window.addEventListener( 'message', function( event ) { var data = JSON.parse( event.data ); - - if( data.markdown ) { - notes.innerHTML = (new Showdown.converter()).makeHtml( data.notes ); - } - else { - notes.innerHTML = data.notes; + console.log(data); + // No need for updating the notes in case of fragement changes + if ( data.notes !== undefined) { + if( data.markdown ) { + notes.innerHTML = (new Showdown.converter()).makeHtml( data.notes ); + } + else { + notes.innerHTML = data.notes; + } } // Kill the slide listeners while responding to the event @@ -124,6 +127,14 @@ currentSlide.contentWindow.Reveal.slide( data.indexh, data.indexv ); nextSlide.contentWindow.Reveal.slide( data.nextindexh, data.nextindexv ); + // Showing and hiding fragments + if (data.fragment === 'next') { + currentSlide.contentWindow.Reveal.nextFragment(); + } + else if (data.fragment === 'prev') { + currentSlide.contentWindow.Reveal.prevFragment(); + } + // Resume listening on the next cycle setTimeout( addSlideListeners, 1 ); diff --git a/plugin/notes/notes.js b/plugin/notes/notes.js index 729dad3..45d13a4 100644 --- a/plugin/notes/notes.js +++ b/plugin/notes/notes.js @@ -7,15 +7,36 @@ var RevealNotes = (function() { function openNotes() { var notesPopup = window.open( 'plugin/notes/notes.html', 'reveal.js - Notes', 'width=1120,height=850' ); - Reveal.addEventListener( 'slidechanged', post ); + // Fires when slide is changed + Reveal.addEventListener( 'slidechanged', function( event ) { + post('slidechanged'); + } ); + + // Fires when a fragment is shown + Reveal.addEventListener( 'fragmentshown', function( event ) { + post('fragmentshown'); + } ); + + // Fires when a fragment is hidden + Reveal.addEventListener( 'fragmenthidden', function( event ) { + post('fragmenthidden'); + } ); - // Posts the current slide data to the notes window - function post() { + /** + * @description Posts the current slide data to the notes window + * + * @param {string} eventType Expecting 'slidechanged', 'fragmentshown' or 'fragmenthidden' + * set in the events above to define the needed slideDate. + */ + function post(eventType) { + console.log(eventType); var slideElement = Reveal.getCurrentSlide(), indexh = Reveal.getIndices().h, indexv = Reveal.getIndices().v, + notes = slideElement.querySelector( 'aside.notes' ), nextindexh, - nextindexv; + nextindexv, + slideData; if( slideElement.nextElementSibling && slideElement.parentNode.nodeName == 'SECTION' ) { nextindexh = indexh; @@ -25,16 +46,26 @@ var RevealNotes = (function() { nextindexv = 0; } - var notes = slideElement.querySelector( 'aside.notes' ); - - var slideData = { - notes : notes ? notes.innerHTML : '', - indexh : indexh, - indexv : indexv, - nextindexh : nextindexh, - nextindexv : nextindexv, - markdown : notes ? typeof notes.getAttribute( 'data-markdown' ) === 'string' : false - }; + if (eventType === 'slidechanged') { + slideData = { + notes : notes ? notes.innerHTML : '', + indexh : indexh, + indexv : indexv, + nextindexh : nextindexh, + nextindexv : nextindexv, + markdown : notes ? typeof notes.getAttribute( 'data-markdown' ) === 'string' : false + }; + } + else if (eventType === 'fragmentshown') { + slideData = { + fragment : 'next' + }; + } + else if (eventType === 'fragmenthidden') { + slideData = { + fragment : 'prev' + }; + } notesPopup.postMessage( JSON.stringify( slideData ), '*' ); } @@ -50,7 +81,9 @@ var RevealNotes = (function() { } ); // Navigate to the current slide when the notes are loaded - notesPopup.addEventListener( 'load', post, false ); + notesPopup.addEventListener( 'load', function( event ) { + post('slidechanged'); + }, false ); } // If the there's a 'notes' query set, open directly @@ -70,5 +103,5 @@ var RevealNotes = (function() { } }, false ); - return { open: openNotes } -})(); \ No newline at end of file + return { open: openNotes }; +})(); -- cgit v1.2.3 From 13e7550afe26b216de6a9f97b3a55b60a2ee4cde Mon Sep 17 00:00:00 2001 From: Michael Kühnel Date: Wed, 24 Oct 2012 14:53:50 +0200 Subject: Delete console output. --- plugin/notes/notes.html | 3 +-- plugin/notes/notes.js | 1 - 2 files changed, 1 insertion(+), 3 deletions(-) (limited to 'plugin') diff --git a/plugin/notes/notes.html b/plugin/notes/notes.html index c69950b..775ccb4 100644 --- a/plugin/notes/notes.html +++ b/plugin/notes/notes.html @@ -109,8 +109,7 @@ window.addEventListener( 'message', function( event ) { var data = JSON.parse( event.data ); - console.log(data); - // No need for updating the notes in case of fragement changes + // No need for updating the notes in case of fragment changes if ( data.notes !== undefined) { if( data.markdown ) { notes.innerHTML = (new Showdown.converter()).makeHtml( data.notes ); diff --git a/plugin/notes/notes.js b/plugin/notes/notes.js index 45d13a4..0573440 100644 --- a/plugin/notes/notes.js +++ b/plugin/notes/notes.js @@ -29,7 +29,6 @@ var RevealNotes = (function() { * set in the events above to define the needed slideDate. */ function post(eventType) { - console.log(eventType); var slideElement = Reveal.getCurrentSlide(), indexh = Reveal.getIndices().h, indexv = Reveal.getIndices().v, -- cgit v1.2.3 From 1801bf67eaf1fac8cb5776fe9ba83cc9e13272d6 Mon Sep 17 00:00:00 2001 From: Michael Kühnel Date: Wed, 24 Oct 2012 15:06:32 +0200 Subject: Delete functionality to control presentation from notes window Its was impossible (at least for me) to keep the windows in sync without bloating the code too much. --- plugin/notes/notes.html | 25 ------------------------- plugin/notes/notes.js | 10 ---------- 2 files changed, 35 deletions(-) (limited to 'plugin') diff --git a/plugin/notes/notes.html b/plugin/notes/notes.html index 775ccb4..90083cf 100644 --- a/plugin/notes/notes.html +++ b/plugin/notes/notes.html @@ -119,9 +119,6 @@ } } - // Kill the slide listeners while responding to the event - removeSlideListeners(); - // Update the note slides currentSlide.contentWindow.Reveal.slide( data.indexh, data.indexv ); nextSlide.contentWindow.Reveal.slide( data.nextindexh, data.nextindexv ); @@ -134,30 +131,8 @@ currentSlide.contentWindow.Reveal.prevFragment(); } - // Resume listening on the next cycle - setTimeout( addSlideListeners, 1 ); - }, false ); - function addSlideListeners() { - currentSlide.contentWindow.Reveal.addEventListener( 'slidechanged', onNotesSlideChange, false ); - nextSlide.contentWindow.Reveal.addEventListener( 'slidechanged', onNotesSlideChange, false ); - } - - function removeSlideListeners() { - currentSlide.contentWindow.Reveal.removeEventListener( 'slidechanged', onNotesSlideChange, false ); - nextSlide.contentWindow.Reveal.removeEventListener( 'slidechanged', onNotesSlideChange, false ); - } - - function onNotesSlideChange( event ) { - window.opener.postMessage( JSON.stringify({ - indexh : event.indexh, - indexv : event.indexv - }), '*' ); - } - - addSlideListeners(); - })( window ); }, false ); diff --git a/plugin/notes/notes.js b/plugin/notes/notes.js index 0573440..00d386d 100644 --- a/plugin/notes/notes.js +++ b/plugin/notes/notes.js @@ -69,16 +69,6 @@ var RevealNotes = (function() { notesPopup.postMessage( JSON.stringify( slideData ), '*' ); } - // The main presentation is kept in sync when navigating the - // note slides so that the popup may be used as a remote - window.addEventListener( 'message', function( event ) { - var data = JSON.parse( event.data ); - - if( data && typeof data.indexh === 'number' && typeof data.indexv === 'number' ) { - Reveal.slide( data.indexh, data.indexv ); - } - } ); - // Navigate to the current slide when the notes are loaded notesPopup.addEventListener( 'load', function( event ) { post('slidechanged'); -- cgit v1.2.3 From e693717f2aa2d65f8f0cf6412a01084280fc2c9a Mon Sep 17 00:00:00 2001 From: Hakim El Hattab Date: Sun, 28 Oct 2012 18:09:54 -0400 Subject: update syntax highlight after editing (#210), move markdown and highlight scripts from lib to plugin --- index.html | 7 ++--- lib/js/data-markdown.js | 28 ------------------- lib/js/highlight.js | 5 ---- lib/js/showdown.js | 62 ------------------------------------------- plugin/highlight/highlight.js | 14 ++++++++++ plugin/markdown/markdown.js | 32 ++++++++++++++++++++++ plugin/markdown/showdown.js | 62 +++++++++++++++++++++++++++++++++++++++++++ 7 files changed, 112 insertions(+), 98 deletions(-) delete mode 100644 lib/js/data-markdown.js delete mode 100644 lib/js/highlight.js delete mode 100644 lib/js/showdown.js create mode 100644 plugin/highlight/highlight.js create mode 100644 plugin/markdown/markdown.js create mode 100644 plugin/markdown/showdown.js (limited to 'plugin') diff --git a/index.html b/index.html index 45029b5..89398c1 100644 --- a/index.html +++ b/index.html @@ -356,14 +356,15 @@ function linkify( selector ) { // Optional libraries used to extend on reveal.js dependencies: [ - { src: 'lib/js/highlight.js', async: true, callback: function() { window.hljs.initHighlightingOnLoad(); } }, { src: 'lib/js/classList.js', condition: function() { return !document.body.classList; } }, - { src: 'lib/js/showdown.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } }, - { src: 'lib/js/data-markdown.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } }, + { src: 'plugin/markdown/showdown.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } }, + { src: 'plugin/markdown/markdown.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } }, + { src: 'plugin/highlight/highlight.js', async: true, callback: function() { hljs.initHighlightingOnLoad(); } }, { src: 'plugin/zoom-js/zoom.js', async: true, condition: function() { return !!document.body.classList; } }, { src: 'plugin/notes/notes.js', async: true, condition: function() { return !!document.body.classList; } } ] }); + diff --git a/lib/js/data-markdown.js b/lib/js/data-markdown.js deleted file mode 100644 index 80f8eb0..0000000 --- a/lib/js/data-markdown.js +++ /dev/null @@ -1,28 +0,0 @@ -// From https://gist.github.com/1343518 -// Modified by Hakim to handle Markdown indented with tabs -(function(){ - - var sections = document.querySelectorAll( '[data-markdown]' ); - - for( var i = 0, len = sections.length; i < len; i++ ) { - var section = sections[i]; - - var template = section.querySelector( 'script' ); - - // strip leading whitespace so it isn't evaluated as code - var text = ( template || section ).innerHTML; - - var leadingWs = text.match(/^\n?(\s*)/)[1].length, - leadingTabs = text.match(/^\n?(\t*)/)[1].length; - - if( leadingTabs > 0 ) { - text = text.replace( new RegExp('\\n?\\t{' + leadingTabs + '}','g'), '\n' ); - } - else if( leadingWs > 1 ) { - text = text.replace( new RegExp('\\n? {' + leadingWs + '}','g'), '\n' ); - } - - section.innerHTML = (new Showdown.converter()).makeHtml(text); - } - -})(); \ No newline at end of file diff --git a/lib/js/highlight.js b/lib/js/highlight.js deleted file mode 100644 index cb27067..0000000 --- a/lib/js/highlight.js +++ /dev/null @@ -1,5 +0,0 @@ -/* -Syntax highlighting with language autodetection. -http://softwaremaniacs.org/soft/highlight/ -*/ -var hljs=new function(){function m(p){return p.replace(/"}while(y.length||z.length){var v=u().splice(0,1)[0];w+=m(x.substr(r,v.offset-r));r=v.offset;if(v.event=="start"){w+=s(v.node);t.push(v.node)}else{if(v.event=="stop"){var q=t.length;do{q--;var p=t[q];w+=("")}while(p!=v.node);t.splice(q,1);while(q'+m(L[0])+""}else{N+=m(L[0])}P=O.lR.lastIndex;L=O.lR.exec(M)}N+=m(M.substr(P,M.length-P));return N}function K(r,M){if(M.sL&&d[M.sL]){var L=e(M.sL,r);t+=L.keyword_count;return L.value}else{return F(r,M)}}function I(M,r){var L=M.cN?'':"";if(M.rB){q+=L;M.buffer=""}else{if(M.eB){q+=m(r)+L;M.buffer=""}else{q+=L;M.buffer=r}}C.push(M);B+=M.r}function E(O,L,Q){var R=C[C.length-1];if(Q){q+=K(R.buffer+O,R);return false}var M=z(L,R);if(M){q+=K(R.buffer+O,R);I(M,L);return M.rB}var r=w(C.length-1,L);if(r){var N=R.cN?"":"";if(R.rE){q+=K(R.buffer+O,R)+N}else{if(R.eE){q+=K(R.buffer+O,R)+N+m(L)}else{q+=K(R.buffer+O+L,R)+N}}while(r>1){N=C[C.length-2].cN?"":"";q+=N;r--;C.length--}var P=C[C.length-1];C.length--;C[C.length-1].buffer="";if(P.starts){I(P.starts,"")}return R.rE}if(x(L,R)){throw"Illegal"}}var H=d[J];var C=[H.dM];var B=0;var t=0;var q="";try{var v=0;H.dM.buffer="";do{var y=s(D,v);var u=E(y[0],y[1],y[2]);v+=y[0].length;if(!u){v+=y[1].length}}while(!y[2]);if(C.length>1){throw"Illegal"}return{r:B,keyword_count:t,value:q}}catch(G){if(G=="Illegal"){return{r:0,keyword_count:0,value:m(D)}}else{throw G}}}function f(t){var r={keyword_count:0,r:0,value:m(t)};var q=r;for(var p in d){if(!d.hasOwnProperty(p)){continue}var s=e(p,t);s.language=p;if(s.keyword_count+s.r>q.keyword_count+q.r){q=s}if(s.keyword_count+s.r>r.keyword_count+r.r){q=r;r=s}}if(q.language){r.second_best=q}return r}function h(r,q,p){if(q){r=r.replace(/^((<[^>]+>|\t)+)/gm,function(t,w,v,u){return w.replace(/\t/g,q)})}if(p){r=r.replace(/\n/g,"
")}return r}function o(u,x,q){var y=g(u,q);var s=a(u);if(s=="no-highlight"){return}if(s){var w=e(s,y)}else{var w=f(y);s=w.language}var p=b(u);if(p.length){var r=document.createElement("pre");r.innerHTML=w.value;w.value=l(p,b(r),y)}w.value=h(w.value,x,q);var t=u.className;if(!t.match("(\\s|^)(language-)?"+s+"(\\s|$)")){t=t?(t+" "+s):s}if(/MSIE [678]/.test(navigator.userAgent)&&u.tagName=="CODE"&&u.parentNode.tagName=="PRE"){var r=u.parentNode;var v=document.createElement("div");v.innerHTML="
"+w.value+"
";u=v.firstChild.firstChild;v.firstChild.cN=r.cN;r.parentNode.replaceChild(v.firstChild,r)}else{u.innerHTML=w.value}u.className=t;u.result={language:s,kw:w.keyword_count,re:w.r};if(w.second_best){u.second_best={language:w.second_best.language,kw:w.second_best.keyword_count,re:w.second_best.r}}}function k(){if(k.called){return}k.called=true;var r=document.getElementsByTagName("pre");for(var p=0;p|>=|>>|>>=|>>>|>>>=|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~";this.BE={b:"\\\\.",r:0};this.ASM={cN:"string",b:"'",e:"'",i:"\\n",c:[this.BE],r:0};this.QSM={cN:"string",b:'"',e:'"',i:"\\n",c:[this.BE],r:0};this.CLCM={cN:"comment",b:"//",e:"$"};this.CBLCLM={cN:"comment",b:"/\\*",e:"\\*/"};this.HCM={cN:"comment",b:"#",e:"$"};this.NM={cN:"number",b:this.NR,r:0};this.CNM={cN:"number",b:this.CNR,r:0};this.inherit=function(p,s){var r={};for(var q in p){r[q]=p[q]}if(s){for(var q in s){r[q]=s[q]}}return r}}();hljs.LANGUAGES.cs={dM:{k:{"abstract":1,as:1,base:1,bool:1,"break":1,"byte":1,"case":1,"catch":1,"char":1,checked:1,"class":1,"const":1,"continue":1,decimal:1,"default":1,delegate:1,"do":1,"do":1,"double":1,"else":1,"enum":1,event:1,explicit:1,extern:1,"false":1,"finally":1,fixed:1,"float":1,"for":1,foreach:1,"goto":1,"if":1,implicit:1,"in":1,"int":1,"interface":1,internal:1,is:1,lock:1,"long":1,namespace:1,"new":1,"null":1,object:1,operator:1,out:1,override:1,params:1,"private":1,"protected":1,"public":1,readonly:1,ref:1,"return":1,sbyte:1,sealed:1,"short":1,sizeof:1,stackalloc:1,"static":1,string:1,struct:1,"switch":1,"this":1,"throw":1,"true":1,"try":1,"typeof":1,uint:1,ulong:1,unchecked:1,unsafe:1,ushort:1,using:1,virtual:1,"volatile":1,"void":1,"while":1,ascending:1,descending:1,from:1,get:1,group:1,into:1,join:1,let:1,orderby:1,partial:1,select:1,set:1,value:1,"var":1,where:1,yield:1},c:[{cN:"comment",b:"///",e:"$",rB:true,c:[{cN:"xmlDocTag",b:"///|"},{cN:"xmlDocTag",b:""}]},hljs.CLCM,hljs.CBLCLM,{cN:"string",b:'@"',e:'"',c:[{b:'""'}]},hljs.ASM,hljs.QSM,hljs.CNM]}};hljs.LANGUAGES.ruby=function(){var g="[a-zA-Z_][a-zA-Z0-9_]*(\\!|\\?)?";var a="[a-zA-Z_]\\w*[!?=]?|[-+~]\\@|<<|>>|=~|===?|<=>|[<>]=?|\\*\\*|[-/+%^&*~`|]|\\[\\]=?";var n={keyword:{and:1,"false":1,then:1,defined:1,module:1,"in":1,"return":1,redo:1,"if":1,BEGIN:1,retry:1,end:1,"for":1,"true":1,self:1,when:1,next:1,until:1,"do":1,begin:1,unless:1,END:1,rescue:1,nil:1,"else":1,"break":1,undef:1,not:1,"super":1,"class":1,"case":1,require:1,yield:1,alias:1,"while":1,ensure:1,elsif:1,or:1,def:1},keymethods:{__id__:1,__send__:1,abort:1,abs:1,"all?":1,allocate:1,ancestors:1,"any?":1,arity:1,assoc:1,at:1,at_exit:1,autoload:1,"autoload?":1,"between?":1,binding:1,binmode:1,"block_given?":1,call:1,callcc:1,caller:1,capitalize:1,"capitalize!":1,casecmp:1,"catch":1,ceil:1,center:1,chomp:1,"chomp!":1,chop:1,"chop!":1,chr:1,"class":1,class_eval:1,"class_variable_defined?":1,class_variables:1,clear:1,clone:1,close:1,close_read:1,close_write:1,"closed?":1,coerce:1,collect:1,"collect!":1,compact:1,"compact!":1,concat:1,"const_defined?":1,const_get:1,const_missing:1,const_set:1,constants:1,count:1,crypt:1,"default":1,default_proc:1,"delete":1,"delete!":1,delete_at:1,delete_if:1,detect:1,display:1,div:1,divmod:1,downcase:1,"downcase!":1,downto:1,dump:1,dup:1,each:1,each_byte:1,each_index:1,each_key:1,each_line:1,each_pair:1,each_value:1,each_with_index:1,"empty?":1,entries:1,eof:1,"eof?":1,"eql?":1,"equal?":1,"eval":1,exec:1,exit:1,"exit!":1,extend:1,fail:1,fcntl:1,fetch:1,fileno:1,fill:1,find:1,find_all:1,first:1,flatten:1,"flatten!":1,floor:1,flush:1,for_fd:1,foreach:1,fork:1,format:1,freeze:1,"frozen?":1,fsync:1,getc:1,gets:1,global_variables:1,grep:1,gsub:1,"gsub!":1,"has_key?":1,"has_value?":1,hash:1,hex:1,id:1,include:1,"include?":1,included_modules:1,index:1,indexes:1,indices:1,induced_from:1,inject:1,insert:1,inspect:1,instance_eval:1,instance_method:1,instance_methods:1,"instance_of?":1,"instance_variable_defined?":1,instance_variable_get:1,instance_variable_set:1,instance_variables:1,"integer?":1,intern:1,invert:1,ioctl:1,"is_a?":1,isatty:1,"iterator?":1,join:1,"key?":1,keys:1,"kind_of?":1,lambda:1,last:1,length:1,lineno:1,ljust:1,load:1,local_variables:1,loop:1,lstrip:1,"lstrip!":1,map:1,"map!":1,match:1,max:1,"member?":1,merge:1,"merge!":1,method:1,"method_defined?":1,method_missing:1,methods:1,min:1,module_eval:1,modulo:1,name:1,nesting:1,"new":1,next:1,"next!":1,"nil?":1,nitems:1,"nonzero?":1,object_id:1,oct:1,open:1,pack:1,partition:1,pid:1,pipe:1,pop:1,popen:1,pos:1,prec:1,prec_f:1,prec_i:1,print:1,printf:1,private_class_method:1,private_instance_methods:1,"private_method_defined?":1,private_methods:1,proc:1,protected_instance_methods:1,"protected_method_defined?":1,protected_methods:1,public_class_method:1,public_instance_methods:1,"public_method_defined?":1,public_methods:1,push:1,putc:1,puts:1,quo:1,raise:1,rand:1,rassoc:1,read:1,read_nonblock:1,readchar:1,readline:1,readlines:1,readpartial:1,rehash:1,reject:1,"reject!":1,remainder:1,reopen:1,replace:1,require:1,"respond_to?":1,reverse:1,"reverse!":1,reverse_each:1,rewind:1,rindex:1,rjust:1,round:1,rstrip:1,"rstrip!":1,scan:1,seek:1,select:1,send:1,set_trace_func:1,shift:1,singleton_method_added:1,singleton_methods:1,size:1,sleep:1,slice:1,"slice!":1,sort:1,"sort!":1,sort_by:1,split:1,sprintf:1,squeeze:1,"squeeze!":1,srand:1,stat:1,step:1,store:1,strip:1,"strip!":1,sub:1,"sub!":1,succ:1,"succ!":1,sum:1,superclass:1,swapcase:1,"swapcase!":1,sync:1,syscall:1,sysopen:1,sysread:1,sysseek:1,system:1,syswrite:1,taint:1,"tainted?":1,tell:1,test:1,"throw":1,times:1,to_a:1,to_ary:1,to_f:1,to_hash:1,to_i:1,to_int:1,to_io:1,to_proc:1,to_s:1,to_str:1,to_sym:1,tr:1,"tr!":1,tr_s:1,"tr_s!":1,trace_var:1,transpose:1,trap:1,truncate:1,"tty?":1,type:1,ungetc:1,uniq:1,"uniq!":1,unpack:1,unshift:1,untaint:1,untrace_var:1,upcase:1,"upcase!":1,update:1,upto:1,"value?":1,values:1,values_at:1,warn:1,write:1,write_nonblock:1,"zero?":1,zip:1}};var h={cN:"yardoctag",b:"@[A-Za-z]+"};var d={cN:"comment",b:"#",e:"$",c:[h]};var c={cN:"comment",b:"^\\=begin",e:"^\\=end",c:[h],r:10};var b={cN:"comment",b:"^__END__",e:"\\n$"};var u={cN:"subst",b:"#\\{",e:"}",l:g,k:n};var p=[hljs.BE,u];var s={cN:"string",b:"'",e:"'",c:p,r:0};var r={cN:"string",b:'"',e:'"',c:p,r:0};var q={cN:"string",b:"%[qw]?\\(",e:"\\)",c:p,r:10};var o={cN:"string",b:"%[qw]?\\[",e:"\\]",c:p,r:10};var m={cN:"string",b:"%[qw]?{",e:"}",c:p,r:10};var l={cN:"string",b:"%[qw]?<",e:">",c:p,r:10};var k={cN:"string",b:"%[qw]?/",e:"/",c:p,r:10};var j={cN:"string",b:"%[qw]?%",e:"%",c:p,r:10};var i={cN:"string",b:"%[qw]?-",e:"-",c:p,r:10};var t={cN:"string",b:"%[qw]?\\|",e:"\\|",c:p,r:10};var e={cN:"function",b:"\\bdef\\s+",e:" |$|;",l:g,k:n,c:[{cN:"title",b:a,l:g,k:n},{cN:"params",b:"\\(",e:"\\)",l:g,k:n},d,c,b]};var f={cN:"identifier",b:g,l:g,k:n,r:0};var v=[d,c,b,s,r,q,o,m,l,k,j,i,t,{cN:"class",b:"\\b(class|module)\\b",e:"$|;",k:{"class":1,module:1},c:[{cN:"title",b:"[A-Za-z_]\\w*(::\\w+)*(\\?|\\!)?",r:0},{cN:"inheritance",b:"<\\s*",c:[{cN:"parent",b:"("+hljs.IR+"::)?"+hljs.IR}]},d,c,b]},e,{cN:"constant",b:"(::)?([A-Z]\\w*(::)?)+",r:0},{cN:"symbol",b:":",c:[s,r,q,o,m,l,k,j,i,t,f],r:0},{cN:"number",b:"(\\b0[0-7_]+)|(\\b0x[0-9a-fA-F_]+)|(\\b[1-9][0-9_]*(\\.[0-9_]+)?)|[0_]\\b",r:0},{cN:"number",b:"\\?\\w"},{cN:"variable",b:"(\\$\\W)|((\\$|\\@\\@?)(\\w+))"},f,{b:"("+hljs.RSR+")\\s*",c:[d,c,b,{cN:"regexp",b:"/",e:"/[a-z]*",i:"\\n",c:[hljs.BE]}],r:0}];u.c=v;e.c[1].c=v;return{dM:{l:g,k:n,c:v}}}();hljs.LANGUAGES.javascript={dM:{k:{keyword:{"in":1,"if":1,"for":1,"while":1,"finally":1,"var":1,"new":1,"function":1,"do":1,"return":1,"void":1,"else":1,"break":1,"catch":1,"instanceof":1,"with":1,"throw":1,"case":1,"default":1,"try":1,"this":1,"switch":1,"continue":1,"typeof":1,"delete":1},literal:{"true":1,"false":1,"null":1}},c:[hljs.ASM,hljs.QSM,hljs.CLCM,hljs.CBLCLM,hljs.CNM,{b:"("+hljs.RSR+"|case|return|throw)\\s*",k:{"return":1,"throw":1,"case":1},c:[hljs.CLCM,hljs.CBLCLM,{cN:"regexp",b:"/",e:"/[gim]*",c:[{b:"\\\\/"}]}],r:0},{cN:"function",b:"\\bfunction\\b",e:"{",k:{"function":1},c:[{cN:"title",b:"[A-Za-z$_][0-9A-Za-z$_]*"},{cN:"params",b:"\\(",e:"\\)",c:[hljs.ASM,hljs.QSM,hljs.CLCM,hljs.CBLCLM]}]}]}};hljs.LANGUAGES.css=function(){var a={cN:"function",b:hljs.IR+"\\(",e:"\\)",c:[{eW:true,eE:true,c:[hljs.NM,hljs.ASM,hljs.QSM]}]};return{cI:true,dM:{i:"[=/|']",c:[hljs.CBLCLM,{cN:"id",b:"\\#[A-Za-z0-9_-]+"},{cN:"class",b:"\\.[A-Za-z0-9_-]+",r:0},{cN:"attr_selector",b:"\\[",e:"\\]",i:"$"},{cN:"pseudo",b:":(:)?[a-zA-Z0-9\\_\\-\\+\\(\\)\\\"\\']+"},{cN:"at_rule",b:"@(font-face|page)",l:"[a-z-]+",k:{"font-face":1,page:1}},{cN:"at_rule",b:"@",e:"[{;]",eE:true,k:{"import":1,page:1,media:1,charset:1},c:[a,hljs.ASM,hljs.QSM,hljs.NM]},{cN:"tag",b:hljs.IR,r:0},{cN:"rules",b:"{",e:"}",i:"[^\\s]",r:0,c:[hljs.CBLCLM,{cN:"rule",b:"[^\\s]",rB:true,e:";",eW:true,c:[{cN:"attribute",b:"[A-Z\\_\\.\\-]+",e:":",eE:true,i:"[^\\s]",starts:{cN:"value",eW:true,eE:true,c:[a,hljs.NM,hljs.QSM,hljs.ASM,hljs.CBLCLM,{cN:"hexcolor",b:"\\#[0-9A-F]+"},{cN:"important",b:"!important"}]}}]}]}]}}}();hljs.LANGUAGES.xml=function(){var b="[A-Za-z0-9\\._:-]+";var a={eW:true,c:[{cN:"attribute",b:b,r:0},{b:'="',rB:true,e:'"',c:[{cN:"value",b:'"',eW:true}]},{b:"='",rB:true,e:"'",c:[{cN:"value",b:"'",eW:true}]},{b:"=",c:[{cN:"value",b:"[^\\s/>]+"}]}]};return{cI:true,dM:{c:[{cN:"pi",b:"<\\?",e:"\\?>",r:10},{cN:"doctype",b:"",r:10,c:[{b:"\\[",e:"\\]"}]},{cN:"comment",b:"",r:10},{cN:"cdata",b:"<\\!\\[CDATA\\[",e:"\\]\\]>",r:10},{cN:"tag",b:"",k:{title:{style:1}},c:[a],starts:{cN:"css",e:"",rE:true,sL:"css"}},{cN:"tag",b:"",k:{title:{script:1}},c:[a],starts:{cN:"javascript",e:"<\/script>",rE:true,sL:"javascript"}},{cN:"vbscript",b:"<%",e:"%>",sL:"vbscript"},{cN:"tag",b:"",c:[{cN:"title",b:"[^ />]+"},a]}]}}}();hljs.LANGUAGES.java={dM:{k:{"false":1,"synchronized":1,"int":1,"abstract":1,"float":1,"private":1,"char":1,"interface":1,"boolean":1,"static":1,"null":1,"if":1,"const":1,"for":1,"true":1,"while":1,"long":1,"throw":1,strictfp:1,"finally":1,"protected":1,"extends":1,"import":1,"native":1,"final":1,"implements":1,"return":1,"void":1,"enum":1,"else":1,"break":1,"transient":1,"new":1,"catch":1,"instanceof":1,"byte":1,"super":1,"class":1,"volatile":1,"case":1,assert:1,"short":1,"package":1,"default":1,"double":1,"public":1,"try":1,"this":1,"switch":1,"continue":1,"throws":1},c:[{cN:"javadoc",b:"/\\*\\*",e:"\\*/",c:[{cN:"javadoctag",b:"@[A-Za-z]+"}],r:10},hljs.CLCM,hljs.CBLCLM,hljs.ASM,hljs.QSM,{cN:"class",b:"(class |interface )",e:"{",k:{"class":1,"interface":1},i:":",c:[{b:"(implements|extends)",k:{"extends":1,"implements":1},r:10},{cN:"title",b:hljs.UIR}]},hljs.CNM,{cN:"annotation",b:"@[A-Za-z]+"}]}};hljs.LANGUAGES.php={cI:true,dM:{k:{and:1,include_once:1,list:1,"abstract":1,global:1,"private":1,echo:1,"interface":1,as:1,"static":1,endswitch:1,array:1,"null":1,"if":1,endwhile:1,or:1,"const":1,"for":1,endforeach:1,self:1,"var":1,"while":1,isset:1,"public":1,"protected":1,exit:1,foreach:1,"throw":1,elseif:1,"extends":1,include:1,__FILE__:1,empty:1,require_once:1,"function":1,"do":1,xor:1,"return":1,"implements":1,parent:1,clone:1,use:1,__CLASS__:1,__LINE__:1,"else":1,"break":1,print:1,"eval":1,"new":1,"catch":1,__METHOD__:1,"class":1,"case":1,exception:1,php_user_filter:1,"default":1,die:1,require:1,__FUNCTION__:1,enddeclare:1,"final":1,"try":1,"this":1,"switch":1,"continue":1,endfor:1,endif:1,declare:1,unset:1,"true":1,"false":1,namespace:1},c:[hljs.CLCM,hljs.HCM,{cN:"comment",b:"/\\*",e:"\\*/",c:[{cN:"phpdoc",b:"\\s@[A-Za-z]+",r:10}]},hljs.CNM,hljs.inherit(hljs.ASM,{i:null}),hljs.inherit(hljs.QSM,{i:null}),{cN:"variable",b:"\\$[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*"},{cN:"preprocessor",b:"<\\?php",r:10},{cN:"preprocessor",b:"\\?>"}]}};hljs.LANGUAGES.python=function(){var c={cN:"string",b:"(u|b)?r?'''",e:"'''",r:10};var b={cN:"string",b:'(u|b)?r?"""',e:'"""',r:10};var a={cN:"string",b:"(u|r|ur|b|br)'",e:"'",c:[hljs.BE],r:10};var f={cN:"string",b:'(u|r|ur|b|br)"',e:'"',c:[hljs.BE],r:10};var d={cN:"title",b:hljs.UIR};var e={cN:"params",b:"\\(",e:"\\)",c:[c,b,a,f,hljs.ASM,hljs.QSM]};return{dM:{k:{keyword:{and:1,elif:1,is:1,global:1,as:1,"in":1,"if":1,from:1,raise:1,"for":1,except:1,"finally":1,print:1,"import":1,pass:1,"return":1,exec:1,"else":1,"break":1,not:1,"with":1,"class":1,assert:1,yield:1,"try":1,"while":1,"continue":1,del:1,or:1,def:1,lambda:1,nonlocal:10},built_in:{None:1,True:1,False:1,Ellipsis:1,NotImplemented:1}},i:"(|\\?)",c:[hljs.HCM,c,b,a,f,hljs.ASM,hljs.QSM,{cN:"function",b:"\\bdef ",e:":",i:"$",k:{def:1},c:[d,e],r:10},{cN:"class",b:"\\bclass ",e:":",i:"[${]",k:{"class":1},c:[d,e],r:10},hljs.CNM,{cN:"decorator",b:"@",e:"$"}]}}}();hljs.LANGUAGES.perl=function(){var c={getpwent:1,getservent:1,quotemeta:1,msgrcv:1,scalar:1,kill:1,dbmclose:1,undef:1,lc:1,ma:1,syswrite:1,tr:1,send:1,umask:1,sysopen:1,shmwrite:1,vec:1,qx:1,utime:1,local:1,oct:1,semctl:1,localtime:1,readpipe:1,"do":1,"return":1,format:1,read:1,sprintf:1,dbmopen:1,pop:1,getpgrp:1,not:1,getpwnam:1,rewinddir:1,qq:1,fileno:1,qw:1,endprotoent:1,wait:1,sethostent:1,bless:1,s:1,opendir:1,"continue":1,each:1,sleep:1,endgrent:1,shutdown:1,dump:1,chomp:1,connect:1,getsockname:1,die:1,socketpair:1,close:1,flock:1,exists:1,index:1,shmget:1,sub:1,"for":1,endpwent:1,redo:1,lstat:1,msgctl:1,setpgrp:1,abs:1,exit:1,select:1,print:1,ref:1,gethostbyaddr:1,unshift:1,fcntl:1,syscall:1,"goto":1,getnetbyaddr:1,join:1,gmtime:1,symlink:1,semget:1,splice:1,x:1,getpeername:1,recv:1,log:1,setsockopt:1,cos:1,last:1,reverse:1,gethostbyname:1,getgrnam:1,study:1,formline:1,endhostent:1,times:1,chop:1,length:1,gethostent:1,getnetent:1,pack:1,getprotoent:1,getservbyname:1,rand:1,mkdir:1,pos:1,chmod:1,y:1,substr:1,endnetent:1,printf:1,next:1,open:1,msgsnd:1,readdir:1,use:1,unlink:1,getsockopt:1,getpriority:1,rindex:1,wantarray:1,hex:1,system:1,getservbyport:1,endservent:1,"int":1,chr:1,untie:1,rmdir:1,prototype:1,tell:1,listen:1,fork:1,shmread:1,ucfirst:1,setprotoent:1,"else":1,sysseek:1,link:1,getgrgid:1,shmctl:1,waitpid:1,unpack:1,getnetbyname:1,reset:1,chdir:1,grep:1,split:1,require:1,caller:1,lcfirst:1,until:1,warn:1,"while":1,values:1,shift:1,telldir:1,getpwuid:1,my:1,getprotobynumber:1,"delete":1,and:1,sort:1,uc:1,defined:1,srand:1,accept:1,"package":1,seekdir:1,getprotobyname:1,semop:1,our:1,rename:1,seek:1,"if":1,q:1,chroot:1,sysread:1,setpwent:1,no:1,crypt:1,getc:1,chown:1,sqrt:1,write:1,setnetent:1,setpriority:1,foreach:1,tie:1,sin:1,msgget:1,map:1,stat:1,getlogin:1,unless:1,elsif:1,truncate:1,exec:1,keys:1,glob:1,tied:1,closedir:1,ioctl:1,socket:1,readlink:1,"eval":1,xor:1,readline:1,binmode:1,setservent:1,eof:1,ord:1,bind:1,alarm:1,pipe:1,atan2:1,getgrent:1,exp:1,time:1,push:1,setgrent:1,gt:1,lt:1,or:1,ne:1,m:1};var d={cN:"subst",b:"[$@]\\{",e:"}",k:c,r:10};var b={cN:"variable",b:"\\$\\d"};var a={cN:"variable",b:"[\\$\\%\\@\\*](\\^\\w\\b|#\\w+(\\:\\:\\w+)*|[^\\s\\w{]|{\\w+}|\\w+(\\:\\:\\w*)*)"};var g=[hljs.BE,d,b,a];var f={b:"->",c:[{b:hljs.IR},{b:"{",e:"}"}]};var e=[b,a,hljs.HCM,{cN:"comment",b:"^(__END__|__DATA__)",e:"\\n$",r:5},f,{cN:"string",b:"q[qwxr]?\\s*\\(",e:"\\)",c:g,r:5},{cN:"string",b:"q[qwxr]?\\s*\\[",e:"\\]",c:g,r:5},{cN:"string",b:"q[qwxr]?\\s*\\{",e:"\\}",c:g,r:5},{cN:"string",b:"q[qwxr]?\\s*\\|",e:"\\|",c:g,r:5},{cN:"string",b:"q[qwxr]?\\s*\\<",e:"\\>",c:g,r:5},{cN:"string",b:"qw\\s+q",e:"q",c:g,r:5},{cN:"string",b:"'",e:"'",c:[hljs.BE],r:0},{cN:"string",b:'"',e:'"',c:g,r:0},{cN:"string",b:"`",e:"`",c:[hljs.BE]},{cN:"string",b:"{\\w+}",r:0},{cN:"string",b:"-?\\w+\\s*\\=\\>",r:0},{cN:"number",b:"(\\b0[0-7_]+)|(\\b0x[0-9a-fA-F_]+)|(\\b[1-9][0-9_]*(\\.[0-9_]+)?)|[0_]\\b",r:0},{cN:"regexp",b:"(s|tr|y)/(\\\\.|[^/])*/(\\\\.|[^/])*/[a-z]*",r:10},{cN:"regexp",b:"(m|qr)?/",e:"/[a-z]*",c:[hljs.BE],r:0},{cN:"sub",b:"\\bsub\\b",e:"(\\s*\\(.*?\\))?[;{]",k:{sub:1},r:5},{cN:"operator",b:"-\\w\\b",r:0},{cN:"pod",b:"\\=\\w",e:"\\=cut"}];d.c=e;f.c[1].c=e;return{dM:{k:c,c:e}}}();hljs.LANGUAGES.cpp=function(){var b={keyword:{"false":1,"int":1,"float":1,"while":1,"private":1,"char":1,"catch":1,"export":1,virtual:1,operator:2,sizeof:2,dynamic_cast:2,typedef:2,const_cast:2,"const":1,struct:1,"for":1,static_cast:2,union:1,namespace:1,unsigned:1,"long":1,"throw":1,"volatile":2,"static":1,"protected":1,bool:1,template:1,mutable:1,"if":1,"public":1,friend:2,"do":1,"return":1,"goto":1,auto:1,"void":2,"enum":1,"else":1,"break":1,"new":1,extern:1,using:1,"true":1,"class":1,asm:1,"case":1,typeid:1,"short":1,reinterpret_cast:2,"default":1,"double":1,register:1,explicit:1,signed:1,typename:1,"try":1,"this":1,"switch":1,"continue":1,wchar_t:1,inline:1,"delete":1,alignof:1,char16_t:1,char32_t:1,constexpr:1,decltype:1,noexcept:1,nullptr:1,static_assert:1,thread_local:1},built_in:{std:1,string:1,cin:1,cout:1,cerr:1,clog:1,stringstream:1,istringstream:1,ostringstream:1,auto_ptr:1,deque:1,list:1,queue:1,stack:1,vector:1,map:1,set:1,bitset:1,multiset:1,multimap:1,unordered_set:1,unordered_map:1,unordered_multiset:1,unordered_multimap:1,array:1,shared_ptr:1}};var a={cN:"stl_container",b:"\\b(deque|list|queue|stack|vector|map|set|bitset|multiset|multimap|unordered_map|unordered_set|unordered_multiset|unordered_multimap|array)\\s*<",e:">",k:b,r:10};a.c=[a];return{dM:{k:b,i:" -// -// Redistributable under a BSD-style open source license. -// See license.txt for more information. -// -// The full source distribution is at: -// -// A A L -// T C A -// T K B -// -// -// -// -// Wherever possible, Showdown is a straight, line-by-line port -// of the Perl version of Markdown. -// -// This is not a normal parser design; it's basically just a -// series of string substitutions. It's hard to read and -// maintain this way, but keeping Showdown close to the original -// design makes it easier to port new features. -// -// More importantly, Showdown behaves like markdown.pl in most -// edge cases. So web applications can do client-side preview -// in Javascript, and then build identical HTML on the server. -// -// This port needs the new RegExp functionality of ECMA 262, -// 3rd Edition (i.e. Javascript 1.5). Most modern web browsers -// should do fine. Even with the new regular expression features, -// We do a lot of work to emulate Perl's regex functionality. -// The tricky changes in this file mostly have the "attacklab:" -// label. Major or self-explanatory changes don't. -// -// Smart diff tools like Araxis Merge will be able to match up -// this file with markdown.pl in a useful way. A little tweaking -// helps: in a copy of markdown.pl, replace "#" with "//" and -// replace "$text" with "text". Be sure to ignore whitespace -// and line endings. -// -// -// Showdown usage: -// -// var text = "Markdown *rocks*."; -// -// var converter = new Showdown.converter(); -// var html = converter.makeHtml(text); -// -// alert(html); -// -// Note: move the sample code to the bottom of this -// file before uncommenting it. -// -// -// Showdown namespace -// -var Showdown={};Showdown.converter=function(){var a,b,c,d=0;this.makeHtml=function(d){return a=new Array,b=new Array,c=new Array,d=d.replace(/~/g,"~T"),d=d.replace(/\$/g,"~D"),d=d.replace(/\r\n/g,"\n"),d=d.replace(/\r/g,"\n"),d="\n\n"+d+"\n\n",d=F(d),d=d.replace(/^[ \t]+$/mg,""),d=f(d),d=e(d),d=h(d),d=D(d),d=d.replace(/~D/g,"$$"),d=d.replace(/~T/g,"~"),d};var e=function(c){var c=c.replace(/^[ ]{0,3}\[(.+)\]:[ \t]*\n?[ \t]*?[ \t]*\n?[ \t]*(?:(\n*)["(](.+?)[")][ \t]*)?(?:\n+|\Z)/gm,function(c,d,e,f,g){return d=d.toLowerCase(),a[d]=z(e),f?f+g:(g&&(b[d]=g.replace(/"/g,""")),"")});return c},f=function(a){a=a.replace(/\n/g,"\n\n");var b="p|div|h[1-6]|blockquote|pre|table|dl|ol|ul|script|noscript|form|fieldset|iframe|math|ins|del",c="p|div|h[1-6]|blockquote|pre|table|dl|ol|ul|script|noscript|form|fieldset|iframe|math";return a=a.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,g),a=a.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,g),a=a.replace(/(\n[ ]{0,3}(<(hr)\b([^<>])*?\/?>)[ \t]*(?=\n{2,}))/g,g),a=a.replace(/(\n\n[ ]{0,3}[ \t]*(?=\n{2,}))/g,g),a=a.replace(/(?:\n\n)([ ]{0,3}(?:<([?%])[^\r]*?\2>)[ \t]*(?=\n{2,}))/g,g),a=a.replace(/\n\n/g,"\n"),a},g=function(a,b){var d=b;return d=d.replace(/\n\n/g,"\n"),d=d.replace(/^\n/,""),d=d.replace(/\n+$/g,""),d="\n\n~K"+(c.push(d)-1)+"K\n\n",d},h=function(a){a=o(a);var b=t("
");return a=a.replace(/^[ ]{0,2}([ ]?\*[ ]?){3,}[ \t]*$/gm,b),a=a.replace(/^[ ]{0,2}([ ]?\-[ ]?){3,}[ \t]*$/gm,b),a=a.replace(/^[ ]{0,2}([ ]?\_[ ]?){3,}[ \t]*$/gm,b),a=q(a),a=s(a),a=r(a),a=x(a),a=f(a),a=y(a),a},i=function(a){return a=u(a),a=j(a),a=A(a),a=m(a),a=k(a),a=B(a),a=z(a),a=w(a),a=a.replace(/ +\n/g,"
\n"),a},j=function(a){var b=/(<[a-z\/!$]("[^"]*"|'[^']*'|[^'">])*>|)/gi;return a=a.replace(b,function(a){var b=a.replace(/(.)<\/?code>(?=.)/g,"$1`");return b=G(b,"\\`*_"),b}),a},k=function(a){return a=a.replace(/(\[((?:\[[^\]]*\]|[^\[\]])*)\][ ]?(?:\n[ ]*)?\[(.*?)\])()()()()/g,l),a=a.replace(/(\[((?:\[[^\]]*\]|[^\[\]])*)\]\([ \t]*()?[ \t]*((['"])(.*?)\6[ \t]*)?\))/g,l),a=a.replace(/(\[([^\[\]]+)\])()()()()()/g,l),a},l=function(c,d,e,f,g,h,i,j){j==undefined&&(j="");var k=d,l=e,m=f.toLowerCase(),n=g,o=j;if(n==""){m==""&&(m=l.toLowerCase().replace(/ ?\n/g," ")),n="#"+m;if(a[m]!=undefined)n=a[m],b[m]!=undefined&&(o=b[m]);else{if(!(k.search(/\(\s*\)$/m)>-1))return k;n=""}}n=G(n,"*_");var p='",p},m=function(a){return a=a.replace(/(!\[(.*?)\][ ]?(?:\n[ ]*)?\[(.*?)\])()()()()/g,n),a=a.replace(/(!\[(.*?)\]\s?\([ \t]*()?[ \t]*((['"])(.*?)\6[ \t]*)?\))/g,n),a},n=function(c,d,e,f,g,h,i,j){var k=d,l=e,m=f.toLowerCase(),n=g,o=j;o||(o="");if(n==""){m==""&&(m=l.toLowerCase().replace(/ ?\n/g," ")),n="#"+m;if(a[m]==undefined)return k;n=a[m],b[m]!=undefined&&(o=b[m])}l=l.replace(/"/g,"""),n=G(n,"*_");var p=''+l+''+i(c)+"")}),a=a.replace(/^(.+)[ \t]*\n-+[ \t]*\n+/gm,function(a,c){return t('

'+i(c)+"

")}),a=a.replace(/^(\#{1,6})[ \t]*(.+?)[ \t]*\#*\n+/gm,function(a,c,d){var e=c.length;return t("'+i(d)+"")}),a},p,q=function(a){a+="~0";var b=/^(([ ]{0,3}([*+-]|\d+[.])[ \t]+)[^\r]+?(~0|\n{2,}(?=\S)(?![ \t]*(?:[*+-]|\d+[.])[ \t]+)))/gm;return d?a=a.replace(b,function(a,b,c){var d=b,e=c.search(/[*+-]/g)>-1?"ul":"ol";d=d.replace(/\n{2,}/g,"\n\n\n");var f=p(d);return f=f.replace(/\s+$/,""),f="<"+e+">"+f+"\n",f}):(b=/(\n\n|^\n?)(([ ]{0,3}([*+-]|\d+[.])[ \t]+)[^\r]+?(~0|\n{2,}(?=\S)(?![ \t]*(?:[*+-]|\d+[.])[ \t]+)))/g,a=a.replace(b,function(a,b,c,d){var e=b,f=c,g=d.search(/[*+-]/g)>-1?"ul":"ol",f=f.replace(/\n{2,}/g,"\n\n\n"),h=p(f);return h=e+"<"+g+">\n"+h+"\n",h})),a=a.replace(/~0/,""),a};p=function(a){return d++,a=a.replace(/\n{2,}$/,"\n"),a+="~0",a=a.replace(/(\n)?(^[ \t]*)([*+-]|\d+[.])[ \t]+([^\r]+?(\n{1,2}))(?=\n*(~0|\2([*+-]|\d+[.])[ \t]+))/gm,function(a,b,c,d,e){var f=e,g=b,j=c;return g||f.search(/\n{2,}/)>-1?f=h(E(f)):(f=q(E(f)),f=f.replace(/\n$/,""),f=i(f)),"
  • "+f+"
  • \n"}),a=a.replace(/~0/g,""),d--,a};var r=function(a){return a+="~0",a=a.replace(/(?:\n\n|^)((?:(?:[ ]{4}|\t).*\n+)+)(\n*[ ]{0,3}[^ \t\n]|(?=~0))/g,function(a,b,c){var d=b,e=c;return d=v(E(d)),d=F(d),d=d.replace(/^\n+/g,""),d=d.replace(/\n+$/g,""),d="
    "+d+"\n
    ",t(d)+e}),a=a.replace(/~0/,""),a},s=function(a){return a+="~0",a=a.replace(/\n```(.*)\n([^`]+)\n```/g,function(a,b,c){var d=b,e=c;return e=v(e),e=F(e),e=e.replace(/^\n+/g,""),e=e.replace(/\n+$/g,""),e="
    "+e+"\n
    ",t(e)}),a=a.replace(/~0/,""),a},t=function(a){return a=a.replace(/(^\n+|\n+$)/g,""),"\n\n~K"+(c.push(a)-1)+"K\n\n"},u=function(a){return a=a.replace(/(^|[^\\])(`+)([^\r]*?[^`])\2(?!`)/gm,function(a,b,c,d,e){var f=d;return f=f.replace(/^([ \t]*)/g,""),f=f.replace(/[ \t]*$/g,""),f=v(f),b+""+f+""}),a},v=function(a){return a=a.replace(/&/g,"&"),a=a.replace(//g,">"),a=G(a,"*_{}[]\\",!1),a},w=function(a){return a=a.replace(/(\*\*|__)(?=\S)([^\r]*?\S[*_]*)\1/g,"$2"),a=a.replace(/(\*|_)(?=\S)([^\r]*?\S)\1/g,"$2"),a},x=function(a){return a=a.replace(/((^[ \t]*>[ \t]?.+\n(.+\n)*\n*)+)/gm,function(a,b){var c=b;return c=c.replace(/^[ \t]*>[ \t]?/gm,"~0"),c=c.replace(/~0/g,""),c=c.replace(/^[ \t]+$/gm,""),c=h(c),c=c.replace(/(^|\n)/g,"$1 "),c=c.replace(/(\s*
    [^\r]+?<\/pre>)/gm,function(a,b){var c=b;return c=c.replace(/^  /mg,"~0"),c=c.replace(/~0/g,""),c}),t("
    \n"+c+"\n
    ")}),a},y=function(a){a=a.replace(/^\n+/g,""),a=a.replace(/\n+$/g,"");var b=a.split(/\n{2,}/g),d=new Array,e=b.length;for(var f=0;f=0?d.push(g):g.search(/\S/)>=0&&(g=i(g),g=g.replace(/^([ \t]*)/g,"

    "),g+="

    ",d.push(g))}e=d.length;for(var f=0;f=0){var h=c[RegExp.$1];h=h.replace(/\$/g,"$$$$"),d[f]=d[f].replace(/~K\d+K/,h)}return d.join("\n\n")},z=function(a){return a=a.replace(/&(?!#?[xX]?(?:[0-9a-fA-F]+|\w+);)/g,"&"),a=a.replace(/<(?![a-z\/?\$!])/gi,"<"),a},A=function(a){return a=a.replace(/\\(\\)/g,H),a=a.replace(/\\([`*_{}\[\]()>#+-.!])/g,H),a},B=function(a){return a=a.replace(/<((https?|ftp|dict):[^'">\s]+)>/gi,'
    $1'),a=a.replace(/<(?:mailto:)?([-.\w]+\@[-a-z0-9]+(\.[-a-z0-9]+)*\.[a-z]+)>/gi,function(a,b){return C(D(b))}),a},C=function(a){function b(a){var b="0123456789ABCDEF",c=a.charCodeAt(0);return b.charAt(c>>4)+b.charAt(c&15)}var c=[function(a){return"&#"+a.charCodeAt(0)+";"},function(a){return"&#x"+b(a)+";"},function(a){return a}];return a="mailto:"+a,a=a.replace(/./g,function(a){if(a=="@")a=c[Math.floor(Math.random()*2)](a);else if(a!=":"){var b=Math.random();a=b>.9?c[2](a):b>.45?c[1](a):c[0](a)}return a}),a=''+a+"",a=a.replace(/">.+:/g,'">'),a},D=function(a){return a=a.replace(/~E(\d+)E/g,function(a,b){var c=parseInt(b);return String.fromCharCode(c)}),a},E=function(a){return a=a.replace(/^(\t|[ ]{1,4})/gm,"~0"),a=a.replace(/~0/g,""),a},F=function(a){return a=a.replace(/\t(?=\t)/g," "),a=a.replace(/\t/g,"~A~B"),a=a.replace(/~B(.+?)~A/g,function(a,b,c){var d=b,e=4-d.length%4;for(var f=0;f"}while(y.length||z.length){var v=u().splice(0,1)[0];w+=m(x.substr(r,v.offset-r));r=v.offset;if(v.event=="start"){w+=s(v.node);t.push(v.node)}else{if(v.event=="stop"){var q=t.length;do{q--;var p=t[q];w+=("")}while(p!=v.node);t.splice(q,1);while(q'+m(L[0])+""}else{N+=m(L[0])}P=O.lR.lastIndex;L=O.lR.exec(M)}N+=m(M.substr(P,M.length-P));return N}function K(r,M){if(M.sL&&d[M.sL]){var L=e(M.sL,r);t+=L.keyword_count;return L.value}else{return F(r,M)}}function I(M,r){var L=M.cN?'':"";if(M.rB){q+=L;M.buffer=""}else{if(M.eB){q+=m(r)+L;M.buffer=""}else{q+=L;M.buffer=r}}C.push(M);B+=M.r}function E(O,L,Q){var R=C[C.length-1];if(Q){q+=K(R.buffer+O,R);return false}var M=z(L,R);if(M){q+=K(R.buffer+O,R);I(M,L);return M.rB}var r=w(C.length-1,L);if(r){var N=R.cN?"":"";if(R.rE){q+=K(R.buffer+O,R)+N}else{if(R.eE){q+=K(R.buffer+O,R)+N+m(L)}else{q+=K(R.buffer+O+L,R)+N}}while(r>1){N=C[C.length-2].cN?"":"";q+=N;r--;C.length--}var P=C[C.length-1];C.length--;C[C.length-1].buffer="";if(P.starts){I(P.starts,"")}return R.rE}if(x(L,R)){throw"Illegal"}}var H=d[J];var C=[H.dM];var B=0;var t=0;var q="";try{var v=0;H.dM.buffer="";do{var y=s(D,v);var u=E(y[0],y[1],y[2]);v+=y[0].length;if(!u){v+=y[1].length}}while(!y[2]);if(C.length>1){throw"Illegal"}return{r:B,keyword_count:t,value:q}}catch(G){if(G=="Illegal"){return{r:0,keyword_count:0,value:m(D)}}else{throw G}}}function f(t){var r={keyword_count:0,r:0,value:m(t)};var q=r;for(var p in d){if(!d.hasOwnProperty(p)){continue}var s=e(p,t);s.language=p;if(s.keyword_count+s.r>q.keyword_count+q.r){q=s}if(s.keyword_count+s.r>r.keyword_count+r.r){q=r;r=s}}if(q.language){r.second_best=q}return r}function h(r,q,p){if(q){r=r.replace(/^((<[^>]+>|\t)+)/gm,function(t,w,v,u){return w.replace(/\t/g,q)})}if(p){r=r.replace(/\n/g,"
    ")}return r}function o(u,x,q){var y=g(u,q);var s=a(u);if(s=="no-highlight"){return}if(s){var w=e(s,y)}else{var w=f(y);s=w.language}var p=b(u);if(p.length){var r=document.createElement("pre");r.innerHTML=w.value;w.value=l(p,b(r),y)}w.value=h(w.value,x,q);var t=u.className;if(!t.match("(\\s|^)(language-)?"+s+"(\\s|$)")){t=t?(t+" "+s):s}if(/MSIE [678]/.test(navigator.userAgent)&&u.tagName=="CODE"&&u.parentNode.tagName=="PRE"){var r=u.parentNode;var v=document.createElement("div");v.innerHTML="
    "+w.value+"
    ";u=v.firstChild.firstChild;v.firstChild.cN=r.cN;r.parentNode.replaceChild(v.firstChild,r)}else{u.innerHTML=w.value}u.className=t;u.result={language:s,kw:w.keyword_count,re:w.r};if(w.second_best){u.second_best={language:w.second_best.language,kw:w.second_best.keyword_count,re:w.second_best.r}}}function k(){if(k.called){return}k.called=true;var r=document.getElementsByTagName("pre");for(var p=0;p|>=|>>|>>=|>>>|>>>=|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~";this.BE={b:"\\\\.",r:0};this.ASM={cN:"string",b:"'",e:"'",i:"\\n",c:[this.BE],r:0};this.QSM={cN:"string",b:'"',e:'"',i:"\\n",c:[this.BE],r:0};this.CLCM={cN:"comment",b:"//",e:"$"};this.CBLCLM={cN:"comment",b:"/\\*",e:"\\*/"};this.HCM={cN:"comment",b:"#",e:"$"};this.NM={cN:"number",b:this.NR,r:0};this.CNM={cN:"number",b:this.CNR,r:0};this.inherit=function(p,s){var r={};for(var q in p){r[q]=p[q]}if(s){for(var q in s){r[q]=s[q]}}return r}}();hljs.LANGUAGES.cs={dM:{k:{"abstract":1,as:1,base:1,bool:1,"break":1,"byte":1,"case":1,"catch":1,"char":1,checked:1,"class":1,"const":1,"continue":1,decimal:1,"default":1,delegate:1,"do":1,"do":1,"double":1,"else":1,"enum":1,event:1,explicit:1,extern:1,"false":1,"finally":1,fixed:1,"float":1,"for":1,foreach:1,"goto":1,"if":1,implicit:1,"in":1,"int":1,"interface":1,internal:1,is:1,lock:1,"long":1,namespace:1,"new":1,"null":1,object:1,operator:1,out:1,override:1,params:1,"private":1,"protected":1,"public":1,readonly:1,ref:1,"return":1,sbyte:1,sealed:1,"short":1,sizeof:1,stackalloc:1,"static":1,string:1,struct:1,"switch":1,"this":1,"throw":1,"true":1,"try":1,"typeof":1,uint:1,ulong:1,unchecked:1,unsafe:1,ushort:1,using:1,virtual:1,"volatile":1,"void":1,"while":1,ascending:1,descending:1,from:1,get:1,group:1,into:1,join:1,let:1,orderby:1,partial:1,select:1,set:1,value:1,"var":1,where:1,yield:1},c:[{cN:"comment",b:"///",e:"$",rB:true,c:[{cN:"xmlDocTag",b:"///|"},{cN:"xmlDocTag",b:""}]},hljs.CLCM,hljs.CBLCLM,{cN:"string",b:'@"',e:'"',c:[{b:'""'}]},hljs.ASM,hljs.QSM,hljs.CNM]}};hljs.LANGUAGES.ruby=function(){var g="[a-zA-Z_][a-zA-Z0-9_]*(\\!|\\?)?";var a="[a-zA-Z_]\\w*[!?=]?|[-+~]\\@|<<|>>|=~|===?|<=>|[<>]=?|\\*\\*|[-/+%^&*~`|]|\\[\\]=?";var n={keyword:{and:1,"false":1,then:1,defined:1,module:1,"in":1,"return":1,redo:1,"if":1,BEGIN:1,retry:1,end:1,"for":1,"true":1,self:1,when:1,next:1,until:1,"do":1,begin:1,unless:1,END:1,rescue:1,nil:1,"else":1,"break":1,undef:1,not:1,"super":1,"class":1,"case":1,require:1,yield:1,alias:1,"while":1,ensure:1,elsif:1,or:1,def:1},keymethods:{__id__:1,__send__:1,abort:1,abs:1,"all?":1,allocate:1,ancestors:1,"any?":1,arity:1,assoc:1,at:1,at_exit:1,autoload:1,"autoload?":1,"between?":1,binding:1,binmode:1,"block_given?":1,call:1,callcc:1,caller:1,capitalize:1,"capitalize!":1,casecmp:1,"catch":1,ceil:1,center:1,chomp:1,"chomp!":1,chop:1,"chop!":1,chr:1,"class":1,class_eval:1,"class_variable_defined?":1,class_variables:1,clear:1,clone:1,close:1,close_read:1,close_write:1,"closed?":1,coerce:1,collect:1,"collect!":1,compact:1,"compact!":1,concat:1,"const_defined?":1,const_get:1,const_missing:1,const_set:1,constants:1,count:1,crypt:1,"default":1,default_proc:1,"delete":1,"delete!":1,delete_at:1,delete_if:1,detect:1,display:1,div:1,divmod:1,downcase:1,"downcase!":1,downto:1,dump:1,dup:1,each:1,each_byte:1,each_index:1,each_key:1,each_line:1,each_pair:1,each_value:1,each_with_index:1,"empty?":1,entries:1,eof:1,"eof?":1,"eql?":1,"equal?":1,"eval":1,exec:1,exit:1,"exit!":1,extend:1,fail:1,fcntl:1,fetch:1,fileno:1,fill:1,find:1,find_all:1,first:1,flatten:1,"flatten!":1,floor:1,flush:1,for_fd:1,foreach:1,fork:1,format:1,freeze:1,"frozen?":1,fsync:1,getc:1,gets:1,global_variables:1,grep:1,gsub:1,"gsub!":1,"has_key?":1,"has_value?":1,hash:1,hex:1,id:1,include:1,"include?":1,included_modules:1,index:1,indexes:1,indices:1,induced_from:1,inject:1,insert:1,inspect:1,instance_eval:1,instance_method:1,instance_methods:1,"instance_of?":1,"instance_variable_defined?":1,instance_variable_get:1,instance_variable_set:1,instance_variables:1,"integer?":1,intern:1,invert:1,ioctl:1,"is_a?":1,isatty:1,"iterator?":1,join:1,"key?":1,keys:1,"kind_of?":1,lambda:1,last:1,length:1,lineno:1,ljust:1,load:1,local_variables:1,loop:1,lstrip:1,"lstrip!":1,map:1,"map!":1,match:1,max:1,"member?":1,merge:1,"merge!":1,method:1,"method_defined?":1,method_missing:1,methods:1,min:1,module_eval:1,modulo:1,name:1,nesting:1,"new":1,next:1,"next!":1,"nil?":1,nitems:1,"nonzero?":1,object_id:1,oct:1,open:1,pack:1,partition:1,pid:1,pipe:1,pop:1,popen:1,pos:1,prec:1,prec_f:1,prec_i:1,print:1,printf:1,private_class_method:1,private_instance_methods:1,"private_method_defined?":1,private_methods:1,proc:1,protected_instance_methods:1,"protected_method_defined?":1,protected_methods:1,public_class_method:1,public_instance_methods:1,"public_method_defined?":1,public_methods:1,push:1,putc:1,puts:1,quo:1,raise:1,rand:1,rassoc:1,read:1,read_nonblock:1,readchar:1,readline:1,readlines:1,readpartial:1,rehash:1,reject:1,"reject!":1,remainder:1,reopen:1,replace:1,require:1,"respond_to?":1,reverse:1,"reverse!":1,reverse_each:1,rewind:1,rindex:1,rjust:1,round:1,rstrip:1,"rstrip!":1,scan:1,seek:1,select:1,send:1,set_trace_func:1,shift:1,singleton_method_added:1,singleton_methods:1,size:1,sleep:1,slice:1,"slice!":1,sort:1,"sort!":1,sort_by:1,split:1,sprintf:1,squeeze:1,"squeeze!":1,srand:1,stat:1,step:1,store:1,strip:1,"strip!":1,sub:1,"sub!":1,succ:1,"succ!":1,sum:1,superclass:1,swapcase:1,"swapcase!":1,sync:1,syscall:1,sysopen:1,sysread:1,sysseek:1,system:1,syswrite:1,taint:1,"tainted?":1,tell:1,test:1,"throw":1,times:1,to_a:1,to_ary:1,to_f:1,to_hash:1,to_i:1,to_int:1,to_io:1,to_proc:1,to_s:1,to_str:1,to_sym:1,tr:1,"tr!":1,tr_s:1,"tr_s!":1,trace_var:1,transpose:1,trap:1,truncate:1,"tty?":1,type:1,ungetc:1,uniq:1,"uniq!":1,unpack:1,unshift:1,untaint:1,untrace_var:1,upcase:1,"upcase!":1,update:1,upto:1,"value?":1,values:1,values_at:1,warn:1,write:1,write_nonblock:1,"zero?":1,zip:1}};var h={cN:"yardoctag",b:"@[A-Za-z]+"};var d={cN:"comment",b:"#",e:"$",c:[h]};var c={cN:"comment",b:"^\\=begin",e:"^\\=end",c:[h],r:10};var b={cN:"comment",b:"^__END__",e:"\\n$"};var u={cN:"subst",b:"#\\{",e:"}",l:g,k:n};var p=[hljs.BE,u];var s={cN:"string",b:"'",e:"'",c:p,r:0};var r={cN:"string",b:'"',e:'"',c:p,r:0};var q={cN:"string",b:"%[qw]?\\(",e:"\\)",c:p,r:10};var o={cN:"string",b:"%[qw]?\\[",e:"\\]",c:p,r:10};var m={cN:"string",b:"%[qw]?{",e:"}",c:p,r:10};var l={cN:"string",b:"%[qw]?<",e:">",c:p,r:10};var k={cN:"string",b:"%[qw]?/",e:"/",c:p,r:10};var j={cN:"string",b:"%[qw]?%",e:"%",c:p,r:10};var i={cN:"string",b:"%[qw]?-",e:"-",c:p,r:10};var t={cN:"string",b:"%[qw]?\\|",e:"\\|",c:p,r:10};var e={cN:"function",b:"\\bdef\\s+",e:" |$|;",l:g,k:n,c:[{cN:"title",b:a,l:g,k:n},{cN:"params",b:"\\(",e:"\\)",l:g,k:n},d,c,b]};var f={cN:"identifier",b:g,l:g,k:n,r:0};var v=[d,c,b,s,r,q,o,m,l,k,j,i,t,{cN:"class",b:"\\b(class|module)\\b",e:"$|;",k:{"class":1,module:1},c:[{cN:"title",b:"[A-Za-z_]\\w*(::\\w+)*(\\?|\\!)?",r:0},{cN:"inheritance",b:"<\\s*",c:[{cN:"parent",b:"("+hljs.IR+"::)?"+hljs.IR}]},d,c,b]},e,{cN:"constant",b:"(::)?([A-Z]\\w*(::)?)+",r:0},{cN:"symbol",b:":",c:[s,r,q,o,m,l,k,j,i,t,f],r:0},{cN:"number",b:"(\\b0[0-7_]+)|(\\b0x[0-9a-fA-F_]+)|(\\b[1-9][0-9_]*(\\.[0-9_]+)?)|[0_]\\b",r:0},{cN:"number",b:"\\?\\w"},{cN:"variable",b:"(\\$\\W)|((\\$|\\@\\@?)(\\w+))"},f,{b:"("+hljs.RSR+")\\s*",c:[d,c,b,{cN:"regexp",b:"/",e:"/[a-z]*",i:"\\n",c:[hljs.BE]}],r:0}];u.c=v;e.c[1].c=v;return{dM:{l:g,k:n,c:v}}}();hljs.LANGUAGES.javascript={dM:{k:{keyword:{"in":1,"if":1,"for":1,"while":1,"finally":1,"var":1,"new":1,"function":1,"do":1,"return":1,"void":1,"else":1,"break":1,"catch":1,"instanceof":1,"with":1,"throw":1,"case":1,"default":1,"try":1,"this":1,"switch":1,"continue":1,"typeof":1,"delete":1},literal:{"true":1,"false":1,"null":1}},c:[hljs.ASM,hljs.QSM,hljs.CLCM,hljs.CBLCLM,hljs.CNM,{b:"("+hljs.RSR+"|case|return|throw)\\s*",k:{"return":1,"throw":1,"case":1},c:[hljs.CLCM,hljs.CBLCLM,{cN:"regexp",b:"/",e:"/[gim]*",c:[{b:"\\\\/"}]}],r:0},{cN:"function",b:"\\bfunction\\b",e:"{",k:{"function":1},c:[{cN:"title",b:"[A-Za-z$_][0-9A-Za-z$_]*"},{cN:"params",b:"\\(",e:"\\)",c:[hljs.ASM,hljs.QSM,hljs.CLCM,hljs.CBLCLM]}]}]}};hljs.LANGUAGES.css=function(){var a={cN:"function",b:hljs.IR+"\\(",e:"\\)",c:[{eW:true,eE:true,c:[hljs.NM,hljs.ASM,hljs.QSM]}]};return{cI:true,dM:{i:"[=/|']",c:[hljs.CBLCLM,{cN:"id",b:"\\#[A-Za-z0-9_-]+"},{cN:"class",b:"\\.[A-Za-z0-9_-]+",r:0},{cN:"attr_selector",b:"\\[",e:"\\]",i:"$"},{cN:"pseudo",b:":(:)?[a-zA-Z0-9\\_\\-\\+\\(\\)\\\"\\']+"},{cN:"at_rule",b:"@(font-face|page)",l:"[a-z-]+",k:{"font-face":1,page:1}},{cN:"at_rule",b:"@",e:"[{;]",eE:true,k:{"import":1,page:1,media:1,charset:1},c:[a,hljs.ASM,hljs.QSM,hljs.NM]},{cN:"tag",b:hljs.IR,r:0},{cN:"rules",b:"{",e:"}",i:"[^\\s]",r:0,c:[hljs.CBLCLM,{cN:"rule",b:"[^\\s]",rB:true,e:";",eW:true,c:[{cN:"attribute",b:"[A-Z\\_\\.\\-]+",e:":",eE:true,i:"[^\\s]",starts:{cN:"value",eW:true,eE:true,c:[a,hljs.NM,hljs.QSM,hljs.ASM,hljs.CBLCLM,{cN:"hexcolor",b:"\\#[0-9A-F]+"},{cN:"important",b:"!important"}]}}]}]}]}}}();hljs.LANGUAGES.xml=function(){var b="[A-Za-z0-9\\._:-]+";var a={eW:true,c:[{cN:"attribute",b:b,r:0},{b:'="',rB:true,e:'"',c:[{cN:"value",b:'"',eW:true}]},{b:"='",rB:true,e:"'",c:[{cN:"value",b:"'",eW:true}]},{b:"=",c:[{cN:"value",b:"[^\\s/>]+"}]}]};return{cI:true,dM:{c:[{cN:"pi",b:"<\\?",e:"\\?>",r:10},{cN:"doctype",b:"",r:10,c:[{b:"\\[",e:"\\]"}]},{cN:"comment",b:"",r:10},{cN:"cdata",b:"<\\!\\[CDATA\\[",e:"\\]\\]>",r:10},{cN:"tag",b:"",k:{title:{style:1}},c:[a],starts:{cN:"css",e:"",rE:true,sL:"css"}},{cN:"tag",b:"",k:{title:{script:1}},c:[a],starts:{cN:"javascript",e:"<\/script>",rE:true,sL:"javascript"}},{cN:"vbscript",b:"<%",e:"%>",sL:"vbscript"},{cN:"tag",b:"",c:[{cN:"title",b:"[^ />]+"},a]}]}}}();hljs.LANGUAGES.java={dM:{k:{"false":1,"synchronized":1,"int":1,"abstract":1,"float":1,"private":1,"char":1,"interface":1,"boolean":1,"static":1,"null":1,"if":1,"const":1,"for":1,"true":1,"while":1,"long":1,"throw":1,strictfp:1,"finally":1,"protected":1,"extends":1,"import":1,"native":1,"final":1,"implements":1,"return":1,"void":1,"enum":1,"else":1,"break":1,"transient":1,"new":1,"catch":1,"instanceof":1,"byte":1,"super":1,"class":1,"volatile":1,"case":1,assert:1,"short":1,"package":1,"default":1,"double":1,"public":1,"try":1,"this":1,"switch":1,"continue":1,"throws":1},c:[{cN:"javadoc",b:"/\\*\\*",e:"\\*/",c:[{cN:"javadoctag",b:"@[A-Za-z]+"}],r:10},hljs.CLCM,hljs.CBLCLM,hljs.ASM,hljs.QSM,{cN:"class",b:"(class |interface )",e:"{",k:{"class":1,"interface":1},i:":",c:[{b:"(implements|extends)",k:{"extends":1,"implements":1},r:10},{cN:"title",b:hljs.UIR}]},hljs.CNM,{cN:"annotation",b:"@[A-Za-z]+"}]}};hljs.LANGUAGES.php={cI:true,dM:{k:{and:1,include_once:1,list:1,"abstract":1,global:1,"private":1,echo:1,"interface":1,as:1,"static":1,endswitch:1,array:1,"null":1,"if":1,endwhile:1,or:1,"const":1,"for":1,endforeach:1,self:1,"var":1,"while":1,isset:1,"public":1,"protected":1,exit:1,foreach:1,"throw":1,elseif:1,"extends":1,include:1,__FILE__:1,empty:1,require_once:1,"function":1,"do":1,xor:1,"return":1,"implements":1,parent:1,clone:1,use:1,__CLASS__:1,__LINE__:1,"else":1,"break":1,print:1,"eval":1,"new":1,"catch":1,__METHOD__:1,"class":1,"case":1,exception:1,php_user_filter:1,"default":1,die:1,require:1,__FUNCTION__:1,enddeclare:1,"final":1,"try":1,"this":1,"switch":1,"continue":1,endfor:1,endif:1,declare:1,unset:1,"true":1,"false":1,namespace:1},c:[hljs.CLCM,hljs.HCM,{cN:"comment",b:"/\\*",e:"\\*/",c:[{cN:"phpdoc",b:"\\s@[A-Za-z]+",r:10}]},hljs.CNM,hljs.inherit(hljs.ASM,{i:null}),hljs.inherit(hljs.QSM,{i:null}),{cN:"variable",b:"\\$[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*"},{cN:"preprocessor",b:"<\\?php",r:10},{cN:"preprocessor",b:"\\?>"}]}};hljs.LANGUAGES.python=function(){var c={cN:"string",b:"(u|b)?r?'''",e:"'''",r:10};var b={cN:"string",b:'(u|b)?r?"""',e:'"""',r:10};var a={cN:"string",b:"(u|r|ur|b|br)'",e:"'",c:[hljs.BE],r:10};var f={cN:"string",b:'(u|r|ur|b|br)"',e:'"',c:[hljs.BE],r:10};var d={cN:"title",b:hljs.UIR};var e={cN:"params",b:"\\(",e:"\\)",c:[c,b,a,f,hljs.ASM,hljs.QSM]};return{dM:{k:{keyword:{and:1,elif:1,is:1,global:1,as:1,"in":1,"if":1,from:1,raise:1,"for":1,except:1,"finally":1,print:1,"import":1,pass:1,"return":1,exec:1,"else":1,"break":1,not:1,"with":1,"class":1,assert:1,yield:1,"try":1,"while":1,"continue":1,del:1,or:1,def:1,lambda:1,nonlocal:10},built_in:{None:1,True:1,False:1,Ellipsis:1,NotImplemented:1}},i:"(|\\?)",c:[hljs.HCM,c,b,a,f,hljs.ASM,hljs.QSM,{cN:"function",b:"\\bdef ",e:":",i:"$",k:{def:1},c:[d,e],r:10},{cN:"class",b:"\\bclass ",e:":",i:"[${]",k:{"class":1},c:[d,e],r:10},hljs.CNM,{cN:"decorator",b:"@",e:"$"}]}}}();hljs.LANGUAGES.perl=function(){var c={getpwent:1,getservent:1,quotemeta:1,msgrcv:1,scalar:1,kill:1,dbmclose:1,undef:1,lc:1,ma:1,syswrite:1,tr:1,send:1,umask:1,sysopen:1,shmwrite:1,vec:1,qx:1,utime:1,local:1,oct:1,semctl:1,localtime:1,readpipe:1,"do":1,"return":1,format:1,read:1,sprintf:1,dbmopen:1,pop:1,getpgrp:1,not:1,getpwnam:1,rewinddir:1,qq:1,fileno:1,qw:1,endprotoent:1,wait:1,sethostent:1,bless:1,s:1,opendir:1,"continue":1,each:1,sleep:1,endgrent:1,shutdown:1,dump:1,chomp:1,connect:1,getsockname:1,die:1,socketpair:1,close:1,flock:1,exists:1,index:1,shmget:1,sub:1,"for":1,endpwent:1,redo:1,lstat:1,msgctl:1,setpgrp:1,abs:1,exit:1,select:1,print:1,ref:1,gethostbyaddr:1,unshift:1,fcntl:1,syscall:1,"goto":1,getnetbyaddr:1,join:1,gmtime:1,symlink:1,semget:1,splice:1,x:1,getpeername:1,recv:1,log:1,setsockopt:1,cos:1,last:1,reverse:1,gethostbyname:1,getgrnam:1,study:1,formline:1,endhostent:1,times:1,chop:1,length:1,gethostent:1,getnetent:1,pack:1,getprotoent:1,getservbyname:1,rand:1,mkdir:1,pos:1,chmod:1,y:1,substr:1,endnetent:1,printf:1,next:1,open:1,msgsnd:1,readdir:1,use:1,unlink:1,getsockopt:1,getpriority:1,rindex:1,wantarray:1,hex:1,system:1,getservbyport:1,endservent:1,"int":1,chr:1,untie:1,rmdir:1,prototype:1,tell:1,listen:1,fork:1,shmread:1,ucfirst:1,setprotoent:1,"else":1,sysseek:1,link:1,getgrgid:1,shmctl:1,waitpid:1,unpack:1,getnetbyname:1,reset:1,chdir:1,grep:1,split:1,require:1,caller:1,lcfirst:1,until:1,warn:1,"while":1,values:1,shift:1,telldir:1,getpwuid:1,my:1,getprotobynumber:1,"delete":1,and:1,sort:1,uc:1,defined:1,srand:1,accept:1,"package":1,seekdir:1,getprotobyname:1,semop:1,our:1,rename:1,seek:1,"if":1,q:1,chroot:1,sysread:1,setpwent:1,no:1,crypt:1,getc:1,chown:1,sqrt:1,write:1,setnetent:1,setpriority:1,foreach:1,tie:1,sin:1,msgget:1,map:1,stat:1,getlogin:1,unless:1,elsif:1,truncate:1,exec:1,keys:1,glob:1,tied:1,closedir:1,ioctl:1,socket:1,readlink:1,"eval":1,xor:1,readline:1,binmode:1,setservent:1,eof:1,ord:1,bind:1,alarm:1,pipe:1,atan2:1,getgrent:1,exp:1,time:1,push:1,setgrent:1,gt:1,lt:1,or:1,ne:1,m:1};var d={cN:"subst",b:"[$@]\\{",e:"}",k:c,r:10};var b={cN:"variable",b:"\\$\\d"};var a={cN:"variable",b:"[\\$\\%\\@\\*](\\^\\w\\b|#\\w+(\\:\\:\\w+)*|[^\\s\\w{]|{\\w+}|\\w+(\\:\\:\\w*)*)"};var g=[hljs.BE,d,b,a];var f={b:"->",c:[{b:hljs.IR},{b:"{",e:"}"}]};var e=[b,a,hljs.HCM,{cN:"comment",b:"^(__END__|__DATA__)",e:"\\n$",r:5},f,{cN:"string",b:"q[qwxr]?\\s*\\(",e:"\\)",c:g,r:5},{cN:"string",b:"q[qwxr]?\\s*\\[",e:"\\]",c:g,r:5},{cN:"string",b:"q[qwxr]?\\s*\\{",e:"\\}",c:g,r:5},{cN:"string",b:"q[qwxr]?\\s*\\|",e:"\\|",c:g,r:5},{cN:"string",b:"q[qwxr]?\\s*\\<",e:"\\>",c:g,r:5},{cN:"string",b:"qw\\s+q",e:"q",c:g,r:5},{cN:"string",b:"'",e:"'",c:[hljs.BE],r:0},{cN:"string",b:'"',e:'"',c:g,r:0},{cN:"string",b:"`",e:"`",c:[hljs.BE]},{cN:"string",b:"{\\w+}",r:0},{cN:"string",b:"-?\\w+\\s*\\=\\>",r:0},{cN:"number",b:"(\\b0[0-7_]+)|(\\b0x[0-9a-fA-F_]+)|(\\b[1-9][0-9_]*(\\.[0-9_]+)?)|[0_]\\b",r:0},{cN:"regexp",b:"(s|tr|y)/(\\\\.|[^/])*/(\\\\.|[^/])*/[a-z]*",r:10},{cN:"regexp",b:"(m|qr)?/",e:"/[a-z]*",c:[hljs.BE],r:0},{cN:"sub",b:"\\bsub\\b",e:"(\\s*\\(.*?\\))?[;{]",k:{sub:1},r:5},{cN:"operator",b:"-\\w\\b",r:0},{cN:"pod",b:"\\=\\w",e:"\\=cut"}];d.c=e;f.c[1].c=e;return{dM:{k:c,c:e}}}();hljs.LANGUAGES.cpp=function(){var b={keyword:{"false":1,"int":1,"float":1,"while":1,"private":1,"char":1,"catch":1,"export":1,virtual:1,operator:2,sizeof:2,dynamic_cast:2,typedef:2,const_cast:2,"const":1,struct:1,"for":1,static_cast:2,union:1,namespace:1,unsigned:1,"long":1,"throw":1,"volatile":2,"static":1,"protected":1,bool:1,template:1,mutable:1,"if":1,"public":1,friend:2,"do":1,"return":1,"goto":1,auto:1,"void":2,"enum":1,"else":1,"break":1,"new":1,extern:1,using:1,"true":1,"class":1,asm:1,"case":1,typeid:1,"short":1,reinterpret_cast:2,"default":1,"double":1,register:1,explicit:1,signed:1,typename:1,"try":1,"this":1,"switch":1,"continue":1,wchar_t:1,inline:1,"delete":1,alignof:1,char16_t:1,char32_t:1,constexpr:1,decltype:1,noexcept:1,nullptr:1,static_assert:1,thread_local:1},built_in:{std:1,string:1,cin:1,cout:1,cerr:1,clog:1,stringstream:1,istringstream:1,ostringstream:1,auto_ptr:1,deque:1,list:1,queue:1,stack:1,vector:1,map:1,set:1,bitset:1,multiset:1,multimap:1,unordered_set:1,unordered_map:1,unordered_multiset:1,unordered_multimap:1,array:1,shared_ptr:1}};var a={cN:"stl_container",b:"\\b(deque|list|queue|stack|vector|map|set|bitset|multiset|multimap|unordered_map|unordered_set|unordered_multiset|unordered_multimap|array)\\s*<",e:">",k:b,r:10};a.c=[a];return{dM:{k:b,i:" 0 ) { + text = text.replace( new RegExp('\\n?\\t{' + leadingTabs + '}','g'), '\n' ); + } + else if( leadingWs > 1 ) { + text = text.replace( new RegExp('\\n? {' + leadingWs + '}','g'), '\n' ); + } + + section.innerHTML = (new Showdown.converter()).makeHtml(text); + } + +})(); \ No newline at end of file diff --git a/plugin/markdown/showdown.js b/plugin/markdown/showdown.js new file mode 100644 index 0000000..3f280f4 --- /dev/null +++ b/plugin/markdown/showdown.js @@ -0,0 +1,62 @@ +// +// showdown.js -- A javascript port of Markdown. +// +// Copyright (c) 2007 John Fraser. +// +// Original Markdown Copyright (c) 2004-2005 John Gruber +// +// +// Redistributable under a BSD-style open source license. +// See license.txt for more information. +// +// The full source distribution is at: +// +// A A L +// T C A +// T K B +// +// +// +// +// Wherever possible, Showdown is a straight, line-by-line port +// of the Perl version of Markdown. +// +// This is not a normal parser design; it's basically just a +// series of string substitutions. It's hard to read and +// maintain this way, but keeping Showdown close to the original +// design makes it easier to port new features. +// +// More importantly, Showdown behaves like markdown.pl in most +// edge cases. So web applications can do client-side preview +// in Javascript, and then build identical HTML on the server. +// +// This port needs the new RegExp functionality of ECMA 262, +// 3rd Edition (i.e. Javascript 1.5). Most modern web browsers +// should do fine. Even with the new regular expression features, +// We do a lot of work to emulate Perl's regex functionality. +// The tricky changes in this file mostly have the "attacklab:" +// label. Major or self-explanatory changes don't. +// +// Smart diff tools like Araxis Merge will be able to match up +// this file with markdown.pl in a useful way. A little tweaking +// helps: in a copy of markdown.pl, replace "#" with "//" and +// replace "$text" with "text". Be sure to ignore whitespace +// and line endings. +// +// +// Showdown usage: +// +// var text = "Markdown *rocks*."; +// +// var converter = new Showdown.converter(); +// var html = converter.makeHtml(text); +// +// alert(html); +// +// Note: move the sample code to the bottom of this +// file before uncommenting it. +// +// +// Showdown namespace +// +var Showdown={};Showdown.converter=function(){var a,b,c,d=0;this.makeHtml=function(d){return a=new Array,b=new Array,c=new Array,d=d.replace(/~/g,"~T"),d=d.replace(/\$/g,"~D"),d=d.replace(/\r\n/g,"\n"),d=d.replace(/\r/g,"\n"),d="\n\n"+d+"\n\n",d=F(d),d=d.replace(/^[ \t]+$/mg,""),d=f(d),d=e(d),d=h(d),d=D(d),d=d.replace(/~D/g,"$$"),d=d.replace(/~T/g,"~"),d};var e=function(c){var c=c.replace(/^[ ]{0,3}\[(.+)\]:[ \t]*\n?[ \t]*?[ \t]*\n?[ \t]*(?:(\n*)["(](.+?)[")][ \t]*)?(?:\n+|\Z)/gm,function(c,d,e,f,g){return d=d.toLowerCase(),a[d]=z(e),f?f+g:(g&&(b[d]=g.replace(/"/g,""")),"")});return c},f=function(a){a=a.replace(/\n/g,"\n\n");var b="p|div|h[1-6]|blockquote|pre|table|dl|ol|ul|script|noscript|form|fieldset|iframe|math|ins|del",c="p|div|h[1-6]|blockquote|pre|table|dl|ol|ul|script|noscript|form|fieldset|iframe|math";return a=a.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,g),a=a.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,g),a=a.replace(/(\n[ ]{0,3}(<(hr)\b([^<>])*?\/?>)[ \t]*(?=\n{2,}))/g,g),a=a.replace(/(\n\n[ ]{0,3}[ \t]*(?=\n{2,}))/g,g),a=a.replace(/(?:\n\n)([ ]{0,3}(?:<([?%])[^\r]*?\2>)[ \t]*(?=\n{2,}))/g,g),a=a.replace(/\n\n/g,"\n"),a},g=function(a,b){var d=b;return d=d.replace(/\n\n/g,"\n"),d=d.replace(/^\n/,""),d=d.replace(/\n+$/g,""),d="\n\n~K"+(c.push(d)-1)+"K\n\n",d},h=function(a){a=o(a);var b=t("
    ");return a=a.replace(/^[ ]{0,2}([ ]?\*[ ]?){3,}[ \t]*$/gm,b),a=a.replace(/^[ ]{0,2}([ ]?\-[ ]?){3,}[ \t]*$/gm,b),a=a.replace(/^[ ]{0,2}([ ]?\_[ ]?){3,}[ \t]*$/gm,b),a=q(a),a=s(a),a=r(a),a=x(a),a=f(a),a=y(a),a},i=function(a){return a=u(a),a=j(a),a=A(a),a=m(a),a=k(a),a=B(a),a=z(a),a=w(a),a=a.replace(/ +\n/g,"
    \n"),a},j=function(a){var b=/(<[a-z\/!$]("[^"]*"|'[^']*'|[^'">])*>|)/gi;return a=a.replace(b,function(a){var b=a.replace(/(.)<\/?code>(?=.)/g,"$1`");return b=G(b,"\\`*_"),b}),a},k=function(a){return a=a.replace(/(\[((?:\[[^\]]*\]|[^\[\]])*)\][ ]?(?:\n[ ]*)?\[(.*?)\])()()()()/g,l),a=a.replace(/(\[((?:\[[^\]]*\]|[^\[\]])*)\]\([ \t]*()?[ \t]*((['"])(.*?)\6[ \t]*)?\))/g,l),a=a.replace(/(\[([^\[\]]+)\])()()()()()/g,l),a},l=function(c,d,e,f,g,h,i,j){j==undefined&&(j="");var k=d,l=e,m=f.toLowerCase(),n=g,o=j;if(n==""){m==""&&(m=l.toLowerCase().replace(/ ?\n/g," ")),n="#"+m;if(a[m]!=undefined)n=a[m],b[m]!=undefined&&(o=b[m]);else{if(!(k.search(/\(\s*\)$/m)>-1))return k;n=""}}n=G(n,"*_");var p='",p},m=function(a){return a=a.replace(/(!\[(.*?)\][ ]?(?:\n[ ]*)?\[(.*?)\])()()()()/g,n),a=a.replace(/(!\[(.*?)\]\s?\([ \t]*()?[ \t]*((['"])(.*?)\6[ \t]*)?\))/g,n),a},n=function(c,d,e,f,g,h,i,j){var k=d,l=e,m=f.toLowerCase(),n=g,o=j;o||(o="");if(n==""){m==""&&(m=l.toLowerCase().replace(/ ?\n/g," ")),n="#"+m;if(a[m]==undefined)return k;n=a[m],b[m]!=undefined&&(o=b[m])}l=l.replace(/"/g,"""),n=G(n,"*_");var p=''+l+''+i(c)+"")}),a=a.replace(/^(.+)[ \t]*\n-+[ \t]*\n+/gm,function(a,c){return t('

    '+i(c)+"

    ")}),a=a.replace(/^(\#{1,6})[ \t]*(.+?)[ \t]*\#*\n+/gm,function(a,c,d){var e=c.length;return t("'+i(d)+"")}),a},p,q=function(a){a+="~0";var b=/^(([ ]{0,3}([*+-]|\d+[.])[ \t]+)[^\r]+?(~0|\n{2,}(?=\S)(?![ \t]*(?:[*+-]|\d+[.])[ \t]+)))/gm;return d?a=a.replace(b,function(a,b,c){var d=b,e=c.search(/[*+-]/g)>-1?"ul":"ol";d=d.replace(/\n{2,}/g,"\n\n\n");var f=p(d);return f=f.replace(/\s+$/,""),f="<"+e+">"+f+"\n",f}):(b=/(\n\n|^\n?)(([ ]{0,3}([*+-]|\d+[.])[ \t]+)[^\r]+?(~0|\n{2,}(?=\S)(?![ \t]*(?:[*+-]|\d+[.])[ \t]+)))/g,a=a.replace(b,function(a,b,c,d){var e=b,f=c,g=d.search(/[*+-]/g)>-1?"ul":"ol",f=f.replace(/\n{2,}/g,"\n\n\n"),h=p(f);return h=e+"<"+g+">\n"+h+"\n",h})),a=a.replace(/~0/,""),a};p=function(a){return d++,a=a.replace(/\n{2,}$/,"\n"),a+="~0",a=a.replace(/(\n)?(^[ \t]*)([*+-]|\d+[.])[ \t]+([^\r]+?(\n{1,2}))(?=\n*(~0|\2([*+-]|\d+[.])[ \t]+))/gm,function(a,b,c,d,e){var f=e,g=b,j=c;return g||f.search(/\n{2,}/)>-1?f=h(E(f)):(f=q(E(f)),f=f.replace(/\n$/,""),f=i(f)),"
  • "+f+"
  • \n"}),a=a.replace(/~0/g,""),d--,a};var r=function(a){return a+="~0",a=a.replace(/(?:\n\n|^)((?:(?:[ ]{4}|\t).*\n+)+)(\n*[ ]{0,3}[^ \t\n]|(?=~0))/g,function(a,b,c){var d=b,e=c;return d=v(E(d)),d=F(d),d=d.replace(/^\n+/g,""),d=d.replace(/\n+$/g,""),d="
    "+d+"\n
    ",t(d)+e}),a=a.replace(/~0/,""),a},s=function(a){return a+="~0",a=a.replace(/\n```(.*)\n([^`]+)\n```/g,function(a,b,c){var d=b,e=c;return e=v(e),e=F(e),e=e.replace(/^\n+/g,""),e=e.replace(/\n+$/g,""),e="
    "+e+"\n
    ",t(e)}),a=a.replace(/~0/,""),a},t=function(a){return a=a.replace(/(^\n+|\n+$)/g,""),"\n\n~K"+(c.push(a)-1)+"K\n\n"},u=function(a){return a=a.replace(/(^|[^\\])(`+)([^\r]*?[^`])\2(?!`)/gm,function(a,b,c,d,e){var f=d;return f=f.replace(/^([ \t]*)/g,""),f=f.replace(/[ \t]*$/g,""),f=v(f),b+""+f+""}),a},v=function(a){return a=a.replace(/&/g,"&"),a=a.replace(//g,">"),a=G(a,"*_{}[]\\",!1),a},w=function(a){return a=a.replace(/(\*\*|__)(?=\S)([^\r]*?\S[*_]*)\1/g,"$2"),a=a.replace(/(\*|_)(?=\S)([^\r]*?\S)\1/g,"$2"),a},x=function(a){return a=a.replace(/((^[ \t]*>[ \t]?.+\n(.+\n)*\n*)+)/gm,function(a,b){var c=b;return c=c.replace(/^[ \t]*>[ \t]?/gm,"~0"),c=c.replace(/~0/g,""),c=c.replace(/^[ \t]+$/gm,""),c=h(c),c=c.replace(/(^|\n)/g,"$1 "),c=c.replace(/(\s*
    [^\r]+?<\/pre>)/gm,function(a,b){var c=b;return c=c.replace(/^  /mg,"~0"),c=c.replace(/~0/g,""),c}),t("
    \n"+c+"\n
    ")}),a},y=function(a){a=a.replace(/^\n+/g,""),a=a.replace(/\n+$/g,"");var b=a.split(/\n{2,}/g),d=new Array,e=b.length;for(var f=0;f=0?d.push(g):g.search(/\S/)>=0&&(g=i(g),g=g.replace(/^([ \t]*)/g,"

    "),g+="

    ",d.push(g))}e=d.length;for(var f=0;f=0){var h=c[RegExp.$1];h=h.replace(/\$/g,"$$$$"),d[f]=d[f].replace(/~K\d+K/,h)}return d.join("\n\n")},z=function(a){return a=a.replace(/&(?!#?[xX]?(?:[0-9a-fA-F]+|\w+);)/g,"&"),a=a.replace(/<(?![a-z\/?\$!])/gi,"<"),a},A=function(a){return a=a.replace(/\\(\\)/g,H),a=a.replace(/\\([`*_{}\[\]()>#+-.!])/g,H),a},B=function(a){return a=a.replace(/<((https?|ftp|dict):[^'">\s]+)>/gi,'
    $1'),a=a.replace(/<(?:mailto:)?([-.\w]+\@[-a-z0-9]+(\.[-a-z0-9]+)*\.[a-z]+)>/gi,function(a,b){return C(D(b))}),a},C=function(a){function b(a){var b="0123456789ABCDEF",c=a.charCodeAt(0);return b.charAt(c>>4)+b.charAt(c&15)}var c=[function(a){return"&#"+a.charCodeAt(0)+";"},function(a){return"&#x"+b(a)+";"},function(a){return a}];return a="mailto:"+a,a=a.replace(/./g,function(a){if(a=="@")a=c[Math.floor(Math.random()*2)](a);else if(a!=":"){var b=Math.random();a=b>.9?c[2](a):b>.45?c[1](a):c[0](a)}return a}),a=''+a+"",a=a.replace(/">.+:/g,'">'),a},D=function(a){return a=a.replace(/~E(\d+)E/g,function(a,b){var c=parseInt(b);return String.fromCharCode(c)}),a},E=function(a){return a=a.replace(/^(\t|[ ]{1,4})/gm,"~0"),a=a.replace(/~0/g,""),a},F=function(a){return a=a.replace(/\t(?=\t)/g," "),a=a.replace(/\t/g,"~A~B"),a=a.replace(/~B(.+?)~A/g,function(a,b,c){var d=b,e=4-d.length%4;for(var f=0;f elements - { src: 'lib/js/highlight.js', async: true, callback: function() { window.hljs.initHighlightingOnLoad(); } }, // Cross-browser shim that fully implements classList - https://github.com/eligrey/classList.js/ - { src: 'lib/js/classList.js', condition: function() { return !document.body.classList; } } + { src: 'lib/js/classList.js', condition: function() { return !document.body.classList; } }, // Interpret Markdown in
    elements - { src: 'lib/js/data-markdown.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } }, - { src: 'lib/js/showdown.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } }, + { src: 'plugin/markdown/showdown.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } }, + { src: 'plugin/markdown/markdown.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } }, + // Syntax highlight for elements + { src: 'plugin/highlight/highlight.js', async: true, callback: function() { hljs.initHighlightingOnLoad(); } }, // Zoom in and out with Alt+click { src: 'plugin/zoom-js/zoom.js', async: true, condition: function() { return !!document.body.classList; } }, // Speaker notes diff --git a/plugin/notes-server/notes.html b/plugin/notes-server/notes.html index d71d7f8..053cb5e 100644 --- a/plugin/notes-server/notes.html +++ b/plugin/notes-server/notes.html @@ -99,7 +99,7 @@
    - + + + + diff --git a/plugin/postmessage/postmessage.js b/plugin/postmessage/postmessage.js new file mode 100644 index 0000000..176d230 --- /dev/null +++ b/plugin/postmessage/postmessage.js @@ -0,0 +1,40 @@ +/* +simple postmessage plugin + +Useful when a reveal slideshow is inside an iframe. +It allows to call reveal methods from outside. + +Example: + var reveal = window.frames[0]; + + // Reveal.prev(); + reveal.postMessage(JSON.stringify({method: 'prev', args: []}), '*'); + // Reveal.next(); + reveal.postMessage(JSON.stringify({method: 'next', args: []}), '*'); + // Reveal.slide(2, 2); + reveal.postMessage(JSON.stringify({method: 'slide', args: [2,2]}), '*'); + +Add to the slideshow: + + dependencies: [ + ... + { src: 'plugin/postmessage/postmessage.js', async: true, condition: function() { return !!document.body.classList; } } + ] + + +*/ + +(function (){ + +window.addEventListener("message", function (event){ + var data = JSON.parse(event.data), + method = data.method, + args = data.args; + if (Reveal[method]){ + Reveal[method].apply(Reveal, data.args); + } +}, false); +}()); + + + -- cgit v1.2.3 From 87591d95d18b9fe215f06791bd639a6ae4839cfd Mon Sep 17 00:00:00 2001 From: Hakim El Hattab Date: Sat, 10 Nov 2012 17:15:11 -0500 Subject: cosmetical tweaks to postmessage plugin --- plugin/postmessage/example.html | 39 ++++++++++++++++++++++++++ plugin/postmessage/iframe_example.html | 34 ----------------------- plugin/postmessage/postmessage.js | 50 ++++++++++++++++++---------------- 3 files changed, 65 insertions(+), 58 deletions(-) create mode 100644 plugin/postmessage/example.html delete mode 100644 plugin/postmessage/iframe_example.html (limited to 'plugin') diff --git a/plugin/postmessage/example.html b/plugin/postmessage/example.html new file mode 100644 index 0000000..cc57a7b --- /dev/null +++ b/plugin/postmessage/example.html @@ -0,0 +1,39 @@ + + + + + +
    + + + +
    + + + + + diff --git a/plugin/postmessage/iframe_example.html b/plugin/postmessage/iframe_example.html deleted file mode 100644 index 6e5709d..0000000 --- a/plugin/postmessage/iframe_example.html +++ /dev/null @@ -1,34 +0,0 @@ - - - -
    - - - -
    - - - diff --git a/plugin/postmessage/postmessage.js b/plugin/postmessage/postmessage.js index 176d230..d0f4140 100644 --- a/plugin/postmessage/postmessage.js +++ b/plugin/postmessage/postmessage.js @@ -1,39 +1,41 @@ /* -simple postmessage plugin -Useful when a reveal slideshow is inside an iframe. -It allows to call reveal methods from outside. + simple postmessage plugin -Example: - var reveal = window.frames[0]; + Useful when a reveal slideshow is inside an iframe. + It allows to call reveal methods from outside. - // Reveal.prev(); - reveal.postMessage(JSON.stringify({method: 'prev', args: []}), '*'); - // Reveal.next(); - reveal.postMessage(JSON.stringify({method: 'next', args: []}), '*'); - // Reveal.slide(2, 2); - reveal.postMessage(JSON.stringify({method: 'slide', args: [2,2]}), '*'); + Example: + var reveal = window.frames[0]; -Add to the slideshow: + // Reveal.prev(); + reveal.postMessage(JSON.stringify({method: 'prev', args: []}), '*'); + // Reveal.next(); + reveal.postMessage(JSON.stringify({method: 'next', args: []}), '*'); + // Reveal.slide(2, 2); + reveal.postMessage(JSON.stringify({method: 'slide', args: [2,2]}), '*'); - dependencies: [ - ... - { src: 'plugin/postmessage/postmessage.js', async: true, condition: function() { return !!document.body.classList; } } - ] + Add to the slideshow: + dependencies: [ + ... + { src: 'plugin/postmessage/postmessage.js', async: true, condition: function() { return !!document.body.classList; } } + ] */ (function (){ -window.addEventListener("message", function (event){ - var data = JSON.parse(event.data), - method = data.method, - args = data.args; - if (Reveal[method]){ - Reveal[method].apply(Reveal, data.args); - } -}, false); + window.addEventListener( "message", function ( event ) { + var data = JSON.parse( event.data ), + method = data.method, + args = data.args; + + if( typeof Reveal[method] === 'function' ) { + Reveal[method].apply( Reveal, data.args ); + } + }, false); + }()); -- cgit v1.2.3 From 4fbec5e87d3797b93b8fae750c5ce6519cddfa3b Mon Sep 17 00:00:00 2001 From: Hakim El Hattab Date: Sun, 11 Nov 2012 19:39:05 -0500 Subject: add touch based remote controlled plugin --- README.md | 9 ++++++++- index.html | 1 + plugin/remotes/remotes.js | 19 +++++++++++++++++++ 3 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 plugin/remotes/remotes.js (limited to 'plugin') diff --git a/README.md b/README.md index 0bfc6fb..2d22fb4 100644 --- a/README.md +++ b/README.md @@ -102,15 +102,22 @@ Reveal.initialize({ dependencies: [ // Cross-browser shim that fully implements classList - https://github.com/eligrey/classList.js/ { src: 'lib/js/classList.js', condition: function() { return !document.body.classList; } }, + // Interpret Markdown in
    elements { src: 'plugin/markdown/showdown.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } }, { src: 'plugin/markdown/markdown.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } }, + // Syntax highlight for elements { src: 'plugin/highlight/highlight.js', async: true, callback: function() { hljs.initHighlightingOnLoad(); } }, + // Zoom in and out with Alt+click { src: 'plugin/zoom-js/zoom.js', async: true, condition: function() { return !!document.body.classList; } }, + // Speaker notes - { src: 'plugin/notes/notes.js', async: true, condition: function() { return !!document.body.classList; } } + { src: 'plugin/notes/notes.js', async: true, condition: function() { return !!document.body.classList; } }, + + // Remote control your reveal.js presentation using a touch device + { src: 'plugin/remotes/remotes.js', async: true, condition: function() { return !!document.body.classList; } } ] }); ``` diff --git a/index.html b/index.html index fa93c0a..0ba0e51 100644 --- a/index.html +++ b/index.html @@ -364,6 +364,7 @@ function linkify( selector ) { { src: 'plugin/highlight/highlight.js', async: true, callback: function() { hljs.initHighlightingOnLoad(); } }, { src: 'plugin/zoom-js/zoom.js', async: true, condition: function() { return !!document.body.classList; } }, { src: 'plugin/notes/notes.js', async: true, condition: function() { return !!document.body.classList; } } + // { src: 'plugin/remotes/remotes.js', async: true, condition: function() { return !!document.body.classList; } } ] }); diff --git a/plugin/remotes/remotes.js b/plugin/remotes/remotes.js new file mode 100644 index 0000000..a739bb2 --- /dev/null +++ b/plugin/remotes/remotes.js @@ -0,0 +1,19 @@ +/** + * Touch-based remote controller for your presentation courtesy + * of the folks at http://remotes.io + */ + +head.ready( 'remotes.ne.min.js', function() { + + new Remotes("preview") + .on("swipe-left", function(e){ Reveal.right(); }) + .on("swipe-right", function(e){ Reveal.left(); }) + .on("swipe-up", function(e){ Reveal.down(); }) + .on("swipe-down", function(e){ Reveal.up(); }) + .on("tap", function(e){ + Reveal.toggleOverview(); + }); + +} ); + +head.js( 'https://raw.github.com/Remotes/Remotes/master/dist/remotes.ne.min.js' ); \ No newline at end of file -- cgit v1.2.3 From 3b073eee65ad0f1b367a54229d0beb2124919d86 Mon Sep 17 00:00:00 2001 From: Hakim El Hattab Date: Fri, 16 Nov 2012 09:08:32 -0500 Subject: fix incorrect navigation in notes window (closes #241) --- plugin/notes/notes.html | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'plugin') diff --git a/plugin/notes/notes.html b/plugin/notes/notes.html index 8763056..64b921c 100644 --- a/plugin/notes/notes.html +++ b/plugin/notes/notes.html @@ -119,10 +119,6 @@ } } - // Update the note slides - currentSlide.contentWindow.Reveal.slide( data.indexh, data.indexv ); - nextSlide.contentWindow.Reveal.slide( data.nextindexh, data.nextindexv ); - // Showing and hiding fragments if( data.fragment === 'next' ) { currentSlide.contentWindow.Reveal.nextFragment(); @@ -130,6 +126,11 @@ else if( data.fragment === 'prev' ) { currentSlide.contentWindow.Reveal.prevFragment(); } + else { + // Update the note slides + currentSlide.contentWindow.Reveal.slide( data.indexh, data.indexv ); + nextSlide.contentWindow.Reveal.slide( data.nextindexh, data.nextindexv ); + } }, false ); -- cgit v1.2.3 From 4009f2601e592945631515b9c7d0c1cab13b61d1 Mon Sep 17 00:00:00 2001 From: Hakim El Hattab Date: Fri, 16 Nov 2012 09:25:26 -0500 Subject: avoid stripping out notes when parsing markdown (closes #253) --- plugin/markdown/markdown.js | 3 +++ 1 file changed, 3 insertions(+) (limited to 'plugin') diff --git a/plugin/markdown/markdown.js b/plugin/markdown/markdown.js index 07ffd80..6331171 100644 --- a/plugin/markdown/markdown.js +++ b/plugin/markdown/markdown.js @@ -10,6 +10,7 @@ for( var i = 0, len = sections.length; i < len; i++ ) { var section = sections[i]; + var notes = section.querySelector( 'aside.notes' ); var template = section.querySelector( 'script' ); @@ -27,6 +28,8 @@ } section.innerHTML = (new Showdown.converter()).makeHtml(text); + + section.appendChild( notes ); } })(); \ No newline at end of file -- cgit v1.2.3 From 332ce86c3a528f313070580fcef11c15ab5f309a Mon Sep 17 00:00:00 2001 From: Hakim El Hattab Date: Fri, 16 Nov 2012 09:29:25 -0500 Subject: null check for notes in markdown parser (#253) --- plugin/markdown/markdown.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'plugin') diff --git a/plugin/markdown/markdown.js b/plugin/markdown/markdown.js index 6331171..b1660a1 100644 --- a/plugin/markdown/markdown.js +++ b/plugin/markdown/markdown.js @@ -29,7 +29,9 @@ section.innerHTML = (new Showdown.converter()).makeHtml(text); - section.appendChild( notes ); + if( notes ) { + section.appendChild( notes ); + } } })(); \ No newline at end of file -- cgit v1.2.3 From b9483f29e142ccfc681367014d8ef51813e98667 Mon Sep 17 00:00:00 2001 From: callmephilip Date: Fri, 4 Jan 2013 17:12:20 -0800 Subject: disable remotes plugin on mobile --- plugin/remotes/remotes.js | 35 +++++++++++++++++++++++------------ 1 file changed, 23 insertions(+), 12 deletions(-) (limited to 'plugin') diff --git a/plugin/remotes/remotes.js b/plugin/remotes/remotes.js index a739bb2..a1f10b8 100644 --- a/plugin/remotes/remotes.js +++ b/plugin/remotes/remotes.js @@ -3,17 +3,28 @@ * of the folks at http://remotes.io */ -head.ready( 'remotes.ne.min.js', function() { - - new Remotes("preview") - .on("swipe-left", function(e){ Reveal.right(); }) - .on("swipe-right", function(e){ Reveal.left(); }) - .on("swipe-up", function(e){ Reveal.down(); }) - .on("swipe-down", function(e){ Reveal.up(); }) - .on("tap", function(e){ - Reveal.toggleOverview(); - }); +(function(window){ -} ); + /** + * Detects if we are dealing with a touch enabled device (with some false positives) + * Borrowed from modernizr: https://github.com/Modernizr/Modernizr/blob/master/feature-detects/touch.js + */ + var hasTouch = (function(){ + return ('ontouchstart' in window) || window.DocumentTouch && document instanceof DocumentTouch; + })(); -head.js( 'https://raw.github.com/Remotes/Remotes/master/dist/remotes.ne.min.js' ); \ No newline at end of file + if(!hasTouch){ + head.ready( 'remotes.ne.min.js', function() { + new Remotes("preview") + .on("swipe-left", function(e){ Reveal.right(); }) + .on("swipe-right", function(e){ Reveal.left(); }) + .on("swipe-up", function(e){ Reveal.down(); }) + .on("swipe-down", function(e){ Reveal.up(); }) + .on("tap", function(e){ + Reveal.toggleOverview(); + }); + } ); + + head.js('https://raw.github.com/Remotes/Remotes/master/dist/remotes.ne.min.js'); + } +})(window); \ No newline at end of file -- cgit v1.2.3 From 05b5255d6046d7b87a691f8f7ea8a397f60a0eaa Mon Sep 17 00:00:00 2001 From: Hakim El Hattab Date: Thu, 10 Jan 2013 09:40:03 -0500 Subject: attribution for print-pdf phantom script (closes #276) --- plugin/print-pdf/print-pdf.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'plugin') diff --git a/plugin/print-pdf/print-pdf.js b/plugin/print-pdf/print-pdf.js index 8533137..2b1d691 100644 --- a/plugin/print-pdf/print-pdf.js +++ b/plugin/print-pdf/print-pdf.js @@ -2,8 +2,9 @@ * phantomjs script for printing presentations to PDF. * * Example: - * * phantomjs print-pdf.js "http://lab.hakim.se/reveal-js?print-pdf" reveal-demo.pdf + * + * By Manuel Bieh (https://github.com/manuelbieh) */ // html2pdf.js -- cgit v1.2.3 From 63a53e9dd1ef8805acd065c7faa2440673b15f92 Mon Sep 17 00:00:00 2001 From: hakimel Date: Mon, 21 Jan 2013 13:05:09 -0500 Subject: notes window now displays correct slides when origin is different than index.html (closes #278) --- plugin/notes/notes.html | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'plugin') diff --git a/plugin/notes/notes.html b/plugin/notes/notes.html index 64b921c..aecef7c 100644 --- a/plugin/notes/notes.html +++ b/plugin/notes/notes.html @@ -89,11 +89,11 @@
    - +
    - + UPCOMING:
    @@ -102,6 +102,13 @@
    - + UPCOMING:
    @@ -102,45 +114,48 @@ UPCOMING: +
    +
    +

    Time

    + 0:00:00 AM +
    +
    +

    Elapsed

    + 00:00:00 +
    +
    -- cgit v1.2.3 From 784fa9d2e3570054728d21f8098199dc9d4164b9 Mon Sep 17 00:00:00 2001 From: Hakim El Hattab Date: Sat, 26 Jan 2013 13:32:07 -0500 Subject: merge in timer in notes window, timer now stays hidden until initial time is set --- plugin/notes/notes.html | 146 ++++++++++++++++++++++++++++-------------------- 1 file changed, 84 insertions(+), 62 deletions(-) (limited to 'plugin') diff --git a/plugin/notes/notes.html b/plugin/notes/notes.html index f8e7f70..af2fbfc 100644 --- a/plugin/notes/notes.html +++ b/plugin/notes/notes.html @@ -95,10 +95,22 @@ .error code { font-family: monospace; } + .time { + width: 448px; + margin: 30px 0 0 10px; + float: left; text-align: center; + opacity: 0; + + -webkit-transition: opacity 0.4s; + -moz-transition: opacity 0.4s; + -o-transition: opacity 0.4s; + transition: opacity 0.4s; } - .elapsed, .clock { + + .elapsed, + .clock { color: #333; font-size: 2em; text-align: center; @@ -107,12 +119,15 @@ background-color: #eee; border-radius: 10px; } - .elapsed h2, .clock h2 { + + .elapsed h2, + .clock h2 { font-size: 0.8em; line-height: 100%; margin: 0; color: #aaa; } + .elapsed .mute { color: #ddd; } @@ -130,61 +145,85 @@ UPCOMING: -
    -
    + +
    +

    Time

    - 0:00:00 AM + 0:00:00 AM
    -
    +

    Elapsed

    - 00:00:00 + 00:00:00
    +
    -- cgit v1.2.3 From 25f3884bf4deb315aaf9a5236ec1c05f85e3ff42 Mon Sep 17 00:00:00 2001 From: Lars Kappert Date: Tue, 29 Jan 2013 23:49:17 +0100 Subject: Support for external markdown files, including configurable (vertical) slide separator --- demo.md | 29 ++++++++++ index-markdown.html | 105 ++++++++++++++++++++++++++++++++++++ plugin/markdown/markdown.js | 126 +++++++++++++++++++++++++++++++++++++++++--- 3 files changed, 252 insertions(+), 8 deletions(-) create mode 100644 demo.md create mode 100644 index-markdown.html (limited to 'plugin') diff --git a/demo.md b/demo.md new file mode 100644 index 0000000..1efe5f9 --- /dev/null +++ b/demo.md @@ -0,0 +1,29 @@ +# External markdown + + + +## Slide 1.1 + +Content 1.1 + + +## Slide 1.2 + +Content 1.2 + + + +## Slide 2 + +Content 2.1 + + + +## Slide 3.1 + +Content 3.1 + + +## Slide 3.2 + +Content 3.2 diff --git a/index-markdown.html b/index-markdown.html new file mode 100644 index 0000000..f46575b --- /dev/null +++ b/index-markdown.html @@ -0,0 +1,105 @@ + + + + + + + reveal.js - The HTML Presentation Framework + + + + + + + + + + + + + + + + + + + + + +
    + + +
    + + +
    + + +
    + +
    + + +
    + +
    + +
    +
    + + + + + + + + diff --git a/plugin/markdown/markdown.js b/plugin/markdown/markdown.js index b1660a1..8d40019 100644 --- a/plugin/markdown/markdown.js +++ b/plugin/markdown/markdown.js @@ -6,11 +6,7 @@ throw 'The reveal.js Markdown plugin requires Showdown to be loaded'; } - var sections = document.querySelectorAll( '[data-markdown]' ); - - for( var i = 0, len = sections.length; i < len; i++ ) { - var section = sections[i]; - var notes = section.querySelector( 'aside.notes' ); + var stripLeadingWhitespace = function(section) { var template = section.querySelector( 'script' ); @@ -27,11 +23,125 @@ text = text.replace( new RegExp('\\n? {' + leadingWs + '}','g'), '\n' ); } - section.innerHTML = (new Showdown.converter()).makeHtml(text); + return text; + + }; + + var slidifyMarkdown = function(markdown, separator, vertical) { + + separator = separator || '^\n---\n$'; + + var reSeparator = new RegExp(separator + (vertical ? '|' + vertical : ''), 'mg'), + reHorSeparator = new RegExp(separator), + matches, + lastIndex = 0, + isHorizontal, + wasHorizontal = true, + content, + sectionStack = [], + markdownSections = ''; + + // iterate until all blocks between separators are stacked up + while( matches = reSeparator.exec(markdown) ) { + + // determine direction (horizontal by default) + isHorizontal = reHorSeparator.test(matches[0]); + + if( !isHorizontal && wasHorizontal ) { + // create vertical stack + sectionStack.push([]); + } + + // pluck slide content from markdown input + content = markdown.substring(lastIndex, matches.index); + + if( isHorizontal && wasHorizontal ) { + // add to horizontal stack + sectionStack.push(content); + } else { + // add to vertical stack + sectionStack[sectionStack.length-1].push(content); + } + + lastIndex = reSeparator.lastIndex; + wasHorizontal = isHorizontal; + + } + + // add the remaining slide + (wasHorizontal ? sectionStack : sectionStack[sectionStack.length-1]).push(markdown.substring(lastIndex)); + + // flatten the hierarchical stack, and insert
    tags + for( var k = 0, klen = sectionStack.length; k < klen; k++ ) { + markdownSections += typeof sectionStack[k] === 'string' + ? '
    ' + sectionStack[k] + '
    ' + : '
    ' + sectionStack[k].join('
    ') + '
    '; + } + + return markdownSections; + }; + + var queryMarkdownSlides = function() { + + var sections = document.querySelectorAll( '[data-markdown]'), + section; + + for( var j = 0, jlen = sections.length; j < jlen; j++ ) { + + section = sections[j]; + + if( section.getAttribute('data-markdown').length ) { + + var xhr = new XMLHttpRequest(), + url = section.getAttribute('data-markdown'); + + xhr.onreadystatechange = function () { + if( xhr.readyState === 4 ) { + section.outerHTML = slidifyMarkdown( xhr.responseText, section.getAttribute('data-separator'), section.getAttribute('data-vertical') ); + } + }; + + xhr.open('GET', url, false); + xhr.send(); + + } else if( section.getAttribute('data-separator') ) { + + var markdown = stripLeadingWhitespace(section); + section.outerHTML = slidifyMarkdown( markdown, section.getAttribute('data-separator'), section.getAttribute('data-vertical') ); + + } + } + + querySlides(); + + }; + + var querySlides = function() { + + var sections = document.querySelectorAll( '[data-markdown]'); + + for( var j = 0, jlen = sections.length; j < jlen; j++ ) { + + makeHtml(sections[j]); + + } + + }; + + var makeHtml = function(section) { + + var notes = section.querySelector( 'aside.notes' ); + + var markdown = stripLeadingWhitespace(section); + + section.innerHTML = (new Showdown.converter()).makeHtml(markdown); if( notes ) { section.appendChild( notes ); } - } -})(); \ No newline at end of file + }; + + queryMarkdownSlides(); + +})(); -- cgit v1.2.3 From 7207122c75137c0d2c7dfd0e1d9a1a0e9bf0a88f Mon Sep 17 00:00:00 2001 From: Lars Kappert Date: Wed, 30 Jan 2013 00:09:02 +0100 Subject: Slightly refactored "slidify" flow --- plugin/markdown/markdown.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'plugin') diff --git a/plugin/markdown/markdown.js b/plugin/markdown/markdown.js index 8d40019..ae4d08b 100644 --- a/plugin/markdown/markdown.js +++ b/plugin/markdown/markdown.js @@ -81,7 +81,7 @@ return markdownSections; }; - var queryMarkdownSlides = function() { + var querySlidingMarkdown = function() { var sections = document.querySelectorAll( '[data-markdown]'), section; @@ -112,11 +112,9 @@ } } - querySlides(); - }; - var querySlides = function() { + var queryMarkdownSlides = function() { var sections = document.querySelectorAll( '[data-markdown]'); @@ -142,6 +140,8 @@ }; + querySlidingMarkdown(); + queryMarkdownSlides(); })(); -- cgit v1.2.3 From 080fb3cd33e6448a1f0e75987b796dcd550b487d Mon Sep 17 00:00:00 2001 From: Hakim El Hattab Date: Sun, 3 Feb 2013 13:21:42 -0500 Subject: disable zoom plugin while in overview mode --- plugin/zoom-js/zoom.js | 47 ++++++++++++++++++++++++++--------------------- 1 file changed, 26 insertions(+), 21 deletions(-) (limited to 'plugin') diff --git a/plugin/zoom-js/zoom.js b/plugin/zoom-js/zoom.js index 6b29f56..b67ae16 100644 --- a/plugin/zoom-js/zoom.js +++ b/plugin/zoom-js/zoom.js @@ -1,29 +1,34 @@ // Custom reveal.js integration (function(){ - document.querySelector( '.reveal' ).addEventListener( 'click', function( event ) { - if( event.altKey ) { + var isEnabled = true; + + document.querySelector( '.reveal' ).addEventListener( 'mousedown', function( event ) { + if( event.altKey && isEnabled ) { event.preventDefault(); zoom.to({ element: event.target, pan: false }); } } ); + + Reveal.addEventListener( 'overviewshown', function() { isEnabled = false; } ); + Reveal.addEventListener( 'overviewhidden', function() { isEnabled = true; } ); })(); /*! * zoom.js 0.2 (modified version for use with reveal.js) * http://lab.hakim.se/zoom-js * MIT licensed - * + * * Copyright (C) 2011-2012 Hakim El Hattab, http://hakim.se */ var zoom = (function(){ // The current zoom level (scale) var level = 1; - + // The current mouse position, used for panning var mouseX = 0, mouseY = 0; - + // Timeout before pan is activated var panEngageTimeout = -1, panUpdateInterval = -1; @@ -36,7 +41,7 @@ var zoom = (function(){ 'msTransform' in document.body.style || 'OTransform' in document.body.style || 'transform' in document.body.style; - + if( supportsTransforms ) { // The easing that will be applied when we zoom in/out document.body.style.transition = 'transform 0.8s ease'; @@ -45,7 +50,7 @@ var zoom = (function(){ document.body.style.MozTransition = '-moz-transform 0.8s ease'; document.body.style.WebkitTransition = '-webkit-transform 0.8s ease'; } - + // Zoom out if the user hits escape document.addEventListener( 'keyup', function( event ) { if( level !== 1 && event.keyCode === 27 ) { @@ -62,21 +67,21 @@ var zoom = (function(){ }, false ); /** - * Applies the CSS required to zoom in, prioritizes use of CSS3 + * Applies the CSS required to zoom in, prioritizes use of CSS3 * transforms but falls back on zoom for IE. - * - * @param {Number} pageOffsetX - * @param {Number} pageOffsetY - * @param {Number} elementOffsetX - * @param {Number} elementOffsetY - * @param {Number} scale + * + * @param {Number} pageOffsetX + * @param {Number} pageOffsetY + * @param {Number} elementOffsetX + * @param {Number} elementOffsetY + * @param {Number} scale */ function magnify( pageOffsetX, pageOffsetY, elementOffsetX, elementOffsetY, scale ) { if( supportsTransforms ) { var origin = pageOffsetX +'px '+ pageOffsetY +'px', transform = 'translate('+ -elementOffsetX +'px,'+ -elementOffsetY +'px) scale('+ scale +')'; - + document.body.style.transformOrigin = origin; document.body.style.OTransformOrigin = origin; document.body.style.msTransformOrigin = origin; @@ -121,7 +126,7 @@ var zoom = (function(){ } /** - * Pan the document when the mosue cursor approaches the edges + * Pan the document when the mosue cursor approaches the edges * of the window. */ function pan() { @@ -129,7 +134,7 @@ var zoom = (function(){ rangeX = window.innerWidth * range, rangeY = window.innerHeight * range, scrollOffset = getScrollOffset(); - + // Up if( mouseY < rangeY ) { window.scroll( scrollOffset.x, scrollOffset.y - ( 1 - ( mouseY / rangeY ) ) * ( 14 / level ) ); @@ -159,7 +164,7 @@ var zoom = (function(){ return { /** * Zooms in on either a rectangle or HTML element. - * + * * @param {Object} options * - element: HTML element to zoom in on * OR @@ -232,7 +237,7 @@ var zoom = (function(){ if( currentOptions && currentOptions.element ) { scrollOffset.x -= ( window.innerWidth - ( currentOptions.width * currentOptions.scale ) ) / 2; } - + magnify( scrollOffset.x, scrollOffset.y, 0, 0, 1 ); level = 1; @@ -241,11 +246,11 @@ var zoom = (function(){ // Alias magnify: function( options ) { this.to( options ) }, reset: function() { this.out() }, - + zoomLevel: function() { return level; } } - + })(); -- cgit v1.2.3 From fd7d09f6972443279e7d06397b52ddd9d789f51e Mon Sep 17 00:00:00 2001 From: Damjan Georgievski Date: Wed, 6 Feb 2013 12:24:04 +0100 Subject: find correct path to open html file from the notes.js path --- plugin/notes/notes.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'plugin') diff --git a/plugin/notes/notes.js b/plugin/notes/notes.js index 7c83366..72f6a10 100644 --- a/plugin/notes/notes.js +++ b/plugin/notes/notes.js @@ -5,7 +5,9 @@ var RevealNotes = (function() { function openNotes() { - var notesPopup = window.open( 'plugin/notes/notes.html', 'reveal.js - Notes', 'width=1120,height=850' ); + var jsFileLocation = document.querySelector('script[src*=notes]').src; // this js file path + jsFileLocation = jsFileLocation.replace(/notes\.js(\?.*)?$/, ''); // the js folder path + var notesPopup = window.open( jsFileLocation + 'notes.html', 'reveal.js - Notes', 'width=1120,height=850' ); // Fires when slide is changed Reveal.addEventListener( 'slidechanged', function( event ) { -- cgit v1.2.3 From 380264afc8468544d82f3e50115cef249f08fff5 Mon Sep 17 00:00:00 2001 From: hakimel Date: Wed, 6 Feb 2013 19:15:30 -0500 Subject: merge in notes improvement --- plugin/notes/notes.html | 32 ++++++++++++++++---------------- plugin/notes/notes.js | 2 +- 2 files changed, 17 insertions(+), 17 deletions(-) (limited to 'plugin') diff --git a/plugin/notes/notes.html b/plugin/notes/notes.html index af2fbfc..50d172a 100644 --- a/plugin/notes/notes.html +++ b/plugin/notes/notes.html @@ -29,16 +29,16 @@ border: none; -webkit-transform-origin: 0 0; - -moz-transform-origin: 0 0; - -ms-transform-origin: 0 0; - -o-transform-origin: 0 0; - transform-origin: 0 0; + -moz-transform-origin: 0 0; + -ms-transform-origin: 0 0; + -o-transform-origin: 0 0; + transform-origin: 0 0; -webkit-transform: scale(0.5); - -moz-transform: scale(0.5); - -ms-transform: scale(0.5); - -o-transform: scale(0.5); - transform: scale(0.5); + -moz-transform: scale(0.5); + -ms-transform: scale(0.5); + -o-transform: scale(0.5); + transform: scale(0.5); } #wrap-next-slide { @@ -55,16 +55,16 @@ border: none; -webkit-transform-origin: 0 0; - -moz-transform-origin: 0 0; - -ms-transform-origin: 0 0; - -o-transform-origin: 0 0; - transform-origin: 0 0; + -moz-transform-origin: 0 0; + -ms-transform-origin: 0 0; + -o-transform-origin: 0 0; + transform-origin: 0 0; -webkit-transform: scale(0.35); - -moz-transform: scale(0.35); - -ms-transform: scale(0.35); - -o-transform: scale(0.35); - transform: scale(0.35); + -moz-transform: scale(0.35); + -ms-transform: scale(0.35); + -o-transform: scale(0.35); + transform: scale(0.35); } .slides { diff --git a/plugin/notes/notes.js b/plugin/notes/notes.js index 72f6a10..63de05a 100644 --- a/plugin/notes/notes.js +++ b/plugin/notes/notes.js @@ -5,7 +5,7 @@ var RevealNotes = (function() { function openNotes() { - var jsFileLocation = document.querySelector('script[src*=notes]').src; // this js file path + var jsFileLocation = document.querySelector('script[src$="notes.js"]').src; // this js file path jsFileLocation = jsFileLocation.replace(/notes\.js(\?.*)?$/, ''); // the js folder path var notesPopup = window.open( jsFileLocation + 'notes.html', 'reveal.js - Notes', 'width=1120,height=850' ); -- cgit v1.2.3 From f095af212ee2b6009412a89fe17ae46860efd8df Mon Sep 17 00:00:00 2001 From: asmod3us Date: Tue, 26 Feb 2013 16:06:18 +0100 Subject: Update plugin/markdown/markdown.js Use textContent instead of innerHTML to prevent encoding of certain characters in Markdown code blocks.--- plugin/markdown/markdown.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'plugin') diff --git a/plugin/markdown/markdown.js b/plugin/markdown/markdown.js index ae4d08b..39e1168 100644 --- a/plugin/markdown/markdown.js +++ b/plugin/markdown/markdown.js @@ -11,7 +11,7 @@ var template = section.querySelector( 'script' ); // strip leading whitespace so it isn't evaluated as code - var text = ( template || section ).innerHTML; + var text = ( template || section ).textContent; var leadingWs = text.match(/^\n?(\s*)/)[1].length, leadingTabs = text.match(/^\n?(\t*)/)[1].length; -- cgit v1.2.3 From f9f17be01473bd80e8f1b6431c6070c4005e1164 Mon Sep 17 00:00:00 2001 From: Hakim El Hattab Date: Wed, 27 Feb 2013 15:01:30 -0500 Subject: merge external markdown support, move example to plugin (#329) --- demo.md | 29 ----------- index-markdown.html | 116 ------------------------------------------- plugin/markdown/example.html | 97 ++++++++++++++++++++++++++++++++++++ plugin/markdown/example.md | 29 +++++++++++ 4 files changed, 126 insertions(+), 145 deletions(-) delete mode 100644 demo.md delete mode 100644 index-markdown.html create mode 100644 plugin/markdown/example.html create mode 100644 plugin/markdown/example.md (limited to 'plugin') diff --git a/demo.md b/demo.md deleted file mode 100644 index 1efe5f9..0000000 --- a/demo.md +++ /dev/null @@ -1,29 +0,0 @@ -# External markdown - - - -## Slide 1.1 - -Content 1.1 - - -## Slide 1.2 - -Content 1.2 - - - -## Slide 2 - -Content 2.1 - - - -## Slide 3.1 - -Content 3.1 - - -## Slide 3.2 - -Content 3.2 diff --git a/index-markdown.html b/index-markdown.html deleted file mode 100644 index 367c879..0000000 --- a/index-markdown.html +++ /dev/null @@ -1,116 +0,0 @@ - - - - - - - reveal.js - The HTML Presentation Framework - - - - - - - - - - - - - - - - - - - - - -
    - - -
    - - -
    - - -
    - -
    - - -
    - -
    - - -
    - -
    - -
    -
    - - - - - - - - diff --git a/plugin/markdown/example.html b/plugin/markdown/example.html new file mode 100644 index 0000000..b4e7f91 --- /dev/null +++ b/plugin/markdown/example.html @@ -0,0 +1,97 @@ + + + + + + + reveal.js - Markdown Demo + + + + + + + +
    + +
    + + +
    + + +
    + +
    + + +
    + +
    + + +
    + +
    + +
    +
    + + + + + + + + diff --git a/plugin/markdown/example.md b/plugin/markdown/example.md new file mode 100644 index 0000000..e988dd9 --- /dev/null +++ b/plugin/markdown/example.md @@ -0,0 +1,29 @@ +# Markdown Demo + + + +## External 1.1 + +Content 1.1 + + +## External 1.2 + +Content 1.2 + + + +## External 2 + +Content 2.1 + + + +## External 3.1 + +Content 3.1 + + +## External 3.2 + +Content 3.2 -- cgit v1.2.3 From d7b92c9c6581dd33567a03bc2f0a3c7f4d5c305d Mon Sep 17 00:00:00 2001 From: Hakim El Hattab Date: Wed, 27 Feb 2013 16:55:42 -0500 Subject: update main window when current slide changes in notes (closes #343) --- plugin/notes/notes.html | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'plugin') diff --git a/plugin/notes/notes.html b/plugin/notes/notes.html index 50d172a..e14c6ac 100644 --- a/plugin/notes/notes.html +++ b/plugin/notes/notes.html @@ -225,6 +225,13 @@ }, 1000 ); + // Navigate the main window when the notes slide changes + currentSlide.contentWindow.Reveal.addEventListener( 'slidechanged', function( event ) { + + window.opener.Reveal.slide( event.indexh, event.indexv ); + + } ); + } else { -- cgit v1.2.3