diff options
-rw-r--r-- | .gitignore | 38 | ||||
-rw-r--r-- | config.rb | 24 | ||||
-rw-r--r-- | js/slides.js (renamed from slides.js) | 47 | ||||
-rw-r--r-- | template.html | 118 | ||||
-rw-r--r-- | theme/css/default.css | 1460 | ||||
-rw-r--r-- | theme/sass/_base.scss (renamed from theme/base.css) | 41 | ||||
-rw-r--r-- | theme/sass/default.scss (renamed from theme/default.css) | 21 |
7 files changed, 1650 insertions, 99 deletions
diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..85db507 --- /dev/null +++ b/.gitignore | |||
@@ -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 | *~ \ No newline at end of file | ||
diff --git a/config.rb b/config.rb new file mode 100644 index 0000000..ed97773 --- /dev/null +++ b/config.rb | |||
@@ -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 | ||
@@ -16,8 +16,14 @@ function SlideDeck() { | |||
16 | * @const | 16 | * @const |
17 | * @private | 17 | * @private |
18 | */ | 18 | */ |
19 | SlideDeck.prototype.SLIDE_CLASSES_ = ['far-past', 'past', 'current', 'next', | 19 | SlideDeck.prototype.SLIDE_CLASSES_ = [ |
20 | 'far-next']; | 20 | 'far-past', 'past', 'current', 'next', 'far-next']; |
21 | |||
22 | /** | ||
23 | * @const | ||
24 | * @private | ||
25 | */ | ||
26 | SlideDeck.prototype.CSS_DIR_ = 'theme/css/'; | ||
21 | 27 | ||
22 | /** | 28 | /** |
23 | * @private | 29 | * @private |
@@ -26,7 +32,9 @@ SlideDeck.prototype.getCurrentSlideFromHash_ = function() { | |||
26 | var slideNo = parseInt(document.location.hash.substr(1)); | 32 | var slideNo = parseInt(document.location.hash.substr(1)); |
27 | 33 | ||
28 | if (slideNo) { | 34 | if (slideNo) { |
29 | this.curSlide_ = slideNo; | 35 | this.curSlide_ = slideNo - 1; |
36 | } else { | ||
37 | this.curSlide_ = 0; | ||
30 | } | 38 | } |
31 | }; | 39 | }; |
32 | 40 | ||
@@ -36,6 +44,11 @@ SlideDeck.prototype.getCurrentSlideFromHash_ = function() { | |||
36 | SlideDeck.prototype.handleDomLoaded_ = function() { | 44 | SlideDeck.prototype.handleDomLoaded_ = function() { |
37 | this.slides_ = document.querySelectorAll('slide:not(.hidden)'); | 45 | this.slides_ = document.querySelectorAll('slide:not(.hidden)'); |
38 | 46 | ||
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 | |||
39 | // Load config | 52 | // Load config |
40 | this.loadConfig_(); | 53 | this.loadConfig_(); |
41 | this.addEventListeners_(); | 54 | this.addEventListeners_(); |
@@ -150,8 +163,9 @@ SlideDeck.prototype.loadConfig_ = function() { | |||
150 | document.title = settings.title; | 163 | document.title = settings.title; |
151 | } | 164 | } |
152 | 165 | ||
153 | if (settings.usePrettify || true) { | 166 | if (!!!('usePrettify' in settings) || settings.usePrettify) { |
154 | console.log('Use prettify'); | 167 | console.log('Use prettify'); |
168 | //TODO | ||
155 | } | 169 | } |
156 | 170 | ||
157 | if (settings.analyticsId) { | 171 | if (settings.analyticsId) { |
@@ -216,7 +230,7 @@ SlideDeck.prototype.buildNextItem_ = function() { | |||
216 | * @param {boolean=} opt_dontPush | 230 | * @param {boolean=} opt_dontPush |
217 | */ | 231 | */ |
218 | SlideDeck.prototype.prevSlide = function(opt_dontPush) { | 232 | SlideDeck.prototype.prevSlide = function(opt_dontPush) { |
219 | if (this.curSlide_ > 1) { | 233 | if (this.curSlide_ > 0) { |
220 | this.curSlide_--; | 234 | this.curSlide_--; |
221 | 235 | ||
222 | this.updateSlides_(opt_dontPush); | 236 | this.updateSlides_(opt_dontPush); |
@@ -339,10 +353,22 @@ SlideDeck.prototype.disableFrame_ = function(frame) { | |||
339 | /** | 353 | /** |
340 | * @private | 354 | * @private |
341 | * @param {number} slideNo | 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 | |||
365 | /** | ||
366 | * @private | ||
367 | * @param {number} slideNo | ||
342 | * @param {string} className | 368 | * @param {string} className |
343 | */ | 369 | */ |
344 | SlideDeck.prototype.updateSlideClass_ = function(slideNo, className) { | 370 | SlideDeck.prototype.updateSlideClass_ = function(slideNo, className) { |
345 | var el = this.slides_[slideNo - 1]; | 371 | var el = this.getSlideEl_(slideNo); |
346 | 372 | ||
347 | if (!el) { | 373 | if (!el) { |
348 | return; | 374 | return; |
@@ -382,9 +408,10 @@ SlideDeck.prototype.makeBuildLists_ = function () { | |||
382 | */ | 408 | */ |
383 | SlideDeck.prototype.updateHash_ = function(dontPush) { | 409 | SlideDeck.prototype.updateHash_ = function(dontPush) { |
384 | if (!dontPush) { | 410 | if (!dontPush) { |
385 | var hash = '#' + this.curSlide_; | 411 | var slideNo = this.curSlide_ + 1; |
412 | var hash = '#' + slideNo; | ||
386 | if (window.history.pushState) { | 413 | if (window.history.pushState) { |
387 | window.history.pushState(this.curSlide_, 'Slide ' + this.curSlide_, hash); | 414 | window.history.pushState(this.curSlide_, 'Slide ' + slideNo, hash); |
388 | } else { | 415 | } else { |
389 | window.location.replace(hash); | 416 | window.location.replace(hash); |
390 | } | 417 | } |
@@ -411,13 +438,13 @@ SlideDeck.prototype.addFavIcon_ = function(favIcon) { | |||
411 | * @param {string} theme | 438 | * @param {string} theme |
412 | */ | 439 | */ |
413 | SlideDeck.prototype.loadTheme_ = function(theme) { | 440 | SlideDeck.prototype.loadTheme_ = function(theme) { |
414 | var styles = ['base', theme]; | 441 | var styles = [theme]; |
415 | for (var i = 0, style; themeUrl = styles[i]; i++) { | 442 | for (var i = 0, style; themeUrl = styles[i]; i++) { |
416 | var style = document.createElement('link'); | 443 | var style = document.createElement('link'); |
417 | style.rel = 'stylesheet'; | 444 | style.rel = 'stylesheet'; |
418 | style.type = 'text/css'; | 445 | style.type = 'text/css'; |
419 | if (themeUrl.indexOf('http') == -1) { | 446 | if (themeUrl.indexOf('http') == -1) { |
420 | style.href = 'theme/' + themeUrl + '.css'; | 447 | style.href = this.CSS_DIR_ + themeUrl + '.css'; |
421 | } else { | 448 | } else { |
422 | style.href = themeUrl; | 449 | style.href = themeUrl; |
423 | } | 450 | } |
diff --git a/template.html b/template.html index 74220cc..3100726 100644 --- a/template.html +++ b/template.html | |||
@@ -1,69 +1,69 @@ | |||
1 | <!DOCTYPE html> | 1 | <!DOCTYPE html> |
2 | <html> | 2 | <html> |
3 | <head> | 3 | <head> |
4 | <title>Title</title> | 4 | <title>Title</title> |
5 | <meta charset="utf-8"> | 5 | <meta charset="utf-8"> |
6 | <meta http-equiv="X-UA-Compatible" content="chrome=1"> | 6 | <meta http-equiv="X-UA-Compatible" content="chrome=1"> |
7 | </head> | 7 | </head> |
8 | <body style="display: none"> | 8 | <body style="display: none"> |
9 | <slides> | 9 | <slides> |
10 | <slide> | 10 | <slide> |
11 | A Slide | 11 | A Slide |
12 | </slide> | 12 | </slide> |
13 | 13 | ||
14 | <slide> | 14 | <slide> |
15 | A Slide | 15 | A Slide |
16 | </slide> | 16 | </slide> |
17 | 17 | ||
18 | <slide> | 18 | <slide> |
19 | A Slide | 19 | A Slide |
20 | </slide> | 20 | </slide> |
21 | 21 | ||
22 | <slide> | 22 | <slide> |
23 | A Slide | 23 | A Slide |
24 | </slide> | 24 | </slide> |
25 | </slides> | 25 | </slides> |
26 | 26 | ||
27 | <script type="text/slide-config"> | 27 | <script type="text/slide-config"> |
28 | var slideConfig = { | 28 | var slideConfig = { |