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
- YmQwYjM1MzE0NDVmMTE0NDc2MDMzMDJiYmU2NTM2MDhjZmJhNWZkMg==
4
+ ZjhiZDM3YTNiNWYyYWI0N2IzNGIwNGU1ZmEyOWMyZjkyZTg1NjZiYQ==
5
5
  data.tar.gz: !binary |-
6
- NGZhNzFkOGE5MWQ1ODNmMmFmZDRhOGEyMDFkZDRiOTVlNTQwMTQyNQ==
6
+ YmMxZGM2YWJlMzQwYjRkYjc2Y2E3YmM1MTM1M2Q2NjFiYWNmY2ZjYg==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- NDhmZjBkMzNhN2I1ZTgwOTkzNjRkYWJiODI0ZWFlYTBhZmE2ZjNhNjlmNmYw
10
- YjQyZmU0NmI0MTBlZmVhNTc0ZWQ4ZTYxYWYzM2U1Zjc5MzQzNGU4ODgzMmQ5
11
- ZmE4NjJkOWY4YjNjMjAxYjM1NmE1YjQwMTM4Y2UwNjdhNWIwODA=
9
+ OTNjZGZiNDA0YzJhYjc0NDEzYmFiNThiOTUwM2JjYjhhMjFmNDJmYTNhOWRl
10
+ MjYyZmNkYWMwZWMwZDBiNjk1NDFmNzhhM2QxZTAwODE3YzQwYzM4MmMyNjlh
11
+ MTBmZTU5MjU5ZTcwYmI4NTZhMDhjNGI0ZTc1OWFlNDA2MTg1Y2Q=
12
12
  data.tar.gz: !binary |-
13
- NTk1Mzc3ODEyYTczYjQ1NmRjZWZhMTMzZWMzOGJiMTVlMGU5NTU3NWUyNWMw
14
- MjNiMjc1MmY5MWU2MzI0OWQzZmI0YWYzOWQ1ZDQwZjlkMjJjODRiNmYwODc4
15
- YzhhOTcwZWJiMjQxYTIyNzE4YjFmOWE1MDRkMTFlZWU5NTIwYWI=
13
+ YWE3MjYxZDQyMGZiYWIwNTM3NmIzMmVhODEyMWIwNzBhYzI0MmY5NWE1NjFj
14
+ NmRjNzY5MDZlZWY4YTczMjZjYTRmZDIwNDdlZDc4MDk2MTRlMmViYjQyZGE4
15
+ NmNjYWE1YmNmN2QxMWZhNjcwNmI5NzMzNDFlODk0ZWRhNjlkY2I=
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |gem|
2
2
  gem.name = 'alongslide'
3
- gem.version = '0.9.8'
3
+ gem.version = '0.9.9'
4
4
 
5
5
  gem.summary = "Create dynamic web layouts with an extended Markdown syntax"
6
6
  gem.description = "Create dynamic web layouts with an extended Markdown syntax"
@@ -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('a[rel=footnote]').each (i, el) =>
87
+ @frames.find('.als-fn-ref').each (i, el) =>
87
88
  # Reference the footnote
88
89
  $el = $(el)
89
- # Find the actual footnote
90
- $footnote = @footnotes.find($el.attr('href'))
91
- # Append actualy footnote to footnote reference
92
- $el.parent('sup').append($footnote)
93
-
94
- # Add event listener to pin/unpin when clicked
95
- $el.on "click", (e) -> $(this).toggleClass('active')
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("&nbsp;")
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 jQuery list of li elements and removes the generated footnotes from DOM
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-child')
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.8
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-15 00:00:00.000000000 Z
12
+ date: 2014-10-16 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: redcarpet