Merge pull request #4223 from FreeCodeCamp/feature/head-tail-challenges
Add head/tail to challenges spec
This commit is contained in:
@ -1,2 +1 @@
|
||||
public/**/*.js
|
||||
client/main.js
|
||||
|
@ -7,23 +7,25 @@ var common = (function() {
|
||||
init: []
|
||||
};
|
||||
|
||||
common.challengeName = common.challengeName || window.challenge_Name ?
|
||||
window.challenge_Name :
|
||||
'';
|
||||
common.challengeName = common.challengeName || window.challenge_Name || '';
|
||||
|
||||
common.challengeType = common.challengeType || window.challengeType ?
|
||||
window.challengeType :
|
||||
0;
|
||||
common.challengeType = common.challengeType || window.challengeType || 0;
|
||||
|
||||
common.challengeId = common.challengeId || window.challenge_Id;
|
||||
|
||||
common.challengeSeed = common.challengeSeed || window.challengeSeed ?
|
||||
window.challengeSeed :
|
||||
[];
|
||||
common.challengeSeed = common.challengeSeed || window.challengeSeed || [];
|
||||
|
||||
common.seed = common.challengeSeed.reduce(function(seed, line) {
|
||||
return seed + line + '\n';
|
||||
common.head = common.head || '';
|
||||
common.tail = common.tail || '';
|
||||
|
||||
common.arrayToNewLineString = function arrayToNewLineString(seedData) {
|
||||
seedData = Array.isArray(seedData) ? seedData : [seedData];
|
||||
return seedData.reduce(function(seed, line) {
|
||||
return '' + seed + line + '\n';
|
||||
}, '');
|
||||
};
|
||||
|
||||
common.seed = common.arrayToNewLineString(common.challengeSeed);
|
||||
|
||||
common.replaceScriptTags = function replaceScriptTags(value) {
|
||||
return value
|
||||
@ -482,7 +484,7 @@ var editor = (function(CodeMirror, emmetCodeMirror, common) {
|
||||
}(window.CodeMirror, window.emmetCodeMirror, common));
|
||||
|
||||
|
||||
var tests = tests || [];
|
||||
var tests = common.tests || [];
|
||||
|
||||
var libraryIncludes =
|
||||
"<script src='//ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js'>" +
|
||||
@ -873,17 +875,8 @@ function updatePreview() {
|
||||
}
|
||||
}
|
||||
|
||||
if (typeof prodOrDev !== 'undefined') {
|
||||
|
||||
/* eslint-disable no-unused-vars */
|
||||
var nodeEnv = window.prodOrDev === 'production' ?
|
||||
'http://www.freecodecamp.com' :
|
||||
'http://localhost:3001';
|
||||
/* eslint-enable no-unused-vars */
|
||||
|
||||
if (common.challengeType === '0') {
|
||||
if (common.challengeType === '0') {
|
||||
setTimeout(updatePreview, 300);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1119,7 +1112,10 @@ var reassembleTest = function(test, data) {
|
||||
};
|
||||
|
||||
var runTests = function(err, data) {
|
||||
var editorValue = editor.getValue();
|
||||
var head = common.arrayToNewLineString(common.head);
|
||||
var tail = common.arrayToNewLineString(common.tail);
|
||||
|
||||
var editorValue = head + editor.getValue() + tail;
|
||||
// userTests = userTests ? null : [];
|
||||
var allTestsPassed = true;
|
||||
pushed = false;
|
||||
@ -1371,6 +1367,8 @@ common.init.push((function() {
|
||||
}(window.$)));
|
||||
|
||||
function bonfireExecute(shouldTest) {
|
||||
var head = common.arrayToNewLineString(common.head);
|
||||
var tail = common.arrayToNewLineString(common.tail);
|
||||
var codeOutput = common.codeOutput;
|
||||
initPreview = false;
|
||||
goodTests = 0;
|
||||
@ -1383,7 +1381,7 @@ function bonfireExecute(shouldTest) {
|
||||
common.challengeType !== '0' &&
|
||||
!editor.getValue().match(/\$\s*?\(\s*?\$\s*?\)/gi)
|
||||
) {
|
||||
var userJavaScript = editor.getValue();
|
||||
var userJavaScript = head + editor.getValue() + tail;
|
||||
var failedCommentTest = false;
|
||||
|
||||
var openingComments = userJavaScript.match(/\/\*/gi);
|
||||
@ -1502,7 +1500,7 @@ $(document).ready(function() {
|
||||
bonfireExecute(true);
|
||||
}
|
||||
});
|
||||
} else if (common.challengeType !== 7) {
|
||||
} else if (common.challengeType !== '7' && common.challengeType !== '2') {
|
||||
bonfireExecute(true);
|
||||
}
|
||||
|
||||
|
563
client/main.js
563
client/main.js
@ -4,6 +4,15 @@ main.mapShareKey = 'map-shares';
|
||||
|
||||
main.ga = window.ga || function() {};
|
||||
|
||||
main.challengeTypes = {
|
||||
'HTML_CSS_JQ': '0',
|
||||
'JAVASCRIPT': '1',
|
||||
'VIDEO': '2',
|
||||
'ZIPLINE': '3',
|
||||
'BASEJUMP': '4',
|
||||
'BONFIRE': '5'
|
||||
};
|
||||
|
||||
main = (function(main) {
|
||||
|
||||
// should be set before gitter script loads
|
||||
@ -103,6 +112,44 @@ main = (function(main) {
|
||||
return main;
|
||||
}(main));
|
||||
|
||||
main.lockTop = function lockTop() {
|
||||
var magiVal;
|
||||
|
||||
if ($(window).width() >= 990) {
|
||||
if ($('.editorScrollDiv').html()) {
|
||||
|
||||
magiVal = $(window).height() -
|
||||
$('.navbar').height() +
|
||||
$('.footer').height();
|
||||
|
||||
if (magiVal < 0) {
|
||||
magiVal = 0;
|
||||
}
|
||||
$('.editorScrollDiv').css('height', magiVal - 85 + 'px');
|
||||
}
|
||||
|
||||
magiVal = $(window).height() -
|
||||
$('.navbar').height() +
|
||||
$('.footer').height();
|
||||
|
||||
if (magiVal < 0) {
|
||||
magiVal = 0;
|
||||
}
|
||||
|
||||
$('.scroll-locker')
|
||||
.css('min-height', $('.editorScrollDiv').height())
|
||||
.css('height', magiVal - 185);
|
||||
} else {
|
||||
$('.editorScrollDiv').css('max-height', 500 + 'px');
|
||||
|
||||
$('.scroll-locker')
|
||||
.css('position', 'inherit')
|
||||
.css('top', 'inherit')
|
||||
.css('width', '100%')
|
||||
.css('max-height', '85%');
|
||||
}
|
||||
};
|
||||
|
||||
var lastCompleted = typeof lastCompleted !== 'undefined' ?
|
||||
lastCompleted :
|
||||
'';
|
||||
@ -147,7 +194,7 @@ $(document).ready(function() {
|
||||
}
|
||||
|
||||
if (typeof editor !== 'undefined') {
|
||||
$('#reset-button').on('click', resetEditor);
|
||||
$('#reset-button').on('click', window.resetEditor);
|
||||
}
|
||||
|
||||
var CSRF_HEADER = 'X-CSRF-Token';
|
||||
@ -164,7 +211,7 @@ $(document).ready(function() {
|
||||
|
||||
$('.checklist-element').each(function() {
|
||||
var checklistElementId = $(this).attr('id');
|
||||
if(!!localStorage[checklistElementId]) {
|
||||
if (localStorage[checklistElementId]) {
|
||||
$(this).children().children('li').addClass('faded');
|
||||
$(this).children().children('input').trigger('click');
|
||||
}
|
||||
@ -179,13 +226,14 @@ $(document).ready(function() {
|
||||
|
||||
$('.challenge-list-checkbox').on('change', function() {
|
||||
var checkboxId = $(this).parent().parent().attr('id');
|
||||
if ($(this).is(":checked")) {
|
||||
if ($(this).is(':checked')) {
|
||||
$(this).parent().siblings().children().addClass('faded');
|
||||
if (!localStorage || !localStorage[checkboxId]) {
|
||||
localStorage[checkboxId] = true;
|
||||
}
|
||||
}
|
||||
if (!$(this).is(":checked")) {
|
||||
|
||||
if (!$(this).is(':checked')) {
|
||||
$(this).parent().siblings().children().removeClass('faded');
|
||||
if (localStorage[checkboxId]) {
|
||||
localStorage.removeItem(checkboxId);
|
||||
@ -193,14 +241,23 @@ $(document).ready(function() {
|
||||
}
|
||||
});
|
||||
|
||||
$("img").error(function () {
|
||||
$(this).unbind("error").attr("src", "https://s3.amazonaws.com/freecodecamp/camper-image-placeholder.png");
|
||||
$('img').error(function() {
|
||||
$(this)
|
||||
.unbind('error')
|
||||
.attr(
|
||||
'src',
|
||||
'https://s3.amazonaws.com/freecodecamp/camper-image-placeholder.png'
|
||||
);
|
||||
});
|
||||
|
||||
function reBindModals(){
|
||||
function reBindModals() {
|
||||
if (!window.common) {
|
||||
return;
|
||||
}
|
||||
var common = window.common;
|
||||
|
||||
$('.close-modal').unbind('click');
|
||||
$('.close-modal').on('click', function(){
|
||||
$('.close-modal').on('click', function() {
|
||||
setTimeout(function() {
|
||||
$('.close-modal').parent().parent().parent().parent().modal('hide');
|
||||
}, 200);
|
||||
@ -208,10 +265,14 @@ $(document).ready(function() {
|
||||
|
||||
$('#search-issue').unbind('click');
|
||||
$('#search-issue').on('click', function() {
|
||||
var queryIssue = window.location.href.toString().split('#?')[0];
|
||||
window.open('https://github.com/FreeCodeCamp/FreeCodeCamp/issues?q=' +
|
||||
'is:issue is:all ' + (challenge_Name || challengeName) + ' OR ' +
|
||||
queryIssue.substr(queryIssue.lastIndexOf('challenges/') + 11)
|
||||
var queryIssue = window.location.href.toString();
|
||||
window.open(
|
||||
'https://github.com/FreeCodeCamp/FreeCodeCamp/issues?q=' +
|
||||
'is:issue is:all ' +
|
||||
(common.challengeName) +
|
||||
' OR ' +
|
||||
queryIssue
|
||||
.substr(queryIssue.lastIndexOf('challenges/') + 11)
|
||||
.replace('/', ''), '_blank');
|
||||
});
|
||||
|
||||
@ -239,46 +300,65 @@ $(document).ready(function() {
|
||||
}
|
||||
|
||||
var request = createCORSRequest('post', 'https://api.github.com/gists');
|
||||
if (request) {
|
||||
if (!request) {
|
||||
return null;
|
||||
}
|
||||
|
||||
request.onload = function() {
|
||||
if (request.readyState === 4 &&
|
||||
if (
|
||||
request.readyState === 4 &&
|
||||
request.status === 201 &&
|
||||
request.statusText === 'Created') {
|
||||
gistWindow.location.href = JSON.parse(request.responseText)['html_url'];
|
||||
request.statusText === 'Created'
|
||||
) {
|
||||
gistWindow.location.href =
|
||||
JSON.parse(request.responseText)['html_url'];
|
||||
}
|
||||
};
|
||||
|
||||
var description = common.username ?
|
||||
'http://www.freecodecamp.com/' + common.username + ' \'s s' :
|
||||
'S';
|
||||
|
||||
var data = {
|
||||
description: (username ? 'http://www.freecodecamp.com/' + username +
|
||||
' \'s s' : 'S') + 'olution for ' + (challenge_Name || challengeName),
|
||||
description: description + 'olution for ' + common.challengeName,
|
||||
public: true,
|
||||
files: {}
|
||||
},
|
||||
queryIssue = window.location.href.toString().split('#?')[0],
|
||||
filename = queryIssue
|
||||
};
|
||||
var queryIssue = window.location.href.toString().split('#?')[0];
|
||||
var filename = queryIssue
|
||||
.substr(queryIssue.lastIndexOf('challenges/') + 11)
|
||||
.replace('/', '') + '.js';
|
||||
data['files'][filename] = {
|
||||
content: '// ' + (challenge_Name || challengeName) + '\n' +
|
||||
(username ? '// Author: @' + username + '\n' : '') +
|
||||
'// Challenge: ' + queryIssue + '\n' +
|
||||
|
||||
data.files[filename] = {
|
||||
content: '// ' +
|
||||
common.challengeName +
|
||||
'\n' +
|
||||
(common.username ? '// Author: @' + common.username + '\n' : '') +
|
||||
'// Challenge: ' +
|
||||
queryIssue +
|
||||
'\n' +
|
||||
'// Learn to Code at Free Code Camp (www.freecodecamp.com)' +
|
||||
'\n\n' + editor.getValue().trim()
|
||||
'\n\n' +
|
||||
window.editor.getValue().trim()
|
||||
};
|
||||
|
||||
request.send(JSON.stringify(data));
|
||||
}
|
||||
});
|
||||
|
||||
$('#help-ive-found-a-bug-wiki-article').unbind('click');
|
||||
$('#help-ive-found-a-bug-wiki-article').on('click', function() {
|
||||
window.open("https://github.com/FreeCodeCamp/FreeCodeCamp/wiki/Help-I've-Found-a-Bug", '_blank');
|
||||
window.open(
|
||||
'https://github.com/FreeCodeCamp/FreeCodeCamp/wiki/' +
|
||||
"Help-I've-Found-a-Bug",
|
||||
'_blank'
|
||||
);
|
||||
});
|
||||
|
||||
$('#report-issue').unbind('click');
|
||||
$('#report-issue').on('click', function() {
|
||||
var textMessage = [
|
||||
'Challenge [',
|
||||
(challenge_Name || challengeName || window.location.href),
|
||||
(common.challengeName || window.location.href),
|
||||
'](',
|
||||
window.location.href,
|
||||
') has an issue.\n',
|
||||
@ -289,14 +369,18 @@ $(document).ready(function() {
|
||||
'links to screenshots if possible.\n\n'
|
||||
].join('');
|
||||
|
||||
if (typeof editor !== 'undefined' && editor.getValue().trim()) {
|
||||
if (
|
||||
window.editor &&
|
||||
typeof window.editor.getValue === 'function' &&
|
||||
window.editor.getValue().trim()
|
||||
) {
|
||||
var type;
|
||||
switch (challengeType) {
|
||||
case challengeTypes.HTML_CSS_JQ:
|
||||
switch (common.challengeType) {
|
||||
case main.challengeTypes.HTML_CSS_JQ:
|
||||
type = 'html';
|
||||
break;
|
||||
case challengeTypes.JAVASCRIPT:
|
||||
case challengeTypes.BONFIRE:
|
||||
case main.challengeTypes.JAVASCRIPT:
|
||||
case main.challengeTypes.BONFIRE:
|
||||
type = 'javascript';
|
||||
break;
|
||||
default:
|
||||
@ -307,7 +391,7 @@ $(document).ready(function() {
|
||||
'My code:\n```',
|
||||
type,
|
||||
'\n',
|
||||
editor.getValue(),
|
||||
window.editor.getValue(),
|
||||
'\n```\n\n'
|
||||
].join('');
|
||||
}
|
||||
@ -360,105 +444,107 @@ $(document).ready(function() {
|
||||
$('#next-courseware-button').on('click', function() {
|
||||
$('#next-courseware-button').unbind('click');
|
||||
if ($('.signup-btn-nav').length < 1) {
|
||||
switch (challengeType) {
|
||||
case challengeTypes.HTML_CSS_JQ:
|
||||
case challengeTypes.JAVASCRIPT:
|
||||
case challengeTypes.VIDEO:
|
||||
$.post(
|
||||
'/completed-challenge/',
|
||||
{
|
||||
var data;
|
||||
var completedWith;
|
||||
var publicURL;
|
||||
switch (common.challengeType) {
|
||||
case main.challengeTypes.HTML_CSS_JQ:
|
||||
case main.challengeTypes.JAVASCRIPT:
|
||||
case main.challengeTypes.VIDEO:
|
||||
data = {
|
||||
challengeInfo: {
|
||||
challengeId: challenge_Id,
|
||||
challengeName: challenge_Name
|
||||
challengeId: common.challengeId,
|
||||
challengeName: common.challengeName
|
||||
}
|
||||
}).success(
|
||||
function(res) {
|
||||
if (res) {
|
||||
window.location.href = '/challenges/next-challenge?id=' + challenge_Id;
|
||||
};
|
||||
$.post('/completed-challenge/', data)
|
||||
.success(function(res) {
|
||||
if (!res) {
|
||||
return;
|
||||
}
|
||||
}).fail(
|
||||
function() {
|
||||
window.location.href="/challenges";
|
||||
}
|
||||
);
|
||||
window.location.href = '/challenges/next-challenge?id=' +
|
||||
common.challengeId;
|
||||
})
|
||||
.fail(function() {
|
||||
window.location.href = '/challenges';
|
||||
});
|
||||
|
||||
break;
|
||||
case challengeTypes.ZIPLINE:
|
||||
var didCompleteWith = $('#completed-with').val() || null;
|
||||
var publicURL = $('#public-url').val() || null;
|
||||
$.post(
|
||||
'/completed-zipline-or-basejump/',
|
||||
{
|
||||
case main.challengeTypes.ZIPLINE:
|
||||
completedWith = $('#completed-with').val() || null;
|
||||
publicURL = $('#public-url').val() || null;
|
||||
data = {
|
||||
challengeInfo: {
|
||||
challengeId: challenge_Id,
|
||||
challengeName: challenge_Name,
|
||||
completedWith: didCompleteWith,
|
||||
challengeId: common.challengeId,
|
||||
challengeName: common.challengeName,
|
||||
completedWith: completedWith,
|
||||
publicURL: publicURL,
|
||||
challengeType: challengeType
|
||||
challengeType: common.challengeType
|
||||
}
|
||||
}).success(
|
||||
function() {
|
||||
window.location.href = '/challenges/next-challenge?id=' + challenge_Id;
|
||||
}).fail(
|
||||
function() {
|
||||
};
|
||||
|
||||
$.post('/completed-zipline-or-basejump/', data)
|
||||
.success(function() {
|
||||
window.location.href = '/challenges/next-challenge?id=' +
|
||||
common.challengeId;
|
||||
})
|
||||
.fail(function() {
|
||||
window.location.href = '/challenges';
|
||||
});
|
||||
break;
|
||||
case challengeTypes.BASEJUMP:
|
||||
var didCompleteWith = $('#completed-with').val() || null;
|
||||
var publicURL = $('#public-url').val() || null;
|
||||
|
||||
case main.challengeTypes.BASEJUMP:
|
||||
completedWith = $('#completed-with').val() || null;
|
||||
publicURL = $('#public-url').val() || null;
|
||||
var githubURL = $('#github-url').val() || null;
|
||||
$.post(
|
||||
'/completed-zipline-or-basejump/',
|
||||
{
|
||||
data = {
|
||||
challengeInfo: {
|
||||
challengeId: challenge_Id,
|
||||
challengeName: challenge_Name,
|
||||
completedWith: didCompleteWith,
|
||||
challengeId: common.challengeId,
|
||||
challengeName: common.challengeName,
|
||||
completedWith: completedWith,
|
||||
publicURL: publicURL,
|
||||
githubURL: githubURL,
|
||||
challengeType: challengeType,
|
||||
challengeType: common.challengeType,
|
||||
verified: false
|
||||
}
|
||||
}).success(function() {
|
||||
window.location.href = '/challenges/next-challenge?id=' + challenge_Id;
|
||||
}).fail(function() {
|
||||
};
|
||||
$.post('/completed-zipline-or-basejump/', data)
|
||||
.success(function() {
|
||||
window.location.href = '/challenges/next-challenge?id=' +
|
||||
common.challengeId;
|
||||
})
|
||||
.fail(function() {
|
||||
window.location.replace(window.location.href);
|
||||
});
|
||||
break;
|
||||
case challengeTypes.BONFIRE:
|
||||
window.location.href = '/challenges/next-challenge?id=' + challenge_Id;
|
||||
|
||||
case main.challengeTypes.BONFIRE:
|
||||
window.location.href = '/challenges/next-challenge?id=' +
|
||||
common.challengeId;
|
||||
break;
|
||||
|
||||
default:
|
||||
console.log('Happy Coding!');
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$('#complete-courseware-dialog').on('hidden.bs.modal', function() {
|
||||
editor.focus();
|
||||
window.editor.focus();
|
||||
});
|
||||
|
||||
$('#complete-zipline-or-basejump').on('hidden.bs.modal', function() {
|
||||
editor.focus();
|
||||
window.editor.focus();
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
$(window).resize(function(){
|
||||
$(window).resize(function() {
|
||||
reBindModals();
|
||||
});
|
||||
|
||||
reBindModals();
|
||||
|
||||
var challengeTypes = {
|
||||
'HTML_CSS_JQ': '0',
|
||||
'JAVASCRIPT': '1',
|
||||
'VIDEO': '2',
|
||||
'ZIPLINE': '3',
|
||||
'BASEJUMP': '4',
|
||||
'BONFIRE': '5'
|
||||
};
|
||||
|
||||
function upvoteHandler(e) {
|
||||
e.preventDefault();
|
||||
var upvoteBtn = this;
|
||||
@ -474,16 +560,19 @@ $(document).ready(function() {
|
||||
}
|
||||
if (!alreadyUpvoted) {
|
||||
$.post('/stories/upvote', { id: id })
|
||||
.fail(function(xhr, textStatus, errorThrown) {
|
||||
.fail(function() {
|
||||
$(upvoteBtn).bind('click', upvoteHandler);
|
||||
})
|
||||
.done(function(data, textStatus, xhr) {
|
||||
$(upvoteBtn).text('Upvoted!').addClass('disabled');
|
||||
.done(function(data) {
|
||||
$(upvoteBtn)
|
||||
.text('Upvoted!')
|
||||
.addClass('disabled');
|
||||
|
||||
$('#storyRank').text(data.rank + " points");
|
||||
$('#storyRank').text(data.rank + ' points');
|
||||
});
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
$('#story-list').on('click', 'button.btn-upvote', upvoteHandler);
|
||||
|
||||
var storySubmitButtonHandler = function storySubmitButtonHandler() {
|
||||
@ -491,90 +580,120 @@ $(document).ready(function() {
|
||||
var link = $('#story-url').val();
|
||||
var headline = $('#story-title').val();
|
||||
var description = $('#description-box').val();
|
||||
|
||||
$('#story-submit').unbind('click');
|
||||
$.post('/stories/',
|
||||
{
|
||||
var data = {
|
||||
data: {
|
||||
link: link,
|
||||
headline: headline,
|
||||
timePosted: Date.now(),
|
||||
description: description,
|
||||
storyMetaDescription: storyMetaDescription,
|
||||
storyMetaDescription: main.storyMetaDescription,
|
||||
rank: 1,
|
||||
image: storyImage
|
||||
image: main.storyImage
|
||||
}
|
||||
})
|
||||
.fail(function (xhr, textStatus, errorThrown) {
|
||||
};
|
||||
|
||||
$('#story-submit').unbind('click');
|
||||
$.post('/stories/', data)
|
||||
.fail(function() {
|
||||
$('#story-submit').bind('click', storySubmitButtonHandler);
|
||||
})
|
||||
.done(function(data, textStatus, xhr) {
|
||||
.done(function(data) {
|
||||
window.location = '/stories/' + data.storyLink;
|
||||
});
|
||||
};
|
||||
|
||||
$('#story-submit').on('click', storySubmitButtonHandler);
|
||||
//fakeiphone positioning hotfix
|
||||
if($('.iphone-position').html() !==undefined || $('.iphone').html() !== undefined){
|
||||
var startIphonePosition = parseInt($('.iphone-position').css('top').replace('px', ''));
|
||||
var startIphone = parseInt($('.iphone').css('top').replace('px', ''));
|
||||
$(window).on('scroll', function(){
|
||||
if((($('.courseware-height').height() + $('.courseware-height').offset().top)-$(window).scrollTop()-$('.iphone-position').height()) <= 0){
|
||||
$('.iphone-position').css('top', startIphonePosition+(($('.courseware-height').height() + $('.courseware-height').offset().top)-$(window).scrollTop()-$('.iphone-position').height()));
|
||||
$('.iphone').css('top', startIphonePosition+(($('.courseware-height').height() + $('.courseware-height').offset().top)-$(window).scrollTop()-$('.iphone-position').height())+120);
|
||||
}
|
||||
else{
|
||||
|
||||
// fakeiphone positioning hotfix
|
||||
if (
|
||||
$('.iphone-position').html() ||
|
||||
$('.iphone').html()
|
||||
) {
|
||||
var startIphonePosition = parseInt(
|
||||
$('.iphone-position')
|
||||
.css('top')
|
||||
.replace('px', ''),
|
||||
10
|
||||
);
|
||||
|
||||
var startIphone = parseInt(
|
||||
$('.iphone')
|
||||
.css('top')
|
||||
.replace('px', ''),
|
||||
10
|
||||
);
|
||||
|
||||
$(window).on('scroll', function() {
|
||||
var courseHeight = $('.courseware-height').height();
|
||||
var courseTop = $('.courseware-height').offset().top;
|
||||
var windowScrollTop = $(window).scrollTop();
|
||||
var phoneHeight = $('.iphone-position').height();
|
||||
|
||||
if (courseHeight + courseTop - windowScrollTop - phoneHeight <= 0) {
|
||||
$('.iphone-position').css(
|
||||
'top',
|
||||
startIphonePosition +
|
||||
courseHeight +
|
||||
courseTop -
|
||||
windowScrollTop -
|
||||
phoneHeight
|
||||
);
|
||||
|
||||
$('.iphone').css(
|
||||
'top',
|
||||
startIphonePosition +
|
||||
courseHeight +
|
||||
courseTop -
|
||||
windowScrollTop -
|
||||
phoneHeight +
|
||||
120
|
||||
);
|
||||
} else {
|
||||
$('.iphone-position').css('top', startIphonePosition);
|
||||
$('.iphone').css('top', startIphone);
|
||||
}
|
||||
});
|
||||
}
|
||||
if($('.scroll-locker').html() != undefined){
|
||||
function lockTop(){
|
||||
if ($(window).width() >= 990) {
|
||||
if($('.editorScrollDiv').html() !== 'undefined'){
|
||||
var magiVal = $(window).height()-($('.navbar').height()+$('.footer').height());
|
||||
if(magiVal < 0){
|
||||
magiVal = 0;
|
||||
}
|
||||
$('.editorScrollDiv').css("height", (magiVal-85) + "px");
|
||||
}
|
||||
magiVal = $(window).height()-($('.navbar').height()+$('.footer').height());
|
||||
if(magiVal < 0){
|
||||
magiVal = 0;
|
||||
}
|
||||
|
||||
$('.scroll-locker').css("min-height", $('.editorScrollDiv').height()).css("height",magiVal-185);
|
||||
}
|
||||
else {
|
||||
$('.editorScrollDiv').css("max-height", 500 + "px");
|
||||
$('.scroll-locker').css('position', 'inherit').css('top', 'inherit').css('width', '100%').css('max-height', '85%');
|
||||
}
|
||||
}
|
||||
if ($('.scroll-locker').html()){
|
||||
lockTop();
|
||||
$(window).on('resize', function(){
|
||||
lockTop();
|
||||
if ($('.scroll-locker').html()) {
|
||||
|
||||
if ($('.scroll-locker').html()) {
|
||||
main.lockTop();
|
||||
$(window).on('resize', function() {
|
||||
main.lockTop();
|
||||
});
|
||||
$(window).on('scroll', function() {
|
||||
lockTop();
|
||||
main.lockTop();
|
||||
});
|
||||
}
|
||||
|
||||
var execInProgress = false;
|
||||
document.getElementById('scroll-locker').addEventListener('previewUpdateSpy', function(e){
|
||||
if (!execInProgress){
|
||||
execInProgress = true;
|
||||
setTimeout(function(){
|
||||
if($($('.scroll-locker').children()[0]).height()-800 > e.detail){
|
||||
$('.scroll-locker').scrollTop(e.detail);
|
||||
|
||||
// why is this not $???
|
||||
document
|
||||
.getElementById('scroll-locker')
|
||||
.addEventListener(
|
||||
'previewUpdateSpy',
|
||||
function(e) {
|
||||
if (execInProgress) {
|
||||
return null;
|
||||
}
|
||||
else {
|
||||
$('.scroll-locker').animate({"scrollTop":$($('.scroll-locker').children()[0]).height()}, 175);
|
||||
execInProgress = true;
|
||||
setTimeout(function() {
|
||||
if (
|
||||
$($('.scroll-locker').children()[0]).height() - 800 > e.detail
|
||||
) {
|
||||
$('.scroll-locker').scrollTop(e.detail);
|
||||
} else {
|
||||
var scrollTop = $($('.scroll-locker').children()[0]).height();
|
||||
|
||||
$('.scroll-locker').animate({ scrollTop: scrollTop }, 175);
|
||||
}
|
||||
execInProgress = false;
|
||||
}, 750);
|
||||
}
|
||||
}, false);
|
||||
},
|
||||
false
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@ -613,81 +732,80 @@ $(document).ready(function() {
|
||||
});
|
||||
});
|
||||
|
||||
function defCheck(a){
|
||||
if(a !== 'undefined'){return(true);}else{return(false);}
|
||||
}
|
||||
var profileValidation =
|
||||
window.angular.module('profileValidation', ['ui.bootstrap']);
|
||||
|
||||
var profileValidation = angular.module('profileValidation',
|
||||
['ui.bootstrap']);
|
||||
profileValidation.controller('profileValidationController', ['$scope', '$http',
|
||||
profileValidation.controller(
|
||||
'profileValidationController',
|
||||
[
|
||||
'$scope',
|
||||
'$http',
|
||||
function($scope, $http) {
|
||||
$http.get('/account/api').success(function(data) {
|
||||
$scope.user = data.user;
|
||||
$scope.user.username = $scope.user.username ? $scope.user.username.toLowerCase() : undefined;
|
||||
|
||||
$scope.user.username = $scope.user.username ?
|
||||
$scope.user.username.toLowerCase() :
|
||||
null;
|
||||
|
||||
$scope.storedUsername = data.user.username;
|
||||
$scope.storedEmail = data.user.email;
|
||||
$scope.user.email = $scope.user.email ? $scope.user.email.toLowerCase() : undefined;
|
||||
$scope.user.twitterHandle = $scope.user.twitterHandle ? $scope.user.twitterHandle.toLowerCase() : undefined;
|
||||
$scope.user.email = $scope.user.email ?
|
||||
$scope.user.email.toLowerCase() :
|
||||
null;
|
||||
|
||||
$scope.user.twitterHandle = $scope.user.twitterHandle ?
|
||||
$scope.user.twitterHandle.toLowerCase() :
|
||||
null;
|
||||
|
||||
$scope.asyncComplete = true;
|
||||
});
|
||||
}
|
||||
]);
|
||||
]
|
||||
);
|
||||
|
||||
profileValidation.controller('pairedWithController', ['$scope',
|
||||
function($scope) {
|
||||
$scope.existingUser = null;
|
||||
}
|
||||
]);
|
||||
profileValidation.controller(
|
||||
'pairedWithController',
|
||||
[
|
||||
'$scope',
|
||||
function($scope) { $scope.existingUser = null; }
|
||||
]
|
||||
);
|
||||
|
||||
profileValidation.controller('emailSignUpController', ['$scope',
|
||||
function($scope) {
|
||||
profileValidation.controller('emailSignUpController', function() {});
|
||||
|
||||
}
|
||||
]);
|
||||
profileValidation.controller('emailSignInController', function() {});
|
||||
|
||||
profileValidation.controller('emailSignInController', ['$scope',
|
||||
function($scope) {
|
||||
profileValidation.controller('URLSubmitController', function() {});
|
||||
|
||||
}
|
||||
]);
|
||||
profileValidation.controller('nonprofitFormController', function() {});
|
||||
|
||||
profileValidation.controller('URLSubmitController', ['$scope',
|
||||
function($scope) {
|
||||
profileValidation.controller(
|
||||
'doneWithFirst100HoursFormController',
|
||||
function() {}
|
||||
);
|
||||
|
||||
}
|
||||
]);
|
||||
profileValidation.controller('submitStoryController', function() {});
|
||||
|
||||
profileValidation.controller('nonprofitFormController', ['$scope',
|
||||
function($scope) {
|
||||
|
||||
}
|
||||
]);
|
||||
|
||||
profileValidation.controller('doneWithFirst100HoursFormController', ['$scope',
|
||||
function($scope) {
|
||||
|
||||
}
|
||||
]);
|
||||
|
||||
profileValidation.controller('submitStoryController', ['$scope',
|
||||
function($scope) {
|
||||
|
||||
}
|
||||
]);
|
||||
|
||||
profileValidation.directive('uniqueUsername', ['$http', function($http) {
|
||||
profileValidation.directive(
|
||||
'uniqueUsername',
|
||||
[
|
||||
'$http',
|
||||
function($http) {
|
||||
return {
|
||||
restrict: 'A',
|
||||
require: 'ngModel',
|
||||
link: function (scope, element, attrs, ngModel) {
|
||||
element.bind("keyup", function (event) {
|
||||
link: function(scope, element, attrs, ngModel) {
|
||||
|
||||
element.bind('keyup', function() {
|
||||
|
||||
ngModel.$setValidity('unique', true);
|
||||
var username = element.val();
|
||||
if (username) {
|
||||
var config = { params: { username: username } };
|
||||
$http
|
||||
.get('/api/users/exists', config)
|
||||
.success(function (result) {
|
||||
.success(function(result) {
|
||||
if (username === scope.storedUsername) {
|
||||
ngModel.$setValidity('unique', true);
|
||||
} else if (result.exists) {
|
||||
@ -698,21 +816,28 @@ profileValidation.directive('uniqueUsername', ['$http', function($http) {
|
||||
});
|
||||
}
|
||||
};
|
||||
}]);
|
||||
}
|
||||
]
|
||||
);
|
||||
|
||||
profileValidation.directive('existingUsername',
|
||||
['$http', function($http) {
|
||||
[
|
||||
'$http',
|
||||
function($http) {
|
||||
return {
|
||||
restrict: 'A',
|
||||
require: 'ngModel',
|
||||
link: function (scope, element, attrs, ngModel) {
|
||||
element.bind('keyup', function (event) {
|
||||
link: function(scope, element, attrs, ngModel) {
|
||||
|
||||
element.bind('keyup', function() {
|
||||
|
||||
if (element.val().length > 0) {
|
||||
ngModel.$setValidity('exists', false);
|
||||
} else {
|
||||
element.removeClass('ng-dirty');
|
||||
ngModel.$setPristine();
|
||||
}
|
||||
|
||||
var username = element.val();
|
||||
if (username) {
|
||||
var config = { params: { username: username } };
|
||||
@ -727,12 +852,16 @@ profileValidation.directive('existingUsername',
|
||||
};
|
||||
}]);
|
||||
|
||||
profileValidation.directive('uniqueEmail', ['$http', function($http) {
|
||||
profileValidation.directive(
|
||||
'uniqueEmail',
|
||||
[
|
||||
'$http',
|
||||
function($http) {
|
||||
return {
|
||||
restrict: 'A',
|
||||
require: 'ngModel',
|
||||
link: function getUnique (scope, element, attrs, ngModel) {
|
||||
element.bind("keyup", function (event) {
|
||||
link: function getUnique(scope, element, attrs, ngModel) {
|
||||
element.bind('keyup', function() {
|
||||
ngModel.$setValidity('unique', true);
|
||||
var email = element.val();
|
||||
if (email) {
|
||||
@ -746,8 +875,10 @@ profileValidation.directive('uniqueEmail', ['$http', function($http) {
|
||||
ngModel.$setValidity('unique', false);
|
||||
}
|
||||
});
|
||||
};
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
}
|
||||
}]);
|
||||
]
|
||||
);
|
||||
|
@ -44,6 +44,16 @@
|
||||
"tests": {
|
||||
"type": "array"
|
||||
},
|
||||
"head": {
|
||||
"type": "array",
|
||||
"default": [],
|
||||
"description": "appended to user code"
|
||||
},
|
||||
"tail": {
|
||||
"type": "array",
|
||||
"default": [],
|
||||
"description": "prepended to user code"
|
||||
},
|
||||
"challengeSeed": {
|
||||
"type": "array"
|
||||
},
|
||||
|
@ -44,8 +44,9 @@
|
||||
" return false;",
|
||||
"",
|
||||
"// Only change code above this line.",
|
||||
"}",
|
||||
"",
|
||||
"}"
|
||||
],
|
||||
"tail": [
|
||||
"welcomeToBooleans();"
|
||||
],
|
||||
"type": "waypoint",
|
||||
@ -67,9 +68,9 @@
|
||||
"challengeSeed": [
|
||||
"var ourName = \"Free Code Camp\";",
|
||||
"",
|
||||
"",
|
||||
"// Only change code above this line.",
|
||||
"",
|
||||
""
|
||||
],
|
||||
"tail": [
|
||||
"if(typeof(myName) !== \"undefined\"){(function(v){return v;})(myName);}"
|
||||
],
|
||||
"type": "waypoint",
|
||||
|
@ -288,27 +288,34 @@ module.exports = function(app) {
|
||||
|
||||
// save user does nothing if user does not exist
|
||||
return Observable.just({
|
||||
|
||||
title: challenge.name,
|
||||
dashedName: origChallengeName,
|
||||
name: challenge.name,
|
||||
details: challenge.description,
|
||||
description: challenge.description,
|
||||
tests: challenge.tests,
|
||||
challengeSeed: challenge.challengeSeed,
|
||||
verb: utils.randomVerb(),
|
||||
phrase: utils.randomPhrase(),
|
||||
compliment: utils.randomCompliment(),
|
||||
challengeId: challenge.id,
|
||||
challengeType: challenge.challengeType,
|
||||
dashedName: origChallengeName,
|
||||
|
||||
challengeSeed: challenge.challengeSeed,
|
||||
head: challenge.head,
|
||||
tail: challenge.tail,
|
||||
tests: challenge.tests,
|
||||
|
||||
// video challenges
|
||||
video: challenge.challengeSeed[0],
|
||||
|
||||
// bonfires specific
|
||||
difficulty: Math.floor(+challenge.difficulty),
|
||||
bonfires: challenge,
|
||||
MDNkeys: challenge.MDNlinks,
|
||||
MDNlinks: getMDNLinks(challenge.MDNlinks),
|
||||
|
||||
// htmls specific
|
||||
environment: utils.whichEnvironment()
|
||||
environment: utils.whichEnvironment(),
|
||||
|
||||
verb: utils.randomVerb(),
|
||||
phrase: utils.randomPhrase(),
|
||||
compliment: utils.randomCompliment()
|
||||
});
|
||||
})
|
||||
.subscribe(
|
||||
|
@ -70,20 +70,6 @@ block content
|
||||
br
|
||||
#testSuite.negative-10
|
||||
br
|
||||
script(type="text/javascript").
|
||||
var tests = !{JSON.stringify(tests)};
|
||||
var challengeSeed = !{JSON.stringify(challengeSeed)};
|
||||
var challenge_Id = !{JSON.stringify(challengeId)};
|
||||
var challenge_Name = !{JSON.stringify(name)};
|
||||
var started = Math.floor(Date.now());
|
||||
var challengeType = !{JSON.stringify(challengeType)};
|
||||
var dashedName = !{JSON.stringify(dashedName)};
|
||||
var _ = R;
|
||||
var dashed = !{JSON.stringify(dashedName)};
|
||||
var username;
|
||||
if (user)
|
||||
script(type="text/javascript").
|
||||
username = !{JSON.stringify(user.username)};
|
||||
|
||||
.col-md-8.col-lg-9
|
||||
.editorScrollDiv(style = "overflow-y: auto; overflow-x: hidden;")
|
||||
@ -91,7 +77,7 @@ block content
|
||||
form.code
|
||||
.form-group.codeMirrorView
|
||||
textarea#codeEditor(autofocus=true, style='display: none;')
|
||||
script(src=rev('/js', 'commonFramework.js'))
|
||||
|
||||
|
||||
#complete-courseware-dialog.modal(tabindex='-1')
|
||||
.modal-dialog.animated.fadeIn.fast-animation
|
||||
@ -125,15 +111,30 @@ block content
|
||||
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
|
||||
include ../partials/challenge-modals
|
||||
script.
|
||||
script(type="text/javascript").
|
||||
var common = window.common = { init: [] };
|
||||
|
||||
common.tests = !{JSON.stringify(tests)};
|
||||
common.head = !{JSON.stringify(head)};
|
||||
common.tail = !{JSON.stringify(tail)};
|
||||
|
||||
common.challengeId = !{JSON.stringify(challengeId)};
|
||||
common.challengeName = !{JSON.stringify(name)};
|
||||
common.challengeSeed = !{JSON.stringify(challengeSeed)};
|
||||
common.challengeType = !{JSON.stringify(challengeType)};
|
||||
common.dashedName = !{JSON.stringify(dashedName)};
|
||||
|
||||
common.started = Math.floor(Date.now());
|
||||
common.username = !{JSON.stringify(user && user.username || '')};
|
||||
|
||||
include ../partials/challenge-footer
|
||||
script.
|
||||
document.addEventListener('gitter-sidecar-ready', function(e) {
|
||||
if (window.main) {
|
||||
window.main.chat.createHelpChat('freecodecamp/helpbonfires', '#challenge-help-btn', 'Bonfires Help');
|
||||
}
|
||||
});
|
||||
|
||||
var MDNlinks = !{JSON.stringify(MDNlinks)};
|
||||
if (!MDNlinks.length) {
|
||||
if (!!{JSON.stringify(MDNlinks.length)}) {
|
||||
$('#MDN-links').addClass('collapse');
|
||||
}
|
||||
|
@ -58,26 +58,12 @@ block content
|
||||
.button-spacer
|
||||
#testSuite
|
||||
br
|
||||
script(type="text/javascript").
|
||||
$('#next-courseware-button').attr('disabled', 'disabled');
|
||||
var tests = !{JSON.stringify(tests)};
|
||||
var challengeSeed = !{JSON.stringify(challengeSeed)};
|
||||
var challenge_Id = !{JSON.stringify(challengeId)};
|
||||
var challenge_Name = !{JSON.stringify(name)};
|
||||
var prodOrDev = !{JSON.stringify(environment)};
|
||||
var dashedName = !{JSON.stringify(dashedName)};
|
||||
var challengeType = !{JSON.stringify(challengeType)};
|
||||
var started = Math.floor(Date.now());
|
||||
.col-md-5.col-lg-6
|
||||
.editorScrollDiv(style = "overflow-y: auto; overflow-x: hidden;")
|
||||
#mainEditorPanel
|
||||
form.code
|
||||
.codeMirrorView
|
||||
textarea#codeEditor(autofocus=true, style='display: none;')
|
||||
script(src=rev('/js', 'commonFramework.js'))
|
||||
script.
|
||||
editor.setOption('lint', false);
|
||||
editor.setOption("mode", "text/html");
|
||||
.col-md-4.col-lg-3
|
||||
.hidden-xs.hidden-sm
|
||||
img.iphone-position.iframe-scroll(src="https://s3.amazonaws.com/freecodecamp/iphone6-frame.png", style = "z-index: -2;")
|
||||
@ -100,9 +86,30 @@ block content
|
||||
else
|
||||
#next-challenge.btn.btn-lg.btn-primary.btn-block Go to my next challenge (ctrl + enter)
|
||||
include ../partials/challenge-modals
|
||||
script(type="text/javascript").
|
||||
$('#next-courseware-button').attr('disabled', 'disabled');
|
||||
var common = window.common || { init: [] };
|
||||
|
||||
common.tests = !{JSON.stringify(tests)};
|
||||
common.head = !{JSON.stringify(head)};
|
||||
common.tail = !{JSON.stringify(tail)};
|
||||
|
||||
common.challengeId = !{JSON.stringify(challengeId)};
|
||||
common.challengeName = !{JSON.stringify(name)};
|
||||
common.challengeSeed = !{JSON.stringify(challengeSeed)};
|
||||
common.challengeType = !{JSON.stringify(challengeType)};
|
||||
common.dashedName = !{JSON.stringify(dashedName)};
|
||||
|
||||
common.prodOrDev = !{JSON.stringify(environment)};
|
||||
common.started = Math.floor(Date.now());
|
||||
|
||||
include ../partials/challenge-footer
|
||||
script.
|
||||
document.addEventListener('gitter-sidecar-ready', function(e) {
|
||||
if (window.main) {
|
||||
window.main.chat.createHelpChat('freecodecamp/help', '#challenge-help-btn');
|
||||
}
|
||||
});
|
||||
|
||||
editor.setOption('lint', false);
|
||||
editor.setOption("mode", "text/html");
|
||||
|
@ -61,25 +61,12 @@ block content
|
||||
br
|
||||
#testSuite.negative-10
|
||||
br
|
||||
script(type="text/javascript").
|
||||
var tests = !{JSON.stringify(tests)};
|
||||
var challengeSeed = !{JSON.stringify(challengeSeed)};
|
||||
var challenge_Id = !{JSON.stringify(challengeId)};
|
||||
var challenge_Name = !{JSON.stringify(name)};
|
||||
var dashedName = !{JSON.stringify(dashedName)};
|
||||
var started = Math.floor(Date.now());
|
||||
var challengeType = !{JSON.stringify(challengeType)};
|
||||
var _ = R;
|
||||
var dashed = !{JSON.stringify(dashedName)};
|
||||
.col-md-8.col-lg-9
|
||||
.editorScrollDiv(style = "overflow-y: auto; overflow-x: hidden;")
|
||||
#mainEditorPanel
|
||||
form.code
|
||||
.codeMirrorView
|
||||
textarea#codeEditor(autofocus=true, style='display: none;')
|
||||
script(src=rev('/js', 'commonFramework.js'))
|
||||
script.
|
||||
editor.setOption("mode", "javascript");
|
||||
#complete-courseware-dialog.modal(tabindex='-1')
|
||||
.modal-dialog.animated.fadeIn.fast-animation
|
||||
.modal-content
|
||||
@ -97,9 +84,24 @@ block content
|
||||
else
|
||||
#next-challenge.animated.fadeIn.btn.btn-lg.btn-primary.btn-block Go to my next challenge (ctrl + enter)
|
||||
include ../partials/challenge-modals
|
||||
script(type="text/javascript").
|
||||
var common = window.common = { init: [] };
|
||||
|
||||
common.tests = !{JSON.stringify(tests)};
|
||||
common.head = !{JSON.stringify(head)};
|
||||
common.tail = !{JSON.stringify(tail)};
|
||||
|
||||
common.challengeId = !{JSON.stringify(challengeId)};
|
||||
common.challengeName = !{JSON.stringify(name)};
|
||||
common.challengeSeed = !{JSON.stringify(challengeSeed)};
|
||||
common.challengeType = !{JSON.stringify(challengeType)};
|
||||
common.dashedName = !{JSON.stringify(dashedName)};
|
||||
|
||||
common.started = Math.floor(Date.now());
|
||||
|
||||
include ../partials/challenge-footer
|
||||
script.
|
||||
var MDNlinks = !{JSON.stringify(MDNlinks)};
|
||||
if (!MDNlinks.length) {
|
||||
if (!!{JSON.stringify(MDNlinks.length)}) {
|
||||
$('#MDN-links').addClass('collapse');
|
||||
}
|
||||
document.addEventListener('gitter-sidecar-ready', function(e) {
|
||||
@ -107,3 +109,4 @@ block content
|
||||
window.main.chat.createHelpChat('freecodecamp/help', '#challenge-help-btn');
|
||||
}
|
||||
});
|
||||
editor.setOption("mode", "javascript");
|
||||
|
@ -34,14 +34,15 @@ block content
|
||||
#challenge-step-btn-submit.animated.fadeIn.btn.btn-lg.btn-primary.btn-block Submit and go to my next challenge
|
||||
else
|
||||
a.btn.btn-lg.btn-primary.btn-block(href='/challenges/next-challenge?id=' + challengeId) Go to my next challenge
|
||||
script(src=rev('/js', 'commonFramework.js'))
|
||||
script.
|
||||
var common = window.common || { init: [] };
|
||||
|
||||
common.challengeId = !{JSON.stringify(challengeId)};
|
||||
common.challengeName = !{JSON.stringify(name)};
|
||||
common.challengeType = 7;
|
||||
common.challengeType = !{JSON.stringify(challengeType)};
|
||||
common.dashedName = !{JSON.stringify(dashedName || '')};
|
||||
common.isHonest = !{JSON.stringify(isHonest || false)};
|
||||
common.isFrontEndCert = !{JSON.stringify(isFrontEndCert || false)};
|
||||
common.isFullStackCert = !{JSON.stringify(isFullStackCert || false)};
|
||||
common.challengeSeed = !{JSON.stringify(challengeSeed || [])};
|
||||
script(src=rev('/js', 'commonFramework.js'))
|
||||
|
@ -75,14 +75,19 @@ block content
|
||||
a.animated.fadeIn.btn.btn-lg.btn-primary.btn-block(href='/challenges/next-challenge?id=' + challengeId) I've completed this challenge (ctrl + enter)
|
||||
script.
|
||||
$('body').bind('keydown', controlEnterHandler);
|
||||
|
||||
include ../partials/challenge-modals
|
||||
script.
|
||||
var challenge_Id = !{JSON.stringify(challengeId)};
|
||||
var challenge_Name = !{JSON.stringify(name)};
|
||||
var challengeType = !{JSON.stringify(challengeType)};
|
||||
var dashedName = !{JSON.stringify(dashedName)};
|
||||
var common = window.common = { init: [] };
|
||||
|
||||
common.challengeId = !{JSON.stringify(challengeId)};
|
||||
common.challengeName = !{JSON.stringify(name)};
|
||||
common.challengeType = !{JSON.stringify(challengeType)};
|
||||
common.dashedName = !{JSON.stringify(dashedName)};
|
||||
|
||||
document.addEventListener('gitter-sidecar-ready', function(e) {
|
||||
if (window.main) {
|
||||
window.main.chat.createHelpChat('freecodecamp/help', '#challenge-help-btn');
|
||||
}
|
||||
});
|
||||
include ../partials/challenge-modals
|
||||
include ../partials/challenge-footer
|
||||
|
5
server/views/partials/challenge-footer.jade
Normal file
5
server/views/partials/challenge-footer.jade
Normal file
@ -0,0 +1,5 @@
|
||||
script(src=rev('/js', 'commonFramework.js'))
|
||||
script.
|
||||
if (typeof localStorage !== 'undefined') {
|
||||
localStorage.setItem('currentDashedName', typeof common !== 'undefined' && common.dashedName || '');
|
||||
}
|
@ -19,7 +19,3 @@
|
||||
h3 This will restore your code editor to its original state.
|
||||
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
|
||||
script.
|
||||
if (typeof localStorage !== 'undefined') {
|
||||
localStorage.setItem('currentDashedName', typeof common !== 'undefined' && common.dashedName || dashedName || '');
|
||||
}
|
||||
|
@ -35,5 +35,4 @@ script.
|
||||
// Leave the below lines alone!
|
||||
script(src=rev('/js', 'main.js'))
|
||||
script(src="/bower_components/angular-bootstrap/ui-bootstrap-tpls.min.js")
|
||||
script(src="/bower_components/ramda/dist/ramda.min.js")
|
||||
script(src='/bower_components/lightbox2/dist/js/lightbox.min.js')
|
||||
|
@ -1,10 +1,7 @@
|
||||
.spacer
|
||||
.spacer
|
||||
#story-list.story-list
|
||||
|
||||
script(src="https://cdn.jsdelivr.net/ramda/0.10.0/ramda.min.js")
|
||||
script.
|
||||
|
||||
var getLinkedName = function getLinkedName(name) {
|
||||
return name.trim().toLowerCase().replace(/\s/g, '-');
|
||||
}
|
||||
|
@ -1,10 +1,12 @@
|
||||
.spacer
|
||||
.col-xs-12
|
||||
script.
|
||||
var storyURL = !{JSON.stringify(storyURL)};
|
||||
var storyTitle = !{JSON.stringify(storyTitle)};
|
||||
var storyImage = !{JSON.stringify(storyImage)};
|
||||
var storyMetaDescription = !{JSON.stringify(storyMetaDescription)};
|
||||
var main = window.main || { init: [] };
|
||||
main.storyURL = !{JSON.stringify(storyURL)};
|
||||
main.storyTitle = !{JSON.stringify(storyTitle)};
|
||||
main.storyImage = !{JSON.stringify(storyImage)};
|
||||
main.storyMetaDescription = !{JSON.stringify(storyMetaDescription)};
|
||||
|
||||
form.form-horizontal.control-label-story-submission#story-submission-form(name="submitStory")
|
||||
.col-xs-12
|
||||
.form-group
|
||||
|
Reference in New Issue
Block a user