1.1 --- a/bootstrap-source/bootstrap-3.0.3/js/dropdown.js Sat Jan 18 12:34:36 2014 +0100
1.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
1.3 @@ -1,154 +0,0 @@
1.4 -/* ========================================================================
1.5 - * Bootstrap: dropdown.js v3.0.3
1.6 - * http://getbootstrap.com/javascript/#dropdowns
1.7 - * ========================================================================
1.8 - * Copyright 2013 Twitter, Inc.
1.9 - *
1.10 - * Licensed under the Apache License, Version 2.0 (the "License");
1.11 - * you may not use this file except in compliance with the License.
1.12 - * You may obtain a copy of the License at
1.13 - *
1.14 - * http://www.apache.org/licenses/LICENSE-2.0
1.15 - *
1.16 - * Unless required by applicable law or agreed to in writing, software
1.17 - * distributed under the License is distributed on an "AS IS" BASIS,
1.18 - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1.19 - * See the License for the specific language governing permissions and
1.20 - * limitations under the License.
1.21 - * ======================================================================== */
1.22 -
1.23 -
1.24 -+function ($) { "use strict";
1.25 -
1.26 - // DROPDOWN CLASS DEFINITION
1.27 - // =========================
1.28 -
1.29 - var backdrop = '.dropdown-backdrop'
1.30 - var toggle = '[data-toggle=dropdown]'
1.31 - var Dropdown = function (element) {
1.32 - $(element).on('click.bs.dropdown', this.toggle)
1.33 - }
1.34 -
1.35 - Dropdown.prototype.toggle = function (e) {
1.36 - var $this = $(this)
1.37 -
1.38 - if ($this.is('.disabled, :disabled')) return
1.39 -
1.40 - var $parent = getParent($this)
1.41 - var isActive = $parent.hasClass('open')
1.42 -
1.43 - clearMenus()
1.44 -
1.45 - if (!isActive) {
1.46 - if ('ontouchstart' in document.documentElement && !$parent.closest('.navbar-nav').length) {
1.47 - // if mobile we use a backdrop because click events don't delegate
1.48 - $('<div class="dropdown-backdrop"/>').insertAfter($(this)).on('click', clearMenus)
1.49 - }
1.50 -
1.51 - $parent.trigger(e = $.Event('show.bs.dropdown'))
1.52 -
1.53 - if (e.isDefaultPrevented()) return
1.54 -
1.55 - $parent
1.56 - .toggleClass('open')
1.57 - .trigger('shown.bs.dropdown')
1.58 -
1.59 - $this.focus()
1.60 - }
1.61 -
1.62 - return false
1.63 - }
1.64 -
1.65 - Dropdown.prototype.keydown = function (e) {
1.66 - if (!/(38|40|27)/.test(e.keyCode)) return
1.67 -
1.68 - var $this = $(this)
1.69 -
1.70 - e.preventDefault()
1.71 - e.stopPropagation()
1.72 -
1.73 - if ($this.is('.disabled, :disabled')) return
1.74 -
1.75 - var $parent = getParent($this)
1.76 - var isActive = $parent.hasClass('open')
1.77 -
1.78 - if (!isActive || (isActive && e.keyCode == 27)) {
1.79 - if (e.which == 27) $parent.find(toggle).focus()
1.80 - return $this.click()
1.81 - }
1.82 -
1.83 - var $items = $('[role=menu] li:not(.divider):visible a', $parent)
1.84 -
1.85 - if (!$items.length) return
1.86 -
1.87 - var index = $items.index($items.filter(':focus'))
1.88 -
1.89 - if (e.keyCode == 38 && index > 0) index-- // up
1.90 - if (e.keyCode == 40 && index < $items.length - 1) index++ // down
1.91 - if (!~index) index=0
1.92 -
1.93 - $items.eq(index).focus()
1.94 - }
1.95 -
1.96 - function clearMenus() {
1.97 - $(backdrop).remove()
1.98 - $(toggle).each(function (e) {
1.99 - var $parent = getParent($(this))
1.100 - if (!$parent.hasClass('open')) return
1.101 - $parent.trigger(e = $.Event('hide.bs.dropdown'))
1.102 - if (e.isDefaultPrevented()) return
1.103 - $parent.removeClass('open').trigger('hidden.bs.dropdown')
1.104 - })
1.105 - }
1.106 -
1.107 - function getParent($this) {
1.108 - var selector = $this.attr('data-target')
1.109 -
1.110 - if (!selector) {
1.111 - selector = $this.attr('href')
1.112 - selector = selector && /#/.test(selector) && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7
1.113 - }
1.114 -
1.115 - var $parent = selector && $(selector)
1.116 -
1.117 - return $parent && $parent.length ? $parent : $this.parent()
1.118 - }
1.119 -
1.120 -
1.121 - // DROPDOWN PLUGIN DEFINITION
1.122 - // ==========================
1.123 -
1.124 - var old = $.fn.dropdown
1.125 -
1.126 - $.fn.dropdown = function (option) {
1.127 - return this.each(function () {
1.128 - var $this = $(this)
1.129 - var data = $this.data('bs.dropdown')
1.130 -
1.131 - if (!data) $this.data('bs.dropdown', (data = new Dropdown(this)))
1.132 - if (typeof option == 'string') data[option].call($this)
1.133 - })
1.134 - }
1.135 -
1.136 - $.fn.dropdown.Constructor = Dropdown
1.137 -
1.138 -
1.139 - // DROPDOWN NO CONFLICT
1.140 - // ====================
1.141 -
1.142 - $.fn.dropdown.noConflict = function () {
1.143 - $.fn.dropdown = old
1.144 - return this
1.145 - }
1.146 -
1.147 -
1.148 - // APPLY TO STANDARD DROPDOWN ELEMENTS
1.149 - // ===================================
1.150 -
1.151 - $(document)
1.152 - .on('click.bs.dropdown.data-api', clearMenus)
1.153 - .on('click.bs.dropdown.data-api', '.dropdown form', function (e) { e.stopPropagation() })
1.154 - .on('click.bs.dropdown.data-api' , toggle, Dropdown.prototype.toggle)
1.155 - .on('keydown.bs.dropdown.data-api', toggle + ', [role=menu]' , Dropdown.prototype.keydown)
1.156 -
1.157 -}(jQuery);