Hello
I made several attempts to adapt this geolocation snippet
https://www.w3schools.com/Html/tryit.asp?filename=tryhtml5_geolocation
to TW.
I starting to think TW is not the easiest place to learn java script. Is
there a documentation how to wrap in the code and define functions?
This is where I am right now, alas it throws red screen of embarassment.
_________________________________
|/*\
title: $:/core/modules/macros/geolocation.js
type: application/javascript
module-type: macro
Macro to return the current Geoposition in Coordinates
\*/
(function(){
/*jslint node: true, browser: true */
/*global $tw: false */
"use strict";
/*
Information about this macro
*/
exports.name = "geolocation";
exports.params = [];
/*
Run the macro
*/
exports.run = function() {
if (navigator.geolocation) {
navigator.geolocation.watchPosition(showPosition);
} else {
var geolocation = Geolocation is not supported by this browser;
}
var geolocation = position.coords.latitude + "," + position.coords.longitude;
return geolocation;
};
})();
__________________
|
Can anyone help?
Yours Jan
Am 03.07.2018 um 00:36 schrieb Jan:
Hello,
I would like to have a macro which uses this script
https://www.w3schools.com/Html/tryit.asp?filename=tryhtml5_geolocation
to capture the geolocation.
It should trigger a Modal with a button to write
position.coords.longitude ,position.coords.latitude
to a field called points in a new tiddler.
(This is what I would furnish if I got the geolocation as a
name/variable. somehow.I would also make a button also add it to a path.)
This would be a great feature to have in Sylvain Naudins Leaflet
Plugin (http://sycom.github.io/TiddlyWiki-Plugins/#Leaflet%20plugin)
Thanks for your help!
Yours
Jan
--
You received this message because you are subscribed to the Google Groups
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit
https://groups.google.com/d/msgid/tiddlywiki/5B4FD2ED.9060300%40googlemail.com.
For more options, visit https://groups.google.com/d/optout.