diff --git a/app/controllers/MathSwipeController.coffee b/app/controllers/MathSwipeController.coffee index cc41747..09e476a 100644 --- a/app/controllers/MathSwipeController.coffee +++ b/app/controllers/MathSwipeController.coffee @@ -9,6 +9,7 @@ InputSolver = require '../services/InputSolver' RandomizedFitLength = require '../services/RandomizedFitLength' ResetButton = require '../services/ResetButton' RunningSum = require '../services/RunningSum' +ShareGameService = require '../services/ShareGameService' SolutionService = require '../services/SolutionService' Title = require '../services/Title' TrackingService = require '../services/TrackingService' @@ -23,7 +24,6 @@ class MathSwipeController constructor: -> @gameScene = @createGameScene() @symbols = @getSymbols() - @initialize() @bindNewGameButton() HowToPlay.createHowToPlay @isMobile if @isMobile().any()? @@ -32,6 +32,8 @@ class MathSwipeController else TrackingService.desktopView() @cursorToPointer() + ShareGameService.setMessage() + @initialize() # # Uncomment the following line to perform general tests # GeneralTests.tests @board diff --git a/app/services/ShareGameService.coffee b/app/services/ShareGameService.coffee new file mode 100644 index 0000000..75ca1ff --- /dev/null +++ b/app/services/ShareGameService.coffee @@ -0,0 +1,8 @@ +TwitterGameService = require './TwitterGameService' + +class ShareGameService + + @setMessage: -> + TwitterGameService.setTweet() + +module.exports = ShareGameService diff --git a/app/services/TwitterGameService.coffee b/app/services/TwitterGameService.coffee new file mode 100644 index 0000000..aeb8702 --- /dev/null +++ b/app/services/TwitterGameService.coffee @@ -0,0 +1,12 @@ +$ = require 'jquery' + +class TwitterGameService + + @setTweet: -> + possible = ['Play MathSwipe with me! Try to beat my score at', + 'Play MathSwipe with me! Try to solve my board at', + 'Play MathSwipe with me! Solve my puzzle at'] + text = possible[Math.floor(Math.random() * 3)] + $( '#tweet' ).attr( 'data-text' , text ) + +module.exports = TwitterGameService diff --git a/bundle.js b/bundle.js index 995ccf4..786b6f4 100644 --- a/bundle.js +++ b/bundle.js @@ -65,7 +65,7 @@ Tuple = __webpack_require__(/*! ./app/models/Tuple */ 5); - Two = __webpack_require__(/*! two.js */ 24); + Two = __webpack_require__(/*! two.js */ 25); game = new MathSwipeController; @@ -9296,7 +9296,7 @@ \****************************************************/ /***/ function(module, exports, __webpack_require__) { - var $, AdjacentCellsCalculator, Board, BoardSolvedService, Cell, ClickHandler, Colors, DFS, ExpressionGenerator, GeneralTests, GoalContainer, HowToPlay, InputSolver, MathSwipeController, RandomizedFitLength, ResetButton, RunningSum, SolutionService, Title, TrackingService; + var $, AdjacentCellsCalculator, Board, BoardSolvedService, Cell, ClickHandler, Colors, DFS, ExpressionGenerator, GeneralTests, GoalContainer, HowToPlay, InputSolver, MathSwipeController, RandomizedFitLength, ResetButton, RunningSum, ShareGameService, SolutionService, Title, TrackingService; $ = __webpack_require__(/*! jquery */ 2); @@ -9320,27 +9320,28 @@ RunningSum = __webpack_require__(/*! ../services/RunningSum */ 16); - SolutionService = __webpack_require__(/*! ../services/SolutionService */ 17); + ShareGameService = __webpack_require__(/*! ../services/ShareGameService */ 17); - Title = __webpack_require__(/*! ../services/Title */ 18); + SolutionService = __webpack_require__(/*! ../services/SolutionService */ 18); + + Title = __webpack_require__(/*! ../services/Title */ 19); TrackingService = __webpack_require__(/*! ../services/TrackingService */ 8); - Board = __webpack_require__(/*! ../views/Board */ 19); + Board = __webpack_require__(/*! ../views/Board */ 20); - Cell = __webpack_require__(/*! ../views/Cell */ 20); + Cell = __webpack_require__(/*! ../views/Cell */ 21); - Colors = __webpack_require__(/*! ../views/Colors */ 21); + Colors = __webpack_require__(/*! ../views/Colors */ 22); - GoalContainer = __webpack_require__(/*! ../views/GoalContainer */ 22); + GoalContainer = __webpack_require__(/*! ../views/GoalContainer */ 23); - GeneralTests = __webpack_require__(/*! ../../tests/controllers/GeneralTests */ 23); + GeneralTests = __webpack_require__(/*! ../../tests/controllers/GeneralTests */ 24); MathSwipeController = (function() { function MathSwipeController() { this.gameScene = this.createGameScene(); this.symbols = this.getSymbols(); - this.initialize(); this.bindNewGameButton(); HowToPlay.createHowToPlay(this.isMobile); if (this.isMobile().any() != null) { @@ -9350,6 +9351,8 @@ TrackingService.desktopView(); this.cursorToPointer(); } + ShareGameService.setMessage(); + this.initialize(); } MathSwipeController.prototype.initialize = function() { @@ -10351,6 +10354,34 @@ /***/ }, /* 17 */ +/*!**********************************************!*\ + !*** ./app/services/ShareGameService.coffee ***! + \**********************************************/ +/***/ function(module, exports, __webpack_require__) { + + var $, ShareGameService; + + $ = __webpack_require__(/*! jquery */ 2); + + ShareGameService = (function() { + function ShareGameService() {} + + ShareGameService.setMessage = function() { + var possible, text; + possible = ['Play MathSwipe with me! Try to beat my score at', 'Play MathSwipe with me! Try to solve my board at', 'Play MathSwipe with me! Solve my puzzle at']; + text = possible[Math.floor(Math.random() * 3)]; + return $('#tweet').attr('data-text', text); + }; + + return ShareGameService; + + })(); + + module.exports = ShareGameService; + + +/***/ }, +/* 18 */ /*!*********************************************!*\ !*** ./app/services/SolutionService.coffee ***! \*********************************************/ @@ -10421,7 +10452,7 @@ /***/ }, -/* 18 */ +/* 19 */ /*!***********************************!*\ !*** ./app/services/Title.coffee ***! \***********************************/ @@ -10448,7 +10479,7 @@ /***/ }, -/* 19 */ +/* 20 */ /*!********************************!*\ !*** ./app/views/Board.coffee ***! \********************************/ @@ -10667,7 +10698,7 @@ /***/ }, -/* 20 */ +/* 21 */ /*!*******************************!*\ !*** ./app/views/Cell.coffee ***! \*******************************/ @@ -10677,7 +10708,7 @@ $ = __webpack_require__(/*! jquery */ 2); - Colors = __webpack_require__(/*! ./Colors */ 21); + Colors = __webpack_require__(/*! ./Colors */ 22); Cell = (function() { function Cell(col1, row1, size, scene, board, clickHandler, symbolBlueprint) { @@ -10875,7 +10906,7 @@ /***/ }, -/* 21 */ +/* 22 */ /*!*********************************!*\ !*** ./app/views/Colors.coffee ***! \*********************************/ @@ -10898,7 +10929,7 @@ /***/ }, -/* 22 */ +/* 23 */ /*!****************************************!*\ !*** ./app/views/GoalContainer.coffee ***! \****************************************/ @@ -10953,7 +10984,7 @@ /***/ }, -/* 23 */ +/* 24 */ /*!***********************************************!*\ !*** ./tests/controllers/GeneralTests.coffee ***! \***********************************************/ @@ -11052,7 +11083,7 @@ /***/ }, -/* 24 */ +/* 25 */ /*!*******************************!*\ !*** ./~/two.js/build/two.js ***! \*******************************/ diff --git a/index.html b/index.html index ed97b14..b7c1082 100644 --- a/index.html +++ b/index.html @@ -28,8 +28,10 @@