$( '#fileCreateConfirmButton' ).click(function() { var fileTags = ""; var rawTags = $( "#newFileNameTags" ).val().split(","); rawTags.forEach(function (value, index) { if(index == 0) { fileTags = value; } else { fileTags = fileTags + TSCORE.Config.getTagDelimiter() + value; } }); if($("#tagWithCurrentDate").prop("checked")) { if(fileTags.length < 1) { fileTags = TSCORE.TagUtils.formatDateTime4Tag(new Date()); } else { fileTags = fileTags + TSCORE.Config.getTagDelimiter() + TSCORE.TagUtils.formatDateTime4Tag(new Date()); } } if(fileTags.length > 0) { fileTags = TSCORE.TagUtils.beginTagContainer + fileTags + TSCORE.TagUtils.endTagContainer; } var fileName = TSCORE.currentPath+TSCORE.dirSeparator+$( "#newFileName" ).val()+fileTags+"."+fileType; TSCORE.IO.saveTextFile(fileName,fileContent); // TODO move this functionality to postio TSCORE.IO.listDirectory(TSCORE.currentPath); });
var handleStartParameters = function() { //Windows "C:\Users\na\Desktop\TagSpaces\tagspaces.exe" --original-process-start-time=13043601900594583 "G:\data\assets\icon16.png" //Linux /opt/tagspaces/tagspaces /home/na/Dropbox/TagSpaces/README[README].md //OSX /home/na/Dropbox/TagSpaces/README[README].md //gui.App.on('open', function(cmdline) { // console.log('Command line arguments on open: ' + cmdline); // TSCORE.FileOpener.openFile(cmdArguments); //}); var cmdArguments = gui.App.argv; if (cmdArguments !== undefined && cmdArguments.length > 0) { console.log("CMD Arguments: " + cmdArguments + " Process running in " + process.cwd()); var dataPathIndex; cmdArguments.forEach(function(part, index) { if (part === "--data-path") { dataPathIndex = index; } }); if (dataPathIndex >= 0 && cmdArguments.length >= dataPathIndex + 1) { cmdArguments.splice(dataPathIndex, 2); } console.log("CMD Arguments cleaned: " + cmdArguments); var filePath = "" + cmdArguments; var dirPath = TSCORE.TagUtils.extractContainingDirectoryPath(filePath); TSCORE.IO.listDirectory(dirPath); TSCORE.FileOpener.openFileOnStartup(filePath); } };
function cancelSearch() { clearSearchFilter(); $('#searchBox').popover('hide'); $('#searchToolbar').hide(); $('#showSearchButton').show(); // Restoring initial dir listing without subdirectories TSCORE.IO.listDirectory(TSCORE.currentPath); }
function navigateToDirectory(directoryPath) { console.log("Navigating to directory: "+directoryPath); // Cleaning the directory path from \\ \ and / if( (directoryPath.lastIndexOf('/')+1 === directoryPath.length) || (directoryPath.lastIndexOf('\\')+1 === directoryPath.length)) { directoryPath = directoryPath.substring(0,directoryPath.length-1); } if( (directoryPath.lastIndexOf('\\\\')+1 === directoryPath.length)) { directoryPath = directoryPath.substring(0,directoryPath.length-2); } var directoryFoundOn = -1; for(var i=0; i < directoryHistory.length; i++) { if(directoryHistory[i].path === directoryPath) { directoryHistory[i].collapsed = false; directoryFoundOn = i; } else { directoryHistory[i].collapsed = true; } } // Removes the history only if it is a completely new path if(directoryFoundOn >= 0) { var diff1 = directoryHistory.length - (directoryFoundOn+1); if(diff1 > 0) { directoryHistory.splice(directoryFoundOn+1, diff1); } } // If directory path not in history then add it to the history if(directoryFoundOn < 0) { // var parentLocation = directoryPath.substring(0, directoryPath.lastIndexOf(TSCORE.dirSeparator)); var parentLocation = TSCORE.TagUtils.extractParentDirectoryPath(directoryPath); var parentFound = -1; for(var j=0; j < directoryHistory.length; j++) { if(directoryHistory[j].path === parentLocation) { parentFound = j; } } if(parentFound >= 0) { var diff2 = directoryHistory.length - (parentFound+1); if(diff2 > 0) { directoryHistory.splice(parentFound+1, diff2); } } var locationTitle = directoryPath.substring(directoryPath.lastIndexOf(TSCORE.dirSeparator)+1,directoryPath.length); directoryHistory.push({ "name": locationTitle, "path": directoryPath, "collapsed": false }); } console.log("Dir History: "+JSON.stringify(directoryHistory)); TSCORE.currentPath = directoryPath; TSCORE.IO.listDirectory(directoryPath); }
.click(function(evt) { evt.preventDefault(); clearSearchFilter(); // Old clear //$("#"+self.extensionID+"FilterBox").val("").addClass("input-medium"); //$("#"+self.extensionID+"FilterBox").val("").removeClass("input-large"); //self.setFilter(""); //$("#silterBox").val(""); // Restoring initial dir listing without subdirectories TSCORE.IO.listDirectory(TSCORE.currentPath); });
.click(function(evt) { evt.preventDefault(); $("#searchOptions").hide(); $("#clearFilterButton").removeClass("filterOn"); $("#searchBox").val(""); //$("#"+self.extensionID+"FilterBox").val("").addClass("input-medium"); //$("#"+self.extensionID+"FilterBox").val("").removeClass("input-large"); //self.setFilter(""); $("#silterBox").val(""); $("#clearFilterButton").removeClass("filterOn"); TSCORE.Search.nextQuery = ""; // Restoring initial dir listing without subdirectories TSCORE.IO.listDirectory(TSCORE.currentPath); // Keeps the subdir files //TSCORE.PerspectiveManager.redrawCurrentPerspective(); });
var refreshFileListContainer = function() { // TODO consider search view TSCORE.IO.listDirectory(TSCORE.currentPath); };
function onDeviceResume() { //TODO: reload curtent dir after background operation TSCORE.IO.listDirectory(TSCORE.currentPath); }
$( "#editTagButton" ).click(function() { TSCORE.TagUtils.renameTag(TSCORE.selectedFiles[0], TSCORE.selectedTag, $( "#newTagName" ).val()); TSCORE.startTime = new Date().getTime(); TSCORE.IO.listDirectory(TSCORE.currentPath); });