Merge pull request #5038 from bugron/fix/common-improvements

Some common code improvements
This commit is contained in:
Logan Tegman
2015-12-07 06:48:47 -08:00
3 changed files with 12 additions and 15 deletions

View File

@ -175,7 +175,10 @@ window.common = (function(global) {
});
$('#search-issue').on('click', function() {
var queryIssue = window.location.href.toString().split('?')[0];
var queryIssue = window.location.href
.toString()
.split('?')[0]
.replace(/(#*)$/, '');
window.open(
'https://github.com/FreeCodeCamp/FreeCodeCamp/issues?q=' +
'is:issue is:all ' +
@ -233,9 +236,12 @@ window.common = (function(global) {
public: true,
files: {}
};
var queryIssue = window.location.href.toString().split('?')[0];
var filename = queryIssue
.substr(queryIssue.lastIndexOf('challenges/') + 11)
var challengeLink = window.location.href
.toString()
.split('?')[0]
.replace(/(#*)$/, '');
var filename = challengeLink
.substr(challengeLink.lastIndexOf('challenges/') + 11)
.replace('/', '') + '.js';
data.files[filename] = {
@ -244,7 +250,7 @@ window.common = (function(global) {
'\n' +
(common.username ? '// Author: @' + common.username + '\n' : '') +
'// Challenge: ' +
queryIssue +
challengeLink +
'\n' +
'// Learn to Code at Free Code Camp (www.freecodecamp.com)' +
'\n\n' +

View File

@ -13,7 +13,7 @@ window.common = (function(global) {
!key ||
typeof key !== 'string'
) {
console.log('unable to save to storage');
console.log('unable to read from storage');
return '';
}
return '' + localStorage.getItem(key + 'Val');

View File

@ -81,15 +81,6 @@ block content
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.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
script(type="text/javascript").
var common = window.common = window.common || { init: [] };