<commit_before>/* بسم الله الرحمن الرحیم
 * 
 * Mickey v0.1
 * LICENSE: MIT 
 * 
 * 
 */


Mickey = function( el ) {
	
	if( typeof el == 'string' ) return new Mickey.fn( document.querySelectorAll( el ) );
	
	el = el || document.body;
	
	return new Mickey.fn( [el] )
		
}

Mickey.forEach = function( target, fn ) {
  
  for( var i = 0, len = target.length; i < len; i++ ) {
    
    fn( target[i] );
    
  }
  
}


/* OPTIONS AVAILABLE:
 * blink :: cursor blinks with a delay
 * chase :: scrolls follow the mouse
 * timeout :: changing cursor after a delay
 * interval :: changing cursor after a delay ( repeated )
 * shadow :: adds shadow to your mouse
 * text :: adds a text following your mouse
 */


Mickey.fn = function( el ) {
	
	this.el = el;

}

Mickey.effect = function( pro, effect, el) {
  
  for( var x in Mickey.effects ) {
    
    if( x == pro ) {
      
      for( var y in Mickey.effects[x] ) {
        
        if( y == effect ) return Mickey.effects[x][y]( el )
        
      }
      return
    }
    
  }
  
}

Mickey.effects = {
  
  shadow: {},
  text  : {},
  image : {}
  
};

Mickey.effects.text.heartbeat = function( el ) {

  var
  i = parseInt( el.style.fontSize ) || 14;
  turn = 0;
  
  setInterval( function() {
    
    if( turn == 0 && i < 30 ) {
      el.style.fontSize = i + 'px';
      i++;
    }
    if( i == 30 ) turn = 1;
      
    if( turn == 1 && i > 11 ) {
      el.style.fontSize = i + 'px';
      i--;
    }
          
    if( i == 11 ) turn = 0;
                   
  }, 25 );

};




