place
+ size size
+@*/
+
+Ox.LeafletMapMarker = function(options) {
+
+ options = Ox.extend({
+ map: null,
+ place: null
+ }, options);
+
+ var that = this,
+ areaSize = {
+ 100: 10, // 10 x 10 m
+ 10000: 12, // 100 x 100 m
+ 1000000: 14, // 1 x 1 km
+ 100000000: 16, // 10 x 10 km
+ 10000000000: 18, // 100 x 100 km
+ 1000000000000: 20, // 1,000 x 1,000 km
+ 100000000000000: 22 // 10,000 x 10,000 km
+ },
+ themeData = Ox.Theme.getThemeData(),
+ typeColor = {};
+
+ [
+ 'country', 'region', 'city', 'borough',
+ 'street', 'building', 'feature'
+ ].forEach(function(type) {
+ typeColor[type] = themeData[
+ 'mapPlace' + Ox.toTitleCase(type) + 'Color'
+ ];
+ });
+
+ Ox.forEach(options, function(val, key) {
+ that[key] = val;
+ });
+ console.log('place', options.place);
+ that.marker = new L.Marker([options.place.center.lat, options.place.center.lng], {
+ // raiseOnDrag: false,
+ // shape: {coords: [8, 8, 8], type: 'circle'}
+ //title: that.place.name,
+ //zIndex: 1000
+ }).addTo(options.map.map);
+
+ // setOptions();
+
+ function click() {
+ var key = that.map.getKey(),
+ place, bounds, southWest, northEast;
+ if (!that.place.selected) {
+ if (
+ that.map.options('editable')
+ && (key == 'meta' || key == 'shift')
+ ) {
+ place = that.map.getSelectedPlace();
+ }
+ if (place) {
+ bounds = new L.LatLngBounds(
+ new L.LatLng(place.south, place.west),
+ new L.LatLng(place.north, place.east)
+ );
+ bounds = bounds.extend(that.place.bounds);
+ southWest = bounds.getSouthWest();
+ northEast = bounds.getNorthEast();
+ that.map.newPlace(new Ox.LeafletMapPlace({
+ // fixme: duplicated, see Ox.Map.js
+ alternativeNames: [],
+ countryCode: '',
+ editable: true,
+ geoname: '',
+ id: '_' + Ox.encodeBase32(Ox.uid()), // fixme: stupid
+ map: that.map,
+ name: '',
+ type: 'feature',
+ south: southWest.lat,
+ west: southWest.lng,
+ north: northEast.lat,
+ east: northEast.lng
+ }));
+ } else {
+ console.log('place', that.place);
+ that.map.options({selected: that.place.id});
+ }
+ } else {
+ if (key == 'meta') {
+ that.map.options({selected: null});
+ } else {
+ that.map.panToPlace();
+ }
+ }
+ }
+
+ function dblclick() {
+ that.place.selected && that.map.zoomToPlace();
+ }
+
+ function dragstart(e) {
+ Ox.$body.addClass('OxDragging');
+ }
+
+ function drag(e) {
+ var northSouth = (that.place.north - that.place.south) / 2,
+ lat = Ox.limit(
+ e.latLng.lat(),
+ Ox.MIN_LATITUDE + northSouth,
+ Ox.MAX_LATITUDE - northSouth
+ ),
+ lng = e.latLng.lng(),
+ span = Math.min(
+ that.place.sizeEastWest * Ox.getDegreesPerMeter(lat) / 2, 179.99999999
+ ),
+ degreesPerMeter = Ox.getDegreesPerMeter(lat);
+ that.place.south += lat - that.place.lat;
+ that.place.north += lat - that.place.lat;
+ that.place.west = lng - span;
+ that.place.east = lng + span;
+ if (that.place.west < -180) {
+ that.place.west += 360;
+ } else if (that.place.east > 180) {
+ that.place.east -= 360;
+ }
+ Ox.Log('Map', 'west', that.place.west, 'east', that.place.east, 'span', span);
+ that.place.update();
+ that.marker.setOptions({
+ position: that.place.center
+ });
+ that.place.rectangle.update();
+ }
+
+ function dragend(e) {
+ Ox.$body.removeClass('OxDragging');
+ that.map.triggerEvent('changeplaceend', that.place);
+ }
+
+ function getMarkerImage(options, callback) {
+ // fixme: unused
+ options = Ox.extend({
+ background: [255, 0, 0],
+ editing: false,
+ result: false,
+ selected: false,
+ size: 16
+ }, options);
+ var background = options.result ? [255, 255, 0] : [255, 0, 0],
+ border = options.editing ? [128, 128, 255] :
+ options.selected ? [255, 255, 255] : [0, 0, 0],
+ c = Ox.canvas(options.size, options.size),
+ image,
+ r = options.size / 2;
+ if (Ox.isArray(background)) {
+ c.context.fillStyle = 'rgba(' + background.join(', ') + ', 0.5)';
+ c.context.arc(r, r, r - 2, 0, 360);
+ c.context.fill();
+ renderImage();
+ } else {
+ image = new Image();
+ image.onload = renderImage;
+ image.src = background;
+ }
+ function renderImage() {
+ //var i;
+ if (Ox.isString(background)) {
+ c.context.drawImage(image, 1, 1, options.size - 2, options.size - 2);
+ /*
+ c.imageData = c.context.getImageData(0, 0, options.size, options.size);
+ c.data = c.imageData.data;
+ for (i = 3; i < c.data.length; i += 1) {
+ c.data[i] = Math.round(c.data[i] * 0.5);
+ }
+ c.context.putImageData(c.imageData, 0, 0);
+ */
+ }
+ c.context.beginPath();
+ c.context.lineWidth = 2;
+ c.context.strokeStyle = 'rgb(' + border.join(', ') + ')';
+ c.context.arc(r, r, r - 1, 0, 360);
+ c.context.stroke();
+ callback(new google.maps.MarkerImage(
+ c.canvas.toDataURL(),
+ new google.maps.Size(options.size, options.size),
+ new google.maps.Point(0, 0),
+ new google.maps.Point(r, r)
+ ));
+ }
+ }
+
+ function mouseover(e) {
+ var offset = that.map.offset(),
+ xy = that.map.overlayView.getProjection()
+ .fromLatLngToContainerPixel(e.latLng);
+ that.tooltip.show(
+ offset.left + Math.round(xy.x) - 4,
+ offset.top + Math.round(xy.y) + 20
+ );
+ }
+
+ function mouseout() {
+ that.tooltip.hide();
+ }
+
+ function setOptions() {
+ // workaround to prevent marker from appearing twice
+ // after setting draggable from true to false (google maps bug)
+ // var fix = that.marker.getDraggable() && !that.place.editing,
+ // color = that.map.options('markerColor'),
+ // size = that.map.options('markerSize');
+ var fix = false,
+ color = that.map.options('markerColor'),
+ size = that.map.options('markerSize');
+ //Ox.Log('Map', 'setOptions, that.map: ', that.map)
+ if (color == 'auto') {
+ that.color = typeColor[that.place.type] || typeColor['mapPlaceFeatureColor'];
+ } else if (Ox.isArray(color)) {
+ that.color = color;
+ } else {
+ that.color = color(that.place);
+ }
+ if (size == 'auto') {
+ that.size = 8;
+ Ox.forEach(areaSize, function(size, area) {
+ if (that.place.area >= area) {
+ that.size = size;
+ } else {
+ return false; // break
+ }
+ });
+ } else if (Ox.isNumber(size)) {
+ that.size = size;
+ } else {
+ that.size = size(that.place);
+ }
+ // that.marker.setOptions({
+ // // fixme: cursor remains pointer
+ // cursor: that.place.editing ? 'move' : 'pointer',
+ // draggable: that.place.editing,
+ // // icon: Ox.MapMarkerImage({
+ // // color: that.color,
+ // // mode: that.place.editing ? 'editing' :
+ // // that.place.selected ? 'selected' : 'normal',
+ // // size: that.size,
+ // // type: that.place.id[0] == '_' ? 'result' : 'place'
+ // // }),
+ // position: that.place.center
+ // });
+ if (fix) {
+ that.marker.setVisible(false);
+ setTimeout(function() {
+ that.marker.setVisible(true);
+ }, 0);
+ }
+ setTooltip();
+ }
+
+ function setTooltip() {
+ that.tooltip && that.tooltip.remove();
+ that.tooltip = Ox.Tooltip({
+ title: '
'
+ + ''
+ + that.map.options('markerTooltip')(that.place) + '
'
+ })
+ .addClass('OxMapMarkerTooltip');
+ }
+
+ /*@
+ add add to map
+ () -> add to map, returns MapMarker
+ @*/
+ that.add = function() {
+ that.marker.addTo(that.map.map);
+ that.marker.on('click', click);
+ that.marker.on('dblclick', dblclick);
+ // that.marker.on('mouseover', mouseover);
+ // that.marker.on('mouseout', mouseout);
+ // google.maps.event.addListener(that.marker, 'click', click);
+ // google.maps.event.addListener(that.marker, 'dblclick', dblclick);
+ // google.maps.event.addListener(that.marker, 'mouseover', mouseover);
+ // google.maps.event.addListener(that.marker, 'mouseout', mouseout);
+ return that;
+ };
+
+ /*@
+ edit edit marker
+ () -> edit marker, returns MapMarker
+ @*/
+ that.edit = function() {
+ setOptions();
+ google.maps.event.addListener(that.marker, 'dragstart', dragstart);
+ google.maps.event.addListener(that.marker, 'drag', drag);
+ google.maps.event.addListener(that.marker, 'dragend', dragend);
+ return that;
+ };
+
+ /*@
+ remove remove marker
+ () -> remove marker from map, returns MapMarker
+ @*/
+ that.remove = function() {
+ that.marker.setMap(null);
+ google.maps.event.clearListeners(that.marker);
+ return that;
+ };
+
+ /*@
+ submit submit marker
+ () -> clear edit listeners, returns MapMarker
+ @*/
+ that.submit = function() {
+ google.maps.event.clearListeners(that.marker, 'dragstart');
+ google.maps.event.clearListeners(that.marker, 'drag');
+ google.maps.event.clearListeners(that.marker, 'dragend');
+ return that;
+ }
+
+ /*@
+ update update marker
+ () -> update marker, returns MapMarker
+ @*/
+ that.update = function() {
+ setOptions();
+ return that;
+ }
+
+ return that;
+
+};
diff --git a/source/UI/js/Map/LeafletMapPlace.js b/source/UI/js/Map/LeafletMapPlace.js
new file mode 100644
index 00000000..a413afa8
--- /dev/null
+++ b/source/UI/js/Map/LeafletMapPlace.js
@@ -0,0 +1,230 @@
+'use strict';
+
+/*@
+Ox.MapPlace MapPlace Object
+ (options) -> MapPlace Object
+ options Options object
+ east
+ editing
+ geoname
+ map
+ markerColor 0> 0]>
+ markerSize
+ name
+ north
+ selected
+ south
+ type
+ visible
+ west
+@*/
+
+Ox.LeafletMapPlace = function(options) {
+
+ options = Ox.extend({
+ east: 0,
+ editing: false,
+ geoname: '',
+ map: null,
+ name: '',
+ north: 0,
+ selected: false,
+ south: 0,
+ type: '',
+ visible: false,
+ west: 0
+ }, options);
+
+ var that = this;
+
+ Ox.forEach(options, function(val, key) {
+ that[key] = val;
+ });
+
+ update();
+
+ function update(updateMarker) {
+ // console.log('foo', that.north, that.east, that.south, that.west);
+ if (that.east < that.west) {
+ if (that.west > 170) {
+ that.west -= 360
+ //console.log(that.geoname, '<< west', that.west+360, '=>', that.west)
+ } else {
+ that.east += 360
+ //console.log(that.geoname, '>> east', that.east-360, that.east)
+ }
+ }
+ that.points = {
+ ne: new L.LatLng(that.north, that.east),
+ sw: new L.LatLng(that.south, that.west)
+ };
+ console.log('points', JSON.stringify(that.points, null, 2));
+
+ that.bounds = new L.latLngBounds(that.points.sw, that.points.ne);
+ that.center = that.bounds.getCenter();
+ that.lat = that.center.lat;
+ that.lng = that.center.lng;
+ Ox.extend(that.points, {
+ e: new L.LatLng(that.lat, that.east),
+ s: new L.LatLng(that.south, that.lng),
+ se: new L.LatLng(that.south, that.east),
+ n: new L.LatLng(that.north, that.lng),
+ nw: new L.LatLng(that.north, that.west),
+ w: new L.LatLng(that.lat, that.west)
+ });
+ // fixme: use bounds.toSpan()
+ that.sizeNorthSouth = (that.north - that.south)
+ * Ox.EARTH_CIRCUMFERENCE / 360;
+ that.sizeEastWest = (that.east + (that.west > that.east ? 360 : 0) - that.west)
+ * Ox.getMetersPerDegree(that.lat);
+ that.area = Ox.getArea(
+ {lat: that.south, lng: that.west},
+ {lat: that.north, lng: that.east}
+ );
+ if (!that.marker) {
+ that.marker = new Ox.LeafletMapMarker({
+ map: that.map,
+ place: that
+ });
+ that.rectangle = new Ox.LeafletMapRectangle({
+ map: that.map,
+ place: that
+ });
+ } else if (updateMarker) {
+ that.marker.update();
+ that.rectangle.update();
+ }
+ }
+
+ function editable() {
+ return that.map.options('editable') && that.editable;
+ }
+
+ /*@
+ add add
+ @*/
+ that.add = function() {
+ that.visible = true;
+ that.marker.add();
+ return that;
+ };
+
+ /*@
+ cancel cancel
+ @*/
+ that.cancel = function() {
+ if (editable()) {
+ that.undo();
+ that.editing = false;
+ that.marker.update();
+ that.rectangle.deselect();
+ }
+ return that;
+ };
+
+ /*@
+ crossesDateline crossesDateline
+ @*/
+ that.crossesDateline = function() {
+ return that.west > that.east;
+ }
+
+ /*@
+ deselect dselect
+ @*/
+ that.deselect = function() {
+ that.editing && that.submit();
+ that.selected = false;
+ that.marker.update();
+ that.rectangle.remove();
+ return that;
+ };
+
+ /*@
+ edit edit
+ @*/
+ that.edit = function() {
+ if (editable()) {
+ that.editing = true;
+ that.original = {
+ south: that.south,
+ west: that.west,
+ north: that.north,
+ east: that.east
+ };
+ that.marker.edit();
+ that.rectangle.select();
+ }
+ return that;
+ };
+
+ // fixme: make this an Ox.Element to get options handling for free?
+ that.options = function(options) {
+ options = Ox.makeObject(arguments);
+ Ox.forEach(options, function(value, key) {
+ that[key] = value;
+ });
+ update(true);
+ };
+
+ /*@
+ remove remove
+ @*/
+ that.remove = function() {
+ that.editing && that.submit();
+ that.selected && that.deselect();
+ that.visible = false;
+ that.marker.remove();
+ return that;
+ };
+
+ /*@
+ select select
+ @*/
+ that.select = function() {
+ that.selected = true;
+ !that.visible && that.add();
+ that.marker.update();
+ that.rectangle.add();
+ return that;
+ };
+
+ /*@
+ submit submit
+ @*/
+ that.submit = function() {
+ if (editable()) {
+ that.editing = false;
+ that.marker.update();
+ that.rectangle.deselect();
+ }
+ return that;
+ };
+
+ /*@
+ update update
+ @*/
+ that.update = function(updateMarker) {
+ update(updateMarker);
+ that.map.triggerEvent('changeplace', that);
+ return that;
+ };
+
+ /*@
+ undo undo
+ @*/
+ that.undo = function() {
+ if (editable()) {
+ Ox.forEach(that.original, function(v, k) {
+ that[k] = v;
+ });
+ that.update();
+ that.marker.update();
+ that.rectangle.update();
+ }
+ return that;
+ };
+
+ return that;
+
+};
diff --git a/source/UI/js/Map/LeafletMapRectangle.js b/source/UI/js/Map/LeafletMapRectangle.js
new file mode 100644
index 00000000..99f1a19e
--- /dev/null
+++ b/source/UI/js/Map/LeafletMapRectangle.js
@@ -0,0 +1,133 @@
+'use strict';
+
+/*@
+Ox.MapRectangle MapRectangle Object
+ (options) -> MapRectangle Object
+ options Options object
+ map map
+ place place
+@*/
+
+Ox.LeafletMapRectangle = function(options) {
+
+ options = Ox.extend({
+ map: null,
+ place: null
+ }, options);
+
+ var that = this,
+ themeData = Ox.Theme.getThemeData();
+
+ Ox.forEach(options, function(val, key) {
+ that[key] = val;
+ });
+
+ /*@
+ rectangle google.maps.Rectangle
+ @*/
+ console.log('place bounds', that.place.bounds);
+ that.rectangle = new L.rectangle(that.place.bounds);
+
+ /*@
+ markers array of markers
+ @*/
+ that.markers = Ox.map(that.place.points, function(point, position) {
+ return new Ox.LeafletMapRectangleMarker({
+ map: that.map,
+ place: that.place,
+ position: position
+ });
+ });
+
+ setOptions();
+
+ function click() {
+ if (
+ that.map.options('editable')
+ && that.place.editable
+ && !that.place.editing
+ ) {
+ that.place.edit();
+ } else if (that.map.getKey() == 'meta') {
+ that.place.submit();
+ } else if (that.map.getKey() == 'shift') {
+ that.map.zoomToPlace();
+ } else {
+ that.map.panToPlace();
+ }
+ }
+
+ function setOptions() {
+ var color = '#' + Ox.toHex(themeData[
+ that.place.editing
+ ? 'mapPlaceEditingBorder'
+ : 'mapPlaceSelectedBorder'
+ ]);
+ // that.rectangle.setOptions({
+ // bounds: that.place.bounds,
+ // fillColor: color,
+ // fillOpacity: that.place.editing ? 0.1 : 0,
+ // strokeColor: color,
+ // strokeOpacity: that.place.id[0] == '_' ? 0.5 : 1,
+ // strokeWeight: 2
+ // });
+ }
+
+ /*@
+ add add
+ @*/
+ that.add = function() {
+ that.rectangle.addTo(that.map.map);
+ that.rectangle.on('click', click);
+ // google.maps.event.addListener(that.rectangle, 'click', click);
+ return that;
+ };
+
+ /*@
+ deselect deselect
+ @*/
+ that.deselect = function() {
+ setOptions();
+ Ox.Log('Map', 'MARKERS', that.markers)
+ Ox.forEach(that.markers, function(marker) {
+ marker.remove();
+ });
+ return that;
+ };
+
+ /*@
+ remove remove
+ @*/
+ that.remove = function() {
+ that.rectangle.remove();
+ // that.rectangle.setMap(null);
+ // google.maps.event.clearListeners(that.rectangle);
+ return that;
+ }
+
+ /*@
+ select select
+ @*/
+ that.select = function() {
+ setOptions();
+ Ox.forEach(that.markers, function(marker) {
+ marker.add();
+ });
+ return that;
+ };
+
+ /*@
+ update udpate
+ @*/
+ that.update = function() {
+ Ox.Log('Map', 'UPDATE...')
+ setOptions();
+ Ox.forEach(that.markers, function(marker) {
+ marker.update();
+ });
+ return that;
+ }
+
+ return that;
+
+};
diff --git a/source/UI/js/Map/LeafletMapRectangleMarker.js b/source/UI/js/Map/LeafletMapRectangleMarker.js
new file mode 100644
index 00000000..71a0e72c
--- /dev/null
+++ b/source/UI/js/Map/LeafletMapRectangleMarker.js
@@ -0,0 +1,126 @@
+'use strict';
+
+/*@
+Ox.MapRectangleMarker MapRectangleMarker Object
+ (options) -> MapRectangleMarker Object
+ options Options object
+ map map
+ place place
+ position
+@*/
+
+Ox.LeafletMapRectangleMarker = function(options) {
+
+ options = Ox.extend({
+ map: null,
+ place: null,
+ position: ''
+ }, options);
+
+ var that = this;
+
+ Ox.forEach(options, function(val, key) {
+ that[key] = val;
+ });
+ console.log('position', that.place.points, that.position);
+ // that.markerImage = new google.maps.MarkerImage
+ that.marker = new L.Marker({
+
+ });
+ // that.marker = new google.maps.Marker({
+ // cursor: that.position + '-resize',
+ // draggable: true,
+ // icon: Ox.MapMarkerImage({
+ // mode: 'editing',
+ // rectangle: true,
+ // type: that.place.id[0] == '_' ? 'result' : 'place'
+ // }),
+ // position: that.place.points[that.position],
+ // raiseOnDrag: false
+ // });
+
+ function dragstart(e) {
+ Ox.$body.addClass('OxDragging');
+ that.drag = {
+ lat: e.latLng.lat(),
+ lng: e.latLng.lng()
+ };
+ }
+
+ function drag(e) {
+ // fixme: implement shift+drag (center stays the same)
+ Ox.Log('Map', e.pixel.x, e.pixel.y)
+ var lat = Ox.limit(e.latLng.lat(), Ox.MIN_LATITUDE, Ox.MAX_LATITUDE),
+ lng = e.latLng.lng();
+ that.drag = {
+ lat: lat,
+ lng: lng
+ };
+ if (that.position.indexOf('s') > -1) {
+ that.place.south = lat;
+ }
+ if (that.position.indexOf('n') > -1) {
+ that.place.north = lat;
+ }
+ if (that.position.indexOf('w') > -1) {
+ that.place.west = lng;
+ }
+ if (that.position.indexOf('e') > -1) {
+ that.place.east = lng;
+ }
+ //Ox.Log('Map', 'west', that.place.west, 'east', that.place.east);
+ //Ox.Log('Map', 'south', that.place.south, 'north', that.place.north);
+ that.place.update();
+ that.place.marker.update();
+ that.place.rectangle.update();
+ }
+
+ function dragend(e) {
+ var south;
+ Ox.$body.removeClass('OxDragging');
+ if (that.place.south > that.place.north) {
+ south = that.place.south;
+ that.place.south = that.place.north;
+ that.place.north = south;
+ that.place.update();
+ that.place.marker.update();
+ that.place.rectangle.update();
+ }
+ that.map.triggerEvent('changeplaceend', that.place);
+ }
+
+ /*@
+ add add
+ @*/
+ that.add = function() {
+ that.marker.setMap(that.map.map);
+ google.maps.event.addListener(that.marker, 'dragstart', dragstart);
+ google.maps.event.addListener(that.marker, 'drag', drag);
+ google.maps.event.addListener(that.marker, 'dragend', dragend);
+ };
+
+ /*@
+ remove remove
+ @*/
+ that.remove = function() {
+ that.marker.setMap(null);
+ google.maps.event.clearListeners(that.marker);
+ };
+
+ /*@
+ update update
+ @*/
+ that.update = function() {
+ that.marker.setOptions({
+ icon: Ox.MapMarkerImage({
+ mode: 'editing',
+ rectangle: true,
+ type: that.place.id[0] == '_' ? 'result' : 'place'
+ }),
+ position: that.place.points[that.position]
+ });
+ };
+
+ return that;
+
+};
diff --git a/source/UI/js/Map/Map.js b/source/UI/js/Map/Map.js
index 9f5c4392..f12e1654 100644
--- a/source/UI/js/Map/Map.js
+++ b/source/UI/js/Map/Map.js
@@ -832,7 +832,6 @@ Ox.Map = function(options, self) {
}
function initMap() {
-
getMapBounds(function(mapBounds) {
//Ox.Log('Map', 'init', mapBounds.getSouthWest(), mapBounds.getNorthEast(), mapBounds.getCenter())
diff --git a/source/UI/js/Video/AnnotationFolder.js b/source/UI/js/Video/AnnotationFolder.js
index 2284f36d..4b04dcd4 100644
--- a/source/UI/js/Video/AnnotationFolder.js
+++ b/source/UI/js/Video/AnnotationFolder.js
@@ -35,7 +35,6 @@ Ox.AnnotationFolder = function(options, self) {
var that = Ox.Element({}, self)
.defaults({
clickLink: null,
- confirmDeleteDialog: null,
collapsed: false,
editable: false,
highlight: '',
@@ -282,7 +281,6 @@ Ox.AnnotationFolder = function(options, self) {
}
self.$annotations = Ox.ArrayEditable(Ox.extend({
clickLink: self.options.clickLink,
- confirmDeleteDialog: self.options.confirmDeleteDialog,
editable: self.options.editable,
getSortValue: self.options.type == 'text'
? function(value) {
@@ -581,40 +579,26 @@ Ox.AnnotationFolder = function(options, self) {
function selectAnnotation(data) {
if (self.loaded) {
- var extendedData;
- if (Ox.isArray(data.id) && data.id.length) {
- var items = data.id.map(id => {
- return Ox.getObjectById(self.options.items, id);
- })
- self.options.selected = data.id;
- extendedData = Ox.extend(data, {
- 'in': Ox.min(items.map(item => { return item["in"]; })),
- out: Ox.max(items.map(item => { return item["out"]; })),
- layer: self.options.id
- });
- } else {
- var item = Ox.getObjectById(self.options.items, data.id)
- self.options.selected = item ? data.id : '';
- if (self.widget) {
- if (self.options.type == 'event') {
- self.$calendar.options({
- selected: item && isDefined(item) ? item.event.id : ''
- })
- .panToEvent();
- } else {
- self.$map.options({
- selected: item && isDefined(item) ? item.place.id : ''
- })
- .panToPlace();
- }
+ var item = Ox.getObjectById(self.options.items, data.id);
+ self.options.selected = item ? data.id : '';
+ if (self.widget) {
+ if (self.options.type == 'event') {
+ self.$calendar.options({
+ selected: item && isDefined(item) ? item.event.id : ''
+ })
+ .panToEvent();
+ } else {
+ self.$map.options({
+ selected: item && isDefined(item) ? item.place.id : ''
+ })
+ .panToPlace();
}
- extendedData = Ox.extend(data, item ? {
- 'in': item['in'],
- out: item.out,
- layer: self.options.id
- } : {});
}
- that.triggerEvent('select', extendedData)
+ that.triggerEvent('select', Ox.extend(data, item ? {
+ 'in': item['in'],
+ out: item.out,
+ layer: self.options.id
+ } : {}));
}
}
diff --git a/source/UI/js/Video/AnnotationPanel.js b/source/UI/js/Video/AnnotationPanel.js
index 658dc9f4..e93ea671 100644
--- a/source/UI/js/Video/AnnotationPanel.js
+++ b/source/UI/js/Video/AnnotationPanel.js
@@ -48,11 +48,9 @@ Ox.AnnotationPanel = function(options, self) {
.defaults({
calendarSize: 256,
clickLink: null,
- confirmDeleteDialog: null,
editable: false,
enableExport: false,
enableImport: false,
- enableTranscribe: false,
highlight: '',
highlightAnnotations: 'none',
highlightLayer: '*',
@@ -305,11 +303,7 @@ Ox.AnnotationPanel = function(options, self) {
{},
{id: 'import', title: Ox._('Import Annotations...'), disabled: !self.options.enableImport},
{id: 'export', title: Ox._('Export Annotations...'), disabled: !self.options.enableExport},
- ].concat(
- self.options.enableTranscribe ? [
- {id: 'transcribeaudio', title: Ox._('Transcribe Audio...')},
- ]: []
- )
+ ]
),
maxWidth: 256,
style: 'square',
@@ -331,9 +325,9 @@ Ox.AnnotationPanel = function(options, self) {
} else if (data.id == 'export') {
that.triggerEvent('exportannotations');
} else if (data.id == 'find') {
- that.triggerEvent('find', {value: Ox.decodeHTMLEntities(value)});
+ that.triggerEvent('find', {value: value});
} else if (data.id == 'findannotations') {
- that.triggerEvent('findannotations', {key: key, value: Ox.decodeHTMLEntities(value)});
+ that.triggerEvent('findannotations', {key: key, value: value});
} else if (data.id == 'import') {
that.triggerEvent('importannotations');
} else if (data.id == 'insert') {
@@ -357,8 +351,6 @@ Ox.AnnotationPanel = function(options, self) {
// ...
} else if (data.id == 'showentityinfo') {
that.triggerEvent('showentityinfo', annotation.entity);
- } else if (data.id == 'transcribeaudio') {
- that.triggerEvent('transcribeaudio');
} else if (data.id == 'undo') {
// ...
}
@@ -379,7 +371,6 @@ Ox.AnnotationPanel = function(options, self) {
self.$folder[index] = Ox.AnnotationFolder(
Ox.extend({
clickLink: self.options.clickLink,
- confirmDeleteDialog: self.options.confirmDeleteDialog,
collapsed: !self.options.showLayers[layer.id],
editable: self.options.editable,
highlight: getHighlight(layer.id),
diff --git a/source/UI/js/Video/VideoAnnotationPanel.js b/source/UI/js/Video/VideoAnnotationPanel.js
index 3d52533a..5ce19326 100644
--- a/source/UI/js/Video/VideoAnnotationPanel.js
+++ b/source/UI/js/Video/VideoAnnotationPanel.js
@@ -61,13 +61,11 @@ Ox.VideoAnnotationPanel = function(options, self) {
censoredIcon: '',
censoredTooltip: '',
clickLink: null,
- confirmDeleteDialog: null,
cuts: [],
duration: 0,
enableDownload: false,
enableImport: false,
enableExport: false,
- enableTranscribe: false,
enableSetPosterFrame: false,
enableSubtitles: false,
find: '',
@@ -846,11 +844,9 @@ Ox.VideoAnnotationPanel = function(options, self) {
autocomplete: self.options.autocomplete,
calendarSize: self.options.annotationsCalendarSize,
clickLink: self.options.clickLink,
- confirmDeleteDialog: self.options.confirmDeleteDialog,
editable: true,
enableExport: self.options.enableExport,
enableImport: self.options.enableImport,
- enableTranscribe: self.options.enableTranscribe,
highlight: self.options.find,
highlightAnnotations: self.options.annotationsHighlight,
highlightLayer: self.options.findLayer,
@@ -953,9 +949,6 @@ Ox.VideoAnnotationPanel = function(options, self) {
that.triggerEvent('showentityinfo', data);
},
submit: submitAnnotation,
- transcribeaudio: function() {
- that.triggerEvent('transcribeaudio');
- },
toggle: toggleAnnotations,
togglecalendar: function(data) {
self.options.showAnnotationsCalendar = !data.collapsed;
diff --git a/source/UI/json/locale.tr.json b/source/UI/json/locale.tr.json
deleted file mode 100644
index 7f671f86..00000000
--- a/source/UI/json/locale.tr.json
+++ /dev/null
@@ -1,281 +0,0 @@
-{
- ", doubleclick to edit": ", düzenlemek için çift tıkla",
- "Add": "Ekle",
- "Add Files": "Dosya Ekle",
- "Add Place": "Yer Ekle",
- "Add a condition": "koşul ekle",
- "Add a group of conditions": "Bir grup koşul ekle",
- "Add column after": "Sonrasına sütun ekle",
- "Add column before": "Önce sütun ekle",
- "Add row above": "Üste satır ekle",
- "Add row below": "Altına satır ekle",
- "Add {0}": "{0} ekle",
- "Adding...": "Ekleniyor..",
- "All": "Tüm",
- "Alternative Names": "Alternatif İsimler",
- "Area": "Alan",
- "At Current Position": "Mevcut Konumda",
- "Blockquote": "Blok halinde alıntıla",
- "Bold": "Kalın",
- "Borough": "Mahalle",
- "Building": "Bina",
- "Bullets": "Madde İşaretleri",
- "By Duration": "Süreye göre",
- "By Position": "Pozisyona Göre",
- "By Text": "Metne gore",
- "Cancel": "İptal et",
- "Cancel/Deselect": "İptal et/Seçimi kaldır",
- "Cancelled": "İptal edildi",
- "City": "Şehir",
- "Clear": "Temizle",
- "Clear Event": "Etkinliği temizle",
- "Clear Place": "Yeri Temizle",
- "Clearing...": "Temizleniyor",
- "Click to hide": "gizlemek için tıklayın",
- "Click to pan, doubleclick to zoom": "Kaydırmak için tıklayın, yakınlaştırmak için çift tıklayın",
- "Click to select": "Seçmek için tıklayın",
- "Click to select, doubleclick to edit": "Seçmek için tıklayın, düzenlemek için çift tıklayın",
- "Click to show": "Göstermek için tıklayın",
- "Close": "Kapat",
- "Complete": "Tamamlandı",
- "Country": "Ülke",
- "Date": "Tarih",
- "Date Created": "Oluşturulma Tarihi",
- "Date Modified": "Değiştirilme Tarihi",
- "Define": "Tanımla",
- "Define Event": "Etkinlik Tanımla",
- "Define Place": "Yer Tanımla",
- "Delete Annotation": "Ek Açıklamayı Sil",
- "Deselect": "Seçimi Kaldır",
- "Deselect Annotation": "Ek Açıklamanın Seçimini Kaldır",
- "Don't Shuffle": "Karıştırma",
- "Done": "Bitti",
- "Download": "İndir",
- "Download Selection...": "Seçimi İndir...",
- "Download Video...": "Video İndir",
- "Drag to resize": "Yeniden boyutlandırmak için sürükleyin",
- "Drag to resize or click to hide": "Yeniden boyutlandırmak için sürükleyin veya gizlemek için tıklayın",
- "Drag to resize or click to toggle map": "eniden boyutlandırmak için sürükleyin veya haritayı değiştirmek için tıklayın",
- "Duration": "Süre",
- "East": "Doğu",
- "Edit": "Kurgula",
- "Edit Annotation": "Ek Açıklamayı Kurgula",
- "Edit/Submit": "Kurgula/Gönder",
- "Editing Options": "Kurgulama Seçenekleri",
- "Embed Selection...": "Seçimi Yerleştir",
- "End": "Son",
- "Enter Fullscreen": "Tam Ekran Gir",
- "Event": "Etkinlik",
- "Events": "Etkinlikler",
- "Examples...": "Örnekler...",
- "Exit Fullscreen": "Tam Ekrandan Çık",
- "Feature": "Özellik",
- "Find": "Bul",
- "Find in All {0}": "Tüm {0} İçinde Bul",
- "Find in List": "Listede Bul",
- "Find in This {0}": "Bu {0}'da Bul",
- "Find on Map": "Haritada Bul",
- "Find...": "Bul...",
- "Find: All": "Bul: Tümü",
- "Find: Alternative Names": "Bul: Alternatif İsimler",
- "Find: Geoname": "Bul: Geoisim",
- "Find: Name": "Bul: İsim",
- "Flag": "Bayrak",
- "Font Size": "Yazı Tipi Boyutu",
- "Generating Documentation...": "Dokümantasyon Oluşturuyor...",
- "Geoname": "Geo isim",
- "Go One Frame Back": "Bir Kare Geri Git",
- "Go One Frame Forward": "Bir Kare İleri Git",
- "Go One Line Down": "Bir Satır Aşağı Git",
- "Go One Line Up": "Bir Satır Yukarı Git",
- "Go One Second Back": "Bir Saniye Geri Git",
- "Go One Second Forward": "Bir Saniye İleriye Git",
- "Go to First Frame": "İlk Kareye Git",
- "Go to In Point": "Giriş Noktasına Git",
- "Go to Last Frame": "Son Kareye Git",
- "Go to Next Annotation": "Sonraki Açıklamaya Git",
- "Go to Next Cut": "Sonraki Kesime Git",
- "Go to Next Result": "Sonraki Sonuca Git",
- "Go to Out Point": "Çıkış Noktasına Git",
- "Go to Poster Frame": "Poster Çerçevesine Git",
- "Go to Previous Annotation": "Önceki Ek Açıklamaya Git",
- "Go to Previous Cut": "Önceki Kesmeye Git",
- "Go to Previous Result": "Önceki Sonuca Git",
- "Headline": "Başlık",
- "Hide": "Sakla",
- "Hide Controls": "Kontrolleri Gizle",
- "Hide Labels": "Etiketleri Gizle",
- "Home": "Ana Sayfa",
- "Home Channel": "Ana Kanal",
- "Image": "İmge",
- "Import Annotations...": "Ek Açıklamaları İçe Aktar...",
- "In Current Selection": "Mevcut Seçimde",
- "Insert": "Ekle",
- "Insert HTML": "HTML Ekle",
- "Insert...": "Ekle...",
- "Italic": "İtalik",
- "Join Clip(s) at Cuts": "Klip(ler)i Kesimlerde Birleştir",
- "Keyboard Shortcuts": "Klavye Kısayolları",
- "Keyboard Shortcuts...": "Klavye Kısayolları...",
- "Large": "Büyük",
- "Large Player": "Büyük Oynatıcı",
- "Larger": "Daha Büyük",
- "Latitude": "Enlem",
- "Limit to": "Sınırla",
- "Linebreak": "Satır Sonu",
- "Link": "Link",
- "List": "Liste",
- "Longitude": "Boylam",
- "Make Clip(s) Static": "Klip(ler)i Statik Yap",
- "Map Options": "Harita Seçenekleri",
- "Match": "Eşleme",
- "Matches": "Eşlemeler",
- "Medium": "Orta",
- "Monospace": "Monospace",
- "Mute": "Sessiz",
- "Mute/Unmute": "Sesi Kapat/Sesi Aç",
- "Name": "İsim",
- "New Event": "Yeni Etkinlik",
- "New Place": "Yeni Yer",
- "Next": "Sıradaki",
- "Next Channel": "Yeni Kanal",
- "Next Result": "Bir Sonraki Sonuç",
- "No file selected": "Seçili dosya yok",
- "No files selected": "Seçili dosya yok",
- "North": "Kuzey",
- "Numbers": "Sayılar",
- "Open in New Tab": "Yeni Sekmede Aç",
- "Options": "Seçenekler",
- "Other": "Diğer",
- "Paragraph": "Paragraf",
- "Pause": "Durdur",
- "Paused": "Durduruldu",
- "Person": "Kişi",
- "Place": "Yer",
- "Place or Event": "Yer ya da Etkinlik",
- "Play": "Oynat",
- "Play Current Track": "Seçili Parçayı Çal",
- "Play In to Out": "Giriş-Çıkış Arasında Oynat",
- "Play Next Track": "Bir Sonraki Parçayı Çal",
- "Play/Pause": "Başlat/Durdur",
- "Previous": "Önceki",
- "Previous Channel": "Önceki Kanal",
- "Previous Result": "Önceki Sonuç",
- "Region": "Bölge",
- "Reload": "Yeniden Yükle",
- "Remove": "Kaldır",
- "Remove Event": "Etkinliği Kaldır",
- "Remove File": "Dosyayı Kaldır",
- "Remove Place": "Yeri Kaldır",
- "Remove this column": "Bu sütunu kaldır",
- "Remove this condition": "Bu koşulu kaldır",
- "Remove this group of conditions": "Bu koşul grubunu kaldır ",
- "Remove this row": "Bu satırı kaldır",
- "Removing...": "Kaldırıyor...",
- "Repeat All": "Hepsini Tekrarla",
- "Repeat None": "Hiçbirini Tekrarlama",
- "Repeat One": "Birini Tekrarla",
- "Reset this condition": "Bu koşulu sıfırla",
- "Resolution": "Çözünürlük",
- "Restart": "Yeniden Başlat",
- "Restore Defaults": "Varsayılanları Geri Yükle",
- "Results": "Sonuçlar",
- "Resume": "Devam Et",
- "Right-to-Left": "Sağdan Sola",
- "Run Tests": "Testleri Çalıştır",
- "Save Changes": "Değişiklikleri Kaydet",
- "Save as Smart List": "Akıllı Liste olarak Kaydet",
- "Scale to Fill": "Doldurmak için Ölç",
- "Scale to Fit": "Sığacak Şekilde Ölç",
- "Scroll to Player": "Oyuncuya Kaydır",
- "Select Current Annotation": "Geçerli Ek Açılamayı Seç",
- "Select Current Cut": "Geçerli Kesimi Seç",
- "Select File": "Dosya Seç",
- "Select Next Annotation": "Sonraki Açıklamayı Seç",
- "Select Previous Annotation": "Önceki Açıklamayı Seç",
- "Set ": "Berlie",
- "Set In Point": "Giriş Noktası Belirle",
- "Set Out Point": "Çıkış Noktası Belirle",
- "Set Poster Frame": "Poster Karesi Belirle",
- "Settings": "Ayarlar",
- "Show Annotations": "Ek Açıklamayı Göster",
- "Show Controls": "Kontrol Çubuğunu Göster",
- "Show Dates": "Tarihleri Göster",
- "Show Labels": "Etiketleri Göster",
- "Show Other": "Diğerini Göster",
- "Show People": "İnsanları Göster",
- "Show Places": "Yerleri Göster",
- "Show Remaining Time": "Kalan Zamanı Göster",
- "Show Subtitles": "Altyazıları Göster",
- "Show Users": "Kullanıcıları Göster",
- "Shuffle": "Karıştır",
- "Small": "Küçük",
- "Small Player": "Küçük Oynatıcı",
- "Smaller": "Daha Küçük",
- "Sort Annotations": "Ek Açıklamayı Düzenle",
- "South": "Güney",
- "Split Clip(s) at Cuts": "Klip(ler)i Kesimlerde Böl",
- "Start": "Başlat",
- "Street": "Sokak",
- "Strike": "Üstünü Çiz",
- "Subscript": "Alt Simge",
- "Subtitles": "Altyazılar",
- "Superscript": "Üst Simge",
- "Switch Theme": "Temayı Değiştir",
- "Timeline": "Zaman Çizelgesi",
- "Title": "Başlık",
- "Turn Volume Down": "Sesi Kıs",
- "Turn Volume Up": "Sesi Aç",
- "Type": "Tür",
- "Underline": "Altını Çiz",
- "Undo Changes": "Değişiklikleri Geri Al",
- "Unmute": "Sesi Aç",
- "Untitled": "İsimsiz",
- "User": "Kullanıcı",
- "Valid": "Geçerli",
- "View": "Görüntüle",
- "View Live": "Canlı Görüntüle",
- "View Source": "Kaynağı Görüntüle",
- "View as Grid": "Izgara Olarak Görüntüle",
- "View as List": "Liste Olarak Görüntüle",
- "Volume": "Ses Seviyesi",
- "West": "Batı",
- "add": "ekle",
- "all": "hepsi",
- "and": "ve",
- "annotations": "ek açıklamalar",
- "any": "herhangi",
- "ascending": "artan",
- "bracket": "parantez",
- "contains": "içerir",
- "descending": "azalan",
- "does not contain": "içermez",
- "does not end with": "ile bitmiyor",
- "does not start with": "ile başlamaz",
- "ends with": "ile biter",
- "file": "dosya",
- "files": "dosyalar",
- "in": "içinde",
- "is": "",
- "is after": "sonra",
- "is before": "önce",
- "is between": "arasında",
- "is greater than": "'den büyüktür",
- "is less than": "daha azdır",
- "is not": "değil",
- "is not after": "sonra değil",
- "is not before": "önce değil",
- "is not between": "arasında değil",
- "is not greater than": "daha büyük değil",
- "is not less than": "daha az değil",
- "items": "öğeler",
- "of the following conditions": "aşağıdaki koşullardan",
- "order": "sırala",
- "sorted by": "göre sırala",
- "starts with": "ile başla",
- "unknown": "bilinmiyor",
- "{0} Century": "Yüzyıl",
- "{0} Century BC": "Yüzyıl MÖ",
- "{0} Millennium": "{0} Milenyum",
- "{0} Millennium BC": "MÖ {0} Milenyum"
-}
diff --git a/tools/build/build.py b/tools/build/build.py
index ec3cc568..8accbd3d 100755
--- a/tools/build/build.py
+++ b/tools/build/build.py
@@ -80,13 +80,13 @@ def build_oxjs(downloads=False, geo=False):
path = source_path + 'UI/svg/'
for filename in [filename for filename in os.listdir(path) if not filename[0] in '._']:
svg = read_text(path + filename)
- svg = re.sub(r'\n\s*', '', svg)
- svg = re.sub(r'', '', svg)
+ svg = re.sub('\n\s*', '', svg)
+ svg = re.sub('', '', svg)
# end fix
ui_images[filename[:-4]] = svg
if filename.startswith('symbolLoading'):
for theme in themes:
- theme_svg = re.sub(r'#808080', format_hex(theme_data[theme]['symbolDefaultColor']), svg)
+ theme_svg = re.sub('#808080', format_hex(theme_data[theme]['symbolDefaultColor']), svg)
write_file('%sUI/themes/%s/svg/%s' % (dev_path, theme, filename), theme_svg)
write_file('%sUI/themes/%s/svg/%s' % (min_path, theme, filename), theme_svg)
@@ -101,10 +101,10 @@ def build_oxjs(downloads=False, geo=False):
and (geo or '/Geo/' not in path):
# write copies in min path
source = os.path.join(path, filename)
- is_jquery = re.search(r'^jquery-[\d\.]+\.js$', filename)
- is_jquery_min = re.search(r'^jquery-[\d\.]+\.min\.js$', filename)
- is_jquery_plugin = re.search(r'^jquery\..*?\.js$', filename)
- is_jsonc = re.search(r'\.jsonc$', filename)
+ is_jquery = re.search('^jquery-[\d\.]+\.js$', filename)
+ is_jquery_min = re.search('^jquery-[\d\.]+\.min\.js$', filename)
+ is_jquery_plugin = re.search('^jquery\..*?\.js$', filename)
+ is_jsonc = re.search('\.jsonc$', filename)
if is_jquery or is_jquery_min:
target = os.path.join(path.replace(source_path, min_path), 'jquery.js')
else:
@@ -113,7 +113,7 @@ def build_oxjs(downloads=False, geo=False):
ui_files['dev'].append(target.replace(min_path, ''))
ui_files['min'].append(target.replace(min_path, ''))
if '/Ox/js/' not in source and '/UI/js/' not in source and not is_jquery:
- if re.match(r'^Ox\..+\.js$', filename) or is_jsonc:
+ if re.match('^Ox\..+\.js$', filename) or is_jsonc:
js = read_text(source)
print('minifiy and write', filename, target)
write_file(target, ox.js.minify(js, '' if is_jsonc else comment))
@@ -129,7 +129,7 @@ def build_oxjs(downloads=False, geo=False):
if not is_jquery_min:
write_link(link_source, link_target)
# locales
- match = re.search(r'/(\w+)/json/locale.(\w+).json', source)
+ match = re.search('/(\w+)/json/locale.(\w+).json', source)
if match:
module = match.group(1)
locale = match.group(2)
@@ -182,12 +182,12 @@ def build_oxjs(downloads=False, geo=False):
if not js_dir + filename in sum(ox_files, []):
ox_files[-1].append(js_dir + filename)
js = re.sub(
- r'Ox.LOCALES = \{\}',
+ 'Ox.LOCALES = \{\}',
'Ox.LOCALES = ' + json.dumps(locales, indent=4, sort_keys=True),
js
)
js = re.sub(
- r"Ox.VERSION = '([\d\.]+)'",
+ "Ox.VERSION = '([\d\.]+)'",
"Ox.VERSION = '%s'" % version,
js
)
@@ -238,7 +238,7 @@ def build_oxjs(downloads=False, geo=False):
data = {
# sum(list, []) is flatten
'documentation': sorted(sum(ox_files, [])) + sorted(list(filter(
- lambda x: re.search(r'\.js$', x),
+ lambda x: re.search('\.js$', x),
ui_files['dev']
)) + ['%s/%s.js' % (x, x) for x in ['Geo', 'Image', 'Unicode']]),
'examples': sorted(sum(map(
@@ -250,7 +250,7 @@ def build_oxjs(downloads=False, geo=False):
)
)),
list(filter(
- lambda x: not re.search(r'^[._]', x),
+ lambda x: not re.search('^[._]', x),
os.listdir(root_path + 'examples/')
))
), [])) if os.path.exists(root_path + 'examples/') else (),
@@ -264,7 +264,7 @@ def build_oxjs(downloads=False, geo=False):
'title': get_title(root_path + 'readme/' + x)
},
filter(
- lambda x: not re.search(r'^[._]', x) and re.search(r'\.html$', x),
+ lambda x: not re.search('^[._]', x) and re.search('\.html$', x),
os.listdir(root_path + 'readme/')
)
))
@@ -355,7 +355,7 @@ def parse_css(css, values):
) for vals in value]
)
return string
- return re.sub(r'\$(\w+)(\[\d+\])?', sub, css)
+ return re.sub('\$(\w+)(\[\d+\])?', sub, css)
def read_file(file):
print('reading', file)