Скрипт Mootools работает в Joomla 1.5, а не в 2.5? - PullRequest
0 голосов
/ 27 марта 2012

У меня есть скрипт, который мне нужно использовать в Joomla 2.5, но, похоже, он не будет работать с новой версией?Какие у меня параметры?

Вот полный код скрипта файла.

echo "<script language=\"javascript\" type=\"text/javascript\" src=\"".JURI::base()."/modules/mod_imageshowcase/mootools-release-1.11.js\"></script>\n";
}
echo 
    "<script language=\"javascript\" type=\"text/javascript\">\n".
    "var praiseShowStartImage_".$moduleInstanceId." = '".$startImage."';\n".
    "var praiseShowImageOrder_".$moduleInstanceId." = '".$imageOrder."';\n".
    "var praiseShowPingPong_".$moduleInstanceId." = ".$pingPong.";\n".
    "var praiseShowImageCount_".$moduleInstanceId." = ".$index.";\n".
    "var praiseShowFxs_".$moduleInstanceId." = new Array();\n".
    "var praiseShowCurrentImageIndex_".$moduleInstanceId.";\n".
    "var praiseShowPlayCount_".$moduleInstanceId." = ".$playCount.";\n".
    "var praiseShowCurrentPlayCount_".$moduleInstanceId." = 0;\n".
    "if(praiseShowStartImage_".$moduleInstanceId." == 'random')\n".
    "{\n".
    "   praiseShowCurrentImageIndex_".$moduleInstanceId." = Math.floor(Math.random()*praiseShowImageCount_".$moduleInstanceId.");\n".
    "}\n".
    "else if(praiseShowStartImage_".$moduleInstanceId." == 'last_seen')\n".
    "{\n".
    "   praiseShowCurrentImageIndex_".$moduleInstanceId." = Cookie.get('praiseShowLastIndex_".$moduleInstanceId."');\n".
    "   if(!praiseShowCurrentImageIndex_".$moduleInstanceId.") { praiseShowCurrentImageIndex_".$moduleInstanceId." = 0; }\n".
    "}\n".
    "else if(praiseShowImageOrder_".$moduleInstanceId." == 'backward')\n".
    "{\n".
    "   praiseShowCurrentImageIndex_".$moduleInstanceId." = praiseShowImageCount_".$moduleInstanceId." - 1;\n".
    "}\n".
    "else\n".
    "{\n".
    "   praiseShowCurrentImageIndex_".$moduleInstanceId." = 0;\n".
    "}\n".
    "window.addEvent('domready',function() {\n".
    $domreadyScript.
    "});\n".
    "window.addEvent('load',function() {\n".
    "   var coords = $('".$containerTagId."').getCoordinates();\n".
    "   var elImage;\n".
    "   var elImageCoords;\n".
    "   $$('.mod_imageshowcase_div_".$moduleInstanceId."').each(function(el, i)\n".
    "   {\n".
    "       elImage = el.getElement('.mod_imageshowcase_image');\n";

if($imageScaleMode == "fit_both" || $imageScaleMode == "fit_height")
{
    echo "          elImage.setStyle('height', coords.height + 'px');\n";
}
if($imageScaleMode == "fit_both" || $imageScaleMode == "fit_width")
{
    echo "          elImage.setStyle('width', coords.width + 'px');\n";
}

