]> git.mxchange.org Git - friendica-addons.git/commitdiff
Added files#
authorpokerazor <hanno-felix.wagner@stud.uni-due.de>
Tue, 8 Jan 2013 23:43:48 +0000 (00:43 +0100)
committerpokerazor <hanno-felix.wagner@stud.uni-due.de>
Tue, 8 Jan 2013 23:43:48 +0000 (00:43 +0100)
openstreetmap/openstreetmap.js [new file with mode: 0644]

diff --git a/openstreetmap/openstreetmap.js b/openstreetmap/openstreetmap.js
new file mode 100644 (file)
index 0000000..479e769
--- /dev/null
@@ -0,0 +1,41 @@
+var toolserver = 'http://toolserver.org/~kolossos/openlayers/kml-on-ol.php';\r
+var startTag = '<iframe class="osmFrame" style="width: 100%; height: 350px; clear: both;" src="'+ toolserver + '?lang=de&amp;uselang=de&amp;params=';\r
+var endTag = '"></iframe>';\r
+\r
+jQuery(document).ready(function($) {\r
+\r
+       $('.wall-item-content-wrapper').each(function(index) {\r
+               var link = $(this).find('.wall-item-location .OSMMapLink');\r
+               link.toggle(addIframe, removeIframe);\r
+       });\r
+});\r
+\r
+function addIframe(ev) {\r
+       var coordinate = $(ev.target).attr('title');\r
+\r
+       var newTag = startTag + convertCoordinateString(coordinate) + endTag;\r
+       $(ev.target).parents('.wall-item-content-wrapper').append(newTag);\r
+}\r
+\r
+function removeIframe(ev) {\r
+       $(ev.target).parents('.wall-item-content-wrapper').find('iframe').remove();\r
+\r
+}\r
+\r
+function convertCoordinateString(coordinate) {\r
+       var locstring = coordinate.split(' ');\r
+       var northSouth;\r
+       var westEast;\r
+\r
+       if (locstring[0] < 0) {\r
+               northSouth = '_S_';\r
+       }else{\r
+               northSouth = '_N_';\r
+       }\r
+       if (locstring[1] < 0) {\r
+               westEast = '_W';\r
+       }else{\r
+               westEast = '_E';\r
+       }\r
+       return Math.abs(locstring[0]) + northSouth + Math.abs(locstring[1]) + westEast;\r
+}
\ No newline at end of file