markdown_presenter 0.5.2 → 0.5.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/presenter.html.haml +17 -10
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7ff2bfb7675f3018cf4a5c19bf28e8f81bba255b
4
- data.tar.gz: 2f1bb85249a65158315051a19f988e7bfcdb01d4
3
+ metadata.gz: 2b880e36eb1aaca4d52108e6ed82c7460137a1a3
4
+ data.tar.gz: 4e3d34dcb96f586781f293977334de37ab01c7c2
5
5
  SHA512:
6
- metadata.gz: 62e581dbe1ec9331714dab8eb106953ef16b44da18e3ed1b5ab85615999a44a99c4d93d72cdc05c1fe6a65a9e9a392775f0bf41a80d0a348cf0fd29e7a76e8f9
7
- data.tar.gz: 42f3fa4397372f917a23337fa9973541cea95dc91ce7db4276386a15876be770e9f5beefb645310032e9e7dab85bf21a2f537ecd643aab026d33668201a41794
6
+ metadata.gz: 64578214b6e8c041a6689ff8785d7d9b28537ac997688cc828e3d41f5e48bf2accd754b848300ea4cffaf5b27f1e341076f1adb09bed36036555465e8b9111bd
7
+ data.tar.gz: 921505ab01c39105fdc17eb6eebb23e0166fd03bc3b10dafd8808462a34d48c9961e6ec0a8723d08f1a2d5aa437560a47ebdd1744022b0c9a5d05d66a0d49648
data/presenter.html.haml CHANGED
@@ -42,13 +42,16 @@
42
42
  :javascript
43
43
  var init = function(){
44
44
  var slides = $(".slide");
45
+ var current_slide_index = 0;
45
46
 
46
- var match = location.href.match(/#(.*)$/);
47
- var current_slide_index = (match && (parseInt(match[1], 10) - 1)) || 0;
47
+ var parseCurrentSlideIndex = function(){
48
+ var match = location.href.match(/#(.*)$/);
49
+ return (match && (parseInt(match[1], 10) - 1)) || 0;
50
+ };
48
51
 
49
52
  var previous = function(){
50
53
  if (current_slide_index === 0) return false;
51
- show(--current_slide_index, function(slide){
54
+ show(current_slide_index - 1, function(slide){
52
55
  slide.css('left', -100);
53
56
  slide.animate({
54
57
  left: parseInt(slide.css('left'), 10) == 0 ? -slide.outerWidth() : 0
@@ -58,7 +61,7 @@
58
61
 
59
62
  var next = function(){
60
63
  if (current_slide_index === (slides.length - 1)) return false;
61
- show(++current_slide_index, function(slide){
64
+ show(current_slide_index + 1, function(slide){
62
65
  slide.css('left', 100);
63
66
  slide.animate({
64
67
  left: parseInt(slide.css('left'), 10) == 0 ? +slide.outerWidth() : 0
@@ -67,12 +70,13 @@
67
70
  };
68
71
 
69
72
  var show = function(index, animation){
73
+ current_slide_index = index || parseCurrentSlideIndex();
70
74
  slides.hide();
71
- var slide = slides.eq(index);
75
+ var slide = slides.eq(current_slide_index);
72
76
  slide.show();
73
77
 
74
- $(".current-slide-number").text(index + 1);
75
- location.href = location.href.replace(/#.*|$/, '#' + (index + 1));
78
+ $(".current-slide-number").text(current_slide_index + 1);
79
+ location.href = location.href.replace(/#.*|$/, '#' + (current_slide_index + 1));
76
80
 
77
81
  if (animation) animation(slide);
78
82
  };
@@ -83,10 +87,15 @@
83
87
  return true;
84
88
  });
85
89
 
86
- show(current_slide_index);
90
+ show();
87
91
 
88
92
  P = {previous:previous, next:next};
89
93
 
94
+ $(window).on('hashchange', function(){
95
+ var parsedIndex = parseCurrentSlideIndex();
96
+ if(parsedIndex !== current_slide_index){ show(parsedIndex); }
97
+ });
98
+
90
99
  var progress_indicator = $(".progress-indicator");
91
100
  progress_indicator.css({ 'opacity' : 0.6 });
92
101
 
@@ -98,5 +107,3 @@
98
107
  };
99
108
 
100
109
  $(document).ready(init);
101
- $(window).on('hashchange', init);
102
-
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: markdown_presenter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.2
4
+ version: 0.5.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matthieu Tanguay-Carel