mirror of
https://git.friendi.ca/friendica/friendica-addons.git
synced 2025-07-09 18:08:49 +00:00
start porting openstreetmap plugin
This commit is contained in:
parent
7753e6c155
commit
cdbde9d1e6
2 changed files with 137 additions and 50 deletions
|
@ -2,8 +2,8 @@ var toolserver = 'http://toolserver.org/~kolossos/openlayers/kml-on-ol.php';
|
|||
var startTag = '<iframe class="osmFrame" style="width: 100%; height: 350px; clear: both;" src="'+ toolserver + '?lang=de&uselang=de&params=';
|
||||
var endTag = '"></iframe>';
|
||||
|
||||
// @TODO document.ready() does not work for ajax loaded content
|
||||
jQuery(document).ready(function($) {
|
||||
|
||||
$('.wall-item-content-wrapper').each(function(index) {
|
||||
var link = $(this).find('.wall-item-location .OSMMapLink');
|
||||
link.toggle(addIframe, removeIframe);
|
||||
|
@ -12,14 +12,12 @@ jQuery(document).ready(function($) {
|
|||
|
||||
function addIframe(ev) {
|
||||
var coordinate = $(ev.target).attr('title');
|
||||
|
||||
var newTag = startTag + convertCoordinateString(coordinate) + endTag;
|
||||
$(ev.target).parents('.wall-item-content-wrapper').append(newTag);
|
||||
}
|
||||
|
||||
function removeIframe(ev) {
|
||||
$(ev.target).parents('.wall-item-content-wrapper').find('iframe').remove();
|
||||
|
||||
}
|
||||
|
||||
function convertCoordinateString(coordinate) {
|
||||
|
@ -38,4 +36,5 @@ function convertCoordinateString(coordinate) {
|
|||
westEast = '_E';
|
||||
}
|
||||
return Math.abs(locstring[0]) + northSouth + Math.abs(locstring[1]) + westEast;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue