// source --> https://collectablesmegastore.com/wp-content/plugins/wp-auto-affiliate-links/js/aalstats.js?ver=6.8.5 
jQuery(document).ready(function($) {



//Check URL button clicked
jQuery(".aalmanual").on('click', function() {
              
              
              var tip = 'manual';
				  var link =  jQuery(this).attr("href");
				  var keyword = jQuery(this).text();
				  var postid = aal_stats_ajax.postid;
				  var url = jQuery(location).attr('href');          
              
              	
              //alert(id);
              //aal_urlExists(id,url);
              // alert(url);
   				//aal_urlExists(url);
   				
						var data = {
							'action': 'aal_stats_save',
							'security': aal_stats_ajax.security,
							'tip': tip,
							'link': link,
							'keyword': keyword,
							'postid': postid,
							'url': url
						};
						
						
						
						jQuery.post(aal_stats_ajax.ajaxstatsurl, data, function(response) {
							//console.log('Got this from the server: ' + response);
							

						});   				  
					        
    


              
        }); 
        
});
// source --> https://collectablesmegastore.com/wp-content/plugins/wp-automatic/js/main-front.js?ver=1.0.1 
jQuery(document).ready(function(){
	
	var attrName = 'data-a-src' ;
	if(jQuery('.wp_automatic_gallery').attr('data-a-src') == undefined) attrName = 'src'; 
	
	var wp_automatic_main_scr = jQuery('.wp_automatic_gallery:first-child').attr(attrName);
	 
	jQuery('.wp_automatic_gallery:first-child').before('<div class="wp_automatic_gallery_wrap"><div style="background-image:url(\'' + wp_automatic_main_scr +'\')" class="wp_automatic_gallery_main" ></div><div class="clear"></div></div>');
	
	
	jQuery('.wp_automatic_gallery').each(function(){
		
		jQuery('.wp_automatic_gallery_wrap').append('<div class="wp_automatic_gallery_btn" style="background-image:url(\''+ jQuery(this).attr( attrName ) + '\')" ></div>');
		jQuery(this).remove();
	});
	
	//append inside the wp_automatic_gallery_wrap at the end a clear div and a br
	jQuery('.wp_automatic_gallery_wrap').append('<div style="clear:both"></div><br>');

	//remove duplicates by looping every wp_automatic_gallery_wrap and remove the duplicate wp_automatic_gallery_btn
	jQuery('.wp_automatic_gallery_wrap').each(function(){
		var seen = {};
		jQuery(this).find('.wp_automatic_gallery_btn').each(function() {
			var bg = jQuery(this).css('background-image');
			if (seen[bg]) {
				jQuery(this).remove();
			} else {
				seen[bg] = true;
			}
		});
	});

	//on click of any wp_automatic_gallery_btn change the background image of wp_automatic_gallery_main to the clicked one
	jQuery('.wp_automatic_gallery_btn').click(function(){
	  
	  jQuery('.wp_automatic_gallery_main').css('background-image', jQuery(this).css('background-image')  );
	  
	});

	
});