Fixed Google Drive actions

This commit is contained in:
benweet 2013-04-22 02:04:12 +01:00
parent c6203e15d1
commit 663c62b162
7 changed files with 32 additions and 8 deletions

View File

@ -1 +1 @@
CACHE MANIFEST # v6 CACHE: index.html css/main-min.css js/main-min.js js/require.js img/ajax-loader.gif img/glyphicons-halflings.png img/glyphicons-halflings-white.png img/icons.png img/stackedit-32.ico img/stackedit-promo.png NETWORK: * CACHE MANIFEST # v7 CACHE: index.html css/main-min.css js/main-min.js js/require.js img/ajax-loader.gif img/glyphicons-halflings.png img/glyphicons-halflings-white.png img/icons.png img/stackedit-32.ico img/stackedit-promo.png NETWORK: *

View File

@ -579,8 +579,33 @@ define(
+ left); + left);
}; };
// Keep a reference to the fileManager
core.setFileManager = function(fileManager) {
core.fileManager = fileManager;
runReadyCallbacks();
};
// onReady event callbacks
var readyCallbacks = [];
core.onReady = function(callback) {
readyCallbacks.push(callback);
runReadyCallbacks();
};
var documentLoaded = false;
function runReadyCallbacks() {
if(documentLoaded === true && core.fileManager !== undefined) {
_.each(readyCallbacks, function(callback) {
callback();
});
readyCallbacks = [];
}
}
$(function() { $(function() {
documentLoaded = true;
runReadyCallbacks();
});
core.onReady(function() {
// jGrowl configuration // jGrowl configuration
$.jGrowl.defaults.life = 5000; $.jGrowl.defaults.life = 5000;
$.jGrowl.defaults.closer = false; $.jGrowl.defaults.closer = false;

View File

@ -2,8 +2,7 @@ define(["jquery", "core", "synchronizer", "publisher", "underscore"],
function($, core, synchronizer, publisher) { function($, core, synchronizer, publisher) {
var fileManager = {}; var fileManager = {};
// To avoid circle inclusion core.setFileManager(fileManager);
core.fileManager = fileManager;
// Defines the current file // Defines the current file
var currentFileIndex = localStorage["file.current"]; var currentFileIndex = localStorage["file.current"];
@ -216,7 +215,7 @@ define(["jquery", "core", "synchronizer", "publisher", "underscore"],
}).value(); }).value();
}; };
$(function() { core.onReady(function() {
fileManager.selectFile(); fileManager.selectFile();
$(".action-create-file").click(function() { $(".action-create-file").click(function() {

View File

@ -240,7 +240,7 @@ define(["jquery", "core", "google-helper", "underscore"], function($, core, goog
return publishAttributes; return publishAttributes;
}; };
$(function() { core.onReady(function() {
var state = localStorage[PROVIDER_GDRIVE + ".state"]; var state = localStorage[PROVIDER_GDRIVE + ".state"];
if(state === undefined) { if(state === undefined) {
return; return;

2
js/main-min.js vendored

File diff suppressed because one or more lines are too long

View File

@ -205,7 +205,7 @@ define(["jquery", "core", "github-provider", "blogger-provider", "dropbox-provid
}); });
}; };
$(function() { core.onReady(function() {
// Init each provider // Init each provider
_.each(providerMap, function(provider) { _.each(providerMap, function(provider) {
// Publish provider button // Publish provider button

View File

@ -236,7 +236,7 @@ define(["jquery", "core", "dropbox-provider", "gdrive-provider", "underscore"],
return providerIdList; return providerIdList;
}; };
$(function() { core.onReady(function() {
// Init each provider // Init each provider
_.each(providerMap, function(provider) { _.each(providerMap, function(provider) {
// Provider's import button // Provider's import button