Skip to content

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

finalizing opening urls

uggrockee539f1dc978
diff --git a/data/chromium/chrome.api.js b/data/chromium/chrome.api.js
index 76c689f0b..8e20b596c 100644
--- a/data/chromium/chrome.api.js
+++ b/data/chromium/chrome.api.js
@@ -39,8 +39,8 @@ define(function(require, exports, module) {
function handleStartParameters() {
var filePath = TSCORE.Utils.getURLParameter("open");
- filePath = decodeURIComponent(filePath);
if (filePath && (filePath.length > 0)) {
+ filePath = decodeURIComponent(filePath);
console.log("Opening file in browser: " + filePath);
if(filePath.indexOf("file://") >= 0) {
filePath = filePath.split("file://")[1];
diff --git a/data/electron/electron.api.js b/data/electron/electron.api.js
index 3f3c53043..2e233e116 100644
--- a/data/electron/electron.api.js
+++ b/data/electron/electron.api.js
@@ -37,8 +37,8 @@ define(function(require, exports, module) {
function handleStartParameters() {
var filePath = TSCORE.Utils.getURLParameter("open");
- filePath = decodeURIComponent(filePath);
if (filePath && (filePath.length > 0)) {
+ filePath = decodeURIComponent(filePath);
console.log("Opening file in browser: " + filePath);
TSCORE.FileOpener.openFileOnStartup(filePath);
}
diff --git a/data/electron/main.js b/data/electron/main.js
index cca7ba36b..8ecea6da1 100644
--- a/data/electron/main.js
+++ b/data/electron/main.js
@@ -45,8 +45,6 @@ app.on('ready', function() {
startupParameter = "?open=" + encodeURIComponent(startupFilePath);
}
var indexPath = 'file://' + path.dirname(__dirname) + '/index.html' + startupParameter;
- //console.log("mainWindow.loadURL: " + indexPath);
- //console.log("App path: " + app.getAppPath());
mainWindow.setMenu(null);
mainWindow.loadURL(indexPath);
diff --git a/data/js/core.api.js b/data/js/core.api.js
index e877d216a..88a248cc8 100644
--- a/data/js/core.api.js
+++ b/data/js/core.api.js
@@ -99,10 +99,9 @@ define(function(require, exports, module) {
if (tsSettings.Settings.tagspacesList.length < 1) {
tsCoreUI.startGettingStartedTour();
}
- if (isNode || isChrome || isElectron) {
+ if (isNode || isChrome || isElectron || isWeb) {
// Handle command line argument in node-webkit
tsIOApi.handleStartParameters(); // Handle minimizing to the tray in node-webkit
- //tsIOApi.handleTray();
}
console.log('Docoument ready finished. Layout initialized');
checkForNewVersion();
diff --git a/data/js/fileopener.js b/data/js/fileopener.js
index 79ae28329..ebdf6a857 100644
--- a/data/js/fileopener.js
+++ b/data/js/fileopener.js
@@ -234,7 +234,11 @@ define(function(require, exports, module) {
_openedFilePath = filePath;
//$("#selectedFilePath").val(_openedFilePath.replace("\\\\","\\"));
if (isWeb) {
- window.history.pushState("", "TagSpaces", "/index.html?open=" + encodeURIComponent(filePath));
+ var startupParameter = "";
+ if (filePath) {
+ startupParameter = "?open=" + encodeURIComponent(filePath);
+ window.history.pushState("", "TagSpaces", "/index.html" + startupParameter);
+ }
console.log("Link to file for sharing: " + window.location.href);
var downloadLink;
if (location.port === '') {
diff --git a/data/js/utils.js b/data/js/utils.js
index 89cecbfb6..25cd98649 100644
--- a/data/js/utils.js
+++ b/data/js/utils.js
@@ -87,7 +87,7 @@ define(function(require, exports, module) {
return pair[1];
}
}
- return (false);
+ return false;
}
exports.arrayBufferToDataURL = arrayBufferToDataURL;
diff --git a/data/web/web.api.js b/data/web/web.api.js
index 2dc02e933..389be6849 100644
--- a/data/web/web.api.js
+++ b/data/web/web.api.js
@@ -85,6 +85,14 @@ define(function(require, exports, module) {
return false;
}
+ function handleStartParameters() {
+ var filePath = TSCORE.Utils.getURLParameter("open");
+ if (filePath && (filePath.length > 0)) {
+ filePath = decodeURIComponent(filePath);
+ console.log("Opening file in browser: " + filePath);
+ TSCORE.FileOpener.openFileOnStartup(filePath);
+ }
+ }
function focusWindow() {
// Bring the TagSpaces window on top of the windows
@@ -536,6 +544,7 @@ define(function(require, exports, module) {
}
// Platform API
+ exports.handleStartParameters = handleStartParameters;
exports.focusWindow = focusWindow;
exports.checkNewVersion = checkNewVersion;