basti1012.bplaced.net

Du siehst gerade eine vereinfachte Darstellung unserer Inhalte. Normale Ansicht mit richtiger Formatierung.
    Lässt es im Browser auf jede Seite schneien

    Code

                                        
                                    // ==UserScript==
    // @name schnee everywhere 
    // @namespace by basti 1012
    // @include **
    // @noframes
    // @grant  GM_getValue
    // @grant  GM_setValue
    // @grant  GM_addStyle
    // @grant  GM_xmlhttpRequest
    // @version       1.0
    // run-at document-start
    // @require https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js
    // ==/UserScript==
    schneefall()
    function schneefall(){
        var windowHeight = $(window).height();
        var windowWidth = $(window).width();
        //$('#snowingScreen').css('height', windowHeight);
        //$('#snowingScreen').css('width', windowWidth);    
        function generateSnow() {
            for(i=0; i<4; i++){
     var snowTop = Math.floor(Math.random()* (windowHeight/2) );     
     var snowLeft = Math.floor(Math.random()* (windowWidth - 10) );    
                $("body").append(
                    $("<div />")
                        .addClass("snow")
                        .css("top", snowTop+"px")
                        .css("left", snowLeft+"px")
                                  .css("color","red")
                        .css("position","absolute")
                                      .css("z-index","1000")
                        .html("*")
                        .click(function() {
                            alert('You Clicked');
                        })
                );
            }
        }
         function snowFalling(){
              $(".snow").each(function(key, value){
          if( parseInt($(this).css("top") > windowHeight - 10 )) {
                  $(this).remove();
                 }        
               var fallingSpeed = Math.floor(Math.random() * 5 + 1);
              var movingDirection = Math.floor(Math.random()*2);
                var currentTop = parseInt($(this).css("top"));        
              var currentLeft = parseInt($(this).css("left"));                
          $(this).css("top", currentTop + fallingSpeed+"px");    
           if( movingDirection === 0){
                   $(this).css("left", currentLeft + fallingSpeed+"px");    
          }else {
     $(this).css("left", currentLeft+ -(fallingSpeed)+"px");
          }                              
         });    
         }
     aa1=window.setInterval(function(){snowFalling()}, 400); 
     aa2=window.setInterval(function(){generateSnow()}, 400);
    }