improve upon @lemonyandrew pull request
This commit is contained in:
@ -45,8 +45,8 @@ editor.setOption("extraKeys", {
|
|||||||
localBonfire: singleton object that contains properties and methods related to
|
localBonfire: singleton object that contains properties and methods related to
|
||||||
dealing with the localStorage system.
|
dealing with the localStorage system.
|
||||||
The keys work off of the variable challenge_name to make unique identifiers per bonfire
|
The keys work off of the variable challenge_name to make unique identifiers per bonfire
|
||||||
|
|
||||||
Two extra functionalities:
|
Two extra functionalities:
|
||||||
Added anonymous version checking system incase of future updates to the system
|
Added anonymous version checking system incase of future updates to the system
|
||||||
Added keyup listener to editor(myCodeMirror) so the last update has been saved to storage
|
Added keyup listener to editor(myCodeMirror) so the last update has been saved to storage
|
||||||
*/
|
*/
|
||||||
@ -81,7 +81,6 @@ localBonfire.updateStorage = function(){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
localBonfire.updateTimeoutId = null;
|
localBonfire.updateTimeoutId = null;
|
||||||
console.log('updated!');
|
|
||||||
};
|
};
|
||||||
// ANONYMOUS 1 TIME UPDATE VERSION
|
// ANONYMOUS 1 TIME UPDATE VERSION
|
||||||
(function(){
|
(function(){
|
||||||
@ -96,7 +95,7 @@ localBonfire.updateStorage = function(){
|
|||||||
}
|
}
|
||||||
})();
|
})();
|
||||||
|
|
||||||
editor.on('keyup', function(codMir, event){
|
editor.on('keyup', function(codMir, event){
|
||||||
window.clearTimeout(localBonfire.updateTimeoutId);
|
window.clearTimeout(localBonfire.updateTimeoutId);
|
||||||
localBonfire.updateTimeoutId = window.setTimeout(localBonfire.updateStorage, localBonfire.updateWait);
|
localBonfire.updateTimeoutId = window.setTimeout(localBonfire.updateStorage, localBonfire.updateWait);
|
||||||
});
|
});
|
||||||
@ -106,6 +105,10 @@ if (attempts) {
|
|||||||
attempts = 0;
|
attempts = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var resetEditor = function() {
|
||||||
|
editor.setValue(allSeeds);
|
||||||
|
localBonfire.updateStorage();
|
||||||
|
};
|
||||||
|
|
||||||
var codeOutput = CodeMirror.fromTextArea(document.getElementById("codeOutput"), {
|
var codeOutput = CodeMirror.fromTextArea(document.getElementById("codeOutput"), {
|
||||||
lineNumbers: false,
|
lineNumbers: false,
|
||||||
|
@ -331,6 +331,8 @@ $(document).ready(function() {
|
|||||||
|
|
||||||
$('#story-submit').on('click', storySubmitButtonHandler);
|
$('#story-submit').on('click', storySubmitButtonHandler);
|
||||||
|
|
||||||
|
$('#reset-button').on('click', resetEditor);
|
||||||
|
|
||||||
var commentSubmitButtonHandler = function commentSubmitButtonHandler() {
|
var commentSubmitButtonHandler = function commentSubmitButtonHandler() {
|
||||||
$('#comment-button').unbind('click');
|
$('#comment-button').unbind('click');
|
||||||
var data = $('#comment-box').val();
|
var data = $('#comment-box').val();
|
||||||
|
@ -88,6 +88,12 @@ block content
|
|||||||
if (user && user.sentSlackInvite)
|
if (user && user.sentSlackInvite)
|
||||||
.button-spacer
|
.button-spacer
|
||||||
.btn-group.input-group.btn-group-justified
|
.btn-group.input-group.btn-group-justified
|
||||||
|
label.btn.btn-success#trigger-help-modal
|
||||||
|
i.fa.fa-refresh
|
||||||
|
| Reset
|
||||||
|
label.btn.btn-success#trigger-help-modal
|
||||||
|
i.fa.fa-refresh
|
||||||
|
| Reset
|
||||||
label.btn.btn-success#trigger-help-modal
|
label.btn.btn-success#trigger-help-modal
|
||||||
i.fa.fa-medkit
|
i.fa.fa-medkit
|
||||||
| Help
|
| Help
|
||||||
@ -119,7 +125,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='/js/lib/coursewares/coursewaresJSFramework_0.0.5.js')
|
script(src='/js/lib/coursewares/coursewaresJSFramework_0.0.6.js')
|
||||||
|
|
||||||
#complete-courseware-dialog.modal(tabindex='-1')
|
#complete-courseware-dialog.modal(tabindex='-1')
|
||||||
.modal-dialog.animated.zoomIn.fast-animation
|
.modal-dialog.animated.zoomIn.fast-animation
|
||||||
@ -140,6 +146,15 @@ block content
|
|||||||
= phrase
|
= phrase
|
||||||
else
|
else
|
||||||
a.animated.fadeIn.btn.btn-lg.signup-btn.btn-block(href='/login') Sign in so you can save your progress
|
a.animated.fadeIn.btn.btn-lg.signup-btn.btn-block(href='/login') Sign in so you can save your progress
|
||||||
|
#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.
|
script.
|
||||||
var MDNlinks = !{JSON.stringify(MDNlinks)};
|
var MDNlinks = !{JSON.stringify(MDNlinks)};
|
||||||
|
Reference in New Issue
Block a user