Commit 568442d9 authored by Lingnan Wu's avatar Lingnan Wu

clean code

parent 035a5d34
...@@ -76,6 +76,7 @@ var Page = { ...@@ -76,6 +76,7 @@ var Page = {
// load the user, the editor and the document in the page (wait for the storage being ready) // load the user, the editor and the document in the page (wait for the storage being ready)
var initPage = function() { var initPage = function() {
var editor = window[getCurrentUser().getSetting("favouriteEditor")[Page.getName()]]; var editor = window[getCurrentUser().getSetting("favouriteEditor")[Page.getName()]];
if(!editor) {// this hack doesn't work and I have no idea why if(!editor) {// this hack doesn't work and I have no idea why
setTimeout(function() {initPage()},500);console.log("try"); setTimeout(function() {initPage()},500);console.log("try");
...@@ -90,9 +91,13 @@ var Page = { ...@@ -90,9 +91,13 @@ var Page = {
else { else {
Page.loadEditor(editor); Page.loadEditor(editor);
Page.displayUserInformation(getCurrentUser()); Page.displayUserInformation(getCurrentUser());
Page.displayDocumentInformation(getCurrentDocument()); Page.displayDocumentInformation(getCurrentDocument());
} }
} }
Storage[Storage.USER_READY] ? initPage() : Storage.addEventHandler(initPage,Storage.USER_READY); Storage[Storage.USER_READY] ? initPage() : Storage.addEventHandler(initPage,Storage.USER_READY);
setTimeout("Document.saveCurrentDocument()",200); setTimeout("Document.saveCurrentDocument()",200);
}); });
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment