diff --git a/controllers/challenges.js b/controllers/challenges.js index 83e5b09c58e..3e38ef7c825 100644 --- a/controllers/challenges.js +++ b/controllers/challenges.js @@ -7,6 +7,8 @@ var _ = require('lodash'); exports.returnChallenge = function(req, res, next) { var challengeNumber = parseInt(req.params.challengeNumber) || 0; + var verbs = ['ACED', 'NAILED', 'ROCKED', 'SCORCHED', 'DEVASTATED', 'OWNED', 'CRUSHED', 'CONQUERED', 'KILLED', 'SHREDDED', 'ANNIHILATED', 'NUKED'] + var phrases = ['Shout it from on top of a mountain', 'Tell everyone and their dogs', "Show them. Show them all!", "Inspire your friends", "Tell the world of your greatness", "Look accomplished on social media", 'Share news of your grand endeavor', 'Establish your alibi for the past two hours', "Prove to mom that computers aren't just for games"] if (challengeNumber > 59) { challengeNumber = 0; } Challenge.find({}, function (err, c) { if (err) { @@ -19,7 +21,10 @@ exports.returnChallenge = function(req, res, next) { video: c[challengeNumber].video, time: c[challengeNumber].time, steps: c[challengeNumber].steps, + number: challengeNumber, cc: req.user ? req.user.challengesHash : undefined, + verb: verbs[Math.floor(Math.random()*verbs.length)], + phrase: phrases[Math.floor(Math.random()*phrases.length)], challenges: c }); }); diff --git a/views/challenges/show.jade b/views/challenges/show.jade index 33f15599c92..2af4860aa50 100644 --- a/views/challenges/show.jade +++ b/views/challenges/show.jade @@ -34,6 +34,11 @@ block content .animated.zoomInUp.delay-1 span.landing-icon.ion-checkmark-circled.text-primary a.animated.fadeIn.delay-2.btn.btn-lg.btn-primary.btn-block.next-button(name='_csrf', value=_csrf, aria-hidden='true') Take me to my next challenge + if (cc && cc[2] > 0) + a.animated.fadeIn.delay-2.btn-twitter.btn.btn-lg.btn-info.btn-block(href="https://twitter.com/intent/tweet?text=I%20just%20#{verb}%20Free%20Code%20Camp%20Challenge%20%23#{number}:%20#{name}&url=http%3A%2F%2Ffreecodecamp.com/challenges/#{number}&hashtags=learntocode, javascript") + i.fa.fa-twitter   + = phrase + #skip-dialog.modal .modal-dialog.animated.zoomIn.fast-animation .modal-content