/**
 * Popups of the collapsable sidebar secondary menu.
 *
 * @mixin
 * @namespace Bolt.submenu
 *
 * @param {Object} bolt - The Bolt module.
 * @param {Object} $ - jQuery.
 * @param {Object} window - Window object.
 */
(function (bolt, $, window) {
    /**
     * Bolt.submenu mixin container.
     *
     * @private
     * @type {Object}
     */
    var submenu = {};

    /**
     * Initializes the mixin.
     *
     * @static
     * @function init
     * @memberof Bolt.submenu
     */
    submenu.init = function () {
        var usePopOvers = !$('.navbar-toggle').is(':visible');

        if (usePopOvers) {
            $('#navpage-secondary a.menu-pop').each(function () {
                initPopOver($(this));
            });
            initDesktopAction();
        } else {
            initMobileAction();
        }
    };

    /**
     * Timeout to open the submenu.
     *
     * @private
     * @constant {integer} Timeout resource number
     * @memberof Bolt.submenu
     */
    var timeout = 0;

    /**
     * Initialize a popup menu.
     *
     * @private
     * @function initPopOver
     * @memberof Bolt.submenu
     *
     * @param {object} menuitem - The menuitem to initialize.
     */
    function initPopOver(menuitem) {
        // Extract menu data and attach it to the popover
        var submenu = '';

        menuitem.nextAll('.submenu').children().each(function () {
            if ($(this).hasClass('subdivider')) {
                submenu += '<hr>';
            }
            submenu += $(this).html().trim().replace(/[ \n]+/g, ' ').replace(/(>) | (<)/g, '$1$2');
        });

        menuitem.popover({
            content: submenu,
            html: true
        });
    }

    /**
     * Initialize opening/closing of mobile submenu.
     *
     * @private
     * @function initMobileAction
     * @memberof Bolt.submenu
     */
    function initMobileAction() {
        $('#navpage-secondary a.menu-pop').on('click', function(e) {
            var submenu = $(this).nextAll('.submenu');

            e.preventDefault();

            if (submenu.hasClass('show')) {
                submenu.removeClass('show');
            } else {
                $('#navpage-secondary .submenu').removeClass('show');
                submenu.addClass('show');
            }
        });
    }

    /**
     * Initialize adding of hover focus and leave blur event handlers for desktop popovers.
     *
     * @private
     * @function initDesktopAction
     * @memberof Bolt.submenu
     */
    function initDesktopAction() {
        $('#navpage-secondary')
            .on('mouseover focus', 'a.menu-pop', function () {
                var item = this;

                window.clearTimeout(timeout);
                timeout = window.setTimeout(function () {
                    $('#navpage-secondary a.menu-pop').not(item).popover('hide');
                    $(item).popover('show');
                }, 300);
            })
            .on('mouseenter focus', '.popover', function () {
                window.clearTimeout(timeout);
            })
            .on('mouseleave blur', 'a.menu-pop, .popover', function () {
                window.clearTimeout(timeout);
                timeout = window.setTimeout(function () {
                    $('#navpage-secondary a.menu-pop').popover('hide');
                }, 300);
            });
    }

    // Apply mixin container
    bolt.submenu = submenu;

})(Bolt || {}, jQuery, window);

@@ -625,113 +625,21 @@
     
-$('#navpage-secondary a.menu-pop').each(function () %7B%0A                initPopOver($(this));%0A            %7D
+initPopOvers(
 );%0A 
@@ -854,16 +854,17 @@
 e number
+.
 %0A     * 
@@ -946,20 +946,48 @@
 ize 
-a
+the
  pop
-up
+over menues in the secondary
  men
-u
+y
 .%0A  
@@ -1035,16 +1035,17 @@
 tPopOver
+s
 %0A     * 
@@ -1077,116 +1077,174 @@
    *
+/
 %0A    
- * @param %7Bobject%7D menuitem - The menuitem to initialize.%0A     */%0A    function initPopOver(menuitem) %7B%0A
+function initPopOvers() %7B%0A%0A        $('#navpage-secondary a.menu-pop').each(function () %7B%0A            var menuitem = $(this),%0A                submenu = '';%0A%0A    
     
@@ -1300,36 +1300,14 @@
 over
+.
 %0A    
-    var submenu = '';%0A%0A
     
@@ -1377,24 +1377,28 @@
             
+    
 if ($(this).
@@ -1431,32 +1431,36 @@
                 
+    
 submenu += '%3Chr%3E
@@ -1466,34 +1466,42 @@
 %3E';%0A            
+  
-%7D%0A
+  %7D%0A    
             subm
@@ -1596,13 +1596,21 @@
     
+    
 %7D);%0A%0A
+    
     
@@ -1644,16 +1644,20 @@
         
+    
 content:
@@ -1678,16 +1678,20 @@
         
+  
+  
 html: tr
@@ -1693,16 +1693,396 @@
 l: true%0A
+            %7D);%0A%0A            menuitem.on('mouseover focus', function () %7B%0A                var item = this;%0A%0A                window.clearTimeout(timeout);%0A                timeout = window.setTimeout(function () %7B%0A                    $('#navpage-secondary a.menu-pop').not(item).popover('hide');%0A                    $(item).popover('show');%0A                %7D, 300);%0A            %7D);%0A
         
@@ -2962,376 +2962,8 @@
 y')%0A
-            .on('mouseover focus', 'a.menu-pop', function () %7B%0A                var item = this;%0A%0A                window.clearTimeout(timeout);%0A                timeout = window.setTimeout(function () %7B%0A                    $('#navpage-secondary a.menu-pop').not(item).popover('hide');%0A                    $(item).popover('show');%0A                %7D, 300);%0A            %7D)%0A
     

Move the loop back