aboutsummaryrefslogtreecommitdiffstats
path: root/core/js/js.js
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2019-05-08 09:41:03 +0200
committerGitHub <noreply@github.com>2019-05-08 09:41:03 +0200
commita3800a6810fca68eff1789dc21488389bf22108a (patch)
tree212570856cef261d907d88ed12263eadeae3df36 /core/js/js.js
parent46281dc0bf0def1ba8926c3c35b8456234ad6161 (diff)
parentb2165059d46eedfa6c268283919b3dba9f592bb0 (diff)
downloadnextcloud-server-a3800a6810fca68eff1789dc21488389bf22108a.tar.gz
nextcloud-server-a3800a6810fca68eff1789dc21488389bf22108a.zip
Merge pull request #15436 from nextcloud/refactor/oc-menu-helpers-bundle
Move OC legacy menu helpers to the bundle
Diffstat (limited to 'core/js/js.js')
-rw-r--r--core/js/js.js110
1 files changed, 0 insertions, 110 deletions
diff --git a/core/js/js.js b/core/js/js.js
index b9b46035a95..c4017b46267 100644
--- a/core/js/js.js
+++ b/core/js/js.js
@@ -420,116 +420,6 @@ Object.assign(window.OC, {
},
/**
- * For menu toggling
- * @todo Write documentation
- *
- * @param {jQuery} $toggle
- * @param {jQuery} $menuEl
- * @param {function|undefined} toggle callback invoked everytime the menu is opened
- * @param {boolean} headerMenu is this a top right header menu?
- * @returns {undefined}
- */
- registerMenu: function($toggle, $menuEl, toggle, headerMenu) {
- var self = this;
- $menuEl.addClass('menu');
-
- // On link, the enter key trigger a click event
- // Only use the click to avoid two fired events
- $toggle.on($toggle.prop('tagName') === 'A'
- ? 'click.menu'
- : 'click.menu keyup.menu', function(event) {
- // prevent the link event (append anchor to URL)
- event.preventDefault();
-
- // allow enter key as a trigger
- if (event.key && event.key !== "Enter") {
- return;
- }
-
- if ($menuEl.is(OC._currentMenu)) {
- self.hideMenus();
- return;
- }
- // another menu was open?
- else if (OC._currentMenu) {
- // close it
- self.hideMenus();
- }
-
- if (headerMenu === true) {
- $menuEl.parent().addClass('openedMenu');
- }
-
- // Set menu to expanded
- $toggle.attr('aria-expanded', true);
-
- $menuEl.slideToggle(OC.menuSpeed, toggle);
- OC._currentMenu = $menuEl;
- OC._currentMenuToggle = $toggle;
- });
- },
-
- /**
- * @todo Write documentation
- */
- unregisterMenu: function($toggle, $menuEl) {
- // close menu if opened
- if ($menuEl.is(OC._currentMenu)) {
- this.hideMenus();
- }
- $toggle.off('click.menu').removeClass('menutoggle');
- $menuEl.removeClass('menu');
- },
-
- /**
- * Hides any open menus
- *
- * @param {Function} complete callback when the hiding animation is done
- */
- hideMenus: function(complete) {
- if (OC._currentMenu) {
- var lastMenu = OC._currentMenu;
- OC._currentMenu.trigger(new $.Event('beforeHide'));
- OC._currentMenu.slideUp(OC.menuSpeed, function() {
- lastMenu.trigger(new $.Event('afterHide'));
- if (complete) {
- complete.apply(this, arguments);
- }
- });
- }
-
- // Set menu to closed
- $('.menutoggle').attr('aria-expanded', false);
-
- $('.openedMenu').removeClass('openedMenu');
- OC._currentMenu = null;
- OC._currentMenuToggle = null;
- },
-
- /**
- * Shows a given element as menu
- *
- * @param {Object} [$toggle=null] menu toggle
- * @param {Object} $menuEl menu element
- * @param {Function} complete callback when the showing animation is done
- */
- showMenu: function($toggle, $menuEl, complete) {
- if ($menuEl.is(OC._currentMenu)) {
- return;
- }
- this.hideMenus();
- OC._currentMenu = $menuEl;
- OC._currentMenuToggle = $toggle;
- $menuEl.trigger(new $.Event('beforeShow'));
- $menuEl.show();
- $menuEl.trigger(new $.Event('afterShow'));
- // no animation
- if (_.isFunction(complete)) {
- complete();
- }
- },
-
- /**
* Returns the user's locale as a BCP 47 compliant language tag
*
* @return {String} locale string