Skip to content

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

reactivating loading animation

Ilian64ed94cbcedd
diff --git a/data/js/ioapi.chrome.js b/data/js/ioapi.chrome.js
index 483cbc927..655220e00 100644
--- a/data/js/ioapi.chrome.js
+++ b/data/js/ioapi.chrome.js
@@ -141,6 +141,7 @@ IO-API
var loadTextFile = function(filePath) {
console.log("Loading file: "+filePath);
+ TSCORE.showLoadingAnimation();
if(nativeIO.fileExists(filePath)) {
var blob;
var size = nativeIO.getFileSize(filePath);
@@ -164,6 +165,7 @@ IO-API
var listDirectory = function(dirPath) {
console.log("Listing directory: "+dirPath);
+ TSCORE.showLoadingAnimation();
if(nativeIO.isDirectory(dirPath)) {
var dirList = nativeIO.getDirEntries(dirPath);
var anotatedDirList = [];
@@ -195,6 +197,7 @@ IO-API
var deleteElement = function(path) {
console.log("Deleting: "+path);
+ TSCORE.showLoadingAnimation();
try {
if(!nativeIO.isDirectory(path)) {
nativeIO.removeRecursively(path);
@@ -207,6 +210,7 @@ IO-API
var createDirectoryIndex = function(dirPath) {
console.log("Creating index for directory: "+dirPath);
+ TSCORE.showLoadingAnimation();
var directoryIndex = [];
directoryIndex = scanDirectory(dirPath, directoryIndex);
//console.log(JSON.stringify(directoryIndex));
@@ -214,6 +218,7 @@ IO-API
};
var createDirectoryTree = function(dirPath) {
+ TSCORE.showLoadingAnimation();
console.log("Creating directory index for: "+dirPath);
var directoyTree = generateDirectoryTree(dirPath);
//console.log(JSON.stringify(directoyTree));
@@ -221,6 +226,7 @@ IO-API
};
var saveTextFile = function(filePath,content) {
+ TSCORE.showLoadingAnimation();
console.log("Saving file: "+filePath);
var byteArray = [];
for (var i = 0; i < content.length; ++i)
@@ -239,7 +245,8 @@ IO-API
};
var createDirectory = function(dirPath) {
- console.log("Creating directory: "+dirPath);
+ console.log("Creating directory: "+dirPath);
+ TSCORE.showLoadingAnimation();
try {
nativeIO.createDirectory(dirPath);
TSPOSTIO.createDirectory();
@@ -250,6 +257,7 @@ IO-API
var renameFile = function(filePath, newFilePath) {
console.log("Renaming file: "+filePath+" to "+newFilePath);
+ TSCORE.showLoadingAnimation();
if(filePath.toLowerCase() == newFilePath.toLowerCase()) {
console.log("Initial and target filenames are the same...");
return false;
diff --git a/data/js/ioapi.cordova.js b/data/js/ioapi.cordova.js
index 175978818..28b7bc7aa 100644
--- a/data/js/ioapi.cordova.js
+++ b/data/js/ioapi.cordova.js
@@ -141,6 +141,7 @@ define(function (require, exports, module) {
};
var listDirectory = function (dirPath) {
+ TSCORE.showLoadingAnimation();
// directory path format DCIM/Camera/ !
dirPath = dirPath+"/"; // TODO make it platform independent
dirPath = normalizePath(dirPath);
@@ -212,6 +213,7 @@ define(function (require, exports, module) {
var deleteElement = function(path) {
console.log("Deleting: "+path);
+ TSCORE.showLoadingAnimation();
path = normalizePath(path);
@@ -234,8 +236,10 @@ define(function (require, exports, module) {
};
var loadTextFile = function(filePath) {
- filePath = normalizePath(filePath);
console.log("Loading file: "+filePath);
+ TSCORE.showLoadingAnimation();
+
+ filePath = normalizePath(filePath);
fsRoot.getFile(filePath, {create: false, exclusive: false},
function(entry) {
entry.file(
@@ -258,8 +262,10 @@ define(function (require, exports, module) {
};
var saveTextFile = function(filePath,content) {
- filePath = normalizePath(filePath);
console.log("Saving file: "+filePath);
+ TSCORE.showLoadingAnimation();
+
+ filePath = normalizePath(filePath);
fsRoot.getFile(filePath, {create: true, exclusive: false},
function(entry) {
entry.createWriter(
@@ -281,8 +287,11 @@ define(function (require, exports, module) {
};
var createDirectory = function(dirPath) {
- dirPath = normalizePath(dirPath);
console.log("Creating directory: "+dirPath);
+ TSCORE.showLoadingAnimation();
+
+ dirPath = normalizePath(dirPath);
+
fsRoot.getDirectory(dirPath, {create: true, exclusive: false},
function (dirEntry) {
TSPOSTIO.createDirectory();
@@ -294,6 +303,8 @@ define(function (require, exports, module) {
};
var renameFile = function(filePath, newFilePath) {
+ TSCORE.showLoadingAnimation();
+
filePath = normalizePath(filePath);
var newFileName = newFilePath.substring(newFilePath.lastIndexOf('/')+1);
var newFileParentPath = normalizePath(newFilePath.substring(0, newFilePath.lastIndexOf('/')));
diff --git a/data/js/ioapi.dropbox.js b/data/js/ioapi.dropbox.js
index 8d94420b3..f0ec03818 100644
--- a/data/js/ioapi.dropbox.js
+++ b/data/js/ioapi.dropbox.js
@@ -75,6 +75,8 @@ define(function (require, exports, module) {
};
var listDirectory = function (dirPath) {
+ TSCORE.showLoadingAnimation();
+
dirPath = dirPath+"/"; // TODO make it platform independent
console.log("Listing directory: " + dirPath);
@@ -108,6 +110,8 @@ define(function (require, exports, module) {
var deleteElement = function(path) {
console.log("Deleting: "+path);
+ TSCORE.showLoadingAnimation();
+
fsRoot.unlink(path, function (err, stat) {
if(err) {
console.log("Error deleting path: "+err);
@@ -120,6 +124,8 @@ define(function (require, exports, module) {
var createDirectoryIndex = function(dirPath) {
console.log("Creating index for directory: "+dirPath);
+ TSCORE.showLoadingAnimation();
+
TSCORE.showAlertDialog("Creating directory index is not supported on Android yet.");
/* var directoryIndex = [];
directoryIndex = scanDirectory(dirPath, directoryIndex);
@@ -129,6 +135,8 @@ define(function (require, exports, module) {
var createDirectoryTree = function(dirPath) {
console.log("Creating directory index for: "+dirPath);
+ TSCORE.showLoadingAnimation();
+
TSCORE.showAlertDialog("Creating directory tree is not supported on Android yet.");
/* var directoyTree = generateDirectoryTree(dirPath);
//console.log(JSON.stringify(directoyTree));
@@ -137,6 +145,8 @@ define(function (require, exports, module) {
var loadTextFile = function(filePath) {
console.log("Loading file: "+filePath);
+ TSCORE.showLoadingAnimation();
+
fsRoot.readFile(filePath, function (err, data, stat) {
if(err) {
console.log("Error loading file: "+err);
@@ -148,6 +158,8 @@ define(function (require, exports, module) {
var saveTextFile = function(filePath,content) {
console.log("Saving file: "+filePath);
+ TSCORE.showLoadingAnimation();
+
fsRoot.writeFile(filePath, content, function (err, stat) {
if(err) {
console.log("Error creating/saving file: "+err);
@@ -159,6 +171,8 @@ define(function (require, exports, module) {
var createDirectory = function(dirPath) {
console.log("Creating directory: "+dirPath);
+ TSCORE.showLoadingAnimation();
+
fsRoot.mkdir(dirPath, function (err, stat) {
if(err) {
console.log("Error creating directory: "+err);
@@ -171,6 +185,8 @@ define(function (require, exports, module) {
var renameFile = function(filePath, newFilePath) {
console.log("Renaming file from: "+filePath+" to: "+newFilePath);
+ TSCORE.showLoadingAnimation();
+
fsRoot.move(filePath, newFilePath, function (err, stat) {
if(err) {
console.log("Error renaming: "+err);
diff --git a/data/js/ioapi.mozilla.js b/data/js/ioapi.mozilla.js
index 6cab5b08e..a6a33ddc7 100644
--- a/data/js/ioapi.mozilla.js
+++ b/data/js/ioapi.mozilla.js
@@ -14,7 +14,6 @@ define(function(require, exports, module) {
document.documentElement.addEventListener("tsMessage", function(event) {
console.log("Message received in page script from content script: "); //+JSON.stringify(event.detail));
- TSCORE.hideLoadingAnimation();
var message = event.detail;
switch (message.command) {
case "loadSettings":
diff --git a/data/js/ioapi.node.js b/data/js/ioapi.node.js
index 226c7dceb..29ee7dcd1 100644
--- a/data/js/ioapi.node.js
+++ b/data/js/ioapi.node.js
@@ -116,6 +116,8 @@ define(function(require, exports, module) {
var createDirectoryIndex = function(dirPath) {
console.log("Creating index for directory: "+dirPath);
+ TSCORE.showLoadingAnimation();
+
var directoryIndex = [];
directoryIndex = scanDirectory(dirPath, directoryIndex);
//console.log(JSON.stringify(directoryIndex));
@@ -124,6 +126,8 @@ define(function(require, exports, module) {
var createDirectoryTree = function(dirPath) {
console.log("Creating directory index for: "+dirPath);
+ TSCORE.showLoadingAnimation();
+
var directoyTree = generateDirectoryTree(dirPath);
//console.log(JSON.stringify(directoyTree));
TSPOSTIO.createDirectoryTree(directoyTree);
@@ -131,6 +135,8 @@ define(function(require, exports, module) {
var createDirectory = function(dirPath) {
console.log("Creating directory: "+dirPath);
+ TSCORE.showLoadingAnimation();
+
fs.mkdir(dirPath, function(error) {
if (error) {
console.log("Creating directory "+dirPath+" failed "+error);
@@ -142,6 +148,8 @@ define(function(require, exports, module) {
var renameFile = function(filePath, newFilePath) {
console.log("Renaming file: "+filePath+" to "+newFilePath);
+ TSCORE.showLoadingAnimation();
+
if(filePath.toLowerCase() == newFilePath.toLowerCase()) {
console.log("Initial and target filenames are the same...");
return false;
@@ -161,6 +169,8 @@ define(function(require, exports, module) {
var loadTextFile = function(filePath) {
console.log("Loading file: "+filePath);
+ TSCORE.showLoadingAnimation();
+
fs.readFile(filePath, 'utf8', function(error, content) {
if (error) {
console.log("Loading file "+filePath+" failed "+error);
@@ -172,6 +182,8 @@ define(function(require, exports, module) {
var saveTextFile = function(filePath,content) {
console.log("Saving file: "+filePath);
+ TSCORE.showLoadingAnimation();
+
// TODO check if fileExist by saving needed
/* if(plugin.fileExists(filePath)) {
plugin.removeFile(filePath);
@@ -187,6 +199,8 @@ define(function(require, exports, module) {
var listDirectory = function(dirPath) {
console.log("Listing directory: "+dirPath);
+ TSCORE.showLoadingAnimation();
+
try {
fs.readdir(dirPath, function(error, dirList) {
if (error) {
@@ -218,6 +232,8 @@ define(function(require, exports, module) {
var deleteElement = function(path) {
console.log("Deleting: "+path);
+ TSCORE.showLoadingAnimation();
+
fs.unlink(path, function(error) {
if (error) {
console.log("Deleting file "+path+" failed "+error);