Guest User

Untitled

a guest
Jun 14th, 2018
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.20 KB | None | 0 0
  1. <script>
  2. "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(){
  3. $('.social .share-button.btn.btn-primary').simpleSocialShare();
  4. });
  5. </script>
Add Comment
Please, Sign In to add comment