add OC.menuSpeed to control the animation speed of menu toggle

This commit is contained in:
Morris Jobke 2014-05-19 15:44:19 +02:00 committed by Jan-Christoph Borchardt
parent 72ba396905
commit de23ae735b
1 changed files with 8 additions and 7 deletions

View File

@ -183,7 +183,8 @@ var OC={
appConfig: window.oc_appconfig || {}, appConfig: window.oc_appconfig || {},
theme: window.oc_defaults || {}, theme: window.oc_defaults || {},
coreApps:['', 'admin','log','search','settings','core','3rdparty'], coreApps:['', 'admin','log','search','settings','core','3rdparty'],
menuSpeed: 100,
/** /**
* Get an absolute url to a file in an app * Get an absolute url to a file in an app
* @param {string} app the id of the app the file belongs to * @param {string} app the id of the app the file belongs to
@ -531,7 +532,7 @@ var OC={
$toggle.addClass('menutoggle'); $toggle.addClass('menutoggle');
$toggle.on('click.menu', function(event) { $toggle.on('click.menu', function(event) {
if ($menuEl.is(OC._currentMenu)) { if ($menuEl.is(OC._currentMenu)) {
$menuEl.slideUp(200); $menuEl.slideUp(OC.menuSpeed);
OC._currentMenu = null; OC._currentMenu = null;
OC._currentMenuToggle = null; OC._currentMenuToggle = null;
return false; return false;
@ -541,7 +542,7 @@ var OC={
// close it // close it
OC._currentMenu.hide(); OC._currentMenu.hide();
} }
$menuEl.slideToggle(200); $menuEl.slideToggle(OC.menuSpeed);
OC._currentMenu = $menuEl; OC._currentMenu = $menuEl;
OC._currentMenuToggle = $toggle; OC._currentMenuToggle = $toggle;
return false; return false;
@ -554,7 +555,7 @@ var OC={
unregisterMenu: function($toggle, $menuEl) { unregisterMenu: function($toggle, $menuEl) {
// close menu if opened // close menu if opened
if ($menuEl.is(OC._currentMenu)) { if ($menuEl.is(OC._currentMenu)) {
$menuEl.slideUp(200); $menuEl.slideUp(OC.menuSpeed);
OC._currentMenu = null; OC._currentMenu = null;
OC._currentMenuToggle = null; OC._currentMenuToggle = null;
} }
@ -1068,7 +1069,7 @@ function initCore() {
} }
}); });
$('#settings #expand').click(function(event) { $('#settings #expand').click(function(event) {
$('#settings #expanddiv').slideToggle(200); $('#settings #expanddiv').slideToggle(OC.menuSpeed);
event.stopPropagation(); event.stopPropagation();
}); });
$('#settings #expanddiv').click(function(event){ $('#settings #expanddiv').click(function(event){
@ -1076,7 +1077,7 @@ function initCore() {
}); });
//hide the user menu when clicking outside it //hide the user menu when clicking outside it
$(document).click(function(){ $(document).click(function(){
$('#settings #expanddiv').slideUp(200); $('#settings #expanddiv').slideUp(OC.menuSpeed);
}); });
// all the tipsy stuff needs to be here (in reverse order) to work // all the tipsy stuff needs to be here (in reverse order) to work
@ -1097,7 +1098,7 @@ function initCore() {
return false; return false;
} }
if (OC._currentMenu) { if (OC._currentMenu) {
OC._currentMenu.slideUp(200); OC._currentMenu.slideUp(OC.menuSpeed);
} }
OC._currentMenu = null; OC._currentMenu = null;
OC._currentMenuToggle = null; OC._currentMenuToggle = null;