if($imageScaleMode != "fit_both")
{
    switch($imageVerticalAlign)
    {
        case "top":
            $jsVerticalAlignText = "0";
            break;
        case "center":
            $jsVerticalAlignText = "(coords.height/2 - elImageCoords.height/2)";
            break;
        case "bottom":
        default:
            $jsVerticalAlignText = "(coords.height - elImageCoords.height)";
            break;
    }
    switch($imageHorizontalAlign)
    {
        case "left":
            $jsHorizontalAlignText = "0";
            break;
        case "center":
            $jsHorizontalAlignText = "(coords.width/2 - elImageCoords.width/2)";
            break;
        case "right":
        default:
            $jsHorizontalAlignText = "(coords.width - elImageCoords.width)";
            break;
    }
    echo
        "       elImageCoords = elImage.getCoordinates();\n".
        "       elImage.setStyle('left', ".$jsHorizontalAlignText." + 'px');\n".
        "       elImage.setStyle('top', ".$jsVerticalAlignText." + 'px');\n";
}
echo 
    "       if(i == praiseShowCurrentImageIndex_".$moduleInstanceId.") { el.setStyle('opacity', 1); }\n".
    "       else { el.setStyle('opacity', 0); }\n".
    "       praiseShowFxs_".$moduleInstanceId."[i] = new Fx.Style(el, 'opacity', {\n".
    "           wait: false,\n".
    "           duration: " . $transition_time . ",\n".
    "           transition: Fx.Transitions.Quart.easeInOut\n".
    "       });\n".
    "   });\n".
    "   switchImage_".$moduleInstanceId.".periodical(" . ($delay_time + $transition_time) . ");\n".
    "});\n".
    "var switchImage_".$moduleInstanceId." = function()\n".
    "{\n".
    "   var nextImageIndex = praiseShowCurrentImageIndex_".$moduleInstanceId.";\n".
    "   switch(praiseShowImageOrder_".$moduleInstanceId.")\n".
    "   {\n".
    "       case 'random':\n".
    "           while(nextImageIndex == praiseShowCurrentImageIndex_".$moduleInstanceId." && praiseShowImageCount_".$moduleInstanceId." > 0)\n".
    "           {\n".
    "               nextImageIndex = Math.floor(Math.random()*praiseShowImageCount_".$moduleInstanceId.");\n".
    "           }\n".
    "           break;\n".
    "       case 'backward':\n".
    "           nextImageIndex = praiseShowCurrentImageIndex_".$moduleInstanceId." - 1;\n".
    "           if(nextImageIndex < 0) {\n".
    "               if(praiseShowPingPong_".$moduleInstanceId.") {\n".
    "                   praiseShowImageOrder_".$moduleInstanceId." = 'forward';\n".
    "                   nextImageIndex = 1;\n".
    "                   praiseShowCurrentPlayCount_".$moduleInstanceId."++;\n".
    "               } else {\n".
    "                   nextImageIndex = praiseShowImageCount_".$moduleInstanceId." - 1;\n".
    "               }\n".
    "           }\n".
    "           break;\n".
    "       default:\n".
    "           nextImageIndex = praiseShowCurrentImageIndex_".$moduleInstanceId." + 1;\n".
    "           if(nextImageIndex >= praiseShowImageCount_".$moduleInstanceId.") {\n".
    "               if(praiseShowPingPong_".$moduleInstanceId.") {\n".
    "                   praiseShowImageOrder_".$moduleInstanceId." = 'backward';\n".
    "                   nextImageIndex = praiseShowImageCount_".$moduleInstanceId." - 2;\n".
    "                   praiseShowCurrentPlayCount_".$moduleInstanceId."++;\n".
    "               } else {\n".
    "                   nextImageIndex = 0;\n".
    "               }\n".
    "           }\n".
    "           break;\n".
    "   }\n".
    "   praiseShowCurrentPlayCount_".$moduleInstanceId."++;\n".
    "   if(praiseShowPlayCount_".$moduleInstanceId." == 0 || praiseShowCurrentPlayCount_".$moduleInstanceId." < praiseShowPlayCount_".$moduleInstanceId."*praiseShowImageCount_".$moduleInstanceId.") {\n".
    "       praiseShowFxs_".$moduleInstanceId."[praiseShowCurrentImageIndex_".$moduleInstanceId."].start(1, 0);\n".
    "       praiseShowFxs_".$moduleInstanceId."[nextImageIndex].start(0, 1);\n".
    "       praiseShowCurrentImageIndex_".$moduleInstanceId." = nextImageIndex;\n".
    "       Cookie.set('praiseShowLastIndex_".$moduleInstanceId."', praiseShowCurrentImageIndex_".$moduleInstanceId.");\n".
    "   }\n".
    "}\n".
    "</script>\n";

