Skip to content

TagSpaces is an offline, open source, document manager with tagging support

Introducing post io module

uggrock9e2de90403a9
diff --git a/data/js/core.api.js b/data/js/core.api.js
index 83d41f9df..91dd4f256 100644
--- a/data/js/core.api.js
+++ b/data/js/core.api.js
@@ -72,14 +72,11 @@ define(function(require, exports, module) {
tsDirectoriesUI.initFavorites();
tsTagsUI.generateTagGroups();
-
$( "#loading" ).hide();
$( "#container" ).show();
$( "#helpers" ).show();
-
-
hideLoadingAnimation();
// TODO check if document.ready is really needed
$(document).ready(function() {
diff --git a/data/js/ioapi.node.js b/data/js/ioapi.node.js
index c98322db8..af62f9c65 100644
--- a/data/js/ioapi.node.js
+++ b/data/js/ioapi.node.js
@@ -6,8 +6,10 @@ define(function(require, exports, module) {
// Activating browser specific exports modul
console.log("Loading ioapi.node.js..");
-
- var TSCORE = require("tscore");
+
+ var TSCORE = require("tscore");
+
+ var TSPOSTIO = require("tspostioapi");
/* stats for file:
dev: 2114,
@@ -97,14 +99,14 @@ define(function(require, exports, module) {
var directoryIndex = [];
directoryIndex = scanDirectory(dirPath, directoryIndex);
//console.log(JSON.stringify(directoryIndex));
- TSCORE.PerspectiveManager.updateFileBrowserData(directoryIndex);
+ TSPOSTIO.createDirectoryIndex(directoryIndex);
}
exports.createDirectoryTree = function(dirPath) {
console.log("Creating directory index for: "+dirPath);
var directoyTree = generateDirectoryTree(dirPath);
//console.log(JSON.stringify(directoyTree));
- TSCORE.PerspectiveManager.updateTreeData(directoyTree);
+ TSPOSTIO.createDirectoryTree(directoyTree);
}
exports.createDirectory = function(dirPath) {
@@ -114,7 +116,7 @@ define(function(require, exports, module) {
console.log("Creating directory "+dirPath+" failed "+error);
return;
}
- //TODO refresh the directory area
+ TSPOSTIO.createDirectory();
});
}
@@ -125,7 +127,7 @@ define(function(require, exports, module) {
console.log("Renaming file failed "+error);
return;
}
- TSCORE.PerspectiveManager.refreshFileListContainer();
+ TSPOSTIO.renameFile();
});
}
@@ -136,7 +138,7 @@ define(function(require, exports, module) {
console.log("Loading file "+filePath+" failed "+error);
return;
}
- TSCORE.FileOpener.updateEditorContent(content);
+ TSPOSTIO.loadTextFile(content);
});
}
@@ -151,11 +153,7 @@ define(function(require, exports, module) {
console.log("Save to file "+filePath+" failed "+error);
return;
}
- TSCORE.PerspectiveManager.refreshFileListContainer();
- if(TSCORE.FileOpener.isFileOpened()) {
- // TODO Automatically reopening of the file is not desirable in every case ...
- TSCORE.FileOpener.openFile(message.content);
- }
+ TSPOSTIO.saveTextFile();
});
}
@@ -182,7 +180,7 @@ define(function(require, exports, module) {
"path": path
});
}
- TSCORE.PerspectiveManager.updateFileBrowserData(anotatedDirList);
+ TSPOSTIO.listDirectory(anotatedDirList);
});
} catch(ex) {
console.error("Listing directory "+dirPath+" failed "+ex);
@@ -210,7 +208,7 @@ define(function(require, exports, module) {
});
}
}
- TSCORE.updateSubDirs(anotatedDirList);
+ TSPOSTIO.getSubdirs(anotatedDirList);
});
} catch(ex) {
console.error("Listing directory "+dirPath+" failed "+ex);
@@ -224,7 +222,7 @@ define(function(require, exports, module) {
console.log("Deleting file "+path+" failed "+error);
return;
}
- TSCORE.PerspectiveManager.refreshFileListContainer();
+ TSPOSTIO.deleteElement();
});
}
@@ -236,7 +234,7 @@ define(function(require, exports, module) {
type: 'GET',
})
.done(function(data) {
- TSCORE.updateNewVersionData(data);
+ TSPOSTIO.checkNewVersion(data);
})
.fail(function(data) {
console.log("AJAX failed "+data);
@@ -250,7 +248,7 @@ define(function(require, exports, module) {
}
var chooser = $('#folderDialog');
chooser.change(function(evt) {
- $("#folderLocation").val($(this).val());
+ TSPOSTIO.selectDirectory($(this).val());
});
chooser.trigger('click');
}
diff --git a/data/loader.js b/data/loader.js
index 966201426..3d2554d33 100644
--- a/data/loader.js
+++ b/data/loader.js
@@ -110,8 +110,8 @@ requirejs.config({
tstagsui: 'js/tags.ui',
tsdirectoriesui: 'js/directories.ui',
tscoreui: 'js/core.ui',
+ tspostioapi: 'js/postioapi',
tsioapi: IO_JS,
- tsiomozrec: 'js/ioapi.mozilla.receiver'
},
shim: {
'bootstrap': { deps: ['jquery'] },
diff --git a/lib/main.js b/lib/main.js
index 7211e2ce3..5aa0aceb8 100644
--- a/lib/main.js
+++ b/lib/main.js
@@ -35,7 +35,7 @@ exports.main = function(options, callbacks) {
'self.on("message", function(message) {'+
'console.log("Message received in content script from addon: "+JSON.stringify(message));'+
'var event = document.createEvent("CustomEvent");'+
- 'event.initCustomEvent("addon-message1", true, true, message);'+
+ 'event.initCustomEvent("tsMessage", true, true, message);'+
'document.documentElement.dispatchEvent(event); '+
'}); '+
'document.documentElement.addEventListener("addon-message", function(event) {'+