Skip to content

Commit 3212724

Browse files
committed
Adding compass/sass. Fixing slide # logic. Fixing slide # at bottom off slide. Fixigin prettify logic when it is false
1 parent de7412e commit 3212724

File tree

7 files changed

+1650
-99
lines changed

7 files changed

+1650
-99
lines changed

.gitignore

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# Compiled source #
2+
###################
3+
*.com
4+
*.class
5+
*.dll
6+
*.exe
7+
*.o
8+
*.so
9+
*.pyc
10+
*.min.css
11+
#*.min.js
12+
.sass-cache/*
13+
14+
# Packages #
15+
############
16+
# it's better to unpack these files and commit the raw source
17+
# git has its own built in compression methods
18+
*.7z
19+
*.dmg
20+
*.gz
21+
*.iso
22+
*.rar
23+
*.tar
24+
*.zip
25+
26+
# Logs and databases #
27+
######################
28+
*.log
29+
*.sql
30+
*.sqlite
31+
32+
# OS generated files #
33+
######################
34+
.DS_Store*
35+
ehthumbs.db
36+
Icon?
37+
Thumbs.db
38+
*~

config.rb

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Require any additional compass plugins here.
2+
3+
# Set this to the root of your project when deployed:
4+
http_path = "/"
5+
css_dir = "theme/css"
6+
sass_dir = "theme/sass"
7+
images_dir = "images"
8+
javascripts_dir = "js"
9+
10+
# You can select your preferred output style here (can be overridden via the command line):
11+
#output_style = :compressed #:expanded or :nested or :compact or :compressed
12+
13+
# To enable relative paths to assets via compass helper functions. Uncomment:
14+
# relative_assets = true
15+
16+
# To disable debugging comments that display the original location of your selectors. Uncomment:
17+
# line_comments = false
18+
19+
20+
# If you prefer the indented syntax, you might want to regenerate this
21+
# project again passing --syntax sass, or you can uncomment this:
22+
# preferred_syntax = :sass
23+
# and then run:
24+
# sass-convert -R --from scss --to sass sass scss && rm -rf sass && mv scss sass

slides.js renamed to js/slides.js

Lines changed: 37 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,14 @@ function SlideDeck() {
1616
* @const
1717
* @private
1818
*/
19-
SlideDeck.prototype.SLIDE_CLASSES_ = ['far-past', 'past', 'current', 'next',
20-
'far-next'];
19+
SlideDeck.prototype.SLIDE_CLASSES_ = [
20+
'far-past', 'past', 'current', 'next', 'far-next'];
21+
22+
/**
23+
* @const
24+
* @private
25+
*/
26+
SlideDeck.prototype.CSS_DIR_ = 'theme/css/';
2127