Просмотр источника:

<body id="page_bg" class="color_blue bg_blue width_fmax">
<a name="up" id="up"></a>
<div class="center" align="center">
    <div id="wrapper">
        <div id="wrapper_r">
            <div id="header">
                <div id="header_l">
                    <div id="header_r">
                        <div id="logo"></div>

                    </div>
                </div>
            </div>

            <div id="tabarea">
                <div id="tabarea_l">
                    <div id="tabarea_r">
                        <div id="tabmenu">
                        <table cellpadding="0" cellspacing="0" class="pill">
                            <tr>
                                <td class="pill_l">&nbsp;</td>
                                <td class="pill_m">
                                <div id="pillmenu">

                                </div>
                                </td>
                                <td class="pill_r">&nbsp;</td>
                            </tr>
                            </table>
                        </div>
                    </div>
                </div>
            </div>

            <div id="search">

            </div>

            <div id="pathway">
                <link href="http://localhost/test//modules/mod_imageshowcase/mod_imageshowcase.css" rel="stylesheet" type="text/css" />
<div style="" class="mod_imageshowcase_container" id="mod_imageshowcase_containerTagId_16">
<div style="opacity: 0; filter: alpha(opacity = 0)" id="mod_imageshowcase_divIdPrefix_160" class="mod_imageshowcase_div mod_imageshowcase_div_16">
<img id="mod_imageshowcase_imageIdPrefix_160" class="mod_imageshowcase_image" src="http://localhost/test//modules/mod_imageshowcase/testimages/CMS-Tactics-Inc-logo.gif" title="" />
<br />
</div>
<div style="opacity: 0; filter: alpha(opacity = 0)" id="mod_imageshowcase_divIdPrefix_161" class="mod_imageshowcase_div mod_imageshowcase_div_16">
<img id="mod_imageshowcase_imageIdPrefix_161" class="mod_imageshowcase_image" src="http://localhost/test//modules/mod_imageshowcase/testimages/beeheard-logo.png" title="" />
<br />
</div>
<div style="opacity: 0; filter: alpha(opacity = 0)" id="mod_imageshowcase_divIdPrefix_162" class="mod_imageshowcase_div mod_imageshowcase_div_16">
<img id="mod_imageshowcase_imageIdPrefix_162" class="mod_imageshowcase_image" src="http://localhost/test//modules/mod_imageshowcase/testimages/beeheardlite-logo.png" title="" />
<br />
</div>
<div style="opacity: 0; filter: alpha(opacity = 0)" id="mod_imageshowcase_divIdPrefix_163" class="mod_imageshowcase_div mod_imageshowcase_div_16">
<img id="mod_imageshowcase_imageIdPrefix_163" class="mod_imageshowcase_image" src="http://localhost/test//modules/mod_imageshowcase/testimages/cookiescrumbslogo3.png" title="" />
<br />
</div>
<div style="opacity: 0; filter: alpha(opacity = 0)" id="mod_imageshowcase_divIdPrefix_164" class="mod_imageshowcase_div mod_imageshowcase_div_16">
<img id="mod_imageshowcase_imageIdPrefix_164" class="mod_imageshowcase_image" src="http://localhost/test//modules/mod_imageshowcase/testimages/full_accesslevel-mid.jpg" title="" />
<br />
</div>
<div style="opacity: 0; filter: alpha(opacity = 0)" id="mod_imageshowcase_divIdPrefix_165" class="mod_imageshowcase_div mod_imageshowcase_div_16">
<img id="mod_imageshowcase_imageIdPrefix_165" class="mod_imageshowcase_image" src="http://localhost/test//modules/mod_imageshowcase/testimages/moo_menu_logo.jpg" title="" />
<br />
</div>
<div style="opacity: 0; filter: alpha(opacity = 0)" id="mod_imageshowcase_divIdPrefix_166" class="mod_imageshowcase_div mod_imageshowcase_div_16">
<img id="mod_imageshowcase_imageIdPrefix_166" class="mod_imageshowcase_image" src="http://localhost/test//modules/mod_imageshowcase/testimages/playlistgen_dropdown.jpg" title="" />
<br />
</div>
</div>
<script language="javascript" type="text/javascript">
var praiseShowStartImage_16 = 'first';
var praiseShowImageOrder_16 = 'forward';
var praiseShowPingPong_16 = 0;
var praiseShowImageCount_16 = 7;
var praiseShowFxs_16 = new Array();
var praiseShowCurrentImageIndex_16;
var praiseShowPlayCount_16 = 0;
var praiseShowCurrentPlayCount_16 = 0;
if(praiseShowStartImage_16 == 'random')
{
    praiseShowCurrentImageIndex_16 = Math.floor(Math.random()*praiseShowImageCount_16);
}
else if(praiseShowStartImage_16 == 'last_seen')
{
    praiseShowCurrentImageIndex_16 = Cookie.get('praiseShowLastIndex_16');
    if(!praiseShowCurrentImageIndex_16) { praiseShowCurrentImageIndex_16 = 0; }
}
else if(praiseShowImageOrder_16 == 'backward')
{
    praiseShowCurrentImageIndex_16 = praiseShowImageCount_16 - 1;
}
else
{
    praiseShowCurrentImageIndex_16 = 0;
}
window.addEvent('domready',function() {
});
window.addEvent('load',function() {
    var coords = $('mod_imageshowcase_containerTagId_16').getCoordinates();
    var elImage;
    var elImageCoords;
    $$('.mod_imageshowcase_div_16').each(function(el, i)
    {
        elImage = el.getElement('.mod_imageshowcase_image');
        elImageCoords = elImage.getCoordinates();
        elImage.setStyle('left', (coords.width/2 - elImageCoords.width/2) + 'px');
        elImage.setStyle('top', (coords.height/2 - elImageCoords.height/2) + 'px');
        if(i == praiseShowCurrentImageIndex_16) { el.setStyle('opacity', 1); }
        else { el.setStyle('opacity', 0); }
        praiseShowFxs_16[i] = new Fx.Style(el, 'opacity', {
            wait: false,
            duration: 1500,
            transition: Fx.Transitions.Quart.easeInOut
        });
    });
    switchImage_16.periodical(6500);
});
var switchImage_16 = function()
{
    var nextImageIndex = praiseShowCurrentImageIndex_16;
    switch(praiseShowImageOrder_16)
    {
        case 'random':
            while(nextImageIndex == praiseShowCurrentImageIndex_16 && praiseShowImageCount_16 > 0)
            {
                nextImageIndex = Math.floor(Math.random()*praiseShowImageCount_16);
            }
            break;
        case 'backward':
            nextImageIndex = praiseShowCurrentImageIndex_16 - 1;
            if(nextImageIndex < 0) {
                if(praiseShowPingPong_16) {
                    praiseShowImageOrder_16 = 'forward';
                    nextImageIndex = 1;
                    praiseShowCurrentPlayCount_16++;
                } else {
                    nextImageIndex = praiseShowImageCount_16 - 1;
                }
            }
            break;
        default:
            nextImageIndex = praiseShowCurrentImageIndex_16 + 1;
            if(nextImageIndex >= praiseShowImageCount_16) {
                if(praiseShowPingPong_16) {
                    praiseShowImageOrder_16 = 'backward';
                    nextImageIndex = praiseShowImageCount_16 - 2;
                    praiseShowCurrentPlayCount_16++;
                } else {
                    nextImageIndex = 0;
                }
            }
            break;
    }
    praiseShowCurrentPlayCount_16++;
    if(praiseShowPlayCount_16 == 0 || praiseShowCurrentPlayCount_16 < praiseShowPlayCount_16*praiseShowImageCount_16) {
        praiseShowFxs_16[praiseShowCurrentImageIndex_16].start(1, 0);
        praiseShowFxs_16[nextImageIndex].start(0, 1);
        praiseShowCurrentImageIndex_16 = nextImageIndex;
        Cookie.set('praiseShowLastIndex_16', praiseShowCurrentImageIndex_16);
    }
}
</script>


            </div>

            <div class="clr"></div>

            <div id="whitebox">
                <div id="whitebox_t">
                    <div id="whitebox_tl">
                        <div id="whitebox_tr"></div>
                    </div>
                </div>

                <div id="whitebox_m">
                    <div id="area">


                        <div id="leftcolumn">
                                                            <div class="module_menu">
            <div>
                <div>
                    <div>
                                                    <h3>Main Menu</h3>
                                            <ul class="menu"><li id="current" class="active item1"><a href="http://localhost/test/"><span>Home</span></a></li></ul>                 </div>
                </div>
            </div>
        </div>

                                                </div>

                                                <div id="maincolumn">

                            <table class="nopad">
                                <tr valign="top">
                                    <td>
                                        <div class="componentheading">
    Test</div>
