source: extensions/MenuRandomPhoto/mrp.js @ 31893

Last change on this file since 31893 was 31893, checked in by romanf, 7 years ago

Merge-Error

  • Property svn:executable set to *
File size: 2.0 KB
RevLine 
[31892]1$(function()
2{
3    if (typeof MRP_blockHeight === 'undefined')
4        return;
[31780]5
[31892]6    $('#imrp_ill0').width(MRP_blockHeight);
7    $('#imrp_ill0').height(MRP_blockHeight);
[31780]8
[31892]9    var randomPict = MRP_Opt['pictures'];
[31893]10    if (randomPict.length > 1 && $("#mbRandomPhoto").length > 0) 
[31892]11    {
12        $('#imrp_ill0 a').attr("href", randomPict[0]['link']);
13        $('#imrp_ill0 img').attr("src", randomPict[0]['thumb']);
[31780]14
[31893]15        var randomPict = MRP_Opt['pictures'];
16        if (randomPict.length > 1)
17        {
18            $('#imrp_ill0 a').attr("href", randomPict[0]['link']);
19            $('#imrp_ill0 img').attr("src", randomPict[0]['thumb']);
[31780]20
[31893]21            var nextFaderPos = 1;
22            var duration = 400;
23            var pause = false;
[31780]24
[31893]25            $('#imrp_ill0 img').after('<img id="irmbRPicImg">');
26            $('#imrp_ill0 img').eq(1).hide();
27            $('#imrp_ill0 img')[1].src = randomPict[1]['thumb'];
28            $('#imrp_ill0 img').css('position', 'absolute');
[31892]29
[31893]30            $('#imrp_ill0').hover(function() { pause = true; },function() { pause = false; });
31
32            function doRotate()
[31892]33            {
[31893]34                if ($('#imrp_ill0 img')[1].complete)
[31892]35                {
[31893]36                    if(!pause)
37                    {
38                        $('#imrp_ill0 img').first().fadeOut(duration, function() {
39                            nextFaderPos = (nextFaderPos + 1) % randomPict.length;
40                            $('#imrp_ill0 img')[1].src = randomPict[nextFaderPos]['thumb'];
41                            });
42                        $('#imrp_ill0 img').first().insertAfter($('#imrp_ill0 img').eq(1)); // swap
43                        $('#imrp_ill0 img').first().fadeIn(duration);
44                        setTimeout(function() {
45                            $('#imrp_ill0 a').attr("href", randomPict[nextFaderPos]['link']);
46                            }, duration/3);
47                    }
[31892]48                }
49            }
[31893]50
51            var rotate = setInterval(doRotate, MRP_delay);
[31780]52        }
53    }
54});
Note: See TracBrowser for help on using the repository browser.