alongslide 0.9.8 → 0.9.9
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
ZjhiZDM3YTNiNWYyYWI0N2IzNGIwNGU1ZmEyOWMyZjkyZTg1NjZiYQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
YmMxZGM2YWJlMzQwYjRkYjc2Y2E3YmM1MTM1M2Q2NjFiYWNmY2ZjYg==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
OTNjZGZiNDA0YzJhYjc0NDEzYmFiNThiOTUwM2JjYjhhMjFmNDJmYTNhOWRl
|
10
|
+
MjYyZmNkYWMwZWMwZDBiNjk1NDFmNzhhM2QxZTAwODE3YzQwYzM4MmMyNjlh
|
11
|
+
MTBmZTU5MjU5ZTcwYmI4NTZhMDhjNGI0ZTc1OWFlNDA2MTg1Y2Q=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
YWE3MjYxZDQyMGZiYWIwNTM3NmIzMmVhODEyMWIwNzBhYzI0MmY5NWE1NjFj
|
14
|
+
NmRjNzY5MDZlZWY4YTczMjZjYTRmZDIwNDdlZDc4MDk2MTRlMmViYjQyZGE4
|
15
|
+
NmNjYWE1YmNmN2QxMWZhNjcwNmI5NzMzNDFlODk0ZWRhNjlkY2I=
|
data/alongslide.gemspec
CHANGED
@@ -17,6 +17,7 @@ class Alongslide
|
|
17
17
|
@source = $(options.source) ? $('#content .raw')
|
18
18
|
@frames = $(options.to) ? $('#frames')
|
19
19
|
@regionCls = options.regionCls ? 'column'
|
20
|
+
@marginTop = options.marginTop ? 0
|
20
21
|
|
21
22
|
RegionFlow::init()
|
22
23
|
|
@@ -47,7 +48,7 @@ class Alongslide
|
|
47
48
|
# @param postRenderCallback - to be called when layout returns
|
48
49
|
#
|
49
50
|
render: (postRenderCallback) ->
|
50
|
-
frameAspect = FixedAspect.prototype.fitFrame(@layout.FRAME_WIDTH)
|
51
|
+
frameAspect = FixedAspect.prototype.fitFrame(@layout.FRAME_WIDTH, @marginTop)
|
51
52
|
@layout.render (lastFramePosition) =>
|
52
53
|
|
53
54
|
@lastFramePosition = lastFramePosition
|
@@ -66,7 +67,7 @@ class Alongslide
|
|
66
67
|
# Refresh Skrollr only on resize events, as it's fast.
|
67
68
|
#
|
68
69
|
refresh: ->
|
69
|
-
frameAspect = FixedAspect.prototype.fitFrame(@layout.FRAME_WIDTH)
|
70
|
+
frameAspect = FixedAspect.prototype.fitFrame(@layout.FRAME_WIDTH, @marginTop)
|
70
71
|
@scrolling.render(frameAspect, @lastFramePosition)
|
71
72
|
FixedAspect.prototype.fitPanels(frameAspect)
|
72
73
|
|
@@ -83,16 +84,32 @@ class Alongslide
|
|
83
84
|
# Sanitize Markdown generated HTML
|
84
85
|
applyFootnotes: ->
|
85
86
|
# For each footnote in the article
|
86
|
-
@frames.find('
|
87
|
+
@frames.find('.als-fn-ref').each (i, el) =>
|
87
88
|
# Reference the footnote
|
88
89
|
$el = $(el)
|
89
|
-
# Find the
|
90
|
-
$footnote = @footnotes.find($el.
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
90
|
+
# Find the footnote text
|
91
|
+
$footnote = @footnotes.find($el.data('anchor'))
|
92
|
+
|
93
|
+
# Append the footnote text element to the column
|
94
|
+
$column = $el.parents('.column')
|
95
|
+
$column.append($footnote)
|
96
|
+
|
97
|
+
# place footnote, prevent placing offscreen
|
98
|
+
bottom = $column.height() + $column.offset().top
|
99
|
+
if ($el.offset().top + $footnote.height()) > bottom
|
100
|
+
$footnote.css('bottom', 0)
|
101
|
+
else
|
102
|
+
$footnote.css('top', $el.parent().position().top )
|
103
|
+
|
104
|
+
$el.on "mouseenter click", (e) ->
|
105
|
+
e.preventDefault()
|
106
|
+
e.stopImmediatePropagation()
|
107
|
+
$footnote.fadeIn(150)
|
108
|
+
false
|
109
|
+
|
110
|
+
$footnote.on "mouseleave click", (e) ->
|
111
|
+
setTimeout ( ()-> $footnote.fadeOut(150) ), 100
|
112
|
+
false
|
96
113
|
|
97
114
|
applyAnchorScrolling: ->
|
98
115
|
self = @
|
@@ -76,6 +76,9 @@ class Alongslide::Layout
|
|
76
76
|
@setPositionOf background, to: @nextFramePosition() if background.length
|
77
77
|
background.addClass('unstaged')
|
78
78
|
|
79
|
+
# Reset section index before building another section
|
80
|
+
@currentSectionFlowIndex = 0
|
81
|
+
|
79
82
|
@renderFrame(flowName)
|
80
83
|
|
81
84
|
# Render one frame and its containing columns.
|
@@ -93,6 +96,10 @@ class Alongslide::Layout
|
|
93
96
|
while frame.find('.'+@regionCls).length < @numFrameColumns(frame)
|
94
97
|
column = @buildRegion frame, flowName
|
95
98
|
|
99
|
+
# Give each section flow an index
|
100
|
+
@currentSectionFlowIndex++
|
101
|
+
column.find('.section').attr('data-section-flow-idx', @currentSectionFlowIndex)
|
102
|
+
|
96
103
|
# Move three-columns class from .section to .frame
|
97
104
|
hasThreeColumns = (column.children('.three-columns').length)
|
98
105
|
if hasThreeColumns
|
@@ -114,12 +114,12 @@ class Alongslide::Parser
|
|
114
114
|
background = idElement.clone().addClass('background frame').html(" ")
|
115
115
|
@backgrounds.push(background)
|
116
116
|
|
117
|
-
# Search for footntes as formatted by Redcarpet
|
117
|
+
# Search for footntes as formatted by Redcarpet's footnotes callback
|
118
118
|
#
|
119
119
|
# Each has an ID of the form `fn1`, which corresponds to the links in the
|
120
120
|
# footnote references.
|
121
121
|
#
|
122
|
-
# Returns a
|
122
|
+
# Returns a DOM node whose child elements are footnote definitions and removes the generated footnotes from DOM
|
123
123
|
collectFootnotes: ->
|
124
|
-
@source.find('.footnotes:last
|
125
|
-
.remove()
|
124
|
+
@source.find('.als-footnotes:last')
|
125
|
+
.remove()
|
@@ -23,6 +23,21 @@ module Redcarpet
|
|
23
23
|
::Alongslide::render_block text
|
24
24
|
end
|
25
25
|
|
26
|
+
def footnote_def(text, number)
|
27
|
+
# example args
|
28
|
+
#
|
29
|
+
# "<p>Here is the text of the footnote</p>\n", 1
|
30
|
+
"<div id='fn#{number}' class='als-footnote'>#{text.insert(3,number.to_s+' ')}</p></div>"
|
31
|
+
end
|
32
|
+
|
33
|
+
def footnotes(text)
|
34
|
+
"<div class='als-footnotes'>"+text+"</div>"
|
35
|
+
end
|
36
|
+
|
37
|
+
def footnote_ref(number)
|
38
|
+
"<sup id='fnref#{number}' class='als-fn-sup'><span class='als-fn-ref' data-anchor='#fn#{number}'>#{number}</span></sup>"
|
39
|
+
end
|
40
|
+
|
26
41
|
end
|
27
42
|
end
|
28
43
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: alongslide
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adam Florin
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-10-
|
12
|
+
date: 2014-10-16 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: redcarpet
|