Merge pull request #5038 from bugron/fix/common-improvements
Some common code improvements
This commit is contained in:
@ -175,7 +175,10 @@ window.common = (function(global) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
$('#search-issue').on('click', function() {
|
$('#search-issue').on('click', function() {
|
||||||
var queryIssue = window.location.href.toString().split('?')[0];
|
var queryIssue = window.location.href
|
||||||
|
.toString()
|
||||||
|
.split('?')[0]
|
||||||
|
.replace(/(#*)$/, '');
|
||||||
window.open(
|
window.open(
|
||||||
'https://github.com/FreeCodeCamp/FreeCodeCamp/issues?q=' +
|
'https://github.com/FreeCodeCamp/FreeCodeCamp/issues?q=' +
|
||||||
'is:issue is:all ' +
|
'is:issue is:all ' +
|
||||||
@ -233,9 +236,12 @@ window.common = (function(global) {
|
|||||||
public: true,
|
public: true,
|
||||||
files: {}
|
files: {}
|
||||||
};
|
};
|
||||||
var queryIssue = window.location.href.toString().split('?')[0];
|
var challengeLink = window.location.href
|
||||||
var filename = queryIssue
|
.toString()
|
||||||
.substr(queryIssue.lastIndexOf('challenges/') + 11)
|
.split('?')[0]
|
||||||
|
.replace(/(#*)$/, '');
|
||||||
|
var filename = challengeLink
|
||||||
|
.substr(challengeLink.lastIndexOf('challenges/') + 11)
|
||||||
.replace('/', '') + '.js';
|
.replace('/', '') + '.js';
|
||||||
|
|
||||||
data.files[filename] = {
|
data.files[filename] = {
|
||||||
@ -244,7 +250,7 @@ window.common = (function(global) {
|
|||||||
'\n' +
|
'\n' +
|
||||||
(common.username ? '// Author: @' + common.username + '\n' : '') +
|
(common.username ? '// Author: @' + common.username + '\n' : '') +
|
||||||
'// Challenge: ' +
|
'// Challenge: ' +
|
||||||
queryIssue +
|
challengeLink +
|
||||||
'\n' +
|
'\n' +
|
||||||
'// Learn to Code at Free Code Camp (www.freecodecamp.com)' +
|
'// Learn to Code at Free Code Camp (www.freecodecamp.com)' +
|
||||||
'\n\n' +
|
'\n\n' +
|
||||||
|
@ -13,7 +13,7 @@ window.common = (function(global) {
|
|||||||
!key ||
|
!key ||
|
||||||
typeof key !== 'string'
|
typeof key !== 'string'
|
||||||
) {
|
) {
|
||||||
console.log('unable to save to storage');
|
console.log('unable to read from storage');
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
return '' + localStorage.getItem(key + 'Val');
|
return '' + localStorage.getItem(key + 'Val');
|
||||||
|
@ -81,15 +81,6 @@ block content
|
|||||||
else
|
else
|
||||||
a#next-challenge.btn.btn-lg.btn-primary.btn-block(href="/challenges/next-challenge?id="+challengeId) Go to my next challenge (ctrl + enter)
|
a#next-challenge.btn.btn-lg.btn-primary.btn-block(href="/challenges/next-challenge?id="+challengeId) Go to my next challenge (ctrl + enter)
|
||||||
a.btn.btn-lg.btn-danger.btn-block#gist-share Share your solution as a GitHub gist
|
a.btn.btn-lg.btn-danger.btn-block#gist-share Share your solution as a GitHub gist
|
||||||
#reset-modal.modal(tabindex='-1')
|
|
||||||
.modal-dialog.animated.fadeInUp.fast-animation
|
|
||||||
.modal-content
|
|
||||||
.modal-header.challenge-list-header Clear your code?
|
|
||||||
a.close.closing-x(href='#', data-dismiss='modal', aria-hidden='true') ×
|
|
||||||
.modal-body
|
|
||||||
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
|
|
||||||
include ../partials/challenge-modals
|
include ../partials/challenge-modals
|
||||||
script(type="text/javascript").
|
script(type="text/javascript").
|
||||||
var common = window.common = window.common || { init: [] };
|
var common = window.common = window.common || { init: [] };
|
||||||
|
Reference in New Issue
Block a user