Файловый менеджер - Редактировать - /home/wuectly/www/03cbe/dropdown.js.tar
Назад
home/wuectly/www/media/fef/js/dropdown.js 0000604 00000011114 15245632111 0014433 0 ustar 00 /* * Akeeba Frontend Framework (FEF) * * @package fef * @copyright (c) 2017-2020 Nicholas K. Dionysopoulos / Akeeba Ltd * @license GNU General Public License version 3, or later * * Created by Crystal Dionysopoulou for Akeeba Ltd, https://www.akeeba.com */ if (typeof akeeba === 'undefined') { akeeba = {}; } if (typeof akeeba.fef === 'undefined') { akeeba.fef = {}; } if (typeof akeeba.fef.forEach === 'undefined') { akeeba.fef.forEach = function (array, callback, scope) { for (var i = 0; i < array.length; i++) { callback.call(scope, i, array[i]); } }; } if (typeof akeeba.fef.triggerEvent === 'undefined') { akeeba.fef.triggerEvent = function (element, eventName) { if (typeof element === 'undefined') { return; } if (element === null) { return; } // Allow the passing of an element ID string instead of the DOM elem if (typeof element === "string") { element = document.getElementById(element); } if (typeof element !== 'object') { return; } if (!(element instanceof Element)) { return; } // Use jQuery and be done with it! if (typeof window.jQuery === 'function') { window.jQuery(element).trigger(eventName); return; } // Internet Explorer way if (document.fireEvent && (typeof window.Event === 'undefined')) { element.fireEvent('on' + eventName); return; } // This works on Chrome and Edge but not on Firefox. Ugh. var event = null; event = document.createEvent("Event"); event.initEvent(eventName, true, true); element.dispatchEvent(event); }; } /** * Activates the dropdown interface for specific HTML elements * * @param {String} [selector] CSS selector for the tab-set wrapper(s). Default: 'nav.akeeba-dropdown' */ akeeba.fef.dropdown = function(selector) { // Use the default selector, if necessary if ((typeof selector === 'undefined') || (selector === '')) { selector = 'nav.akeeba-dropdown'; } // Get all outer wrappers (NAV elements) var navList = document.querySelectorAll(selector); if (navList.length === 0) { return; } // Loop for the first button inside each wrapper (the NAV) akeeba.fef.forEach(navList, function(i, elNav) { // Get the first button inside the NAV wrapper. That's our drop-down toggle. var buttonList = elNav.querySelectorAll('button'); if (buttonList.length === 0) { return; } var elButton = buttonList[0]; // Add an event listener to toggle the "open" class whenever the button is clicked. elButton.addEventListener('click', function (event) { var isOpen = false; var currentClasses = this.className.split(' '); var newClass = ''; for (var property in currentClasses) { if (!currentClasses.hasOwnProperty(property)) { continue; } if (currentClasses[property] === 'open') { isOpen = true; continue; } newClass += currentClasses[property] + ' '; } if (newClass.trim) { newClass = newClass.trim(); } if (!isOpen) { newClass += ' open'; } this.className = newClass; event.preventDefault(); }); // Loop through all section > a elements in the NAV var linkList = elNav.querySelectorAll('section > a'); if (linkList.length === 0) { return; } /** * Clicking on each link will do two things: * - It will set the clicked link's class to “current” * - It will unset the “current” class on every other link * - It will trigger a virtual click on the drop-down button (to close the drop-down). */ akeeba.fef.forEach(linkList, function(i, elLink) { elLink.addEventListener('click', function (event) { // Close the drop-down akeeba.fef.triggerEvent(elButton, 'click'); // Remove the “current” class from all links akeeba.fef.forEach(linkList, function(i, element) { var currentClasses = element.className.split(' '); var newClass = ''; for (var property in currentClasses) { if (!currentClasses.hasOwnProperty(property) || (currentClasses[property] === 'current')) { continue; } newClass += currentClasses[property] + ' '; } if (newClass.trim) { newClass = newClass.trim(); } element.className = newClass; }); // Add the “current” class to the current link this.className += ' current'; event.preventDefault(); }); }); }); }; home/wuectly/www/plugins/system/t3/base/bootstrap/js/dropdown.js 0000604 00000010630 15245721526 0021111 0 ustar 00 /* ======================================================================== * Bootstrap: dropdown.js v3.0.0 * http://twbs.github.com/bootstrap/javascript.html#dropdowns * ======================================================================== * Copyright 2012 Twitter, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * ======================================================================== */ +function ($) { "use strict"; // DROPDOWN CLASS DEFINITION // ========================= var backdrop = '.dropdown-backdrop' var toggle = '[data-toggle=dropdown]' var Dropdown = function (element) { var $el = $(element).on('click.bs.dropdown', this.toggle) } Dropdown.prototype.toggle = function (e) { var $this = $(this) if ($this.is('.disabled, :disabled')) return var $parent = getParent($this) var isActive = $parent.hasClass('open') clearMenus() if (!isActive) { if ('ontouchstart' in document.documentElement && !$parent.closest('.navbar-nav').length) { // if mobile we we use a backdrop because click events don't delegate $('<div class="dropdown-backdrop"/>').insertAfter($(this)).on('click', clearMenus) } $parent.trigger(e = $.Event('show.bs.dropdown')) if (e.isDefaultPrevented()) return $parent .toggleClass('open') .trigger('shown.bs.dropdown') $this.focus() } return false } Dropdown.prototype.keydown = function (e) { if (!/(38|40|27)/.test(e.keyCode)) return var $this = $(this) e.preventDefault() e.stopPropagation() if ($this.is('.disabled, :disabled')) return var $parent = getParent($this) var isActive = $parent.hasClass('open') if (!isActive || (isActive && e.keyCode == 27)) { if (e.which == 27) $parent.find(toggle).focus() return $this.click() } var $items = $('[role=menu] li:not(.divider):visible a', $parent) if (!$items.length) return var index = $items.index($items.filter(':focus')) if (e.keyCode == 38 && index > 0) index-- // up if (e.keyCode == 40 && index < $items.length - 1) index++ // down if (!~index) index=0 $items.eq(index).focus() } function clearMenus() { $(backdrop).remove() $(toggle).each(function (e) { var $parent = getParent($(this)) if (!$parent.hasClass('open')) return $parent.trigger(e = $.Event('hide.bs.dropdown')) if (e.isDefaultPrevented()) return $parent.removeClass('open').trigger('hidden.bs.dropdown') }) } function getParent($this) { var selector = $this.attr('data-target') if (!selector) { selector = $this.attr('href') selector = selector && /#/.test(selector) && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7 } var $parent = selector && $(selector) return $parent && $parent.length ? $parent : $this.parent() } // DROPDOWN PLUGIN DEFINITION // ========================== var old = $.fn.dropdown $.fn.dropdown = function (option) { return this.each(function () { var $this = $(this) var data = $this.data('dropdown') if (!data) $this.data('dropdown', (data = new Dropdown(this))) if (typeof option == 'string') data[option].call($this) }) } $.fn.dropdown.Constructor = Dropdown // DROPDOWN NO CONFLICT // ==================== $.fn.dropdown.noConflict = function () { $.fn.dropdown = old return this } // APPLY TO STANDARD DROPDOWN ELEMENTS // =================================== $(document) .on('click.bs.dropdown.data-api', clearMenus) .on('click.bs.dropdown.data-api', '.dropdown form', function (e) { e.stopPropagation() }) .on('click.bs.dropdown.data-api' , toggle, Dropdown.prototype.toggle) .on('keydown.bs.dropdown.data-api', toggle + ', [role=menu]' , Dropdown.prototype.keydown) }(window.jQuery);
| ver. 1.4 |
Github
|
.
| PHP 8.1.34 | Генерация страницы: 0 |
proxy
|
phpinfo
|
Настройка