Ignore:
Timestamp:
Oct 2, 2017, 8:51:54 PM (6 years ago)
Author:
romanf
Message:

Copy/Paste Error

File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/MenuRandomPhoto/mrp.js

    r31893 r31894  
    1313        $('#imrp_ill0 img').attr("src", randomPict[0]['thumb']);
    1414
    15         var randomPict = MRP_Opt['pictures'];
    16         if (randomPict.length > 1)
     15        var nextFaderPos = 1;
     16        var duration = 400;
     17        var pause = false;
     18
     19        $('#imrp_ill0 img').after('<img id="irmbRPicImg">');
     20        $('#imrp_ill0 img').eq(1).hide();
     21        $('#imrp_ill0 img')[1].src = randomPict[1]['thumb'];
     22        $('#imrp_ill0 img').css('position', 'absolute');
     23
     24        $('#imrp_ill0').hover(function() { pause = true; },function() { pause = false; });
     25
     26        function doRotate()
    1727        {
    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()
     28            if ($('#imrp_ill0 img')[1].complete)
    3329            {
    34                 if ($('#imrp_ill0 img')[1].complete)
     30                if(!pause)
    3531                {
    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                     }
     32                    $('#imrp_ill0 img').first().fadeOut(duration, function() {
     33                        nextFaderPos = (nextFaderPos + 1) % randomPict.length;
     34                        $('#imrp_ill0 img')[1].src = randomPict[nextFaderPos]['thumb'];
     35                        });
     36                    $('#imrp_ill0 img').first().insertAfter($('#imrp_ill0 img').eq(1)); // swap
     37                    $('#imrp_ill0 img').first().fadeIn(duration);
     38                    setTimeout(function() {
     39                        $('#imrp_ill0 a').attr("href", randomPict[nextFaderPos]['link']);
     40                        }, duration/3);
    4841                }
    4942            }
     43        }
    5044
    51             var rotate = setInterval(doRotate, MRP_delay);
    52         }
     45        var rotate = setInterval(doRotate, MRP_delay);
    5346    }
    5447});
Note: See TracChangeset for help on using the changeset viewer.