|
|
@@ -25,13 +25,13 @@ $(document).ready(function() {
|
|
|
|
|
|
function setCurrentHash(slug) {
|
|
|
if(slug) {
|
|
|
- console.log('save current hash', slug);
|
|
|
+ // console.log('save current hash', slug);
|
|
|
window.location.hash = currentHash = slug;
|
|
|
}
|
|
|
else {
|
|
|
currentHash = window.location.hash ?
|
|
|
window.location.hash.substr(1) : undefined;
|
|
|
- if(currentHash) console.log('restored current hash', currentHash);
|
|
|
+ // if(currentHash) console.log('restored current hash', currentHash);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -41,7 +41,7 @@ $(document).ready(function() {
|
|
|
|
|
|
function saveToLocalStorage() {
|
|
|
var editorContent = editor.getSession().getValue();
|
|
|
- console.log('saveToLocalStorage', activeMode, editorContent.substr(0, 10) + '[...]');
|
|
|
+ // console.log('saveToLocalStorage', activeMode, editorContent.substr(0, 10) + '[...]');
|
|
|
editorStorage.saveSource(activeMode, editorContent);
|
|
|
saveTimeout = undefined;
|
|
|
}
|
|
|
@@ -56,7 +56,7 @@ $(document).ready(function() {
|
|
|
editor.getSession().on('change', editorContentChanged);
|
|
|
|
|
|
function setActiveTab(mode) {
|
|
|
- console.log('setting mode', mode);
|
|
|
+ // console.log('setting mode', mode);
|
|
|
var elementId = 'show-' + mode;
|
|
|
$('#show-' + activeMode).removeClass('active');
|
|
|
activeMode = mode;
|
|
|
@@ -129,20 +129,20 @@ $(document).ready(function() {
|
|
|
var didRestore;
|
|
|
liste.forEach(addFileSelectItem);
|
|
|
if(currentHash) {
|
|
|
- console.log('I have current hash', currentHash);
|
|
|
+ // console.log('I have current hash', currentHash);
|
|
|
$fileSelect.val(currentHash);
|
|
|
var item = _.find(liste, { slug: currentHash });
|
|
|
if( ! item) {
|
|
|
return;
|
|
|
}
|
|
|
- console.log('I have current item', item);
|
|
|
+ // console.log('I have current item', item);
|
|
|
restoredDraft = editorStorage.restore(item.slug);
|
|
|
if(! restoredDraft) {
|
|
|
- console.log('I did not restore');
|
|
|
+ // console.log('I did not restore');
|
|
|
loadExample(item.slug);
|
|
|
}
|
|
|
else {
|
|
|
- console.log('I did restore');
|
|
|
+ // console.log('I did restore');
|
|
|
$editorHtml.html(restoredDraft.sources.html);
|
|
|
$editorJs.html(restoredDraft.sources.javascript);
|
|
|
setActiveTab('html');
|
|
|
@@ -186,7 +186,7 @@ $(document).ready(function() {
|
|
|
notify('success', "Exemple créé !");
|
|
|
},
|
|
|
error: function(jqXHR, textStatus, errorThrown ) {
|
|
|
- console.log(jqXHR, textStatus, errorThrown);
|
|
|
+ // console.log(jqXHR, textStatus, errorThrown);
|
|
|
notify('error', 'Erreur: ' + jqXHR.responseText);
|
|
|
},
|
|
|
contentType: 'application/json',
|
|
|
@@ -208,9 +208,10 @@ $(document).ready(function() {
|
|
|
data: JSON.stringify(payload),
|
|
|
success: function(newExample) {
|
|
|
notify('success', "Exemple sauvegardé !");
|
|
|
+ loadExample(currentHash);
|
|
|
},
|
|
|
error: function(jqXHR, textStatus, errorThrown ) {
|
|
|
- console.log(jqXHR, textStatus, errorThrown);
|
|
|
+ // console.log(jqXHR, textStatus, errorThrown);
|
|
|
notify('error', 'Erreur: ' + jqXHR.responseText);
|
|
|
},
|
|
|
contentType: 'application/json',
|