alongslide 0.9.1 → 0.9.2
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +10 -0
- data/Gemfile.lock +103 -0
- data/alongslide.gemspec +18 -0
- data/app/assets/javascripts/alongslide/alongslide.coffee +107 -0
- data/app/assets/javascripts/alongslide/layout.coffee +504 -0
- data/app/assets/javascripts/alongslide/parser.coffee +125 -0
- data/app/assets/javascripts/alongslide/scrolling.coffee +423 -0
- data/app/assets/javascripts/alongslide.coffee +19 -0
- data/app/assets/stylesheets/alongslide.sass +444 -0
- data/app/views/panel/panel.haml +8 -0
- data/app/views/panel/unpin.haml +4 -0
- data/app/views/section/exit.haml +4 -0
- data/app/views/section/section.haml +4 -0
- data/grammar/alongslide.treetop +162 -0
- data/grammar/panel.treetop +67 -0
- data/vendor/assets/javascripts/jquery.fitvids.js +74 -0
- data/vendor/assets/javascripts/prefix.js +18 -0
- data/vendor/assets/javascripts/regionFlow.coffee +305 -0
- data/vendor/assets/javascripts/skrollr.js +1716 -0
- data/vendor/assets/javascripts/tether.js +1357 -0
- metadata +23 -3
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,103 @@
|
|
1
|
+
GIT
|
2
|
+
remote: git://github.com/vmg/redcarpet.git
|
3
|
+
revision: f2ad99f4d3cefaa51655cbb47a075d8e88e86618
|
4
|
+
ref: f2ad99f
|
5
|
+
specs:
|
6
|
+
redcarpet (3.0.0)
|
7
|
+
|
8
|
+
GEM
|
9
|
+
remote: https://rubygems.org/
|
10
|
+
specs:
|
11
|
+
actionmailer (4.0.0)
|
12
|
+
actionpack (= 4.0.0)
|
13
|
+
mail (~> 2.5.3)
|
14
|
+
actionpack (4.0.0)
|
15
|
+
activesupport (= 4.0.0)
|
16
|
+
builder (~> 3.1.0)
|
17
|
+
erubis (~> 2.7.0)
|
18
|
+
rack (~> 1.5.2)
|
19
|
+
rack-test (~> 0.6.2)
|
20
|
+
activemodel (4.0.0)
|
21
|
+
activesupport (= 4.0.0)
|
22
|
+
builder (~> 3.1.0)
|
23
|
+
activerecord (4.0.0)
|
24
|
+
activemodel (= 4.0.0)
|
25
|
+
activerecord-deprecated_finders (~> 1.0.2)
|
26
|
+
activesupport (= 4.0.0)
|
27
|
+
arel (~> 4.0.0)
|
28
|
+
activerecord-deprecated_finders (1.0.3)
|
29
|
+
activesupport (4.0.0)
|
30
|
+
i18n (~> 0.6, >= 0.6.4)
|
31
|
+
minitest (~> 4.2)
|
32
|
+
multi_json (~> 1.3)
|
33
|
+
thread_safe (~> 0.1)
|
34
|
+
tzinfo (~> 0.3.37)
|
35
|
+
arel (4.0.0)
|
36
|
+
atomic (1.1.14)
|
37
|
+
builder (3.1.4)
|
38
|
+
diff-lcs (1.2.4)
|
39
|
+
erubis (2.7.0)
|
40
|
+
haml (4.0.3)
|
41
|
+
tilt
|
42
|
+
hike (1.2.3)
|
43
|
+
i18n (0.6.5)
|
44
|
+
mail (2.5.4)
|
45
|
+
mime-types (~> 1.16)
|
46
|
+
treetop (~> 1.4.8)
|
47
|
+
mime-types (1.25)
|
48
|
+
minitest (4.7.5)
|
49
|
+
multi_json (1.8.1)
|
50
|
+
polyglot (0.3.3)
|
51
|
+
rack (1.5.2)
|
52
|
+
rack-test (0.6.2)
|
53
|
+
rack (>= 1.0)
|
54
|
+
rails (4.0.0)
|
55
|
+
actionmailer (= 4.0.0)
|
56
|
+
actionpack (= 4.0.0)
|
57
|
+
activerecord (= 4.0.0)
|
58
|
+
activesupport (= 4.0.0)
|
59
|
+
bundler (>= 1.3.0, < 2.0)
|
60
|
+
railties (= 4.0.0)
|
61
|
+
sprockets-rails (~> 2.0.0)
|
62
|
+
railties (4.0.0)
|
63
|
+
actionpack (= 4.0.0)
|
64
|
+
activesupport (= 4.0.0)
|
65
|
+
rake (>= 0.8.7)
|
66
|
+
thor (>= 0.18.1, < 2.0)
|
67
|
+
rake (10.1.0)
|
68
|
+
rspec (2.14.1)
|
69
|
+
rspec-core (~> 2.14.0)
|
70
|
+
rspec-expectations (~> 2.14.0)
|
71
|
+
rspec-mocks (~> 2.14.0)
|
72
|
+
rspec-core (2.14.4)
|
73
|
+
rspec-expectations (2.14.0)
|
74
|
+
diff-lcs (>= 1.1.3, < 2.0)
|
75
|
+
rspec-mocks (2.14.2)
|
76
|
+
sprockets (2.10.0)
|
77
|
+
hike (~> 1.2)
|
78
|
+
multi_json (~> 1.0)
|
79
|
+
rack (~> 1.0)
|
80
|
+
tilt (~> 1.1, != 1.3.0)
|
81
|
+
sprockets-rails (2.0.0)
|
82
|
+
actionpack (>= 3.0)
|
83
|
+
activesupport (>= 3.0)
|
84
|
+
sprockets (~> 2.8)
|
85
|
+
thor (0.18.1)
|
86
|
+
thread_safe (0.1.3)
|
87
|
+
atomic
|
88
|
+
tilt (1.4.1)
|
89
|
+
treetop (1.4.14)
|
90
|
+
polyglot
|
91
|
+
polyglot (>= 0.3.1)
|
92
|
+
tzinfo (0.3.38)
|
93
|
+
|
94
|
+
PLATFORMS
|
95
|
+
ruby
|
96
|
+
|
97
|
+
DEPENDENCIES
|
98
|
+
haml
|
99
|
+
polyglot
|
100
|
+
rails
|
101
|
+
redcarpet!
|
102
|
+
rspec
|
103
|
+
treetop
|
data/alongslide.gemspec
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
Gem::Specification.new do |gem|
|
2
|
+
gem.name = 'alongslide'
|
3
|
+
gem.version = '0.9.2'
|
4
|
+
|
5
|
+
gem.summary = "Create dynamic web layouts with an extended Markdown syntax"
|
6
|
+
gem.description = "Create dynamic web layouts with an extended Markdown syntax"
|
7
|
+
|
8
|
+
gem.authors = ['Adam Florin', 'Anthony Tran']
|
9
|
+
gem.email = 'adam@canopycanopycanopy.com'
|
10
|
+
gem.homepage = 'http://github.com/triplecanopy/alongslide'
|
11
|
+
|
12
|
+
gem.add_dependency('redcarpet')
|
13
|
+
gem.add_dependency('treetop')
|
14
|
+
gem.add_dependency('polyglot')
|
15
|
+
gem.add_development_dependency('rspec')
|
16
|
+
|
17
|
+
gem.files = `git ls-files`.split("\n")
|
18
|
+
end
|
@@ -0,0 +1,107 @@
|
|
1
|
+
#
|
2
|
+
# alongslide.cofee: Central init, pull in submodules.
|
3
|
+
#
|
4
|
+
# Copyright 2013 Canopy Canopy Canopy, Inc.
|
5
|
+
# Authors Adam Florin & Anthony Tran
|
6
|
+
#
|
7
|
+
class Alongslide
|
8
|
+
|
9
|
+
panels : {}
|
10
|
+
sections : {}
|
11
|
+
|
12
|
+
parser : null
|
13
|
+
layout : null
|
14
|
+
scrolling : null
|
15
|
+
|
16
|
+
constructor: (options= {}) ->
|
17
|
+
@source = $(options.source) ? $('#content .raw')
|
18
|
+
@frames = $(options.to) ? $('#frames')
|
19
|
+
@regionCls = options.regionCls ? 'column'
|
20
|
+
|
21
|
+
RegionFlow::init()
|
22
|
+
|
23
|
+
# parse
|
24
|
+
@parser = new @Parser source: @source
|
25
|
+
{@flowNames, @backgrounds, @panels, @footnotes, @sourceLength} = @parser.parse()
|
26
|
+
|
27
|
+
# init layout
|
28
|
+
@layout = new @Layout
|
29
|
+
sourceLength: @sourceLength
|
30
|
+
frames: @frames
|
31
|
+
flowNames: @flowNames
|
32
|
+
backgrounds: @backgrounds
|
33
|
+
panels: @panels
|
34
|
+
regionCls: @regionCls
|
35
|
+
|
36
|
+
# init scrolling
|
37
|
+
@scrolling = new @Scrolling
|
38
|
+
frames: @frames
|
39
|
+
|
40
|
+
|
41
|
+
# Render flowing layout and scroll behavior.
|
42
|
+
#
|
43
|
+
# Force use of CSS Regions polyfill. (Don't trust native browser support
|
44
|
+
# while W3C draft is under active development.)
|
45
|
+
#
|
46
|
+
# @param frameAspect - bounding box computed by FixedAspect
|
47
|
+
# @param postRenderCallback - to be called when layout returns
|
48
|
+
#
|
49
|
+
render: (frameAspect, postRenderCallback) ->
|
50
|
+
@layout.render (lastFramePosition) =>
|
51
|
+
|
52
|
+
@lastFramePosition = lastFramePosition
|
53
|
+
|
54
|
+
@refresh(frameAspect)
|
55
|
+
@applyFootnotes()
|
56
|
+
@applyAnchorScrolling()
|
57
|
+
|
58
|
+
# Emit notification that layout is complete.
|
59
|
+
$(document).triggerHandler 'alongslide.ready', @frames
|
60
|
+
|
61
|
+
@hashToPosition()
|
62
|
+
postRenderCallback()
|
63
|
+
|
64
|
+
# Refresh Skrollr only on resize events, as it's fast.
|
65
|
+
#
|
66
|
+
refresh: (frameAspect) ->
|
67
|
+
@scrolling.render(frameAspect, @lastFramePosition)
|
68
|
+
|
69
|
+
hashToPosition: ->
|
70
|
+
hash = window.location.hash
|
71
|
+
if hash.length > 0
|
72
|
+
@goToPanel(hash.substr(1))
|
73
|
+
else
|
74
|
+
@goToPanel('titlesplash')
|
75
|
+
|
76
|
+
|
77
|
+
# Create footnotes
|
78
|
+
#
|
79
|
+
# Sanitize Markdown generated HTML
|
80
|
+
applyFootnotes: ->
|
81
|
+
# For each footnote in the article
|
82
|
+
@frames.find('a[rel=footnote]').each (i, el) =>
|
83
|
+
# Reference the footnote
|
84
|
+
$el = $(el)
|
85
|
+
# Find the actual footnote
|
86
|
+
$footnote = @footnotes.find($el.attr('href'))
|
87
|
+
# Append actualy footnote to footnote reference
|
88
|
+
$el.parent('sup').append($footnote)
|
89
|
+
|
90
|
+
# Add event listener to pin/unpin when clicked
|
91
|
+
$el.on "click", (e) -> $(this).toggleClass('active')
|
92
|
+
|
93
|
+
applyAnchorScrolling: ->
|
94
|
+
self = @
|
95
|
+
@frames.find('a[href*=#]:not([href=#])').on('click', (e) ->
|
96
|
+
self.goToPanel(@hash.substr(1))
|
97
|
+
)
|
98
|
+
|
99
|
+
goToPanel: (alsId) =>
|
100
|
+
$target = $('#frames').find('[data-alongslide-id=' + alsId + ']')
|
101
|
+
targetPos = $target.data('als-in-position')
|
102
|
+
@scrolling.scrollToPosition(targetPos)
|
103
|
+
|
104
|
+
|
105
|
+
# Make global
|
106
|
+
#
|
107
|
+
window.Alongslide = Alongslide
|