sanskrit-documentation-theme 0.1.6 → 0.1.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +7 -2
- data/_includes/head.html +15 -11
- data/_includes/jekyll_vars_to_js.html +27 -0
- data/_includes/sidebar.html +4 -14
- data/_includes/topnav.html +8 -18
- data/_layouts/default.html +8 -66
- data/_layouts/page.html +12 -13
- data/assets/css/class-styles-general.scss +44 -21
- data/assets/css/element-styles-general.scss +7 -3
- data/assets/css/embeds.scss +19 -0
- data/assets/css/navbar-toc.scss +31 -153
- data/assets/css/topnav.scss +86 -0
- data/assets/js/navgoco.js +314 -0
- data/assets/js/on_doc_ready/audio_embed.js +45 -0
- data/assets/js/on_doc_ready/handle_includes.js +175 -0
- data/assets/js/on_doc_ready/main.js +0 -0
- data/assets/js/on_doc_ready/sidebar.js +119 -0
- data/assets/js/on_doc_ready/toc.js +159 -0
- data/assets/js/on_doc_ready/video_embed.js +52 -0
- metadata +12 -8
- data/_includes/functions/recursive_item_to_list.html +0 -29
- data/_includes/toc.html +0 -38
- data/assets/css/theme-blue.scss +0 -140
- data/assets/js/customscripts.js +0 -54
- data/assets/js/jquery.navgoco.min.js +0 -8
- data/assets/js/toc.js +0 -73
@@ -0,0 +1,19 @@
|
|
1
|
+
---
|
2
|
+
---
|
3
|
+
// The dashes above are required by jekyll.
|
4
|
+
// This file generates a css.
|
5
|
+
|
6
|
+
.videoEmbed {
|
7
|
+
position: relative;
|
8
|
+
padding-bottom: 56.333%;
|
9
|
+
height: 0;
|
10
|
+
background: black;
|
11
|
+
}
|
12
|
+
.videoEmbed iframe {
|
13
|
+
position: absolute;
|
14
|
+
top: 0;
|
15
|
+
left: 0;
|
16
|
+
width: 100%;
|
17
|
+
height: 100%;
|
18
|
+
border: 0;
|
19
|
+
}
|
data/assets/css/navbar-toc.scss
CHANGED
@@ -4,91 +4,33 @@
|
|
4
4
|
// This file generates a css.
|
5
5
|
|
6
6
|
/*Table of contents and Navbar*/
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
font-weight: bolder;
|
15
|
-
color: #9c131e;
|
16
|
-
}
|
17
|
-
|
18
|
-
li.dropdownActive a {
|
19
|
-
font-weight: bold;
|
20
|
-
}
|
21
|
-
|
22
|
-
.nav-tabs > li.active > a {
|
23
|
-
background-color: #248ec2;
|
24
|
-
color: white;
|
25
|
-
&:hover, &:focus {
|
26
|
-
background-color: #248ec2;
|
27
|
-
color: white;
|
28
|
-
}
|
29
|
-
}
|
30
|
-
|
31
|
-
/************************************************************/
|
32
|
-
|
33
|
-
.navbar-inverse {
|
34
|
-
.navbar-nav > {
|
35
|
-
li > a {
|
36
|
-
background-color: transparent;
|
37
|
-
margin-top: 10px;
|
38
|
-
}
|
39
|
-
.active > a {
|
40
|
-
border-radius: 5px;
|
41
|
-
&:hover, &:focus {
|
42
|
-
border-radius: 5px;
|
43
|
-
}
|
44
|
-
}
|
45
|
-
.open > a {
|
46
|
-
border-radius: 5px;
|
47
|
-
&:focus, &:hover {
|
48
|
-
border-radius: 5px;
|
49
|
-
}
|
50
|
-
}
|
51
|
-
}
|
52
|
-
.navbar-collapse, .navbar-form {
|
53
|
-
border-color: #248ec2 !important;
|
54
|
-
}
|
7
|
+
li.sidebarTitle {
|
8
|
+
margin-top: 20px;
|
9
|
+
font-weight: normal;
|
10
|
+
font-size: 130%;
|
11
|
+
color: #0041ed;
|
12
|
+
margin-bottom: 10px;
|
13
|
+
margin-left: 5px;
|
55
14
|
}
|
56
15
|
|
57
|
-
/* not sure if using this ...*/
|
58
|
-
|
59
16
|
/************************************************************/
|
60
|
-
|
61
|
-
|
62
|
-
#accordion .panel-heading {
|
63
|
-
font-size: 110%;
|
64
|
-
}
|
65
|
-
|
66
|
-
a {
|
67
|
-
&.accordion-toggle, &.accordion-collapsed {
|
68
|
-
font-size: 110%;
|
69
|
-
text-decoration: none;
|
70
|
-
}
|
71
|
-
}
|
72
|
-
|
73
|
-
/************************************************************/
|
74
|
-
|
75
|
-
/* navgoco sidebar styles (customized) */
|
76
|
-
|
17
|
+
// The below was generated from 1b775fd Mar 14, 2014 version of navgoco.
|
77
18
|
.nav {
|
78
19
|
list-style: none;
|
20
|
+
border-width: 2px;
|
21
|
+
border-color: #000000;
|
79
22
|
ul, li {
|
80
23
|
list-style: none;
|
24
|
+
background: #FAFAFA;
|
81
25
|
}
|
82
26
|
ul {
|
83
27
|
padding: 0;
|
84
|
-
|
85
|
-
margin: 0px;
|
28
|
+
margin: 0 0 0 18px;
|
86
29
|
}
|
87
|
-
|
88
|
-
padding: 0px;
|
30
|
+
padding: 4px;
|
89
31
|
margin: 0px;
|
90
32
|
> li {
|
91
|
-
margin:
|
33
|
+
margin: 4px 0;
|
92
34
|
li {
|
93
35
|
margin: 2px 0;
|
94
36
|
}
|
@@ -97,17 +39,22 @@ a {
|
|
97
39
|
color: #333;
|
98
40
|
display: block;
|
99
41
|
outline: none;
|
100
|
-
|
101
|
-
-moz-border-radius: 4px;
|
102
|
-
border-radius: 4px;*/
|
42
|
+
border-radius: 4px;
|
103
43
|
text-decoration: none;
|
104
44
|
}
|
105
45
|
li {
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
46
|
+
border-width: 2px;
|
47
|
+
border-color: #000000;
|
48
|
+
> a {
|
49
|
+
> span {
|
50
|
+
float: right;
|
51
|
+
font-size: 130%;
|
52
|
+
font-weight: bolder;
|
53
|
+
}
|
54
|
+
&:hover > span {
|
55
|
+
color: #000000;
|
56
|
+
}
|
57
|
+
> span:after {
|
111
58
|
content: '\25be';
|
112
59
|
}
|
113
60
|
}
|
@@ -117,7 +64,7 @@ a {
|
|
117
64
|
}
|
118
65
|
a:hover {
|
119
66
|
background-color: #8D8D8D;
|
120
|
-
color: #
|
67
|
+
color: #000000;
|
121
68
|
}
|
122
69
|
li {
|
123
70
|
&.active > a {
|
@@ -126,85 +73,16 @@ a {
|
|
126
73
|
}
|
127
74
|
a {
|
128
75
|
font-size: 110%;
|
129
|
-
line-height:
|
76
|
+
line-height: 110%;
|
130
77
|
padding: 2px 10px;
|
131
|
-
background-color: #f1f1f1;
|
132
78
|
}
|
133
79
|
}
|
134
80
|
> li.active > a {
|
135
|
-
background-color:
|
81
|
+
background-color: rgb(190, 129, 0);
|
136
82
|
}
|
137
83
|
> li > a {
|
138
84
|
font-size: 110%;
|
139
|
-
line-height:
|
85
|
+
line-height: 120%;
|
140
86
|
padding: 4px 10px;
|
141
87
|
}
|
142
|
-
}
|
143
|
-
|
144
|
-
ul#displayed_sidebar {
|
145
|
-
border-radius: 0px;
|
146
|
-
}
|
147
|
-
|
148
|
-
.nav {
|
149
|
-
ul li ul li a {
|
150
|
-
padding-left: 40px;
|
151
|
-
}
|
152
|
-
li.thirdlevel > a {
|
153
|
-
color: #248EC2;
|
154
|
-
font-weight: bold;
|
155
|
-
padding-left: 20px;
|
156
|
-
background-color: whitesmoke !important;
|
157
|
-
}
|
158
|
-
ul li a {
|
159
|
-
background-color: #FAFAFA;
|
160
|
-
}
|
161
|
-
li a {
|
162
|
-
padding-right: 10px;
|
163
|
-
&:hover {
|
164
|
-
background-color: #8D8D8D;
|
165
|
-
}
|
166
|
-
}
|
167
|
-
ul {
|
168
|
-
li a {
|
169
|
-
border-top: 1px solid whitesmoke;
|
170
|
-
padding-left: 10px;
|
171
|
-
}
|
172
|
-
&.series {
|
173
|
-
li {
|
174
|
-
list-style: decimal;
|
175
|
-
font-size: 80%;
|
176
|
-
a:hover {
|
177
|
-
background-color: gray;
|
178
|
-
}
|
179
|
-
}
|
180
|
-
padding-left: 30px;
|
181
|
-
background-color: #FAFAFA;
|
182
|
-
}
|
183
|
-
}
|
184
|
-
li.active > a.subfoldersTitle {
|
185
|
-
background-color: whitesmoke;
|
186
|
-
font-weight: bold;
|
187
|
-
color: black;
|
188
|
-
}
|
189
|
-
}
|
190
|
-
|
191
|
-
/************************************************************/
|
192
|
-
|
193
|
-
div#toc ul li ul li {
|
194
|
-
list-style-type: none;
|
195
|
-
margin: 5px 0px 0px 0px;
|
196
|
-
}
|
197
|
-
|
198
|
-
#displayed_sidebar .nav ul {
|
199
|
-
background-color: #FAFAFA;
|
200
|
-
}
|
201
|
-
|
202
|
-
.seriesContext .dropdown-menu li.active {
|
203
|
-
font-weight: bold;
|
204
|
-
margin-left: 43px;
|
205
|
-
font-size: 110%;
|
206
|
-
}
|
207
|
-
|
208
|
-
li.activeSeries {
|
209
|
-
font-weight: bold;
|
210
88
|
}
|
@@ -0,0 +1,86 @@
|
|
1
|
+
---
|
2
|
+
---
|
3
|
+
// The dashes above are required by jekyll.
|
4
|
+
// This file generates a css.
|
5
|
+
|
6
|
+
.projectTitle {
|
7
|
+
font-weight: bold;
|
8
|
+
color: #ffffff;
|
9
|
+
padding-top: 15px;
|
10
|
+
padding-bottom: 15px;
|
11
|
+
vertical-align: center;
|
12
|
+
// When you hover on the title in the navbar.
|
13
|
+
&:hover{
|
14
|
+
color: #f0f0f0;
|
15
|
+
}
|
16
|
+
}
|
17
|
+
|
18
|
+
.githubEditButton {
|
19
|
+
margin-bottom: 7px;
|
20
|
+
}
|
21
|
+
|
22
|
+
.navbar {
|
23
|
+
background-color: #be8100;
|
24
|
+
border-color: #015CAE;
|
25
|
+
ul, li {
|
26
|
+
list-style: none;
|
27
|
+
}
|
28
|
+
.navbar-nav > li > a, .navbar-brand {
|
29
|
+
color: white;
|
30
|
+
}
|
31
|
+
.navbar-nav > li > a:hover {
|
32
|
+
color: #f0f0f0;
|
33
|
+
}
|
34
|
+
.navbar-nav > .open > a {
|
35
|
+
color: #015CAE;
|
36
|
+
&:hover, &:focus {
|
37
|
+
color: #015CAE;
|
38
|
+
}
|
39
|
+
background-color: #015CAE;
|
40
|
+
color: #ffffff;
|
41
|
+
&:hover, &:focus {
|
42
|
+
background-color: #015CAE;
|
43
|
+
color: #ffffff;
|
44
|
+
}
|
45
|
+
}
|
46
|
+
.navbar-collapse, .navbar-form {
|
47
|
+
border-color: #248ec2 !important;
|
48
|
+
}
|
49
|
+
.navbar-nav > {
|
50
|
+
li > a {
|
51
|
+
background-color: transparent;
|
52
|
+
margin-top: 10px;
|
53
|
+
}
|
54
|
+
.active > a {
|
55
|
+
border-radius: 5px;
|
56
|
+
&:hover, &:focus {
|
57
|
+
border-radius: 5px;
|
58
|
+
}
|
59
|
+
}
|
60
|
+
.open > a {
|
61
|
+
border-radius: 5px;
|
62
|
+
&:focus, &:hover {
|
63
|
+
border-radius: 5px;
|
64
|
+
}
|
65
|
+
}
|
66
|
+
}
|
67
|
+
.navbar-collapse, .navbar-form {
|
68
|
+
border-color: #248ec2 !important;
|
69
|
+
}
|
70
|
+
}
|
71
|
+
|
72
|
+
.navbar .navbar-nav > .active > a {
|
73
|
+
background-color: #be8100;
|
74
|
+
&:hover, &:focus {
|
75
|
+
background-color: #be8100;
|
76
|
+
}
|
77
|
+
}
|
78
|
+
|
79
|
+
|
80
|
+
div.navbar-collapse .dropdown-menu > li > a:hover {
|
81
|
+
background-color: #be8100;
|
82
|
+
}
|
83
|
+
|
84
|
+
li.dropdownActive a {
|
85
|
+
font-weight: bold;
|
86
|
+
}
|
@@ -0,0 +1,314 @@
|
|
1
|
+
/*
|
2
|
+
* jQuery Navgoco Menus Plugin v0.2.1 (2014-04-11)
|
3
|
+
* https://github.com/tefra/navgoco
|
4
|
+
*
|
5
|
+
* Copyright (c) 2014 Chris T (@tefra)
|
6
|
+
* BSD - https://github.com/tefra/navgoco/blob/master/LICENSE-BSD
|
7
|
+
*/
|
8
|
+
(function($) {
|
9
|
+
|
10
|
+
"use strict";
|
11
|
+
|
12
|
+
/**
|
13
|
+
* Plugin Constructor. Every menu must have a unique id which will either
|
14
|
+
* be the actual id attribute or its index in the page.
|
15
|
+
*
|
16
|
+
* @param {Element} el
|
17
|
+
* @param {Object} options
|
18
|
+
* @param {Integer} idx
|
19
|
+
* @returns {Object} Plugin Instance
|
20
|
+
*/
|
21
|
+
var Plugin = function(el, options, idx) {
|
22
|
+
this.el = el;
|
23
|
+
this.$el = $(el);
|
24
|
+
this.options = options;
|
25
|
+
this.uuid = this.$el.attr('id') ? this.$el.attr('id') : idx;
|
26
|
+
this.state = {};
|
27
|
+
this.init();
|
28
|
+
return this;
|
29
|
+
};
|
30
|
+
|
31
|
+
/**
|
32
|
+
* Plugin methods
|
33
|
+
*/
|
34
|
+
Plugin.prototype = {
|
35
|
+
/**
|
36
|
+
* Load cookie, assign a unique data-index attribute to
|
37
|
+
* all sub-menus and show|hide them according to cookie
|
38
|
+
* or based on the parent open class. Find all parent li > a
|
39
|
+
* links add the carent if it's on and attach the event click
|
40
|
+
* to them.
|
41
|
+
*/
|
42
|
+
init: function() {
|
43
|
+
var self = this;
|
44
|
+
self._load();
|
45
|
+
self.$el.find('ul').each(function(idx) {
|
46
|
+
var sub = $(this);
|
47
|
+
sub.attr('data-index', idx);
|
48
|
+
if (self.options.save && self.state.hasOwnProperty(idx)) {
|
49
|
+
sub.parent().addClass(self.options.openClass);
|
50
|
+
sub.show();
|
51
|
+
} else if (sub.parent().hasClass(self.options.openClass)) {
|
52
|
+
sub.show();
|
53
|
+
self.state[idx] = 1;
|
54
|
+
} else {
|
55
|
+
sub.hide();
|
56
|
+
}
|
57
|
+
});
|
58
|
+
|
59
|
+
var caret = $('<span></span>').prepend(self.options.caretHtml);
|
60
|
+
var links = self.$el.find("li > a");
|
61
|
+
self._trigger(caret, false);
|
62
|
+
self._trigger(links, true);
|
63
|
+
self.$el.find("li:has(ul) > a").prepend(caret);
|
64
|
+
},
|
65
|
+
/**
|
66
|
+
* Add the main event trigger to toggle menu items to the given sources
|
67
|
+
* @param {Element} sources
|
68
|
+
* @param {Boolean} isLink
|
69
|
+
*/
|
70
|
+
_trigger: function(sources, isLink) {
|
71
|
+
var self = this;
|
72
|
+
sources.on('click', function(event) {
|
73
|
+
event.stopPropagation();
|
74
|
+
var sub = isLink ? $(this).next() : $(this).parent().next();
|
75
|
+
var isAnchor = false;
|
76
|
+
if (isLink) {
|
77
|
+
var href = $(this).attr('href');
|
78
|
+
isAnchor = href === undefined || href === '' || href === '#';
|
79
|
+
}
|
80
|
+
sub = sub.length > 0 ? sub : false;
|
81
|
+
self.options.onClickBefore.call(this, event, sub);
|
82
|
+
|
83
|
+
if (!isLink || sub && isAnchor) {
|
84
|
+
event.preventDefault();
|
85
|
+
self._toggle(sub, sub.is(":hidden"));
|
86
|
+
self._save();
|
87
|
+
} else if (self.options.accordion) {
|
88
|
+
var allowed = self.state = self._parents($(this));
|
89
|
+
self.$el.find('ul').filter(':visible').each(function() {
|
90
|
+
var sub = $(this),
|
91
|
+
idx = sub.attr('data-index');
|
92
|
+
|
93
|
+
if (!allowed.hasOwnProperty(idx)) {
|
94
|
+
self._toggle(sub, false);
|
95
|
+
}
|
96
|
+
});
|
97
|
+
self._save();
|
98
|
+
}
|
99
|
+
self.options.onClickAfter.call(this, event, sub);
|
100
|
+
});
|
101
|
+
},
|
102
|
+
/**
|
103
|
+
* Accepts a JQuery Element and a boolean flag. If flag is false it removes the `open` css
|
104
|
+
* class from the parent li and slides up the sub-menu. If flag is open it adds the `open`
|
105
|
+
* css class to the parent li and slides down the menu. If accordion mode is on all
|
106
|
+
* sub-menus except the direct parent tree will close. Internally an object with the menus
|
107
|
+
* states is maintained for later save duty.
|
108
|
+
*
|
109
|
+
* @param {Element} sub
|
110
|
+
* @param {Boolean} open
|
111
|
+
*/
|
112
|
+
_toggle: function(sub, open) {
|
113
|
+
var self = this,
|
114
|
+
idx = sub.attr('data-index'),
|
115
|
+
parent = sub.parent();
|
116
|
+
|
117
|
+
self.options.onToggleBefore.call(this, sub, open);
|
118
|
+
if (open) {
|
119
|
+
parent.addClass(self.options.openClass);
|
120
|
+
sub.slideDown(self.options.slide);
|
121
|
+
self.state[idx] = 1;
|
122
|
+
|
123
|
+
if (self.options.accordion) {
|
124
|
+
var allowed = self.state = self._parents(sub);
|
125
|
+
allowed[idx] = self.state[idx] = 1;
|
126
|
+
|
127
|
+
self.$el.find('ul').filter(':visible').each(function() {
|
128
|
+
var sub = $(this),
|
129
|
+
idx = sub.attr('data-index');
|
130
|
+
|
131
|
+
if (!allowed.hasOwnProperty(idx)) {
|
132
|
+
self._toggle(sub, false);
|
133
|
+
}
|
134
|
+
});
|
135
|
+
}
|
136
|
+
} else {
|
137
|
+
parent.removeClass(self.options.openClass);
|
138
|
+
sub.slideUp(self.options.slide);
|
139
|
+
self.state[idx] = 0;
|
140
|
+
}
|
141
|
+
self.options.onToggleAfter.call(this, sub, open);
|
142
|
+
},
|
143
|
+
/**
|
144
|
+
* Returns all parents of a sub-menu. When obj is true It returns an object with indexes for
|
145
|
+
* keys and the elements as values, if obj is false the object is filled with the value `1`.
|
146
|
+
*
|
147
|
+
* @since v0.1.2
|
148
|
+
* @param {Element} sub
|
149
|
+
* @param {Boolean} obj
|
150
|
+
* @returns {Object}
|
151
|
+
*/
|
152
|
+
_parents: function(sub, obj) {
|
153
|
+
var result = {},
|
154
|
+
parent = sub.parent(),
|
155
|
+
parents = parent.parents('ul');
|
156
|
+
|
157
|
+
parents.each(function() {
|
158
|
+
var par = $(this),
|
159
|
+
idx = par.attr('data-index');
|
160
|
+
|
161
|
+
if (!idx) {
|
162
|
+
return false;
|
163
|
+
}
|
164
|
+
result[idx] = obj ? par : 1;
|
165
|
+
});
|
166
|
+
return result;
|
167
|
+
},
|
168
|
+
/**
|
169
|
+
* If `save` option is on the internal object that keeps track of the sub-menus states is
|
170
|
+
* saved with a cookie. For size reasons only the open sub-menus indexes are stored. *
|
171
|
+
*/
|
172
|
+
_save: function() {
|
173
|
+
if (this.options.save) {
|
174
|
+
var save = {};
|
175
|
+
for (var key in this.state) {
|
176
|
+
if (this.state[key] === 1) {
|
177
|
+
save[key] = 1;
|
178
|
+
}
|
179
|
+
}
|
180
|
+
cookie[this.uuid] = this.state = save;
|
181
|
+
$.cookie(this.options.cookie.name, JSON.stringify(cookie), this.options.cookie);
|
182
|
+
}
|
183
|
+
},
|
184
|
+
/**
|
185
|
+
* If `save` option is on it reads the cookie data. The cookie contains data for all
|
186
|
+
* navgoco menus so the read happens only once and stored in the global `cookie` var.
|
187
|
+
*/
|
188
|
+
_load: function() {
|
189
|
+
if (this.options.save) {
|
190
|
+
if (cookie === null) {
|
191
|
+
var data = $.cookie(this.options.cookie.name);
|
192
|
+
cookie = (data) ? JSON.parse(data) : {};
|
193
|
+
}
|
194
|
+
this.state = cookie.hasOwnProperty(this.uuid) ? cookie[this.uuid] : {};
|
195
|
+
}
|
196
|
+
},
|
197
|
+
/**
|
198
|
+
* Public method toggle to manually show|hide sub-menus. If no indexes are provided all
|
199
|
+
* items will be toggled. You can pass sub-menus indexes as regular params. eg:
|
200
|
+
* navgoco('toggle', true, 1, 2, 3, 4, 5);
|
201
|
+
*
|
202
|
+
* Since v0.1.2 it will also open parents when providing sub-menu indexes.
|
203
|
+
*
|
204
|
+
* @param {Boolean} open
|
205
|
+
*/
|
206
|
+
toggle: function(open) {
|
207
|
+
var self = this,
|
208
|
+
length = arguments.length;
|
209
|
+
|
210
|
+
if (length <= 1) {
|
211
|
+
self.$el.find('ul').each(function() {
|
212
|
+
var sub = $(this);
|
213
|
+
self._toggle(sub, open);
|
214
|
+
});
|
215
|
+
} else {
|
216
|
+
var idx,
|
217
|
+
list = {},
|
218
|
+
args = Array.prototype.slice.call(arguments, 1);
|
219
|
+
length--;
|
220
|
+
|
221
|
+
for (var i = 0; i < length; i++) {
|
222
|
+
idx = args[i];
|
223
|
+
var sub = self.$el.find('ul[data-index="' + idx + '"]').first();
|
224
|
+
if (sub) {
|
225
|
+
list[idx] = sub;
|
226
|
+
if (open) {
|
227
|
+
var parents = self._parents(sub, true);
|
228
|
+
for (var pIdx in parents) {
|
229
|
+
if (!list.hasOwnProperty(pIdx)) {
|
230
|
+
list[pIdx] = parents[pIdx];
|
231
|
+
}
|
232
|
+
}
|
233
|
+
}
|
234
|
+
}
|
235
|
+
}
|
236
|
+
|
237
|
+
for (idx in list) {
|
238
|
+
self._toggle(list[idx], open);
|
239
|
+
}
|
240
|
+
}
|
241
|
+
self._save();
|
242
|
+
},
|
243
|
+
/**
|
244
|
+
* Removes instance from JQuery data cache and unbinds events.
|
245
|
+
*/
|
246
|
+
destroy: function() {
|
247
|
+
$.removeData(this.$el);
|
248
|
+
this.$el.find("li:has(ul) > a").unbind('click');
|
249
|
+
this.$el.find("li:has(ul) > a > span").unbind('click');
|
250
|
+
}
|
251
|
+
};
|
252
|
+
|
253
|
+
/**
|
254
|
+
* A JQuery plugin wrapper for navgoco. It prevents from multiple instances and also handles
|
255
|
+
* public methods calls. If we attempt to call a public method on an element that doesn't have
|
256
|
+
* a navgoco instance, one will be created for it with the default options.
|
257
|
+
*
|
258
|
+
* @param {Object|String} options
|
259
|
+
*/
|
260
|
+
$.fn.navgoco = function(options) {
|
261
|
+
if (typeof options === 'string' && options.charAt(0) !== '_' && options !== 'init') {
|
262
|
+
var callback = true,
|
263
|
+
args = Array.prototype.slice.call(arguments, 1);
|
264
|
+
} else {
|
265
|
+
options = $.extend({}, $.fn.navgoco.defaults, options || {});
|
266
|
+
if (!$.cookie) {
|
267
|
+
options.save = false;
|
268
|
+
}
|
269
|
+
}
|
270
|
+
return this.each(function(idx) {
|
271
|
+
var $this = $(this),
|
272
|
+
obj = $this.data('navgoco');
|
273
|
+
|
274
|
+
if (!obj) {
|
275
|
+
obj = new Plugin(this, callback ? $.fn.navgoco.defaults : options, idx);
|
276
|
+
$this.data('navgoco', obj);
|
277
|
+
}
|
278
|
+
if (callback) {
|
279
|
+
obj[options].apply(obj, args);
|
280
|
+
}
|
281
|
+
});
|
282
|
+
};
|
283
|
+
/**
|
284
|
+
* Global var holding all navgoco menus open states
|
285
|
+
*
|
286
|
+
* @type {Object}
|
287
|
+
*/
|
288
|
+
var cookie = null;
|
289
|
+
|
290
|
+
/**
|
291
|
+
* Default navgoco options
|
292
|
+
*
|
293
|
+
* @type {Object}
|
294
|
+
*/
|
295
|
+
$.fn.navgoco.defaults = {
|
296
|
+
caretHtml: '',
|
297
|
+
accordion: false,
|
298
|
+
openClass: 'open',
|
299
|
+
save: true,
|
300
|
+
cookie: {
|
301
|
+
name: 'navgoco',
|
302
|
+
expires: false,
|
303
|
+
path: '/'
|
304
|
+
},
|
305
|
+
slide: {
|
306
|
+
duration: 400,
|
307
|
+
easing: 'swing'
|
308
|
+
},
|
309
|
+
onClickBefore: $.noop,
|
310
|
+
onClickAfter: $.noop,
|
311
|
+
onToggleBefore: $.noop,
|
312
|
+
onToggleAfter: $.noop
|
313
|
+
};
|
314
|
+
})(jQuery);
|