[pmwiki-users] displaying coordinates of mouse click

Petko Yotov 5ko at 5ko.fr
Thu Jun 6 04:47:32 CDT 2013


Mark Lee writes:
> site is at Wikidot, and one of the things I did there is shown below: 
> http://picturecollection.wikidot.com/test3:23 
>
> If you click on the picture, the click location is captured behind the  
> scenes, then X and Y coordinates are displayed in a couple text boxes.
>
> Here is the code I used in Wikidot. Can this be done in PMWiki?

Yes, it can.

Create a form with the required form fields, see  
http://www.pmwiki.org/wiki/PmWiki/Forms .

Create a custom markup for the <canvas> element, see  
http://www.pmwiki.org/wiki/PmWiki/CustomMarkup or start with an existing  
recipe like one of the Flash, Video or Java applet recipes and change it to  
produce your canvas HTML.

To insert stuff in the HTML <head>...</head> section, add the stuff as an  
element to the $HTMLHeaderFmt, something like:


$HTMHHeaderFmt['my-recipe'] = <<<EOF
<script type="text/javascript">
// your javascript here
</script>
EOF;

-or-

$HTMHHeaderFmt['my-recipe'] = '<script type="text/javascript"  
src="$PubDirUrl/your-script.js"></script>';

where $PubDirUrl is normally the url address of your pub/ directory (and  
PmWiki guesses it in most cases.

Petko



More information about the pmwiki-users mailing list