fnp
/
wolnelektury.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
remove the banner
[wolnelektury.git]
/
src
/
wolnelektury
/
static
/
js
/
book_text
/
references.js
diff --git
a/src/wolnelektury/static/js/book_text/references.js
b/src/wolnelektury/static/js/book_text/references.js
index
0585d84
..
cdfc1f0
100644
(file)
--- a/
src/wolnelektury/static/js/book_text/references.js
+++ b/
src/wolnelektury/static/js/book_text/references.js
@@
-8,18
+8,18
@@
$("#settings-references").css('display', 'block');
}
$("#settings-references").css('display', 'block');
}
-
-
var map_enabled = false;
var map_enabled = false;
- var marker = L.
m
arker([0,0]);
+ var marker = L.
circleM
arker([0,0]);
var map = null;
function enable_map() {
var map = null;
function enable_map() {
+ $("#reference-map").show('slow');
+
if (map_enabled) return;
map = L.map('reference-map').setView([0, 0], 11);
if (map_enabled) return;
map = L.map('reference-map').setView([0, 0], 11);
- L.tileLayer('https://
{s}.tile.openstreetmap.org/{z}/{x}/{y}.png
', {
- attribution: 'Map
data © <a href="http://
openstreetmap.org/copyright">OpenStreetMap contributors</a>'
+ L.tileLayer('https://
tile.thunderforest.com/cycle/{z}/{x}/{y}.png?apikey=a8a97f0ae5134403ac38c1a075b03e15
', {
+ attribution: 'Map
s © <a href="http://www.thunderforest.com">Thunderforest</a>, Data © <a href="http://www.
openstreetmap.org/copyright">OpenStreetMap contributors</a>'
}).addTo(map);
map_enabled = true;
}).addTo(map);
map_enabled = true;
@@
-29,13
+29,18
@@
}
}
- $("#reference-close").on("click", function() {
+ $("#reference-close").on("click", function(event) {
+ event.preventDefault();
$("#reference-box").hide();
});
$('a.reference').each(function() {
$this = $(this);
uri = $this.attr('data-uri');
$("#reference-box").hide();
});
$('a.reference').each(function() {
$this = $(this);
uri = $this.attr('data-uri');
+ if (uri == '') {
+ $this.remove();
+ return;
+ }
if (interestingReferences.hasOwnProperty(uri)) {
$this.addClass('interesting');
ref = interestingReferences[uri];
if (interestingReferences.hasOwnProperty(uri)) {
$this.addClass('interesting');
ref = interestingReferences[uri];
@@
-58,11
+63,18
@@
if (ref.location) {
enable_map();
if (ref.location) {
enable_map();
- marker.setLatLng(ref.location);
- //marker.setContent(ref.label);
+ let newLoc = [
+ ref.location[0],
+ ref.location[1] + Math.round(
+ (map.getCenter().lng - ref.location[1]) / 360
+ ) * 360
+ ];
+
+ marker.setLatLng(newLoc);
marker.bindTooltip(ref.label).openTooltip();
map.addLayer(marker);
marker.bindTooltip(ref.label).openTooltip();
map.addLayer(marker);
- map.panTo(ref.location, {
+
+ map.panTo(newLoc, {
animate: true,
duration: 1,
});
animate: true,
duration: 1,
});
@@
-73,17
+85,23
@@
}
}
}
}
- $("#reference-images
img
").remove();
+ $("#reference-images
a
").remove();
if (ref.images) {
$.each(ref.images, function(i, e) {
$i = $("<a target='_blank'><img></a>");
$i.attr('href', e.page);
if (ref.images) {
$.each(ref.images, function(i, e) {
$i = $("<a target='_blank'><img></a>");
$i.attr('href', e.page);
- $('img', $i).attr('src', e.url);
+ $('img', $i).attr('src', e.thumburl || e.url);
+ if (e.thumbresolution) {
+ $('img', $i).attr('width', e.thumbresolution[0]).attr('height', e.thumbresolution[1]);
+ }
+
$("#reference-images").append($i);
})
}
$("#reference-link").text(ref.label);
$("#reference-link").attr('href', ref.wikipedia_link);
$("#reference-images").append($i);
})
}
$("#reference-link").text(ref.label);
$("#reference-link").attr('href', ref.wikipedia_link);
+
+ _paq.push(['trackEvent', 'html', 'reference']);
});
})})(jQuery);
});
})})(jQuery);