Skip to content

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

jshinting + i18n-ing

Ilian6714e3e1424b
diff --git a/data/cordova/cordova.api.js b/data/cordova/cordova.api.js
index 492ae42b5..c6edd6536 100644
--- a/data/cordova/cordova.api.js
+++ b/data/cordova/cordova.api.js
@@ -1,6 +1,8 @@
-/* Copyright (c) 2012-2013 The TagSpaces Authors. All rights reserved.
+/* Copyright (c) 2012-2014 The TagSpaces Authors. All rights reserved.
* Use of this source code is governed by a AGPL3 license that
* can be found in the LICENSE file. */
+/* global define */
+
define(function (require, exports, module) {
"use strict";
@@ -22,9 +24,9 @@ define(function (require, exports, module) {
// Redifining the back button
document.addEventListener("backbutton", function(e){
- TSCORE.FileOpener.closeFile();
- $('.modal').modal('hide');
- e.preventDefault();
+ TSCORE.FileOpener.closeFile();
+ $('.modal').modal('hide');
+ e.preventDefault();
}, false);
getFileSystem();
@@ -46,24 +48,24 @@ define(function (require, exports, module) {
function scanDirectory(entries) {
var i;
for (i = 0; i < entries.length; i++) {
- if (entries[i].isFile) {
- console.log("File: "+entries[i].name);
- anotatedDirListing.push({
- "name": entries[i].name,
- "isFile": entries[i].isFile,
- "size": "", // TODO
- "lmdt": "", //
- "path": entries[i].fullPath
- });
- } else {
- var directoryReader = entries[i].createReader();
- pendingRecursions++;
- directoryReader.readEntries(
- scanDirectory,
- function (error) {
+ if (entries[i].isFile) {
+ console.log("File: " + entries[i].name);
+ anotatedDirListing.push({
+ "name": entries[i].name,
+ "isFile": entries[i].isFile,
+ "size": "", // TODO
+ "lmdt": "", //
+ "path": entries[i].fullPath
+ });
+ } else {
+ var directoryReader = entries[i].createReader();
+ pendingRecursions++;
+ directoryReader.readEntries(
+ scanDirectory,
+ function (error) {
console.log("Error reading dir entries: " + error.code);
- } );
- }
+ });
+ }
}
pendingRecursions--;
console.log("Pending recursions: " + pendingRecursions);
@@ -72,7 +74,7 @@ define(function (require, exports, module) {
}
}
- var anotatedDirListing = undefined;
+ var anotatedDirListing;
var pendingRecursions = 0;
var createDirectoryIndex = function(dirPath) {
dirPath = dirPath+"/"; // TODO make it platform independent
@@ -108,7 +110,7 @@ define(function (require, exports, module) {
tree["children"].push({
"name": entries[i].name,
"isFile": entries[i].isFile,
- "size": "", // TODO
+ "size": "", // TODO size and lmtd
"lmdt": "", //
"path": entries[i].fullPath
});
@@ -146,10 +148,10 @@ define(function (require, exports, module) {
var checkNewVersion = function() {
console.log("Checking for new version...");
- var cVer = TSCORE.Config.DefaultSettings["appVersion"]+"."+TSCORE.Config.DefaultSettings["appBuild"];
+ var cVer = TSCORE.Config.DefaultSettings.appVersion+"."+TSCORE.Config.DefaultSettings.appBuild;
$.ajax({
url: 'http://tagspaces.org/releases/version.json?pVer='+cVer,
- type: 'GET',
+ type: 'GET'
})
.done(function(data) {
TSPOSTIO.checkNewVersion(data);
@@ -232,7 +234,7 @@ define(function (require, exports, module) {
});
pendingCallbacks--;
console.log("File: "+entry.name+" Size: "+entry.size+ " i:"+i+" Callb: "+pendingCallbacks);
- if(pendingCallbacks == 0 && i == entries.length) {
+ if(pendingCallbacks === 0 && i === entries.length) {
TSPOSTIO.listDirectory(anotatedDirList);
}
}, function (error) { // error get file system
@@ -249,13 +251,13 @@ define(function (require, exports, module) {
"path": normalizedPath
});
console.log("Dir: "+entries[i].name+ " I:"+i+" Callb: "+pendingCallbacks);
- if((pendingCallbacks == 0) && ((i+1) == entries.length)) {
+ if((pendingCallbacks === 0) && ((i+1) == entries.length)) {
TSPOSTIO.listDirectory(anotatedDirList);
}
}
}
- if(pendingCallbacks == 0) {
+ if(pendingCallbacks === 0) {
TSPOSTIO.listDirectory(anotatedDirList);
}
//console.log("Dir content: " + JSON.stringify(entries));
@@ -310,11 +312,11 @@ define(function (require, exports, module) {
reader.onloadend = function(evt) {
TSPOSTIO.loadTextFile(evt.target.result);
};
- if(isPreview) {
- reader.readAsText(file.slice(0,10000));
- } else {
- reader.readAsText(file);
- }
+ if(isPreview) {
+ reader.readAsText(file.slice(0,10000));
+ } else {
+ reader.readAsText(file);
+ }
},
function() {
console.log("error getting file: "+filePath);
@@ -334,8 +336,8 @@ define(function (require, exports, module) {
// Handling the UTF8 support for text files
var UTF8_BOM = "\ufeff";
- if(content.indexOf(UTF8_BOM) == 0) {
- // already has a UTF8 bom
+ if(content.indexOf(UTF8_BOM) === 0) {
+ console.log("Content beging with a UTF8 bom");
} else {
content = UTF8_BOM+content;
}
@@ -418,7 +420,7 @@ define(function (require, exports, module) {
};
var selectFile = function() {
- console.log("Operation selectFile not supported on Android!");
+ console.log("Operation selectFile not supported.");
};
var checkAccessFileURLAllowed = function() {
@@ -426,7 +428,7 @@ define(function (require, exports, module) {
};
var openDirectory = function(dirPath) {
- TSCORE.showAlertDialog("Select file functionality not supported on Android!");
+ TSCORE.showAlertDialog($.i18n.t("ns.dialogs:openContainingDirectoryAlert"));
//dirPath = normalizePath(dirPath);
//window.open(dirPath,"_blank", "location=no");
};
@@ -461,11 +463,11 @@ define(function (require, exports, module) {
TSPOSTIO.getFileProperties(fileProperties);
},
function() {
- console.warn("Error retrieving file properties of "+filePath);
+ console.log("Error retrieving file properties of "+filePath);
}
);
} else {
- console.warn("Error getting file properties. "+filePath+" is directory");
+ console.log("Error getting file properties. "+filePath+" is directory");
}
},
function() {