TagSpaces is an offline, open source, document manager with tagging support
style checking
uggrock81ec1a745006
diff --git a/data/js/search.js b/data/js/search.jsindex 750b7225e..bc507dd3e 100644--- a/data/js/search.js+++ b/data/js/search.js@@ -9,16 +9,7 @@ define(function(require, exports, module) {var currentQuery = '';var nextQuery = '';--- var search4String = function(query) {- TSCORE.Search.nextQuery = '+' + query;- $('#searchBox').val('+' + query);- TSCORE.PerspectiveManager.redrawCurrentPerspective();- TSCORE.showSearchArea();- };-- var calculateTags = function(data) {+ function calculateTags(data) {console.log('Calculating tags from search results');var allTags = [];data.forEach(function(fileEntry) {@@ -38,12 +29,12 @@ define(function(require, exports, module) {});});TSCORE.generateTagGroups();- };+ }function prepareQuery(queryText) {// cleaning up the query, reducing the spacesvar queryText = queryText.toLowerCase().replace(/^\s+|\s+$/g, '');- var recursive = !(queryText.indexOf('~') === 0);+ var recursive = queryText.indexOf('~') !== 0;if (recursive) {queryText = queryText.substring(1, queryText.length);}@@ -147,8 +138,7 @@ define(function(require, exports, module) {return result;}- var searchData = function(data, query) {-+ function searchData(data, query) {//todo make a switch in gui for content searchvar searchInContent = (isChrome || isFirefox || isWeb) ? false : true;var queryObj = prepareQuery(query);@@ -204,13 +194,13 @@ define(function(require, exports, module) {}// file is text file containing extracted contentent (txt)- if (contentExtLocation > indexOfMetaDirectory ) {+ if (contentExtLocation > indexOfMetaDirectory) {fileEntry.name = fileEntry.name.substring(0, fileEntry.name.indexOf(TSCORE.contentFileExt));fileEntry.path = fileEntry.path.substring(0, indexOfMetaDirectory + 1) + fileEntry.name;}// file is meta directory file (tsm.json)- if (metaFolderLocation > indexOfMetaDirectory ) {+ if (metaFolderLocation > indexOfMetaDirectory) {fileEntry.path = fileEntry.path.substring(0, indexOfMetaDirectory + 1);fileEntry.name = TSCORE.TagUtils.extractDirectoryName(fileEntry.path) + "." + TSCORE.directoryExt;}@@ -253,7 +243,7 @@ define(function(require, exports, module) {}return data;}- };+ }// Public variables definitionexports.currentQuery = currentQuery;@@ -262,6 +252,5 @@ define(function(require, exports, module) {// Public API definitionexports.searchData = searchData;exports.searchForTag = searchForTag;- exports.searchForString = search4String;exports.calculateTags = calculateTags;});diff --git a/data/js/search.ui.js b/data/js/search.ui.jsindex 2e809ce9d..a7d7ceb07 100644--- a/data/js/search.ui.js+++ b/data/js/search.ui.js@@ -81,34 +81,38 @@ define(function(require, exports, module) {});};+ function parseQuery() {++ }+function updateQuery() {var query = "";- if(!$('#searchRecursive').is(':checked')) {- query = "| "+ if (!$('#searchRecursive').is(':checked')) {+ query = "| ";}var searchTerms = $('#searchTerms').val();- if(searchTerms.length > 0 ) {+ if (searchTerms.length > 0) {searchTerms = searchTerms.split(" ");searchTerms.forEach(function(term) {- if(term.length > 1) {+ if (term.length > 1) {query = query + " " + term;}- })+ });}var tags = $('#searchTags').val();- if(tags.length > 0 ) {+ if (tags.length > 0) {tags = tags.split(" ");tags.forEach(function(tag) {- if(tag.length > 1) {+ if (tag.length > 1) {query = query + " +" + tag;}- })+ });}var fileType = $('#searchFileType').val();- if(fileType.length > 0) {+ if (fileType.length > 0) {query = query + " " + fileType;}diff --git a/data/js/tagutils.js b/data/js/tagutils.jsindex 2c145eb19..4ecbc64bc 100644--- a/data/js/tagutils.js+++ b/data/js/tagutils.js@@ -121,7 +121,7 @@ define(function(require, exports, module) {function formatFileSize(sizeInBytes, siSystem) {var threshold = siSystem ? 1000 : 1024;- if(!sizeInBytes) {+ if (!sizeInBytes) {return "";}if (sizeInBytes < threshold) {