kind of got the modals working - Ben will finish this

This commit is contained in:
Quincy Larson
2015-08-22 12:10:08 -07:00
parent cd4823de76
commit 73eb6ec2d1
4 changed files with 8 additions and 63 deletions

View File

@ -198,9 +198,8 @@ codeStorage.isAlive = function() {
return val !== 'null' && return val !== 'null' &&
val !== 'undefined' && val !== 'undefined' &&
(val && val.length > 0); (val && val.length > 0);
} };
codeStorage.updateStorage = function(){ codeStorage.updateStorage = function(){
//document.getElementById('scroll-locker').dispatchEvent(new CustomEvent('previewUpdateSpy', {'detail': $('.scroll-locker').scrollTop()}));
if(typeof(Storage) !== undefined) { if(typeof(Storage) !== undefined) {
var value = editor.getValue(); var value = editor.getValue();
localStorage.setItem(codeStorage.keyValue, value); localStorage.setItem(codeStorage.keyValue, value);
@ -257,7 +256,6 @@ editor.setValue(editorValue.replace((/fccss/gi), '<script>').replace((/fcces/gi)
editor.refresh(); editor.refresh();
var resetEditor = function resetEditor() { var resetEditor = function resetEditor() {
document.getElementById('scroll-locker').dispatchEvent(new CustomEvent('previewUpdateSpy', {'detail': $('.scroll-locker').scrollTop()}));
editor.setValue(allSeeds.replace((/fccss/gi), '<script>').replace((/fcces/gi), '</script>')); editor.setValue(allSeeds.replace((/fccss/gi), '<script>').replace((/fcces/gi), '</script>'));
updatePreview(); updatePreview();
codeStorage.updateStorage(); codeStorage.updateStorage();

View File

@ -330,7 +330,6 @@ codeStorage.isAlive = function() {
(val && val.length > 0); (val && val.length > 0);
} }
codeStorage.updateStorage = function(){ codeStorage.updateStorage = function(){
document.getElementById('scroll-locker').dispatchEvent(new CustomEvent('previewUpdateSpy', {'detail': $('.scroll-locker').scrollTop()}));
if(typeof(Storage) !== undefined) { if(typeof(Storage) !== undefined) {
var value = editor.getValue(); var value = editor.getValue();
localStorage.setItem(codeStorage.keyValue, value); localStorage.setItem(codeStorage.keyValue, value);

View File

@ -59,44 +59,11 @@ $(document).ready(function() {
function reBindModals(){ function reBindModals(){
$('#i-want-help').unbind('click'); $('.close-modal').unbind('click');
$('#i-want-help').on('click', function() { $('.close-modal').on('click', function(){
$('#help-modal').modal('hide'); setTimeout(function() {
var editorValue = editor.getValue(); $('#issue-modal').modal('hide');
var currentLocation = window.location.href; }, 2000);
$.post(
'/get-help',
{
payload: {
code: editorValue,
challenge: currentLocation
}
},
function(res) {
if (res) {
window.open('https://gitter.im/FreeCodeCamp/Help', '_blank')
}
}
);
});
$('#i-want-help-editorless').unbind('click');
$('#i-want-help-editorless').on('click', function() {
$('#help-editorless-modal').modal('hide');
var currentLocation = window.location.href;
$.post(
'/get-help',
{
payload: {
challenge: currentLocation
}
},
function(res) {
if (res) {
window.open('https://gitter.im/FreeCodeCamp/Help', '_blank')
}
}
);
}); });
$('#report-issue').unbind('click'); $('#report-issue').unbind('click');
@ -105,25 +72,6 @@ $(document).ready(function() {
window.open('https://github.com/freecodecamp/freecodecamp/issues/new?&body=Challenge '+ window.location.href +' has an issue. Please describe how to reproduce it, and include links to screenshots if possible.', '_blank') window.open('https://github.com/freecodecamp/freecodecamp/issues/new?&body=Challenge '+ window.location.href +' has an issue. Please describe how to reproduce it, and include links to screenshots if possible.', '_blank')
}); });
$('#i-want-help').unbind('click');
$('#i-want-to-pair').on('click', function() {
$('#pair-modal').modal('hide');
var currentLocation = window.location.href;
$.post(
'/get-pair',
{
payload: {
challenge: currentLocation
}
},
function(res) {
if (res) {
window.open('https://gitter.im/FreeCodeCamp/LetsPair', '_blank')
}
}
);
});
$('#completed-courseware').unbind('click'); $('#completed-courseware').unbind('click');
$('#completed-courseware').on('click', function() { $('#completed-courseware').on('click', function() {
$('#complete-courseware-dialog').modal('show'); $('#complete-courseware-dialog').modal('show');

View File

@ -30,11 +30,11 @@
a.close.closing-x(href='#', data-dismiss='modal', aria-hidden='true') × a.close.closing-x(href='#', data-dismiss='modal', aria-hidden='true') ×
.modal-body.text-center .modal-body.text-center
h3 Remember to use &thinsp; h3 Remember to use &thinsp;
a(href='//github.com/FreeCodeCamp/freecodecamp/wiki/How-to-get-help-when-you-get-stuck' target='_blank') Read-Search-Ask a(href='//github.com/FreeCodeCamp/freecodecamp/wiki/How-to-get-help-when-you-get-stuck', target='_blank') Read-Search-Ask
| . | .
h3 If you've already read the errors and searched Google, you should ask for help. h3 If you've already read the errors and searched Google, you should ask for help.
h3 This will take you to our help room. h3 This will take you to our help room.
a.btn.btn-lg.btn-primary.btn-block(href='https://gitter.im/FreeCodeCamp/help', data-dismiss='modal', aria-hidden='true' target='_blank') Take me to the help room a.btn.btn-lg.btn-primary.btn-block.close-modal(href='https://gitter.im/FreeCodeCamp/help', target='_blank') Take me to the help room
a.btn.btn-lg.btn-info.btn-block(href='#', data-dismiss='modal', aria-hidden='true') Cancel a.btn.btn-lg.btn-info.btn-block(href='#', data-dismiss='modal', aria-hidden='true') Cancel
#reset-modal.modal(tabindex='-1') #reset-modal.modal(tabindex='-1')