YUI.add('lang/ixl_social-sharing-commonjs_js_SocialSharing', function(Y) { var intl = require('ixl/util-commonjs/Intl'); var text = {}; text['copy_link.link_copied'] = 'Link copied'; text['copy_link.tooltip_text.skill'] = 'Copy the link to this skill'; text['basic_config.tweet_description'] = 'Check out @IXLLearning!'; text['copy_link.tooltip_text.lesson'] = 'Copy the link to this lesson'; intl.addModule('ixl_social-sharing-commonjs_js_SocialSharing', text); }, '@VERSION@', {'requires':['ixl_content_util_YLang', 'ixl_util-commonjs_YEscape', 'ixl_util-commonjs_Intl']}); !function(){function e(e,t,i){const n=e("ixl/external/react/react"),o=e("ixl/external/react/reactDom"),s=e("ixl/external/react/prop-types"),l={onClick:s.func.isRequired,infoTooltipContent:s.string.isRequired,clickedTooltipContent:s.string.isRequired};class r extends n.Component{constructor(e){super(e),this.state={isClicked:!1,renderTooltip:!1},this._handleCopyLink=this._handleCopyLink.bind(this),this._handleMouseEnter=this._handleMouseEnter.bind(this),this._handleMouseLeave=this._handleMouseLeave.bind(this),this._handleOutsideClick=this._handleOutsideClick.bind(this),this.ref=n.createRef()}componentDidMount(){document.addEventListener("mousedown",this._handleOutsideClick),document.addEventListener("touchdown",this._handleOutsideClick)}componentWillUnmount(){this._clearTimer(this.linkCopiedTimer),document.removeEventListener("mousedown",this._handleOutsideClick),document.removeEventListener("touchdown",this._handleOutsideClick)}_handleOutsideClick(e){this.ref.current.contains(e.target)||this.setState({renderTooltip:!1,isClicked:!1})}_handleMouseEnter(){this.setState({renderTooltip:!0})}_handleMouseLeave(){this.state.isClicked||this.setState({renderTooltip:!1})}_handleCopyLink(){this._clearTimer(this.linkCopiedTimer),this.props.onClick(),this.setState({isClicked:!0,renderTooltip:!0},()=>{this.linkCopiedTimer=window.setTimeout(()=>{this.setState({isClicked:!1,renderTooltip:!1})},1500)})}_clearTimer(e){e&&window.clearTimeout(e)}render(){const e="social-sharing-tooltip-wrapper "+(this.state.renderTooltip?"show-tooltip":"");return n.createElement("div",{className:e,ref:this.ref},n.createElement("div",{onClick:this._handleCopyLink,onMouseEnter:this._handleMouseEnter,onMouseLeave:this._handleMouseLeave,className:"copy-link share-button",tabIndex:0},n.createElement("span",{className:"social-sharing-tooltip"},this.state.isClicked?this.props.clickedTooltipContent:this.props.infoTooltipContent)))}}r.displayName="CopyLinkButton",r.propTypes=l,i.exports={createCopyLinkButton:function(e,t){o.render(n.createElement(r,t),e)}}}e.moduleId="ixl_social-sharing-commonjs_components_CopyLinkTooltip",define(e)}(); YUI.add('lang/ixl_social-sharing-commonjs_js_ClickTrackingUtils', function(Y) { var intl = require('ixl/util-commonjs/Intl'); var text = {}; text['google_classroom.name'] = 'Google Classroom'; text['copy_link.name'] = 'Copy link'; text['twitter.name'] = 'Twitter'; text['basic_config.tweet_description'] = 'Check out @IXLLearning!'; text['fb.name'] = 'Facebook'; intl.addModule('ixl_social-sharing-commonjs_js_ClickTrackingUtils', text); }, '@VERSION@', {'requires':['ixl_content_util_YLang', 'ixl_util-commonjs_YEscape', 'ixl_util-commonjs_Intl']}); !function(){function t(t,o,n){var e=t("ixl/util-commonjs/Intl").getModule("ixl_social-sharing-commonjs_js_ClickTrackingUtils");const i=t("ixl/util-commonjs/gaq"),c="SocialSharing",a="fb",s="gc",r="tw";function l(t,o,n){n?i("send","event",c,t,o,n):i("send","event",c,t,o)}n.exports={trackClickback:function(){const t=window.location.hash;function o(t){var[o,n]=window.location.href.split("#"+t);if(n)"&"===n.charAt(0)&&(n=n.substring(1));else{const t=o.length;"&"===o.charAt(t-1)&&(o=o.substring(0,t-1))}window.location.href=o+"#"+n}if(!t)return;const n=window.location.origin+window.location.pathname;t.startsWith(a)&&(l(e.getText("fb.name"),n,2),o(a)),t.startsWith(r)&&(l(e.getText("twitter.name"),n,2),o(r)),t.startsWith(s)&&(l(e.getText("google_classroom.name"),n,2),o(s))},trackCopyLink:function(t){l(e.getText("copy_link.name"),t,1)},trackFacebook:function(t,o){return l(e.getText("fb.name"),t,1),"http://www.facebook.com/sharer.php?u="+(t+(o?"#"+a:""))},trackGoogleClassroom:function(t,o){return l(e.getText("google_classroom.name"),t,1),`https://classroom.google.com/share?url=${t+(o?"%23"+s:"")}`},trackTwitter:function(t,o){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.getText("basic_config.tweet_description");return l(e.getText("twitter.name"),t,1),"https://twitter.com/share?url="+(t+(o?"%23"+r:""))+"&text="+n}}}t.moduleId="ixl_social-sharing-commonjs_js_ClickTrackingUtils",define(t)}(); !function(){function o(o,n,t){var e=o("ixl/util-commonjs/Intl").getModule("ixl_social-sharing-commonjs_js_SocialSharing"),i=o("ixl/email-framework/common/Utils"),a=o("ixl/social-sharing-commonjs/components/CopyLinkTooltip"),{isFeatureEnabled:l}=o("ixl/util-commonjs/FeatureToggle");o("ixl/content/util/is-mobile-device");const{trackClickback:c,trackCopyLink:s,trackFacebook:r,trackGoogleClassroom:m,trackTwitter:u}=o("ixl/social-sharing-commonjs/js/ClickTrackingUtils");var d={link:"http://www.ixl.com",tweetDescription:e.getText("basic_config.tweet_description"),trackClickback:!0,loadOnly:!1,setUpSocialMedia:!0,aType:-1,pageType:"skill"};function k(o,n,t){window.open(o,"_blank","menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height="+n+",width="+t)}function p(o,n){k(r(o,n),450,600)}function g(o,n,t){k(u(o,t,n),"400","550")}function f(o){return new Promise(function(n,t){if(!o.loadOnly){document.getElementsByClassName("facebook-share share-button")[0].addEventListener("click",function(n){n.stopPropagation(),p(o.link,!0)})}n()})}function y(o){return new Promise(function(n){if(o.loadOnly)n("load only - do not set up a button");else{var t=document.getElementsByClassName("twitter-share share-button")[0];t.addEventListener("click",function(n){n.stopPropagation(),g(o.tweetLink,o.tweetDescription,!0)}),n(t)}})}function h(o){return new Promise(function(n,t){(void 0===o.aType||parseInt(o.aType,10)<0)&&n("Google Classroom not required"),o.loadOnly&&n("load only - do not set up a button");const e=document.getElementsByClassName("google-classroom share-button")[0];e.classList.remove("none"),e.addEventListener("click",function(n){var t;n.stopPropagation(),t=o.link,k(m(t,!0),"400","640")}),n()})}function b(o){l("SOCIAL_SHARING_COPY_LINK")&&a.createCopyLinkButton(document.getElementById("copy-link-button"),{onClick:function(){var n=o.customDomainUrl?o.link+"?signInRedirect="+encodeURIComponent(o.customDomainUrl):o.link;s(n),i.copyToClipboard(n)},infoTooltipContent:e.getText("copy_link.tooltip_text."+o.pageType),clickedTooltipContent:e.getText("copy_link.link_copied")})}function w(){var o=document.getElementsByClassName("social-share-bar")[0];o.classList.add("loaded")}window.shareReport=function(o){var n=JSON.parse(o.shareData);n.link=n.host+n.link,n.image=n.host+n.image,"fb"===o.channel?p(n.link,!0):"tw"===o.channel&&g(n.link,n.tweet,!0)};t.exports={setUpSocialSharing:function(o){var n={...d,...o};n.trackClickback&&c(),n.setUpSocialMedia&&Promise.all([f(n),y(n),h(n),b(n)]).then(w)}}}o.moduleId="ixl_social-sharing-commonjs_js_SocialSharing",define(o)}();