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/902446e9-b053-4965-bd4e-3c97866a58d1%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.

