Your IP : 216.73.217.143


Current Path : /home/ereika83/public_html/wp-content/plugins/genesis-club-pro/scripts/
Upload File :
Current File : /home/ereika83/public_html/wp-content/plugins/genesis-club-pro/scripts/jquery.social.js

/*! SocialCount - v0.1.10 - 2015-01-29
* https://github.com/filamentgroup/SocialCount
* Copyright (c) 2015 zachleat; Licensed MIT */

;(function( win, doc, $ ) {

	var $loadingIndicator,
		$count,
		addedScripts = {};

	function featureTest( prop, unprefixedProp ) {
		var style = doc.createElement('social').style,
			prefixes = 'webkit Moz o ms'.split(' ');

		if( unprefixedProp in style ) {
			return true;
		}
		for( var j = 0, k = prefixes.length; j < k; j++ ) {
			if( ( prefixes[ j ] + prop ) in style ) {
				return true;
			}
		}
		return false;
	}

	function getDomain(url){
		var matches = url.match(/^https?\:\/\/([^\/?#]+)(?:[\/?#]|$)/i);
		var domain = matches && matches[1];  // domain will be null if no match is found	
		return domain;	
	}

	function removeFileName( src ) {
		var split = src.split( '/' );
		split.pop();
		split.pop();
		return split.join( '/' ) + '/';
	}

	function resolveServiceDir(url) {
		return GCPPURL.url +'/';		
	}

	var SocialCount = {
		// For A-grade experience, require querySelector (IE8+) and not BlackBerry or touchscreen
		isGradeA: 'querySelectorAll' in doc && !win.blackberry && !('ontouchstart' in window) &&
			// Note that this feature test does not account for the Windows Phone version that includes IE9
			// IE 10 desktop (non-touch) returns 0 for msMaxTouchPoints
			( typeof window.navigator.msMaxTouchPoints === 'undefined' || window.navigator.msMaxTouchPoints === 0 ),
		minCount: 1,
		serviceUrl: 'services/social-counts.php',
		mailtoUrl: 'scripts/mailto.html',
		initSelector: '.socialcount',
		classes: {
			js: 'js',
			gradeA: 'grade-a',
			loaded: 'loaded',
			hover: 'hover',
			noTransforms: 'no-transforms',
			showCounts: 'counts',
			countContainer: 'count',
			shareCount: 'shares',
			activateOnHover: 'activate-on-hover',
			activateOnClick: 'activate-on-click'
		},
		thousandCharacter: 'K',
		millionCharacter: 'M',
		missingResultText: '-',
		activateOnClick: false, // default is hover
		hoverDelay: 200, // in milliseconds
		selectors: {},
		locale: (function() {
			var locale = doc.documentElement ? ( doc.documentElement.lang || '' ) : '';
			locale = locale.replace(/\-/, '_');
			return locale.match(/\w{2}_\w{2}/) ? locale : '';
		})(),
		extraHoverTargets: 'table.gc-bubbleDefault', // google plus share bubble
		scriptSrcRegex: /jquery.social.js/i,
		email: '',
		plugins: {
			init: [],
			bind: []
		},

		// private, but for testing
		cache: {},

		removeFileName: removeFileName,
		resolveServiceDir: resolveServiceDir,

		isCssAnimations: function() {
			return featureTest( 'AnimationName', 'animationName' );
		},
		isCssTransforms: function() {
			return featureTest( 'Transform', 'transform' );
		},
		getMailUrl: function( $el ) {
			return resolveServiceDir() + SocialCount.mailtoUrl;
		},
		getUrl: function( $el ) {
			return $el.attr('data-url') || location.href;
		},
		// Currently only available on Twitter
		getShareText: function( $el ) {
			return $el.attr('data-share-text' ) || '';
		},
		getDescription: function( $el ) {
			return $el.attr('data-description' ) || '';
		},
		getMedia: function( $el ) {
			return $el.attr('data-media' ) || '';
		},		
		getEmail: function( $el ) {
			return $el.attr('data-email' ) || '';
		},
		getTwitter: function( $el ) {
			return $el.attr('data-twitter' ) || '';
		},
		isCountsEnabled: function( $el ) {
			return $el.attr('data-counts') === 'true';
		},
		isSmallSize: function( $el ) {
			return $el.is( '.socialcount-small' );
		},
		getCounts: function( $el, url ) {
			var map = SocialCount.selectors,
				cache = SocialCount.cache,
				counts = {},
				$networkNode,
				$countNode,
				j;

			for( j in map ) {
				$networkNode = $el.find( map[ j ] );
				if ($networkNode.length) {
					$countNode = $networkNode.find( '.' + SocialCount.classes.countContainer );

					if( $countNode.length ) {
						counts[ j ] = $countNode;
					} else {
						counts[ j ] = $count.clone();
						$networkNode.append( counts[ j ] );
					}
				}
			}

			if( !cache[ url ] ) {		
				cache[ url ] = $.ajax({
					url: resolveServiceDir() + SocialCount.serviceUrl,
					data: {
						url: url
					},
					dataType: 'json'
				});
			}
			cache[ url ].done( function complete( data ) {
				var showEachCount = ! $el.parent().hasClass('counter-none');
				var total = 0; //not all social channels are displayed so need to calculate total including local clicks not included in cached results 
				for( var j in data ) {
					if( data.hasOwnProperty( j ) && counts[ j ] ) {
						var likecount = $.isNumeric(data [ j ]) ? data [ j ] : 0 ;
  						var value = "; " + document.cookie;
  						var parts = value.split("; genesis_club_share_"+j+"=");
  						if (parts.length == 2) likecount++;	/* add 1 if user has just shared it but we have cached result */
						counts [j ].attr('data-count', likecount );
						if ( j == 'total') {
							display = total;
						} else {
							display = showEachCount ? likecount : 0; 
							total += likecount;
						}
						if ( display >= SocialCount.minCount)						
							counts[ j ].addClass( SocialCount.classes.shareCount ).removeClass( SocialCount.classes.countContainer ).html( SocialCount.normalizeCount( display) );
					}
				}
			});

			return cache[ url ];
		},
		load: function( $el ) {
			$el.find( "a" )
				.filter( ".socialcount li a" )
				.trigger( SocialCount.activateOnClick ? 'click' : 'mouseover' )
				.trigger( "mouseleave" );
		},
		init: function( $el ) {
			var classes = [],
				isSmall = SocialCount.isSmallSize( $el ),
				url = SocialCount.getUrl( $el ),
				initPlugins = SocialCount.plugins.init,
				countsEnabled = SocialCount.isCountsEnabled( $el );

			classes.push( SocialCount.classes.js );

			if( SocialCount.isGradeA ) {
				classes.push( SocialCount.classes.gradeA );
			}
			if( !SocialCount.isCssTransforms() ) {
				classes.push( SocialCount.classes.noTransforms );
			}
			if( countsEnabled ) {
				classes.push( SocialCount.classes.showCounts );
			}
			if( SocialCount.activateOnClick ) {
				classes.push( SocialCount.classes.activateOnClick );
			} else {
				classes.push( SocialCount.classes.activateOnHover );
			}
			if( SocialCount.locale ) {
				classes.push( SocialCount.locale );
			}
			$el.addClass( classes.join(' ') );

			for( var j = 0, k = initPlugins.length; j < k; j++ ) {
				initPlugins[ j ].call( $el );
			}

			if( SocialCount.isGradeA ) {
				SocialCount.bindEvents( $el, url, isSmall );
			}

			if( countsEnabled && !isSmall ) {
				SocialCount.getCounts( $el, url );
			}
		},
		normalizeCount: function( count ) {
			if( !count && count !== 0 ) {
				return SocialCount.missingResultText;
			}
			function getRounded( num ) {
				return ( num ).toFixed( 1 ).replace( /\.0/, '' );
			}
			// > 1M
			if( count >= 1000000 ) {
				return getRounded( count / 1000000 ) + SocialCount.millionCharacter;
			} else if( count >= 100000 ) { // > 100K
				return Math.floor( count / 1000 ) + SocialCount.thousandCharacter;
			} else if( count > 1000 ) {
				return getRounded( count / 1000 ) + SocialCount.thousandCharacter;
			}
			return count;
		},
		bindEvents: function( $el, url, isSmall ) {
			function bind( $a, sn, callback ) {
				// IE bug (tested up to version 9) with :hover rules and iframes.
				var isTooltipActive = false,
					isHoverActive = false,
					delayHoverTimer;

				$a.closest( 'li' ).bind( 'mouseenter', function() {
					var $li = $( this ).closest( 'li' );

					$li.addClass( SocialCount.classes.hover );

					if( SocialCount.activateOnClick ) {
						return;
					}
					isHoverActive = true;

					$( document ).on( 'mouseenter.socialcount mouseleave.socialcount', SocialCount.extraHoverTargets, function( event ) {
						isTooltipActive = event.type === 'mouseenter';

						if( !isTooltipActive && !isHoverActive ) {
							$li.removeClass( SocialCount.classes.hover );
						}
					});
				}).bind( 'mouseleave', function() {
					var self = this;
					window.clearTimeout( delayHoverTimer );

					if( SocialCount.activateOnClick ) {
						return;
					}

					window.setTimeout(function() {
						isHoverActive = false;

						if( !isTooltipActive && !isHoverActive ) {
							$( document ).off( '.socialcount' );
							$( self ).closest( 'li' ).removeClass( SocialCount.classes.hover );
						}
					}, 0);
				});

				$a.bind(  'click.socialcount', function( event ) {
					var $self = $( this );
					if( event.type === "click" ) {
							event.preventDefault();
							event.stopPropagation();
							var now = new Date();
							var time = now.getTime();
							time += 3600 * 1000;
							now.setTime(time);
							document.cookie = "genesis_club_share_"+sn+"=1; expires=" + now.toUTCString() + "; path="+ window.location.pathname +";"
							if (callback) callback( $a );
					}
				});
			} // end bind()

			if( !isSmall ) {
				var bindPlugins = SocialCount.plugins.bind;
				for( var j = 0, k = bindPlugins.length; j < k; j++ ) {
					bindPlugins[ j ].call( $el, bind, url, isSmall );
				}
			}
		} // end bindEvents()
	};

	$(function() {
		// Thanks to http://codepen.io/ericmatthys/pen/FfcEL
		$loadingIndicator = $('<div>')
			.addClass('loading')
			.html( SocialCount.isCssAnimations() ? new Array(4).join('<div class="dot"></div>') : 'Loading' );

		$count = $('<span>')
			.addClass( SocialCount.classes.countContent )
			.html('&#160;');

		$( SocialCount.initSelector ).each(function() {
			var $el = $(this);
			SocialCount.init($el);
		});
	});

	window.SocialCount = SocialCount;

}( window, window.document, jQuery ));

(function( $, SocialCount ) {

  SocialCount.selectors.facebook = '.facebook';

  SocialCount.plugins.bind.push(function(bind, url) {
    var $el = this,
      url = SocialCount.getUrl( $el ),
      text = SocialCount.getShareText( $el ),
      desc = SocialCount.getDescription( $el );
    bind( $el.find( SocialCount.selectors.facebook + ' a' ),  'facebook',
      function( el ) {
 			window.open('https://www.facebook.com/sharer/sharer.php?s=100&u='+encodeURIComponent(url)+'&p[title]='+decodeURIComponent(text)+'&p[summary]='+decodeURIComponent(desc), 
 				'facebook', 'toolbar=0,status=0,width=626,height=436');
      });
  });

})( jQuery, window.SocialCount );



(function( $, SocialCount ) {

  SocialCount.selectors.twitter = '.twitter';

  SocialCount.plugins.bind.push(function(bind, url) {
    var $el = this,
      url = SocialCount.getUrl( $el ),
      twitter = SocialCount.getTwitter( $el );
      text = SocialCount.getShareText( $el );

    bind( $el.find( SocialCount.selectors.twitter + ' a' ),  'twitter',
      function( el ) {
 			window.open('https://twitter.com/intent/tweet?url='+encodeURIComponent(url)+'&text='+encodeURIComponent(text)+'&via='+encodeURIComponent(twitter), 
 				'twitter', 'toolbar=0,status=0,width=626,height=436');
      });
  });

})( jQuery, window.SocialCount );



(function( $, SocialCount ) {

  SocialCount.selectors.plusone = '.plusone';

  SocialCount.plugins.bind.push(function(bind, url) {
    var $el = this,
      url = SocialCount.getUrl( $el ),
      text = SocialCount.getShareText( $el );
    bind( $el.find( SocialCount.selectors.plusone + ' a' ),  'plusone',
      function( el ) {
 			window.open('https://plus.google.com/share?url='+encodeURIComponent(url)+'&t='+encodeURIComponent(text), 'googleplus', 'toolbar=0,status=0,width=626,height=436');
      });
  });

})( jQuery, window.SocialCount );



(function( $, SocialCount ) {

  SocialCount.selectors.pinterest = '.pinterest';

  SocialCount.plugins.bind.push(function(bind, url) {
    var $el = this,      
      url = SocialCount.getUrl( $el ),
      text = SocialCount.getShareText( $el ),
      desc = SocialCount.getDescription($el),
      media = SocialCount.getMedia($el);

    bind( $el.find( SocialCount.selectors.pinterest ),  'pinterest',
      function( el ) {
 			window.open('https://www.pinterest.com/pin/create/button/?url='+encodeURIComponent(url)+'&description='+encodeURIComponent(desc), 
 				'pinterest', 'toolbar=0,status=0,width=626,height=436');
      });
  });

})( jQuery, window.SocialCount );


(function( $, SocialCount ) {

  SocialCount.selectors.buffer = '.buffer';

  SocialCount.plugins.bind.push(function(bind, url) {
    var $el = this,
      url = SocialCount.getUrl( $el ),    
      text = SocialCount.getShareText( $el );
	 var btn = 'horizontal';

    bind( $el.find( SocialCount.selectors.buffer + ' a' ), 'buffer',
      function( el ) {
 			window.open('https://bufferapp.com/add?url='+encodeURIComponent(url)+'&title='+encodeURIComponent(text), 
 				'buffer', 'toolbar=0,status=0,width=626,height=436');
      });
  });
 })( jQuery, window.SocialCount );

  
 (function( $, SocialCount ) {

  SocialCount.selectors.linkedin = '.linkedin';

  SocialCount.plugins.bind.push(function(bind, url) {
    var $el = this,
      url = SocialCount.getUrl( $el ),       
      text = SocialCount.getShareText( $el ),
      desc = SocialCount.getDescription( $el );


    bind( $el.find( SocialCount.selectors.linkedin + ' a' ), 'linkedin',
      function( el ) {
 			window.open('https://www.linkedin.com/shareArticle?mini=true&url='+encodeURIComponent(url)+'&title='+encodeURIComponent(text)+'&summary='+encodeURIComponent(desc), 
 				'linkedin', 'toolbar=0,status=0,width=626,height=436');
      });
  });
})( jQuery, window.SocialCount );   


(function( $, SocialCount ) {

  SocialCount.selectors.stumbleupon = '.stumbleupon';

  SocialCount.plugins.bind.push(function(bind, url) {
    var $el = this,
      url = SocialCount.getUrl( $el ),       
      text = SocialCount.getShareText( $el );

    bind( $el.find( SocialCount.selectors.stumbleupon + ' a' ), 'stumbleupon',
      function( el ) {
 			window.open('https://www.stumbleupon.com/badge/?url='+encodeURIComponent(url)+'&title='+encodeURIComponent(text), 
 				'stumbleupon', 'toolbar=0,status=0,width=626,height=436');
      });
  });
})( jQuery, window.SocialCount );


(function( $, SocialCount ) {

  SocialCount.selectors.email = '.email';

  SocialCount.plugins.bind.push(function(bind, url) {
    var $el = this,
    url = SocialCount.getMailUrl( $el ),
    text = SocialCount.getShareText( $el ), 
    desc = SocialCount.getDescription( $el ) ,     
    email = SocialCount.getEmail( $el );
    bind( $el.find( SocialCount.selectors.email + ' a' ), 'email',
 		function() {
  			window.open(url+'?mailto='+encodeURIComponent(email)+'&amp;subject='+encodeURIComponent(text)+'&amp;body='+encodeURIComponent(desc), 
  				'email', 'toolbar=0,status=0,width=500,height=500');
  			return false;
		}
	);
  });
})( jQuery, window.SocialCount );


(function( $, SocialCount ) {

  SocialCount.selectors.print = '.print';

  SocialCount.plugins.bind.push(function(bind, url) {
    var $el = this;
    bind( $el.find( SocialCount.selectors.print + ' a' ), 'print',
 		function() {
			window.print();
			return false;
		});
  });
})( jQuery, window.SocialCount );


(function( $, SocialCount ) {

  SocialCount.selectors.total = '.total';

 })( jQuery, window.SocialCount );