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
Line 
1$(function()
2{
3    if (typeof MRP_blockHeight === 'undefined')
4        return;
5
6    $('#imrp_ill0').width(MRP_blockHeight);
7    $('#imrp_ill0').height(MRP_blockHeight);
8
9    var randomPict = MRP_Opt['pictures'];
10    if (randomPict.length > 1 && $("#mbRandomPhoto").length > 0) 
11    {
12        $('#imrp_ill0 a').attr("href", randomPict[0]['link']);
13        $('#imrp_ill0 img').attr("src", randomPict[0]['thumb']);
14
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']);
20
21            var nextFaderPos = 1;
22            var duration = 400;
23            var pause = false;
24
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');
29
30            $('#imrp_ill0').hover(function() { pause = true; },function() { pause = false; });
31
32            function doRotate()
33            {
34                if ($('#imrp_ill0 img')[1].complete)
35                {
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                    }
48                }
49            }
50
51            var rotate = setInterval(doRotate, MRP_delay);
52        }
53    }
54});
Note: See TracBrowser for help on using the repository browser.