Skip to content

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

completing ioapi.node.js

uggrock973d208c5902
diff --git a/data/ext/editorMirror/extension.js b/data/ext/editorMirror/extension.js
index 13f452b99..a8d9cdd9e 100644
--- a/data/ext/editorMirror/extension.js
+++ b/data/ext/editorMirror/extension.js
@@ -35,29 +35,34 @@ define(function(require, exports, module) {
//TODO if (mode != null)
require([
extensionDirectory+'/codemirror/codemirror.js',
- 'css!'+extensionDirectory+'/codemirror/codemirror.css',
- "./codemirror/mode/" + mode + "/" + mode + ".js"
+ 'css!'+extensionDirectory+'/codemirror/codemirror.css',
+ 'css!'+extensionDirectory+'/extension.css',
], function() {
- cmEditor = CodeMirror(document.getElementById("code"), {
- fixedGutter: false,
- mode: mode,
- lineNumbers: true,
- lineWrapping: true,
- tabSize: 2,
- collapseRange: true,
- matchBrackets: true,
- //theme: "lesser-dark",
- /* extraKeys: {
- "Cmd-S": function(instance) { handleSaveButton() },
- "Ctrl-S": function(instance) { handleSaveButton() },
- "F5": function(instance) { handleSaveButton() },
- "Ctrl-Space": "autocomplete",
- } */
+ require([
+ extensionDirectory+"./codemirror/mode/" + mode + "/" + mode + ".js",
+ ], function() {
+ cmEditor = CodeMirror(document.getElementById("code"), {
+ fixedGutter: false,
+ mode: mode,
+ lineNumbers: true,
+ lineWrapping: true,
+ tabSize: 2,
+ collapseRange: true,
+ matchBrackets: true,
+ readOnly: isViewerMode,
+ //theme: "lesser-dark",
+ /* extraKeys: {
+ "Cmd-S": function(instance) { handleSaveButton() },
+ "Ctrl-S": function(instance) { handleSaveButton() },
+ "F5": function(instance) { handleSaveButton() },
+ "Ctrl-Space": "autocomplete",
+ } */
+ });
+
+ //cmEditor.readOnly = isViewerMode;
+ cmEditor.setSize("100%","100%");
+ TSCORE.IO.loadTextFile(filePath);
});
-
- cmEditor.readOnly = isViewerMode;
- cmEditor.setSize("100%","100%");
- TSCORE.IO.loadTextFile(filePath);
});
}
diff --git a/data/js/fileopener.js b/data/js/fileopener.js
index 5d685c358..6139d20ab 100644
--- a/data/js/fileopener.js
+++ b/data/js/fileopener.js
@@ -70,8 +70,7 @@ define(function(require, exports, module) {
} else {
require([TSCORE.Config.getExtensionPath()+"/"+viewerExt+"/extension.js"], function(viewer) {
_tsEditor = viewer;
- _tsEditor.init(filePath, "viewer");
- _tsEditor.viewerMode(true);
+ _tsEditor.init(filePath, "viewer", true);
});
}
TSCORE.FileOpener.setFileOpened(true);
@@ -106,7 +105,7 @@ define(function(require, exports, module) {
try {
require([TSCORE.Config.getExtensionPath()+"/"+editorExt+"/extension.js"], function(editr) {
_tsEditor = editr;
- _tsEditor.init(filePath, "viewer");
+ _tsEditor.init(filePath, "viewer", false);
});
_isEditMode = true;
} catch(ex) {
diff --git a/data/js/ioapi.chrome.js b/data/js/ioapi.chrome.js
index 3ef968ea1..1766bf51f 100644
--- a/data/js/ioapi.chrome.js
+++ b/data/js/ioapi.chrome.js
@@ -1,15 +1,12 @@
-/* Copyright (c) 2012 The Tagspaces Authors. All rights reserved.
+/* Copyright (c) 2012-2013 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. */
-
-// TODO use eventually this http://developer.chrome.com/extensions/fileBrowserHandler.html
-
define(function(require, exports, module) {
"use strict";
// Activating browser specific exports modul
console.log("Loading ioapi.chrome.js..");
-
+
var TSCORE = require("tscore");
/**
@@ -37,6 +34,15 @@ New:
void watchDirectory(std::string key, std::string path, FB::JSObjectPtr callback);
void stopWatching(std::string key);
std::string getChromeDataDir(std::string version);
+
+Missing:
+ renameFile
+ createDirectory
+ openDirectory
+ selectDirectory
+
+ fileSize buggy
+ lastModified datetime
*/
var plugin = document.createElement("embed");
@@ -53,11 +59,10 @@ New:
function scanDirectory(dirPath, index) {
try {
var dirList = nativeIO.getDirEntries(dirPath);
- var index = [];
for (var i=0; i < dirList.length; i++) {
var path = dirPath+getDirseparator()+dirList[i];
var isDir = nativeIO.isDirectory(path);
- var fileSize = nativeIO.getFileSize(path);
+ var fileSize = 0; //nativeIO.getFileSize(path);
index.push({
"name": dirList[i],
"type": isDir?"directory":"file",
@@ -65,7 +70,7 @@ New:
"lmdt": "0",
"path": path
});
- if (!file.isFile()) {
+ if (isDir) {
scanDirectory(path, index);
}
}
@@ -75,6 +80,35 @@ New:
}
}
+ function generateDirectoryTree(dirPath) {
+ try {
+ var tree = {};
+ tree["name"] = dirPath.substring(dirPath.lastIndexOf(getDirseparator()) + 1, dirPath.length);
+ tree["type"] = "directory";
+ tree["lmdt"] = 0;
+ tree["path"] = dirPath;
+ tree["children"] = [];
+ var dirList = nativeIO.getDirEntries(dirPath);
+ for (var i=0; i < dirList.length; i++) {
+ var path = dirPath+getDirseparator()+dirList[i];
+ var isDir = nativeIO.isDirectory(path);
+ if (!isDir) {
+ tree["children"].push({
+ "name": dirList[i],
+ "type": "file",
+ "size": 0,
+ "lmdt": 0,
+ "path": path
+ });
+ } else {
+ tree["children"].push( generateDirectoryTree(path) );
+ }
+ }
+ return tree;
+ } catch(ex) {
+ console.error("Scanning directory "+dirPath+" failed "+ex);
+ }
+ }
function isWindows() {
return (navigator.platform == 'Win32');
@@ -88,52 +122,55 @@ New:
}
}
- exports.createDirectory = function(dirPath) {
- console.log("Creating directory: "+dirPath);
- if(plugin.isDirectory(dirPath)) {
- console.error("Directory already exists...");
- } else {
- if(plugin.createDirectory(dirPath)) {
- console.log("Directory: "+dirPath+" created.");
- } else {
- console.error("Directory creation failed");
- }
- }
- }
+ exports.checkNewVersion = function() {
+ console.log("Checking for new version...");
+ var cVer = TSCORE.Config.DefaultSettings["appVersion"]+"."+TSCORE.Config.DefaultSettings["appBuild"];
+ $.ajax({
+ url: 'http://tagspaces.org/releases/version.json?cVer='+cVer,
+ type: 'GET',
+ })
+ .done(function(data) {
+ TSCORE.updateNewVersionData(data);
+ })
+ .fail(function(data) {
+ console.log("AJAX failed "+data);
+ })
+ ;
+ }
exports.loadTextFile = function(filePath) {
console.log("Loading file: "+filePath);
- if(plugin.fileExists(filePath)) {
- var fileContent = plugin.getTextFile(filePath);
- TSCORE.FileOpener.updateEditorContent(fileContent);
+ if(nativeIO.fileExists(filePath)) {
+ var blob;
+ var size = nativeIO.getFileSize(filePath);
+ if (size){
+ var byteArray = nativeIO.contentsAtPath(filePath);
+ blob = new Int8Array(byteArray);
+ } else {
+ blob = new Int8Array(0);
+ }
+ var b = new Blob([blob]);
+ b.size = size;
+ var reader = new FileReader();
+ reader.onload = function (e) {
+ TSCORE.FileOpener.updateEditorContent(e.target.result);
+ }
+ reader.readAsText(b);
} else {
console.error("File does not exists...");
}
}
- exports.renameFile = function(filePath, newFilePath) {
- console.log("Renaming file: "+filePath+" to "+newFilePath);
-
- }
-
- exports.saveTextFile = function(filePath,content) {
- console.log("Saving file: "+filePath);
-/* if(plugin.fileExists(filePath)) {
- plugin.removeFile(filePath);
- }
- plugin.saveTextFile(filePath,content);*/
- }
-
exports.listDirectory = function(dirPath) {
console.log("Listing directory: "+dirPath);
- if(plugin.isDirectory(dirPath)) {
+ if(nativeIO.isDirectory(dirPath)) {
try {
var dirList = nativeIO.getDirEntries(dirPath);
var anotatedDirList = [];
for (var i=0; i < dirList.length; i++) {
var path = dirPath+getDirseparator()+dirList[i];
var isDir = nativeIO.isDirectory(path);
- var fileSize = nativeIO.getFileSize(path);
+ var fileSize = 0; //nativeIO.getFileSize(path);
anotatedDirList.push({
"name": dirList[i],
"type": isDir?"directory":"file",
@@ -176,22 +213,68 @@ New:
console.error("Directory does not exists.");
}
}
+
+ exports.deleteElement = function(path) {
+ console.log("Deleting: "+path);
+ try {
+ nativeIO.removeRecursively(path)
+ } catch(ex) {
+ console.error("Deleting file failed "+ex);
+ }
+ }
+
+ exports.createDirectoryIndex = function(dirPath) {
+ console.log("Creating index for directory: "+dirPath);
+ var directoryIndex = [];
+ directoryIndex = scanDirectory(dirPath, directoryIndex);
+ //console.log(JSON.stringify(directoryIndex));
+ TSCORE.PerspectiveManager.updateFileBrowserData(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);
+ }
+
+ exports.saveTextFile = function(filePath,content) {
+ // TODO implement saveTextFile use saveBlobToFile
+ console.log("Saving file: "+filePath);
+ console.log("Saving file functionality not implemented on chrome yet!");
+ TSCORE.showAlertDialog("Saving file functionality not implemented on chrome yet!")
+ }
- exports.deleteElement = function(path) {
- console.log("Deleting: "+path);
-/* TSCORE.PerspectiveManager.refreshFileListContainer();
- plugin.removeFile(path)*/
- }
-
+ exports.renameFile = function(filePath, newFilePath) {
+ // TODO implement renameFile
+ console.log("Renaming file: "+filePath+" to "+newFilePath);
+ console.log("Renaming file functionality not implemented on chrome yet!");
+ TSCORE.showAlertDialog("Renaming file functionality not implemented on chrome yet!")
+ }
+
exports.selectDirectory = function() {
+ // TODO implement selectDirectory
console.log("Select directory functionality not implemented on chrome yet!");
// TSCORE.showAlertDialog("Not implemented yet");
-/* nativeIO.launchFolderSelect(function(dirPath){
+ /* nativeIO.launchFolderSelect(function(dirPath){
if (dirPath && dirPath.length){
$("#favoriteLocation").val(dirPath);
}
- }); */
+ }); */
}
+
+ exports.openDirectory = function(dirPath) {
+ // TODO implement openDirectory
+ console.log("Open directory functionality not implemented on chrome yet!");
+ TSCORE.showAlertDialog("Select file functionality not implemented on chrome yet!")
+ }
+
+ exports.createDirectory = function(dirPath) {
+ // TODO implement create directory
+ console.log("Creating directory: "+dirPath);
+ console.log("Creating directory functionality not implemented on chrome yet!");
+ TSCORE.showAlertDialog("Creating directory functionality not implemented on chrome yet!")
+ }
exports.selectFile = function() {
// TODO implement selectFile
@@ -199,85 +282,9 @@ New:
TSCORE.showAlertDialog("Select file functionality not implemented on chrome yet!")
}
- exports.openDirectory = function(dirPath) {
- // TODO implement openDirectory
- console.log("Open directory functionality not implemented on chrome yet!");
- TSCORE.showAlertDialog("Select file functionality not implemented on chrome yet!")
- }
-
exports.openExtensionsDirectory = function() {
// TODO implement openExtensionsDirectory
console.log("Open extensions directory functionality not implemented on chrome yet!");
TSCORE.showAlertDialog("Open extensions directory functionality not implemented on chrome yet!");
}
-
- exports.createDirectoryIndex = function(dirPath) {
- // TODO implement createDirectoryIndex
- console.log("Directory indexing functionality not implemented on chrome yet!");
- TSCORE.showAlertDialog("Directory indexing functionality not implemented on chrome yet!");
- }
-
- exports.createDirectoryTree = function(dirPath) {
- console.log("Creating directory index for: "+dirPath);
- console.log("Creating Directory Tree functionality not implemented on chrome yet!");
- // TODO implement createDirectoryTree
- TSCORE.PerspectiveManager.updateTreeData();
- }
-
- exports.checkNewVersion = function() {
- console.log("Checking for new version...");
- var cVer = TSCORE.Config.DefaultSettings["appVersion"]+"."+TSCORE.Config.DefaultSettings["appBuild"];
- $.ajax({
- url: 'http://tagspaces.org/releases/version.json?cVer='+cVer,
- type: 'GET',
- })
- .done(function(data) {
- TSCORE.updateNewVersionData(data);
- })
- .fail(function(data) {
- console.log("AJAX failed "+data);
- })
-// .always(function(data) {
-// console.log("ajax complete: "+data);
-// });
- ;
-
- }
-
});
-
-/* Needed for createDirectoryTree
-function directoryTree(dirPath) {
- try {
- var tree = {};
- var dirList = filesIO.list(dirPath);
- var directory = Cc['@mozilla.org/file/local;1'].createInstance(Ci.nsIFile);
- directory.initWithPath(dirPath);
- console.log("Directory "+JSON.stringify(directory));
- tree["name"] = directory.leafName;
- tree["type"] = "directory";
- tree["lmdt"] = directory.lastModifiedTime;
- tree["path"] = dirPath;
- tree["children"] = [];
-
- for (var i=0; i < dirList.length; i++) {
- var path = filesIO.join(dirPath,dirList[i]);
- var file = Cc['@mozilla.org/file/local;1'].createInstance(Ci.nsIFile);
- file.initWithPath(path);
- if (file.isFile()) {
- tree["children"].push({
- "name": file.leafName,
- "type": "file",
- "size": file.fileSize,
- "lmdt": file.lastModifiedTime,
- "path": path
- });
- } else {
- tree["children"].push( directoryTree(path) );
- }
- }
- return tree;
- } catch(ex) {
- console.error("Creating directory index failed "+ex);
- }
-}*/
\ No newline at end of file
diff --git a/data/js/ioapi.cordova.js b/data/js/ioapi.cordova.js
index 03d36da0e..c5c57da56 100644
--- a/data/js/ioapi.cordova.js
+++ b/data/js/ioapi.cordova.js
@@ -1,163 +1,134 @@
/* Copyright (c) 2012-2013 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. */
-console.log("Loading ioapi.cordova.js..");
+define(function (require, exports, module) {
+ "use strict";
+
+ // Activating browser specific exports modul
+ console.log("Loading ioapi.cordova.js..");
+
+ var TSCORE = require("tscore");
+
+ var fsRoot = undefined;
+
+ // handling document ready and phonegap deviceready
+ window.addEventListener('load', function () {
+ console.log(">>>>>>>>>>>>>>>>>>>>>>> Add Ev Li");
+ document.addEventListener('deviceready', onDeviceReady, false);
+ }, false);
+
+ // Phonegap is loaded and can be used
+ function onDeviceReady() {
+ console.log(">>>>>>>>>>>>>>>>>>>>>>> Dev Ready");
+ getFileSystem();
+ }
-var IOAPI = (typeof IOAPI == 'object' && IOAPI != null) ? IOAPI : {};
+ /* get the root file system */
+// function getFileSystem() {
+ console.log(">>>>>>>>>>>>>>>>>>>>>>> FS");
+ window.requestFileSystem(LocalFileSystem.PERSISTENT, 0,
+ function (fileSystem) { // success get file system
+ fsRoot = fileSystem.root;
+ console.log("Filesystem: " + fsRoot);
+ }, function (evt) { // error get file system
+ console.log("File System Error: " + evt.target.error.code);
+ }
+ );
+ // }
-// Determine the directory separator
+ exports.createDirectory = function (dirPath) {
+ console.log("Creating directory: " + dirPath);
+ }
-//IOAPI.pathSeparator = IOAPI.plugin.getPlatform() == 'windows' ? "\\" : '/';
+ exports.loadTextFile = function (filePath) {
+ console.log("Loading file: " + filePath);
+ }
-// Wait for Cordova to load
-
-//document.addEventListener("deviceready", onDeviceReady, false);
+ exports.renameFile = function (filePath, newFilePath) {
+ console.log("Renaming file: " + filePath + " to " + newFilePath);
+ }
-//function onDeviceReady() {
- window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, gotFS, fail);
-//}
+ exports.saveTextFile = function (filePath, content) {
+ console.log("Saving file: " + filePath);
+ }
-function gotFS(fileSystem) {
- fileSystem.root.getFile("readme.txt", {create: true, exclusive: false}, gotFileEntry, fail);
-}
+ exports.listDirectory = function (dirPath) {
+ console.log("Listing directory: " + dirPath);
+ //dirPath = "C:\\Users\\na\\Documents";
+ var curDirectory = new DirectoryEntry("Documents1",dirPath);
+
+ if(curDirectory.isDirectory) {
+ var dirReader = curDirectory.createReader();
+ dirReader.readEntries(
+ function (entries) {
+ var i;
+ var anotatedDirList = [];
+ for (i = 0; i < entries.length; i++) {
+ console.log(entries[i].name);
+ anotatedDirList.push({
+ "name": entries[i].name,
+ "type": entries[i].isDirectory ? "directory" : "file",
+ "size": "0",
+ "lmdt": "0",
+ "path": entries[i].fullPath
+ });
+ }
+ // {"isFile":true,"isDirectory":false,"name":"bla.png","fullPath":"C:\\Users\\na\\Documents\\bla.png","filesystem":null}
+ //console.log("Dir content: " + JSON.stringify(entries));
+ TSCORE.PerspectiveManager.updateFileBrowserData(anotatedDirList);
+ },
+ function (ex) {
+ console.log("Listing directory " + dirPath + " failed: " + ex);
+ }
+ );
+ } else {
+ console.error("Directory does not exists.");
+ }
+ }
-function gotFileEntry(fileEntry) {
- fileEntry.createWriter(gotFileWriter, fail);
-}
+ exports.getSubdirs = function (dirPath) {
+ console.log("Getting subdirs: " + dirPath);
+ }
-function gotFileWriter(writer) {
- writer.onwriteend = function(evt) {
- console.log("contents of file now 'some sample text'");
- writer.truncate(11);
- writer.onwriteend = function(evt) {
- console.log("contents of file now 'some sample'");
- writer.seek(4);
- writer.write(" different text");
- writer.onwriteend = function(evt){
- console.log("contents of file now 'some different text'");
- }
- };
- };
- writer.write("some sample text");
-}
-
-
-// Test if plugin works
-console.log("Current platform: "+IOAPI.plugin.getPlatform()+" with path separator: "+IOAPI.pathSeparator);
-
-IOAPI.createDirectory = function(dirPath) {
- console.log("Creating directory: "+dirPath);
- if(IOAPI.plugin.isDirectory(dirPath)) {
- console.error("Directory already exists...");
- } else {
- if(IOAPI.plugin.createDirectory(dirPath)) {
- console.log("Directory: "+dirPath+" created.");
- } else {
- console.error("Directory creation failed");
- }
+ exports.deleteElement = function (path) {
+ console.log("Deleting: " + path);
+ // IOAPI.plugin.removeFile(path)
}
-}
-
-IOAPI.loadTextFile = function(filePath) {
- console.log("Loading file: "+filePath);
- if(IOAPI.plugin.fileExists(filePath)) {
- var fileContent = IOAPI.plugin.getTextFile(filePath);
- UIAPI.FileOpener.updateEditorContent(fileContent);
- } else {
- console.error("File does not exists...");
- }
-}
-
-// TODO Renaming very slow, due the copy implementation
-IOAPI.renameFile = function(filePath, newFilePath) {
- console.log("Renaming file: "+filePath+" to "+newFilePath);
- if(IOAPI.plugin.fileExists(newFilePath)) {
- console.error("Target file already exists: "+newFilePath);
- } else {
- if(IOAPI.plugin.fileExists(filePath)) {
- IOAPI.plugin.saveBinaryFile(newFilePath,IOAPI.plugin.getBinaryFile(filePath));
- IOAPI.plugin.removeFile(filePath);
- console.log("File renamed to: "+newFilePath);
- } else {
- console.error("Original file does not exists: "+filePath);
- }
+
+ exports.selectDirectory = function () {
+ // TODO implement selectDirectory
+ console.log("Select directory functionality not implemented on cordova yet!");
}
-}
-IOAPI.saveTextFile = function(filePath,content) {
- console.log("Saving file: "+filePath);
- if(IOAPI.plugin.fileExists(filePath)) {
- IOAPI.plugin.removeFile(filePath);
+ exports.selectFile = function () {
+ // TODO implement selectFile
+ console.log("Select file functionality not implemented on cordova yet!");
}
- IOAPI.plugin.saveTextFile(filePath,content);
-}
-
-IOAPI.listDirectory = function(dirPath) {
- console.log("Listing directory: "+dirPath);
- if(IOAPI.plugin.isDirectory(dirPath)) {
- try {
- var dirList = IOAPI.plugin.listFiles(dirPath);
- console.log("Dir content: "+JSON.stringify(dirList));
- UIAPI.PerspectiveManager.updateFileBrowserData(dirList);
- } catch(ex) {
- console.error("Directory listing failed "+ex);
- }
- } else {
- console.error("Directory does not exists.");
- }
-}
-
-IOAPI.getSubdirs = function(dirPath) {
- console.log("Getting subdirs: "+dirPath);
- if(IOAPI.plugin.isDirectory(dirPath)) {
- try {
- var dirList = IOAPI.plugin.listFiles(dirPath);
- var anotatedDirList = [];
- for (var i=0; i < dirList.length; i++) {
- if(dirList[i].type == "directory") {
- anotatedDirList.push({
- "title": dirList[i].name,
- "isFolder": true,
- "isLazy": true,
- "key": dirPath+IOAPI.pathSeparator+dirList[i].name
- });
- }
- }
- // TODO JSON functions are a workarround for a bug....
- UIAPI.updateSubDirs(JSON.parse( JSON.stringify(anotatedDirList)));
- } catch(ex) {
- console.error("Directory listing failed "+ex);
- }
- } else {
- console.error("Directory does not exists.");
+
+ exports.openDirectory = function (dirPath) {
+ // TODO implement openDirectory
+ console.log("Open directory functionality not implemented on cordova yet!");
}
-}
-
-IOAPI.deleteElement = function(path) {
- console.log("Deleting: "+path);
-// IOAPI.plugin.removeFile(path)
-}
-
-IOAPI.selectDirectory = function() {
- // TODO implement selectDirectory
- console.log("Select directory functionality not implemented on cordova yet!");
- alert("Select directory functionality not implemented on cordova yet!")
-}
-
-IOAPI.selectFile = function() {
- // TODO implement selectFile
- console.log("Select file functionality not implemented on cordova yet!");
- alert("Select file functionality not implemented on cordova yet!")
-}
-
-IOAPI.openDirectory = function(dirPath) {
- // TODO implement openDirectory
- console.log("Open directory functionality not implemented on cordova yet!");
- alert("Open directory functionality not implemented on cordova yet!");
-}
-
-IOAPI.openExtensionsDirectory = function() {
- // TODO implement openExtensionsDirectory
- console.log("Open extensions directory functionality not implemented on cordova yet!");
- alert("Open extensions directory functionality not implemented on cordova yet!");
-}
\ No newline at end of file
+
+ exports.openExtensionsDirectory = function () {
+ // TODO implement openExtensionsDirectory
+ console.log("Open extensions directory functionality not implemented on cordova yet!");
+ }
+
+ exports.checkNewVersion = function () {
+ console.log("Checking for new version...");
+ var cVer = TSCORE.Config.DefaultSettings["appVersion"] + "." + TSCORE.Config.DefaultSettings["appBuild"];
+ $.ajax({
+ url: 'http://tagspaces.org/releases/version.json?pVer=' + cVer,
+ type: 'GET',
+ })
+ .done(function (data) {
+ TSCORE.updateNewVersionData(data);
+ })
+ .fail(function (data) {
+ console.log("AJAX failed " + data);
+ })
+ ;
+
+ }
+});
\ No newline at end of file
diff --git a/data/js/ioapi.node.js b/data/js/ioapi.node.js
index c1b57f1b2..40b0a35c3 100644
--- a/data/js/ioapi.node.js
+++ b/data/js/ioapi.node.js
@@ -1,263 +1,268 @@
-/* Copyright (c) 2012-2013 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. */
-define(function(require, exports, module) {
-"use strict";
-
- // Activating browser specific exports modul
- console.log("Loading ioapi.node.js..");
-
- var TSCORE = require("tscore");
-
-/* stats for file:
- dev: 2114,
- ino: 48064969,
- mode: 33188,
- nlink: 1,
- uid: 85,
- gid: 100,
- rdev: 0,
- size: 527,
- blksize: 4096,
- blocks: 8,
- atime: Mon, 10 Oct 2011 23:24:11 GMT,
- mtime: Mon, 10 Oct 2011 23:24:11 GMT,
- ctime: Mon, 10 Oct 2011 23:24:11 GMT
-*/
-
- function scanDirectory(dirPath, index) {
- try {
- var dirList = fs.readdirSync(dirPath)
- for (var i=0; i < dirList.length; i++) {
- var path = dirPath+getDirseparator()+dirList[i];
- var stats = fs.statSync(path);
- //console.log('stats: ' + JSON.stringify(stats));
- index.push({
- "name": dirList[i],
- "type": stats.isDirectory()?"directory":"file",
- "size": stats.size,
- "lmdt": stats.mtime,
- "path": path
- });
- if (stats.isDirectory()) {
- scanDirectory(path, index);
- }
- }
- return index;
- } catch(ex) {
- console.error("Scanning directory "+dirPath+" failed "+ex);
- }
- }
-
- function isWindows() {
- return (navigator.platform == 'Win32');
- }
-
- function getDirseparator() {
- if(isWindows()) {
- return "\\";
- } else {
- return "/";
- }
- }
-
- function generateDirectoryTree(dirPath) {
- try {
- var tree = {};
- var dstats = fs.statSync(dirPath);
- tree["name"] = pathUtils.basename(dirPath);
- tree["type"] = "directory";
- tree["lmdt"] = dstats.mtime;
- tree["path"] = dirPath;
- tree["children"] = [];
- var dirList = fs.readdirSync(dirPath)
- for (var i=0; i < dirList.length; i++) {
- var path = dirPath+getDirseparator()+dirList[i];
- var stats = fs.statSync(path);
- if (stats.isFile()) {
- tree["children"].push({
- "name": pathUtils.basename(path),
- "type": "file",
- "size": stats.size,
- "lmdt": stats.mtime,
- "path": path
- });
- } else {
- tree["children"].push( generateDirectoryTree(path) );
- }
- }
- return tree;
- } catch(ex) {
- console.error("Scanning directory "+dirPath+" failed "+ex);
- }
- }
-
- exports.createDirectoryIndex = function(dirPath) {
- console.log("Creating index for directory: "+dirPath);
- var directoryIndex = [];
- directoryIndex = scanDirectory(dirPath, directoryIndex);
- //console.log(JSON.stringify(directoryIndex));
- TSCORE.PerspectiveManager.updateFileBrowserData(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);
- }
-
- exports.createDirectory = function(dirPath) {
- console.log("Creating directory: "+dirPath);
- fs.mkdir(dirPath, function(error) {
- if (error) {
- console.log("Creating directory "+dirPath+" failed "+error);
- return;
- }
- //TODO refresh the directory area
- });
- }
-
- exports.renameFile = function(filePath, newFilePath) {
- console.log("Renaming file: "+filePath+" to "+newFilePath);
- fs.rename(filePath, newFilePath, function(error) {
- if (error) {
- console.log("Renaming file failed "+error);
- return;
- }
- TSCORE.PerspectiveManager.refreshFileListContainer();
- });
- }
-
- exports.loadTextFile = function(filePath) {
- console.log("Loading file: "+filePath);
- fs.readFile(filePath, function(error, content) {
- if (error) {
- console.log("Loading file "+filePath+" failed "+error);
- return;
- }
- TSCORE.FileOpener.updateEditorContent(content);
- });
- }
-
- exports.saveTextFile = function(filePath,content) {
- console.log("Saving file: "+filePath);
- // TODO check if fileExist by saving needed
-/* if(plugin.fileExists(filePath)) {
- plugin.removeFile(filePath);
- } */
- fs.writeFile(filePath, content, function(error) {
- if (error) {
- console.log("Save to file "+filePath+" failed "+error);
- return;
- }
- TSCORE.PerspectiveManager.refreshFileListContainer();
- });
- }
-
- exports.listDirectory = function(dirPath) {
- console.log("Listing directory: "+dirPath);
- fs.readdir(dirPath, function(error, dirList) {
- if (error) {
- console.log("Listing directory: "+dirPath+" failed "+error);
- return;
- }
-
- var anotatedDirList = [];
- for (var i=0; i < dirList.length; i++) {
- var path = dirPath+getDirseparator()+dirList[i];
- var path = dirPath+getDirseparator()+dirList[i];
- var stats = fs.statSync(path);
- //console.log('stats: ' + JSON.stringify(stats));
- anotatedDirList.push({
- "name": dirList[i],
- "type": stats.isDirectory()?"directory":"file",
- "size": stats.size,
- "lmdt": stats.mtime,
- "path": path
- });
- }
- TSCORE.PerspectiveManager.updateFileBrowserData(anotatedDirList);
- });
- }
-
- exports.getSubdirs = function(dirPath) {
- console.log("Getting subdirs: "+dirPath);
- fs.readdir(dirPath, function(error, dirList) {
- if (error) {
- console.log("Directory listing failed "+error);
- return;
- }
-
- var anotatedDirList = [];
- for (var i=0; i < dirList.length; i++) {
- var path = dirPath+getDirseparator()+dirList[i];
- var stats = fs.statSync(path);
- if(stats.isDirectory()) {
- anotatedDirList.push({
- "title": dirList[i],
- //"isFolder": true,
- "key": path
- });
- }
- }
- TSCORE.updateSubDirs(anotatedDirList);
- });
- }
-
- exports.deleteElement = function(path) {
- console.log("Deleting: "+path);
- fs.unlink(path, function(error) {
- if (error) {
- console.log("Deleting file "+path+" failed "+error);
- return;
- }
- TSCORE.PerspectiveManager.refreshFileListContainer();
- });
- }
-
- exports.selectDirectory = function() {
- console.log("Select directory functionality not implemented on chrome yet!");
- // TSCORE.showAlertDialog("Not implemented yet");
-/* nativeIO.launchFolderSelect(function(dirPath){
- if (dirPath && dirPath.length){
- $("#favoriteLocation").val(dirPath);
- }
- }); */
- }
-
- exports.selectFile = function() {
- // TODO implement selectFile
- console.log("Select file functionality not implemented on chrome yet!");
- TSCORE.showAlertDialog("Select file functionality not implemented on chrome yet!")
- }
-
- exports.openDirectory = function(dirPath) {
- // TODO implement openDirectory
- console.log("Open directory functionality not implemented on chrome yet!");
- TSCORE.showAlertDialog("Select file functionality not implemented on chrome yet!")
- }
-
- exports.openExtensionsDirectory = function() {
- // TODO implement openExtensionsDirectory
- console.log("Open extensions directory functionality not implemented on chrome yet!");
- TSCORE.showAlertDialog("Open extensions directory functionality not implemented on chrome yet!");
- }
-
- exports.checkNewVersion = function() {
- console.log("Checking for new version...");
- var cVer = TSCORE.Config.DefaultSettings["appVersion"]+"."+TSCORE.Config.DefaultSettings["appBuild"];
- $.ajax({
- url: 'http://tagspaces.org/releases/version.json?cVer='+cVer,
- type: 'GET',
- })
- .done(function(data) {
- TSCORE.updateNewVersionData(data);
- })
- .fail(function(data) {
- console.log("AJAX failed "+data);
- })
- ;
- }
-
-});
\ No newline at end of file
+/* Copyright (c) 2012-2013 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. */
+define(function(require, exports, module) {
+"use strict";
+
+ // Activating browser specific exports modul
+ console.log("Loading ioapi.node.js..");
+
+ var TSCORE = require("tscore");
+
+/* stats for file:
+ dev: 2114,
+ ino: 48064969,
+ mode: 33188,
+ nlink: 1,
+ uid: 85,
+ gid: 100,
+ rdev: 0,
+ size: 527,
+ blksize: 4096,
+ blocks: 8,
+ atime: Mon, 10 Oct 2011 23:24:11 GMT,
+ mtime: Mon, 10 Oct 2011 23:24:11 GMT,
+ ctime: Mon, 10 Oct 2011 23:24:11 GMT
+*/
+
+ function scanDirectory(dirPath, index) {
+ try {
+ var dirList = fs.readdirSync(dirPath)
+ for (var i=0; i < dirList.length; i++) {
+ var path = dirPath+getDirseparator()+dirList[i];
+ var stats = fs.statSync(path);
+ //console.log('stats: ' + JSON.stringify(stats));
+ index.push({
+ "name": dirList[i],
+ "type": stats.isDirectory()?"directory":"file",
+ "size": stats.size,
+ "lmdt": stats.mtime,
+ "path": path
+ });
+ if (stats.isDirectory()) {
+ scanDirectory(path, index);
+ }
+ }
+ return index;
+ } catch(ex) {
+ console.error("Scanning directory "+dirPath+" failed "+ex);
+ }
+ }
+
+ function isWindows() {
+ return (navigator.platform == 'Win32');
+ }
+
+ function getDirseparator() {
+ if(isWindows()) {
+ return "\\";
+ } else {
+ return "/";
+ }
+ }
+
+ function generateDirectoryTree(dirPath) {
+ try {
+ var tree = {};
+ var dstats = fs.statSync(dirPath);
+ tree["name"] = pathUtils.basename(dirPath);
+ tree["type"] = "directory";
+ tree["lmdt"] = dstats.mtime;
+ tree["path"] = dirPath;
+ tree["children"] = [];
+ var dirList = fs.readdirSync(dirPath);
+ for (var i=0; i < dirList.length; i++) {
+ var path = dirPath+getDirseparator()+dirList[i];
+ var stats = fs.statSync(path);
+ if (stats.isFile()) {
+ tree["children"].push({
+ "name": pathUtils.basename(path),
+ "type": "file",
+ "size": stats.size,
+ "lmdt": stats.mtime,
+ "path": path
+ });
+ } else {
+ tree["children"].push( generateDirectoryTree(path) );
+ }
+ }
+ return tree;
+ } catch(ex) {
+ console.error("Scanning directory "+dirPath+" failed "+ex);
+ }
+ }
+
+ exports.createDirectoryIndex = function(dirPath) {
+ console.log("Creating index for directory: "+dirPath);
+ var directoryIndex = [];
+ directoryIndex = scanDirectory(dirPath, directoryIndex);
+ //console.log(JSON.stringify(directoryIndex));
+ TSCORE.PerspectiveManager.updateFileBrowserData(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);
+ }
+
+ exports.createDirectory = function(dirPath) {
+ console.log("Creating directory: "+dirPath);
+ fs.mkdir(dirPath, function(error) {
+ if (error) {
+ console.log("Creating directory "+dirPath+" failed "+error);
+ return;
+ }
+ //TODO refresh the directory area
+ });
+ }
+
+ exports.renameFile = function(filePath, newFilePath) {
+ console.log("Renaming file: "+filePath+" to "+newFilePath);
+ fs.rename(filePath, newFilePath, function(error) {
+ if (error) {
+ console.log("Renaming file failed "+error);
+ return;
+ }
+ TSCORE.PerspectiveManager.refreshFileListContainer();
+ });
+ }
+
+ exports.loadTextFile = function(filePath) {
+ console.log("Loading file: "+filePath);
+ fs.readFile(filePath, function(error, content) {
+ if (error) {
+ console.log("Loading file "+filePath+" failed "+error);
+ return;
+ }
+ TSCORE.FileOpener.updateEditorContent(content);
+ });
+ }
+
+ exports.saveTextFile = function(filePath,content) {
+ console.log("Saving file: "+filePath);
+ // TODO check if fileExist by saving needed
+/* if(plugin.fileExists(filePath)) {
+ plugin.removeFile(filePath);
+ } */
+ fs.writeFile(filePath, content, function(error) {
+ if (error) {
+ console.log("Save to file "+filePath+" failed "+error);
+ return;
+ }
+ TSCORE.PerspectiveManager.refreshFileListContainer();
+ });
+ }
+
+ exports.listDirectory = function(dirPath) {
+ console.log("Listing directory: "+dirPath);
+ fs.readdir(dirPath, function(error, dirList) {
+ if (error) {
+ console.log("Listing directory: "+dirPath+" failed "+error);
+ return;
+ }
+
+ var anotatedDirList = [];
+ for (var i=0; i < dirList.length; i++) {
+ var path = dirPath+getDirseparator()+dirList[i];
+ var path = dirPath+getDirseparator()+dirList[i];
+ var stats = fs.statSync(path);
+ //console.log('stats: ' + JSON.stringify(stats));
+ anotatedDirList.push({
+ "name": dirList[i],
+ "type": stats.isDirectory()?"directory":"file",
+ "size": stats.size,
+ "lmdt": stats.mtime,
+ "path": path
+ });
+ }
+ TSCORE.PerspectiveManager.updateFileBrowserData(anotatedDirList);
+ });
+ }
+
+ exports.getSubdirs = function(dirPath) {
+ console.log("Getting subdirs: "+dirPath);
+ fs.readdir(dirPath, function(error, dirList) {
+ if (error) {
+ console.log("Directory listing failed "+error);
+ return;
+ }
+
+ var anotatedDirList = [];
+ for (var i=0; i < dirList.length; i++) {
+ var path = dirPath+getDirseparator()+dirList[i];
+ var stats = fs.statSync(path);
+ if(stats.isDirectory()) {
+ anotatedDirList.push({
+ "title": dirList[i],
+ //"isFolder": true,
+ "key": path
+ });
+ }
+ }
+ TSCORE.updateSubDirs(anotatedDirList);
+ });
+ }
+
+ exports.deleteElement = function(path) {
+ console.log("Deleting: "+path);
+ fs.unlink(path, function(error) {
+ if (error) {
+ console.log("Deleting file "+path+" failed "+error);
+ return;
+ }
+ TSCORE.PerspectiveManager.refreshFileListContainer();
+ });
+ }
+
+ exports.checkNewVersion = function() {
+ console.log("Checking for new version...");
+ var cVer = TSCORE.Config.DefaultSettings["appVersion"]+"."+TSCORE.Config.DefaultSettings["appBuild"];
+ $.ajax({
+ url: 'http://tagspaces.org/releases/version.json?nVer='+cVer,
+ type: 'GET',
+ })
+ .done(function(data) {
+ TSCORE.updateNewVersionData(data);
+ })
+ .fail(function(data) {
+ console.log("AJAX failed "+data);
+ })
+ ;
+ }
+
+ exports.selectDirectory = function() {
+ if(document.getElementById('folderDialog') == null) {
+ $("#folderLocation").after('<input style="display:none;" id="folderDialog" type="file" nwdirectory />');
+ }
+ var chooser = $('#folderDialog');
+ chooser.change(function(evt) {
+ $("#folderLocation").val($(this).val());
+ });
+ chooser.trigger('click');
+ }
+
+ exports.openDirectory = function(dirPath) {
+ gui.Shell.openItem(dirPath);
+ }
+
+ exports.selectFile = function() {
+ if(document.getElementById('fileDialog') == null) {
+ $("#folderLocation").after('<input style="display:none;" id="fileDialog" type="file" />');
+ }
+ var chooser = $('#fileDialog');
+ chooser.change(function(evt) {
+ console.log("File selected: "+$(this).val());
+ });
+ chooser.trigger('click');
+ }
+
+ exports.openExtensionsDirectory = function() {
+ // TODO implement openExtensionsDirectory on node
+ //gui.Shell.openItem(extPath);
+ console.log("Open extensions directory functionality not implemented on chrome yet!");
+ TSCORE.showAlertDialog("Open extensions directory functionality not implemented on chrome yet!");
+ }
+
+});
diff --git a/data/loader.js b/data/loader.js
index ff1a9461a..9e60b9178 100644
--- a/data/loader.js
+++ b/data/loader.js
@@ -1,131 +1,164 @@
-/* Copyright (c) 2012-2013 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. */
-
-//var LOG = debug ? console.log : function () {};
-// the value of this var is replaced to "true" by the build script
-var PRODUCTION = "@PRODUCTION@";
-
-// Disabling all output to console in production mode
-if (PRODUCTION == "true") {
- console = console || {};
- console.log = function(){};
- console.error = function(){};
- console.log = function(){};
-}
-
-// Temporal hacks
-var isFirefox = 'MozBoxSizing' in document.documentElement.style;
-var isSafari = Object.prototype.toString.call(window.HTMLElement).indexOf('Constructor') > 0;
-var isChrome = !isSafari && 'WebkitTransform' in document.documentElement.style;
-
-console.log("Loading Loader 4 Firefox: "+isFirefox+" | Chrome: "+isChrome);
-
-// Setting up the IO functionality according to the platform
-var IO_JS = undefined;
-if( isFirefox ) {
- IO_JS = "js/ioapi.mozilla";
-} else if ( isChrome ) {
- IO_JS = "js/ioapi.chrome";
-} else {
- // TODO safari and ie io handler needed
- IO_JS = "js/ioapi.chrome";
-}
-
-require.config({
- map: {
- '*': {
- 'css': 'libs/requirecss/css'
- }
- },
- paths: {
- jquery: 'libs/jquery/jquery-2.0.1',
- jqueryui: 'libs/jqueryui/jquery.ui.core',
- jqueryuiwidget: 'libs/jqueryui/jquery.ui.widget',
- jqueryuimouse: 'libs/jqueryui/jquery.ui.mouse',
- jqueryuiposition: 'libs/jqueryui/jquery.ui.position',
- jqueryuiselectable: 'libs/jqueryui/jquery.ui.selectable',
- jqueryuisortable: 'libs/jqueryui/jquery.ui.sortable',
- jqueryuiresizable: 'libs/jqueryui/jquery.ui.resizable',
- jqueryuidraggable: 'libs/jqueryui/jquery.ui.draggable',
- jqueryuidroppable: 'libs/jqueryui/jquery.ui.droppable',
- jqueryuiautocomplete: 'libs/jqueryui/jquery.ui.autocomplete',
- jqueryuidatepicker: 'libs/jqueryui/jquery.ui.datepicker',
-
- bootstrap: 'libs/bootstrap/js/bootstrap',
- datatables: 'libs/datatables/js/jquery.dataTables.min',
- datatablescss: 'libs/datatables/css/jquery.dataTables',
- jsoneditor: 'libs/jsoneditor/jsoneditor',
- jsoneditorcss: 'libs/jsoneditor/jsoneditor',
- jquerylayout: 'libs/jquerylayout/jquery.layout-latest',
- jquerylayoutcss: 'libs/jquerylayout/layout-default-latest',
- jquerydropdown: 'libs/jquerydropdown/jquery.dropdown',
- jquerydropdowncss: 'libs/jquerydropdown/jquery.dropdown',
- less: 'libs/less/less-1.3.3.min',
- jqueryeditinplace: 'libs/jqueryeditinplace/jquery.editinplace',
-
- tscore: 'js/core.api',
- tssetting: 'js/settings.api',
- tsoptions: 'js/options.ui',
- tspersmanager: 'js/perspective.manager',
- tstagutils: 'js/tagutils',
- tsfileopener: 'js/fileopener',
- tstagsui: 'js/tags.ui',
- tsdirectoriesui: 'js/directories.ui',
- tscoreui: 'js/core.ui',
- tsioapi: IO_JS,
- tsiomozrec: 'js/ioapi.mozilla.receiver'
- },
- shim: {
- 'bootstrap': { deps: ['jquery'] },
- 'jqueryui': { deps: ['jquery'] },
- 'jqueryuiwidget': { deps: ['jqueryui'] },
- 'jqueryuimouse': { deps: ['jqueryui','jqueryuiwidget'] },
- 'jqueryuiposition': { deps: ['jqueryui'] },
- 'jqueryuiselectable': { deps: ['jqueryui','jqueryuiwidget','jqueryuimouse'] },
- 'jqueryuisortable': { deps: ['jqueryui','jqueryuiwidget','jqueryuimouse'] },
- 'jqueryuidatepicker': { deps: ['jqueryui'] },
- 'jqueryuidroppable': { deps: ['jqueryui','jqueryuiwidget','jqueryuimouse','jqueryuidraggable'] },
- 'jqueryuidraggable': { deps: ['jqueryui','jqueryuiwidget','jqueryuimouse'] },
- 'jqueryuiresizable': { deps: ['jqueryui','jqueryuiwidget','jqueryuimouse'] },
- 'jquerylayout': { deps: ['jquery', 'jqueryuidraggable' ] },
- 'jquerydropdown': { deps: ['jquery','bootstrap'] },
- 'datatables': { deps: ['jquery'] },
- 'jqueryeditinplace': { deps: ['jquery'] },
- 'tscore': { deps: [
- 'jquery',
- 'jqueryui',
- 'jqueryuidraggable',
- 'jqueryuidroppable',
- 'jqueryuiresizable',
- 'jqueryuiposition',
- 'jqueryuiselectable',
- 'jqueryuisortable',
- 'bootstrap',
- 'jquerylayout',
- 'jquerydropdown',
- ] },
- }
-});
-
-define(function (require, exports, module) {
-"use strict";
-
- //require("less");
- if( isFirefox ) {
- require("tsiomozrec");
- }
-
- var TSCORE = undefined;
- require(['tscore'], function (core) {
- TSCORE = core;
- TSCORE.initApp();
- });
-
-/* var TSCORE = require("tscore");
- require(['libs/requirejs/domReady!'], function () {
- //This function is called once the DOM is ready
- TSCORE.initApp();
- }); */
-
+/* Copyright (c) 2012-2013 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. */
+//var LOG = debug ? console.log : function () {};
+// the value of this var is replaced to "true" by the build script
+var PRODUCTION = "@PRODUCTION@";
+
+// Disabling all output to console in production mode
+if (PRODUCTION == "true") {
+ console = console || {};
+ console.log = function(){};
+ console.error = function(){};
+ console.log = function(){};
+}
+
+// Temporal hacks
+var isFirefox = 'MozBoxSizing' in document.documentElement.style;
+var isSafari = Object.prototype.toString.call(window.HTMLElement).indexOf('Constructor') > 0;
+var isChrome = !isSafari && 'WebkitTransform' in document.documentElement.style;
+var isNode = undefined;
+
+ // BROWSER SNIFFING
+/*
+ // Crude, but necessary to handle a number of hard-to-feature-detect
+ // bugs and behavior differences.
+ var gecko = /gecko\/\d/i.test(navigator.userAgent);
+ var ie = /MSIE \d/.test(navigator.userAgent);
+ var ie_lt8 = ie && (document.documentMode == null || document.documentMode < 8);
+ var ie_lt9 = ie && (document.documentMode == null || document.documentMode < 9);
+ var webkit = /WebKit\//.test(navigator.userAgent);
+ var qtwebkit = webkit && /Qt\/\d+\.\d+/.test(navigator.userAgent);
+ var chrome = /Chrome\//.test(navigator.userAgent);
+ var opera = /Opera\//.test(navigator.userAgent);
+ var safari = /Apple Computer/.test(navigator.vendor);
+ var khtml = /KHTML\//.test(navigator.userAgent);
+ var mac_geLion = /Mac OS X 1\d\D([7-9]|\d\d)\D/.test(navigator.userAgent);
+ var mac_geMountainLion = /Mac OS X 1\d\D([8-9]|\d\d)\D/.test(navigator.userAgent);
+ var phantom = /PhantomJS/.test(navigator.userAgent);
+
+ var ios = /AppleWebKit/.test(navigator.userAgent) && /Mobile\/\w+/.test(navigator.userAgent);
+ // This is woefully incomplete. Suggestions for alternative methods welcome.
+ var mobile = ios || /Android|webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(navigator.userAgent);
+ var mac = ios || /Mac/.test(navigator.platform);
+ var windows = /windows/i.test(navigator.platform);
+*/
+console.log("Loading Loader 4 Firefox: "+isFirefox+" | Chrome: "+isChrome);
+
+// Setting up the IO functionality according to the platform
+var IO_JS = undefined;
+if( isFirefox ) {
+ IO_JS = "js/ioapi.mozilla";
+} else if ( isChrome ) {
+ IO_JS = "js/ioapi.chrome";
+} else {
+ // TODO safari and ie io handler needed
+ IO_JS = "js/ioapi.chrome";
+}
+
+// Check for running in node-webkit
+try {
+ var fs = require('fs');
+ var pathUtils = require('path');
+ var gui = require('nw.gui');
+// var openEntry = require('open');
+ IO_JS = "js/ioapi.node";
+ isNode = true;
+} catch(e) {
+ console.log("node.js not found!");
+}
+
+requirejs.config({
+ map: {
+ '*': {
+ 'css': 'libs/requirecss/css'
+ }
+ },
+ paths: {
+ jquery: 'libs/jquery/jquery-2.0.1',
+ jqueryui: 'libs/jqueryui/jquery.ui.core',
+ jqueryuiwidget: 'libs/jqueryui/jquery.ui.widget',
+ jqueryuimouse: 'libs/jqueryui/jquery.ui.mouse',
+ jqueryuiposition: 'libs/jqueryui/jquery.ui.position',
+ jqueryuiselectable: 'libs/jqueryui/jquery.ui.selectable',
+ jqueryuisortable: 'libs/jqueryui/jquery.ui.sortable',
+ jqueryuiresizable: 'libs/jqueryui/jquery.ui.resizable',
+ jqueryuidraggable: 'libs/jqueryui/jquery.ui.draggable',
+ jqueryuidroppable: 'libs/jqueryui/jquery.ui.droppable',
+ jqueryuiautocomplete: 'libs/jqueryui/jquery.ui.autocomplete',
+ jqueryuidatepicker: 'libs/jqueryui/jquery.ui.datepicker',
+
+ bootstrap: 'libs/bootstrap/js/bootstrap',
+ datatables: 'libs/datatables/js/jquery.dataTables.min',
+ datatablescss: 'libs/datatables/css/jquery.dataTables',
+ jsoneditor: 'libs/jsoneditor/jsoneditor',
+ jsoneditorcss: 'libs/jsoneditor/jsoneditor',
+ jquerylayout: 'libs/jquerylayout/jquery.layout-latest',
+ jquerylayoutcss: 'libs/jquerylayout/layout-default-latest',
+ jquerydropdown: 'libs/jquerydropdown/jquery.dropdown',
+ jquerydropdowncss: 'libs/jquerydropdown/jquery.dropdown',
+ jquerynanoscroller: 'libs/jquerynanoscroller/jquery.nanoscroller',
+ less: 'libs/less/less-1.3.3.min',
+ jqueryeditinplace: 'libs/jqueryeditinplace/jquery.editinplace',
+
+ tscore: 'js/core.api',
+ tssetting: 'js/settings.api',
+ tsoptions: 'js/options.ui',
+ tspersmanager: 'js/perspective.manager',
+ tstagutils: 'js/tagutils',
+ tsfileopener: 'js/fileopener',
+ tstagsui: 'js/tags.ui',
+ tsdirectoriesui: 'js/directories.ui',
+ tscoreui: 'js/core.ui',
+ tsioapi: IO_JS,
+ tsiomozrec: 'js/ioapi.mozilla.receiver'
+ },
+ shim: {
+ 'bootstrap': { deps: ['jquery'] },
+ 'jqueryui': { deps: ['jquery'] },
+ 'jqueryuiwidget': { deps: ['jqueryui'] },
+ 'jqueryuimouse': { deps: ['jqueryui','jqueryuiwidget'] },
+ 'jqueryuiposition': { deps: ['jqueryui'] },
+ 'jqueryuiselectable': { deps: ['jqueryui','jqueryuiwidget','jqueryuimouse'] },
+ 'jqueryuisortable': { deps: ['jqueryui','jqueryuiwidget','jqueryuimouse'] },
+ 'jqueryuidatepicker': { deps: ['jqueryui'] },
+ 'jqueryuidroppable': { deps: ['jqueryui','jqueryuiwidget','jqueryuimouse','jqueryuidraggable'] },
+ 'jqueryuidraggable': { deps: ['jqueryui','jqueryuiwidget','jqueryuimouse'] },
+ 'jqueryuiresizable': { deps: ['jqueryui','jqueryuiwidget','jqueryuimouse'] },
+ 'jquerylayout': { deps: ['jquery', 'jqueryuidraggable' ] },
+ 'jquerydropdown': { deps: ['jquery','bootstrap'] },
+ 'datatables': { deps: ['jquery'] },
+ 'jqueryeditinplace': { deps: ['jquery'] },
+ 'jquerynanoscroller': { deps: ['jquery'] },
+ 'tscore': { deps: [
+ 'jquery',
+ 'jqueryui',
+ 'jqueryuidraggable',
+ 'jqueryuidroppable',
+ 'jqueryuiresizable',
+ 'jqueryuiposition',
+ 'jqueryuiselectable',
+ 'jqueryuisortable',
+ 'jquerynanoscroller',
+ 'bootstrap',
+ 'jquerylayout',
+ 'jquerydropdown',
+ ] },
+ }
+});
+
+define(function (require, exports, module) {
+"use strict";
+
+ //require("less");
+ if( isFirefox ) {
+ requirejs(["tsiomozrec"]);
+ }
+
+ var TSCORE = undefined;
+ requirejs(['tscore'], function (core) {
+ TSCORE = core;
+ TSCORE.initApp();
+ });
+
});
\ No newline at end of file
diff --git a/data/manifest.json b/data/manifest.json
index 1e697d99f..8e431db80 100644
--- a/data/manifest.json
+++ b/data/manifest.json
@@ -1,6 +1,6 @@
{
"name": "TagSpaces",
- "version": "1.4.1384",
+ "version": "1.4.1386",
"manifest_version": 2,
"description": "TagSpaces Explorer",
"icons": {