CMS Development

micheleguilford
Participante

Share Links on Blog not Working

Just realized that the social share buttons on our blog template don't work. You click, the address bars blinks and nothing. I've looked at the code and realized I'm in too deep for my knowledge. I would appreciate someone reviewing the code and sharing what is incorrect. Thanks so much for your time!

 

https://www.edtscyber.com/blog/common-cyber-scams

 

-Michele

0 Me gusta
2 Respuestas 2
tjoyce
Experto reconocido | Partner nivel Elite
Experto reconocido | Partner nivel Elite

Share Links on Blog not Working

@micheleguilford

You just need to update the plugin

 

In your blog template in the design manager, you have a rawJS or HTML content block added with content that looks similar to this:

js.png

Replace it with this script:


tim@belch.io

tjoyce
Experto reconocido | Partner nivel Elite
Experto reconocido | Partner nivel Elite

Share Links on Blog not Working

@micheleguilford

You just need to update the plugin

 

In your blog template in the design manager, you have a rawJS or HTML content block added with content that looks similar to this:

js.png

Replace it with this:

"function"!=typeof Object.create&&(Object.create=function(e){function t(){}return t.prototype=e,new t}),function($,e,t,n){var o="simpleSocialShare",i="plugin_"+o,r={init:function(e,t){var n=this;return n.options=$.extend(!0,{},$.fn[o].options,e),n.namespace="."+o+"."+(new Date).getTime(),n.element=t,n.$element=$(t),n.allowedNetworks=["facebook","twitter","linkedin","googleplus","pinterest","reddit"],n.bind(),n},bind:function(){var e=this;e.bindProxied(e.$element,"click",e.openSocialSharePopup)},bindProxied:function(e,t,n){var o=this;e.on(t+o.namespace,$.proxy(function(e){return n.call(o,e)},o))},destroy:function(){var e=this;e.$element.off(e.namespace),e.$element.removeData(i)},openSocialSharePopup:function(e){e.preventDefault();var t=this,n=!1,o=t.$element.data("share-url"),i=t.$element.data("share-network"),r=t.$element.data("share-text"),a=t.$element.data("share-title"),c=t.$element.data("share-via"),d=t.$element.data("share-tags"),s=t.$element.data("share-media"),p="";if("undefined"!=typeof o&&"undefined"!=typeof i&&t.allowedNetworks.indexOf(i)>-1&&(n=!0),n===!0)switch(i){case"facebook":p="https://www.facebook.com/sharer/sharer.php?u="+encodeURIComponent(o);break;case"googleplus":p="https://plus.google.com/share?url="+encodeURIComponent(o);break;case"linkedin":p="https://www.linkedin.com/shareArticle?mini=true&url="+encodeURIComponent(o)+"&source="+encodeURIComponent(o),"undefined"!=typeof a&&""!==a&&(p+="&title="+encodeURIComponent(a)),"undefined"!=typeof r&&""!==r&&(p+="&summary="+encodeURIComponent(r));break;case"pinterest":p="https://www.pinterest.com/pin/create/button/?url="+encodeURIComponent(o),"undefined"!=typeof s&&""!==s&&(p+="&media="+encodeURIComponent(s)),"undefined"!=typeof r&&""!==r&&(p+="&description="+encodeURIComponent(r)),"undefined"!=typeof d&&""!==d&&(p+="&hashtags="+d);break;case"reddit":p="http://www.reddit.com/submit/?url="+encodeURIComponent(o);break;case"twitter":p="https://twitter.com/intent/tweet?&url="+encodeURIComponent(o),"undefined"!=typeof r&&""!==r&&(p+="&text="+encodeURIComponent(r)),"undefined"!=typeof c&&""!==c&&(p+="&via="+encodeURIComponent(c)),"undefined"!=typeof d&&""!==d&&(p+="&hashtags="+d);break;default:return!1}n&&t.popupwindow(p,"",500,300)},popupwindow:function(t,n,o,i){var r=screen.width/2-o/2,a=screen.height/2-i/2;return e.open(t,n,"toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width="+o+", height="+i+", top="+a+", left="+r)}};$.fn[o]=function(e){var t=Array.prototype.slice.call(arguments);return this.each(function(){var n=$.data(this,i),a={};if("object"!=typeof e&&"init"!==e&&e){if(!n)return void $.fn[o].log("Simple Social Share is not initialized for this object yet.");if(!n[e])return void $.error("Method "+e+" does not exist on jQuery."+o+".");var c=e;a=t.slice(1),n[c].apply(n,a)}else{if(n)return void $.fn[o].log("Simple Social Share is already initialized for this object.");"init"===e&&(a=t[1]||{}),n=Object.create(r).init(a,this),$.data(this,i,n)}})},$.fn[o].log=function t(){e.console&&console.log&&console.log("[social-share] "+Array.prototype.join.call(arguments," "))}}(jQuery,window,document);
$(function(){
$('.social .share-button.btn.btn-primary').simpleSocialShare();
});

You may or may not have to wrap that new JS above in <script></script> tags


tim@belch.io

0 Me gusta