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.
- checksums.yaml +4 -4
- data/presenter.html.haml +17 -10
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2b880e36eb1aaca4d52108e6ed82c7460137a1a3
|
4
|
+
data.tar.gz: 4e3d34dcb96f586781f293977334de37ab01c7c2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
47
|
-
|
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(
|
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(
|
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(
|
75
|
+
var slide = slides.eq(current_slide_index);
|
72
76
|
slide.show();
|
73
77
|
|
74
|
-
$(".current-slide-number").text(
|
75
|
-
location.href = location.href.replace(/#.*|$/, '#' + (
|
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(
|
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
|
-
|