TagSpaces is an offline, open source, document manager with tagging support
jshinting + optimizing i18n
Ilianc916287d1c90
diff --git a/data/js/core.api.js b/data/js/core.api.jsindex 873315173..3fa4e49b6 100644--- a/data/js/core.api.js+++ b/data/js/core.api.js@@ -1,13 +1,14 @@/* Copyright (c) 2012-2013 The TagSpaces Authors. All rights reserved.* Use of this source code is governed by a AGPL3 license that* can be found in the LICENSE file. */+/*global isNode */define(function(require, exports, module) {"use strict";- console.log("Loading core.api.js ...");-- var tsSettings = require("tssetting");- var tsIOApi = require("tsioapi");+ console.log("Loading core.api.js ...");++ var tsSettings = require("tssetting");+ var tsIOApi = require("tsioapi");// var tsIOApiDropbox = require("tsioapidropbox");var tsPersManager = require("tspersmanager");var tsTagUtils = require("tstagutils");@@ -17,46 +18,46 @@ define(function(require, exports, module) {var tsCoreUI = require("tscoreui");var tsSearch = require("tssearch");- var currentPath = undefined;- var currentView = undefined;-- // Current selected files- var selectedFiles = [];-- // Current directory list of files- var fileList = [];-- // Last clicked button for removing a tag- var selectedTag = "";-- var selectedTagData = "";-- var startTime = undefined;-- var subfoldersDirBrowser = undefined;-- var directoryBrowser = undefined;-- function initApp() {- console.log("Init application");-- tsSettings.loadSettingsLocalStorage();-+ var currentPath = undefined;+ var currentView = undefined;++ // Current selected files+ var selectedFiles = [];++ // Current directory list of files+ var fileList = [];++ // Last clicked button for removing a tag+ var selectedTag = "";++ var selectedTagData = "";++ var startTime = undefined;++ var subfoldersDirBrowser = undefined;++ var directoryBrowser = undefined;++ function initApp() {+ console.log("Init application");++ tsSettings.loadSettingsLocalStorage();+checkLocalStorageEnabled();-- // In firefox, by empty local storage trying to load the settings from mozilla preferences- if(tsSettings.Settings == undefined && isFirefox) {- window.setTimeout(tsIOApi.loadSettings, 1000); // executes initUI and updateSettingMozillaPreferences by success- console.log("Loading setting with from mozilla pref execured with delay...");- }-- // If still nothing found, loading the default setting from the application's javascript- // This is usually the case by a new installation- if(tsSettings.Settings == undefined) {- tsSettings.Settings = tsSettings.DefaultSettings;- }-- tsSettings.upgradeSettings();++ // In firefox, by empty local storage trying to load the settings from mozilla preferences+ if(tsSettings.Settings == undefined && isFirefox) {+ window.setTimeout(tsIOApi.loadSettings, 1000); // executes initUI and updateSettingMozillaPreferences by success+ console.log("Loading setting with from mozilla pref execured with delay...");+ }++ // If still nothing found, loading the default setting from the application's javascript+ // This is usually the case by a new installation+ if(tsSettings.Settings == undefined) {+ tsSettings.Settings = tsSettings.DefaultSettings;+ }++ tsSettings.upgradeSettings();// Init UI componentstsCoreUI.initUI();@@ -65,35 +66,35 @@ define(function(require, exports, module) {tsDirectoriesUI.initUI();tsDirectoriesUI.initLocations();tsFileOpener.initUI();- tsPersManager.initPerspectives();-- hideLoadingAnimation();-- $(document).ready(function() {- initLayout();- initI18N();- initKeyBindings();- $( "#loading" ).hide();-- // Show start hint by no last location- var lastLocation = tsSettings.getLastOpenedLocation();- if(lastLocation == undefined || lastLocation.length < 1 ) {+ tsPersManager.initPerspectives();++ hideLoadingAnimation();++ $(document).ready(function() {+ initLayout();+ initI18N();+ initKeyBindings();+ $( "#loading" ).hide();++ // Show start hint by no last location+ var lastLocation = tsSettings.getLastOpenedLocation();+ if(lastLocation == undefined || lastLocation.length < 1 ) {tsCoreUI.showWelcomeDialog();}-- // Show start hint by no locations++ // Show start hint by no locationsif(tsSettings.Settings.tagspacesList.length < 1 ) {$( "#createNewLocation" ).tooltip( "show" );$( "#locationName" ).prop('disabled', true);$( "#selectLocation" ).prop('disabled', true);// tsCoreUI.showWelcomeDialog();}-- console.log("Layout initialized");- });-++ console.log("Layout initialized");+ });+checkForNewVersion();- }+ }function switchIOAPI(type) {if(type=="dropbox") {@@ -105,15 +106,16 @@ define(function(require, exports, module) {}function initI18N() {- $.i18n.init({- ns: { namespaces: ['ns.common'], defaultNs: 'ns.common'},- lng: "en",- debug: false- }, function() {+ $.i18n.init({+ ns: { namespaces: ['ns.common','ns.dialogs']},+ lng: "de",+ //debug: true,+ fallbackLng: "en"+ }, function() {$('[data-i18n]').i18n();- });+ });}-+function initKeyBindings() {if(isNode) {var win = gui.Window.get();@@ -128,7 +130,7 @@ define(function(require, exports, module) {});}}-+function checkForNewVersion() {if(tsSettings.getCheckForUpdates()) {tsIOApi.checkNewVersion();@@ -156,39 +158,33 @@ define(function(require, exports, module) {var currentBuild = parseInt(tsSettings.DefaultSettings["appBuild"]);var currentVersion = parseFloat(tsSettings.DefaultSettings["appVersion"]);- /* Testing the new version notifications- availableVersion = 1;- currentVersion = 1;- availableBuild = 2;- currentBuild = 1;- */+ /* Testing the new version notifications+ availableVersion = 1;+ currentVersion = 1;+ availableBuild = 2;+ currentBuild = 1; */if(availableVersion > currentVersion) {- $("#newVersionMenu").html('<p style="padding: 15px" id="newVersionMessageContent">'+- 'New TagSpaces major release available! Please go to '+- '<a href="http://tagspaces.org/whatsnew/" target="_blank">tagspaces.org/whatsnew/</a> and update.</p>');- $("#newVersionAvailable").css('display', "inline");+ $("#newVersionMenu").html('<p id="newVersionMessageContent"><span data-i18n="app.newMinorReleaseAvailable">New TagSpaces major release available! See what\'s new on</span> ' ++ '<a href="http://tagspaces.org/whatsnew/" class="whatsNewLink">tagspaces.org/whatsnew</a></p>');} else if ((availableVersion == currentVersion) && (availableBuild > currentBuild)) {- $("#newVersionMenu").html('<p style="padding: 15px" id="newVersionMessageContent">'+- 'New TagSpaces minor release available on '+- '<a href="http://tagspaces.org/whatsnew/" target="_blank">tagspaces.org/whatsnew/</a></p>');- $("#newVersionAvailable").css('display', "inline");+ $("#newVersionMenu").html('<p id="newVersionMessageContent"><span data-i18n="app.newMajorReleaseAvailable">New TagSpaces minor release available! See what\'s new on</span> ' ++ '<a href="http://tagspaces.org/whatsnew/" class="whatsNewLink">tagspaces.org/whatsnew</a></p>');}}-- function updateLogger() {- // TODO reactivate- console.log("Updating logger...");- }-- function showLoadingAnimation() {- $("#loadingAnimation").css('visibility', "visible");- }-- function hideLoadingAnimation() {- $("#loadingAnimation").css('visibility', "hidden");- }-++ function updateLogger() {+ console.log("Updating logger...");+ }++ function showLoadingAnimation() {+ $("#loadingAnimation").css('visibility', "visible");+ }++ function hideLoadingAnimation() {+ $("#loadingAnimation").css('visibility', "hidden");+ }+function removeFileModel(model, filePath) {console.log("Removing file from model");for(var i = 0; i < model.length; i++) {@@ -217,7 +213,7 @@ define(function(require, exports, module) {}}}-+function exportFileListCSV(fileList) {var csv = '';var headers = [];@@ -361,27 +357,27 @@ define(function(require, exports, module) {shouldOpenCol3?layoutContainer.open("east"):layoutContainer.close("east");}- function openFileViewer() {- tsCoreUI.hideAllDropDownMenus();- shouldOpenCol3 = true;+ function openFileViewer() {+ tsCoreUI.hideAllDropDownMenus();+ shouldOpenCol3 = true;reLayout();- }-- function closeFileViewer() {+ }++ function closeFileViewer() {shouldOpenCol3 = false;- isFullWidth = false;+ isFullWidth = false;reLayout();- }+ }function toggleFullWidth() {isFullWidth = !isFullWidth;reLayout();}- function toggleLeftPanel() {- layoutContainer.toggle("west");- shouldOpenCol1 = !shouldOpenCol1;- }+ function toggleLeftPanel() {+ layoutContainer.toggle("west");+ shouldOpenCol1 = !shouldOpenCol1;+ }function reloadUI() {location.reload();@@ -390,185 +386,186 @@ define(function(require, exports, module) {window.addEventListener("orientationchange", reLayout);$( window ).on('resize', reLayout);-- function initLayout (){++ function initLayout (){console.log("Initializing Layout...");- layoutContainer = $('body').layout({- name: 'outerLayout' // for debugging & auto-adding buttons (see below)- , fxName: "none" // none, slide- //, fxSpeed: "normal"- , autoResize: true // try to maintain pane-percentages- , autoReopen: true // auto-open panes that were previously auto-closed due to 'no room'+ layoutContainer = $('body').layout({+ name: 'outerLayout' // for debugging & auto-adding buttons (see below)+ , fxName: "none" // none, slide+ //, fxSpeed: "normal"+ , autoResize: true // try to maintain pane-percentages+ , autoReopen: true // auto-open panes that were previously auto-closed due to 'no room', minSize: 1- , autoBindCustomButtons: true- , west__paneSelector: '.col1'- , center__paneSelector: '.col2'- , east__paneSelector: '.col3'- , west__size: col1DefaultWidth- , west__minWidth: col1DefaultWidth- , east__size: 0.5- , west__spacing_open: 1- , east__spacing_open: 1- , center_minWidth: 1- , center_minHeight: 200- , spacing_closed: 0- , noRoomToOpenAction: "hide" // 'close' or 'hide' when no room to open a pane at minSize- // , west__showOverflowOnHover: true- // , center__showOverflowOnHover: true- // , east__showOverflowOnHover: true- , enableCursorHotkey: false- });-- // Initially close the right panel- layoutContainer.close("east");-- col1Layout = layoutContainer.panes.west.layout({- name: 'col1Layout' // for debugging & auto-adding buttons (see below)- // , north__paneSelector: '.row1'- , center__paneSelector: '.row2'- , south__paneSelector: '.row3'- // , north__size: row1Height // percentage size expresses as a string- , south__size: row3Height- , north__spacing_open: 0- , south__spacing_open: 0- , autoResize: false // try to maintain pane-percentages- , closable: false- , togglerLength_open: 0 // hide toggler-buttons- , spacing_closed: 0 // hide resizer/slider bar when closed- //, autoReopen: true // auto-open panes that were previously auto-closed due to 'no room'- , autoBindCustomButtons: true- , minSize: 1- , center__minHeight: 25- // , north__showOverflowOnHover: true- // , center__showOverflowOnHover: true- // , south__showOverflowOnHover: true- , enableCursorHotkey: false- });-- col2Layout = layoutContainer.panes.center.layout({- name: 'col2Layout' // for debugging & auto-adding buttons (see below)- // , north__paneSelector: '.row1'- , center__paneSelector: '.row2'- , south__paneSelector: '.row3'- // , north__size: row1Height // percentage size expresses as a string- , south__size: row3Height- , north__spacing_open: 0- , south__spacing_open: 0- , autoResize: true // try to maintain pane-percentages- , closable: false- , togglerLength_open: 0 // hide toggler-buttons- , spacing_closed: 0 // hide resizer/slider bar when closed- , autoReopen: true // auto-open panes that were previously auto-closed due to 'no room'- , autoBindCustomButtons: true- , minSize: 1- , center__minHeight: 25- , north__showOverflowOnHover: true- // , center__showOverflowOnHover: true- // , south__showOverflowOnHover: true- , enableCursorHotkey: false- });-- /*- var col3Layout = layoutContainer.panes.east.layout({- name: 'col2Layout' // for debugging & auto-adding buttons (see below)- // , north__paneSelector: '.row1'- , center__paneSelector: '.row2'- , south__paneSelector: '.row3'- // , north__size: row1Height // percentage size expresses as a string- , south__size: row3Height- , north__spacing_open: 0- , south__spacing_open: 0- , autoResize: true // try to maintain pane-percentages- , closable: false- , togglerLength_open: 0 // hide toggler-buttons- , spacing_closed: 0 // hide resizer/slider bar when closed- , autoReopen: true // auto-open panes that were previously auto-closed due to 'no room'- , autoBindCustomButtons: true- , minSize: 25- , center__minHeight: 25- , north__showOverflowOnHover: true- // , center__showOverflowOnHover: true- // , south__showOverflowOnHover: true- , enableCursorHotkey: false- }); */-- reLayout();- }--- // Proxying applications parts- exports.Config = tsSettings;- exports.IO = tsIOApi;- exports.PerspectiveManager = tsPersManager;- exports.TagUtils = tsTagUtils;- exports.FileOpener = tsFileOpener;+ , autoBindCustomButtons: true+ , west__paneSelector: '.col1'+ , center__paneSelector: '.col2'+ , east__paneSelector: '.col3'+ , west__size: col1DefaultWidth+ , west__minWidth: col1DefaultWidth+ , east__size: 0.5+ , west__spacing_open: 1+ , east__spacing_open: 1+ , center_minWidth: 1+ , center_minHeight: 200+ , spacing_closed: 0+ , noRoomToOpenAction: "hide" // 'close' or 'hide' when no room to open a pane at minSize+ // , west__showOverflowOnHover: true+ // , center__showOverflowOnHover: true+ // , east__showOverflowOnHover: true+ , enableCursorHotkey: false+ });++ // Initially close the right panel+ layoutContainer.close("east");++ col1Layout = layoutContainer.panes.west.layout({+ name: 'col1Layout' // for debugging & auto-adding buttons (see below)+ // , north__paneSelector: '.row1'+ , center__paneSelector: '.row2'+ , south__paneSelector: '.row3'+ // , north__size: row1Height // percentage size expresses as a string+ , south__size: row3Height+ , north__spacing_open: 0+ , south__spacing_open: 0+ , autoResize: false // try to maintain pane-percentages+ , closable: false+ , togglerLength_open: 0 // hide toggler-buttons+ , spacing_closed: 0 // hide resizer/slider bar when closed+ //, autoReopen: true // auto-open panes that were previously auto-closed due to 'no room'+ , autoBindCustomButtons: true+ , minSize: 1+ , center__minHeight: 25+ // , north__showOverflowOnHover: true+ // , center__showOverflowOnHover: true+ // , south__showOverflowOnHover: true+ , enableCursorHotkey: false+ });++ col2Layout = layoutContainer.panes.center.layout({+ name: 'col2Layout' // for debugging & auto-adding buttons (see below)+ // , north__paneSelector: '.row1'+ , center__paneSelector: '.row2'+ , south__paneSelector: '.row3'+ // , north__size: row1Height // percentage size expresses as a string+ , south__size: row3Height+ , north__spacing_open: 0+ , south__spacing_open: 0+ , autoResize: true // try to maintain pane-percentages+ , closable: false+ , togglerLength_open: 0 // hide toggler-buttons+ , spacing_closed: 0 // hide resizer/slider bar when closed+ , autoReopen: true // auto-open panes that were previously auto-closed due to 'no room'+ , autoBindCustomButtons: true+ , minSize: 1+ , center__minHeight: 25+ , north__showOverflowOnHover: true+ // , center__showOverflowOnHover: true+ // , south__showOverflowOnHover: true+ , enableCursorHotkey: false+ });++ /*+ var col3Layout = layoutContainer.panes.east.layout({+ name: 'col2Layout' // for debugging & auto-adding buttons (see below)+ // , north__paneSelector: '.row1'+ , center__paneSelector: '.row2'+ , south__paneSelector: '.row3'+ // , north__size: row1Height // percentage size expresses as a string+ , south__size: row3Height+ , north__spacing_open: 0+ , south__spacing_open: 0+ , autoResize: true // try to maintain pane-percentages+ , closable: false+ , togglerLength_open: 0 // hide toggler-buttons+ , spacing_closed: 0 // hide resizer/slider bar when closed+ , autoReopen: true // auto-open panes that were previously auto-closed due to 'no room'+ , autoBindCustomButtons: true+ , minSize: 25+ , center__minHeight: 25+ , north__showOverflowOnHover: true+ // , center__showOverflowOnHover: true+ // , south__showOverflowOnHover: true+ , enableCursorHotkey: false+ }); */++ reLayout();+ }+++ // Proxying applications parts+ exports.Config = tsSettings;+ exports.IO = tsIOApi;+ exports.PerspectiveManager = tsPersManager;+ exports.TagUtils = tsTagUtils;+ exports.FileOpener = tsFileOpener;exports.Search = tsSearch;-- // Public API definition- exports.initApp = initApp;- exports.updateLogger = updateLogger;- exports.showLoadingAnimation = showLoadingAnimation;- exports.hideLoadingAnimation = hideLoadingAnimation;++ // Public API definition+ exports.initApp = initApp;+ exports.updateLogger = updateLogger;+ exports.showLoadingAnimation = showLoadingAnimation;+ exports.hideLoadingAnimation = hideLoadingAnimation;// exports.fileExists = fileExists;- exports.reloadUI = reloadUI;- exports.openFileViewer = openFileViewer;- exports.closeFileViewer = closeFileViewer;- exports.toggleLeftPanel = toggleLeftPanel;- exports.toggleFullWidth = toggleFullWidth;- exports.updateNewVersionData = updateNewVersionData;- exports.exportFileListCSV = exportFileListCSV;- exports.exportFileListArray = exportFileListArray;- exports.removeFileModel = removeFileModel;- exports.updateFileModel = updateFileModel;-- // Proxying functions from tsCoreUI+ exports.reloadUI = reloadUI;+ exports.openFileViewer = openFileViewer;+ exports.closeFileViewer = closeFileViewer;+ exports.toggleLeftPanel = toggleLeftPanel;+ exports.toggleFullWidth = toggleFullWidth;+ exports.updateNewVersionData = updateNewVersionData;+ exports.exportFileListCSV = exportFileListCSV;+ exports.exportFileListArray = exportFileListArray;+ exports.removeFileModel = removeFileModel;+ exports.updateFileModel = updateFileModel;++ // Proxying functions from tsCoreUIexports.clearSearchFilter = tsCoreUI.clearSearchFilter;- exports.enableTopToolbar = tsCoreUI.enableTopToolbar;+ exports.openLinkExternally = tsCoreUI.openLinkExternally;+ exports.enableTopToolbar = tsCoreUI.enableTopToolbar;exports.disableTopToolbar = tsCoreUI.disableTopToolbar;- exports.showAlertDialog = tsCoreUI.showAlertDialog;- exports.showConfirmDialog = tsCoreUI.showConfirmDialog;- exports.showTagEditDialog = tsCoreUI.showTagEditDialog;- exports.hideAllDropDownMenus = tsCoreUI.hideAllDropDownMenus;- exports.showFileCreateDialog = tsCoreUI.showFileCreateDialog;- exports.showFileRenameDialog = tsCoreUI.showFileRenameDialog;+ exports.showAlertDialog = tsCoreUI.showAlertDialog;+ exports.showConfirmDialog = tsCoreUI.showConfirmDialog;+ exports.showTagEditDialog = tsCoreUI.showTagEditDialog;+ exports.hideAllDropDownMenus = tsCoreUI.hideAllDropDownMenus;+ exports.showFileCreateDialog = tsCoreUI.showFileCreateDialog;+ exports.showFileRenameDialog = tsCoreUI.showFileRenameDialog;exports.showFileDeleteDialog = tsCoreUI.showFileDeleteDialog;- exports.showLocationsPanel = tsCoreUI.showLocationsPanel;- exports.showTagsPanel = tsCoreUI.showTagsPanel;- exports.showContextMenu = tsCoreUI.showContextMenu;- exports.showDirectoryBrowserDialog = tsCoreUI.showDirectoryBrowserDialog;-- // Proxying functions from tsTagsUI- exports.generateTagButtons = tsTagsUI.generateTagButtons;- exports.generateTagStyle = tsTagsUI.generateTagStyle;- exports.openTagMenu = tsTagsUI.openTagMenu;- exports.showAddTagsDialog = tsTagsUI.showAddTagsDialog;- exports.showTagEditInTreeDialog = tsTagsUI.showTagEditInTreeDialog;+ exports.showLocationsPanel = tsCoreUI.showLocationsPanel;+ exports.showTagsPanel = tsCoreUI.showTagsPanel;+ exports.showContextMenu = tsCoreUI.showContextMenu;+ exports.showDirectoryBrowserDialog = tsCoreUI.showDirectoryBrowserDialog;++ // Proxying functions from tsTagsUI+ exports.generateTagButtons = tsTagsUI.generateTagButtons;+ exports.generateTagStyle = tsTagsUI.generateTagStyle;+ exports.openTagMenu = tsTagsUI.openTagMenu;+ exports.showAddTagsDialog = tsTagsUI.showAddTagsDialog;+ exports.showTagEditInTreeDialog = tsTagsUI.showTagEditInTreeDialog;exports.showDialogTagCreate = tsTagsUI.showDialogTagCreate;exports.showDialogEditTagGroup = tsTagsUI.showDialogEditTagGroup;exports.showDialogTagGroupCreate = tsTagsUI.showDialogTagGroupCreate;exports.calculatedTags = tsTagsUI.calculatedTags;exports.generateTagGroups = tsTagsUI.generateTagGroups;- // Proxying functions from directoriesUI+ // Proxying functions from directoriesUIexports.openLocation = tsDirectoriesUI.openLocation;- exports.updateSubDirs = tsDirectoriesUI.updateSubDirs;- exports.initLocations = tsDirectoriesUI.initLocations;- exports.showCreateDirectoryDialog = tsDirectoriesUI.showCreateDirectoryDialog;+ exports.updateSubDirs = tsDirectoriesUI.updateSubDirs;+ exports.initLocations = tsDirectoriesUI.initLocations;+ exports.showCreateDirectoryDialog = tsDirectoriesUI.showCreateDirectoryDialog;exports.closeCurrentLocation = tsDirectoriesUI.closeCurrentLocation;exports.navigateToDirectory = tsDirectoriesUI.navigateToDirectory;- // Public variables definition- exports.currentPath = currentPath;- exports.currentView = currentView;- exports.selectedFiles = selectedFiles;- exports.fileList = fileList;- exports.selectedTag = selectedTag;- exports.selectedTagData = selectedTagData;- exports.startTime = startTime;- exports.subfoldersDirBrowser = subfoldersDirBrowser;- exports.directoryBrowser = directoryBrowser;-+ // Public variables definition+ exports.currentPath = currentPath;+ exports.currentView = currentView;+ exports.selectedFiles = selectedFiles;+ exports.fileList = fileList;+ exports.selectedTag = selectedTag;+ exports.selectedTagData = selectedTagData;+ exports.startTime = startTime;+ exports.subfoldersDirBrowser = subfoldersDirBrowser;+ exports.directoryBrowser = directoryBrowser;+exports.fileListFILEEXT = 0;exports.fileListTITLE = 1;exports.fileListTAGS = 2;@@ -578,5 +575,5 @@ define(function(require, exports, module) {exports.fileListFILENAME = 6;exports.dirSeparator = isWin?"\\":"/";-+});\ No newline at end of file