This repository was archived by the owner on Nov 1, 2017. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 58
Expand file tree
/
Copy pathdocumentation.js
More file actions
78 lines (68 loc) · 2.36 KB
/
Copy pathdocumentation.js
File metadata and controls
78 lines (68 loc) · 2.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
// Init sidebar
$(function() {
var activeItem,
helpList = $('#js-sidebar .js-topic'),
firstOccurance = true
// hide list items at startup
if($('body.api') && window.location){
var reg = /\/\/[^\/]+(\/.+)/g,
docUrl = reg.exec(window.location.toString())
if(docUrl){
$('#js-sidebar .js-topic a').each(function(){
var url = $(this).attr('href').toString()
if(url.indexOf(docUrl[1]) >= 0 && url.length == docUrl[1].length){
$(this).parent('li').addClass('disable')
var parentTopic = $(this).parentsUntil('div.sidebar-module > ul').last()
parentTopic.addClass('js-current')
parentTopic.find('.js-expand-btn').toggleClass('collapsed expanded')
}
})
}
}
$('#js-sidebar .js-topic').each(function(){
if(($(this).find('.disable').length == 0 || firstOccurance == false) &&
$(this).hasClass('js-current') != true){
$(this).find('.js-guides').children().hide()
} else {
activeItem = $(this).index()
firstOccurance = false
}
})
// Toggle style list. Expanded items stay
// expanded when new items are clicked.
$('#js-sidebar .js-toggle-list .js-expand-btn').click(function(){
var clickedTopic = $(this).parents('.js-topic'),
topicGuides = clickedTopic.find('.js-guides li')
$(this).toggleClass('collapsed expanded')
topicGuides.toggle(100)
return false
})
// Accordion style list. Expanded items
// collapse when new items are clicked.
$('#js-sidebar .js-accordion-list .js-topic h3 a').click(function(){
var clickedTopic = $(this).parents('.js-topic'),
topicGuides = clickedTopic.find('.js-guides li')
if(activeItem != clickedTopic.index()){
if(helpList.eq(activeItem)){
helpList.eq(activeItem).find('.js-guides li').toggle(100)
}
activeItem = clickedTopic.index()
topicGuides.toggle(100)
} else {
activeItem = undefined
topicGuides.toggle(100)
}
return false
})
$('.help-search .search-box').focus(function(){
$(this).css('background-position','0px -25px')
})
$('.help-search .search-box').focusout(function(){
if($(this).val() == ''){
$(this).css('background-position','0px 0px')
}
})
// Dynamic year for footer copyright
var currentYear = (new Date).getFullYear();
$("#year").text( (new Date).getFullYear() );
});