# Radialize the colors
Highcharts.setOptions
colors: [
'#96000F'
'#E10019'
'#AAA5A0'
'#46413C'
'#327D91'
'#4BBEE1'
'#560F32'
'#821350'
'#006450'
'#009682'
'#697D19'
'#9BC328'
'#AA5500'
'#FF8200'
]
credits:
enabled: true
legend:
enabled: false
tooltip:
enabled: false
title:
text: ''
chart:
backgroundColor: 'rgba(0,0,0,0)'
plotBackgroundColor: null
plotBorderWidth: null
plotShadow: false
margin: [0, 0, 0, 0]
style:
fontFamily: 'Open Sans Light'
fontSize: '20px'
color: 'black'
Highcharts.getOptions().colors = Highcharts.map Highcharts.getOptions().colors, (color) ->
radialGradient:
cx: 0.5
cy: 0.3
r: 0.7
stops: [
[0, color]
[1, Highcharts.Color(color).brighten(-0.3).get('rgb')] # darken
]
$.fn.extend
typewriter: ->
this.each ->
$el = $(this)
str = $el.text()
progress = 0
$el.text('')
timer = setInterval ->
$el.text(str.substring(0, progress) + '_')
if progress >= str.length
clearInterval(timer)
$el.text(str)
progress++
, 100
this
textfill: (maxFontSize, maxWords) ->
maxFontSize = parseInt(maxFontSize, 10) || 0
maxWords = parseInt(maxWords, 10) || 3
@each ->
calcSize = (text) ->
ourText = $("" + text + "").appendTo(self)
multiplier = maxWidth / ourText.width()
newSize = fontSize * (multiplier - 0.1)
ourText.css "fontSize", (if maxFontSize > 0 and newSize > maxFontSize then maxFontSize else newSize)
ourText.css "lineHeight", "1em"
#ourText.css "textTransform", "uppercase"
scrollHeight = self[0].scrollHeight
if scrollHeight > maxHeight
multiplier = maxHeight / scrollHeight
newSize = newSize * multiplier
ourText.css "fontSize", (if maxFontSize > 0 and newSize > maxFontSize then maxFontSize else newSize)
ourText.css "lineHeight", "1em"
#ourText.css "textTransform", "uppercase"
return
self = $(this)
orgText = self.text()
fontSize = parseInt(self.css("fontSize"), 10)
#lineHeight = parseInt(self.css("lineHeight"), "1em")
maxHeight = self.height()
maxWidth = self.width()
splittedText = self.html().split(/\s+|<.+?>/)
words = []
for word in splittedText
words.push(word) if word && !word.empty?
self.empty()
if words.length > maxWords
while words.length > 0
newText = words.splice(0, maxWords).join(" ")
console.log
calcSize newText
self.append "
"
else
calcSize orgText
return
class Transform
@body = document.body
@getScaleFactor: ->
denominator = Math.max(@body.clientWidth / window.innerWidth, @body.clientHeight / window.innerHeight)
1 / denominator
@apply: (transform) ->
@body.style.WebkitTransform = transform
@body.style.MozTransform = transform
@body.style.msTransform = transform
@body.style.OTransform = transform
@body.style.transform = transform
@scale: ->
Transform.apply("scale(/#{@getScaleFactor()})")
@reset: ->
Transform.apply('none')
class Mode
@body = document.body
@dispatchSingleSlideMode: (e) ->
slideId = Mode.findSlideId(e.target)
presentSlideId = slideId?
if presentSlideId and Mode.isListMode()
Mode.enterSlideMode()
slide = Slide.fromSlideId(slideId)
slide.goto()
slide.replaceHistory()
@enterSlideMode: ->
@body.className = "full"
Transform.scale()
@enterListMode: ->
@body.className = "list"
Transform.reset()
@isListMode: ->
!@body.classList.contains("full")
@isSlideMode: ->
!Mode.isListMode()
@switchToListMode: ->
Mode.enterListMode()
slide = Slide.current()
slide.pushHistory()
slide.scrollTo()
@switchToSlideMode: ->
Mode.enterSlideMode()
slide = Slide.current()
slide.pushHistory()
slide.updateProgress()
@reload: ->
Slide.current() || Slide.first().goto()
if window.location.search.substr(1) is 'full'
Mode.enterSlideMode()
#Slide.current().updateProgress()
else
Mode.enterListMode()
Slide.current()?.scrollTo()
# private
# go up to element with class "slide" and return its id
@findSlideId: (node) ->
while "BODY" isnt node.nodeName and "HTML" isnt node.nodeName
return node.id if node.classList.contains("slide")
node = node.parentNode
null
class SlideInitializer
@init: ->
# SlideInitializer.initMouseClick()
$slides = $('.slide').not('.disabled')
totalSize = $slides.length
for slide in $slides
SlideInitializer.initSlideNumber(slide, totalSize)
SlideInitializer.initIncremental(slide)
SlideInitializer.initPause(slide)
SlideInitializer.initTypewriter(slide)
@initMouseClick: ->
# left click
$('body').click (e) ->
if e.which == 1
e.preventDefault()
UserInterface.nextStep()
# right click
$('body').on 'contextmenu', (e) ->
e.preventDefault()
UserInterface.prevStep()
@initSlideNumber: (slide, total) ->
slideNum = $(slide).index() - $(slide).prevAll('.slide.disabled').length
$(slide).attr('data-slide', slideNum).attr('data-slides', total)
@initIncremental: (slide) ->
$slide = $(slide)
if $slide.hasClass('incr-list')
$slide.find('> div > ul > li:first-child').addClass('current')
$slide.find('> div > ol > li:first-child').addClass('current')
$slide.find('> div > ul > li:not(:first-child)').addClass('inactive')
$slide.find('> div > ol > li:not(:first-child)').addClass('inactive')
if $slide.hasClass('incr-code')
$slide.find('pre > code:first-child').addClass('current')
$slide.find('pre > code:not(:first-child)').addClass('inactive')
if $slide.hasClass('incr-table')
$slide.find('table > tbody > tr:first-child').addClass('current')
$slide.find('table > tbody > tr:not(:first-child)').addClass('inactive')
@initPause: (slide) ->
pauses = $(slide).find(".pause")
for pause, i in pauses
last = i == pauses.length - 1
if last
wrappable = $(pause).nextAll()
else
wrappable = $(pause).nextUntil(".pause")
wrappable?.wrapAll('