Skip to content

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

updating jscs version, styling the js code according to the new rules

uggrock51dceae1f9c2
diff --git a/.jscs.json b/.jscs.json
index e1d1a3e57..9004aa807 100644
--- a/.jscs.json
+++ b/.jscs.json
@@ -46,12 +46,6 @@
"disallowSpacesInsideArrayBrackets": "all",
"disallowSpacesInsideParentheses": true,
-
- "validateJSDoc": {
- "checkParamNames": true,
- "requireParamTypes": true
- },
-
"disallowMultipleLineBreaks": true,
"disallowNewlineBeforeBlockStatements": true
}
diff --git a/Gruntfile.js b/Gruntfile.js
index 2941587f2..e880653d6 100644
--- a/Gruntfile.js
+++ b/Gruntfile.js
@@ -82,7 +82,7 @@ module.exports = function(grunt) {
jscs: {
options: {
config: ".jscs.json",
- maxErrors: 5
+ maxErrors: 10
},
files: {
src: [
@@ -251,9 +251,9 @@ module.exports = function(grunt) {
jsDAV.debugMode = true;
var jsDAV_Auth_Backend_File = require("jsDAV/lib/DAV/plugins/auth/file");
jsDAV.createServer({
- node: "./data",
- authBackend: jsDAV_Auth_Backend_File.new("./jsdavauth"),
- realm: "jdavtest"
+ node: "./data",
+ authBackend: jsDAV_Auth_Backend_File.new("./jsdavauth"),
+ realm: "jdavtest"
}, 8000);
grunt.log.writeln("WebDAV server started");
}),
diff --git a/data/cordova/cordova.api.js b/data/cordova/cordova.api.js
index e887a1ec9..b8242d1da 100644
--- a/data/cordova/cordova.api.js
+++ b/data/cordova/cordova.api.js
@@ -798,7 +798,7 @@ define(function(require, exports, module) {
);
} else {
TSCORE.hideLoadingAnimation();
- TSCORE.showAlertDialog($.i18n.t("ns.common:fileExists", { fileName:filePath }));
+ TSCORE.showAlertDialog($.i18n.t("ns.common:fileExists", {fileName:filePath}));
}
};
diff --git a/data/ext/editorHTML/extension.js b/data/ext/editorHTML/extension.js
index b3279390e..b1c1a2289 100644
--- a/data/ext/editorHTML/extension.js
+++ b/data/ext/editorHTML/extension.js
@@ -50,11 +50,11 @@ define(function(require, exports, module) {
}));
TSCORE.IO.loadTextFile(filePath);
- // if (!window.addEventListener) {
- // window.attachEvent('onmessage', function(e) {alert(e.origin);alert(e.data);});
- // } else {
- // window.addEventListener('message', function(e) {alert(e.origin);alert(e.data);}, false);
- // }
+ //if (!window.addEventListener) {
+ // window.attachEvent('onmessage', function(e) {alert(e.origin);alert(e.data);});
+ //} else {
+ // window.addEventListener('message', function(e) {alert(e.origin);alert(e.data);}, false);
+ //}
};
exports.setFileType = function(fileType) {
@@ -77,12 +77,12 @@ define(function(require, exports, module) {
} catch (e) {
console.log("Error parsing the body of the HTML document. " + e);
bodyContent = content;
-// TSCORE.FileOpener.closeFile(true);
-// TSCORE.showAlertDialog("Probably a body tag was not found in the document. Document will be closed.", "Error parsing HTML document");
+ //TSCORE.FileOpener.closeFile(true);
+ //TSCORE.showAlertDialog("Probably a body tag was not found in the document. Document will be closed.", "Error parsing HTML document");
}
- // var titleRegex = /\<title[^>]*\>([^]*)\<\/title/m;
- // var titleContent = content.match( titleRegex )[1];
+ //var titleRegex = /\<title[^>]*\>([^]*)\<\/title/m;
+ //var titleContent = content.match( titleRegex )[1];
// removing all scripts from the document
var cleanedBodyContent = bodyContent.replace(/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi, "");
diff --git a/data/ext/perspectiveGrid/perspectiveUI.js b/data/ext/perspectiveGrid/perspectiveUI.js
index 303bca0b0..0ce83de56 100644
--- a/data/ext/perspectiveGrid/perspectiveUI.js
+++ b/data/ext/perspectiveGrid/perspectiveUI.js
@@ -96,7 +96,7 @@ define(function(require, exports, module) {
} else {
tmbPath = "file:///" + filePath;
}
- var metaObj = metaObj || { thumbnailPath : ""};
+ var metaObj = metaObj || {thumbnailPath : ""};
var context = {
filepath: filePath,
tmbpath: tmbPath,
@@ -177,7 +177,7 @@ define(function(require, exports, module) {
console.log("Init UI module");
var self = this;
- this.viewContainer.append(toolbarTemplate({ id: this.extensionID }));
+ this.viewContainer.append(toolbarTemplate({id: this.extensionID}));
$("#" + this.extensionID + "ToogleSelectAll").on("click", function() {
self.toggleSelectAll();
diff --git a/data/ext/viewerHTML/main.js b/data/ext/viewerHTML/main.js
index be7c6d5d0..aca4f49b1 100644
--- a/data/ext/viewerHTML/main.js
+++ b/data/ext/viewerHTML/main.js
@@ -105,8 +105,8 @@ $(document).ready(function() {
function saveExtSettings() {
var settings = {
- "styleIndex": currentStyleIndex,
- "zoomState": currentZoomState
+ "styleIndex": currentStyleIndex,
+ "zoomState": currentZoomState
};
localStorage.setItem('viewerHTMLSettings', JSON.stringify(settings));
}
diff --git a/data/ext/viewerMD/main.js b/data/ext/viewerMD/main.js
index 31028dfae..41f59ed6e 100644
--- a/data/ext/viewerMD/main.js
+++ b/data/ext/viewerMD/main.js
@@ -103,8 +103,8 @@ $(document).ready(function() {
function saveExtSettings() {
var settings = {
- "styleIndex": currentStyleIndex,
- "zoomState": currentZoomState
+ "styleIndex": currentStyleIndex,
+ "zoomState": currentZoomState
};
localStorage.setItem('viewerMDSettings', JSON.stringify(settings));
}
diff --git a/data/ext/viewerZIP/extension.js b/data/ext/viewerZIP/extension.js
index cee2ebb21..84b121cce 100644
--- a/data/ext/viewerZIP/extension.js
+++ b/data/ext/viewerZIP/extension.js
@@ -55,8 +55,8 @@ define(function(require, exports, module) {
'fontSize': 12,
'width': '100%',
'height': '100%',
- }).appendTo($parent);
- //.width($parent.width()).height($parent.height()).appendTo($parent);
+ }).appendTo($parent);
+ //.width($parent.width()).height($parent.height()).appendTo($parent);
TSCORE.showLoadingAnimation();
@@ -66,7 +66,6 @@ define(function(require, exports, module) {
var ulFiles = $previewElement.append("<ul/>");
for (var fileName in zipFile.files) {
-
if (zipFile.files[fileName].dir === true) {
continue;
}
diff --git a/data/js/core.api.js b/data/js/core.api.js
index af991d09d..c77dee2b3 100644
--- a/data/js/core.api.js
+++ b/data/js/core.api.js
@@ -343,14 +343,14 @@ define(function(require, exports, module) {
}
if (shouldOpenCol2) {
-// $("#openLeftPanel").hide();
+ //$("#openLeftPanel").hide();
$(".col2").show();
} else {
$(".col2").hide();
}
if (shouldOpenCol3) {
-// $("#openLeftPanel").hide();
+ //$("#openLeftPanel").hide();
$(".col3").show();
hidePerspectiveMenu();
} else {
diff --git a/data/js/core.ui.js b/data/js/core.ui.js
index f628ab51b..9f894f51c 100644
--- a/data/js/core.ui.js
+++ b/data/js/core.ui.js
@@ -34,8 +34,8 @@ define(function(require, exports, module) {
message = 'No Message to Display.';
}
var n = noty({
- text: message,
- layout: 'bottomCenter',
+ text: message,
+ layout: 'bottomCenter',
});
/*var alertModal = $('#alertDialog');
alertModal.find('h4').text(title);
@@ -200,8 +200,7 @@ define(function(require, exports, module) {
], function(uiTPL, controller) {
if ($('#dialogOptions').length < 1) {
var uiTemplate = Handlebars.compile(uiTPL);
- $('body').append(uiTemplate({ isProVersion: TSCORE.PRO ? true : false }));
-
+ $('body').append(uiTemplate({isProVersion: TSCORE.PRO ? true : false}));
controller.initUI();
}
@@ -690,9 +689,9 @@ define(function(require, exports, module) {
$('#openNatively').hide();
$('#fileMenuOpenNatively').parent().hide();
} else if (isNode) {
- // $('#fullscreenFile').hide();
+ //$('#fullscreenFile').hide();
$('#openFileInNewWindow').hide();
- // handling window maximization
+ //handling window maximization
var nwwin = gui.Window.get();
nwwin.on('maximize', function() {
TSCORE.Config.setIsWindowMaximized(true);
diff --git a/data/js/directories.ui.js b/data/js/directories.ui.js
index be5c7c25c..8c8492723 100644
--- a/data/js/directories.ui.js
+++ b/data/js/directories.ui.js
@@ -221,8 +221,8 @@ define(function(require, exports, module) {
//console.log(leftPos+" "+sourceObject.offset().left+" "+$menu.width()+" "+window.innerWidth);
$menu.css({
display: 'block',
- // left: leftPos + 'px',
- // top: topPos + 'px'
+ //left: leftPos + 'px',
+ //top: topPos + 'px'
});
};
diff --git a/data/js/fileopener.js b/data/js/fileopener.js
index 802d790bc..2f6ae0048 100644
--- a/data/js/fileopener.js
+++ b/data/js/fileopener.js
@@ -357,11 +357,12 @@ define(function(require, exports, module) {
}
function updateEditorContent(fileContent) {
- console.log('Updating editor');
- // with data: "+fileContent);
- _tsEditor.setContent(fileContent);
- }
- // Should return false if no editor found
+ console.log('Updating editor');
+ // with data: "+fileContent);
+ _tsEditor.setContent(fileContent);
+ }
+
+ // Should return false if no editor found
function getFileEditor(filePath) {
var fileExt = TSCORE.TagUtils.extractFileExtension(filePath);
// Getting the editor for the file extension/type
diff --git a/data/js/settings.api.js b/data/js/settings.api.js
index b6b6eb8cf..71bae2eae 100644
--- a/data/js/settings.api.js
+++ b/data/js/settings.api.js
@@ -11,20 +11,20 @@ define(function(require, exports, module) {
var tagTemplate = {
'title': undefined,
'type': 'plain'
- /* ,
- "pattern":"yyyymmddhhmmss-yyyymmddhhmmss",
- "example":"20120114123456-20120823231235",
- "regex":"",
- "maxlength":17,
- "chainedTags":[
- "isbn","autor"
- ],
- "url": "http://example.com",
- "action":"showDatePicker",
- "prefixes":[
- "EUR", "USD", "BGN"
- ]
- */
+ /*
+ "pattern":"yyyymmddhhmmss-yyyymmddhhmmss",
+ "example":"20120114123456-20120823231235",
+ "regex":"",
+ "maxlength":17,
+ "chainedTags":[
+ "isbn","autor"
+ ],
+ "url": "http://example.com",
+ "action":"showDatePicker",
+ "prefixes":[
+ "EUR", "USD", "BGN"
+ ]
+ */
};
var locationTemplate = {
'name': undefined,
diff --git a/data/js/tags.ui.js b/data/js/tags.ui.js
index a390473b0..3cde768b1 100644
--- a/data/js/tags.ui.js
+++ b/data/js/tags.ui.js
@@ -402,28 +402,29 @@ define(function(require, exports, module) {
var tagButtonTmpl = Handlebars.compile('{{#each tags}} <button class="btn btn-sm tagButton" tag="{{tag}}" ' + 'filepath="{{filepath}}" style="{{style}}">{{tag}}&nbsp;&nbsp;<span class="fa fa-ellipsis-v"></span></button>{{/each}}');
// Helper function generating tag buttons
function generateTagButtons(commaSeparatedTags, filePath) {
- //console.log("Creating tags...");
- var tagString = '' + commaSeparatedTags;
- var context = {
- tags: []
- };
- if (tagString.length > 0) {
- var tags = tagString.split(',');
- for (var i = 0; i < tags.length; i++) {
- context.tags.push({
- filepath: filePath,
- tag: tags[i],
- style: generateTagStyle(TSCORE.Config.findTag(tags[i]))
- });
- }
- }
- var metaTags = TSCORE.Meta.getTagsFromMetaFile(filePath);
- if (metaTags.length > 0) {
- context.tags = context.tags.concat(metaTags);
+ //console.log("Creating tags...");
+ var tagString = '' + commaSeparatedTags;
+ var context = {
+ tags: []
+ };
+ if (tagString.length > 0) {
+ var tags = tagString.split(',');
+ for (var i = 0; i < tags.length; i++) {
+ context.tags.push({
+ filepath: filePath,
+ tag: tags[i],
+ style: generateTagStyle(TSCORE.Config.findTag(tags[i]))
+ });
}
- return tagButtonTmpl(context);
}
- // Get the color for a tag
+ var metaTags = TSCORE.Meta.getTagsFromMetaFile(filePath);
+ if (metaTags.length > 0) {
+ context.tags = context.tags.concat(metaTags);
+ }
+ return tagButtonTmpl(context);
+ }
+
+ // Get the color for a tag
function generateTagStyle(tagObject) {
var tagStyle = '';
if (tagObject.color !== undefined) {
diff --git a/data/js/tagutils.js b/data/js/tagutils.js
index e8e6c156a..75580b003 100644
--- a/data/js/tagutils.js
+++ b/data/js/tagutils.js
@@ -399,13 +399,13 @@ define(function(require, exports, module) {
}
function removeTags(filePathArray, tagArray) {
- console.log('Remove tags from files');
- for (var i = 0; i < filePathArray.length; i++) {
- removeTagsFromFile(filePathArray[i], tagArray);
- }
+ console.log('Remove tags from files');
+ for (var i = 0; i < filePathArray.length; i++) {
+ removeTagsFromFile(filePathArray[i], tagArray);
}
- // Moves the location of tag in the file name
- // possible directions should be next, prev, last, first
+ }
+
+ // Moves the location of tag in the file name possible directions should be next, prev, last, first
function moveTagLocation(filePath, tagName, direction) {
console.log('Moves the location of tag in the file name: ' + filePath);
var fileName = extractFileName(filePath);
diff --git a/data/node-webkit/node-webkit.api.js b/data/node-webkit/node-webkit.api.js
index 6dcfc1b0a..14ad28ed8 100644
--- a/data/node-webkit/node-webkit.api.js
+++ b/data/node-webkit/node-webkit.api.js
@@ -305,24 +305,24 @@ define(function(require, exports, module) {
}
if (fs.lstatSync(sourceFilePath).isDirectory()) {
TSCORE.hideWaitingDialog();
- TSCORE.showAlertDialog($.i18n.t("ns.common:fileIsDirectory", { fileName:sourceFilePath }));
+ TSCORE.showAlertDialog($.i18n.t("ns.common:fileIsDirectory", {fileName:sourceFilePath}));
return false;
}
if (fs.existsSync(targetFilePath)) {
TSCORE.hideWaitingDialog();
- TSCORE.showAlertDialog($.i18n.t("ns.common:fileExists", { fileName:targetFilePath }), $.i18n.t("ns.common:fileRenameFailed"));
+ TSCORE.showAlertDialog($.i18n.t("ns.common:fileExists", {fileName:targetFilePath}), $.i18n.t("ns.common:fileRenameFailed"));
return false;
}
var rd = fs.createReadStream(sourceFilePath);
rd.on("error", function(err) {
TSCORE.hideWaitingDialog();
- TSCORE.showAlertDialog($.i18n.t("ns.common:fileCopyFailed", { fileName:sourceFilePath }));
+ TSCORE.showAlertDialog($.i18n.t("ns.common:fileCopyFailed", {fileName:sourceFilePath}));
});
var wr = fs.createWriteStream(targetFilePath);
wr.on("error", function(err) {
TSCORE.hideWaitingDialog();
- TSCORE.showAlertDialog($.i18n.t("ns.common:fileCopyFailed", { fileName:sourceFilePath }));
+ TSCORE.showAlertDialog($.i18n.t("ns.common:fileCopyFailed", {fileName:sourceFilePath}));
});
wr.on("close", function(ex) {
TSPOSTIO.copyFile(sourceFilePath, targetFilePath);
@@ -340,18 +340,18 @@ define(function(require, exports, module) {
}
if (fs.lstatSync(filePath).isDirectory()) {
TSCORE.hideWaitingDialog();
- TSCORE.showAlertDialog($.i18n.t("ns.common:fileIsDirectory", { fileName:filePath }));
+ TSCORE.showAlertDialog($.i18n.t("ns.common:fileIsDirectory", {fileName:filePath}));
return false;
}
if (fs.existsSync(newFilePath)) {
TSCORE.hideWaitingDialog();
- TSCORE.showAlertDialog($.i18n.t("ns.common:fileExists", { fileName:newFilePath }), $.i18n.t("ns.common:fileRenameFailed"));
+ TSCORE.showAlertDialog($.i18n.t("ns.common:fileExists", {fileName:newFilePath}), $.i18n.t("ns.common:fileRenameFailed"));
return false;
}
fs.move(filePath, newFilePath, function(error) {
if (error) {
TSCORE.hideWaitingDialog();
- TSCORE.showAlertDialog($.i18n.t("ns.common:fileRenameFailedDiffPartition", { fileName:filePath }));
+ TSCORE.showAlertDialog($.i18n.t("ns.common:fileRenameFailedDiffPartition", {fileName:filePath}));
return;
}
TSPOSTIO.renameFile(filePath, newFilePath);
@@ -371,7 +371,7 @@ define(function(require, exports, module) {
}
if (fs.existsSync(newDirPath)) {
TSCORE.hideWaitingDialog();
- TSCORE.showAlertDialog($.i18n.t("ns.common:directoryExists", { dirName:newDirPath }), $.i18n.t("ns.common:directoryRenameFailed"));
+ TSCORE.showAlertDialog($.i18n.t("ns.common:directoryExists", {dirName:newDirPath}), $.i18n.t("ns.common:directoryRenameFailed"));
return false;
}
var dirStatus = fs.lstatSync(dirPath);
@@ -386,7 +386,7 @@ define(function(require, exports, module) {
});
} else {
TSCORE.hideWaitingDialog();
- TSCORE.showAlertDialog($.i18n.t("ns.common:pathIsNotDirectory", { dirName:dirPath }), $.i18n.t("ns.common:directoryRenameFailed"));
+ TSCORE.showAlertDialog($.i18n.t("ns.common:pathIsNotDirectory", {dirName:dirPath}), $.i18n.t("ns.common:directoryRenameFailed"));
return false;
}
};
@@ -671,7 +671,7 @@ define(function(require, exports, module) {
if (fsWatcher) {
fsWatcher.close();
}
- fsWatcher = fs.watch(dirPath, { persistent: true, recursive: false }, listener);
+ fsWatcher = fs.watch(dirPath, {persistent: true, recursive: false}, listener);
};
function getFile(fileURL, result, error) {
diff --git a/package.json b/package.json
index 19add1097..ba8e1e9f5 100644
--- a/package.json
+++ b/package.json
@@ -38,7 +38,6 @@
"grunt-fixmyjs": "~0.3.0",
"grunt-jscs": "~1.1.0",
"grunt-jsdoc": "^0.5.7",
- "grunt-mozilla-addon-sdk": "~0.3.2",
"jsDAV": "~0.3.2"
},
"private": true