diff --git a/js/html_actuator.js b/js/html_actuator.js index d840068..9561632 100644 --- a/js/html_actuator.js +++ b/js/html_actuator.js @@ -130,6 +130,7 @@ HTMLActuator.prototype.message = function (won) { this.messageContainer.classList.add(type); this.messageContainer.getElementsByTagName("p")[0].textContent = message; + this.messageContainer.appendChild(this.showSocialButtons()); }; HTMLActuator.prototype.clearMessage = function () { @@ -137,3 +138,38 @@ HTMLActuator.prototype.clearMessage = function () { this.messageContainer.classList.remove("game-won"); this.messageContainer.classList.remove("game-over"); }; + +HTMLActuator.prototype.showSocialButtons = function () { + var text = "I scored " + this.score + " points at 243, a game where you join nubers to score high! @mishopet" + var html = + '
' + + '' + + '
' + + '
'; + document.getElementById( 'viewport' ).insertAdjacentHTML( 'beforeEnd', html ); + + var script = document.createElement( 'script' ); + script.async = true; + script.src = document.location.protocol + '//connect.facebook.net/en_US/all.js#xfbml=1&appId=239765196226361'; + document.getElementById( 'fb-root' ).appendChild( script ); + + script = document.createElement( 'script' ); + script.async = true; + script.src = document.location.protocol + '//platform.twitter.com/widgets.js'; + document.getElementById( 'social-buttons' ).appendChild( script ); + + script = document.createElement( 'script' ); + script.async = true; + script.src = document.location.protocol + '//apis.google.com/js/plusone.js'; + document.getElementById( 'social-buttons' ).appendChild( script ); + + window.setTimeout( function () { + + document.getElementById( 'social-buttons' ).removeAttribute( 'class' ); + + }, 1000 ); + return html +};