|
Cookbook /
BookmarkletSummary: Make bookmarklet links, make browser toolbar buttons
Version: 1.4
Prerequisites: none
Status: working
Maintainer:
GNUZooDiscussion: Bookmarklet-Talk
Categories: Links BookMarklet
Downloads: Bookmarklet.phpΔ
Questions answered by this recipe
DescriptionIt is really useful to place an EDIT button on your toolbar using a bookmarklet. Especially when you have wiki(s) that do not have edit links and look like non-wiki websites. I find that the EDIT button is the most convenient and useful bookmarklet. You can drag a bookmarklet link from your browser window to your bookmarks or to your bookmarks toolbar. I prefer the bookmarks toolbar because it makes it into a button for you. 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. For instance, drag the bookmarklet link "edit" to the browser bookmark toolbar to create an Edit button. To edit a PMWiki page you can now just click the button. 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. So whenever you are in a pmwiki that is more like a web page you are just 1 click away from actions.
A working example of bookmarklets can be found at this link: Bookmarklet Example New feature - Included are some new bookmarklet favicons for some PMWiki actions.Bookmarklets in FireFox are not required to have name text if they have a icon (favicon). If you are happy with just an icon you can remove the name text. To do this first you must add an icon to your bookmarklet. You can install them easily using the freeware utility AM-DeadLink. Then right-click the bookmarklet and select properties from the popup context menu. Then clear the text in the "name" field and click the "OK" button. How To UseThere are 2 solutions here. The first one is for ALL PMWiki actions. The second one is for ONE individual bookmarklet. They both work with a wiki farm. Installing for all actionsCopy Bookmarklet.phpΔ to your cookbook directory In your config.php enter: include_once("cookbook/Bookmarklet.php");
or in your farmconfig.php enter: include_once(" $FarmD/cookbook/Bookmarklet.php");
In you PMWiki page put code like this: [[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]] [[action:attr|Attributes]] Installing for a single bookmarklet link.
# This is config.php code using Markup alone:
# create custom bookmarklet link
Markup('pmwikiedit', 'directives', '/\\(:pmwikiedit:\\)/',
Keep("<a href='javascript:location.href+=\"?action=edit\"'>Edit</a>"));
NotesYou can create other kinds of bookmarklets by copying the code above and changing the word "action" to something else and by changing the javascript code. Working example of bookmarklets can be found at this link: SecurityCurrently when PMWiki sees "javascript:blahblahblah" in the page source code it just appends it to the end of the current page url. Patrick Michaud said it is not wise to allow wiki authors to use "javascript:blahblahblah" inside of a PMWiki page source because that would be a security risk. Specifically he said 'here's a page that demonstrates some XSS vulnerabilities using "javascript:" ... http://archives.neohapsis.com/archives/fulldisclosure/2005-10/0445.html '. This recipe is secure because it only allows authors to reference bookmarklets which are predefined in your config.php or farmconfig.php file. Release NotesThis program is free software. You can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation http://www.fsf.org either version 2 of the License, or (at your option) any later version. Copyright 2007 by Please donate to the author at url: http://gnuzoo.org/GNUZooPayPal
See Also
Contributors
CommentsSee discussion at Bookmarklet-Talk User notes? : If you use, used or reviewed this recipe, you can add your name. These statistics appear in the Cookbook listings and will help newcomers browsing through the wiki. |