summaryrefslogtreecommitdiffstats
path: root/extensions/BugModal/web
diff options
context:
space:
mode:
authorKohei Yoshino <kohei.yoshino@gmail.com>2017-12-13 22:06:06 +0100
committerDylan William Hardison <dylan@hardison.net>2017-12-13 22:06:06 +0100
commit2e5d910d9401c4fa8f105d8f9502d9e4ea27bb99 (patch)
treeaba81e2eedc8af3136af73af3beba04c092ff80c /extensions/BugModal/web
parent48fe3a1e0a4a833aa14e7f95136d0e4542959eb8 (diff)
downloadbugzilla-2e5d910d9401c4fa8f105d8f9502d9e4ea27bb99.tar.gz
bugzilla-2e5d910d9401c4fa8f105d8f9502d9e4ea27bb99.tar.xz
Bug 1376826 - New HTML Header for BMO
Diffstat (limited to 'extensions/BugModal/web')
-rw-r--r--extensions/BugModal/web/dropdown.css53
-rw-r--r--extensions/BugModal/web/dropdown.js93
2 files changed, 0 insertions, 146 deletions
diff --git a/extensions/BugModal/web/dropdown.css b/extensions/BugModal/web/dropdown.css
deleted file mode 100644
index e9a363c11..000000000
--- a/extensions/BugModal/web/dropdown.css
+++ /dev/null
@@ -1,53 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this file,
- * You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This Source Code Form is "Incompatible With Secondary Licenses", as
- * defined by the Mozilla Public License, v. 2.0. */
-
-/* The container <div> - needed to position the dropdown content */
-.dropdown {
- position: relative;
- display: inline-block;
-}
-
-/* Dropdown Content (Hidden by Default) */
-.dropdown-content {
- position: absolute;
- background-color: #eee;
- min-width: 120px;
- z-index: 1;
- text-align: left;
- margin: 0;
- padding: 0;
- border: 1px solid #ddd;
- -webkit-box-shadow: 1px 1px 5px rgba(0, 0, 0, 0.1);
- -moz-box-shadow: 1px 1px 5px rgba(0, 0, 0, 0.1);
- box-shadow: 1px 1px 5px rgba(0, 0, 0, 0.1);
- list-style: none;
- right: 0px;
-}
-
-.dropdown-content.menu-up {
- bottom: 100%;
-}
-
-.dropdown-separator {
- border-bottom: 1px solid #ddd;
-}
-
-/* Links inside the dropdown */
-.dropdown-content a {
- white-space: nowrap;
- background-color: #eee;
- color: black !important;
- padding: 4px 8px;
- text-decoration: none !important;
- display: block;
-}
-
-/* Change color of dropdown links on hover */
-.dropdown-content li .active {
- text-decoration: none;
- background-color: #39f;
-}
diff --git a/extensions/BugModal/web/dropdown.js b/extensions/BugModal/web/dropdown.js
deleted file mode 100644
index 181be9f73..000000000
--- a/extensions/BugModal/web/dropdown.js
+++ /dev/null
@@ -1,93 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this file,
- * You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This Source Code Form is "Incompatible With Secondary Licenses", as
- * defined by the Mozilla Public License, v. 2.0. */
-
-$(function() {
- 'use strict';
-
- $(window).click(function(e) {
- // clicking dropdown button opens or closes the dropdown content
- if (!$(e.target).hasClass('dropdown-button')) {
- $('.dropdown-button').each(function() {
- toggleDropDown(e, $(this), $('#' + $(this).attr('aria-controls')), 1);
- });
- }
- }).keydown(function(e) {
- // Escape key hides the dropdown if visible
- if (e.keyCode == 27) {
- $('.dropdown-button').each(function() {
- var $button = $(this);
- if ($button.siblings('.dropdown-content').is(':visible')) {
- toggleDropDown(e, $button, $('#' + $button.attr('aria-controls')), 1);
- $button.focus();
- }
- });
- }
- // allow arrow up and down keys to choose one of the dropdown items if menu visible
- if (e.keyCode == 38 || e.keyCode == 40) {
- $('.dropdown-content').each(function() {
- var $content = $(this);
- if ($content.is(':visible')) {
- e.preventDefault();
- e.stopPropagation();
- var $li = $content.find('li');
- // if none focused select the first or last
- var $any_focused = $content.find('a:focus');
- if ($any_focused.length == 0) {
- var index = e.keyCode == 40 ? 0 : $li.length - 1;
- var $link = $li.eq(index).find('a');
- $link.addClass('active').focus();
- return;
- }
- // otherwise move up or down the list based on arrow key pressed
- var inc = e.keyCode == 40 ? 1 : -1;
- var move = $content.find('a:focus').parent('li').index() + inc;
- var $link = $li.eq(move % $li.length).find('a');
- $content.find('a').removeClass('active');
- $link.addClass('active').focus();
- }
- });
- }
-
- // enter clicks on a link
- if (e.keyCode == 13) {
- $('.dropdown-content:visible a.active').trigger('click');
- }
- });
-
- $('.dropdown-content a').hover(
- function(){ $(this).addClass('active') },
- function(){ $(this).removeClass('active') }
- );
-
- $('.dropdown').each(function() {
- var $div = $(this);
- var $button = $div.find('.dropdown-button');
- var $content = $div.find('.dropdown-content');
- $button.click(function(e) {
- toggleDropDown(e, $button, $content);
- }).keydown(function(e) {
- // allow enter to toggle menu
- if (e.keyCode == 13) {
- toggleDropDown(e, $button, $content);
- }
- });
- });
-
- function toggleDropDown(e, $button, $content, hide_only) {
- // clear all active links
- $content.find('a').removeClass('active');
- if ($content.is(':visible')) {
- $content.hide();
- $button.attr('aria-expanded', false);
- }
- // if not using Escape or clicking outside the dropdown div, then we are hiding
- else if (!hide_only) {
- $content.show();
- $button.attr('aria-expanded', true);
- }
- }
-});