');
if(settings.responsive)
{
$splugin.addClass('responsive');
$splugin.addClass(settings.mobilePosition);
}
$.each(settings.enable, function (k, v) {
if(!urls[v])
{
console.error(defaults.appName + ' ' + v + ' is not a valid url');
return;
}
let $element = $('
');
let link = urls[v].url
.replace('[post-title]', encodeURIComponent(settings.title))
.replace('[post-url]', encodeURIComponent(settings.url))
.replace('[post-img]', encodeURIComponent(settings.img))
.replace('[post-desc]', encodeURIComponent(settings.description));
$element.attr('target', '_blank');
$element.addClass(settings.btnClass);
$element.attr('data-action', 'social-share');
$element.attr('href', link);
$element.html('');
$splugin.append($element);
});
e.append($splugin);
$(document).on('click', '[data-action="social-share"]', function (ele) {
ele.preventDefault();
if ($(this).attr('href').startsWith('copy:')) {
defaults.copyTop = e.pageY + 25;
defaults.copyLeft = e.pageX - 15;
copyTrigger(decodeURIComponent($(this).attr('href').replace('copy:', '')));
} else {
// Open the link in a new tab within the same window.
window.open($(this).data('href') || $(this).attr('href'), '_blank');
}
});
$(document).on('click', '.socialJS-custom-tooltip', function () {
$(this).remove();
})
};
return this.each(function() {
return new build($(this));
});
};