<table class="blog" cellpadding="0" cellspacing="0">
<tr>
    <td valign="top">
                </td>
</tr>


</table>


                                    </td>
                                                                    </tr>
                            </table>

                        </div>
                        <div class="clr"></div>
                    </div>
                    <div class="clr"></div>
                </div>

                <div id="whitebox_b">
                    <div id="whitebox_bl">
                        <div id="whitebox_br"></div>
                    </div>
                </div>
            </div>

            <div id="footerspacer"></div>
        </div>

        <div id="footer">
            <div id="footer_l">
                <div id="footer_r">
                    <p id="syndicate">

                    </p>
                    <p id="power_by">
                        Powered by <a href="http://www.joomla.org">Joomla!</a>.
                        valid <a href="http://validator.w3.org/check/referer">XHTML</a> and <a href="http://jigsaw.w3.org/css-validator/check/referer">CSS</a>.
                    </p>
                </div>
            </div>
        </div>
    </div>
</div>


</body>

Только отрисованный скрипт:

<script language="javascript" type="text/javascript">
var praiseShowStartImage_16 = 'first';
var praiseShowImageOrder_16 = 'forward';
var praiseShowPingPong_16 = 0;
var praiseShowImageCount_16 = 7;
var praiseShowFxs_16 = new Array();
var praiseShowCurrentImageIndex_16;
var praiseShowPlayCount_16 = 0;
var praiseShowCurrentPlayCount_16 = 0;
if(praiseShowStartImage_16 == 'random')
{
    praiseShowCurrentImageIndex_16 = Math.floor(Math.random()*praiseShowImageCount_16);
}
else if(praiseShowStartImage_16 == 'last_seen')
{
    praiseShowCurrentImageIndex_16 = Cookie.get('praiseShowLastIndex_16');
    if(!praiseShowCurrentImageIndex_16) { praiseShowCurrentImageIndex_16 = 0; }
}
else if(praiseShowImageOrder_16 == 'backward')
{
    praiseShowCurrentImageIndex_16 = praiseShowImageCount_16 - 1;
}
else
{
    praiseShowCurrentImageIndex_16 = 0;
}
window.addEvent('domready',function() {
});
window.addEvent('load',function() {
    var coords = $('mod_imageshowcase_containerTagId_16').getCoordinates();
    var elImage;
    var elImageCoords;
    $$('.mod_imageshowcase_div_16').each(function(el, i)
    {
        elImage = el.getElement('.mod_imageshowcase_image');
        elImageCoords = elImage.getCoordinates();
        elImage.setStyle('left', (coords.width/2 - elImageCoords.width/2) + 'px');
        elImage.setStyle('top', (coords.height/2 - elImageCoords.height/2) + 'px');
        if(i == praiseShowCurrentImageIndex_16) { el.setStyle('opacity', 1); }
        else { el.setStyle('opacity', 0); }
        praiseShowFxs_16[i] = new Fx.Style(el, 'opacity', {
            wait: false,
            duration: 1500,
            transition: Fx.Transitions.Quart.easeInOut
        });
    });
    switchImage_16.periodical(6500);
});
var switchImage_16 = function()
{
    var nextImageIndex = praiseShowCurrentImageIndex_16;
    switch(praiseShowImageOrder_16)
    {
        case 'random':
            while(nextImageIndex == praiseShowCurrentImageIndex_16 && praiseShowImageCount_16 > 0)
            {
                nextImageIndex = Math.floor(Math.random()*praiseShowImageCount_16);
            }
            break;
        case 'backward':
            nextImageIndex = praiseShowCurrentImageIndex_16 - 1;
            if(nextImageIndex < 0) {
                if(praiseShowPingPong_16) {
                    praiseShowImageOrder_16 = 'forward';
                    nextImageIndex = 1;
                    praiseShowCurrentPlayCount_16++;
                } else {
                    nextImageIndex = praiseShowImageCount_16 - 1;
                }
            }
            break;
        default:
            nextImageIndex = praiseShowCurrentImageIndex_16 + 1;
            if(nextImageIndex >= praiseShowImageCount_16) {
                if(praiseShowPingPong_16) {
                    praiseShowImageOrder_16 = 'backward';
                    nextImageIndex = praiseShowImageCount_16 - 2;
                    praiseShowCurrentPlayCount_16++;
                } else {
                    nextImageIndex = 0;
                }
            }
            break;
    }
    praiseShowCurrentPlayCount_16++;
    if(praiseShowPlayCount_16 == 0 || praiseShowCurrentPlayCount_16 < praiseShowPlayCount_16*praiseShowImageCount_16) {
        praiseShowFxs_16[praiseShowCurrentImageIndex_16].start(1, 0);
        praiseShowFxs_16[nextImageIndex].start(0, 1);
        praiseShowCurrentImageIndex_16 = nextImageIndex;
        Cookie.set('praiseShowLastIndex_16', praiseShowCurrentImageIndex_16);
    }
}
</script>

