[pmwiki-users] bookmarklet on wiki page

JB jbit at ev1.net
Thu Aug 17 22:39:51 CDT 2006


Ben Wilson wrote:
> Look at these recipes. Both produce bookmarklet markup, and should
> help guide you to your answer. If this is overwhelming, let us know,
> and I'll see if I can provide a better answer. :-)
> 
> http://www.pmwiki.org/wiki/Cookbook/Marklets
> http://www.pmwiki.org/wiki/Cookbook/AddLinkBookmarklet
> http://www.pmwiki.org/wiki/Cookbook/Bookmarklet

Ben,

You need to pay attention.  I have already responded to this.
In case you did not notice, the first two recipes do nothing like
I asked.  And the third one is one that I created yesterday!

Below is a repeat of my response to this.

----------------------------------------------------------------

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