Mickey.fn.prototype = {
	
	chase : function() {
   
   

	 Mickey.forEach( this.el, function( target ) {
			
     target.addEventListener('mousemove', function( e ) {
  			
  			var
  			  top = Mickey.top,
  				left = Mickey.left,
  				topScrl = window.scrollY,
  				leftScrl = window.scrollX,
  				offsetWidth = target.offsetWidth,
  				offsetHeight = target.offsetHeight;
  			
  			window.scroll( ( left - leftScrl ) * ( offsetWidth / 700 ), ( top -  topScrl ) * ( offsetHeight / 700 ) ); // Works on almost every size, tested up to 40000px height & width
  						
  		});
  		
		});
		
		return new Mickey.fn( this.el )
	},
	
	blink : function( delay, cursor ) {
		
		
		
		Mickey.forEach( this.el, function(target) {
		  
			var turn = 0;
			
  		setInterval(function() {
  		  
  			if( turn == 0 ) {
  			  
  				target.style.cursor = 'none',
  				turn = 1;
  				
  			}
  			else {
  			  
  				target.style.cursor = cursor || 'default',
  				turn = 0;
  				
  			}
  		}, delay || 300);
  		
		});
		
		return new Mickey.fn( this.el )
	},
	
	timeout : function( cursor, delay, ret ) {
	 
	 
	 
    Mickey.forEach( this.el, function( target ) {
      
      var shift  = target.style.cursor;
      
      setTimeout(function() {
        
        target.style.cursor = cursor || 'pointer';
        
        if( ret ) setTimeout(function(){
          
            if( typeof ret == 'string' ) target.style.cursor = ret;
            
            else target.style.cursor = shift;
            
            }, delay)
        
      }, delay || 300);
      
    });
    
    return new Mickey.fn( this.el )
  },
	
	
	interval : function( from, to, delay ) { // Has same structure as blink
	  
	  
	  
    Mickey.forEach( this.el, function( target ) {
      
      turn = 0;
      
      setInterval(function() {
        
        if( turn == 0 ) {
          
          target.style.cursor = from,
          turn = 1;
          
        }
        else {
          
          target.style.cursor = to,
          turn = 0;
          
        }<commit_msg>Updated heartbeat effect<commit_after>/* بسم الله الرحمن الرحیم
 * 
 * Mickey v0.1
 * LICENSE: MIT 
 * 
 * 
 */


Mickey = function( el ) {
	
	if( typeof el == 'string' ) return new Mickey.fn( document.querySelectorAll( el ) );
	
	el = el || document.body;
	
	return new Mickey.fn( [el] )
		
}

Mickey.forEach = function( target, fn ) {
  
  for( var i = 0, len = target.length; i < len; i++ ) {
    
    fn( target[i] );
    
  }
  
}


/* OPTIONS AVAILABLE:
 * blink :: cursor blinks with a delay
 * chase :: scrolls follow the mouse
 * timeout :: changing cursor after a delay
 * interval :: changing cursor after a delay ( repeated )
 * shadow :: adds shadow to your mouse
 * text :: adds a text following your mouse
 */


Mickey.fn = function( el ) {
	
	this.el = el;

}

Mickey.effect = function( pro, effect, el) {
  
  for( var x in Mickey.effects ) {
    
    if( x == pro ) {
      
      for( var y in Mickey.effects[x] ) {
        
        if( y == effect ) return Mickey.effects[x][y]( el )
        
      }
      return
    }
    
  }
  
}

Mickey.effects = {
  
  shadow: {},
  text  : {},
  image : {}
  
};

Mickey.effects.text.heartbeat = function( el ) {

  var
  i = parseInt( el.style.fontSize ) || 14;
  turn = 0;
  
  setInterval( function() {
    
    if( turn == 0 && i < 25 ) {
      el.style.fontSize = i + 'px';
      i++;
    }
    if( i == 25 ) turn = 1;
      
    if( turn == 1 && i > 11 ) {
      el.style.fontSize = i + 'px';
      i--;
    }
          
    if( i == 11 ) turn = 0;
                   
  }, 30 );

};




Mickey.fn.prototype = {
	
	chase : function() {
   
   

	 Mickey.forEach( this.el, function( target ) {
			
     target.addEventListener('mousemove', function( e ) {
  			
  			var
  			  top = Mickey.top,
  				left = Mickey.left,
  				topScrl = window.scrollY,
  				leftScrl = window.scrollX,
  				offsetWidth = target.offsetWidth,
  				offsetHeight = target.offsetHeight;
  			
  			window.scroll( ( left - leftScrl ) * ( offsetWidth / 700 ), ( top -  topScrl ) * ( offsetHeight / 700 ) ); // Works on almost every size, tested up to 40000px height & width
  						
  		});
  		
		});
		
		return new Mickey.fn( this.el )
	},
	
	blink : function( delay, cursor ) {
		
		
		
		Mickey.forEach( this.el, function(target) {
		  
			var turn = 0;
			
  		setInterval(function() {
  		  
  			if( turn == 0 ) {
  			  
  				target.style.cursor = 'none',
  				turn = 1;
  				
  			}
  			else {
  			  
  				target.style.cursor = cursor || 'default',
  				turn = 0;
  				
  			}
  		}, delay || 300);
  		
		});
		
		return new Mickey.fn( this.el )
	},
	
	timeout : function( cursor, delay, ret ) {
	 
	 
	 
    Mickey.forEach( this.el, function( target ) {
      
      var shift  = target.style.cursor;
      
      setTimeout(function() {
        
        target.style.cursor = cursor || 'pointer';
        
        if( ret ) setTimeout(function(){
          
            if( typeof ret == 'string' ) target.style.cursor = ret;
            
            else target.style.cursor = shift;
            
            }, delay)
        
      }, delay || 300);
      
    });
    
    return new Mickey.fn( this.el )
  },
	
	
	interval : function( from, to, delay ) { // Has same structure as blink
	  
	  
	  
    Mickey.forEach( this.el, function( target ) {
      
      var turn = 0;
      
      setInterval(function() {
        
        if( turn == 0 ) {
          
          target.style.cursor = from,
          turn = 1;
          
        }
        else {
          
          target.style.cursor = to,
          turn = 0;
          
        }
{'fraction_non_alphanumeric': 0.1315022888056596, 'fraction_numerical': 0.012484394506866416, 'mean_word_length': 1.5, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6108221', 'n_tokens_mistral': 2773, 'n_tokens_neox': 2420, 'n_words': 599}