.attr(‘id’, ‘facebook-jssdk’)
.attr(‘async’, ‘true’)
.attr(‘defer’, ‘true’)
.attr(‘src’, ‘https://connect.facebook.net/en_US/sdk.js#xfbml=1&version=v11.0‘)
.appendTo(‘body’);
}
};
/**
* @param includeWidget {boolean} If true WhatsApp's own button widget is loaded, custom button otherwise
*/
var _initWhatsAppButton = function (includeWidget) {
// configure WhatsApp button
var buttonDom = $.parseHTML(includeWidget ? _BUTTON_TEMPLATES.whatsAppWidget : _BUTTON_TEMPLATES.whatsApp);
_$portlet.append(buttonDom);
};
/**
* @param includeWidget {boolean} If true Email's own button widget is loaded, custom button otherwise
*/
var _initEmailButton = function (includeWidget) {
// configure Email button
var buttonDom = $.parseHTML(includeWidget ? _BUTTON_TEMPLATES.emailWidget : _BUTTON_TEMPLATES.email);
_$portlet.append(buttonDom);
};
/**
* @param includeWidget {boolean} If true Pinterest's own button widget is loaded, custom button otherwise
*/
var _initPinterestButton = function (includeWidget) {
// configure Pinterest button
var buttonDom = $.parseHTML(includeWidget ? _BUTTON_TEMPLATES.pinterestWidget : _BUTTON_TEMPLATES.pinterest);
_$portlet.append(buttonDom);
};
/**
* @param includeWidget {boolean} If true Reddit's own button widget is loaded, custom button otherwise
*/
var _initRedditButton = function (includeWidget) {
// configure Reddit button
var buttonDom = $.parseHTML(includeWidget ? _BUTTON_TEMPLATES.redditWidget : _BUTTON_TEMPLATES.reddit);
_$portlet.append(buttonDom);
};
/**
* @param includeWidget {boolean} If true Tumblr's own button widget is loaded, custom button otherwise
*/
var _initTumblrButton = function (includeWidget) {
// configure Tumblr button
var buttonDom = $.parseHTML(includeWidget ? _BUTTON_TEMPLATES.tumblrWidget : _BUTTON_TEMPLATES.tumblr);
_$portlet.append(buttonDom);
};
/**
* @param includeWidget {boolean} If true Pocket's own button widget is loaded, custom button otherwise
*/
var _initPocketButton = function (includeWidget) {
// configure Pocket button
var buttonDom = $.parseHTML(includeWidget ? _BUTTON_TEMPLATES.pocketWidget : _BUTTON_TEMPLATES.pocket);
_$portlet.append(buttonDom);
};
/**
* @param includeWidget {boolean} If true Telegram's own button widget is loaded, custom button otherwise
*/
var _initTelegramButton = function (includeWidget) {
// configure Telegram button
var buttonDom = $.parseHTML(includeWidget ? _BUTTON_TEMPLATES.telegramWidget : _BUTTON_TEMPLATES.telegram);
_$portlet.append(buttonDom);
};
/**
* @param includeWidget {boolean} If true Hacker News's own button widget is loaded, custom button otherwise
*/
var _initHackerNewsButton = function (includeWidget) {
// configure Hacker News button
var buttonDom = $.parseHTML(includeWidget ? _BUTTON_TEMPLATES.hackerNewsWidget : _BUTTON_TEMPLATES.hackerNews);
_$portlet.append(buttonDom);
};
/**
* @param includeWidget {boolean} If true VKontakte's own button widget is loaded, custom button otherwise
*/
var _initVKontakteButton = function (includeWidget) {
// configure VKontakte button
var buttonDom = $.parseHTML(includeWidget ? _BUTTON_TEMPLATES.vkontakteWidget : _BUTTON_TEMPLATES.vkontakte);
_$portlet.append(buttonDom);
};
/**
* @param includeWidget {boolean} If true XING's own button widget is loaded, custom button otherwise
*/
var _initXINGButton = function (includeWidget) {
// configure XING button
var buttonDom = $.parseHTML(includeWidget ? _BUTTON_TEMPLATES.xingWidget : _BUTTON_TEMPLATES.xing);
_$portlet.append(buttonDom);
};
/**
* @param includeWidget {boolean} If true Renren's own button widget is loaded, custom button otherwise
*/
var _initRenrenButton = function (includeWidget) {
// configure Renren button
var buttonDom = $.parseHTML(includeWidget ? _BUTTON_TEMPLATES.renrenWidget : _BUTTON_TEMPLATES.renren);
_$portlet.append(buttonDom);
};
/**
* @param includeWidget {boolean} If true Weibo's own button widget is loaded, custom button otherwise
*/
var _initWeiboButton = function (includeWidget) {
// configure Weibo button
var buttonDom = $.parseHTML(includeWidget ? _BUTTON_TEMPLATES.weiboWidget : _BUTTON_TEMPLATES.weibo);
_$portlet.append(buttonDom);
};
/**
* @param includeWidget {boolean} If true Line's own button widget is loaded, custom button otherwise
*/
var _initLineButton = function (includeWidget) {
// configure Line button
var buttonDom = $.parseHTML(includeWidget ? _BUTTON_TEMPLATES.lineWidget : _BUTTON_TEMPLATES.line);
_$portlet.append(buttonDom);
};
/**
* @param includeWidget {boolean} If true Viber's own button widget is loaded, custom button otherwise
*/
var _initViberButton = function (includeWidget) {
// configure Viber button
var buttonDom = $.parseHTML(includeWidget ? _BUTTON_TEMPLATES.viberWidget : _BUTTON_TEMPLATES.viber);
_$portlet.append(buttonDom);
};
/**
* @param includeWidget {boolean} If true Print's own button widget is loaded, custom button otherwise
*/
var _initPrintButton = function (includeWidget) {
// configure Print button
var buttonDom = $.parseHTML(includeWidget ? _BUTTON_TEMPLATES.printWidget : _BUTTON_TEMPLATES.print);
_$portlet.append(buttonDom);
};
/**
* @param includeWidget {boolean} If true Copy Link's own button widget is loaded, custom button otherwise
*/
var _initCopyLinkButton = function (includeWidget) {
// configure Copy Link button
var buttonDom = $.parseHTML(includeWidget ? _BUTTON_TEMPLATES.copyLinkWidget : _BUTTON_TEMPLATES.copyLink);
_$portlet.append(buttonDom);
};
/**
* @param includeWidget {boolean} If true More's own button widget is loaded, custom button otherwise
*/
var _initMoreButton = function (includeWidget) {
// configure More button
var buttonDom = $.parseHTML(includeWidget ? _BUTTON_TEMPLATES.moreWidget : _BUTTON_TEMPLATES.more);
_$portlet.append(buttonDom);
};
/**
* Initialize the social sharing buttons based on the configuration
*/
var init = function () {
// check if the container element exists
if (_$portlet.length === 0) {
console.error('Social sharing container element not found.');
return;
}
// initialize the social sharing buttons based on the configuration
if (_CONFIG.facebook) {
_initFacebookButton(_CONFIG.useWidget);
}
if (_CONFIG.twitter) {
_initTwitterButton(_CONFIG.useWidget);
}
if (_CONFIG.linkedin) {
_initLinkedInButton(_CONFIG.useWidget);
}
if (_CONFIG.whatsApp) {
_initWhatsAppButton(_CONFIG.useWidget);
}
if (_CONFIG.email) {
_initEmailButton(_CONFIG.useWidget);
}
if (_CONFIG.pinterest) {
_initPinterestButton(_CONFIG.useWidget);
}
if (_CONFIG.reddit) {
_initRedditButton(_CONFIG.useWidget);
}
if (_CONFIG.tumblr) {
_initTumblrButton(_CONFIG.useWidget);
}
if (_CONFIG.pocket) {
_initPocketButton(_CONFIG.useWidget);
}
if (_CONFIG.telegram) {
_initTelegramButton(_CONFIG.useWidget);
}
if (_CONFIG.hackerNews) {
_initHackerNewsButton(_CONFIG.useWidget);
}
if (_CONFIG.vkontakte) {
_initVKontakteButton(_CONFIG.useWidget);
}
if (_CONFIG.xing) {
_initXINGButton(_CONFIG.useWidget);
}
if (_CONFIG.renren) {
_initRenrenButton(_CONFIG.useWidget);
}
if (_CONFIG.weibo) {
_initWeiboButton(_CONFIG.useWidget);
}
if (_CONFIG.line) {
_initLineButton(_CONFIG.useWidget);
}
if (_CONFIG.viber) {
_initViberButton(_CONFIG.useWidget);
}
if (_CONFIG.print) {
_initPrintButton(_CONFIG.useWidget);
}
if (_CONFIG.copyLink) {
_initCopyLinkButton(_CONFIG.useWidget);
}
if (_CONFIG.more) {
_initMoreButton(_CONFIG.useWidget);
}
};
return {
init: init
};
})();
// initialize the social sharing buttons
SocialSharing.init();
})(jQuery);
</script>
social-link .fb-share-button script’, _$portlet).remove();
$(”)
.attr(‘id’, ‘facebook-jssdk’)
.attr(‘async’, true)
.attr(‘defer’, true)
.attr(‘src’, ‘https://connect.facebook.net/en_US/sdk.js#xfbml=1&version=v3.2‘)
.appendTo(‘body’);
}
};
/**
* @param includeWidget {boolean} If true WhatsApp's own button widget is loaded, custom button otherwise
*/
var _initWhatsAppButton = function (includeWidget) {
// configure WhatsApp button
var buttonDom = $.parseHTML(includeWidget ? _BUTTON_TEMPLATES.whatsAppWidget : _BUTTON_TEMPLATES.whatsApp);
_$portlet.append(buttonDom);
};
/**
* @param includeWidget {boolean} If true Email's own button widget is loaded, custom button otherwise
*/
var _initEmailButton = function (includeWidget) {
// configure Email button
var buttonDom = $.parseHTML(includeWidget ? _BUTTON_TEMPLATES.emailWidget : _BUTTON_TEMPLATES.email);
_$portlet.append(buttonDom);
};
/**
* @param includeWidget {boolean} If true Pinterest's own button widget is loaded, custom button otherwise
*/
var _initPinterestButton = function (includeWidget) {
// configure Pinterest button
var buttonDom = $.parseHTML(includeWidget ? _BUTTON_TEMPLATES.pinterestWidget : _BUTTON_TEMPLATES.pinterest);
_$portlet.append(buttonDom);
};
/**
* @param includeWidget {boolean} If true Reddit's own button widget is loaded, custom button otherwise
*/
var _initRedditButton = function (includeWidget) {
// configure Reddit button
var buttonDom = $.parseHTML(includeWidget ? _BUTTON_TEMPLATES.redditWidget : _BUTTON_TEMPLATES.reddit);
_$portlet.append(buttonDom);
};
/**
* @param includeWidget {boolean} If true Tumblr's own button widget is loaded, custom button otherwise
*/
var _initTumblrButton = function (includeWidget) {
// configure Tumblr button
var buttonDom = $.parseHTML(includeWidget ? _BUTTON_TEMPLATES.tumblrWidget : _BUTTON_TEMPLATES.tumblr);
_$portlet.append(buttonDom);
};
/**
* @param includeWidget {boolean} If true Pocket's own button widget is loaded, custom button otherwise
*/
var _initPocketButton = function (includeWidget) {
// configure Pocket button
var buttonDom = $.parseHTML(includeWidget ? _BUTTON_TEMPLATES.pocketWidget : _BUTTON_TEMPLATES.pocket);
_$portlet.append(buttonDom);
};
/**
* @param includeWidget {boolean} If true Telegram's own button widget is loaded, custom button otherwise
*/
var _initTelegramButton = function (includeWidget) {
// configure Telegram button
var buttonDom = $.parseHTML(includeWidget ? _BUTTON_TEMPLATES.telegramWidget : _BUTTON_TEMPLATES.telegram);
_$portlet.append(buttonDom);
};
/**
* @param includeWidget {boolean} If true Hacker News's own button widget is loaded, custom button otherwise
*/
var _initHackerNewsButton = function (includeWidget) {
// configure Hacker News button
var buttonDom = $.parseHTML(includeWidget ? _BUTTON_TEMPLATES.hackerNewsWidget : _BUTTON_TEMPLATES.hackerNews);
_$portlet.append(buttonDom);
};
/**
* @param includeWidget {boolean} If true VK's own button widget is loaded, custom button otherwise
*/
var _initVKButton = function (includeWidget) {
// configure VK button
var buttonDom = $.parseHTML(includeWidget ? _BUTTON_TEMPLATES.vkWidget : _BUTTON_TEMPLATES.vk);
_$portlet.append(buttonDom);
};
/**
* @param includeWidget {boolean} If true XING's own button widget is loaded, custom button otherwise
*/
var _initXINGButton = function (includeWidget) {
// configure XING button
var buttonDom = $.parseHTML(includeWidget ? _BUTTON_TEMPLATES.xingWidget : _BUTTON_TEMPLATES.xing);
_$portlet.append(buttonDom);
};
/**
* @param includeWidget {boolean} If true Mix's own button widget is loaded, custom button otherwise
*/
var _initMixButton = function (includeWidget) {
// configure Mix button
var buttonDom = $.parseHTML(includeWidget ? _BUTTON_TEMPLATES.mixWidget : _BUTTON_TEMPLATES.mix);
_$portlet.append(buttonDom);
};
/**
* @param includeWidget {boolean} If true Instapaper's own button widget is loaded, custom button otherwise
*/
var _initInstapaperButton = function (includeWidget) {
// configure Instapaper button
var buttonDom = $.parseHTML(includeWidget ? _BUTTON_TEMPLATES.instapaperWidget : _BUTTON_TEMPLATES.instapaper);
_$portlet.append(buttonDom);
};
/**
* @param includeWidget {boolean} If true Line's own button widget is loaded, custom button otherwise
*/
var _initLineButton = function (includeWidget) {
// configure Line button
var buttonDom = $.parseHTML(includeWidget ? _BUTTON_TEMPLATES.lineWidget : _BUTTON_TEMPLATES.line);
_$portlet.append(buttonDom);
};
/**
* @param includeWidget {boolean} If true Viber's own button widget is loaded, custom button otherwise
*/
var _initViberButton = function (includeWidget) {
// configure Viber button
var buttonDom = $.parseHTML(includeWidget ? _BUTTON_TEMPLATES.viberWidget : _BUTTON_TEMPLATES.viber);
_$portlet.append(buttonDom);
};
/**
* @param includeWidget {boolean} If true Print's own button widget is loaded, custom button otherwise
*/
var _initPrintButton = function (includeWidget) {
// configure Print button
var buttonDom = $.parseHTML(includeWidget ? _BUTTON_TEMPLATES.printWidget : _BUTTON_TEMPLATES.print);
_$portlet.append(buttonDom);
};
/**
* @param includeWidget {boolean} If true Copy's own button widget is loaded, custom button otherwise
*/
var _initCopyButton = function (includeWidget) {
// configure Copy button
var buttonDom = $.parseHTML(includeWidget ? _BUTTON_TEMPLATES.copyWidget : _BUTTON_TEMPLATES.copy);
_$portlet.append(buttonDom);
};
/**
* @param includeWidget {boolean} If true More's own button widget is loaded, custom button otherwise
*/
var _initMoreButton = function (includeWidget) {
// configure More button
var buttonDom = $.parseHTML(includeWidget ? _BUTTON_TEMPLATES.moreWidget : _BUTTON_TEMPLATES.more);
_$portlet.append(buttonDom);
};
/**
* Initializes the social sharing buttons based on the configuration provided
*/
var init = function () {
if (_config) {
// initialize each social button based on the configuration
if (_config.twitter) {
_initTwitterButton(_config.twitterWidget);
}
if (_config.linkedIn) {
_initLinkedInButton(_config.linkedInWidget);
}
if (_config.facebook) {
_initFacebookButton(_config.facebookWidget);
}
if (_config.whatsApp) {
_initWhatsAppButton(_config.whatsAppWidget);
}
if (_config.email) {
_initEmailButton(_config.emailWidget);
}
if (_config.pinterest) {
_initPinterestButton(_config.pinterestWidget);
}
if (_config.reddit) {
_initRedditButton(_config.redditWidget);
}
if (_config.tumblr) {
_initTumblrButton(_config.tumblrWidget);
}
if (_config.pocket) {
_initPocketButton(_config.pocketWidget);
}
if (_config.telegram) {
_initTelegramButton(_config.telegramWidget);
}
if (_config.hackerNews) {
_initHackerNewsButton(_config.hackerNewsWidget);
}
if (_config.vk) {
_initVKButton(_config.vkWidget);
}
if (_config.xing) {
_initXINGButton(_config.xingWidget);
}
if (_config.mix) {
_initMixButton(_config.mixWidget);
}
if (_config.instapaper) {
_initInstapaperButton(_config.instapaperWidget);
}
if (_config.line) {
_initLineButton(_config.lineWidget);
}
if (_config.viber) {
_initViberButton(_config.viberWidget);
}
if (_config.print) {
_initPrintButton(_config.printWidget);
}
if (_config.copy) {
_initCopyButton(_config.copyWidget);
}
if (_config.more) {
_initMoreButton(_config.moreWidget);
}
}
};
return {
init: init
};
};
return SocialShare;
})(jQuery);
// Initialize social share buttons
var socialShare = new SocialShare({
twitter: true,
twitterWidget: true,
linkedIn: true,
linkedInWidget: true,
facebook: true,
facebookWidget: true,
whatsApp: true,
whatsAppWidget: true,
email: true,
emailWidget: true,
pinterest: true,
pinterestWidget: true,
reddit: true,
redditWidget: true,
tumblr: true,
tumblrWidget: true,
pocket: true,
pocketWidget: true,
telegram: true,
telegramWidget: true,
hackerNews: true,
hackerNewsWidget: true,
vk: true,
vkWidget: true,
xing: true,
xingWidget: true,
mix: true,
mixWidget: true,
instapaper: true,
instapaperWidget: true,
line: true,
lineWidget: true,
viber: true,
viberWidget: true,
print: true,
printWidget: true,
copy: true,
copyWidget: true,
more: true,
moreWidget: true
});
socialShare.init();