├── README.md
├── bootstrap.js
├── style.css
└── wp-bootstrap-navwalker.php
/README.md:
--------------------------------------------------------------------------------
1 | Utilizing the wp-bootstrap-navwalker class by Edward McIntyre (https://github.com/twittem/wp-bootstrap-navwalker), added support
2 | for multi level dropdown menus. This solution works for both WordPress or as
3 | a standalone solution.
4 |
5 | For details visit http://www.jeffmould.com/2014/01/09/responsive-multi-level-bootstrap-menu/
7 |
8 |
9 |
--------------------------------------------------------------------------------
/bootstrap.js:
--------------------------------------------------------------------------------
1 | /*!
2 | * Bootstrap v3.0.3 (http://getbootstrap.com)
3 | * Copyright 2013 Twitter, Inc.
4 | * Licensed under http://www.apache.org/licenses/LICENSE-2.0
5 | */
6 |
7 | if (typeof jQuery === "undefined") { throw new Error("Bootstrap requires jQuery") }
8 |
9 | /* ========================================================================
10 | * Bootstrap: transition.js v3.0.3
11 | * http://getbootstrap.com/javascript/#transitions
12 | * ========================================================================
13 | * Copyright 2013 Twitter, Inc.
14 | *
15 | * Licensed under the Apache License, Version 2.0 (the "License");
16 | * you may not use this file except in compliance with the License.
17 | * You may obtain a copy of the License at
18 | *
19 | * http://www.apache.org/licenses/LICENSE-2.0
20 | *
21 | * Unless required by applicable law or agreed to in writing, software
22 | * distributed under the License is distributed on an "AS IS" BASIS,
23 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
24 | * See the License for the specific language governing permissions and
25 | * limitations under the License.
26 | * ======================================================================== */
27 |
28 |
29 | +function ($) { "use strict";
30 |
31 | // CSS TRANSITION SUPPORT (Shoutout: http://www.modernizr.com/)
32 | // ============================================================
33 |
34 | function transitionEnd() {
35 | var el = document.createElement('bootstrap')
36 |
37 | var transEndEventNames = {
38 | 'WebkitTransition' : 'webkitTransitionEnd'
39 | , 'MozTransition' : 'transitionend'
40 | , 'OTransition' : 'oTransitionEnd otransitionend'
41 | , 'transition' : 'transitionend'
42 | }
43 |
44 | for (var name in transEndEventNames) {
45 | if (el.style[name] !== undefined) {
46 | return { end: transEndEventNames[name] }
47 | }
48 | }
49 | }
50 |
51 | // http://blog.alexmaccaw.com/css-transitions
52 | $.fn.emulateTransitionEnd = function (duration) {
53 | var called = false, $el = this
54 | $(this).one($.support.transition.end, function () { called = true })
55 | var callback = function () { if (!called) $($el).trigger($.support.transition.end) }
56 | setTimeout(callback, duration)
57 | return this
58 | }
59 |
60 | $(function () {
61 | $.support.transition = transitionEnd()
62 | })
63 |
64 | }(jQuery);
65 |
66 | /* ========================================================================
67 | * Bootstrap: alert.js v3.0.3
68 | * http://getbootstrap.com/javascript/#alerts
69 | * ========================================================================
70 | * Copyright 2013 Twitter, Inc.
71 | *
72 | * Licensed under the Apache License, Version 2.0 (the "License");
73 | * you may not use this file except in compliance with the License.
74 | * You may obtain a copy of the License at
75 | *
76 | * http://www.apache.org/licenses/LICENSE-2.0
77 | *
78 | * Unless required by applicable law or agreed to in writing, software
79 | * distributed under the License is distributed on an "AS IS" BASIS,
80 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
81 | * See the License for the specific language governing permissions and
82 | * limitations under the License.
83 | * ======================================================================== */
84 |
85 |
86 | +function ($) { "use strict";
87 |
88 | // ALERT CLASS DEFINITION
89 | // ======================
90 |
91 | var dismiss = '[data-dismiss="alert"]'
92 | var Alert = function (el) {
93 | $(el).on('click', dismiss, this.close)
94 | }
95 |
96 | Alert.prototype.close = function (e) {
97 | var $this = $(this)
98 | var selector = $this.attr('data-target')
99 |
100 | if (!selector) {
101 | selector = $this.attr('href')
102 | selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') // strip for ie7
103 | }
104 |
105 | var $parent = $(selector)
106 |
107 | if (e) e.preventDefault()
108 |
109 | if (!$parent.length) {
110 | $parent = $this.hasClass('alert') ? $this : $this.parent()
111 | }
112 |
113 | $parent.trigger(e = $.Event('close.bs.alert'))
114 |
115 | if (e.isDefaultPrevented()) return
116 |
117 | $parent.removeClass('in')
118 |
119 | function removeElement() {
120 | $parent.trigger('closed.bs.alert').remove()
121 | }
122 |
123 | $.support.transition && $parent.hasClass('fade') ?
124 | $parent
125 | .one($.support.transition.end, removeElement)
126 | .emulateTransitionEnd(150) :
127 | removeElement()
128 | }
129 |
130 |
131 | // ALERT PLUGIN DEFINITION
132 | // =======================
133 |
134 | var old = $.fn.alert
135 |
136 | $.fn.alert = function (option) {
137 | return this.each(function () {
138 | var $this = $(this)
139 | var data = $this.data('bs.alert')
140 |
141 | if (!data) $this.data('bs.alert', (data = new Alert(this)))
142 | if (typeof option == 'string') data[option].call($this)
143 | })
144 | }
145 |
146 | $.fn.alert.Constructor = Alert
147 |
148 |
149 | // ALERT NO CONFLICT
150 | // =================
151 |
152 | $.fn.alert.noConflict = function () {
153 | $.fn.alert = old
154 | return this
155 | }
156 |
157 |
158 | // ALERT DATA-API
159 | // ==============
160 |
161 | $(document).on('click.bs.alert.data-api', dismiss, Alert.prototype.close)
162 |
163 | }(jQuery);
164 |
165 | /* ========================================================================
166 | * Bootstrap: button.js v3.0.3
167 | * http://getbootstrap.com/javascript/#buttons
168 | * ========================================================================
169 | * Copyright 2013 Twitter, Inc.
170 | *
171 | * Licensed under the Apache License, Version 2.0 (the "License");
172 | * you may not use this file except in compliance with the License.
173 | * You may obtain a copy of the License at
174 | *
175 | * http://www.apache.org/licenses/LICENSE-2.0
176 | *
177 | * Unless required by applicable law or agreed to in writing, software
178 | * distributed under the License is distributed on an "AS IS" BASIS,
179 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
180 | * See the License for the specific language governing permissions and
181 | * limitations under the License.
182 | * ======================================================================== */
183 |
184 |
185 | +function ($) { "use strict";
186 |
187 | // BUTTON PUBLIC CLASS DEFINITION
188 | // ==============================
189 |
190 | var Button = function (element, options) {
191 | this.$element = $(element)
192 | this.options = $.extend({}, Button.DEFAULTS, options)
193 | }
194 |
195 | Button.DEFAULTS = {
196 | loadingText: 'loading...'
197 | }
198 |
199 | Button.prototype.setState = function (state) {
200 | var d = 'disabled'
201 | var $el = this.$element
202 | var val = $el.is('input') ? 'val' : 'html'
203 | var data = $el.data()
204 |
205 | state = state + 'Text'
206 |
207 | if (!data.resetText) $el.data('resetText', $el[val]())
208 |
209 | $el[val](data[state] || this.options[state])
210 |
211 | // push to event loop to allow forms to submit
212 | setTimeout(function () {
213 | state == 'loadingText' ?
214 | $el.addClass(d).attr(d, d) :
215 | $el.removeClass(d).removeAttr(d);
216 | }, 0)
217 | }
218 |
219 | Button.prototype.toggle = function () {
220 | var $parent = this.$element.closest('[data-toggle="buttons"]')
221 | var changed = true
222 |
223 | if ($parent.length) {
224 | var $input = this.$element.find('input')
225 | if ($input.prop('type') === 'radio') {
226 | // see if clicking on current one
227 | if ($input.prop('checked') && this.$element.hasClass('active'))
228 | changed = false
229 | else
230 | $parent.find('.active').removeClass('active')
231 | }
232 | if (changed) $input.prop('checked', !this.$element.hasClass('active')).trigger('change')
233 | }
234 |
235 | if (changed) this.$element.toggleClass('active')
236 | }
237 |
238 |
239 | // BUTTON PLUGIN DEFINITION
240 | // ========================
241 |
242 | var old = $.fn.button
243 |
244 | $.fn.button = function (option) {
245 | return this.each(function () {
246 | var $this = $(this)
247 | var data = $this.data('bs.button')
248 | var options = typeof option == 'object' && option
249 |
250 | if (!data) $this.data('bs.button', (data = new Button(this, options)))
251 |
252 | if (option == 'toggle') data.toggle()
253 | else if (option) data.setState(option)
254 | })
255 | }
256 |
257 | $.fn.button.Constructor = Button
258 |
259 |
260 | // BUTTON NO CONFLICT
261 | // ==================
262 |
263 | $.fn.button.noConflict = function () {
264 | $.fn.button = old
265 | return this
266 | }
267 |
268 |
269 | // BUTTON DATA-API
270 | // ===============
271 |
272 | $(document).on('click.bs.button.data-api', '[data-toggle^=button]', function (e) {
273 | var $btn = $(e.target)
274 | if (!$btn.hasClass('btn')) $btn = $btn.closest('.btn')
275 | $btn.button('toggle')
276 | e.preventDefault()
277 | })
278 |
279 | }(jQuery);
280 |
281 | /* ========================================================================
282 | * Bootstrap: carousel.js v3.0.3
283 | * http://getbootstrap.com/javascript/#carousel
284 | * ========================================================================
285 | * Copyright 2013 Twitter, Inc.
286 | *
287 | * Licensed under the Apache License, Version 2.0 (the "License");
288 | * you may not use this file except in compliance with the License.
289 | * You may obtain a copy of the License at
290 | *
291 | * http://www.apache.org/licenses/LICENSE-2.0
292 | *
293 | * Unless required by applicable law or agreed to in writing, software
294 | * distributed under the License is distributed on an "AS IS" BASIS,
295 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
296 | * See the License for the specific language governing permissions and
297 | * limitations under the License.
298 | * ======================================================================== */
299 |
300 |
301 | +function ($) { "use strict";
302 |
303 | // CAROUSEL CLASS DEFINITION
304 | // =========================
305 |
306 | var Carousel = function (element, options) {
307 | this.$element = $(element)
308 | this.$indicators = this.$element.find('.carousel-indicators')
309 | this.options = options
310 | this.paused =
311 | this.sliding =
312 | this.interval =
313 | this.$active =
314 | this.$items = null
315 |
316 | this.options.pause == 'hover' && this.$element
317 | .on('mouseenter', $.proxy(this.pause, this))
318 | .on('mouseleave', $.proxy(this.cycle, this))
319 | }
320 |
321 | Carousel.DEFAULTS = {
322 | interval: 5000
323 | , pause: 'hover'
324 | , wrap: true
325 | }
326 |
327 | Carousel.prototype.cycle = function (e) {
328 | e || (this.paused = false)
329 |
330 | this.interval && clearInterval(this.interval)
331 |
332 | this.options.interval
333 | && !this.paused
334 | && (this.interval = setInterval($.proxy(this.next, this), this.options.interval))
335 |
336 | return this
337 | }
338 |
339 | Carousel.prototype.getActiveIndex = function () {
340 | this.$active = this.$element.find('.item.active')
341 | this.$items = this.$active.parent().children()
342 |
343 | return this.$items.index(this.$active)
344 | }
345 |
346 | Carousel.prototype.to = function (pos) {
347 | var that = this
348 | var activeIndex = this.getActiveIndex()
349 |
350 | if (pos > (this.$items.length - 1) || pos < 0) return
351 |
352 | if (this.sliding) return this.$element.one('slid.bs.carousel', function () { that.to(pos) })
353 | if (activeIndex == pos) return this.pause().cycle()
354 |
355 | return this.slide(pos > activeIndex ? 'next' : 'prev', $(this.$items[pos]))
356 | }
357 |
358 | Carousel.prototype.pause = function (e) {
359 | e || (this.paused = true)
360 |
361 | if (this.$element.find('.next, .prev').length && $.support.transition.end) {
362 | this.$element.trigger($.support.transition.end)
363 | this.cycle(true)
364 | }
365 |
366 | this.interval = clearInterval(this.interval)
367 |
368 | return this
369 | }
370 |
371 | Carousel.prototype.next = function () {
372 | if (this.sliding) return
373 | return this.slide('next')
374 | }
375 |
376 | Carousel.prototype.prev = function () {
377 | if (this.sliding) return
378 | return this.slide('prev')
379 | }
380 |
381 | Carousel.prototype.slide = function (type, next) {
382 | var $active = this.$element.find('.item.active')
383 | var $next = next || $active[type]()
384 | var isCycling = this.interval
385 | var direction = type == 'next' ? 'left' : 'right'
386 | var fallback = type == 'next' ? 'first' : 'last'
387 | var that = this
388 |
389 | if (!$next.length) {
390 | if (!this.options.wrap) return
391 | $next = this.$element.find('.item')[fallback]()
392 | }
393 |
394 | this.sliding = true
395 |
396 | isCycling && this.pause()
397 |
398 | var e = $.Event('slide.bs.carousel', { relatedTarget: $next[0], direction: direction })
399 |
400 | if ($next.hasClass('active')) return
401 |
402 | if (this.$indicators.length) {
403 | this.$indicators.find('.active').removeClass('active')
404 | this.$element.one('slid.bs.carousel', function () {
405 | var $nextIndicator = $(that.$indicators.children()[that.getActiveIndex()])
406 | $nextIndicator && $nextIndicator.addClass('active')
407 | })
408 | }
409 |
410 | if ($.support.transition && this.$element.hasClass('slide')) {
411 | this.$element.trigger(e)
412 | if (e.isDefaultPrevented()) return
413 | $next.addClass(type)
414 | $next[0].offsetWidth // force reflow
415 | $active.addClass(direction)
416 | $next.addClass(direction)
417 | $active
418 | .one($.support.transition.end, function () {
419 | $next.removeClass([type, direction].join(' ')).addClass('active')
420 | $active.removeClass(['active', direction].join(' '))
421 | that.sliding = false
422 | setTimeout(function () { that.$element.trigger('slid.bs.carousel') }, 0)
423 | })
424 | .emulateTransitionEnd(600)
425 | } else {
426 | this.$element.trigger(e)
427 | if (e.isDefaultPrevented()) return
428 | $active.removeClass('active')
429 | $next.addClass('active')
430 | this.sliding = false
431 | this.$element.trigger('slid.bs.carousel')
432 | }
433 |
434 | isCycling && this.cycle()
435 |
436 | return this
437 | }
438 |
439 |
440 | // CAROUSEL PLUGIN DEFINITION
441 | // ==========================
442 |
443 | var old = $.fn.carousel
444 |
445 | $.fn.carousel = function (option) {
446 | return this.each(function () {
447 | var $this = $(this)
448 | var data = $this.data('bs.carousel')
449 | var options = $.extend({}, Carousel.DEFAULTS, $this.data(), typeof option == 'object' && option)
450 | var action = typeof option == 'string' ? option : options.slide
451 |
452 | if (!data) $this.data('bs.carousel', (data = new Carousel(this, options)))
453 | if (typeof option == 'number') data.to(option)
454 | else if (action) data[action]()
455 | else if (options.interval) data.pause().cycle()
456 | })
457 | }
458 |
459 | $.fn.carousel.Constructor = Carousel
460 |
461 |
462 | // CAROUSEL NO CONFLICT
463 | // ====================
464 |
465 | $.fn.carousel.noConflict = function () {
466 | $.fn.carousel = old
467 | return this
468 | }
469 |
470 |
471 | // CAROUSEL DATA-API
472 | // =================
473 |
474 | $(document).on('click.bs.carousel.data-api', '[data-slide], [data-slide-to]', function (e) {
475 | var $this = $(this), href
476 | var $target = $($this.attr('data-target') || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7
477 | var options = $.extend({}, $target.data(), $this.data())
478 | var slideIndex = $this.attr('data-slide-to')
479 | if (slideIndex) options.interval = false
480 |
481 | $target.carousel(options)
482 |
483 | if (slideIndex = $this.attr('data-slide-to')) {
484 | $target.data('bs.carousel').to(slideIndex)
485 | }
486 |
487 | e.preventDefault()
488 | })
489 |
490 | $(window).on('load', function () {
491 | $('[data-ride="carousel"]').each(function () {
492 | var $carousel = $(this)
493 | $carousel.carousel($carousel.data())
494 | })
495 | })
496 |
497 | }(jQuery);
498 |
499 | /* ========================================================================
500 | * Bootstrap: collapse.js v3.0.3
501 | * http://getbootstrap.com/javascript/#collapse
502 | * ========================================================================
503 | * Copyright 2013 Twitter, Inc.
504 | *
505 | * Licensed under the Apache License, Version 2.0 (the "License");
506 | * you may not use this file except in compliance with the License.
507 | * You may obtain a copy of the License at
508 | *
509 | * http://www.apache.org/licenses/LICENSE-2.0
510 | *
511 | * Unless required by applicable law or agreed to in writing, software
512 | * distributed under the License is distributed on an "AS IS" BASIS,
513 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
514 | * See the License for the specific language governing permissions and
515 | * limitations under the License.
516 | * ======================================================================== */
517 |
518 |
519 | +function ($) { "use strict";
520 |
521 | // COLLAPSE PUBLIC CLASS DEFINITION
522 | // ================================
523 |
524 | var Collapse = function (element, options) {
525 | this.$element = $(element)
526 | this.options = $.extend({}, Collapse.DEFAULTS, options)
527 | this.transitioning = null
528 |
529 | if (this.options.parent) this.$parent = $(this.options.parent)
530 | if (this.options.toggle) this.toggle()
531 | }
532 |
533 | Collapse.DEFAULTS = {
534 | toggle: true
535 | }
536 |
537 | Collapse.prototype.dimension = function () {
538 | var hasWidth = this.$element.hasClass('width')
539 | return hasWidth ? 'width' : 'height'
540 | }
541 |
542 | Collapse.prototype.show = function () {
543 | if (this.transitioning || this.$element.hasClass('in')) return
544 |
545 | var startEvent = $.Event('show.bs.collapse')
546 | this.$element.trigger(startEvent)
547 | if (startEvent.isDefaultPrevented()) return
548 |
549 | var actives = this.$parent && this.$parent.find('> .panel > .in')
550 |
551 | if (actives && actives.length) {
552 | var hasData = actives.data('bs.collapse')
553 | if (hasData && hasData.transitioning) return
554 | actives.collapse('hide')
555 | hasData || actives.data('bs.collapse', null)
556 | }
557 |
558 | var dimension = this.dimension()
559 |
560 | this.$element
561 | .removeClass('collapse')
562 | .addClass('collapsing')
563 | [dimension](0)
564 |
565 | this.transitioning = 1
566 |
567 | var complete = function () {
568 | this.$element
569 | .removeClass('collapsing')
570 | .addClass('in')
571 | [dimension]('auto')
572 | this.transitioning = 0
573 | this.$element.trigger('shown.bs.collapse')
574 | }
575 |
576 | if (!$.support.transition) return complete.call(this)
577 |
578 | var scrollSize = $.camelCase(['scroll', dimension].join('-'))
579 |
580 | this.$element
581 | .one($.support.transition.end, $.proxy(complete, this))
582 | .emulateTransitionEnd(350)
583 | [dimension](this.$element[0][scrollSize])
584 | }
585 |
586 | Collapse.prototype.hide = function () {
587 | if (this.transitioning || !this.$element.hasClass('in')) return
588 |
589 | var startEvent = $.Event('hide.bs.collapse')
590 | this.$element.trigger(startEvent)
591 | if (startEvent.isDefaultPrevented()) return
592 |
593 | var dimension = this.dimension()
594 |
595 | this.$element
596 | [dimension](this.$element[dimension]())
597 | [0].offsetHeight
598 |
599 | this.$element
600 | .addClass('collapsing')
601 | .removeClass('collapse')
602 | .removeClass('in')
603 |
604 | this.transitioning = 1
605 |
606 | var complete = function () {
607 | this.transitioning = 0
608 | this.$element
609 | .trigger('hidden.bs.collapse')
610 | .removeClass('collapsing')
611 | .addClass('collapse')
612 | }
613 |
614 | if (!$.support.transition) return complete.call(this)
615 |
616 | this.$element
617 | [dimension](0)
618 | .one($.support.transition.end, $.proxy(complete, this))
619 | .emulateTransitionEnd(350)
620 | }
621 |
622 | Collapse.prototype.toggle = function () {
623 | this[this.$element.hasClass('in') ? 'hide' : 'show']()
624 | }
625 |
626 |
627 | // COLLAPSE PLUGIN DEFINITION
628 | // ==========================
629 |
630 | var old = $.fn.collapse
631 |
632 | $.fn.collapse = function (option) {
633 | return this.each(function () {
634 | var $this = $(this)
635 | var data = $this.data('bs.collapse')
636 | var options = $.extend({}, Collapse.DEFAULTS, $this.data(), typeof option == 'object' && option)
637 |
638 | if (!data) $this.data('bs.collapse', (data = new Collapse(this, options)))
639 | if (typeof option == 'string') data[option]()
640 | })
641 | }
642 |
643 | $.fn.collapse.Constructor = Collapse
644 |
645 |
646 | // COLLAPSE NO CONFLICT
647 | // ====================
648 |
649 | $.fn.collapse.noConflict = function () {
650 | $.fn.collapse = old
651 | return this
652 | }
653 |
654 |
655 | // COLLAPSE DATA-API
656 | // =================
657 |
658 | $(document).on('click.bs.collapse.data-api', '[data-toggle=collapse]', function (e) {
659 | var $this = $(this), href
660 | var target = $this.attr('data-target')
661 | || e.preventDefault()
662 | || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '') //strip for ie7
663 | var $target = $(target)
664 | var data = $target.data('bs.collapse')
665 | var option = data ? 'toggle' : $this.data()
666 | var parent = $this.attr('data-parent')
667 | var $parent = parent && $(parent)
668 |
669 | if (!data || !data.transitioning) {
670 | if ($parent) $parent.find('[data-toggle=collapse][data-parent="' + parent + '"]').not($this).addClass('collapsed')
671 | $this[$target.hasClass('in') ? 'addClass' : 'removeClass']('collapsed')
672 | }
673 |
674 | $target.collapse(option)
675 | })
676 |
677 | }(jQuery);
678 |
679 | /* ========================================================================
680 | * Bootstrap: dropdown.js v3.0.3
681 | * http://getbootstrap.com/javascript/#dropdowns
682 | * ========================================================================
683 | * Copyright 2013 Twitter, Inc.
684 | *
685 | * Licensed under the Apache License, Version 2.0 (the "License");
686 | * you may not use this file except in compliance with the License.
687 | * You may obtain a copy of the License at
688 | *
689 | * http://www.apache.org/licenses/LICENSE-2.0
690 | *
691 | * Unless required by applicable law or agreed to in writing, software
692 | * distributed under the License is distributed on an "AS IS" BASIS,
693 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
694 | * See the License for the specific language governing permissions and
695 | * limitations under the License.
696 | * ======================================================================== */
697 |
698 |
699 | !function ($) {
700 |
701 | "use strict"; // jshint ;_;
702 |
703 |
704 | /* DROPDOWN CLASS DEFINITION
705 | * ========================= */
706 |
707 | var toggle = '[data-toggle=dropdown]'
708 | , Dropdown = function (element) {
709 | var $el = $(element).on('click.dropdown.data-api', this.toggle)
710 | $('html').on('click.dropdown.data-api', function () {
711 | $el.parent().removeClass('open')
712 | })
713 | }
714 |
715 | Dropdown.prototype = {
716 |
717 | constructor: Dropdown
718 |
719 | , toggle: function (e) {
720 | var $this = $(this)
721 | , $parent
722 | , isActive
723 |
724 | if ($this.is('.disabled, :disabled')) return
725 |
726 | $parent = getParent($this)
727 |
728 | isActive = $parent.hasClass('open')
729 |
730 | clearMenus()
731 |
732 | if (!isActive) {
733 | if ('ontouchstart' in document.documentElement) {
734 | // if mobile we we use a backdrop because click events don't delegate
735 | $('
').insertBefore($(this)).on('click', clearMenus)
736 | }
737 | $parent.toggleClass('open')
738 | }
739 |
740 | $this.focus()
741 |
742 | return false
743 | }
744 |
745 | , keydown: function (e) {
746 | var $this
747 | , $items
748 | , $active
749 | , $parent
750 | , isActive
751 | , index
752 |
753 | if (!/(38|40|27)/.test(e.keyCode)) return
754 |
755 | $this = $(this)
756 |
757 | e.preventDefault()
758 | e.stopPropagation()
759 |
760 | if ($this.is('.disabled, :disabled')) return
761 |
762 | $parent = getParent($this)
763 |
764 | isActive = $parent.hasClass('open')
765 |
766 | if (!isActive || (isActive && e.keyCode == 27)) {
767 | if (e.which == 27) $parent.find(toggle).focus()
768 | return $this.click()
769 | }
770 |
771 | $items = $('[role=menu] li:not(.divider):visible a', $parent)
772 |
773 | if (!$items.length) return
774 |
775 | index = $items.index($items.filter(':focus'))
776 |
777 | if (e.keyCode == 38 && index > 0) index-- // up
778 | if (e.keyCode == 40 && index < $items.length - 1) index++ // down
779 | if (!~index) index = 0
780 |
781 | $items
782 | .eq(index)
783 | .focus()
784 | }
785 |
786 | }
787 |
788 | function clearMenus() {
789 | $('.dropdown-backdrop').remove()
790 | $(toggle).each(function () {
791 | getParent($(this)).removeClass('open')
792 | })
793 | }
794 |
795 | function getParent($this) {
796 | var selector = $this.attr('data-target')
797 | , $parent
798 |
799 | if (!selector) {
800 | selector = $this.attr('href')
801 | selector = selector && /#/.test(selector) && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7
802 | }
803 |
804 | $parent = selector && $(selector)
805 |
806 | if (!$parent || !$parent.length) $parent = $this.parent()
807 |
808 | return $parent
809 | }
810 |
811 |
812 | /* DROPDOWN PLUGIN DEFINITION
813 | * ========================== */
814 |
815 | var old = $.fn.dropdown
816 |
817 | $.fn.dropdown = function (option) {
818 | return this.each(function () {
819 | var $this = $(this)
820 | , data = $this.data('dropdown')
821 | if (!data) $this.data('dropdown', (data = new Dropdown(this)))
822 | if (typeof option == 'string') data[option].call($this)
823 | })
824 | }
825 |
826 | $.fn.dropdown.Constructor = Dropdown
827 |
828 |
829 | /* DROPDOWN NO CONFLICT
830 | * ==================== */
831 |
832 | $.fn.dropdown.noConflict = function () {
833 | $.fn.dropdown = old
834 | return this
835 | }
836 |
837 |
838 | /* APPLY TO STANDARD DROPDOWN ELEMENTS
839 | * =================================== */
840 |
841 | $(document)
842 | .on('click.dropdown.data-api', clearMenus)
843 | .on('click.dropdown.data-api', '.dropdown form', function (e) { e.stopPropagation() })
844 | .on('click.dropdown.data-api' , toggle, Dropdown.prototype.toggle)
845 | .on('keydown.dropdown.data-api', toggle + ', [role=menu]' , Dropdown.prototype.keydown)
846 |
847 | }(window.jQuery);
848 |
849 | /* ========================================================================
850 | * Bootstrap: modal.js v3.0.3
851 | * http://getbootstrap.com/javascript/#modals
852 | * ========================================================================
853 | * Copyright 2013 Twitter, Inc.
854 | *
855 | * Licensed under the Apache License, Version 2.0 (the "License");
856 | * you may not use this file except in compliance with the License.
857 | * You may obtain a copy of the License at
858 | *
859 | * http://www.apache.org/licenses/LICENSE-2.0
860 | *
861 | * Unless required by applicable law or agreed to in writing, software
862 | * distributed under the License is distributed on an "AS IS" BASIS,
863 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
864 | * See the License for the specific language governing permissions and
865 | * limitations under the License.
866 | * ======================================================================== */
867 |
868 |
869 | +function ($) { "use strict";
870 |
871 | // MODAL CLASS DEFINITION
872 | // ======================
873 |
874 | var Modal = function (element, options) {
875 | this.options = options
876 | this.$element = $(element)
877 | this.$backdrop =
878 | this.isShown = null
879 |
880 | if (this.options.remote) this.$element.load(this.options.remote)
881 | }
882 |
883 | Modal.DEFAULTS = {
884 | backdrop: true
885 | , keyboard: true
886 | , show: true
887 | }
888 |
889 | Modal.prototype.toggle = function (_relatedTarget) {
890 | return this[!this.isShown ? 'show' : 'hide'](_relatedTarget)
891 | }
892 |
893 | Modal.prototype.show = function (_relatedTarget) {
894 | var that = this
895 | var e = $.Event('show.bs.modal', { relatedTarget: _relatedTarget })
896 |
897 | this.$element.trigger(e)
898 |
899 | if (this.isShown || e.isDefaultPrevented()) return
900 |
901 | this.isShown = true
902 |
903 | this.escape()
904 |
905 | this.$element.on('click.dismiss.modal', '[data-dismiss="modal"]', $.proxy(this.hide, this))
906 |
907 | this.backdrop(function () {
908 | var transition = $.support.transition && that.$element.hasClass('fade')
909 |
910 | if (!that.$element.parent().length) {
911 | that.$element.appendTo(document.body) // don't move modals dom position
912 | }
913 |
914 | that.$element.show()
915 |
916 | if (transition) {
917 | that.$element[0].offsetWidth // force reflow
918 | }
919 |
920 | that.$element
921 | .addClass('in')
922 | .attr('aria-hidden', false)
923 |
924 | that.enforceFocus()
925 |
926 | var e = $.Event('shown.bs.modal', { relatedTarget: _relatedTarget })
927 |
928 | transition ?
929 | that.$element.find('.modal-dialog') // wait for modal to slide in
930 | .one($.support.transition.end, function () {
931 | that.$element.focus().trigger(e)
932 | })
933 | .emulateTransitionEnd(300) :
934 | that.$element.focus().trigger(e)
935 | })
936 | }
937 |
938 | Modal.prototype.hide = function (e) {
939 | if (e) e.preventDefault()
940 |
941 | e = $.Event('hide.bs.modal')
942 |
943 | this.$element.trigger(e)
944 |
945 | if (!this.isShown || e.isDefaultPrevented()) return
946 |
947 | this.isShown = false
948 |
949 | this.escape()
950 |
951 | $(document).off('focusin.bs.modal')
952 |
953 | this.$element
954 | .removeClass('in')
955 | .attr('aria-hidden', true)
956 | .off('click.dismiss.modal')
957 |
958 | $.support.transition && this.$element.hasClass('fade') ?
959 | this.$element
960 | .one($.support.transition.end, $.proxy(this.hideModal, this))
961 | .emulateTransitionEnd(300) :
962 | this.hideModal()
963 | }
964 |
965 | Modal.prototype.enforceFocus = function () {
966 | $(document)
967 | .off('focusin.bs.modal') // guard against infinite focus loop
968 | .on('focusin.bs.modal', $.proxy(function (e) {
969 | if (this.$element[0] !== e.target && !this.$element.has(e.target).length) {
970 | this.$element.focus()
971 | }
972 | }, this))
973 | }
974 |
975 | Modal.prototype.escape = function () {
976 | if (this.isShown && this.options.keyboard) {
977 | this.$element.on('keyup.dismiss.bs.modal', $.proxy(function (e) {
978 | e.which == 27 && this.hide()
979 | }, this))
980 | } else if (!this.isShown) {
981 | this.$element.off('keyup.dismiss.bs.modal')
982 | }
983 | }
984 |
985 | Modal.prototype.hideModal = function () {
986 | var that = this
987 | this.$element.hide()
988 | this.backdrop(function () {
989 | that.removeBackdrop()
990 | that.$element.trigger('hidden.bs.modal')
991 | })
992 | }
993 |
994 | Modal.prototype.removeBackdrop = function () {
995 | this.$backdrop && this.$backdrop.remove()
996 | this.$backdrop = null
997 | }
998 |
999 | Modal.prototype.backdrop = function (callback) {
1000 | var that = this
1001 | var animate = this.$element.hasClass('fade') ? 'fade' : ''
1002 |
1003 | if (this.isShown && this.options.backdrop) {
1004 | var doAnimate = $.support.transition && animate
1005 |
1006 | this.$backdrop = $('')
1007 | .appendTo(document.body)
1008 |
1009 | this.$element.on('click.dismiss.modal', $.proxy(function (e) {
1010 | if (e.target !== e.currentTarget) return
1011 | this.options.backdrop == 'static'
1012 | ? this.$element[0].focus.call(this.$element[0])
1013 | : this.hide.call(this)
1014 | }, this))
1015 |
1016 | if (doAnimate) this.$backdrop[0].offsetWidth // force reflow
1017 |
1018 | this.$backdrop.addClass('in')
1019 |
1020 | if (!callback) return
1021 |
1022 | doAnimate ?
1023 | this.$backdrop
1024 | .one($.support.transition.end, callback)
1025 | .emulateTransitionEnd(150) :
1026 | callback()
1027 |
1028 | } else if (!this.isShown && this.$backdrop) {
1029 | this.$backdrop.removeClass('in')
1030 |
1031 | $.support.transition && this.$element.hasClass('fade')?
1032 | this.$backdrop
1033 | .one($.support.transition.end, callback)
1034 | .emulateTransitionEnd(150) :
1035 | callback()
1036 |
1037 | } else if (callback) {
1038 | callback()
1039 | }
1040 | }
1041 |
1042 |
1043 | // MODAL PLUGIN DEFINITION
1044 | // =======================
1045 |
1046 | var old = $.fn.modal
1047 |
1048 | $.fn.modal = function (option, _relatedTarget) {
1049 | return this.each(function () {
1050 | var $this = $(this)
1051 | var data = $this.data('bs.modal')
1052 | var options = $.extend({}, Modal.DEFAULTS, $this.data(), typeof option == 'object' && option)
1053 |
1054 | if (!data) $this.data('bs.modal', (data = new Modal(this, options)))
1055 | if (typeof option == 'string') data[option](_relatedTarget)
1056 | else if (options.show) data.show(_relatedTarget)
1057 | })
1058 | }
1059 |
1060 | $.fn.modal.Constructor = Modal
1061 |
1062 |
1063 | // MODAL NO CONFLICT
1064 | // =================
1065 |
1066 | $.fn.modal.noConflict = function () {
1067 | $.fn.modal = old
1068 | return this
1069 | }
1070 |
1071 |
1072 | // MODAL DATA-API
1073 | // ==============
1074 |
1075 | $(document).on('click.bs.modal.data-api', '[data-toggle="modal"]', function (e) {
1076 | var $this = $(this)
1077 | var href = $this.attr('href')
1078 | var $target = $($this.attr('data-target') || (href && href.replace(/.*(?=#[^\s]+$)/, ''))) //strip for ie7
1079 | var option = $target.data('modal') ? 'toggle' : $.extend({ remote: !/#/.test(href) && href }, $target.data(), $this.data())
1080 |
1081 | e.preventDefault()
1082 |
1083 | $target
1084 | .modal(option, this)
1085 | .one('hide', function () {
1086 | $this.is(':visible') && $this.focus()
1087 | })
1088 | })
1089 |
1090 | $(document)
1091 | .on('show.bs.modal', '.modal', function () { $(document.body).addClass('modal-open') })
1092 | .on('hidden.bs.modal', '.modal', function () { $(document.body).removeClass('modal-open') })
1093 |
1094 | }(jQuery);
1095 |
1096 | /* ========================================================================
1097 | * Bootstrap: tooltip.js v3.0.3
1098 | * http://getbootstrap.com/javascript/#tooltip
1099 | * Inspired by the original jQuery.tipsy by Jason Frame
1100 | * ========================================================================
1101 | * Copyright 2013 Twitter, Inc.
1102 | *
1103 | * Licensed under the Apache License, Version 2.0 (the "License");
1104 | * you may not use this file except in compliance with the License.
1105 | * You may obtain a copy of the License at
1106 | *
1107 | * http://www.apache.org/licenses/LICENSE-2.0
1108 | *
1109 | * Unless required by applicable law or agreed to in writing, software
1110 | * distributed under the License is distributed on an "AS IS" BASIS,
1111 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1112 | * See the License for the specific language governing permissions and
1113 | * limitations under the License.
1114 | * ======================================================================== */
1115 |
1116 |
1117 | +function ($) { "use strict";
1118 |
1119 | // TOOLTIP PUBLIC CLASS DEFINITION
1120 | // ===============================
1121 |
1122 | var Tooltip = function (element, options) {
1123 | this.type =
1124 | this.options =
1125 | this.enabled =
1126 | this.timeout =
1127 | this.hoverState =
1128 | this.$element = null
1129 |
1130 | this.init('tooltip', element, options)
1131 | }
1132 |
1133 | Tooltip.DEFAULTS = {
1134 | animation: true
1135 | , placement: 'top'
1136 | , selector: false
1137 | , template: ''
1138 | , trigger: 'hover focus'
1139 | , title: ''
1140 | , delay: 0
1141 | , html: false
1142 | , container: false
1143 | }
1144 |
1145 | Tooltip.prototype.init = function (type, element, options) {
1146 | this.enabled = true
1147 | this.type = type
1148 | this.$element = $(element)
1149 | this.options = this.getOptions(options)
1150 |
1151 | var triggers = this.options.trigger.split(' ')
1152 |
1153 | for (var i = triggers.length; i--;) {
1154 | var trigger = triggers[i]
1155 |
1156 | if (trigger == 'click') {
1157 | this.$element.on('click.' + this.type, this.options.selector, $.proxy(this.toggle, this))
1158 | } else if (trigger != 'manual') {
1159 | var eventIn = trigger == 'hover' ? 'mouseenter' : 'focus'
1160 | var eventOut = trigger == 'hover' ? 'mouseleave' : 'blur'
1161 |
1162 | this.$element.on(eventIn + '.' + this.type, this.options.selector, $.proxy(this.enter, this))
1163 | this.$element.on(eventOut + '.' + this.type, this.options.selector, $.proxy(this.leave, this))
1164 | }
1165 | }
1166 |
1167 | this.options.selector ?
1168 | (this._options = $.extend({}, this.options, { trigger: 'manual', selector: '' })) :
1169 | this.fixTitle()
1170 | }
1171 |
1172 | Tooltip.prototype.getDefaults = function () {
1173 | return Tooltip.DEFAULTS
1174 | }
1175 |
1176 | Tooltip.prototype.getOptions = function (options) {
1177 | options = $.extend({}, this.getDefaults(), this.$element.data(), options)
1178 |
1179 | if (options.delay && typeof options.delay == 'number') {
1180 | options.delay = {
1181 | show: options.delay
1182 | , hide: options.delay
1183 | }
1184 | }
1185 |
1186 | return options
1187 | }
1188 |
1189 | Tooltip.prototype.getDelegateOptions = function () {
1190 | var options = {}
1191 | var defaults = this.getDefaults()
1192 |
1193 | this._options && $.each(this._options, function (key, value) {
1194 | if (defaults[key] != value) options[key] = value
1195 | })
1196 |
1197 | return options
1198 | }
1199 |
1200 | Tooltip.prototype.enter = function (obj) {
1201 | var self = obj instanceof this.constructor ?
1202 | obj : $(obj.currentTarget)[this.type](this.getDelegateOptions()).data('bs.' + this.type)
1203 |
1204 | clearTimeout(self.timeout)
1205 |
1206 | self.hoverState = 'in'
1207 |
1208 | if (!self.options.delay || !self.options.delay.show) return self.show()
1209 |
1210 | self.timeout = setTimeout(function () {
1211 | if (self.hoverState == 'in') self.show()
1212 | }, self.options.delay.show)
1213 | }
1214 |
1215 | Tooltip.prototype.leave = function (obj) {
1216 | var self = obj instanceof this.constructor ?
1217 | obj : $(obj.currentTarget)[this.type](this.getDelegateOptions()).data('bs.' + this.type)
1218 |
1219 | clearTimeout(self.timeout)
1220 |
1221 | self.hoverState = 'out'
1222 |
1223 | if (!self.options.delay || !self.options.delay.hide) return self.hide()
1224 |
1225 | self.timeout = setTimeout(function () {
1226 | if (self.hoverState == 'out') self.hide()
1227 | }, self.options.delay.hide)
1228 | }
1229 |
1230 | Tooltip.prototype.show = function () {
1231 | var e = $.Event('show.bs.'+ this.type)
1232 |
1233 | if (this.hasContent() && this.enabled) {
1234 | this.$element.trigger(e)
1235 |
1236 | if (e.isDefaultPrevented()) return
1237 |
1238 | var $tip = this.tip()
1239 |
1240 | this.setContent()
1241 |
1242 | if (this.options.animation) $tip.addClass('fade')
1243 |
1244 | var placement = typeof this.options.placement == 'function' ?
1245 | this.options.placement.call(this, $tip[0], this.$element[0]) :
1246 | this.options.placement
1247 |
1248 | var autoToken = /\s?auto?\s?/i
1249 | var autoPlace = autoToken.test(placement)
1250 | if (autoPlace) placement = placement.replace(autoToken, '') || 'top'
1251 |
1252 | $tip
1253 | .detach()
1254 | .css({ top: 0, left: 0, display: 'block' })
1255 | .addClass(placement)
1256 |
1257 | this.options.container ? $tip.appendTo(this.options.container) : $tip.insertAfter(this.$element)
1258 |
1259 | var pos = this.getPosition()
1260 | var actualWidth = $tip[0].offsetWidth
1261 | var actualHeight = $tip[0].offsetHeight
1262 |
1263 | if (autoPlace) {
1264 | var $parent = this.$element.parent()
1265 |
1266 | var orgPlacement = placement
1267 | var docScroll = document.documentElement.scrollTop || document.body.scrollTop
1268 | var parentWidth = this.options.container == 'body' ? window.innerWidth : $parent.outerWidth()
1269 | var parentHeight = this.options.container == 'body' ? window.innerHeight : $parent.outerHeight()
1270 | var parentLeft = this.options.container == 'body' ? 0 : $parent.offset().left
1271 |
1272 | placement = placement == 'bottom' && pos.top + pos.height + actualHeight - docScroll > parentHeight ? 'top' :
1273 | placement == 'top' && pos.top - docScroll - actualHeight < 0 ? 'bottom' :
1274 | placement == 'right' && pos.right + actualWidth > parentWidth ? 'left' :
1275 | placement == 'left' && pos.left - actualWidth < parentLeft ? 'right' :
1276 | placement
1277 |
1278 | $tip
1279 | .removeClass(orgPlacement)
1280 | .addClass(placement)
1281 | }
1282 |
1283 | var calculatedOffset = this.getCalculatedOffset(placement, pos, actualWidth, actualHeight)
1284 |
1285 | this.applyPlacement(calculatedOffset, placement)
1286 | this.$element.trigger('shown.bs.' + this.type)
1287 | }
1288 | }
1289 |
1290 | Tooltip.prototype.applyPlacement = function(offset, placement) {
1291 | var replace
1292 | var $tip = this.tip()
1293 | var width = $tip[0].offsetWidth
1294 | var height = $tip[0].offsetHeight
1295 |
1296 | // manually read margins because getBoundingClientRect includes difference
1297 | var marginTop = parseInt($tip.css('margin-top'), 10)
1298 | var marginLeft = parseInt($tip.css('margin-left'), 10)
1299 |
1300 | // we must check for NaN for ie 8/9
1301 | if (isNaN(marginTop)) marginTop = 0
1302 | if (isNaN(marginLeft)) marginLeft = 0
1303 |
1304 | offset.top = offset.top + marginTop
1305 | offset.left = offset.left + marginLeft
1306 |
1307 | $tip
1308 | .offset(offset)
1309 | .addClass('in')
1310 |
1311 | // check to see if placing tip in new offset caused the tip to resize itself
1312 | var actualWidth = $tip[0].offsetWidth
1313 | var actualHeight = $tip[0].offsetHeight
1314 |
1315 | if (placement == 'top' && actualHeight != height) {
1316 | replace = true
1317 | offset.top = offset.top + height - actualHeight
1318 | }
1319 |
1320 | if (/bottom|top/.test(placement)) {
1321 | var delta = 0
1322 |
1323 | if (offset.left < 0) {
1324 | delta = offset.left * -2
1325 | offset.left = 0
1326 |
1327 | $tip.offset(offset)
1328 |
1329 | actualWidth = $tip[0].offsetWidth
1330 | actualHeight = $tip[0].offsetHeight
1331 | }
1332 |
1333 | this.replaceArrow(delta - width + actualWidth, actualWidth, 'left')
1334 | } else {
1335 | this.replaceArrow(actualHeight - height, actualHeight, 'top')
1336 | }
1337 |
1338 | if (replace) $tip.offset(offset)
1339 | }
1340 |
1341 | Tooltip.prototype.replaceArrow = function(delta, dimension, position) {
1342 | this.arrow().css(position, delta ? (50 * (1 - delta / dimension) + "%") : '')
1343 | }
1344 |
1345 | Tooltip.prototype.setContent = function () {
1346 | var $tip = this.tip()
1347 | var title = this.getTitle()
1348 |
1349 | $tip.find('.tooltip-inner')[this.options.html ? 'html' : 'text'](title)
1350 | $tip.removeClass('fade in top bottom left right')
1351 | }
1352 |
1353 | Tooltip.prototype.hide = function () {
1354 | var that = this
1355 | var $tip = this.tip()
1356 | var e = $.Event('hide.bs.' + this.type)
1357 |
1358 | function complete() {
1359 | if (that.hoverState != 'in') $tip.detach()
1360 | }
1361 |
1362 | this.$element.trigger(e)
1363 |
1364 | if (e.isDefaultPrevented()) return
1365 |
1366 | $tip.removeClass('in')
1367 |
1368 | $.support.transition && this.$tip.hasClass('fade') ?
1369 | $tip
1370 | .one($.support.transition.end, complete)
1371 | .emulateTransitionEnd(150) :
1372 | complete()
1373 |
1374 | this.$element.trigger('hidden.bs.' + this.type)
1375 |
1376 | return this
1377 | }
1378 |
1379 | Tooltip.prototype.fixTitle = function () {
1380 | var $e = this.$element
1381 | if ($e.attr('title') || typeof($e.attr('data-original-title')) != 'string') {
1382 | $e.attr('data-original-title', $e.attr('title') || '').attr('title', '')
1383 | }
1384 | }
1385 |
1386 | Tooltip.prototype.hasContent = function () {
1387 | return this.getTitle()
1388 | }
1389 |
1390 | Tooltip.prototype.getPosition = function () {
1391 | var el = this.$element[0]
1392 | return $.extend({}, (typeof el.getBoundingClientRect == 'function') ? el.getBoundingClientRect() : {
1393 | width: el.offsetWidth
1394 | , height: el.offsetHeight
1395 | }, this.$element.offset())
1396 | }
1397 |
1398 | Tooltip.prototype.getCalculatedOffset = function (placement, pos, actualWidth, actualHeight) {
1399 | return placement == 'bottom' ? { top: pos.top + pos.height, left: pos.left + pos.width / 2 - actualWidth / 2 } :
1400 | placement == 'top' ? { top: pos.top - actualHeight, left: pos.left + pos.width / 2 - actualWidth / 2 } :
1401 | placement == 'left' ? { top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left - actualWidth } :
1402 | /* placement == 'right' */ { top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left + pos.width }
1403 | }
1404 |
1405 | Tooltip.prototype.getTitle = function () {
1406 | var title
1407 | var $e = this.$element
1408 | var o = this.options
1409 |
1410 | title = $e.attr('data-original-title')
1411 | || (typeof o.title == 'function' ? o.title.call($e[0]) : o.title)
1412 |
1413 | return title
1414 | }
1415 |
1416 | Tooltip.prototype.tip = function () {
1417 | return this.$tip = this.$tip || $(this.options.template)
1418 | }
1419 |
1420 | Tooltip.prototype.arrow = function () {
1421 | return this.$arrow = this.$arrow || this.tip().find('.tooltip-arrow')
1422 | }
1423 |
1424 | Tooltip.prototype.validate = function () {
1425 | if (!this.$element[0].parentNode) {
1426 | this.hide()
1427 | this.$element = null
1428 | this.options = null
1429 | }
1430 | }
1431 |
1432 | Tooltip.prototype.enable = function () {
1433 | this.enabled = true
1434 | }
1435 |
1436 | Tooltip.prototype.disable = function () {
1437 | this.enabled = false
1438 | }
1439 |
1440 | Tooltip.prototype.toggleEnabled = function () {
1441 | this.enabled = !this.enabled
1442 | }
1443 |
1444 | Tooltip.prototype.toggle = function (e) {
1445 | var self = e ? $(e.currentTarget)[this.type](this.getDelegateOptions()).data('bs.' + this.type) : this
1446 | self.tip().hasClass('in') ? self.leave(self) : self.enter(self)
1447 | }
1448 |
1449 | Tooltip.prototype.destroy = function () {
1450 | this.hide().$element.off('.' + this.type).removeData('bs.' + this.type)
1451 | }
1452 |
1453 |
1454 | // TOOLTIP PLUGIN DEFINITION
1455 | // =========================
1456 |
1457 | var old = $.fn.tooltip
1458 |
1459 | $.fn.tooltip = function (option) {
1460 | return this.each(function () {
1461 | var $this = $(this)
1462 | var data = $this.data('bs.tooltip')
1463 | var options = typeof option == 'object' && option
1464 |
1465 | if (!data) $this.data('bs.tooltip', (data = new Tooltip(this, options)))
1466 | if (typeof option == 'string') data[option]()
1467 | })
1468 | }
1469 |
1470 | $.fn.tooltip.Constructor = Tooltip
1471 |
1472 |
1473 | // TOOLTIP NO CONFLICT
1474 | // ===================
1475 |
1476 | $.fn.tooltip.noConflict = function () {
1477 | $.fn.tooltip = old
1478 | return this
1479 | }
1480 |
1481 | }(jQuery);
1482 |
1483 | /* ========================================================================
1484 | * Bootstrap: popover.js v3.0.3
1485 | * http://getbootstrap.com/javascript/#popovers
1486 | * ========================================================================
1487 | * Copyright 2013 Twitter, Inc.
1488 | *
1489 | * Licensed under the Apache License, Version 2.0 (the "License");
1490 | * you may not use this file except in compliance with the License.
1491 | * You may obtain a copy of the License at
1492 | *
1493 | * http://www.apache.org/licenses/LICENSE-2.0
1494 | *
1495 | * Unless required by applicable law or agreed to in writing, software
1496 | * distributed under the License is distributed on an "AS IS" BASIS,
1497 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1498 | * See the License for the specific language governing permissions and
1499 | * limitations under the License.
1500 | * ======================================================================== */
1501 |
1502 |
1503 | +function ($) { "use strict";
1504 |
1505 | // POPOVER PUBLIC CLASS DEFINITION
1506 | // ===============================
1507 |
1508 | var Popover = function (element, options) {
1509 | this.init('popover', element, options)
1510 | }
1511 |
1512 | if (!$.fn.tooltip) throw new Error('Popover requires tooltip.js')
1513 |
1514 | Popover.DEFAULTS = $.extend({} , $.fn.tooltip.Constructor.DEFAULTS, {
1515 | placement: 'right'
1516 | , trigger: 'click'
1517 | , content: ''
1518 | , template: ''
1519 | })
1520 |
1521 |
1522 | // NOTE: POPOVER EXTENDS tooltip.js
1523 | // ================================
1524 |
1525 | Popover.prototype = $.extend({}, $.fn.tooltip.Constructor.prototype)
1526 |
1527 | Popover.prototype.constructor = Popover
1528 |
1529 | Popover.prototype.getDefaults = function () {
1530 | return Popover.DEFAULTS
1531 | }
1532 |
1533 | Popover.prototype.setContent = function () {
1534 | var $tip = this.tip()
1535 | var title = this.getTitle()
1536 | var content = this.getContent()
1537 |
1538 | $tip.find('.popover-title')[this.options.html ? 'html' : 'text'](title)
1539 | $tip.find('.popover-content')[this.options.html ? 'html' : 'text'](content)
1540 |
1541 | $tip.removeClass('fade top bottom left right in')
1542 |
1543 | // IE8 doesn't accept hiding via the `:empty` pseudo selector, we have to do
1544 | // this manually by checking the contents.
1545 | if (!$tip.find('.popover-title').html()) $tip.find('.popover-title').hide()
1546 | }
1547 |
1548 | Popover.prototype.hasContent = function () {
1549 | return this.getTitle() || this.getContent()
1550 | }
1551 |
1552 | Popover.prototype.getContent = function () {
1553 | var $e = this.$element
1554 | var o = this.options
1555 |
1556 | return $e.attr('data-content')
1557 | || (typeof o.content == 'function' ?
1558 | o.content.call($e[0]) :
1559 | o.content)
1560 | }
1561 |
1562 | Popover.prototype.arrow = function () {
1563 | return this.$arrow = this.$arrow || this.tip().find('.arrow')
1564 | }
1565 |
1566 | Popover.prototype.tip = function () {
1567 | if (!this.$tip) this.$tip = $(this.options.template)
1568 | return this.$tip
1569 | }
1570 |
1571 |
1572 | // POPOVER PLUGIN DEFINITION
1573 | // =========================
1574 |
1575 | var old = $.fn.popover
1576 |
1577 | $.fn.popover = function (option) {
1578 | return this.each(function () {
1579 | var $this = $(this)
1580 | var data = $this.data('bs.popover')
1581 | var options = typeof option == 'object' && option
1582 |
1583 | if (!data) $this.data('bs.popover', (data = new Popover(this, options)))
1584 | if (typeof option == 'string') data[option]()
1585 | })
1586 | }
1587 |
1588 | $.fn.popover.Constructor = Popover
1589 |
1590 |
1591 | // POPOVER NO CONFLICT
1592 | // ===================
1593 |
1594 | $.fn.popover.noConflict = function () {
1595 | $.fn.popover = old
1596 | return this
1597 | }
1598 |
1599 | }(jQuery);
1600 |
1601 | /* ========================================================================
1602 | * Bootstrap: scrollspy.js v3.0.3
1603 | * http://getbootstrap.com/javascript/#scrollspy
1604 | * ========================================================================
1605 | * Copyright 2013 Twitter, Inc.
1606 | *
1607 | * Licensed under the Apache License, Version 2.0 (the "License");
1608 | * you may not use this file except in compliance with the License.
1609 | * You may obtain a copy of the License at
1610 | *
1611 | * http://www.apache.org/licenses/LICENSE-2.0
1612 | *
1613 | * Unless required by applicable law or agreed to in writing, software
1614 | * distributed under the License is distributed on an "AS IS" BASIS,
1615 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1616 | * See the License for the specific language governing permissions and
1617 | * limitations under the License.
1618 | * ======================================================================== */
1619 |
1620 |
1621 | +function ($) { "use strict";
1622 |
1623 | // SCROLLSPY CLASS DEFINITION
1624 | // ==========================
1625 |
1626 | function ScrollSpy(element, options) {
1627 | var href
1628 | var process = $.proxy(this.process, this)
1629 |
1630 | this.$element = $(element).is('body') ? $(window) : $(element)
1631 | this.$body = $('body')
1632 | this.$scrollElement = this.$element.on('scroll.bs.scroll-spy.data-api', process)
1633 | this.options = $.extend({}, ScrollSpy.DEFAULTS, options)
1634 | this.selector = (this.options.target
1635 | || ((href = $(element).attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7
1636 | || '') + ' .nav li > a'
1637 | this.offsets = $([])
1638 | this.targets = $([])
1639 | this.activeTarget = null
1640 |
1641 | this.refresh()
1642 | this.process()
1643 | }
1644 |
1645 | ScrollSpy.DEFAULTS = {
1646 | offset: 10
1647 | }
1648 |
1649 | ScrollSpy.prototype.refresh = function () {
1650 | var offsetMethod = this.$element[0] == window ? 'offset' : 'position'
1651 |
1652 | this.offsets = $([])
1653 | this.targets = $([])
1654 |
1655 | var self = this
1656 | var $targets = this.$body
1657 | .find(this.selector)
1658 | .map(function () {
1659 | var $el = $(this)
1660 | var href = $el.data('target') || $el.attr('href')
1661 | var $href = /^#\w/.test(href) && $(href)
1662 |
1663 | return ($href
1664 | && $href.length
1665 | && [[ $href[offsetMethod]().top + (!$.isWindow(self.$scrollElement.get(0)) && self.$scrollElement.scrollTop()), href ]]) || null
1666 | })
1667 | .sort(function (a, b) { return a[0] - b[0] })
1668 | .each(function () {
1669 | self.offsets.push(this[0])
1670 | self.targets.push(this[1])
1671 | })
1672 | }
1673 |
1674 | ScrollSpy.prototype.process = function () {
1675 | var scrollTop = this.$scrollElement.scrollTop() + this.options.offset
1676 | var scrollHeight = this.$scrollElement[0].scrollHeight || this.$body[0].scrollHeight
1677 | var maxScroll = scrollHeight - this.$scrollElement.height()
1678 | var offsets = this.offsets
1679 | var targets = this.targets
1680 | var activeTarget = this.activeTarget
1681 | var i
1682 |
1683 | if (scrollTop >= maxScroll) {
1684 | return activeTarget != (i = targets.last()[0]) && this.activate(i)
1685 | }
1686 |
1687 | for (i = offsets.length; i--;) {
1688 | activeTarget != targets[i]
1689 | && scrollTop >= offsets[i]
1690 | && (!offsets[i + 1] || scrollTop <= offsets[i + 1])
1691 | && this.activate( targets[i] )
1692 | }
1693 | }
1694 |
1695 | ScrollSpy.prototype.activate = function (target) {
1696 | this.activeTarget = target
1697 |
1698 | $(this.selector)
1699 | .parents('.active')
1700 | .removeClass('active')
1701 |
1702 | var selector = this.selector
1703 | + '[data-target="' + target + '"],'
1704 | + this.selector + '[href="' + target + '"]'
1705 |
1706 | var active = $(selector)
1707 | .parents('li')
1708 | .addClass('active')
1709 |
1710 | if (active.parent('.dropdown-menu').length) {
1711 | active = active
1712 | .closest('li.dropdown')
1713 | .addClass('active')
1714 | }
1715 |
1716 | active.trigger('activate.bs.scrollspy')
1717 | }
1718 |
1719 |
1720 | // SCROLLSPY PLUGIN DEFINITION
1721 | // ===========================
1722 |
1723 | var old = $.fn.scrollspy
1724 |
1725 | $.fn.scrollspy = function (option) {
1726 | return this.each(function () {
1727 | var $this = $(this)
1728 | var data = $this.data('bs.scrollspy')
1729 | var options = typeof option == 'object' && option
1730 |
1731 | if (!data) $this.data('bs.scrollspy', (data = new ScrollSpy(this, options)))
1732 | if (typeof option == 'string') data[option]()
1733 | })
1734 | }
1735 |
1736 | $.fn.scrollspy.Constructor = ScrollSpy
1737 |
1738 |
1739 | // SCROLLSPY NO CONFLICT
1740 | // =====================
1741 |
1742 | $.fn.scrollspy.noConflict = function () {
1743 | $.fn.scrollspy = old
1744 | return this
1745 | }
1746 |
1747 |
1748 | // SCROLLSPY DATA-API
1749 | // ==================
1750 |
1751 | $(window).on('load', function () {
1752 | $('[data-spy="scroll"]').each(function () {
1753 | var $spy = $(this)
1754 | $spy.scrollspy($spy.data())
1755 | })
1756 | })
1757 |
1758 | }(jQuery);
1759 |
1760 | /* ========================================================================
1761 | * Bootstrap: tab.js v3.0.3
1762 | * http://getbootstrap.com/javascript/#tabs
1763 | * ========================================================================
1764 | * Copyright 2013 Twitter, Inc.
1765 | *
1766 | * Licensed under the Apache License, Version 2.0 (the "License");
1767 | * you may not use this file except in compliance with the License.
1768 | * You may obtain a copy of the License at
1769 | *
1770 | * http://www.apache.org/licenses/LICENSE-2.0
1771 | *
1772 | * Unless required by applicable law or agreed to in writing, software
1773 | * distributed under the License is distributed on an "AS IS" BASIS,
1774 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1775 | * See the License for the specific language governing permissions and
1776 | * limitations under the License.
1777 | * ======================================================================== */
1778 |
1779 |
1780 | +function ($) { "use strict";
1781 |
1782 | // TAB CLASS DEFINITION
1783 | // ====================
1784 |
1785 | var Tab = function (element) {
1786 | this.element = $(element)
1787 | }
1788 |
1789 | Tab.prototype.show = function () {
1790 | var $this = this.element
1791 | var $ul = $this.closest('ul:not(.dropdown-menu)')
1792 | var selector = $this.data('target')
1793 |
1794 | if (!selector) {
1795 | selector = $this.attr('href')
1796 | selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7
1797 | }
1798 |
1799 | if ($this.parent('li').hasClass('active')) return
1800 |
1801 | var previous = $ul.find('.active:last a')[0]
1802 | var e = $.Event('show.bs.tab', {
1803 | relatedTarget: previous
1804 | })
1805 |
1806 | $this.trigger(e)
1807 |
1808 | if (e.isDefaultPrevented()) return
1809 |
1810 | var $target = $(selector)
1811 |
1812 | this.activate($this.parent('li'), $ul)
1813 | this.activate($target, $target.parent(), function () {
1814 | $this.trigger({
1815 | type: 'shown.bs.tab'
1816 | , relatedTarget: previous
1817 | })
1818 | })
1819 | }
1820 |
1821 | Tab.prototype.activate = function (element, container, callback) {
1822 | var $active = container.find('> .active')
1823 | var transition = callback
1824 | && $.support.transition
1825 | && $active.hasClass('fade')
1826 |
1827 | function next() {
1828 | $active
1829 | .removeClass('active')
1830 | .find('> .dropdown-menu > .active')
1831 | .removeClass('active')
1832 |
1833 | element.addClass('active')
1834 |
1835 | if (transition) {
1836 | element[0].offsetWidth // reflow for transition
1837 | element.addClass('in')
1838 | } else {
1839 | element.removeClass('fade')
1840 | }
1841 |
1842 | if (element.parent('.dropdown-menu')) {
1843 | element.closest('li.dropdown').addClass('active')
1844 | }
1845 |
1846 | callback && callback()
1847 | }
1848 |
1849 | transition ?
1850 | $active
1851 | .one($.support.transition.end, next)
1852 | .emulateTransitionEnd(150) :
1853 | next()
1854 |
1855 | $active.removeClass('in')
1856 | }
1857 |
1858 |
1859 | // TAB PLUGIN DEFINITION
1860 | // =====================
1861 |
1862 | var old = $.fn.tab
1863 |
1864 | $.fn.tab = function ( option ) {
1865 | return this.each(function () {
1866 | var $this = $(this)
1867 | var data = $this.data('bs.tab')
1868 |
1869 | if (!data) $this.data('bs.tab', (data = new Tab(this)))
1870 | if (typeof option == 'string') data[option]()
1871 | })
1872 | }
1873 |
1874 | $.fn.tab.Constructor = Tab
1875 |
1876 |
1877 | // TAB NO CONFLICT
1878 | // ===============
1879 |
1880 | $.fn.tab.noConflict = function () {
1881 | $.fn.tab = old
1882 | return this
1883 | }
1884 |
1885 |
1886 | // TAB DATA-API
1887 | // ============
1888 |
1889 | $(document).on('click.bs.tab.data-api', '[data-toggle="tab"], [data-toggle="pill"]', function (e) {
1890 | e.preventDefault()
1891 | $(this).tab('show')
1892 | })
1893 |
1894 | }(jQuery);
1895 |
1896 | /* ========================================================================
1897 | * Bootstrap: affix.js v3.0.3
1898 | * http://getbootstrap.com/javascript/#affix
1899 | * ========================================================================
1900 | * Copyright 2013 Twitter, Inc.
1901 | *
1902 | * Licensed under the Apache License, Version 2.0 (the "License");
1903 | * you may not use this file except in compliance with the License.
1904 | * You may obtain a copy of the License at
1905 | *
1906 | * http://www.apache.org/licenses/LICENSE-2.0
1907 | *
1908 | * Unless required by applicable law or agreed to in writing, software
1909 | * distributed under the License is distributed on an "AS IS" BASIS,
1910 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1911 | * See the License for the specific language governing permissions and
1912 | * limitations under the License.
1913 | * ======================================================================== */
1914 |
1915 |
1916 | +function ($) { "use strict";
1917 |
1918 | // AFFIX CLASS DEFINITION
1919 | // ======================
1920 |
1921 | var Affix = function (element, options) {
1922 | this.options = $.extend({}, Affix.DEFAULTS, options)
1923 | this.$window = $(window)
1924 | .on('scroll.bs.affix.data-api', $.proxy(this.checkPosition, this))
1925 | .on('click.bs.affix.data-api', $.proxy(this.checkPositionWithEventLoop, this))
1926 |
1927 | this.$element = $(element)
1928 | this.affixed =
1929 | this.unpin = null
1930 |
1931 | this.checkPosition()
1932 | }
1933 |
1934 | Affix.RESET = 'affix affix-top affix-bottom'
1935 |
1936 | Affix.DEFAULTS = {
1937 | offset: 0
1938 | }
1939 |
1940 | Affix.prototype.checkPositionWithEventLoop = function () {
1941 | setTimeout($.proxy(this.checkPosition, this), 1)
1942 | }
1943 |
1944 | Affix.prototype.checkPosition = function () {
1945 | if (!this.$element.is(':visible')) return
1946 |
1947 | var scrollHeight = $(document).height()
1948 | var scrollTop = this.$window.scrollTop()
1949 | var position = this.$element.offset()
1950 | var offset = this.options.offset
1951 | var offsetTop = offset.top
1952 | var offsetBottom = offset.bottom
1953 |
1954 | if (typeof offset != 'object') offsetBottom = offsetTop = offset
1955 | if (typeof offsetTop == 'function') offsetTop = offset.top()
1956 | if (typeof offsetBottom == 'function') offsetBottom = offset.bottom()
1957 |
1958 | var affix = this.unpin != null && (scrollTop + this.unpin <= position.top) ? false :
1959 | offsetBottom != null && (position.top + this.$element.height() >= scrollHeight - offsetBottom) ? 'bottom' :
1960 | offsetTop != null && (scrollTop <= offsetTop) ? 'top' : false
1961 |
1962 | if (this.affixed === affix) return
1963 | if (this.unpin) this.$element.css('top', '')
1964 |
1965 | this.affixed = affix
1966 | this.unpin = affix == 'bottom' ? position.top - scrollTop : null
1967 |
1968 | this.$element.removeClass(Affix.RESET).addClass('affix' + (affix ? '-' + affix : ''))
1969 |
1970 | if (affix == 'bottom') {
1971 | this.$element.offset({ top: document.body.offsetHeight - offsetBottom - this.$element.height() })
1972 | }
1973 | }
1974 |
1975 |
1976 | // AFFIX PLUGIN DEFINITION
1977 | // =======================
1978 |
1979 | var old = $.fn.affix
1980 |
1981 | $.fn.affix = function (option) {
1982 | return this.each(function () {
1983 | var $this = $(this)
1984 | var data = $this.data('bs.affix')
1985 | var options = typeof option == 'object' && option
1986 |
1987 | if (!data) $this.data('bs.affix', (data = new Affix(this, options)))
1988 | if (typeof option == 'string') data[option]()
1989 | })
1990 | }
1991 |
1992 | $.fn.affix.Constructor = Affix
1993 |
1994 |
1995 | // AFFIX NO CONFLICT
1996 | // =================
1997 |
1998 | $.fn.affix.noConflict = function () {
1999 | $.fn.affix = old
2000 | return this
2001 | }
2002 |
2003 |
2004 | // AFFIX DATA-API
2005 | // ==============
2006 |
2007 | $(window).on('load', function () {
2008 | $('[data-spy="affix"]').each(function () {
2009 | var $spy = $(this)
2010 | var data = $spy.data()
2011 |
2012 | data.offset = data.offset || {}
2013 |
2014 | if (data.offsetBottom) data.offset.bottom = data.offsetBottom
2015 | if (data.offsetTop) data.offset.top = data.offsetTop
2016 |
2017 | $spy.affix(data)
2018 | })
2019 | })
2020 |
2021 | }(jQuery);
--------------------------------------------------------------------------------
/style.css:
--------------------------------------------------------------------------------
1 | /* Add the following to your stylesheet */
2 |
3 | .dropdown-submenu{position:relative;}
4 | .dropdown-submenu>.dropdown-menu{top:0;left:100%;-webkit-border-radius:0 6px 6px 6px;-moz-border-radius:0 6px 6px 6px;border-radius:0 6px 6px 6px;}
5 | .dropdown-submenu:active>.dropdown-menu, .dropdown-submenu:hover>.dropdown-menu {
6 | display: block;
7 | }
8 | .dropdown-submenu>a:after{display:block;content:" ";float:right;width:0;height:0;border-color:transparent;border-style:solid;border-width:5px 0 5px 5px;border-left-color:#cccccc;margin-top:5px;margin-right:-10px;}
9 | .dropdown-submenu:active>a:after{border-left-color:#ffffff;}
10 | .dropdown-submenu.pull-left{float:none;}.dropdown-submenu.pull-left>.dropdown-menu{left:-100%;margin-left:10px;-webkit-border-radius:6px 0 6px 6px;-moz-border-radius:6px 0 6px 6px;border-radius:6px 0 6px 6px;}
11 |
--------------------------------------------------------------------------------
/wp-bootstrap-navwalker.php:
--------------------------------------------------------------------------------
1 | \n";
32 | }
33 |
34 | /**
35 | * @see Walker::start_el()
36 | * @since 3.0.0
37 | *
38 | * @param string $output Passed by reference. Used to append additional content.
39 | * @param object $item Menu item data object.
40 | * @param int $depth Depth of menu item. Used for padding.
41 | * @param int $current_page Menu item ID.
42 | * @param object $args
43 | */
44 | public function start_el( &$output, $item, $depth = 0, $args = array(), $id = 0 ) {
45 | $indent = ( $depth ) ? str_repeat( "\t", $depth ) : '';
46 |
47 | /**
48 | * Dividers, Headers or Disabled
49 | * =============================
50 | * Determine whether the item is a Divider, Header, Disabled or regular
51 | * menu item. To prevent errors we use the strcasecmp() function to so a
52 | * comparison that is not case sensitive. The strcasecmp() function returns
53 | * a 0 if the strings are equal.
54 | */
55 | if ( strcasecmp( $item->attr_title, 'divider' ) == 0 && $depth === 1 ) {
56 | $output .= $indent . '';
57 | } else if ( strcasecmp( $item->title, 'divider') == 0 && $depth === 1 ) {
58 | $output .= $indent . '';
59 | } else if ( strcasecmp( $item->attr_title, 'dropdown-header') == 0 && $depth === 1 ) {
60 | $output .= $indent . '' . esc_attr( $item->title ) . '';
63 | } else {
64 |
65 | $class_names = $value = '';
66 |
67 | $classes = empty( $item->classes ) ? array() : (array) $item->classes;
68 | $classes[] = 'menu-item-' . $item->ID;
69 |
70 | $class_names = join( ' ', apply_filters( 'nav_menu_css_class', array_filter( $classes ), $item, $args ) );
71 |
72 | /*
73 | if ( $args->has_children )
74 | $class_names .= ' dropdown';
75 | */
76 |
77 | if($args->has_children && $depth === 0) { $class_names .= ' dropdown'; } elseif($args->has_children && $depth > 0) { $class_names .= ' dropdown-submenu'; }
78 |
79 | if ( in_array( 'current-menu-item', $classes ) )
80 | $class_names .= ' active';
81 |
82 | // remove Font Awesome icon from classes array and save the icon
83 | // we will add the icon back in via a below so it aligns with
84 | // the menu item
85 | if ( in_array('fa', $classes)) {
86 | $key = array_search('fa', $classes);
87 | $icon = $classes[$key + 1];
88 | $class_names = str_replace($classes[$key+1], '', $class_names);
89 | $class_names = str_replace($classes[$key], '', $class_names);
90 |
91 | }
92 |
93 | $class_names = $class_names ? ' class="' . esc_attr( $class_names ) . '"' : '';
94 |
95 | $id = apply_filters( 'nav_menu_item_id', 'menu-item-'. $item->ID, $item, $args );
96 | $id = $id ? ' id="' . esc_attr( $id ) . '"' : '';
97 |
98 | $output .= $indent . '';
99 |
100 | $atts = array();
101 | $atts['title'] = ! empty( $item->title ) ? $item->title : '';
102 | $atts['target'] = ! empty( $item->target ) ? $item->target : '';
103 | $atts['rel'] = ! empty( $item->xfn ) ? $item->xfn : '';
104 |
105 | // If item has_children add atts to a.
106 | // if ( $args->has_children && $depth === 0 ) {
107 | if ( $args->has_children ) {
108 | $atts['href'] = '#';
109 | $atts['data-toggle'] = 'dropdown';
110 | $atts['class'] = 'dropdown-toggle';
111 | } else {
112 | $atts['href'] = ! empty( $item->url ) ? $item->url : '';
113 | }
114 |
115 | $atts = apply_filters( 'nav_menu_link_attributes', $atts, $item, $args );
116 |
117 | $attributes = '';
118 | foreach ( $atts as $attr => $value ) {
119 | if ( ! empty( $value ) ) {
120 | $value = ( 'href' === $attr ) ? esc_url( $value ) : esc_attr( $value );
121 | $attributes .= ' ' . $attr . '="' . $value . '"';
122 | }
123 | }
124 |
125 | $item_output = $args->before;
126 |
127 | // Font Awesome icons
128 | if ( ! empty( $icon ) )
129 | $item_output .= ' ';
130 | else
131 | $item_output .= '';
132 |
133 | $item_output .= $args->link_before . apply_filters( 'the_title', $item->title, $item->ID ) . $args->link_after;
134 | $item_output .= ( $args->has_children && 0 === $depth ) ? ' ' : '';
135 | $item_output .= $args->after;
136 |
137 | $output .= apply_filters( 'walker_nav_menu_start_el', $item_output, $item, $depth, $args );
138 | }
139 | }
140 |
141 | /**
142 | * Traverse elements to create list from elements.
143 | *
144 | * Display one element if the element doesn't have any children otherwise,
145 | * display the element and its children. Will only traverse up to the max
146 | * depth and no ignore elements under that depth.
147 | *
148 | * This method shouldn't be called directly, use the walk() method instead.
149 | *
150 | * @see Walker::start_el()
151 | * @since 2.5.0
152 | *
153 | * @param object $element Data object
154 | * @param array $children_elements List of elements to continue traversing.
155 | * @param int $max_depth Max depth to traverse.
156 | * @param int $depth Depth of current element.
157 | * @param array $args
158 | * @param string $output Passed by reference. Used to append additional content.
159 | * @return null Null on failure with no changes to parameters.
160 | */
161 | public function display_element( $element, &$children_elements, $max_depth, $depth, $args, &$output ) {
162 | if ( ! $element )
163 | return;
164 |
165 | $id_field = $this->db_fields['id'];
166 |
167 | // Display this element.
168 | if ( is_object( $args[0] ) )
169 | $args[0]->has_children = ! empty( $children_elements[ $element->$id_field ] );
170 |
171 | parent::display_element( $element, $children_elements, $max_depth, $depth, $args, $output );
172 | }
173 |
174 | /**
175 | * Menu Fallback
176 | * =============
177 | * If this function is assigned to the wp_nav_menu's fallback_cb variable
178 | * and a manu has not been assigned to the theme location in the WordPress
179 | * menu manager the function with display nothing to a non-logged in user,
180 | * and will add a link to the WordPress menu manager if logged in as an admin.
181 | *
182 | * @param array $args passed from the wp_nav_menu function.
183 | *
184 | */
185 | public static function fallback( $args ) {
186 | if ( current_user_can( 'manage_options' ) ) {
187 |
188 | extract( $args );
189 |
190 | $fb_output = null;
191 |
192 | if ( $container ) {
193 | $fb_output = '<' . $container;
194 |
195 | if ( $container_id )
196 | $fb_output .= ' id="' . $container_id . '"';
197 |
198 | if ( $container_class )
199 | $fb_output .= ' class="' . $container_class . '"';
200 |
201 | $fb_output .= '>';
202 | }
203 |
204 | $fb_output .= '';
214 | $fb_output .= '';
215 |
216 | if ( $container )
217 | $fb_output .= '' . $container . '>';
218 |
219 | echo $fb_output;
220 | }
221 | }
222 | }
--------------------------------------------------------------------------------