[pmwiki-users] bookmarklet on wiki page solution!

JB jbit at ev1.net
Wed Aug 16 22:27:24 CDT 2006


I chatted with PM today on irc and he provided a great solution.

First, PM said it is not wise to allow "javascript:blahblahblah" 
inside of a PMWiki page source because that would be a security risk.  
Currently PMWiki just appends it to the end of the current page url.  
I thought maybe it might behave like an external URL and not be 
modified at all. I could not find any way to do this and that is 
why I chatted with PM.


The solution:
Put this in you local config.php

# allow action bookmarklet links
$LinkFunctions['action:'] = 'LinkIMap';
$IMap['action:'] = '$1';
$IMapLinkFmt['action:'] = "<a
href='javascript:location.href+=\"?action=\$LinkUrl\"'>\$LinkText</a>";




Then your pmwiki page source code can look like this:

(:linebreaks:)
[[action:browse|View]]
[[action:edit|Edit]]
[[action:diff|History]]
[[action:upload|Upload]]
[[action:crypt|Crypt]]
[[action:print|Print]]
[[action:search|Search]]
[[action:source|Source]]
[[action:login|Login]]
[[action:logout|Logout]]
[[action:rss|RSS]]
[[action:atom|Atom]]
[[action:rdf|RDF]]
[[action:dc|DC]]
[[action:refcount|RefCount]]
[[action:ruleset|Ruleset]]
[[action:phpinfo|PHPInfo]]
[[action:diag|Diag]]

And now you have bookmarklets!  You can drag the link
from your browser window to your bookmarks or to you
bookmarks toolbar.  I prefer the bookmarks toolbar
because it makes it into a button for you.

So whenever you are in a pmwiki you are just 1 click 
away from actions.  This is useful if you have a 
wiki that you want to look like a web page without the 
"View Edit History Print" in the upper right.  To 
edit you can click the browser bookmark toolbar button
(bookmarklet).  This will save you from having to click
in the URL box and typing ?action=edit to the end of the 
url and then pressing enter.  A big ergonomic improvement.

Thanks PM!   :)


John





More information about the pmwiki-users mailing list