Skip to content

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

Merge branches 'TS201-AudioRecording' and 'develop' of https://github.com/tagspaces/tagspaces into develop

kristiyandd845ded67959d
diff --cc .gitignore
index a909e78d3,a909e78d3..0975fd255
--- a/.gitignore
+++ b/.gitignore
@@@ -9,7 -9,7 +9,7 @@@ extension
docs
data/pro
data/tsprofile
--data/ext
++#data/ext
nwjsdata
data/electron/data
data/node-webkit/locales
diff --cc .idea/jsLibraryMappings.xml
index 000000000,000000000..95b07d092
new file mode 100644
--- /dev/null
+++ b/.idea/jsLibraryMappings.xml
@@@ -1,0 -1,0 +1,6 @@@
++<?xml version="1.0" encoding="UTF-8"?>
++<project version="4">
++ <component name="JavaScriptLibraryMappings">
++ <file url="file://$PROJECT_DIR$" libraries="{tagspacesNew node_modules}" />
++ </component>
++</project>
diff --cc .idea/libraries/tagspacesNew_node_modules.xml
index 000000000,000000000..c13828206
new file mode 100644
--- /dev/null
+++ b/.idea/libraries/tagspacesNew_node_modules.xml
@@@ -1,0 -1,0 +1,14 @@@
++<component name="libraryTable">
++ <library name="tagspacesNew node_modules" type="javaScript">
++ <properties>
++ <option name="frameworkName" value="node_modules" />
++ <sourceFilesUrls>
++ <item url="file://$PROJECT_DIR$/node_modules" />
++ </sourceFilesUrls>
++ </properties>
++ <CLASSES>
++ <root url="file://$PROJECT_DIR$/node_modules" />
++ </CLASSES>
++ <SOURCES />
++ </library>
++</component>
diff --cc data/libs/extCommon/common.js
index 000000000,c42d565f8..429e10c2d
mode 000000,100644..100644
--- a/data/libs/extCommon/common.js
+++ b/data/libs/extCommon/common.js
@@@ -1,0 -1,229 +1,229 @@@
+ /* Copyright (c) 2013-2016 The TagSpaces Authors.
+ * Use of this source code is governed by the MIT license which can be found in the LICENSE.txt file. */
+
+ "use strict";
+ /* globals Mousetrap */
+
+ var isCordova;
+ var isWin;
+ var isWeb;
+
+ $(document).ready(function() {
+ isCordova = parent.isCordova;
+ isWin = parent.isWin;
+ isWeb = parent.isWeb;
+
+ // Disable drag events in extensions
+ $(document).on('drop dragend dragenter dragover', function(event) {
+ event.preventDefault();
+ });
+
+ // Hide all menus in TS on click in extension
+ $(document).on('click' , function(event) {
+ fireHideAllMenusEvent();
+ });
+
+ function fireHideAllMenusEvent() {
+ var msg = {command: "hideAllMenus"};
+ window.parent.postMessage(JSON.stringify(msg), "*");
+ }
+
+ // Init about box functionality
+ $('#aboutExtensionModal').on('show.bs.modal', function() {
+ $.ajax({
+ url: 'README.md',
+ type: 'GET'
+ }).done(function(mdData) {
+ //console.log("DATA: " + mdData);
- if (marked) {
++ //if (marked) {
+ var modalBody = $("#aboutExtensionModal .modal-body");
+ modalBody.html(marked(mdData, {sanitize: true}));
+ handleLinks(modalBody);
- } else {
- console.log("markdown to html transformer not found");
- }
++ //} else {
++ // console.log("markdown to html transformer not found");
++ //}
+ }).fail(function(data) {
+ console.warn("Loading file failed " + data);
+ });
+ });
+
+ function handleLinks($element) {
+ $element.find("a[href]").each(function() {
+ var currentSrc = $(this).attr("href");
+ $(this).bind('click', function(e) {
+ e.preventDefault();
+ var msg = {command: "openLinkExternally", link: currentSrc};
+ window.parent.postMessage(JSON.stringify(msg), "*");
+ });
+ });
+ }
+
+ $("#aboutButton").on("click", function(e) {
+ $("#aboutExtensionModal").modal({show: true});
+ });
+
+ $(".roundButton").on("click", function(e) {
+ fireHideAllMenusEvent();
+ });
+
+ // Activating the print functionality
+ $("#printButton").on("click", function(e) {
+ window.print();
+ });
+
+ if (isCordova) {
+ $("#printButton").hide();
+ }
+
+ initSearch();
+ });
+
+ function getParameterByName(name) {
+ name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]");
+ var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"), results = regex.exec(location.search);
+
+ return results === null ? "" : decodeURIComponent(results[1].replace(/\+/g, " "));
+ }
+
+ function showSearchPanel(e) {
+ //$('#searchToolbar').slideDown(500);
+ $('#searchToolbar').show();
+ $('#searchBox').val('');
+ $('#searchBox').focus();
+ }
+
+ function cancelSearch() {
+ //$('#searchToolbar').slideUp(500);
+ $('#htmlContent').unhighlight();
+ $('#searchToolbar').hide();
+ //$('#searchBox').hide();
+ }
+
+ function initSearch() {
+ $("#findInFile").on('click', function() {
+ showSearchPanel();
+ });
+
+ $("#searchExtButton").on('click', function() {
+ doSearch();
+ });
+
+ $('#clearSearchExtButton').on('click', function(e) {
+ cancelSearch();
+ });
+
+ $('#searchBox').keyup(function(e) {
+ if (e.keyCode === 13) { // Start the search on ENTER
+ doSearch();}
+ });
+
+ $(window).keyup(function(e) {
+ if (e.keyCode == 27) { // Hide search on ESC
+ cancelSearch();
+ }
+ });
+ //
+ //Mousetrap.bind(['command+f', 'ctrl+f'], function(e) {
+ // showSearchPanel();
+ // return false;
+ //});
+ window.addEventListener("keyup", function keyup(evt){
+
+ var handled = false;
+ var cmd = (evt.ctrlKey ? 1 : 0) |
+ (evt.altKey ? 2 : 0) |
+ (evt.shiftKey ? 4 : 0) |
+ (evt.metaKey ? 8 : 0);
+ /*
+ First, handle the key bindings that are independent whether an input
+ control is selected or not.
+ */
+ if(cmd === 1 || cmd === 8 || cmd === 5 || cmd === 12){
+ // either CTRL or META key with optional SHIFT.
+ switch(evt.keyCode){
+ case 70: // f
+ //open custom search/find text
+ handled = true;
+ break;
+ case 71: //g
+ //find next
+ handled = true;
+ break;
+ case 61: // FF/Mac "="
+ case 107: // FF "+" and "="
+ case 187: // Chrome "+"
+ case 171: // FF with German keyboard
+ //zoom in
+ handled = true;
+ break;
+ case 173: // FF/Mac "-"
+ case 109: // FF "-"
+ case 189: // Chrome "-"
+ //zoom out
+ handled = true;
+ break;
+ }
+ }
+
+ // CTRL or META without shift
+ if(cmd === 1 || cmd === 8){
+ switch(evt.keyCode){
+ case 70: // f
+ showSearchPanel(); //open custom search/find text
+ handled = true;
+ break;
+ }
+ }
+
+ // CTRL+ALT or Option+Command
+ if(cmd === 3 || cmd === 10){
+ switch(evt.keyCode){
+ case 80: //p
+ //presentaion mode
+ handled = true;
+ break;
+ case 71: //g
+ //focus page number dialoge
+ handled = true;
+ break;
+ }
+ }
+ if(handled){
+ evt.preventDefault();
+ return;
+ }
+ });
+ }
+
+ function doSearch() {
+ $('#htmlContent').unhighlight();
+ $('#searchBox').attr('placeholder', 'Search');
+ var givenString = document.getElementById("searchBox").value;
+
+ var selector = $('#htmlContent') || 'body';
+ var caseSensitiveString = $('#htmlContent').highlight(givenString, {wordsOnly: false});
+ var found, getSelection;
+
+ if (window.find) { // Firefox, Google Chrome, Safari
+ found = window.find(givenString);
+ $('#htmlContent').highlight(givenString, {wordsOnly: false});
+
+ var searchTermRegEx = new RegExp(found, "ig");
+ var matches = $(selector).text().match(searchTermRegEx);
+ if (matches) {
+ if ($('.highlight:first').length) {//if match found, scroll to where the first one appears
+ //$(window).animate({scrollTo:($("*:contains('"+ givenString +"')").offset().top)},"fast");
+ //$(selector).animate({scrollTop: $('#htmlContent .highlight::selection').offset().top}, "fast");
+ //window.find(givenString);
+ //$(window).animate({scrollTop: window.find(givenString)}, "fast");
+ }
+ }
+ if (!found || (!found && !caseSensitiveString) || !caseSensitiveString) {
+ var topOfContent = $(selector).animate({scrollTop: $('#htmlContent').offset().top}, "fast");
+ $('#htmlContent').unhighlight();
+ $('#searchBox').val('');
+ $('#searchBox').attr('placeholder', 'Search text not found. Try again.');
+ return topOfContent;
+ }
+ }
+ }