kickstart_rails 3.0.39 → 3.0.40
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/javascripts/kickstart_rails/app.coffee +17 -0
- data/app/assets/javascripts/kickstart_rails/buffer.coffee +32 -0
- data/app/assets/javascripts/kickstart_rails/buttons.coffee +8 -0
- data/app/assets/javascripts/kickstart_rails/debouncer.coffee +14 -0
- data/app/assets/javascripts/kickstart_rails/docs.coffee +179 -0
- data/app/assets/javascripts/kickstart_rails/dropdown.coffee +40 -0
- data/app/assets/javascripts/kickstart_rails/growl.coffee +56 -0
- data/app/assets/javascripts/kickstart_rails/ks.coffee +16 -0
- data/app/assets/javascripts/kickstart_rails/modal.coffee +29 -0
- data/app/assets/javascripts/kickstart_rails/navbar-fixer.coffee +9 -0
- data/app/assets/javascripts/kickstart_rails/navbar.coffee +36 -0
- data/app/assets/javascripts/kickstart_rails/status.coffee +30 -0
- data/app/assets/javascripts/kickstart_rails/tabs.coffee +32 -0
- data/app/assets/javascripts/kickstart_rails/tests.coffee +10 -0
- data/app/assets/javascripts/kickstart_rails/throttler.coffee +7 -0
- data/app/assets/stylesheets/core/_animations.sass +8 -0
- data/app/assets/stylesheets/core/_base.sass +16 -0
- data/app/assets/stylesheets/core/_base_components.sass +15 -0
- data/app/assets/stylesheets/core/_dependent_components.sass +12 -0
- data/app/assets/stylesheets/core/_direct-apply.sass +337 -0
- data/app/assets/stylesheets/core/_grid.sass +142 -0
- data/app/assets/stylesheets/core/_icons.sass +3 -0
- data/app/assets/stylesheets/core/_index.sass +7 -0
- data/app/assets/stylesheets/core/_mixins.sass +22 -0
- data/app/assets/stylesheets/core/_normalize.sass +339 -0
- data/app/assets/stylesheets/core/_root-element.sass +17 -0
- data/app/assets/stylesheets/core/_typography.sass +180 -0
- data/app/assets/stylesheets/core/components/_alerts.sass +23 -0
- data/app/assets/stylesheets/core/components/_buttons.sass +159 -0
- data/app/assets/stylesheets/core/components/_dropdown_menu.sass +69 -0
- data/app/assets/stylesheets/core/components/_forms.sass +106 -0
- data/app/assets/stylesheets/core/components/_growls.sass +2 -0
- data/app/assets/stylesheets/core/components/_hr.sass +5 -0
- data/app/assets/stylesheets/core/components/_images.sass +40 -0
- data/app/assets/stylesheets/core/components/_labels.sass +15 -0
- data/app/assets/stylesheets/core/components/_modals.sass +73 -0
- data/app/assets/stylesheets/core/components/_navbar.sass +270 -0
- data/app/assets/stylesheets/core/components/_notifications.sass +20 -0
- data/app/assets/stylesheets/core/components/_pagination.sass +11 -0
- data/app/assets/stylesheets/core/components/_progress.sass +12 -0
- data/app/assets/stylesheets/core/components/_tables.sass +70 -0
- data/app/assets/stylesheets/core/components/_tabs.sass +37 -0
- data/app/assets/stylesheets/core/components/_tooltips.sass +26 -0
- data/app/assets/stylesheets/docs.sass +99 -0
- data/app/assets/stylesheets/fullpage.sass +7 -0
- data/app/assets/stylesheets/kickstart-semantic.sass +10 -0
- data/app/assets/stylesheets/kickstart.sass +344 -0
- data/app/assets/stylesheets/pages/docs/form.sass +0 -0
- data/app/assets/stylesheets/pages/docs/grid.sass +73 -0
- data/app/assets/stylesheets/pages/docs/index.sass +217 -0
- data/app/assets/stylesheets/pages/docs/ui/alerts.sass +5 -0
- data/app/assets/stylesheets/pages/docs/ui/buttons.sass +52 -0
- data/app/assets/stylesheets/pages/docs/ui/forms.sass +31 -0
- data/app/assets/stylesheets/pages/docs/ui/images.sass +7 -0
- data/app/assets/stylesheets/pages/docs/ui/labels.sass +10 -0
- data/app/assets/stylesheets/pages/docs/ui/modals.sass +18 -0
- data/app/assets/stylesheets/pages/docs/ui/navigation.sass +14 -0
- data/app/assets/stylesheets/pages/docs/ui/notifications.sass +17 -0
- data/app/assets/stylesheets/pages/docs/ui/tables.sass +13 -0
- data/app/assets/stylesheets/pages/docs/ui/tabs.sass +7 -0
- data/app/assets/stylesheets/pages/docs/ui/tooltips.sass +7 -0
- data/app/assets/stylesheets/pages/docs/ui/typography.sass +56 -0
- data/app/assets/stylesheets/pages/index.sass +105 -0
- data/app/assets/stylesheets/themes/default/theme.sass +264 -0
- data/app/assets/stylesheets/vendor/_index.sass +10 -0
- data/app/assets/stylesheets/vendor/switch/README.md +34 -0
- data/app/assets/stylesheets/vendor/switch/example.sass +14 -0
- data/app/assets/stylesheets/vendor/switch/gulpfile.js +16 -0
- data/app/assets/stylesheets/vendor/switch/index.html +18 -0
- data/app/assets/stylesheets/vendor/switch/package.json +24 -0
- data/app/assets/stylesheets/vendor/switch/switch.sass +53 -0
- data/lib/kickstart_rails/version.rb +1 -1
- metadata +72 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1392983d4cb6ba0696aa53cacf07e56c54ae2a06
|
4
|
+
data.tar.gz: bbb85a8f300a847d8752f33ef62a9551bd0dae43
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6d36d3661755a02f91a293c87141f10c381468e231b1a4853c0873f2db5f01ffdb0d4244032db34f84ff6d8b4566dfebfd5eb47ca0e7e722535c229995102844
|
7
|
+
data.tar.gz: 48834a41145fa5eddf133fe6b343c79fd70e4ceb4c08f4c7fb5fd182d6637c18213cce94c01d4f4662d22803a2e5d63b378875e2cd0c2261467ae9254c2d1fe4
|
@@ -0,0 +1,17 @@
|
|
1
|
+
KS = require './ks'
|
2
|
+
Modal = require './modal'
|
3
|
+
Dropdown = require './dropdown'
|
4
|
+
Navbar = require './navbar'
|
5
|
+
Debounce = require './debouncer'
|
6
|
+
Status = require './status'
|
7
|
+
Tabs = require './tabs'
|
8
|
+
Throttler = require './throttler'
|
9
|
+
Buttons = require './buttons'
|
10
|
+
Buffer = require './buffer'
|
11
|
+
Growl = require './growl'
|
12
|
+
|
13
|
+
k$.ready = ->
|
14
|
+
k$.button()
|
15
|
+
k$.dropdown()
|
16
|
+
|
17
|
+
document.addEventListener 'DOMContentLoaded', -> k$.ready()
|
@@ -0,0 +1,32 @@
|
|
1
|
+
buffer = (fn, delay) ->
|
2
|
+
|
3
|
+
# Create a new bufferArray if one does not exist already.
|
4
|
+
k$.bufferArray = k$.bufferArray || new Array()
|
5
|
+
if not k$.bufferArray.length
|
6
|
+
k$.bufferArray = new Array()
|
7
|
+
|
8
|
+
delay = delay || 500
|
9
|
+
|
10
|
+
# Create an interval to fire the fns in bufferArray
|
11
|
+
i = 1
|
12
|
+
|
13
|
+
k$.bufferInterval = setInterval ->
|
14
|
+
k$.bufferArray[i]() if k$.bufferArray[i]
|
15
|
+
i++
|
16
|
+
if i >= k$.bufferArray.length
|
17
|
+
clearInterval k$.bufferInterval
|
18
|
+
k$.bufferArray = undefined
|
19
|
+
i = 1
|
20
|
+
, delay
|
21
|
+
|
22
|
+
# Add this function to the array.
|
23
|
+
k$.bufferArray.push fn
|
24
|
+
|
25
|
+
# Fire right away if it's the first in line.
|
26
|
+
k$.bufferArray[0]() if k$.bufferArray.length == 1
|
27
|
+
|
28
|
+
console.info "Function queued (#{k$.bufferArray.length} in queue)"
|
29
|
+
|
30
|
+
k$.buffer = buffer
|
31
|
+
|
32
|
+
module.exports = buffer
|
@@ -0,0 +1,8 @@
|
|
1
|
+
button = ->
|
2
|
+
|
3
|
+
($button.classList.add 'menu-item' if $button.querySelectorAll('ul').length) for $button in k$.$$("button")
|
4
|
+
$buttonDropdown.parentNode.classList.add 'menu-item' for $buttonDropdown in k$.$$ '.button-dropdown'
|
5
|
+
|
6
|
+
k$.button = button
|
7
|
+
|
8
|
+
module.exports = button
|
@@ -0,0 +1,14 @@
|
|
1
|
+
debounce = (fn, id, delay) ->
|
2
|
+
|
3
|
+
$delay = delay || 1000
|
4
|
+
|
5
|
+
k$.debounceQueue = id if k$.debounceQueue == null
|
6
|
+
clearTimeout k$.debounceTimer if id == k$.debounceQueue
|
7
|
+
k$.debounceTimer = setTimeout ->
|
8
|
+
fn()
|
9
|
+
k$.debounceQueue = null
|
10
|
+
, $delay
|
11
|
+
|
12
|
+
k$.debounce = debounce
|
13
|
+
|
14
|
+
module.exports = debounce
|
@@ -0,0 +1,179 @@
|
|
1
|
+
document.addEventListener 'DOMContentLoaded', ->
|
2
|
+
|
3
|
+
window.$$ = (el) -> document.querySelectorAll(el)
|
4
|
+
window.$ = (el) -> $$(el)[0]
|
5
|
+
|
6
|
+
###
|
7
|
+
CRUD DOCUMENTATION SETTINGS
|
8
|
+
###
|
9
|
+
|
10
|
+
# Default settings
|
11
|
+
defaults =
|
12
|
+
viewOptions:
|
13
|
+
jquery: false
|
14
|
+
semantic: true
|
15
|
+
|
16
|
+
booleanViewOptions = ['jquery', 'semantic']
|
17
|
+
|
18
|
+
# Retrieve user's saved settings
|
19
|
+
options = JSON.parse localStorage.getItem 'kickstartDocs'
|
20
|
+
|
21
|
+
# Create shallow extend function
|
22
|
+
# (http://andrewdupont.net/2009/08/28/deep-extending-objects-in-javascript/)
|
23
|
+
extend = (destination, source) ->
|
24
|
+
for property of source
|
25
|
+
if source[property] and source[property].constructor and source[property].constructor is Object
|
26
|
+
destination[property] = destination[property] or {}
|
27
|
+
arguments.callee destination[property], source[property]
|
28
|
+
else
|
29
|
+
destination[property] = source[property]
|
30
|
+
destination
|
31
|
+
|
32
|
+
# Extend from defaults
|
33
|
+
settings = if options then extend defaults, options else defaults
|
34
|
+
|
35
|
+
# Create function to write to localStorage
|
36
|
+
setSettings = (settings) ->
|
37
|
+
localStorage.setItem 'kickstartDocs', JSON.stringify settings
|
38
|
+
|
39
|
+
for option in booleanViewOptions
|
40
|
+
if settings.viewOptions["#{option}"]
|
41
|
+
document.body.classList.add "show-#{option}"
|
42
|
+
else
|
43
|
+
document.body.classList.remove "show-#{option}"
|
44
|
+
|
45
|
+
# Write to localStorage
|
46
|
+
setSettings(settings)
|
47
|
+
|
48
|
+
els = []
|
49
|
+
for option in booleanViewOptions
|
50
|
+
option = "#docs-#{option}"
|
51
|
+
els.push option
|
52
|
+
|
53
|
+
if $$(els).length
|
54
|
+
# This page has checkboxes for view options.
|
55
|
+
for option in booleanViewOptions
|
56
|
+
# Closure needed for event listeners
|
57
|
+
do (option) ->
|
58
|
+
window["$opt#{option}"] = $ "#docs-#{option}"
|
59
|
+
|
60
|
+
# Set state of buttons based on saved options in localStorage
|
61
|
+
window["$opt#{option}"].checked = (if settings.viewOptions["#{option}"] then true else false)
|
62
|
+
|
63
|
+
# Listen for checkbox changes
|
64
|
+
window["$opt#{option}"].addEventListener 'click', ->
|
65
|
+
settings.viewOptions["#{option}"] = this.checked
|
66
|
+
setSettings settings
|
67
|
+
|
68
|
+
# Show growls
|
69
|
+
if k$.$('#example-showGrowl')
|
70
|
+
k$.$('#example-showGrowl').addEventListener 'click', ->
|
71
|
+
growls = [
|
72
|
+
{
|
73
|
+
title: 'Document Saved.',
|
74
|
+
text: 'Your document was successfully saved.'
|
75
|
+
type: 'alert-green'
|
76
|
+
},
|
77
|
+
{
|
78
|
+
title: 'Library book not found'
|
79
|
+
text: 'Sorry, we could find that library book.',
|
80
|
+
type: 'alert-red'
|
81
|
+
},
|
82
|
+
{
|
83
|
+
title: 'Wide clearance selection',
|
84
|
+
text: 'Remember to check out our clearance',
|
85
|
+
type: 'alert-blue'
|
86
|
+
},
|
87
|
+
{
|
88
|
+
title: 'Deadline approaching',
|
89
|
+
text: 'Friendly reminder that your deadline is quickly approaching.',
|
90
|
+
type: 'alert-yellow'
|
91
|
+
}
|
92
|
+
]
|
93
|
+
|
94
|
+
k$.exampleCounter++
|
95
|
+
k$.exampleCounter = 0 if not k$.exampleCounter or k$.exampleCounter > 3
|
96
|
+
|
97
|
+
k$.growl growls[k$.exampleCounter]
|
98
|
+
|
99
|
+
# Show status message
|
100
|
+
if k$.$('#example-showStatus')
|
101
|
+
k$.$('#example-showStatus').addEventListener 'click', ->
|
102
|
+
statuses = [
|
103
|
+
{
|
104
|
+
text: 'Document Saved.',
|
105
|
+
type: 'status-green'
|
106
|
+
},
|
107
|
+
{
|
108
|
+
text: 'Sorry, we could find that library book.',
|
109
|
+
type: 'status-red'
|
110
|
+
},
|
111
|
+
{
|
112
|
+
text: 'Remember to check out our clearance',
|
113
|
+
type: 'status-blue'
|
114
|
+
},
|
115
|
+
{
|
116
|
+
text: 'Deadline is approaching!',
|
117
|
+
type: 'status-yellow'
|
118
|
+
}
|
119
|
+
]
|
120
|
+
|
121
|
+
k$.exampleCounter++
|
122
|
+
k$.exampleCounter = 0 if not k$.exampleCounter or k$.exampleCounter > 3
|
123
|
+
|
124
|
+
k$.status(statuses[k$.exampleCounter])
|
125
|
+
|
126
|
+
k$.slugify = (str) ->
|
127
|
+
`str.toLowerCase().replace(/ /g,'-').replace(/[^\w-]+/g,'')`
|
128
|
+
|
129
|
+
# Create a table of contents
|
130
|
+
|
131
|
+
if k$.$$('#toc').length
|
132
|
+
k$.$('.creating-table').parentNode.removeChild k$.$('.creating-table')
|
133
|
+
$toc = document.createElement 'ul'
|
134
|
+
$toc.className = "list list-unstyled"
|
135
|
+
$link = document.createElement('li')
|
136
|
+
$link.innerHTML = '<a></a>'
|
137
|
+
|
138
|
+
# Assuming proper html, start with h1.
|
139
|
+
$headingLevel = 1
|
140
|
+
|
141
|
+
# The node we're currently appending to. Always a ul.
|
142
|
+
$targetNode = $toc
|
143
|
+
|
144
|
+
$documentContainer = k$.$('.document-container')
|
145
|
+
for heading in $documentContainer.querySelectorAll('h1, h2, h3, h4, h5, h6')
|
146
|
+
# Ignore headings that declare themselves as exempt from the TOC
|
147
|
+
if not heading.classList.contains 'toc-exempt'
|
148
|
+
# For extra unique names.
|
149
|
+
# heading.id = "#{k$.slugify heading.innerHTML}-#{_k}"
|
150
|
+
|
151
|
+
heading.id = k$.slugify heading.innerHTML
|
152
|
+
|
153
|
+
# If this is a lower level.
|
154
|
+
$thisHeadingLevel = parseInt(heading.tagName.substr(1, 2))
|
155
|
+
|
156
|
+
if $thisHeadingLevel > $headingLevel
|
157
|
+
# Append a new submenu and make that the targetNode.
|
158
|
+
$newSubmenu = document.createElement 'ul'
|
159
|
+
$targetNode.children[$targetNode.children.length - 1].appendChild $newSubmenu
|
160
|
+
$targetNode = $newSubmenu
|
161
|
+
$headingLevel = $thisHeadingLevel
|
162
|
+
|
163
|
+
# If this is a higher level
|
164
|
+
if $thisHeadingLevel < $headingLevel
|
165
|
+
$stepsUp = $headingLevel - $thisHeadingLevel
|
166
|
+
|
167
|
+
while $stepsUp > -1
|
168
|
+
$targetNode = $targetNode.parentNode
|
169
|
+
$stepsUp--
|
170
|
+
|
171
|
+
$headingLevel = $thisHeadingLevel
|
172
|
+
|
173
|
+
# Make a new li and append it to the target ul node.
|
174
|
+
$menuItem = $link.cloneNode true
|
175
|
+
$menuItem.querySelector('a').href = "##{heading.id}"
|
176
|
+
$menuItem.querySelector('a').innerHTML = heading.innerHTML
|
177
|
+
$targetNode.appendChild $menuItem
|
178
|
+
|
179
|
+
k$.$('#toc').appendChild $toc
|
@@ -0,0 +1,40 @@
|
|
1
|
+
dropdown = () ->
|
2
|
+
|
3
|
+
# The following should apply to several elements.
|
4
|
+
|
5
|
+
$menuItems = k$.$$ '.menu-item'
|
6
|
+
|
7
|
+
for $_menuItem in $menuItems
|
8
|
+
|
9
|
+
$menuItem = $_menuItem.cloneNode true
|
10
|
+
$_menuItem.parentNode.replaceChild $menuItem, $_menuItem
|
11
|
+
|
12
|
+
do ($menuItem) ->
|
13
|
+
# TODO: Is there a way we could not have an event listener for every
|
14
|
+
# single one?
|
15
|
+
$menuItem.addEventListener 'click', (e) ->
|
16
|
+
|
17
|
+
# Just close it if it's already open
|
18
|
+
if $menuItem.classList.contains 'open'
|
19
|
+
$menuItem.classList.remove 'open'
|
20
|
+
return
|
21
|
+
|
22
|
+
# Reset all
|
23
|
+
_$menuItem.classList.remove 'open' for _$menuItem in document.querySelectorAll('.menu-item')
|
24
|
+
$openable = $menuItem.querySelector 'ul'
|
25
|
+
|
26
|
+
# Open this one
|
27
|
+
if $openable
|
28
|
+
$menuItem.classList.add 'open'
|
29
|
+
|
30
|
+
# Prevent bubbling
|
31
|
+
e.stopPropagation()
|
32
|
+
|
33
|
+
# Dismiss all
|
34
|
+
document.body.addEventListener 'click', ->
|
35
|
+
$ul.parentNode.classList.remove 'open' for $ul in k$.$$('.menu-item > ul')
|
36
|
+
$li.classList.remove 'open' for $li in k$.$$('.menu-item.open')
|
37
|
+
|
38
|
+
k$.dropdown = dropdown
|
39
|
+
|
40
|
+
module.exports = dropdown
|
@@ -0,0 +1,56 @@
|
|
1
|
+
growl = (params) ->
|
2
|
+
|
3
|
+
k$.buffer ->
|
4
|
+
defaults =
|
5
|
+
title: undefined
|
6
|
+
text: undefined
|
7
|
+
delay: 2000
|
8
|
+
type: 'alert-warn'
|
9
|
+
id: Date.now()
|
10
|
+
|
11
|
+
params = k$.extend defaults, params
|
12
|
+
|
13
|
+
# Create growl container
|
14
|
+
if not k$.$$('.growl_container').length
|
15
|
+
growlContainer = document.createElement 'div'
|
16
|
+
growlContainer.className = 'growl_container'
|
17
|
+
document.body.appendChild growlContainer
|
18
|
+
|
19
|
+
# Create growl
|
20
|
+
growl = document.createElement 'div'
|
21
|
+
|
22
|
+
# Add appropriate classes
|
23
|
+
className = "alert growl show #{params.type} growl-#{params.id}"
|
24
|
+
growl.className = className
|
25
|
+
|
26
|
+
# Add content
|
27
|
+
content = ""
|
28
|
+
content += "<h1>#{params.title}</h1>" if params.title
|
29
|
+
content += "<p>#{params.text}</p>" if params.text
|
30
|
+
growl.innerHTML = content
|
31
|
+
|
32
|
+
# Append child to container
|
33
|
+
k$.$('.growl_container').appendChild growl
|
34
|
+
|
35
|
+
delay = params.delay
|
36
|
+
id = params.id
|
37
|
+
|
38
|
+
if delay > 0
|
39
|
+
do (delay, id) ->
|
40
|
+
setTimeout ->
|
41
|
+
$growl = k$.$(".growl-#{id}")
|
42
|
+
$growl.classList.remove('show')
|
43
|
+
$newGrowl = $growl.cloneNode true
|
44
|
+
$growl.parentNode.replaceChild $newGrowl, $growl
|
45
|
+
$newGrowl.classList.add('hide')
|
46
|
+
|
47
|
+
do (delay, id) ->
|
48
|
+
setTimeout ->
|
49
|
+
# Remove ghost growls
|
50
|
+
k$.$('.growl_container').parentNode.removeChild k$.$('.growl_container') if not k$.$$('.growl.show').length
|
51
|
+
, 500
|
52
|
+
, delay
|
53
|
+
|
54
|
+
k$.growl = growl
|
55
|
+
|
56
|
+
module.exports = growl
|
@@ -0,0 +1,16 @@
|
|
1
|
+
global.k$ = new Object()
|
2
|
+
|
3
|
+
k$.$$ = (el) -> document.querySelectorAll el
|
4
|
+
k$.$ = (el) -> k$.$$(el)[0]
|
5
|
+
k$.debounceTimer = false
|
6
|
+
k$.debounceQueue = null
|
7
|
+
k$.extend = (destination, source) ->
|
8
|
+
for property of source
|
9
|
+
if source[property] and source[property].constructor and source[property].constructor is Object
|
10
|
+
destination[property] = destination[property] or {}
|
11
|
+
arguments.callee destination[property], source[property]
|
12
|
+
else
|
13
|
+
destination[property] = source[property]
|
14
|
+
destination
|
15
|
+
|
16
|
+
module.exports = k$
|
@@ -0,0 +1,29 @@
|
|
1
|
+
modal = (el) ->
|
2
|
+
|
3
|
+
`var iOS = /(iPad|iPhone|iPod)/g.test( navigator.userAgent )`
|
4
|
+
|
5
|
+
# Cursor pointer hack if iOS
|
6
|
+
document.body.classList.add 'dismiss-modal' if iOS
|
7
|
+
|
8
|
+
do (el) ->
|
9
|
+
|
10
|
+
$hideModal = ->
|
11
|
+
k$.$(el).style.display = 'none'
|
12
|
+
|
13
|
+
# Allow modal to dismiss when clicked outside
|
14
|
+
document.body.addEventListener 'click', ->
|
15
|
+
$hideModal()
|
16
|
+
|
17
|
+
k$.$(el).addEventListener 'click', (e) ->
|
18
|
+
return e.stopPropagation()
|
19
|
+
|
20
|
+
$closer = k$.$(el).querySelector('a[data-modal-close]')
|
21
|
+
if $closer
|
22
|
+
$closer.addEventListener 'click', ->
|
23
|
+
$hideModal()
|
24
|
+
|
25
|
+
k$.$ el
|
26
|
+
|
27
|
+
k$.modal = modal
|
28
|
+
|
29
|
+
module.exports = modal
|
@@ -0,0 +1,9 @@
|
|
1
|
+
window.onscroll = ->
|
2
|
+
$marker = k$.$('#marker')
|
3
|
+
$fixedArea = k$.$('.fixed-area')
|
4
|
+
$offset = $marker.getBoundingClientRect().top
|
5
|
+
$isFixed = $fixedArea.classList.contains 'fixed'
|
6
|
+
if $offset < 1
|
7
|
+
$fixedArea.classList.add 'fixed' if not $isFixed
|
8
|
+
else
|
9
|
+
$fixedArea.classList.remove 'fixed' if $isFixed
|
@@ -0,0 +1,36 @@
|
|
1
|
+
nav = (el) ->
|
2
|
+
|
3
|
+
try
|
4
|
+
# Wire up menu items
|
5
|
+
$menuItems = k$.$(el).querySelectorAll('ul > li')
|
6
|
+
|
7
|
+
# Prune items that don't contain uls
|
8
|
+
_$menuItems = new Array()
|
9
|
+
for $menuItem in $menuItems
|
10
|
+
if $menuItem.querySelectorAll('ul').length and !$menuItem.querySelectorAll('[role="button"]').length
|
11
|
+
_$menuItems.push $menuItem
|
12
|
+
|
13
|
+
$menuItems = _$menuItems
|
14
|
+
for $menuItem in $menuItems
|
15
|
+
|
16
|
+
# For styling
|
17
|
+
$menuItem.classList.add 'menu-item'
|
18
|
+
|
19
|
+
# Wire up the menu
|
20
|
+
k$.dropdown()
|
21
|
+
|
22
|
+
catch e
|
23
|
+
console.error "Could not instantiate as a nav.", e.message
|
24
|
+
|
25
|
+
$button = k$.$(el).querySelector('.navbar-title button')
|
26
|
+
if $button
|
27
|
+
$button.addEventListener 'click', ->
|
28
|
+
$nav = k$.$(el).querySelector('nav')
|
29
|
+
if $nav.classList.contains 'expand'
|
30
|
+
$nav.classList.remove 'expand'
|
31
|
+
else
|
32
|
+
$nav.classList.add 'expand'
|
33
|
+
|
34
|
+
k$.nav = nav
|
35
|
+
|
36
|
+
module.exports = nav
|