Google
Edit File: social-buttons-d6d9e4a394bf2055098e-min.js
webpackJsonp([34],{0:function(m,n,g){g(3439);g(3438)},703:function(m,n){m.exports={TWITTER:1,FACEBOOK:2,GOOGLE:3,LINKEDIN:4,STUMBLE:5,REDDIT:6,PINTEREST:7,TUMBLR:8}},3438:function(m,n,g){var l=g(1),p=g(21),b=g(703);YUI.add("squarespace-social-button",function(d){d.namespace("Squarespace");var g=function(c){return c},e=d.Squarespace.SocialButton=d.Base.create("socialButton",d.Widget,[],{initializer:function(c){this._servicesRendered={};c.services.forEach(function(a){this._servicesRendered[a]=!1},this); this._open=!1;this._anims={};this._serviceRenderers={};this._serviceRenderers[b.REDDIT]=this._renderReddit;this._serviceRenderers[b.FACEBOOK]=this._renderFacebook;this._serviceRenderers[b.TWITTER]=this._renderTwitter;this._serviceRenderers[b.GOOGLE]=this._renderGoogle;this._serviceRenderers[b.LINKEDIN]=this._renderLinkedIn;this._serviceRenderers[b.STUMBLE]=this._renderStumble;this._serviceRenderers[b.PINTEREST]=this._renderPinterest;this._serviceRenderers[b.TUMBLR]=this._renderTumblr;this.publish("serviceRendered", {defaultFn:this._defaultServiceRendered,context:this});this.publish("buttonClicked",{defaultFn:this._defaultButtonClicked,preventable:!0,context:this});this.publish("close",{defaultFn:this.close,preventable:!0,context:this});this.publish("servicesRendered");this._serviceContainer=d.Node.create('<div class="ss-social-button-container"></div>')},_defaultServiceRendered:function(c){this._servicesRendered[c.details[0]]=!0;this._allServicesRendered()&&(this.set("loaded",!0),this.fire("servicesRendered", this))},open:function(){this._open=!0;this._openList()},close:function(){this._open=!1;this._closeList()},_onClick:function(c){this.fire("buttonClicked",c)},_defaultButtonClicked:function(c){this.get("loaded")?this.isOpen()?this.close():this.open():this.get("loading")||(this.once("servicesRendered",function(){this.set("loading",!1)},this),this.set("loading",!0),this._renderServices(),this.open())},isOpen:function(){return this._open},destructor:function(){this._stopAnimations()},_stopAnimations:function(){d.Object.values(this._anims).forEach(function(c){c.stop()})}, _closeList:function(){var c=this.get("contentBox");if(c._node&&c.inDoc()){var a=c.one(".ss-social-button-wrapper"),b=c.one(".ss-social-list-wrapper"),c=a.get("offsetWidth");a.get("offsetHeight");a=b.get("offsetWidth");Math.abs(c-a);b&&(b._node&&b.inDoc())&&(a=new d.Anim({node:b,duration:0.3,easing:d.Easing.easeOutStrong,to:{height:0,opacity:0}}),this._anims.close=a,a.on("end",function(){b.setStyle("overflow",null);this.fire("listClose")},this),a.run())}},_openList:function(){var c=this.get("contentBox"); if(c._node&&c.inDoc()){var a=c.one(".ss-social-button-wrapper"),b=c.one(".ss-social-list-wrapper"),c=c.one(".ss-social-button-list"),e=a.get("offsetWidth"),a=a.get("offsetHeight"),k=b.get("offsetWidth"),g=Math.abs(e-k),l;this.get("id");b.setStyles({left:(e<=k?-1:1)*g/2,top:a});a=d.DOM.viewportRegion();k=c.get("region");e=k.height+k.top-(a.height+a.top);a=a.left-k.left;k=0<a;0<e&&b.setStyle("top",parseInt(b.getComputedStyle("top"),10)-e-20);k&&b.setStyle("left",parseInt(b.getComputedStyle("left"), 10)+a+20);b&&(b._node&&b.inDoc())&&(c=new d.Anim({node:b,duration:0.3,easing:d.Easing.easeOutStrong,to:{height:c.get("offsetHeight"),opacity:1}}),this._anims.open=c,c.on("end",function(){b.setStyle("overflow","visible");var a=d.config.win.document;d.UA.touchEnabled&&d.one(a.documentElement).setStyle("cursor","pointer");l=d.one(a).on("click",function(b){b.target.ancestor(".ss-social-list-wrapper",!0)||(this.fire("close"),l.detach(),l=null,d.one(a.documentElement).setStyle("cursor",""))},this);this.fire("listOpen")}, this),c.run())}},_allServicesRendered:function(){return d.Object.values(this._servicesRendered).every(g)},bindUI:function(){var b=this.get("contentBox").one(".ss-social-button-wrapper");this.after("loadingChange",this._onLoadingChange,this);b.on("click",this._onClick,this)},_onLoadingChange:function(){this.get("boundingBox").ancestor(".squarespace-social-buttons").toggleClass("loading",this.get("loading"))},renderUI:function(){var b=this.get("contentBox");b.append('<div class="ss-social-button-wrapper"><div class="ss-social-button"><span class="ss-social-button-icon"></span>Share</div></div>'); b.append('<div class="ss-social-list-wrapper"><div class="ss-social-button-list"></div></div>');b.one(".ss-social-button-list")},_renderServices:function(){var b=this.get("contentBox").one(".ss-social-button-list");this.get("services").forEach(function(a){this._serviceRenderers[a].call(this,b)},this)},_defaultTimeoutCb:function(c,a){var f=d.Squarespace.Utils.reverseMap(b),h=p(l("(Social Button) Loading render script for service: {name} too longer than {sub1} seconds. Skipping."),{sub1:e.SCRIPT_TIMEOUT/ 1E3});return function(){console.warn(d.substitute(h,{name:f[c]}));this.fire("serviceRendered",c);a&&a.hide()}},_defaultFailureCb:function(c,a){var e=d.Squarespace.Utils.reverseMap(b),h=l("(Social Button) Service {name} render script failed to load.");return function(){console.warn(d.substitute(h,{name:e[c]}));this.fire("serviceRendered",c);a&&a.hide()}},_renderReddit:function(c){var a=this._serviceContainer.cloneNode(!0),f=this.get("url");this.get("contentBox");a.addClass("reddit");a.append(d.Node.create(e.REDDIT_LINK)); a.on("click",function(a){window.open("http://reddit.com/submit?url="+encodeURIComponent(f),l("Submit to Reddit"));a.stopImmediatePropagation()});c.append(a);this.fire("serviceRendered",b.REDDIT)},_renderTumblr:function(c){var a=this._serviceContainer.cloneNode(!0),f={url:this.get("url"),name:this.get("title")},f=d.QueryString.stringify(f);a.addClass("tumblr");a.append(d.substitute(e.TUMBLR_TAG_TEMPLATE,{query:f}));c.append(a);d.Get.script(e.TUMBLR_URL,{onSuccess:function(){d.later(400,this,function(){this.fire("serviceRendered", b.TUMBLR)})},onFailure:this._defaultFailureCb(b.TUMBLR,a),onTimeout:this._defaultTimeoutCb(b.TUMBLR,a),timeout:e.SCRIPT_TIMEOUT,context:this,win:d.config.win})},_renderFacebook:function(c){var a=this._serviceContainer.cloneNode(!0),f=this.get("url");a.addClass("facebook");a.append(d.Node.create(d.substitute(e.FACEBOOK_TAG_TEMPLATE,{url:f})));c.append(a);var h=d.config.win,k=Static.SQUARESPACE_CONTEXT.facebookAppId;d.Get.script(e.FACEBOOK_URL,{onSuccess:function(){h.FB&&d.later(400,this,function(){h.FB.init({appId:k, xfbml:!1,version:"v2.5"});h.FB.XFBML&&h.FB.XFBML.parse&&h.FB.XFBML.parse();this.fire("serviceRendered",b.FACEBOOK)})},onFailure:this._defaultFailureCb(b.FACEBOOK,a),onTimeout:this._defaultTimeoutCb(b.FACEBOOK,a),timeout:e.SCRIPT_TIMEOUT,context:this})},_renderGoogle:function(c){var a=this._serviceContainer.cloneNode(!0),f=this.get("url");a.addClass("google");a.append(d.Node.create(d.substitute(e.GOOGLE_TAG_TEMPLATE,{url:f})));c.append(a);d.Get.script(e.GOOGLE_PLUS_URL,{onSuccess:function(){window.gapi&& (gapi.plusone.go(),d.later(400,this,function(){this.fire("serviceRendered",b.GOOGLE);this._googleRendered=!0}))},onFailure:this._defaultFailureCb(b.GOOGLE,a),onTimeout:this._defaultTimeoutCb(b.GOOGLE,a),timeout:e.SCRIPT_TIMEOUT,context:this});this.fire("serviceRendered",b.GOOGLE)},_renderTwitter:function(c){var a=this._serviceContainer.cloneNode(!0),f=this.get("title"),h=this.get("url");a.append(d.Node.create('<a href="https://twitter.com/share" data-text="'+d.Escape.html(f||"")+'" data-url="'+d.Escape.html(h)+ '"class="twitter-share-button">tweet</a>'));a.addClass("twitter");c.append(a);d.Get.script(e.TWITTER_URL,{onSuccess:function(){d.later(400,this,function(){this.fire("serviceRendered",b.TWITTER)})},onFailure:this._defaultFailureCb(b.TWITTER,a),onTimeout:this._defaultTimeoutCb(b.TWITTER,a),timeout:e.SCRIPT_TIMEOUT,context:this})},_renderLinkedIn:function(c){var a=this._serviceContainer.cloneNode(!0);this.get("title");var f=this.get("url");a.addClass("linkedin");a.append(d.Node.create(d.substitute(e.LINKEDIN_URL_TEMPLATE, {url:f})));c.append(a);window.IN=void 0;d.Get.script(e.LINKEDIN_URL,{onSuccess:function(){d.later(400,this,function(){this.fire("serviceRendered",b.LINKEDIN)})},onFailure:this._defaultFailureCb(b.LINKEDIN,a),onTimeout:this._defaultTimeoutCb(b.LINKEDIN,a),timeout:e.SCRIPT_TIMEOUT,context:this})},_renderStumble:function(c){var a=this._serviceContainer.cloneNode(!0),f=this.get("url"),h=this.get("id");a.addClass("stumble");a.append(d.Node.create(d.substitute(e.STUMBLE_TAG_TEMPLATE,{url:f,id:h})));c.append(a); d.Get.script(e.STUMBLE_URL,{onSuccess:function(){d.later(400,this,function(){STMBLPN&&(STMBLPN.wasProcessLoaded&&(STMBLPN.wasProcessLoaded=!1),STMBLPN.processWidgets());this.fire("serviceRendered",b.STUMBLE)})},onFailure:this._defaultFailureCb(b.STUMBLE,a),onTimeout:this._defaultTimeoutCb(b.STUMBLE,a),timeout:e.SCRIPT_TIMEOUT,context:this})},_renderPinterest:function(c){var a=this._serviceContainer.cloneNode(!0),f=this.get("assetUrl"),h=this.get("url"),k=Static.SQUARESPACE_CONTEXT.website.authenticUrl+ c.ancestor(".squarespace-social-buttons").getAttribute("data-full-url");this.get("id");this.get("recordType");this.get("systemDataId")?(a.addClass("pinterest"),a.append(d.Node.create(d.substitute(e.PINTEREST_TAG_TEMPLATE,{url:encodeURIComponent(f||h),pageUrl:encodeURIComponent(k)}))),c.append(a),d.Get.script(e.PINTEREST_URL,{onSuccess:function(){d.later(400,this,function(){this.fire("serviceRendered",b.PINTEREST)},this)},onFailure:this._defaultFailureCb(b.PINTEREST,a),onTimeout:this._defaultTimeoutCb(b.PINTEREST, a),timeout:e.SCRIPT_TIMEOUT,context:this})):this.fire("serviceRendered",b.PINTEREST)}},{TWITTER_URL:"http://platform.twitter.com/widgets.js",TUMBLR_URL:"http://platform.tumblr.com/v1/share.js",FACEBOOK_URL:"http://connect.facebook.net/en_US/sdk.js",LINKEDIN_URL:"http://platform.linkedin.com/in.js",GOOGLE_PLUS_URL:"http://apis.google.com/js/plusone.js",STUMBLE_URL:"http://platform.stumbleupon.com/1/widgets.js",PINTEREST_URL:"http://assets.pinterest.com/js/pinit.js",LINKEDIN_URL_TEMPLATE:'<script type="IN/Share" data-url="{url}" data-counter="right">\x3c/script>', GOOGLE_TAG_TEMPLATE:'<g:plusone size="medium" annotation="bubble" href="{url}"></g:plusone>',FACEBOOK_TAG_TEMPLATE:'<div id="fb-root"></div><fb:like href="{url}" send="false" layout="button_count" show_faces="true"></fb:like>',PINTEREST_TAG_TEMPLATE:'<a href="http://pinterest.com/pin/create/button?url={pageUrl}&media={url}" class="pin-it-button" count-layout="horizontal"><img border="0" src="../images/PinExt.png" title="Pin It" /></a>',TUMBLR_TAG_TEMPLATE:'<a href="http://tumblr.com/share/link?{query}" title="Share on Tumblr" style="display:inline-block; text-indent:-9999px; overflow:hidden; width:81px; height:20px; background:url(\'http://platform.tumblr.com/v1/share_1T.png\') top left no-repeat transparent;">Share on Tumblr</a>', SCRIPT_TIMEOUT:5E3,STUMBLE_TAG_TEMPLATE:'<su:badge layout="1" location="{url}"></su:badge>',REDDIT_LINK:'<a href="#"><img src="../static/spreddit7.gif" alt="submit to reddit" border="0" /></a>',ATTRS:{url:{value:window.location.href},title:{value:document.title||window.location.href},services:{},recordType:{},assetUrl:{value:""},systemDataId:{value:""},loaded:{value:!1},loading:{value:!1}}})},"1.0",{requires:"anim base escape node querystring-stringify squarespace-util substitute widget".split(" ")})}, 3439:function(m,n,g){var l=g(703),p=g(98);YUI.add("squarespace-social-buttons",function(b){b.namespace("Squarespace");var d=b.config.win.Static,g=b.Squarespace.SocialButton,e=b.Squarespace.SocialButtons=b.Base.create("socialButtons",b.Base,[],{initializer:function(a){a=this.get("services");this._buttonConfigs={};this._buttons=[];this._eventHandles=[];0<a.length?(this._scanForButtons(),this._initializeButtons(),this._bindEvents(),this._renderButtons()):this._markButtonsAsEmpty()},_markButtonsAsEmpty:function(){b.all(e.SOCIAL_BUTTON_CONTAINER).addClass("empty")}, _scanForButtons:function(){var a=b.all(e.SOCIAL_BUTTON_CONTAINER),c=this.get("services");a.each(function(a){var g=a.getAttribute(e.TITLE),l=d.SQUARESPACE_CONTEXT.website.baseUrl+a.getAttribute(e.FULL_URL),m=parseInt(a.getAttribute(e.RECORD_TYPE),10),n=a.getAttribute(e.ASSET_URL),p=a.getAttribute(e.SYSTEM_DATA_ID),q=b.guid(e.ID_PREFIX);this._buttonConfigs[q]={id:q,title:g,url:l,recordType:m,assetUrl:n,systemDataId:p,services:c,node:a}},this)},_initializeButtons:function(){this._buttons=b.Array.map(b.Object.values(this._buttonConfigs), function(a){return new g(a)})},_bindEvents:function(){this._eventHandles.push(this.after("cleanup",this._defaultDestroy,this))},_renderButtons:function(){this._buttons.filter(this._excludeOnlyPinterest,this).forEach(function(a){var b=a.get("id");a.render(this._buttonConfigs[b].node)},this)},destructor:function(){this.fire("cleanup")},_unbindEvents:function(){this._eventHandles.forEach(function(a){a.detach()})},_defaultDestroy:function(){this._destroyButtons();this._unbindEvents();this.fire("destroyed")}, _destroyButtons:function(){this._buttons.forEach(function(a){a.destroy()},this)},_excludeOnlyPinterest:function(a){return a.get("recordType")!==p.IMAGE&&this._onlyServiceIsPinterest(a)?!1:!0},_onlyServiceIsPinterest:function(a){a=a.get("services");return 1===a.length&&a[0]===l.PINTEREST}},{FULL_URL:"data-full-url",ASSET_URL:"data-asset-url",SYSTEM_DATA_ID:"data-system-data-id",RECORD_TYPE:"data-record-type",ID_PREFIX:"social-",TITLE:"data-title",SOCIAL_BUTTON_CONTAINER:".squarespace-social-buttons", ATTRS:{services:{valueFn:function(){return b.Array.map(b.Object.keys(d.SQUARESPACE_CONTEXT.website.shareButtonOptions||{}),function(a){return parseInt(a,10)})}}}}),c;b.config.win.Squarespace.onInitialize(b,function(){c=[];b.all(".squarespace-social-buttons").isEmpty()||c.push(new b.Squarespace.SocialButtons)});b.config.win.Squarespace.onDestroy(b,function(){c.forEach(function(a){a.destroy()});c=null})},"1.0",{requires:["array-extras","base","node","squarespace-social-button"]})}});