[pmwiki-users] Integrating JavaScript function into Custom Markup

Miller, Joshua web at cityofelmira.net
Fri Apr 7 19:01:39 CDT 2006


> Friday, April 7, 2006, 3:41:38 PM, Joshua wrote:
> > I have a custom JavaScript Function that launches a map in a new 
> > window that looks like this in normal html: <a 
> > href='javascript:map("map=11&1");' title="Map of Third Floor">Show 
> > map of Third Floor</a>
> 
> > How do I write a custom markup so that I could do this in my wiki:
> 
> > (:map map=11&1 title=Map of Third Floor:) or
> > (:map map=5&1&3&5 title=Map to Central Office:)
> 
> Markup('map', 'directives', "/\\(:map (.*?)?\\s*?:\\)/e", 
> "Map('$1')"); function Map($args) {
>      $arg = PSS(ParseArgs($args));
>      if (isset($arg['map'])) $map = $arg['map'];
>      if (isset($arg['title'])) $maptitle = $arg['title'];
>      $out = "<a href='javascript:map(\"map=$map\");' ";
>      $out.= "title=\"$maptitle\">Show $maptitle</a>";
>      return Keep($out);
>      }
--------------------
Hans and Patrick,

Thanks for the advice.  I was able to get it working great.  I
appreciate raising the security concerns, at least in my case, I'm the
only editor of the site so I don't have to worry about it.

One more question I have with this:

If I don't want to set the parameters, can I call a different function,
like this:


-without parameters
(:map:)
<a href='javascript:OpenMap();' title="Map">Map</a>

-with parameters
(:map map=1&2&3 title='Click here for map':)
<a href='javascript:map("map=1&2&3");' title="Click here for map">Click
here for map</a>

Thanks,
-Josh





More information about the pmwiki-users mailing list