MediaWiki:Skin/Kamel:Ungott.js

aus Kamelopedia, der wüsten Enzyklopädie
Zur Navigation springen Zur Suche springen

Hinweis: Leere nach dem Speichern den Browser-Cache, um die Änderungen sehen zu können.

  • Firefox/Safari: Umschalttaste drücken und gleichzeitig Aktualisieren anklicken oder entweder Strg+F5 oder Strg+R (⌘+R auf dem Mac) drücken
  • Google Chrome: Umschalttaste+Strg+R (⌘+Umschalttaste+R auf dem Mac) drücken
  • Internet Explorer: Strg+F5 drücken oder Strg drücken und gleichzeitig Aktualisieren anklicken
  • Opera: Gehe zu Menü → Einstellungen (Opera → Einstellungen auf dem Mac) und dann auf Datenschutz & Sicherheit → Browserdaten löschen → Gespeicherte Bilder und Dateien.
var anz_bilder  = 20;
var anim_bilder = new Array();
var bild_info = [
    { "src": "http://kamelopedia.mormo.org/images/6/6c/BunchieViola.gif",    "width": 53,  "height": 66 }
]

for ( var i = 0; i < anz_bilder; i++ ){
    var size              = Math.random() * 2;
    var src               = Math.floor(Math.random() * bild_info.length);
    anim_bilder[i]        = new Image;
    anim_bilder[i].src    = bild_info[src].src;
    anim_bilder[i].width  = bild_info[src].width * size;
    anim_bilder[i].height = bild_info[src].height * size;    
}

$(function() {
    $('#content').css({'position': 'relative', 'overflow' : 'hidden'});
    $('#content').children().css({'position': 'relative' : 'z-index' : '2'});
    for ( var i = 0; i < anz_bilder; i++ ){
        $('#content').append(anim_bilder[i]);
        $('#content img').last().css({'position': 'absolute', 'z-index': '1'});
        var bottom = Math.round( ( ( $('#content').outerHeight() + anim_bilder[i].height ) * Math.random() ) - anim_bilder[i].height );
        var left   = Math.round( ( ( $('#content').outerWidth() + anim_bilder[i].width ) * Math.random() ) - anim_bilder[i].width );
        $('#content img').last().css('bottom', bottom + 'px');
        $('#content img').last().css('left', left + 'px');
        $('#content img').last().animate(
            { bottom: '+' + $('#content').outerHeight() }, {
            duration: Math.round(7000 * Math.random() + 7000) - bottom * 15,
            easing: 'linear',
            complete: function(){ resetimage($(this)); },
            queue: false }
        );
        swing($('#content img').last(), 
            $('#content img').last().width() / 8 + ($('#content img').last().width() / 8 * Math.random()),
            400 * Math.random() + 250);
    }
});

function resetimage(anim_bild) {
    var left   = ( ( $('#content').outerWidth() + anim_bilder[i].width ) * Math.random() ) - anim_bilder[i].width;
    anim_bild.css('left', left + 'px');   
    anim_bild.css('bottom', '-' + anim_bild.height() + 'px');
    anim_bild.animate(
        { bottom: '+' + $('#content').outerHeight() }, {
        duration: Math.round(7000 * Math.random() + 7000),
        easing: 'linear',
        complete: function(){ resetimage($(this)); },
        queue: false }
    );
}

function swing(anim_bild, amount,  duration) {
    anim_bild.animate(
        { marginLeft: amount }, {
        duration: duration,
        queue: false,
            complete: function(){ 
                $(this).animate(
                    { marginLeft: 0 }, {
                    duration: duration,
                    queue: false,
                    complete: function(){ swing($(this), amount, duration) }
                    }
                )
            }
        }
    );
}