Hello, I made an attempt, that need some ironing and is still buggy. But it may help you to progress. You can find it on the leaflet branch of the leaflet map plugin repo : https://framagit.org/sycom/TiddlyWikiPlugins/blob/leaflet/leaflet/macros/geolocation-macro.js
cheers, Sylvain PS: Sylvain Naudin is not the author of this plugin. He's a very cool guy though... Le jeudi 19 juillet 2018 03:15:08 UTC+2, TonyM a écrit : > > Jan, > > When wanting to include JavaScript in TiddlyWiki I think you will find the > developer forum and various resources more useful. > > > - This has being discussed many times and there are architectural > reasons why this is not so strait forward. > - However many plugins come from js resources. > - You may also find the git issues relate to this > https://github.com/Jermolene/TiddlyWiki5/issues > > I have a keen interest in geolocation and would appreciate some features > in TiddlyWiki however I have another approach that may be simpler. > > Let me know if you want to start a conversation on this. > > Regards > Tony > > > Regards > Tony > > On Thursday, July 19, 2018 at 9:53:28 AM UTC+10, Jan wrote: >> >> 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/a601bb93-4d61-47a6-8d3e-813e6b64171a%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.

