=== modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.menu.js' --- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.menu.js 2014-04-03 15:09:25 +0000 +++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.menu.js 2014-04-03 15:58:51 +0000 @@ -526,6 +526,83 @@ }); + // Set show and hide drop down events on top menu + + $( "#menuLink1" ).hover( function() + { + showDropDown( "menuDropDown1" ); + }, + function() + { + hideDropDownTimeout(); + } ); + + $( "#menuLink2" ).hover( function() + { + showDropDown( "menuDropDown2" ); + }, + function() + { + hideDropDownTimeout(); + } ); + + $( "#menuLink3" ).hover( function() + { + showDropDown( "menuDropDown3" ); + }, + function() + { + hideDropDownTimeout(); + } ); + + $( "#menuDropDown1, #menuDropDown2, #menuDropDown3" ).hover( function() + { + cancelHideDropDownTimeout(); + }, + function() + { + hideDropDownTimeout(); + } ); + + + $('.drop-down-menu-link').get().forEach(function (element, index, elements) { + var id = $(element).parent().attr('id'), + dropdown_menu = $('div#' + id.split('_')[0]); + + function closeAllDropdowns() { + $('.app-menu-dropdown').each(function () { + $(this).attr('data-clicked-open', 'false'); + $(this).hide(); + }); + hideDropDown(); + } + + $(element).click(function () { + return function () { + var thisDropDownStatus = $(dropdown_menu).attr('data-clicked-open'); + closeAllDropdowns(); + + if (thisDropDownStatus === 'true') { + $(dropdown_menu).attr('data-clicked-open', 'false'); + } else { + $(dropdown_menu).attr('data-clicked-open', 'true'); + showDropDown(dropdown_menu.attr('id')); + } + } + }()); + }); + + $(window).resize(function () { + $('.app-menu-dropdown').get().forEach(function (element, index, elements) { + var newDropDownId = '#' + $(element).attr('id'), + position = $(newDropDownId + '_button').position(); + + $(newDropDownId).css('position', 'absolute'); + $(newDropDownId).css('top', '55px'); + $(newDropDownId).css('left', Math.ceil(position.left - Math.ceil(parseInt($(newDropDownId).innerWidth(), 10) - 108)) + 'px'); + }); + }); + }); })(jQuery, dhis2.menu); === modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/main.js' --- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/main.js 2014-04-03 15:35:50 +0000 +++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/main.js 2014-04-03 15:58:51 +0000 @@ -19,83 +19,6 @@ { $( this ).attr( "src", "../images/hide.png" ); } ); - - // Set show and hide drop down events on top menu - - $( "#menuLink1" ).hover( function() - { - showDropDown( "menuDropDown1" ); - }, - function() - { - hideDropDownTimeout(); - } ); - - $( "#menuLink2" ).hover( function() - { - showDropDown( "menuDropDown2" ); - }, - function() - { - hideDropDownTimeout(); - } ); - - $( "#menuLink3" ).hover( function() - { - showDropDown( "menuDropDown3" ); - }, - function() - { - hideDropDownTimeout(); - } ); - - $( "#menuDropDown1, #menuDropDown2, #menuDropDown3" ).hover( function() - { - cancelHideDropDownTimeout(); - }, - function() - { - hideDropDownTimeout(); - } ); - - - $('.drop-down-menu-link').get().forEach(function (element, index, elements) { - var id = $(element).parent().attr('id'), - dropdown_menu = $('div#' + id.split('_')[0]); - - function closeAllDropdowns() { - $('.app-menu-dropdown').each(function () { - $(this).attr('data-clicked-open', 'false'); - $(this).hide(); - }); - hideDropDown(); - } - - $(element).click(function () { - return function () { - var thisDropDownStatus = $(dropdown_menu).attr('data-clicked-open'); - closeAllDropdowns(); - - if (thisDropDownStatus === 'true') { - $(dropdown_menu).attr('data-clicked-open', 'false'); - } else { - $(dropdown_menu).attr('data-clicked-open', 'true'); - showDropDown(dropdown_menu.attr('id')); - } - } - }()); - }); - - $(window).resize(function () { - $('.app-menu-dropdown').get().forEach(function (element, index, elements) { - var newDropDownId = '#' + $(element).attr('id'), - position = $(newDropDownId + '_button').position(); - - $(newDropDownId).css('position', 'absolute'); - $(newDropDownId).css('top', '55px'); - $(newDropDownId).css('left', Math.ceil(position.left - Math.ceil(parseInt($(newDropDownId).innerWidth(), 10) - 108)) + 'px'); - }); - }); } function setTableStyles()