Fix race conditions that could prevent applications from being loaded

pull/1/head
yflory 8 years ago
parent 7d5a33512a
commit 74df38f94f

@ -12,9 +12,6 @@ define([
Cryptpad: Cryptpad, Cryptpad: Cryptpad,
}; };
DecorateToolbar.main($('#bottom-bar'));
Cryptpad.styleAlerts();
var padTypes = { var padTypes = {
'/pad/': Messages.type.pad, '/pad/': Messages.type.pad,
'/code/': Messages.type.code, '/code/': Messages.type.code,
@ -22,9 +19,9 @@ define([
'/slide/': Messages.type.slide, '/slide/': Messages.type.slide,
}; };
var $table = $('table.scroll'); var $table;
var $tbody = $table.find('tbody'); var $tbody;
var $tryit = $('#tryit'); var $tryit;
var now = new Date(); var now = new Date();
var hasRecent = false; var hasRecent = false;
@ -138,11 +135,18 @@ define([
}); });
}; };
displayCreateButtons();
Cryptpad.ready(function () { Cryptpad.ready(function () {
console.log("ready"); console.log("ready");
refreshTable();
$table = $('table.scroll');
$tbody = $table.find('tbody');
$tryit = $('#tryit');
DecorateToolbar.main($('#bottom-bar'));
Cryptpad.styleAlerts();
displayCreateButtons();
refreshTable();
if (Cryptpad.store && Cryptpad.store.change) { if (Cryptpad.store && Cryptpad.store.change) {
Cryptpad.store.change(function (data) { Cryptpad.store.change(function (data) {
if (data.key === 'CryptPad_RECENTPADS') { if (data.key === 'CryptPad_RECENTPADS') {

@ -557,8 +557,21 @@ define([
Store.ready(function (err, store) { Store.ready(function (err, store) {
common.store = env.store = store; common.store = env.store = store;
$(function() {
if($('#pad-iframe').length) {
var $iframe = $('#pad-iframe');
var iframe = $iframe[0];
var iframeDoc = iframe.contentDocument || iframe.contentWindow.document;
if (iframeDoc.readyState === 'complete') {
cb(); cb();
return; return;
}
$iframe.load(cb);
return;
}
cb();
});
return;
/* /*
authorize(function (err, proxy) { authorize(function (err, proxy) {
/* /*

Loading…
Cancel
Save