Skip to content

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

adding toggling selection of all files with ctrl+a single click opens files in grid perspective

uggrockdb5a683ee7e9
diff --git a/data/ext/perspectiveGrid/perspectiveUI.js b/data/ext/perspectiveGrid/perspectiveUI.js
index 9b9000731..a6852a202 100644
--- a/data/ext/perspectiveGrid/perspectiveUI.js
+++ b/data/ext/perspectiveGrid/perspectiveUI.js
@@ -180,20 +180,7 @@ define(function(require, exports, module) {
this.viewContainer.append(toolbarTemplate({ id: this.extensionID }));
$("#" + this.extensionID + "ToogleSelectAll").on("click", function() {
- var checkIcon = $(this).find("i");
- if (checkIcon.hasClass("fa-square-o")) {
- TSCORE.selectedFiles = [];
- $(self.viewContainer).find('.fileTileSelector').each(function() {
- $(this).parent().parent().addClass("ui-selected");
- $(this).find("i").addClass("fa-check-square").removeClass("fa-square-o");
- TSCORE.selectedFiles.push($(this).attr("filepath"));
- });
- } else {
- TSCORE.PerspectiveManager.clearSelectedFiles();
- }
- self.handleElementActivation();
- checkIcon.toggleClass("fa-check-square");
- checkIcon.toggleClass("fa-square-o");
+ self.toggleSelectAll();
});
$("#" + this.extensionID + "CreateFileButton").on("click", function() {
@@ -448,14 +435,15 @@ define(function(require, exports, module) {
var self = this;
$fileTile
- .hammer().on("doubletap", function() { //.dblclick(function() {
+ /*.hammer().on("doubletap", function() { //.dblclick(function() {
TSCORE.FileOpener.openFile(filePath);
self.selectFile(filePath);
- })
+ })*/
.click(function() {
+ TSCORE.FileOpener.openFile(filePath);
self.selectFile(filePath);
})
- .draggable({
+ /*.draggable({
"cancel": false,
"appendTo": "body",
"helper": "clone",
@@ -464,7 +452,7 @@ define(function(require, exports, module) {
"start": function() {
self.selectFile(filePath);
}
- })
+ })*/
.droppable({
accept: ".tagButton",
hoverClass: "activeRow",
@@ -505,10 +493,16 @@ define(function(require, exports, module) {
self.handleElementActivation();
return false;
})
- .find(".fileTagsTile").click(function() {
+ .find(".fileTagsTile").click(function(e) {
+ //e.preventDefault();
self.selectFile($(this).attr("filepath"));
TSCORE.openTagMenu(this, $(this).attr("tag"), $(this).attr("filepath"));
});
+
+ Mousetrap.unbind("mod+a");
+ Mousetrap.bindGlobal("mod+a", function() {
+ self.toggleSelectAll();
+ });
};
ExtUI.prototype.clearSelectedFiles = function() {
@@ -648,5 +642,22 @@ define(function(require, exports, module) {
return prevFilePath;
};
+ ExtUI.prototype.toggleSelectAll = function() {
+ var checkIcon = $("#" + this.extensionID + "ToogleSelectAll").find("i");
+ if (checkIcon.hasClass("fa-square-o")) {
+ TSCORE.selectedFiles = [];
+ $(this.viewContainer).find('.fileTileSelector').each(function() {
+ $(this).parent().parent().addClass("ui-selected");
+ $(this).find("i").addClass("fa-check-square").removeClass("fa-square-o");
+ TSCORE.selectedFiles.push($(this).attr("filepath"));
+ });
+ } else {
+ TSCORE.PerspectiveManager.clearSelectedFiles();
+ }
+ this.handleElementActivation();
+ checkIcon.toggleClass("fa-check-square");
+ checkIcon.toggleClass("fa-square-o");
+ };
+
exports.ExtUI = ExtUI;
});
diff --git a/data/ext/perspectiveList/perspectiveUI.js b/data/ext/perspectiveList/perspectiveUI.js
index 620e7fcc0..c3a6ebc01 100644
--- a/data/ext/perspectiveList/perspectiveUI.js
+++ b/data/ext/perspectiveList/perspectiveUI.js
@@ -39,103 +39,66 @@ define(function(require, exports, module) {
// Init Toolbar
this.viewContainer.append(toolbarTemplate(context));
- $("#" + this.extensionID + "ToogleSelectAll")
- .click(function() {
- if ($(this).find("i").hasClass("fa-square-o")) {
- TSCORE.selectedFiles = [];
- $('#' + self.extensionID + 'FileTable tbody tr').each(function() {
- $(this).addClass('ui-selected');
- $(this).find(".fileSelection").find("i").addClass("fa-check-square-o").removeClass("fa-square-o");
- TSCORE.selectedFiles.push($(this).find(".fileTitleButton").attr("filepath"));
- self.handleElementActivation();
- });
- $(this).find("i")
- .removeClass("fa-square-o")
- .addClass("fa-check-square-o");
- } else {
- TSCORE.PerspectiveManager.clearSelectedFiles();
- $(this).find("i")
- .removeClass("fa fa-check-square-o")
- .addClass("fa fa-square-o");
- }
- });
-
- $("#" + this.extensionID + "IncludeSubDirsButton")
- .click(function() {
- if (TSCORE.Config.getShowWarningRecursiveScan()) {
- TSCORE.showConfirmDialog(
- $.i18n.t("ns.perspectiveList:includeSubdirsTitleConfirm"),
- $.i18n.t("ns.perspectiveList:includeSubdirsContentConfirm"),
- function() {
- TSCORE.Config.setShowWarningRecursiveScan($("#confirmDialog").find("#showThisDialogAgain").prop('checked'));
- //console.log("Shownextime : "+$("#confirmDialog").find("#showThisDialogAgain").prop('checked'));
- $("#" + self.extensionID + "IncludeSubDirsButton").prop('disabled', true);
- TSCORE.IO.createDirectoryIndex(TSCORE.currentPath);
- },
- function() {},
- TSCORE.Config.getShowWarningRecursiveScan()
- );
- } else {
- $("#" + self.extensionID + "IncludeSubDirsButton").prop('disabled', true);
- TSCORE.IO.createDirectoryIndex(TSCORE.currentPath);
- }
- });
+ $("#" + this.extensionID + "ToogleSelectAll").on("click", function() {
+ self.toggleSelectAll();
+ });
- $("#" + this.extensionID + "DeleteSelectedFilesButton")
- .click(function() {
+ $("#" + this.extensionID + "IncludeSubDirsButton").on("click", function() {
+ if (TSCORE.Config.getShowWarningRecursiveScan()) {
+ TSCORE.showConfirmDialog(
+ $.i18n.t("ns.perspectiveList:includeSubdirsTitleConfirm"),
+ $.i18n.t("ns.perspectiveList:includeSubdirsContentConfirm"),
+ function() {
+ TSCORE.Config.setShowWarningRecursiveScan($("#confirmDialog").find("#showThisDialogAgain").prop('checked'));
+ //console.log("Shownextime : "+$("#confirmDialog").find("#showThisDialogAgain").prop('checked'));
+ $("#" + self.extensionID + "IncludeSubDirsButton").prop('disabled', true);
+ TSCORE.IO.createDirectoryIndex(TSCORE.currentPath);
+ },
+ function() {},
+ TSCORE.Config.getShowWarningRecursiveScan()
+ );
+ } else {
+ $("#" + self.extensionID + "IncludeSubDirsButton").prop('disabled', true);
+ TSCORE.IO.createDirectoryIndex(TSCORE.currentPath);
+ }
+ });
- TSCORE.showConfirmDialog($.i18n.t('ns.dialogs:fileDeleteTitleConfirm'),
- $.i18n.t('ns.dialogs:selectedFilesDeleteContentConfirm'), function() {
- TSCORE.selectedFiles.forEach(function(file) {
- TSCORE.IO.deleteElement(file);
- });
+ $("#" + this.extensionID + "DeleteSelectedFilesButton").on("click", function() {
+ TSCORE.showConfirmDialog($.i18n.t('ns.dialogs:fileDeleteTitleConfirm'),
+ $.i18n.t('ns.dialogs:selectedFilesDeleteContentConfirm'), function() {
+ TSCORE.selectedFiles.forEach(function(file) {
+ TSCORE.IO.deleteElement(file);
});
- });
-
- $("#" + this.extensionID + "TagButton")
- .click(function() {
- TSCORE.showAddTagsDialog();
- });
-
- $("#" + this.extensionID + "CopyMoveButton")
- .click(function() {
- TSCORE.showMoveCopyFilesDialog();
- });
+ });
+ });
- $("#" + this.extensionID + "ShowTmbButton")
- .click(function() {
- self.toggleThumbnails();
- });
+ $("#" + this.extensionID + "TagButton").on("click", function() {
+ TSCORE.showAddTagsDialog();
+ });
- $("#" + this.extensionID + "IncreaseThumbsButton")
- .click(function() {
- self.switchThumbnailSize();
- })
- .prop('disabled', true);
+ $("#" + this.extensionID + "CopyMoveButton").on("click", function() {
+ TSCORE.showMoveCopyFilesDialog();
+ });
- $("#" + this.extensionID + "ShowFileDetailsButton")
- .click(function() {
- self.toggleFileDetails();
- });
+ $("#" + this.extensionID + "ShowFileDetailsButton").on("click", function() {
+ self.toggleFileDetails();
+ });
- $("#" + this.extensionID + "ShowTagsButton")
- .click(function() {
- self.toggleTags();
- });
+ $("#" + this.extensionID + "ShowTagsButton").on("click", function() {
+ self.toggleTags();
+ });
- $("#" + this.extensionID + "Export2CSVButton")
- .click(function() {
- var blob = new Blob([TSCORE.exportFileListCSV(TSCORE.fileList)], {
- type: "text/csv;charset=utf-8"
- });
- saveAs(blob, "Export.csv");
- //console.log("Export data: "+TSCORE.exportFileListCSV(TSCORE.fileList));
+ $("#" + this.extensionID + "Export2CSVButton").on("click", function() {
+ var blob = new Blob([TSCORE.exportFileListCSV(TSCORE.fileList)], {
+ type: "text/csv;charset=utf-8"
});
+ saveAs(blob, "Export.csv");
+ //console.log("Export data: "+TSCORE.exportFileListCSV(TSCORE.fileList));
+ });
- $("#" + this.extensionID + "ReloadFolderButton")
- .click(function() {
- TSCORE.navigateToDirectory(TSCORE.currentPath);
- });
+ $("#" + this.extensionID + "ReloadFolderButton").on("click", function() {
+ TSCORE.navigateToDirectory(TSCORE.currentPath);
+ });
$("#" + this.extensionID + "CreateFileButton").on("click", function() {
TSCORE.showFileCreateDialog();
@@ -432,6 +395,11 @@ define(function(require, exports, module) {
}
}
+ Mousetrap.unbind("mod+a");
+ Mousetrap.bindGlobal("mod+a", function() {
+ self.toggleSelectAll();
+ });
+
this.refreshThumbnails();
TSCORE.hideLoadingAnimation();
};
@@ -718,5 +686,23 @@ define(function(require, exports, module) {
return prevFilePath;
};
+
+ ExtUI.prototype.toggleSelectAll = function() {
+ var $checkIcon = $("#" + this.extensionID + "ToogleSelectAll").find("i");
+ if ($checkIcon.hasClass("fa-square-o")) {
+ TSCORE.selectedFiles = [];
+ $('#' + this.extensionID + 'FileTable tbody tr').each(function() {
+ $(this).addClass('ui-selected');
+ $(this).find(".fileSelection").find("i").addClass("fa-check-square-o").removeClass("fa-square-o");
+ TSCORE.selectedFiles.push($(this).find(".fileTitleButton").attr("filepath"));
+ });
+ $checkIcon.removeClass("fa-square-o").addClass("fa-check-square-o");
+ } else {
+ TSCORE.PerspectiveManager.clearSelectedFiles();
+ $checkIcon.removeClass("fa fa-check-square-o").addClass("fa fa-square-o");
+ }
+ this.handleElementActivation();
+ };
+
exports.ExtUI = ExtUI;
});