Skip to content

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

Bringing the chrome extension up to date

uggrock8b3b870beb24
diff --git a/data/js/ioapi.chrome.js b/data/js/ioapi.chrome.js
index a2108fc36..cea06ebec 100644
--- a/data/js/ioapi.chrome.js
+++ b/data/js/ioapi.chrome.js
@@ -90,7 +90,9 @@ IOAPI.listDirectory = function(dirPath) {
if(IOAPI.plugin.isDirectory(dirPath)) {
try {
var dirList = IOAPI.plugin.listFiles(dirPath);
- UIAPI.updateFileBrowserData(dirList);
+ console.debug("Dir content: "+JSON.stringify(dirList)); // [{"name":"The-Ultimate-Complete-Social-Media-Sizing-Cheat-Sheet1.png","type":"file","size":1945180,"lmdt":1357742820000},{"name":"IMG_1803[wine].JPG","type":"file","size":2372609,"lmdt":1353796522000}]
+ UIAPI.updateFileBrowserData(JSON.parse( JSON.stringify(dirList)));
+ //UIAPI.updateFileBrowserData(JSON.parse( '[{"name":"The-Ultimate-Complete-Social-Media-Sizing-Cheat-Sheet1.png","type":"file","size":1945180,"lmdt":1357742820000},{"name":"IMG_1803[wine].JPG","type":"file","size":2372609,"lmdt":1353796522000}]' ));
} catch(ex) {
console.error("Directory listing failed "+ex);
}
@@ -99,9 +101,8 @@ IOAPI.listDirectory = function(dirPath) {
}
}
-//TODO Implement getSubdirs for chrome
IOAPI.getSubdirs = function(dirPath) {
- console.debug("Getting subdirs(Not Implemented): "+dirPath);
+ console.debug("Getting subdirs: "+dirPath);
if(IOAPI.plugin.isDirectory(dirPath)) {
try {
var dirList = IOAPI.plugin.listFiles(dirPath);
@@ -115,9 +116,9 @@ IOAPI.getSubdirs = function(dirPath) {
"key": dirPath+IOAPI.pathSeparator+dirList[i].name
});
}
- }
- // TODO Convert JSON to dyntree format
- UIAPI.updateTree(anotatedDirList);
+ }
+ // TODO JSON functions are a workarround for a bug....
+ DirectoriesUI.updateSubDirs(JSON.parse( JSON.stringify(anotatedDirList)));
} catch(ex) {
console.error("Directory listing failed "+ex);
}
@@ -131,3 +132,26 @@ IOAPI.deleteElement = function(path) {
IOAPI.plugin.removeFile(path)
}
+IOAPI.selectDirectory = function() {
+ // TODO implement selectDirectory
+ console.debug("Select directory functionality not implemented on chrome yet!");
+ alert("Select directory functionality not implemented on chrome yet!")
+}
+
+IOAPI.selectFile = function() {
+ // TODO implement selectFile
+ console.debug("Select file functionality not implemented on chrome yet!");
+ alert("Select file functionality not implemented on chrome yet!")
+}
+
+IOAPI.openDirectory = function(dirPath) {
+ // TODO implement openDirectory
+ console.debug("Open directory functionality not implemented on chrome yet!");
+ alert("Open directory functionality not implemented on chrome yet!");
+}
+
+IOAPI.openExtensionsDirectory = function() {
+ // TODO implement openExtensionsDirectory
+ console.debug("Open extensions directory functionality not implemented on chrome yet!");
+ alert("Open extensions directory functionality not implemented on chrome yet!");
+}
\ No newline at end of file
diff --git a/data/js/misc.ui.js b/data/js/misc.ui.js
index 27735bee7..2b3917d5c 100644
--- a/data/js/misc.ui.js
+++ b/data/js/misc.ui.js
@@ -99,6 +99,8 @@ UIAPI.updateFileBrowserData = function(dirList) {
var tags = undefined;
var ext = undefined;
var title = undefined;
+ var fileSize = undefined;
+ var fileLMDT = undefined;
// Sort the dir list alphabetically before displaying
// TODO sorting files not working correctly
dirList.sort(function(a,b) { return a.name.localeCompare(b.name); });
@@ -116,7 +118,11 @@ UIAPI.updateFileBrowserData = function(dirList) {
// title = dirList[i].name;
ext = "";
}
- var entry = [dirList[i].name,dirList[i].size,dirList[i].lmdt,title,tags,ext];
+ fileSize = dirList[i].size;
+ fileLMDT = dirList[i].lmdt;
+ if(fileSize == undefined) fileSize = "";
+ if(fileLMDT == undefined) fileLMDT = "";
+ var entry = [dirList[i].name,fileSize,fileLMDT,title,tags,ext];
UIAPI.fileList.push(entry);
}
}
diff --git a/data/js/tagspace.api.js b/data/js/tagspace.api.js
index ec258f653..8d822ed2c 100644
--- a/data/js/tagspace.api.js
+++ b/data/js/tagspace.api.js
@@ -20,6 +20,7 @@ TSAPI.createSearchIndex = function(currentLocation) {
}
TSAPI.formatDateTime = function(date, includeTime) {
+ if( (date == undefined) || (date == "") ) return "";
var d = new Date(date);
var cDate = d.getDate();
cDate = cDate + "";
diff --git a/data/manifest.json b/data/manifest.json
index ddcb27d21..d8ca318a6 100644
--- a/data/manifest.json
+++ b/data/manifest.json
@@ -1,6 +1,6 @@
{
"name": "TagSpaces",
- "version": "1.1.1186",
+ "version": "1.2.1197",
"manifest_version": 2,
"description": "TagSpaces Explorer",
"icons": {
@@ -24,8 +24,9 @@
{"path": "chrome/npapi-fileio/npapi-file-io-64.so", "public": false}
],
"permissions": [
- "tabs", "http://*/*"
+ "tabs", "http://*/*", "file://*/*"
],
+ "content_security_policy": "script-src 'self' ; object-src 'self'",
"web_accessible_resources": [
"about.html"
],