TagSpaces is an offline, open source, document manager with tagging support
update 1.1
kristiyandd6632877fb5e4
diff --git a/bower.json b/bower.jsonindex a1c3671a2..205d94b7b 100644--- a/bower.json+++ b/bower.json@@ -31,6 +31,7 @@"underscore": "https://raw.githubusercontent.com/jashkenas/underscore/1.8.3/underscore.js","marked": "~0.3.5","flatpickr-calendar": "~1.8.7",+ "leaflet.locatecontrol":"~0.52.0","extCommon": "https://github.com/tagspaces/extCommons.git"},"private": true,diff --git a/data/assets/tagspaces.css b/data/assets/tagspaces.cssindex 38cd8c772..b736aa7d9 100644--- a/data/assets/tagspaces.css+++ b/data/assets/tagspaces.css@@ -11,6 +11,7 @@@import '../libs/flatpickr-calendar/dist/flatpickr.material_red.min.css';@import '../libs/flatpickr-calendar/dist/flatpickr.min.css';@import '../libs/leaf/leaflet.css';+@import '../libs/leaflet.locatecontrol/dist/L.Control.Locate.min.css';@import 'general.css';@import 'core.css';@import 'layout.css';diff --git a/data/js/core.ui.js b/data/js/core.ui.jsindex 5416051cf..ac0f8b84c 100644--- a/data/js/core.ui.js+++ b/data/js/core.ui.js@@ -13,19 +13,13 @@ define(function(require, exports, module) {require('pickr');require('leaflet');+ require('leafletlocate');var fileContent;var fileType;var waitingDialogTimeoutID;var addFileInputName;- var fileDropTemplate = Handlebars.compile(- '<div id="fileDropArea">' +- '<div id="fileDropExplanation"><i class="fa fa-2x fa-mail-forward"></i><br>' +- '<span>Drop files here in order to be copied or moved in the current folder</span></div>' +- '</div>'- );-function initUI() {$('#appVersion').text(TSCORE.Config.DefaultSettings.appVersion + '.' + TSCORE.Config.DefaultSettings.appBuild);$('#appVersion').attr('title', 'BuildID: ' + TSCORE.Config.DefaultSettings.appVersion + '.' + TSCORE.Config.DefaultSettings.appBuild + '.' + TSCORE.Config.DefaultSettings.appBuildID);@@ -344,6 +338,13 @@ define(function(require, exports, module) {platformTuning();}+ var fileDropTemplate = Handlebars.compile(+ '<div id="fileDropArea">' ++ '<div id="fileDropExplanation"><i class="fa fa-2x fa-mail-forward"></i><br>' ++ '<span>Drop files here in order to be copied or moved in the current folder</span></div>' ++ '</div>'+ );+function showFileDropArea() {if ($('#fileDropArea').length < 1) {$('#viewContainers').append(fileDropTemplate({}));@@ -685,40 +686,79 @@ define(function(require, exports, module) {flatpickr('#dateTimeCalendar', {dateFormat: 'd-m-Y'});flatpickr('#dateTimeRangeCalendar', {dateFormat: 'd-m-Y'});flatpickr('.calendar');-}- function showGeoLocation() {- var ACCESS_TOKEN = 'pk.eyJ1Ijoia3Jpc3RpeWFuZGQiLCJhIjoiY2lweHVlam5rMDA3Y2k0bTJ4Z3l2ZzFxdyJ9.6pyZff5AHe9xPRX7FcjwCw';- var MB_ATTR = 'Map data © <a href="http://tagspaces.org">TagSpaces</a> contributors, ';- var MB_URL = 'https://api.mapbox.com/styles/v1/mapbox/streets-v9/tiles/256/{z}/{x}/{y}?access_token=' + ACCESS_TOKEN;- var OSM_URL = 'http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png';- var OSM_ATTRIB = '';+ // TagSpaces Map+ var ACCESS_TOKEN = 'pk.eyJ1Ijoia3Jpc3RpeWFuZGQiLCJhIjoiY2lweHVlam5rMDA3Y2k0bTJ4Z3l2ZzFxdyJ9.6pyZff5AHe9xPRX7FcjwCw';+ var MB_ATTR = 'Map data © <a href="http://tagspaces.org">TagSpaces</a>';+ var MB_URL = 'https://api.mapbox.com/styles/v1/mapbox/streets-v9/tiles/256/{z}/{x}/{y}?access_token=' + ACCESS_TOKEN;+ var OSM_URL = 'http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png';+ var OSM_ATTRIB = '';+ var tagSpacesMapOption = {+ //layers: [MB_ATTR],+ center: [51.505, -0.09],+ //zoom: 10,+ zoomControl: true,+ detectRetina: true+ };+ var tagSpacesMap = L.map('mapTag', tagSpacesMapOption).setView([51.505, -0.09], 13);- var mapContent = L.map('mapTag').setView([51.505, -0.09], 13);+ function showGeoLocation() {L.tileLayer(MB_URL, {attribution: MB_ATTR,- id: 'mapbox.streets'- }).addTo(mapContent);-- //var marker;- //mapContent.on('click', function(e) {- // if (!marker) {- // marker = L.marker(e.latlng).addTo(mapContent);- // }- //});- //- //$('#dialogEditTag').on('shown', function() {- // L.Util.requestAnimFrame(mapContent.invalidateSize, mapContent, !1, mapContent._container);- //});- //- //$('#dialogEditTag').on('hidden', function() {- // if (marker) {- // mapContent.removeLayer(marker);- // marker = null;- // }+ id: 'tagSpacesMap'+ }).addTo(tagSpacesMap);++ L.marker([51.5, -0.09]).addTo(tagSpacesMap).bindPopup('TagSpaces').openPopup();++ var popup = L.popup();++ function onMapClick(e) {+ popup.setLatLng(e.latlng).setContent("You clicked the map at " + e.latlng.toString()).openOn(tagSpacesMap);+ }++ tagSpacesMap.on('click', onMapClick);++ }++ function initMap() {++ $('#dialogEditTag').on('show.bs.modal', function() {+ setTimeout(function() {+ tagSpacesMap.invalidateSize();+ }, 10);+ });++ //tagSpacesMap.locate({setView: true, watch: true}) /* This will return map so you can do chaining */+ //.on('locationfound', function(e){+ // var marker = L.marker([e.latitude, e.longitude]).bindPopup('Your are here :)');+ // var circle = L.circle([e.latitude, e.longitude], e.accuracy/2, {+ // weight: 1,+ // color: 'blue',+ // fillColor: '#cacaca',+ // fillOpacity: 0.2+ // });+ // tagSpacesMap.addLayer(marker);+ // tagSpacesMap.addLayer(circle);+ //})+ //.on('locationerror', function(e){+ // console.log(e);+ // alert("Location access denied.");//});++ L.control.locate({+ position: 'topright',+ //strings: {+ // title: "TagSpaces!"+ //}+ }).addTo(tagSpacesMap);++ showGeoLocation();++ //L.mapbox.accessToken = '<your access token here>';+ //L.mapbox.map('map', 'mapbox.streets')+ //.addControl(L.mapbox.geocoderControl('mapbox.places'));}function showTagEditDialog() {@@ -747,7 +787,8 @@ define(function(require, exports, module) {handle: ".modal-header"});showDateTimeCalendar();- showGeoLocation();+ initMap();+}function showRenameFileDialog() {diff --git a/data/loader.js b/data/loader.jsindex d4307b74f..4fc7378ed 100644--- a/data/loader.js+++ b/data/loader.js@@ -111,6 +111,7 @@ var isWin = navigator.appVersion.indexOf("Win")!==-1;offlinelib: 'web/offlinelib/offline.min',webdav: 'web/webdavlib/webdavlib',leaflet: 'libs/leaf/leaflet',+ leafletlocate: 'libs/leaflet.locatecontrol/dist/L.Control.Locate.min',tscore: 'js/core.api',tssetting: 'js/settings.api',