Я полагаю, что он в настоящее время на Mootools v1.11.Спасибо.

Ответы [ 2 ]

4 голосов
/ 28 марта 2012

Хорошо. Первое, что бросается в глаза, это:

new Fx.Style(el, 'opacity', {
    wait: false,
    duration: 1500,
    transition: Fx.Transitions.Quart.easeInOut
});

Изменить на:

new Fx.Tween(el, {
    link: 'cancel',
    duration: 1500,
    transition: Fx.Transitions.Quart.easeInOut,
    property: 'opacity'
}).start(el.getStyle('opacity').toInt()?0:1);

Опубликовать результаты и любые ошибки в Firebug (или эквивалент);

UPDATE: На самом деле лучше, чем эта линия

el.getStyle('opacity').toInt()?0:1

будет также меняться:

if(i == praiseShowCurrentImageIndex_16) { el.setStyle('opacity', 1); }
        else { el.setStyle('opacity', 0); }

до

if(i == praiseShowCurrentImageIndex_16) {
    var targetOpacity = 1;
    el.setStyle('opacity', targetOpacity);
} else {
    var targetOpacity = 0;
    el.setStyle('opacity', targetOpacity);
}

вкл на проход функции запуска:

new Fx.Tween(el, {
    link: 'cancel',
    duration: 1500,
    transition: Fx.Transitions.Quart.easeInOut,
    property: 'opacity'
}).start(targetOpacity);

