mirror of https://github.com/freeCodeCamp/devdocs
parent
50dfc91721
commit
013eff4cba
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 18 KiB |
Before Width: | Height: | Size: 46 KiB After Width: | Height: | Size: 47 KiB |
@ -0,0 +1,28 @@
|
|||||||
|
#= require views/pages/base
|
||||||
|
|
||||||
|
class app.views.MaxcdnPage extends app.views.BasePage
|
||||||
|
@events:
|
||||||
|
click: 'onClick'
|
||||||
|
|
||||||
|
afterRender: ->
|
||||||
|
@highlightCode @findAll('.tab-pane[id^="ruby"] > pre'), 'ruby'
|
||||||
|
@highlightCode @findAll('.tab-pane[id^="python"] > pre'), 'python'
|
||||||
|
@highlightCode @findAll('.tab-pane[id^="node"] > pre, .tab-pane[id^="resp"] > pre'), 'javascript'
|
||||||
|
return
|
||||||
|
|
||||||
|
onClick: (event) ->
|
||||||
|
return unless (link = event.target).getAttribute('data-toggle') is 'tab'
|
||||||
|
$.stopEvent(event)
|
||||||
|
|
||||||
|
list = link.parentNode.parentNode
|
||||||
|
tabs = list.nextElementSibling
|
||||||
|
|
||||||
|
li = link.parentNode
|
||||||
|
position = 1
|
||||||
|
position++ while li = li.previousElementSibling
|
||||||
|
|
||||||
|
$('.active', list).classList.remove('active')
|
||||||
|
$('.active', tabs).classList.remove('active')
|
||||||
|
|
||||||
|
link.parentNode.classList.add('active')
|
||||||
|
$(".tab-pane:nth-child(#{position})", tabs).classList.add('active')
|
@ -0,0 +1,49 @@
|
|||||||
|
._maxcdn {
|
||||||
|
padding-left: 1rem;
|
||||||
|
|
||||||
|
h1, h2, h3 { margin-left: -1rem; }
|
||||||
|
h2 { @extend %block-heading; }
|
||||||
|
h3 { @extend %block-label, %label-blue; }
|
||||||
|
h4 { font-size: 1em; }
|
||||||
|
p > code { @extend %label; }
|
||||||
|
|
||||||
|
.url {
|
||||||
|
padding: .5rem;
|
||||||
|
white-space: normal;
|
||||||
|
@extend %pre, %note-green;
|
||||||
|
}
|
||||||
|
|
||||||
|
.http_method { @extend %label; }
|
||||||
|
|
||||||
|
.nav-tabs {
|
||||||
|
height: 2rem;
|
||||||
|
padding: 0;
|
||||||
|
list-style: none;
|
||||||
|
border-bottom: 1px solid #ddd;
|
||||||
|
|
||||||
|
> li {
|
||||||
|
float: left;
|
||||||
|
margin: -1px 0;
|
||||||
|
|
||||||
|
> a {
|
||||||
|
display: block;
|
||||||
|
padding: .5rem 1em;
|
||||||
|
line-height: 1rem;
|
||||||
|
margin-right: 2px;
|
||||||
|
border: 1px solid transparent;
|
||||||
|
border-radius: 3px 3px 0 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.active > a {
|
||||||
|
color: $textColor;
|
||||||
|
text-decoration: none;
|
||||||
|
background: white;
|
||||||
|
border-color: #ddd #ddd transparent;
|
||||||
|
cursor: default;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.tab-pane { display: none; }
|
||||||
|
.tab-pane.active { display: block; }
|
||||||
|
}
|
@ -0,0 +1,25 @@
|
|||||||
|
module Docs
|
||||||
|
class Maxcdn
|
||||||
|
class CleanHtmlFilter < Filter
|
||||||
|
def call
|
||||||
|
css('hr', 'td:last-child:empty').remove
|
||||||
|
|
||||||
|
css('h1, h2, h3, h4').each do |node|
|
||||||
|
node.name = node.name.sub(/\d/) { |i| i.to_i + 1 }
|
||||||
|
end
|
||||||
|
|
||||||
|
at_css('h2').name = 'h1'
|
||||||
|
|
||||||
|
css('.path > a').each do |node|
|
||||||
|
node.before(node.children).remove
|
||||||
|
end
|
||||||
|
|
||||||
|
css('[name]').each do |node|
|
||||||
|
node.remove_attribute 'name'
|
||||||
|
end
|
||||||
|
|
||||||
|
doc
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
@ -0,0 +1,30 @@
|
|||||||
|
module Docs
|
||||||
|
class Maxcdn
|
||||||
|
class EntriesFilter < Docs::EntriesFilter
|
||||||
|
def additional_entries
|
||||||
|
type = id_prefix = nil
|
||||||
|
|
||||||
|
doc.children.each_with_object [] do |node, entries|
|
||||||
|
if node.name == 'h2'
|
||||||
|
type = node.content.strip
|
||||||
|
type.remove! %r{ API\z}
|
||||||
|
type.remove! ' Custom Domains'
|
||||||
|
id_prefix = type.parameterize
|
||||||
|
type = 'Reports' if type.starts_with? 'Reports'
|
||||||
|
elsif node.name == 'h3'
|
||||||
|
next unless type
|
||||||
|
name = node.content.strip
|
||||||
|
id = "#{id_prefix}-#{name}".parameterize
|
||||||
|
node['id'] = id
|
||||||
|
|
||||||
|
if name.ends_with?('Domain') && ['Push Zone', 'Pull Zone', 'VOD Zone'].include?(type)
|
||||||
|
name << " (#{type})"
|
||||||
|
end
|
||||||
|
|
||||||
|
entries << [name, id, type]
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
@ -0,0 +1,17 @@
|
|||||||
|
module Docs
|
||||||
|
class Maxcdn < UrlScraper
|
||||||
|
self.name = 'MaxCDN'
|
||||||
|
self.type = 'maxcdn'
|
||||||
|
self.base_url = 'http://docs.maxcdn.com/'
|
||||||
|
|
||||||
|
html_filters.push 'maxcdn/clean_html', 'maxcdn/entries'
|
||||||
|
|
||||||
|
options[:container] = '#readme-docs'
|
||||||
|
options[:skip_links] = true
|
||||||
|
|
||||||
|
options[:attribution] = <<-HTML
|
||||||
|
© 2014 MaxCDN<br>
|
||||||
|
Licensed under the MIT License.
|
||||||
|
HTML
|
||||||
|
end
|
||||||
|
end
|
After Width: | Height: | Size: 530 B |
After Width: | Height: | Size: 1.1 KiB |
@ -0,0 +1 @@
|
|||||||
|
https://github.com/MaxCDN/media
|
Loading…
Reference in new issue