File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -101,18 +101,22 @@ class EventHandler(MacroElement):
101101 >>>
102102 >>> g = folium.GeoJson(geo_json_data).add_to(m)
103103 >>>
104- >>> highlight = JsCode("""
104+ >>> highlight = JsCode(
105+ ... """
105106 ... function highlight(e) {
106107 ... e.target.original_color = e.layer.options.color;
107108 ... e.target.setStyle({ color: "green" });
108109 ... }
109- ... """)
110+ ... """
111+ ... )
110112 >>>
111- >>> reset = JsCode("""
113+ >>> reset = JsCode(
114+ ... """
112115 ... function reset(e) {
113116 ... e.target.setStyle({ color: e.target.original_color });
114117 ... }
115- ... """)
118+ ... """
119+ ... )
116120 >>>
117121 >>> g.add_child(EventHandler("mouseover", highlight))
118122 >>> g.add_child(EventHandler("mouseout", reset))
Original file line number Diff line number Diff line change @@ -42,11 +42,15 @@ class Draw(JSCSSMixin, MacroElement):
4242 ... position="topleft",
4343 ... draw_options={"polyline": {"allowIntersection": False}},
4444 ... edit_options={"poly": {"allowIntersection": False}},
45- ... on={"click": JsCode("""
45+ ... on={
46+ ... "click": JsCode(
47+ ... """
4648 ... function(event) {
4749 ... alert(JSON.stringify(this.toGeoJSON()));
4850 ... }
49- ... """)},
51+ ... """
52+ ... )
53+ ... },
5054 ... ).add_to(m)
5155
5256 For more info please check
Original file line number Diff line number Diff line change @@ -53,7 +53,8 @@ class Timeline(GeoJson):
5353
5454 >>> timeline = Timeline(
5555 ... data,
56- ... get_interval=JsCode('''
56+ ... get_interval=JsCode(
57+ ... '''
5758 ... function (quake) {
5859 ... // earthquake data only has a time, so we\' ll use that as a "start"
5960 ... // and the "end" will be that + some value based on magnitude
@@ -64,7 +65,8 @@ class Timeline(GeoJson):
6465 ... end: quake.properties.time + quake.properties.mag * 1800000,
6566 ... };
6667 ... };
67- ... '''),
68+ ... '''
69+ ... ),
6870 ... ).add_to(m)
6971 >>> TimelineSlider(
7072 ... auto_play=False,
Original file line number Diff line number Diff line change @@ -279,14 +279,16 @@ class WebGLEarthRealtime(JSCSSMixin, MacroElement):
279279 >>> iss = WebGLEarthRealtime(
280280 ... source_url="https://api.wheretheiss.at/v1/satellites/25544",
281281 ... interval=3000,
282- ... on_update=JsCode('''
282+ ... on_update=JsCode(
283+ ... '''
283284 ... function(data, earth) {
284285 ... if (window._issMarker) window._issMarker.removeFrom(earth);
285286 ... window._issMarker = WE.marker(
286287 ... [data.latitude, data.longitude]
287288 ... ).addTo(earth);
288289 ... }
289- ... '''),
290+ ... '''
291+ ... ),
290292 ... )
291293 >>> iss.add_to(globe)
292294 """
You can’t perform that action at this time.
0 commit comments