2228
/**
2329
* @private
@@ -26,7 +32,9 @@ SlideDeck.prototype.getCurrentSlideFromHash_ = function() {
2632
var slideNo = parseInt(document.location.hash.substr(1));
2733

2834
if (slideNo) {
29-
this.curSlide_ = slideNo;
35+
this.curSlide_ = slideNo - 1;
36+
} else {
37+
this.curSlide_ = 0;
3038
}
3139
};
3240

@@ -36,6 +44,11 @@ SlideDeck.prototype.getCurrentSlideFromHash_ = function() {
3644
SlideDeck.prototype.handleDomLoaded_ = function() {
3745
this.slides_ = document.querySelectorAll('slide:not(.hidden)');
3846

47+
for (var i = 0, slide; slide = this.slides_[i]; ++i) {
48+
slide.dataset.slideNum = i + 1;
49+
slide.dataset.totalSlides = this.slides_.length;
50+
}
51+
3952
// Load config
4053
this.loadConfig_();
4154
this.addEventListeners_();
@@ -150,8 +163,9 @@ SlideDeck.prototype.loadConfig_ = function() {
150163
document.title = settings.title;
151164
}
152165

153-
if (settings.usePrettify || true) {
166+
if (!!!('usePrettify' in settings) || settings.usePrettify) {
154167
console.log('Use prettify');
168+
//TODO
155169
}
156170

157171
if (settings.analyticsId) {
@@ -216,7 +230,7 @@ SlideDeck.prototype.buildNextItem_ = function() {
216230
* @param {boolean=} opt_dontPush
217231
*/
218232
SlideDeck.prototype.prevSlide = function(opt_dontPush) {
219-
if (this.curSlide_ > 1) {
233+
if (this.curSlide_ > 0) {
220234
this.curSlide_--;
221235

222236
this.updateSlides_(opt_dontPush);
@@ -336,13 +350,25 @@ SlideDeck.prototype.disableFrame_ = function(frame) {
336350
frame.src = 'about:blank';
337351
};
338352

353+
/**
354+
* @private
355+
* @param {number} slideNo
356+
*/
357+
SlideDeck.prototype.getSlideEl_ = function(no) {
358+
if ((no < 0) || (no >= this.slides_.length)) {
359+
return null;
360+
} else {
361+
return this.slides_[no];
362+
}
363+
};
364+
339365
/**
340366
* @private
341367
* @param {number} slideNo
342368
* @param {string} className
343369
*/
344370
SlideDeck.prototype.updateSlideClass_ = function(slideNo, className) {
345-
var el = this.slides_[slideNo - 1];
371+
var el = this.getSlideEl_(slideNo);
346372

347373
if (!el) {
348374
return;
@@ -382,9 +408,10 @@ SlideDeck.prototype.makeBuildLists_ = function () {
382408
*/
383409
SlideDeck.prototype.updateHash_ = function(dontPush) {
384410
if (!dontPush) {
385-
var hash = '#' + this.curSlide_;
411+
var slideNo = this.curSlide_ + 1;
412+
var hash = '#' + slideNo;
386413
if (window.history.pushState) {
387-
window.history.pushState(this.curSlide_, 'Slide ' + this.curSlide_, hash);
414+
window.history.pushState(this.curSlide_, 'Slide ' + slideNo, hash);
388415
} else {
389416
window.location.replace(hash);
390417
}
@@ -411,13 +438,13 @@ SlideDeck.prototype.addFavIcon_ = function(favIcon) {
411438
* @param {string} theme
412439
*/
413440
SlideDeck.prototype.loadTheme_ = function(theme) {
414-
var styles = ['base', theme];
441+
var styles = [theme];
415442
for (var i = 0, style; themeUrl = styles[i]; i++) {
416443
var style = document.createElement('link');
417444
style.rel = 'stylesheet';
418445
style.type = 'text/css';
419446
if (themeUrl.indexOf('http') == -1) {
420-
style.href = 'theme/' + themeUrl + '.css';
447+
style.href = this.CSS_DIR_ + themeUrl + '.css';
421448
} else {
422449
style.href = themeUrl;
423450
}

template.html

Lines changed: 59 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -1,69 +1,69 @@
11
<!DOCTYPE html>
22
<html>
3-
<head>
4-
<title>Title</title>
5-
<meta charset="utf-8">
6-
<meta http-equiv="X-UA-Compatible" content="chrome=1">
7-
</head>
8-
<body style="display: none">
9-
<slides>
10-
<slide>
11-
A Slide
12-
</slide>
3+
<head>
4+
<title>Title</title>
5+
<meta charset="utf-8">
6+
<meta http-equiv="X-UA-Compatible" content="chrome=1">
7+
</head>
8+
<body style="display: none">
9+
<slides>
10+
<slide>
11+
A Slide
12+
</slide>
1313

14-
<slide>
15-
A Slide
16-
</slide>
14+
<slide>
15+
A Slide
16+
</slide>
1717

18-
<slide>
19-
A Slide
20-
</slide>
18+
<slide>
19+
A Slide
20+
</slide>
2121

22-
<slide>
23-
A Slide
24-
</slide>
25-
</slides>
22+
<slide>
23+
A Slide
24+
</slide>
25+
</slides>
2626

27-
<script type="text/slide-config">
28-
var slideConfig = {
29-
// Slide settings
30-
settings: {
31-
title: 'A Fancy Slide Deck',
32-
theme: 'default',
33-
hashtag: '#html5', //TODO
34-
useBuilds: true,
35-
usePrettify: true, // TODO
36-
enableSideAreas: true, //TODO
37-
analytics: 'UA-25678279-1',
38-
favIcon:
39-
'http://tokyo.bleedinghtml5.appspot.com/images/chrome-logo-tiny2.png',
40-
onLoad: null, // TODO. function to call onload
41-
fonts: [
42-
'Open Sans:regular,semibold,italic,italicsemibold',
43-
'Droid Sans Mono'
44-
]
45-
},
27+
<script type="text/slide-config">
28+
var slideConfig = {
29+
// Slide settings
30+
settings: {
31+
title: 'A Fancy Slide Deck',
32+
theme: 'default',
33+
hashtag: '#html5', //TODO
34+
useBuilds: true,
35+
usePrettify: true,
36+
enableSideAreas: true, //TODO
37+
analytics: 'UA-25678279-1',
38+
favIcon:
39+
'http://tokyo.bleedinghtml5.appspot.com/images/chrome-logo-tiny2.png',
40+
onLoad: null, // TODO. function to call onload
41+
fonts: [
42+
'Open Sans:regular,semibold,italic,italicsemibold',
43+
'Droid Sans Mono'
44+
]
45+
},
4646

47-
// Author information
48-
author: [{
49-
name: 'Luke Mahe',
50-
gplus: 'http://www.google.com'
51-
}, {
52-
name: 'Marcin Wichary',
53-
gplus: 'http://www.google.com'
54-
}, {
55-
name: 'Eric Bidelman',
56-
gplus: 'http://www.google.com'
57-
}]
58-
};
59-
</script>
47+
// Author information
48+
author: [{
49+
name: 'Luke Mahe',
50+
gplus: 'http://www.google.com'
51+
}, {
52+
name: 'Marcin Wichary',
53+
gplus: 'http://www.google.com'
54+
}, {
55+
name: 'Eric Bidelman',
56+
gplus: 'http://plus.ericbidelman.com'
57+
}]
58+
};
59+
</script>
6060

61-
<script src="slides.js"></script>
61+
<script src="js/slides.js"></script>
6262

63-
<!-- Add to slides.js -->
64-
<!--[if IE]>
65-
<script src="http://ajax.googleapis.com/ajax/libs/chrome-frame/1/CFInstall.min.js"></script>
66-
<script>CFInstall.check({mode: 'overlay'});</script>
67-
<![endif]-->
68-
</body>
63+
<!-- Add to slides.js -->
64+
<!--[if IE]>
65+
<script src="http://ajax.googleapis.com/ajax/libs/chrome-frame/1/CFInstall.min.js"></script>
66+
<script>CFInstall.check({mode: 'overlay'});</script>
67+
<![endif]-->
68+
</body>
6969
</html>

0 commit comments

Comments
 (0)