Merge branch 'QuincyLarson-learn-button' into learn-button
This commit is contained in:
@ -604,7 +604,7 @@
|
|||||||
"difficulty": "9.9817",
|
"difficulty": "9.9817",
|
||||||
"description": [
|
"description": [
|
||||||
"<code>pop()</code> always removes the last element of an array. What if you want to remove the first? That's where <code>.shift()</code> comes in.",
|
"<code>pop()</code> always removes the last element of an array. What if you want to remove the first? That's where <code>.shift()</code> comes in.",
|
||||||
"Take the myArray array and <code>shift()</code> the first value off of it."
|
"Take the myArray array and <code>shift()</code> the first value off of it. Set <code>myRemoved</code> to the first value of <code>myArray</code> using <code>shift()</code>."
|
||||||
],
|
],
|
||||||
"tests": [
|
"tests": [
|
||||||
"assert((function(d){if(d[0] == 23 && d[1][0] == 'dog' && d[1][1] == 3 && d[2] == undefined){return true;}else{return false;}})(myArray), 'myArray should only have the last two values left([23, [\"dog\", 3]])');",
|
"assert((function(d){if(d[0] == 23 && d[1][0] == 'dog' && d[1][1] == 3 && d[2] == undefined){return true;}else{return false;}})(myArray), 'myArray should only have the last two values left([23, [\"dog\", 3]])');",
|
||||||
@ -1022,7 +1022,7 @@
|
|||||||
"<code>g</code> means that we want to search the entire string for this pattern instead of just the first match.",
|
"<code>g</code> means that we want to search the entire string for this pattern instead of just the first match.",
|
||||||
"<code>i</code> means that we want to ignore the case (uppercase or lowercase) when searching for the pattern.",
|
"<code>i</code> means that we want to ignore the case (uppercase or lowercase) when searching for the pattern.",
|
||||||
"<code>Regular expressions</code> are written by surrounding the pattern with a <code>/</code> symbol.",
|
"<code>Regular expressions</code> are written by surrounding the pattern with a <code>/</code> symbol.",
|
||||||
"Let's try selecting all the occurrences of the word <code>and</code> in the string <code>George Boole and Alan Turing went to the shop and got some milk</code>. We can do this by replacing the <code>...</code> part of our regular expression with the current <code>regular expression</code> with the word <code>and</code>."
|
"Let's try selecting all the occurrences of the word <code>and</code> in the string <code>George Boole and Alan Turing went to the shop and got some milk</code>. We can do this by replacing the <code>.</code> part of our regular expression with the current <code>regular expression</code> with the word <code>and</code>."
|
||||||
],
|
],
|
||||||
"tests":[
|
"tests":[
|
||||||
"assert(test==2, 'Your <code>regular expression</code> should find two occurrences of the word <code>and</code>');",
|
"assert(test==2, 'Your <code>regular expression</code> should find two occurrences of the word <code>and</code>');",
|
||||||
@ -1109,7 +1109,7 @@
|
|||||||
"title": "Invert Regular Expression Matches with JavaScript",
|
"title": "Invert Regular Expression Matches with JavaScript",
|
||||||
"difficulty":"9.987",
|
"difficulty":"9.987",
|
||||||
"description":[
|
"description":[
|
||||||
"Use <code>/\\S/gi;</code> to match everything that isn't a space in the string.",
|
"Use <code>/\\S/gi</code> to match everything that isn't a space in the string.",
|
||||||
"You can invert any match by using the uppercase version of the selector <code>\\s</code> versus <code>\\S</code> for example."
|
"You can invert any match by using the uppercase version of the selector <code>\\s</code> versus <code>\\S</code> for example."
|
||||||
],
|
],
|
||||||
"tests":[
|
"tests":[
|
||||||
|
@ -2842,10 +2842,10 @@
|
|||||||
"Give the green box a <code>padding</code> of <code>40px</code> on its top and left side, but only <code>20px</code> on its bottom and right side."
|
"Give the green box a <code>padding</code> of <code>40px</code> on its top and left side, but only <code>20px</code> on its bottom and right side."
|
||||||
],
|
],
|
||||||
"tests": [
|
"tests": [
|
||||||
"assert($(\".green-box\").css(\"padding-top\") === \"40px\", 'Your <code>green-box</code> class should give the top of elements <code>40px</code> of <code>padding</code>.')",
|
"assert($(\".green-box\").css(\"padding-top\") === \"40px\", 'Your <code>green-box</code> class should give the top of the elements <code>40px</code> of <code>padding</code>.')",
|
||||||
"assert($(\".green-box\").css(\"padding-left\") === \"40px\", 'Your <code>green-box</code> class should give the left of elements <code>40px</code> of <code>padding</code>.')",
|
"assert($(\".green-box\").css(\"padding-left\") === \"40px\", 'Your <code>green-box</code> class should give the left of the elements <code>40px</code> of <code>padding</code>.')",
|
||||||
"assert($(\".green-box\").css(\"padding-right\") === \"20px\", 'Your <code>green-box</code> class should give the right of elements <code>20px</code> of <code>padding</code>.')",
|
"assert($(\".green-box\").css(\"padding-right\") === \"20px\", 'Your <code>green-box</code> class should give the right of the elements <code>20px</code> of <code>padding</code>.')",
|
||||||
"assert($(\".green-box\").css(\"padding-bottom\") === \"20px\", 'Your <code>green-box</code> class should give the bottom of elements <code>20px</code> of <code>padding</code>.')"
|
"assert($(\".green-box\").css(\"padding-bottom\") === \"20px\", 'Your <code>green-box</code> class should give the bottom of the elements <code>20px</code> of <code>padding</code>.')"
|
||||||
],
|
],
|
||||||
"challengeSeed": [
|
"challengeSeed": [
|
||||||
"<style>",
|
"<style>",
|
||||||
|
@ -14,7 +14,6 @@ import {
|
|||||||
|
|
||||||
import {
|
import {
|
||||||
userMigration,
|
userMigration,
|
||||||
ifNoUserRedirectTo,
|
|
||||||
ifNoUserSend
|
ifNoUserSend
|
||||||
} from '../utils/middleware';
|
} from '../utils/middleware';
|
||||||
|
|
||||||
@ -100,9 +99,6 @@ module.exports = function(app) {
|
|||||||
const userCount$ = observeMethod(User, 'count');
|
const userCount$ = observeMethod(User, 'count');
|
||||||
|
|
||||||
const send200toNonUser = ifNoUserSend(true);
|
const send200toNonUser = ifNoUserSend(true);
|
||||||
const redirectNonUser = ifNoUserRedirectTo(
|
|
||||||
'/map'
|
|
||||||
);
|
|
||||||
|
|
||||||
router.post(
|
router.post(
|
||||||
'/completed-challenge/',
|
'/completed-challenge/',
|
||||||
@ -125,18 +121,11 @@ module.exports = function(app) {
|
|||||||
router.get('/map', challengeMap);
|
router.get('/map', challengeMap);
|
||||||
router.get(
|
router.get(
|
||||||
'/challenges/next-challenge',
|
'/challenges/next-challenge',
|
||||||
redirectNonUser,
|
|
||||||
returnNextChallenge
|
returnNextChallenge
|
||||||
);
|
);
|
||||||
|
|
||||||
router.get('/challenges/:challengeName', returnIndividualChallenge);
|
router.get('/challenges/:challengeName', returnIndividualChallenge);
|
||||||
|
|
||||||
router.get(
|
|
||||||
'/challenges/',
|
|
||||||
redirectNonUser,
|
|
||||||
returnCurrentChallenge
|
|
||||||
);
|
|
||||||
|
|
||||||
app.use(router);
|
app.use(router);
|
||||||
|
|
||||||
function returnNextChallenge(req, res, next) {
|
function returnNextChallenge(req, res, next) {
|
||||||
@ -203,7 +192,7 @@ module.exports = function(app) {
|
|||||||
function() {
|
function() {
|
||||||
debug('next challengeName', nextChallengeName);
|
debug('next challengeName', nextChallengeName);
|
||||||
if (!nextChallengeName || nextChallengeName === firstChallenge) {
|
if (!nextChallengeName || nextChallengeName === firstChallenge) {
|
||||||
req.flash('errors', {
|
req.flash('info', {
|
||||||
msg: dedent`
|
msg: dedent`
|
||||||
Once you have completed all of our challenges, you should
|
Once you have completed all of our challenges, you should
|
||||||
join our <a href=\"//gitter.im/freecodecamp/HalfWayClub\"
|
join our <a href=\"//gitter.im/freecodecamp/HalfWayClub\"
|
||||||
@ -218,34 +207,6 @@ module.exports = function(app) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function returnCurrentChallenge(req, res, next) {
|
|
||||||
Observable.just(req.user)
|
|
||||||
.flatMap(user => {
|
|
||||||
if (!req.user.currentChallenge) {
|
|
||||||
return challenge$
|
|
||||||
.first()
|
|
||||||
.flatMap(challenge => {
|
|
||||||
user.currentChallenge = {
|
|
||||||
challengeId: challenge.id,
|
|
||||||
challengeName: challenge.name,
|
|
||||||
dashedName: challenge.dashedName
|
|
||||||
};
|
|
||||||
return saveUser(user);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
return Observable.just(user);
|
|
||||||
})
|
|
||||||
.map(user => user.currentChallenge.dashedName)
|
|
||||||
.subscribe(
|
|
||||||
function(challengeName) {
|
|
||||||
res.redirect('/challenges/' + challengeName);
|
|
||||||
},
|
|
||||||
next,
|
|
||||||
function() {
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
function returnIndividualChallenge(req, res, next) {
|
function returnIndividualChallenge(req, res, next) {
|
||||||
const origChallengeName = req.params.challengeName;
|
const origChallengeName = req.params.challengeName;
|
||||||
const unDashedName = unDasherize(origChallengeName);
|
const unDashedName = unDasherize(origChallengeName);
|
||||||
@ -280,18 +241,8 @@ module.exports = function(app) {
|
|||||||
return Observable.just('/challenges/' + dasherize(challenge.name));
|
return Observable.just('/challenges/' + dasherize(challenge.name));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (challenge) {
|
|
||||||
if (req.user) {
|
|
||||||
req.user.currentChallenge = {
|
|
||||||
challengeId: challenge.id,
|
|
||||||
challengeName: challenge.name,
|
|
||||||
dashedName: challenge.dashedName
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
// save user does nothing if user does not exist
|
// save user does nothing if user does not exist
|
||||||
return saveUser(req.user)
|
return Observable.just({
|
||||||
.map(() => ({
|
|
||||||
title: challenge.name,
|
title: challenge.name,
|
||||||
dashedName: origChallengeName,
|
dashedName: origChallengeName,
|
||||||
name: challenge.name,
|
name: challenge.name,
|
||||||
@ -312,8 +263,7 @@ module.exports = function(app) {
|
|||||||
MDNlinks: getMDNLinks(challenge.MDNlinks),
|
MDNlinks: getMDNLinks(challenge.MDNlinks),
|
||||||
// htmls specific
|
// htmls specific
|
||||||
environment: utils.whichEnvironment()
|
environment: utils.whichEnvironment()
|
||||||
}));
|
});
|
||||||
}
|
|
||||||
})
|
})
|
||||||
.subscribe(
|
.subscribe(
|
||||||
function(data) {
|
function(data) {
|
||||||
|
@ -114,6 +114,7 @@ block content
|
|||||||
var challenge_Name = !{JSON.stringify(name)};
|
var challenge_Name = !{JSON.stringify(name)};
|
||||||
var started = Math.floor(Date.now());
|
var started = Math.floor(Date.now());
|
||||||
var challengeType = !{JSON.stringify(challengeType)};
|
var challengeType = !{JSON.stringify(challengeType)};
|
||||||
|
var dashedName = !{JSON.stringify(dashedName)};
|
||||||
var _ = R;
|
var _ = R;
|
||||||
var dashed = !{JSON.stringify(dashedName)};
|
var dashed = !{JSON.stringify(dashedName)};
|
||||||
|
|
||||||
@ -140,14 +141,14 @@ block content
|
|||||||
.spacer
|
.spacer
|
||||||
.row
|
.row
|
||||||
if (user)
|
if (user)
|
||||||
#submit-challenge.animated.fadeIn.btn.btn-lg.btn-primary.btn-block Submit and go to next challenge
|
#submit-challenge.animated.fadeIn.btn.btn-lg.btn-primary.btn-block Submit and go to my next challenge
|
||||||
|
|
||||||
if (user.progressTimestamps.length > 2)
|
if (user.progressTimestamps.length > 2)
|
||||||
a.animated.fadeIn.btn.btn-lg.btn-block.btn-twitter(target="_blank", href="https://twitter.com/intent/tweet?text=I%20just%20#{verb}%20%40FreeCodeCamp%20#{name}&url=http%3A%2F%2Ffreecodecamp.com/challenges/#{dashedName}&hashtags=LearnToCode, JavaScript")
|
a.animated.fadeIn.btn.btn-lg.btn-block.btn-twitter(target="_blank", href="https://twitter.com/intent/tweet?text=I%20just%20#{verb}%20%40FreeCodeCamp%20#{name}&url=http%3A%2F%2Ffreecodecamp.com/challenges/#{dashedName}&hashtags=LearnToCode, JavaScript")
|
||||||
i.fa.fa-twitter  
|
i.fa.fa-twitter  
|
||||||
= phrase
|
= phrase
|
||||||
else
|
else
|
||||||
a.animated.fadeIn.btn.btn-lg.signup-btn.btn-block(href='/login') Sign in so you can save your progress
|
a.animated.fadeIn.btn.btn-lg.btn-primary.btn-block(href='/challenges/next-challenge?id=' + challengeId) Go to my next challenge
|
||||||
#reset-modal.modal(tabindex='-1')
|
#reset-modal.modal(tabindex='-1')
|
||||||
.modal-dialog.animated.fadeInUp.fast-animation
|
.modal-dialog.animated.fadeInUp.fast-animation
|
||||||
.modal-content
|
.modal-content
|
||||||
|
@ -62,6 +62,7 @@ block content
|
|||||||
var challenge_Id = !{JSON.stringify(challengeId)};
|
var challenge_Id = !{JSON.stringify(challengeId)};
|
||||||
var challenge_Name = !{JSON.stringify(name)};
|
var challenge_Name = !{JSON.stringify(name)};
|
||||||
var prodOrDev = !{JSON.stringify(environment)};
|
var prodOrDev = !{JSON.stringify(environment)};
|
||||||
|
var dashedName = !{JSON.stringify(dashedName)};
|
||||||
var challengeType = !{JSON.stringify(challengeType)};
|
var challengeType = !{JSON.stringify(challengeType)};
|
||||||
var started = Math.floor(Date.now());
|
var started = Math.floor(Date.now());
|
||||||
.col-xs-12.col-sm-12.col-md-5.col-lg-6
|
.col-xs-12.col-sm-12.col-md-5.col-lg-6
|
||||||
@ -91,7 +92,7 @@ block content
|
|||||||
span.completion-icon.ion-checkmark-circled.text-primary
|
span.completion-icon.ion-checkmark-circled.text-primary
|
||||||
.spacer
|
.spacer
|
||||||
if(user)
|
if(user)
|
||||||
#submit-challenge.animated.fadeIn.btn.btn-lg.btn-primary.btn-block Submit and go to next challenge
|
#submit-challenge.animated.fadeIn.btn.btn-lg.btn-primary.btn-block Submit and go to my next challenge
|
||||||
else
|
else
|
||||||
a.animated.fadeIn.btn.btn-lg.signup-btn.btn-block(href='/login') Sign in so you can save your progress
|
a.animated.fadeIn.btn.btn-lg.btn-primary.btn-block(href='/challenges/next-challenge?id=' + challengeId) Go to my next challenge
|
||||||
include ../partials/challenge-modals
|
include ../partials/challenge-modals
|
||||||
|
@ -61,6 +61,7 @@ block content
|
|||||||
var challengeSeed = !{JSON.stringify(challengeSeed)};
|
var challengeSeed = !{JSON.stringify(challengeSeed)};
|
||||||
var challenge_Id = !{JSON.stringify(challengeId)};
|
var challenge_Id = !{JSON.stringify(challengeId)};
|
||||||
var challenge_Name = !{JSON.stringify(name)};
|
var challenge_Name = !{JSON.stringify(name)};
|
||||||
|
var dashedName = !{JSON.stringify(dashedName)};
|
||||||
var started = Math.floor(Date.now());
|
var started = Math.floor(Date.now());
|
||||||
var challengeType = !{JSON.stringify(challengeType)};
|
var challengeType = !{JSON.stringify(challengeType)};
|
||||||
var _ = R;
|
var _ = R;
|
||||||
@ -93,7 +94,7 @@ block content
|
|||||||
i.fa.fa-twitter  
|
i.fa.fa-twitter  
|
||||||
= phrase
|
= phrase
|
||||||
else
|
else
|
||||||
a.animated.fadeIn.btn.btn-lg.signup-btn.btn-block(href='/login') Sign in so you can save your progress
|
a.animated.fadeIn.btn.btn-lg.btn-primary.btn-block(href='/challenges/next-challenge?id=' + challengeId) Go to my next challenge
|
||||||
include ../partials/challenge-modals
|
include ../partials/challenge-modals
|
||||||
script.
|
script.
|
||||||
var MDNlinks = !{JSON.stringify(MDNlinks)};
|
var MDNlinks = !{JSON.stringify(MDNlinks)};
|
||||||
|
@ -30,6 +30,8 @@ block content
|
|||||||
| Report a bug
|
| Report a bug
|
||||||
.button-spacer
|
.button-spacer
|
||||||
else
|
else
|
||||||
|
a.animated.fadeIn.btn.btn-big.btn-primary.btn-block(href='/challenges/next-challenge?id=' + challengeId) Go to my next challenge (ctrl + enter)
|
||||||
|
.button-spacer
|
||||||
a.btn.btn-big.signup-btn.btn-block(href='/login') Sign in so you can save your progress
|
a.btn.btn-big.signup-btn.btn-block(href='/login') Sign in so you can save your progress
|
||||||
script.
|
script.
|
||||||
var userLoggedIn = false;
|
var userLoggedIn = false;
|
||||||
@ -64,7 +66,7 @@ block content
|
|||||||
.animated.zoomInDown.delay-half
|
.animated.zoomInDown.delay-half
|
||||||
span.completion-icon.ion-checkmark-circled.text-primary
|
span.completion-icon.ion-checkmark-circled.text-primary
|
||||||
if (user)
|
if (user)
|
||||||
a.animated.fadeIn.btn.btn-lg.btn-primary.btn-block#next-courseware-button(name='_csrf', value=_csrf) On to my next challenge (ctrl + enter)
|
a.animated.fadeIn.btn.btn-lg.btn-primary.btn-block#next-courseware-button(name='_csrf', value=_csrf) Go to my next challenge
|
||||||
script.
|
script.
|
||||||
$('#complete-courseware-editorless-dialog').bind('keypress', modalControlEnterHandler);
|
$('#complete-courseware-editorless-dialog').bind('keypress', modalControlEnterHandler);
|
||||||
|
|
||||||
@ -74,12 +76,12 @@ block content
|
|||||||
i.fa.fa-twitter  
|
i.fa.fa-twitter  
|
||||||
= phrase
|
= phrase
|
||||||
else
|
else
|
||||||
a.animated.fadeIn.btn.btn-lg.signup-btn.btn-block(href='/login') Sign in so you can save your progress
|
a.animated.fadeIn.btn.btn-lg.btn-primary.btn-block(href='/challenges/next-challenge?id=' + challengeId) Go to my next challenge
|
||||||
h1 #{name}
|
|
||||||
script.
|
script.
|
||||||
$('body').bind('keypress', controlEnterHandler);
|
$('body').bind('keypress', controlEnterHandler);
|
||||||
script.
|
script.
|
||||||
var challenge_Id = !{JSON.stringify(challengeId)};
|
var challenge_Id = !{JSON.stringify(challengeId)};
|
||||||
var challenge_Name = !{JSON.stringify(name)};
|
var challenge_Name = !{JSON.stringify(name)};
|
||||||
var challengeType = !{JSON.stringify(challengeType)};
|
var challengeType = !{JSON.stringify(challengeType)};
|
||||||
|
var dashedName = !{JSON.stringify(dashedName)};
|
||||||
include ../partials/challenge-modals
|
include ../partials/challenge-modals
|
||||||
|
@ -33,7 +33,8 @@ block content
|
|||||||
script.
|
script.
|
||||||
var userLoggedIn = true;
|
var userLoggedIn = true;
|
||||||
else
|
else
|
||||||
a.btn.btn-lg.signup-btn.btn-block(href='/login') Sign in so you can save your progress
|
a.animated.fadeIn.btn.btn-big.btn-primary.btn-block(href='/challenges/next-challenge?id=' + challengeId) Go to my next challenge (ctrl + enter)
|
||||||
|
a.btn.btn-big.signup-btn.btn-block(href='/login') Sign in so you can save your progress
|
||||||
script.
|
script.
|
||||||
var userLoggedIn = false;
|
var userLoggedIn = false;
|
||||||
br
|
br
|
||||||
@ -41,6 +42,7 @@ block content
|
|||||||
var challenge_Id = !{JSON.stringify(challengeId)};
|
var challenge_Id = !{JSON.stringify(challengeId)};
|
||||||
var challenge_Name = !{JSON.stringify(name)};
|
var challenge_Name = !{JSON.stringify(name)};
|
||||||
var started = Math.floor(Date.now());
|
var started = Math.floor(Date.now());
|
||||||
|
var dashedName = !{JSON.stringify(dashedName)};
|
||||||
var challengeType = !{JSON.stringify(challengeType)};
|
var challengeType = !{JSON.stringify(challengeType)};
|
||||||
var controlEnterHandler = function (e) {
|
var controlEnterHandler = function (e) {
|
||||||
$('body').unbind('keypress');
|
$('body').unbind('keypress');
|
||||||
@ -87,11 +89,12 @@ block content
|
|||||||
| Username not found
|
| Username not found
|
||||||
|
|
||||||
if (user)
|
if (user)
|
||||||
a.animated.fadeIn.btn.btn-lg.btn-primary.btn-block#next-courseware-button(name='_csrf', value=_csrf, ng-disabled='completedWithForm.$invalid') Go to my next challenge (ctrl + enter)
|
a.animated.fadeIn.btn.btn-lg.btn-primary.btn-block#next-courseware-button(name='_csrf', value=_csrf, ng-disabled='completedWithForm.$invalid') Go to my next challenge
|
||||||
|
.button-spacer
|
||||||
script.
|
script.
|
||||||
$('#complete-zipline-or-basejump-dialog').on('keypress', modalControlEnterHandler);
|
$('#complete-zipline-or-basejump-dialog').on('keypress', modalControlEnterHandler);
|
||||||
else
|
else
|
||||||
a.animated.fadeIn.btn.btn-lg.signup-btn.btn-block(href='/login') Sign in so you can save your progress
|
a.animated.fadeIn.btn.btn-lg.btn-primary.btn-block(href='/challenges/next-challenge?id=' + challengeId) Go to my next challenge
|
||||||
script.
|
script.
|
||||||
$('body').on('keypress', controlEnterHandler);
|
$('body').on('keypress', controlEnterHandler);
|
||||||
include ../partials/challenge-modals
|
include ../partials/challenge-modals
|
||||||
|
@ -48,3 +48,6 @@
|
|||||||
a.btn.btn-lg.btn-info.btn-block#reset-button(href='#', data-dismiss='modal', aria-hidden='true') Clear my code
|
a.btn.btn-lg.btn-info.btn-block#reset-button(href='#', data-dismiss='modal', aria-hidden='true') Clear my code
|
||||||
a.btn.btn-lg.btn-primary.btn-block(href='#', data-dismiss='modal', aria-hidden='true') Cancel
|
a.btn.btn-lg.btn-primary.btn-block(href='#', data-dismiss='modal', aria-hidden='true') Cancel
|
||||||
script.
|
script.
|
||||||
|
if (typeof localStorage !== 'undefined') {
|
||||||
|
localStorage.setItem('currentDashedName', dashedName);
|
||||||
|
}
|
||||||
|
@ -8,7 +8,7 @@ nav.navbar.navbar-default.navbar-fixed-top.nav-height
|
|||||||
.collapse.navbar-collapse
|
.collapse.navbar-collapse
|
||||||
ul.nav.navbar-nav.navbar-right.hamburger-dropdown
|
ul.nav.navbar-nav.navbar-right.hamburger-dropdown
|
||||||
li
|
li
|
||||||
a(href='/challenges') Learn
|
a.learn-btn(href='#') Learn
|
||||||
li
|
li
|
||||||
a(href='/map') Map
|
a(href='/map') Map
|
||||||
li
|
li
|
||||||
@ -34,3 +34,19 @@ nav.navbar.navbar-default.navbar-fixed-top.nav-height
|
|||||||
.hidden-xs.hidden-sm
|
.hidden-xs.hidden-sm
|
||||||
a(href='/account')
|
a(href='/account')
|
||||||
img.profile-picture.float-right(src='#{user.picture}')
|
img.profile-picture.float-right(src='#{user.picture}')
|
||||||
|
script.
|
||||||
|
$(document).ready(function() {
|
||||||
|
$('.learn-btn').click(function(e) {
|
||||||
|
var challengeDashedName = null;
|
||||||
|
e.preventDefault();
|
||||||
|
if (typeof dashedName === "string") {
|
||||||
|
return location.reload();
|
||||||
|
}
|
||||||
|
if (typeof localStorage !== 'undefined') {
|
||||||
|
challengeDashedName = localStorage.getItem('currentDashedName');
|
||||||
|
}
|
||||||
|
window.location = challengeDashedName ?
|
||||||
|
'/challenges/' + challengeDashedName :
|
||||||
|
'/map';
|
||||||
|
});
|
||||||
|
});
|
||||||
|
Reference in New Issue
Block a user