-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Valentin Vasilyev
committed
Apr 29, 2015
1 parent
330f37a
commit 60951f1
Showing
17 changed files
with
2,352 additions
and
833 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
/*[class*="bg-solid"] { | ||
border: 1px solid rgba(0, 0, 0, .3); | ||
box-shadow: 0 2px 6px rgba(0, 0, 0, .4); | ||
text-shadow: 0 2px 2px rgba(0, 0, 0, .3); | ||
}*/ | ||
|
||
|
||
.bg-default { | ||
background: -webkit-radial-gradient(#F0F0F0, #BEBEBE); | ||
background: -moz-radial-gradient(#F0F0F0, #BEBEBE); | ||
background: -ms-radial-gradient(#F0F0F0, #BEBEBE); | ||
background: -o-radial-gradient(#F0F0F0, #BEBEBE); | ||
background: radial-gradient(#F0F0F0, #BEBEBE); | ||
} | ||
|
||
/* | ||
included for legacy support of old decks with the defaultbg attribute set. | ||
*/ | ||
.defaultbg { | ||
background: -webkit-radial-gradient(#F0F0F0, #BEBEBE); | ||
background: -moz-radial-gradient(#F0F0F0, #BEBEBE); | ||
background: -ms-radial-gradient(#F0F0F0, #BEBEBE); | ||
background: -o-radial-gradient(#F0F0F0, #BEBEBE); | ||
background: radial-gradient(#F0F0F0, #BEBEBE); | ||
} | ||
|
||
.bg-solid-orange { | ||
background-color: #774040; | ||
} | ||
|
||
.bg-solid-black { | ||
background-color: #222; | ||
} | ||
|
||
.bg-solid-light { | ||
background-color: white; | ||
} | ||
|
||
.bg-solid-smoke { | ||
background-color: #DDD; | ||
} | ||
|
||
.bg-solid-yellow { | ||
background-color: #D1B377; | ||
} | ||
|
||
.bg-solid-grass { | ||
background-color: #597847; | ||
} | ||
|
||
.bg-solid-darkgreen { | ||
background-color: #134952; | ||
} | ||
|
||
.bg-solid-sky { | ||
background-color: #515E99; | ||
} | ||
|
||
.bg-solid-lavender { | ||
background-color: #443C4D; | ||
} | ||
|
||
.bg-solid-purple { | ||
background-color: #6C478F; | ||
} | ||
|
||
.bg-solid-salmon { | ||
background-color: #C98D8D; | ||
} | ||
|
||
.nobg { | ||
background: url(img/nobg.png); | ||
background-size: 40px 40px; | ||
} | ||
|
||
.themeProviders .thumbnail { | ||
height: 20px; | ||
width: 20px; | ||
padding: 10px; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
/*! | ||
* bespoke-hash v0.1.2 | ||
* | ||
* Copyright 2013, Mark Dalgleish | ||
* This content is released under the MIT license | ||
* http://mit-license.org/markdalgleish | ||
*/ | ||
|
||
(function(bespoke) { | ||
|
||
bespoke.plugins.hash = function(deck) { | ||
var activeIndex, | ||
|
||
parseHash = function() { | ||
var hash = window.location.hash.slice(1), | ||
slideNumberOrName = parseInt(hash, 10); | ||
|
||
if (hash) { | ||
if (slideNumberOrName) { | ||
activateSlide(slideNumberOrName - 1); | ||
} else { | ||
deck.slides.forEach(function(slide, i) { | ||
slide.getAttribute('data-bespoke-hash') === hash && activateSlide(i); | ||
}); | ||
} | ||
} | ||
}, | ||
|
||
activateSlide = function(index) { | ||
if (index !== activeIndex) { | ||
deck.slide(index); | ||
} | ||
}; | ||
|
||
setTimeout(function() { | ||
parseHash(); | ||
|
||
deck.on('activate', function(e) { | ||
var slideName = e.slide.getAttribute('data-bespoke-hash'); | ||
window.location.hash = slideName || e.index + 1; | ||
activeIndex = e.index; | ||
}); | ||
|
||
window.addEventListener('hashchange', parseHash); | ||
}, 0); | ||
}; | ||
|
||
}(bespoke)); | ||
|
||
/*! | ||
* bespoke-state v0.2.2 | ||
* | ||
* Copyright 2013, Mark Dalgleish | ||
* This content is released under the MIT license | ||
* http://mit-license.org/markdalgleish | ||
*/ | ||
|
||
(function(bespoke) { | ||
|
||
bespoke.plugins.state = function(deck) { | ||
var modifyState = function(method, event) { | ||
var attr = event.slide.getAttribute('data-bespoke-state'); | ||
|
||
if (attr) { | ||
attr.split(' ').forEach(function(state) { | ||
state && deck.parent.classList[method](state); | ||
}); | ||
} | ||
}; | ||
|
||
deck.on('activate', modifyState.bind(null, 'add')); | ||
deck.on('deactivate', modifyState.bind(null, 'remove')); | ||
}; | ||
|
||
}(bespoke)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,187 @@ | ||
/*! | ||
* Bespoke.js v0.3.1 | ||
* | ||
* Copyright 2013, Mark Dalgleish | ||
* This content is released under the MIT license | ||
* http://mit-license.org/markdalgleish | ||
*/ | ||
|
||
(function(moduleName, window) { | ||
var from = function(selectorOrElement, selectedPlugins) { | ||
var parent = selectorOrElement.blur ? selectorOrElement : document.querySelector(selectorOrElement), | ||
slides = [].slice.call(parent.children, 0), | ||
activeSlide = slides[0], | ||
listeners = {}, | ||
|
||
activate = function(index, customData) { | ||
if (!slides[index]) { | ||
return; | ||
} | ||
|
||
fire('deactivate', createEventData(activeSlide, customData)); | ||
|
||
activeSlide = slides[index]; | ||
|
||
slides.map(deactivate); | ||
|
||
fire('activate', createEventData(activeSlide, customData)); | ||
|
||
addClass(activeSlide, 'active'); | ||
removeClass(activeSlide, 'inactive'); | ||
}, | ||
|
||
deactivate = function(slide, index) { | ||
var offset = index - slides.indexOf(activeSlide), | ||
offsetClass = offset > 0 ? 'after' : 'before'; | ||
|
||
['before(-\\d+)?', 'after(-\\d+)?', 'active', 'inactive'].map(removeClass.bind(0, slide)); | ||
|
||
slide != activeSlide && | ||
['inactive', offsetClass, offsetClass + '-' + Math.abs(offset)].map(addClass.bind(0, slide)); | ||
}, | ||
|
||
slide = function(index, customData) { | ||
fire('slide', createEventData(slides[index], customData)) && activate(index, customData); | ||
}, | ||
|
||
step = function(offset, customData) { | ||
var slideIndex = slides.indexOf(activeSlide) + offset; | ||
|
||
fire(offset > 0 ? 'next' : 'prev', createEventData(activeSlide, customData)) && activate(slideIndex, customData); | ||
}, | ||
|
||
on = function(eventName, callback) { | ||
(listeners[eventName] || (listeners[eventName] = [])).push(callback); | ||
|
||
return function() { | ||
listeners[eventName] = listeners[eventName].filter(function(listener) { | ||
return listener != callback; | ||
}); | ||
}; | ||
}, | ||
|
||
fire = function(eventName, eventData) { | ||
return (listeners[eventName] || []) | ||
.reduce(function(notCancelled, callback) { | ||
return notCancelled && callback(eventData) !== false; | ||
}, true); | ||
}, | ||
|
||
createEventData = function(slide, eventData) { | ||
eventData = eventData || {}; | ||
eventData.index = slides.indexOf(slide); | ||
eventData.slide = slide; | ||
return eventData; | ||
}, | ||
|
||
deck = { | ||
on: on, | ||
fire: fire, | ||
slide: slide, | ||
next: step.bind(0, 1), | ||
prev: step.bind(0, -1), | ||
parent: parent, | ||
slides: slides | ||
}; | ||
|
||
addClass(parent, 'parent'); | ||
|
||
slides.map(function(slide) { | ||
addClass(slide, 'slide'); | ||
}); | ||
|
||
for (var pluginName in selectedPlugins) { | ||
plugins[pluginName](deck, selectedPlugins[pluginName]); | ||
} | ||
|
||
activate(0); | ||
|
||
decks.push(deck); | ||
|
||
return deck; | ||
}, | ||
|
||
decks = [], | ||
|
||
addClass = function(el, cls) { | ||
el.classList.add(moduleName + '-' + cls); | ||
}, | ||
|
||
removeClass = function(el, cls) { | ||
el.className = el.className | ||
.replace(RegExp(moduleName + '-' + cls +'(\\s|$)', 'g'), ' ') | ||
.trim(); | ||
}, | ||
|
||
callOnAllDecks = function(method) { | ||
return function(arg) { | ||
decks.map(function(deck) { | ||
deck[method](arg); | ||
}); | ||
}; | ||
}, | ||
|
||
bindPlugin = function(pluginName) { | ||
return { | ||
from: function(selectorOrElement, selectedPlugins) { | ||
(selectedPlugins = selectedPlugins || {})[pluginName] = true; | ||
return from(selectorOrElement, selectedPlugins); | ||
} | ||
}; | ||
}, | ||
|
||
makePluginForAxis = function(axis) { | ||
return function(deck) { | ||
var startPosition, | ||
delta; | ||
|
||
document.addEventListener('keydown', function(e) { | ||
( | ||
e.which == 34 || // PAGE DOWN | ||
e.which == 32 || // SPACE | ||
axis == 'X' && e.which == 39 || // RIGHT | ||
axis == 'Y' && e.which == 40 // BOTTOM | ||
) && deck.next(); | ||
( | ||
e.which == 33 || // PAGE UP | ||
axis == 'X' && e.which == 37 || // LEFT | ||
axis == 'Y' && e.which == 38 // TOP | ||
) && deck.prev(); | ||
}); | ||
|
||
deck.parent.addEventListener('touchstart', function(e) { | ||
if (e.touches.length == 1) { | ||
startPosition = e.touches[0]['page' + axis]; | ||
delta = 0; | ||
} | ||
}); | ||
|
||
deck.parent.addEventListener('touchmove', function(e) { | ||
if (e.touches.length == 1) { | ||
e.preventDefault(); | ||
delta = e.touches[0]['page' + axis] - startPosition; | ||
} | ||
}); | ||
|
||
deck.parent.addEventListener('touchend', function() { | ||
Math.abs(delta) > 50 && (delta > 0 ? deck.prev() : deck.next()); | ||
}); | ||
}; | ||
}, | ||
|
||
plugins = { | ||
horizontal: makePluginForAxis('X'), | ||
vertical: makePluginForAxis('Y') | ||
}; | ||
|
||
window[moduleName] = { | ||
from: from, | ||
slide: callOnAllDecks('slide'), | ||
next: callOnAllDecks('next'), | ||
prev: callOnAllDecks('prev'), | ||
horizontal: bindPlugin('horizontal'), | ||
vertical: bindPlugin('vertical'), | ||
plugins: plugins | ||
}; | ||
|
||
}('bespoke', window)); |
Oops, something went wrong.