Обновлен PHP (простой тест top не может быть незначительными ошибками)

    echo 
        "<script language=\"javascript\" type=\"text/javascript\">\n".
        "var praiseShowStartImage_".$moduleInstanceId." = '".$startImage."';\n".
        "var praiseShowImageOrder_".$moduleInstanceId." = '".$imageOrder."';\n".
        "var praiseShowPingPong_".$moduleInstanceId." = ".$pingPong.";\n".
        "var praiseShowImageCount_".$moduleInstanceId." = ".$index.";\n".
        "var praiseShowFxs_".$moduleInstanceId." = new Array();\n".
        "var praiseShowCurrentImageIndex_".$moduleInstanceId.";\n".
        "var praiseShowPlayCount_".$moduleInstanceId." = ".$playCount.";\n".
        "var praiseShowCurrentPlayCount_".$moduleInstanceId." = 0;\n".
        "if(praiseShowStartImage_".$moduleInstanceId." == 'random')\n".
        "{\n".
        "   praiseShowCurrentImageIndex_".$moduleInstanceId." = Math.floor(Math.random()*praiseShowImageCount_".$moduleInstanceId.");\n".
        "}\n".
        "else if(praiseShowStartImage_".$moduleInstanceId." == 'last_seen')\n".
        "{\n".
        "   praiseShowCurrentImageIndex_".$moduleInstanceId." = Cookie.get('praiseShowLastIndex_".$moduleInstanceId."');\n".
        "   if(!praiseShowCurrentImageIndex_".$moduleInstanceId.") { praiseShowCurrentImageIndex_".$moduleInstanceId." = 0; }\n".
        "}\n".
    "else if(praiseShowImageOrder_".$moduleInstanceId." == 'backward')\n".
    "{\n".
    "   praiseShowCurrentImageIndex_".$moduleInstanceId." = praiseShowImageCount_".$moduleInstanceId." - 1;\n".
    "}\n".
    "else\n".
    "{\n".
    "   praiseShowCurrentImageIndex_".$moduleInstanceId." = 0;\n".
    "}\n".
    "window.addEvent('domready',function() {\n".
    $domreadyScript.
    "});\n".
    "window.addEvent('load',function() {\n".
    "   var coords = $('".$containerTagId."').getCoordinates();\n".
    "   var elImage;\n".
    "   var elImageCoords;\n".
    "   $$('.mod_imageshowcase_div_".$moduleInstanceId."').each(function(el, i)\n".
    "   {\n".
    "       elImage = el.getElement('.mod_imageshowcase_image');\n";

    if($imageScaleMode == "fit_both" || $imageScaleMode == "fit_height")
    {
    echo "          elImage.setStyle('height', coords.height + 'px');\n";
    }
    if($imageScaleMode == "fit_both" || $imageScaleMode == "fit_width")
    {
    echo "          elImage.setStyle('width', coords.width + 'px');\n";
    }

    if($imageScaleMode != "fit_both")
    {
    switch($imageVerticalAlign)
    {
    case "top":
    $jsVerticalAlignText = "0";
    break;
    case "center":
    $jsVerticalAlignText = "(coords.height/2 - elImageCoords.height/2)";
    break;
    case "bottom":
    default:
    $jsVerticalAlignText = "(coords.height - elImageCoords.height)";
    break;
    }
    switch($imageHorizontalAlign)
    {
    case "left":
    $jsHorizontalAlignText = "0";
    break;
    case "center":
    $jsHorizontalAlignText = "(coords.width/2 - elImageCoords.width/2)";
    break;
    case "right":
    default:
    $jsHorizontalAlignText = "(coords.width - elImageCoords.width)";
    break;
    }
    echo
    "       elImageCoords = elImage.getCoordinates();\n".
    "       elImage.setStyle('left', ".$jsHorizontalAlignText." + 'px');\n".
    "       elImage.setStyle('top', ".$jsVerticalAlignText." + 'px');\n";
    }
    echo 
    "       if(i == praiseShowCurrentImageIndex_".$moduleInstanceId.") { var targetOpacity = 1; el.setStyle('opacity', targetOpacity); }\n".
    "       else { var targetOpacity = 0; el.setStyle('opacity', targetOpacit); }\n".
    "       praiseShowFxs_".$moduleInstanceId."[i] = Fx.Tween(el, {\n".
    "           link: 'cancel',\n".
    "           duration: " . $transition_time . ",\n".
    "           transition: Fx.Transitions.Quart.easeInOut,\n".
    "           property: 'opacity'\n".
    "       }).start(targetOpacity);\n".
    "   });\n".
    "   switchImage_".$moduleInstanceId.".periodical(" . ($delay_time + $transition_time) . ");\n".
    "});\n".
    "var switchImage_".$moduleInstanceId." = function()\n".
    "{\n".
    "   var nextImageIndex = praiseShowCurrentImageIndex_".$moduleInstanceId.";\n".
    "   switch(praiseShowImageOrder_".$moduleInstanceId.")\n".
    "   {\n".
    "       case 'random':\n".
    "           while(nextImageIndex == praiseShowCurrentImageIndex_".$moduleInstanceId." && praiseShowImageCount_".$moduleInstanceId." > 0)\n".
    "           {\n".
    "               nextImageIndex = Math.floor(Math.random()*praiseShowImageCount_".$moduleInstanceId.");\n".
    "           }\n".
    "           break;\n".
    "       case 'backward':\n".
    "           nextImageIndex = praiseShowCurrentImageIndex_".$moduleInstanceId." - 1;\n".
    "           if(nextImageIndex < 0) {\n".
    "               if(praiseShowPingPong_".$moduleInstanceId.") {\n".
    "                   praiseShowImageOrder_".$moduleInstanceId." = 'forward';\n".
    "                   nextImageIndex = 1;\n".
    "                   praiseShowCurrentPlayCount_".$moduleInstanceId."++;\n".
    "               } else {\n".
    "                   nextImageIndex = praiseShowImageCount_".$moduleInstanceId." - 1;\n".
    "               }\n".
    "           }\n".
    "           break;\n".
    "       default:\n".
    "           nextImageIndex = praiseShowCurrentImageIndex_".$moduleInstanceId." + 1;\n".
    "           if(nextImageIndex >= praiseShowImageCount_".$moduleInstanceId.") {\n".
    "               if(praiseShowPingPong_".$moduleInstanceId.") {\n".
    "                   praiseShowImageOrder_".$moduleInstanceId." = 'backward';\n".
    "                   nextImageIndex = praiseShowImageCount_".$moduleInstanceId." - 2;\n".
    "                   praiseShowCurrentPlayCount_".$moduleInstanceId."++;\n".
    "               } else {\n".
    "                   nextImageIndex = 0;\n".
    "               }\n".
    "           }\n".
    "           break;\n".
    "   }\n".
    "   praiseShowCurrentPlayCount_".$moduleInstanceId."++;\n".
    "   if(praiseShowPlayCount_".$moduleInstanceId." == 0 || praiseShowCurrentPlayCount_".$moduleInstanceId." < praiseShowPlayCount_".$moduleInstanceId."*praiseShowImageCount_".$moduleInstanceId.") {\n".
    "       praiseShowFxs_".$moduleInstanceId."[praiseShowCurrentImageIndex_".$moduleInstanceId."].start(1, 0);\n".
    "       praiseShowFxs_".$moduleInstanceId."[nextImageIndex].start(0, 1);\n".
    "       praiseShowCurrentImageIndex_".$moduleInstanceId." = nextImageIndex;\n".
    "       Cookie.set('praiseShowLastIndex_".$moduleInstanceId."', praiseShowCurrentImageIndex_".$moduleInstanceId.");\n".
    "   }\n".
    "}\n".
    "</script>\n";
4 голосов
/ 27 марта 2012

Похоже, что Joomla 2.5 использует mooTools 1.4

Joomla 1.5 использует 1.12

Вы можете вручную обновить код mootools 1.12 до стандартов mootools 1.4.

В Интернете есть множество ресурсов, которые могут помочь вам в этом.

У вас есть ссылка на ваш код, который не работает?

Эта ссылка поможет вам перейти с 1.1 на 1.2 (на данный моментукажите, что вы можете скачать и использовать слой совместимости moo [не рекомендуется]): https://github.com/mootools/mootools-core/wiki/Conversion-from-1.11-to-1.2-

По этой ссылке вы перейдете с 1,2 на 1,3: https://github.com/mootools/mootools-core/wiki/Upgrade-from-1.2-to-1.3

На данный момент вы должны бытьВ хороших MooTools 1.4 добавлены основные улучшения, в частности, обновление движка селектора и делегирование событий (ранее встречалось только больше)

подробнее на: http://mootools.net/blog/2011/09/10/mootools-1-4-0/

Надеюсь, это поможет!

...