Skip to content

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

find meta file by path

Borislav Sapundzhiev6972ee819445
diff --git a/data/ext/perspectiveGrid/perspectiveUI.js b/data/ext/perspectiveGrid/perspectiveUI.js
index b0c923f20..ea94c0f37 100644
--- a/data/ext/perspectiveGrid/perspectiveUI.js
+++ b/data/ext/perspectiveGrid/perspectiveUI.js
@@ -289,17 +289,10 @@ define(function(require, exports, module) {
}
});
} else {
- TSCORE.metaFileList.every(function(element) {
-
- var filePath = $element.attr('filepath') + ".png";
- if (filePath.indexOf(element.name) > 0) {
- var metaFilePath = TSCORE.currentPath + TSCORE.dirSeparator +
- ".ts" + TSCORE.dirSeparator + element.name;
- $element.attr('src', metaFilePath);
- return false;
- }
- return true;
- });
+ var metaFilePath = TSCORE.findMetaFilebyPath($element.attr('filepath'), "png");
+ if (metaFilePath) {
+ $element.attr('src', metaFilePath);
+ }
}
$element.attr('style', "");
});
diff --git a/data/ext/perspectiveImageSwiper/perspectiveUI.js b/data/ext/perspectiveImageSwiper/perspectiveUI.js
index 0d1088388..525bc6115 100644
--- a/data/ext/perspectiveImageSwiper/perspectiveUI.js
+++ b/data/ext/perspectiveImageSwiper/perspectiveUI.js
@@ -31,18 +31,22 @@ define(function(require, exports, module) {
var ext = fileInfo[TSCORE.fileListFILEEXT];
if(supportedFileTypesThumbs.indexOf(ext) !== -1) {
-
+ var filePath = fileInfo[TSCORE.fileListFILEPATH];
var doc = {
name: fileInfo[TSCORE.fileListFILENAME],
- path: encodeURI("file://" + fileInfo[TSCORE.fileListFILEPATH]),
+ path: encodeURI("file://" + filePath),
thumbnail: encodeURI(defaultThumnailPath),
title: fileInfo[TSCORE.fileListTITLE]
}
- var thumb = loadThumbnail(doc.path);
+ var metaFilePath = TSCORE.findMetaFilebyPath(filePath, "png");
+ if(metaFilePath) {
+ doc.thumbnail = encodeURI("file://" + metaFilePath);
+ }
+ /*var thumb = loadThumbnail(doc.path);
if(thumb) {
doc.thumbnail = encodeURI("file://" + thumb);
- }
+ }*/
data.push(doc);
}
});
diff --git a/data/js/core.api.js b/data/js/core.api.js
index 8a2a9209f..fa777ba58 100644
--- a/data/js/core.api.js
+++ b/data/js/core.api.js
@@ -545,6 +545,20 @@ define(function(require, exports, module) {
}, 0);
}
+ function findMetaFilebyPath(filePath, type) {
+ var metaFilePath = null;
+ filePath = filePath + "." + type;
+ exports.metaFileList.every(function(element) {
+ if (filePath.indexOf(element.name) > 0) {
+ metaFilePath = exports.currentPath + exports.dirSeparator +
+ ".ts" + exports.dirSeparator + element.name;
+ return false;
+ }
+ return true;
+ });
+ return metaFilePath;
+ }
+
// Proxying applications parts
exports.Config = tsSettings;
exports.IO = tsIOApi;
@@ -649,4 +663,5 @@ define(function(require, exports, module) {
exports.createDocumentEvent = createDocumentEvent;
exports.fireDocumentEvent = fireDocumentEvent;
exports.metaFileList = metaFileList;
+ exports.findMetaFilebyPath = findMetaFilebyPath;
});