';
for(var i in theChampMoreSharingServices){
var tempTitle = theChampCapitaliseFirstLetter(theChampMoreSharingServices[i].title.replace(/[_. ]/g, ""));
theChampMoreSharingServicesHtml += '- ' + theChampMoreSharingServices[i].title + '
';
}
theChampMoreSharingServicesHtml += concate;
var mainDiv = document.createElement('div');
mainDiv.innerHTML = theChampMoreSharingServicesHtml;
mainDiv.setAttribute('id', 'the_champ_sharing_more_providers');
var bgDiv = document.createElement('div');
bgDiv.setAttribute('id', 'the_champ_popup_bg');
jQuery('body').append(mainDiv).append(bgDiv);
document.getElementById('the_champ_popup_bg').onclick = document.getElementById('the_champ_sharing_popup_close').onclick = function(){
mainDiv.parentNode.removeChild(mainDiv);
bgDiv.parentNode.removeChild(bgDiv);
}
}
if(typeof theChampHorizontalSharingCountEnable == 'undefined'){
var theChampHorizontalSharingCountEnable = 0;
}
if(typeof theChampVerticalSharingCountEnable == 'undefined'){
var theChampVerticalSharingCountEnable = 0;
}
if((typeof theChampSaveSharesLocally == 'undefined' || theChampSaveSharesLocally == 0) && (theChampHorizontalSharingCountEnable || theChampVerticalSharingCountEnable)){
// get sharing counts on window load
theChampLoadEvent(
function(){
// sharing counts
theChampCallAjax(function(){
theChampGetSharingCounts();
});
}
);
}
/**
* Search sharing services
*/
function theChampFilterSharing(val) {
jQuery('ul.mini li a').each(function(){
if (jQuery(this).text().toLowerCase().indexOf(val.toLowerCase()) != -1) {
jQuery(this).parent().css('display', 'block');
} else {
jQuery(this).parent().css('display', 'none');
}
});
};
var heateorSsFacebookTargetUrls = [];
/**
* Get sharing counts
*/
function theChampGetSharingCounts(){
var targetUrls = [];
jQuery('.the_champ_sharing_container').each(function(){
if(typeof jQuery(this).attr('super-socializer-no-counts') == 'undefined'){
var currentTargetUrl = jQuery(this).attr('super-socializer-data-href');
if(currentTargetUrl != null && jQuery.inArray(currentTargetUrl, heateorSsUrlCountFetched) == -1){
targetUrls.push(currentTargetUrl);
heateorSsUrlCountFetched.push(currentTargetUrl);
}
}
});
if(targetUrls.length == 0){
return;
}
jQuery.ajax({
type: 'GET',
dataType: 'json',
url: theChampSharingAjaxUrl,
data: {
action: 'the_champ_sharing_count',
urls: targetUrls,
},
success: function(data, textStatus, XMLHttpRequest){
if(data.status == 1){
if(data.facebook){
heateorSsFacebookTargetUrls = data.facebook_urls;
}
for(var i in data.message){
var sharingContainers = jQuery("div[super-socializer-data-href='"+i+"']");
jQuery(sharingContainers).each(function(){
var totalCount = 0;
for(var j in data.message[i]){
var sharingCount = parseInt(data.message[i][j]) || 0;
var targetElement = jQuery(this).find('.the_champ_'+j+'_count');
if(jQuery(targetElement).attr('ss_st_count')){
sharingCount = parseInt(sharingCount) + parseInt(jQuery(targetElement).attr('ss_st_count'));
}
totalCount += parseInt(sharingCount);
if(sharingCount < 1){ continue; }
jQuery(targetElement).html(theChampCalculateApproxCount(sharingCount)).css({'visibility': 'visible', 'display': 'block'});
if ( ( typeof theChampReduceHorizontalSvgWidth != 'undefined' && jQuery(this).hasClass('the_champ_horizontal_sharing') ) || ( typeof theChampReduceVerticalSvgWidth != 'undefined' && jQuery(this).hasClass('the_champ_vertical_sharing') ) ) {
jQuery(targetElement).parents('li').find('.theChampSharingSvg').css('float', 'left');
}
if ( ( typeof theChampReduceHorizontalSvgHeight != 'undefined' && jQuery(this).hasClass('the_champ_horizontal_sharing') ) || ( typeof theChampReduceVerticalSvgHeight != 'undefined' && jQuery(this).hasClass('the_champ_vertical_sharing') ) ) {
jQuery(targetElement).parents('li').find('.theChampSharingSvg').css('marginTop', '0');
}
}
var totalCountContainer = jQuery(this).find('.theChampTCBackground');
jQuery(totalCountContainer).each(function(){
var containerHeight = jQuery(this).css('height');
jQuery(this).html('' + theChampCalculateApproxCount(totalCount) + '
' + (totalCount == 0 || totalCount > 1 ? heateorSsSharesText : heateorSsShareText) + '
').css('visibility', 'visible');
});
});
}
if(heateorSsFacebookTargetUrls.length != 0){
theChampFetchFacebookShares(heateorSsFacebookTargetUrls);
}
}
}
});
}
function theChampFetchFacebookShares(targetUrls){
var loopCounter = 0;
for(var i in targetUrls){
for(var j in targetUrls[i]){
loopCounter++;
theChampFBShareJSONCall(targetUrls[i][j], loopCounter, targetUrls[0].length*targetUrls.length, targetUrls[0][j]);
}
}
}
function theChampFBShareJSONCall(targetUrl, loopCounter, targetUrlsLength, dataHref) {
jQuery.getJSON('//graph.facebook.com/?id=' + targetUrl, function(data){
if(data.share && data.share.share_count >= 0){
var sharingContainers = jQuery("div[super-socializer-data-href='"+dataHref+"']");
jQuery(sharingContainers).each(function(){
var targetElement = jQuery(this).find('.the_champ_facebook_count');
var facebookBackground = jQuery(this).find('i.theChampFacebookBackground');
var sharingCount = parseInt(data.share.share_count);
if(jQuery(targetElement).attr('ss_st_count') !== undefined){
sharingCount += parseInt(jQuery(targetElement).attr('ss_st_count'));
}
if(sharingCount > 0){
if(typeof jQuery(facebookBackground).attr('heateor-ss-fb-shares') == 'undefined'){
jQuery(targetElement).html(theChampCalculateApproxCount(sharingCount)).css({'visibility': 'visible', 'display': 'block'});
jQuery(facebookBackground).attr('heateor-ss-fb-shares', sharingCount);
}else if(typeof jQuery(facebookBackground).attr('heateor-ss-fb-shares') != 'undefined'){
var tempShareCount = parseInt(jQuery(facebookBackground).attr('heateor-ss-fb-shares'));
jQuery(facebookBackground).attr('heateor-ss-fb-shares', sharingCount + tempShareCount);
jQuery(targetElement).html(theChampCalculateApproxCount(sharingCount + tempShareCount));
}
if ( ( typeof theChampReduceHorizontalSvgWidth != 'undefined' && jQuery(this).hasClass('the_champ_horizontal_sharing') ) || ( typeof theChampReduceVerticalSvgWidth != 'undefined' && jQuery(this).hasClass('the_champ_vertical_sharing') ) ) {
jQuery(targetElement).parents('li').find('.theChampSharingSvg').css('float', 'left');
}
if ( ( typeof theChampReduceHorizontalSvgHeight != 'undefined' && jQuery(this).hasClass('the_champ_horizontal_sharing') ) || ( typeof theChampReduceVerticalSvgHeight != 'undefined' && jQuery(this).hasClass('the_champ_vertical_sharing') ) ) {
jQuery(targetElement).parents('li').find('.theChampSharingSvg').css('marginTop', '0');
}
var totalCountContainer = jQuery(this).find('.theChampTCBackground');
jQuery(totalCountContainer).each(function(){
var totalShareCountElem = jQuery(this).find('.theChampTotalShareCount');
var totalShareCount = jQuery(totalShareCountElem).text();
var newTotalCount = theChampCalculateActualCount(totalShareCount) + sharingCount;
jQuery(totalShareCountElem).text(theChampCalculateApproxCount(newTotalCount));
jQuery(this).find('.theChampTotalShareText').text(newTotalCount == 0 || newTotalCount > 1 ? heateorSsSharesText : heateorSsShareText);
});
}
});
}
if(loopCounter == targetUrlsLength){
setTimeout(function(){
var facebookShares = {};
for(var i in heateorSsFacebookTargetUrls[0]){
var sharingContainers = jQuery("div[super-socializer-data-href='"+heateorSsFacebookTargetUrls[0][i]+"']");
jQuery(sharingContainers).each(function(){
var facebookCountElement = jQuery(this).find('.the_champ_facebook_count');
var facebookCountElementBg = jQuery(this).find('i.theChampFacebookBackground');
var shareCountString = typeof jQuery(facebookCountElementBg).attr('heateor-ss-fb-shares') != 'undefined' ? jQuery(facebookCountElementBg).attr('heateor-ss-fb-shares').trim() : '';
if(shareCountString != ''){
var shareCount = parseInt(theChampCalculateActualCount(shareCountString));
if(jQuery(facebookCountElement).attr('ss_st_count') !== undefined){
var startingCount = parseInt(jQuery(facebookCountElement).attr('ss_st_count').trim());
shareCount = Math.abs(shareCount - startingCount);
}
facebookShares[heateorSsFacebookTargetUrls[0][i]] = shareCount;
return;
}
});
}
if(!jQuery.isEmptyObject(facebookShares)){
theChampSaveFacebookShares(facebookShares);
}
}, 1000);
}
});
}
function theChampSaveFacebookShares(facebookShares){
jQuery.ajax({
type: 'GET',
dataType: 'json',
url: theChampSharingAjaxUrl,
data: {
action: 'the_champ_save_facebook_shares',
share_counts: facebookShares,
},
success: function(data, textStatus, XMLHttpRequest){}
});
}
function theChampCalculateApproxCount(sharingCount){
// round to one decimal
if(sharingCount > 999 && sharingCount < 10000){
sharingCount = (Math.round(sharingCount/100))/10 + 'K';
}else if(sharingCount > 9999 && sharingCount < 100000){
sharingCount = (Math.round(sharingCount/100))/10 + 'K';
}else if(sharingCount > 99999 && sharingCount < 1000000){
sharingCount = (Math.round(sharingCount/100))/10 + 'K';
}else if(sharingCount > 999999){
sharingCount = (Math.round(sharingCount/100000))/10 + 'M';
}
return sharingCount;
}
function theChampCalculateActualCount(sharingCount){
if(sharingCount.indexOf('K') > 0){
sharingCount = sharingCount.replace('K', '') * 1000;
}else if(sharingCount.indexOf('M') > 0){
sharingCount = sharingCount.replace('M', '') * 1000000;
}
return parseInt(sharingCount);
}
function theChampCapitaliseFirstLetter(e) {
return e.charAt(0).toUpperCase() + e.slice(1)
}
jQuery(function(){
var heateorSsWhatsappJSAPI = heateorSsDetermineWhatsappShareAPI(false);
var classes = ['the_champ_vertical_sharing', 'the_champ_vertical_counter'];
for(var i = 0; i < classes.length; i++){
if(jQuery('.' + classes[i]).length){
jQuery('.' + classes[i]).each(function(){
var verticalSharingHtml = jQuery(this).html();
if(jQuery(this).attr('style').indexOf('right') >= 0){
var removeClass = 'theChampPushIn', margin = 'Right', alignment = 'right', addClass = 'theChampPullOut';
}else{
var removeClass = 'theChampPullOut', margin = 'Left', alignment = 'left', addClass = 'theChampPushIn';
}
jQuery(this).html(verticalSharingHtml + '');
});
}
}
if(theChampMobileStickySharingEnabled == 1){
if(jQuery('div.the_champ_vertical_sharing').length){
// insert div before
jQuery(document.body).append("");
}
}
var heateorSsClipboard = new ClipboardJS('.theChampCopyLinkBackground, .theChampCopyLinkShare, .theChampCopyLinkSvg', {
text: function(trigger) {
if(jQuery(trigger).hasClass('theChampCopyLinkShare')){
var element = trigger.parentElement.parentElement.parentElement.parentElement;
var url = jQuery(element).attr("data-href") || "";
}else if(jQuery(trigger).hasClass('theChampCopyLinkSvg')){
var element = trigger.parentElement.parentElement.parentElement.parentElement;
var url = jQuery(element).attr("super-socializer-data-href") || "";
if(jQuery(element).hasClass('the_champ_horizontal_sharing') && typeof heateorSsHorSharingShortUrl != undefined){
var url = heateorSsHorSharingShortUrl;
}else if(jQuery(element).hasClass('the_champ_vertical_sharing') && typeof heateorSsVerticalSharingShortUrl != undefined){
var url = heateorSsVerticalSharingShortUrl;
}
if(!url){
var element = trigger.parentElement.parentElement.parentElement.parentElement.parentElement.parentElement;
var url = jQuery(element).attr("data-href") || "";
}
}
return url;
}
});
heateorSsClipboard.on('success', function(e) {
alert(heateorSsCopyLinkMessage);
});
});
function theChampHideSharing(elem, removeClass, addClass, margin, alignment){
var animation = {}, counter = jQuery(elem).parent().hasClass('the_champ_vertical_counter'), offset = parseInt(jQuery(elem).parent().css('width')) + 10 - (counter ? 16 : 0);
var ssOffset = jQuery(elem).parent().attr('ss-offset');
if(ssOffset){
var savedOffset = parseInt(ssOffset);
}else{
var savedOffset = (counter ? theChampCounterOffset : theChampSharingOffset);
}
if(jQuery(elem).attr('title') == 'Hide'){
animation[alignment] = "-=" + (offset + savedOffset);
jQuery(elem).parent().animate(animation, 400, function(){
jQuery(elem).removeClass(removeClass).addClass(addClass).attr('title', 'Share');
if(counter){
var cssFloat = alignment == 'left' ? 'right' : 'left';
jQuery(elem).css('float', cssFloat);
}else{
jQuery(elem).css('margin' + margin, offset + 'px')
}
});
}else{
animation[alignment] = "+=" + (offset + savedOffset);
jQuery(elem).parent().animate(animation, 400, function(){
jQuery(elem).removeClass(addClass).addClass(removeClass).attr('title', 'Hide');
if(counter){
jQuery(elem).css('float', alignment);
}else{
jQuery(elem).css('margin' + margin, '0px');
}
});
}
}
/*!
* clipboard.js v2.0.6
* https://clipboardjs.com/
*
* Licensed MIT © Zeno Rocha
*/
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.ClipboardJS=e():t.ClipboardJS=e()}(this,function(){return o={},r.m=n=[function(t,e){t.exports=function(t){var e;if("SELECT"===t.nodeName)t.focus(),e=t.value;else if("INPUT"===t.nodeName||"TEXTAREA"===t.nodeName){var n=t.hasAttribute("readonly");n||t.setAttribute("readonly",""),t.select(),t.setSelectionRange(0,t.value.length),n||t.removeAttribute("readonly"),e=t.value}else{t.hasAttribute("contenteditable")&&t.focus();var o=window.getSelection(),r=document.createRange();r.selectNodeContents(t),o.removeAllRanges(),o.addRange(r),e=o.toString()}return e}},function(t,e){function n(){}n.prototype={on:function(t,e,n){var o=this.e||(this.e={});return(o[t]||(o[t]=[])).push({fn:e,ctx:n}),this},once:function(t,e,n){var o=this;function r(){o.off(t,r),e.apply(n,arguments)}return r._=e,this.on(t,r,n)},emit:function(t){for(var e=[].slice.call(arguments,1),n=((this.e||(this.e={}))[t]||[]).slice(),o=0,r=n.length;o