简体   繁体   English

Magento-此javascript文件未正确合并

[英]Magento - this javascript file doesn't merge correctly

i have a magento 1.6.2 webshop. 我有一个magento 1.6.2网上商店。

I would like to merge the javascript files for optimizing my loadingspeeds. 我想合并javascript文件以优化加载速度。 But when i select merge in the settings my Custom Menu extensions doesn't work anymore. 但是,当我在设置中选择合并时,“自定义菜单”扩展名将不再起作用。

I guess there is something wrong in the code. 我猜代码有问题。 I have tried to contact the developer, but i don't get a reaction ... 我试图与开发人员联系,但是我没有反应...

This extension is for the navigation menu at the top (with images) 此扩展名用于顶部的导航菜单(带有图像)

Here is the code of the custommenu.js file: 这是custommenu.js文件的代码:

    function wpShowMenuPopup(objMenu, popupId)
{
    objMenu = $(objMenu.id); var popup = $(popupId); if (!popup) return;
    popup.style.display = 'block';
    objMenu.addClassName('active');
    var popupWidth = CUSTOMMENU_POPUP_WIDTH;
    if (!popupWidth) popupWidth = popup.getWidth();
    var pos = wpPopupPos(objMenu, popupWidth);
    popup.style.top = pos.top + 'px';
    popup.style.left = pos.left + 'px';
    if (CUSTOMMENU_POPUP_WIDTH) popup.style.width = CUSTOMMENU_POPUP_WIDTH + 'px';
}

function wpPopupPos(objMenu, w)
{
    var pos = objMenu.cumulativeOffset();
    var wraper = $('custommenu');
    var posWraper = wraper.cumulativeOffset();
    var wWraper = wraper.getWidth() - CUSTOMMENU_POPUP_RIGHT_OFFSET_MIN;
    var xTop = pos.top - posWraper.top + CUSTOMMENU_POPUP_TOP_OFFSET;
    var xLeft = pos.left - posWraper.left;
    if ((xLeft + w) > wWraper) xLeft = wWraper - w;
    return {'top': xTop, 'left': xLeft};
}

function wpHideMenuPopup(element, event, popupId, menuId)
{
    element = $(element.id); var popup = $(popupId); if (!popup) return;
    var current_mouse_target = null;
    if (event.toElement)
    {
        current_mouse_target = event.toElement;
    }
    else if (event.relatedTarget)
    {
        current_mouse_target = event.relatedTarget;
    }
    if (!wpIsChildOf(element, current_mouse_target) && element != current_mouse_target)
    {
        if (!wpIsChildOf(popup, current_mouse_target) && popup != current_mouse_target)
        {
            popup.style.display = 'none';
            $(menuId).removeClassName('active');
        }
    }
}

function wpIsChildOf(parent, child)
{
    if (child != null)
    {
        while (child.parentNode)
        {
            if ((child = child.parentNode) == parent)
            {
                return true;
            }
        }
    }
    return false;
}

You can see it working on my webshop: www.liefstoereigenwijs.nl 您可以在我的网上商店中看到它的运行情况: www.liefstoereigengenwijs.nl

Can anyone see if there is something wrong in the code? 谁能看到代码中是否有错误? Or has a other solution for my problem? 还是我的问题有其他解决方案?

End each 结束每个

function xx(x)
{
  ...
}

with a ; ; at the end! 在末尾!

So: 所以:

function xx(x)
{
  ...
};

问题在1.7.0.2中自动解决

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM