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