|
Cookbook /
BookmarkletSummary: Make bookmarklet links, make browser toolbar buttons
Version: 1.2
Prerequisites: none
Status: working
Maintainer: GNUZoo
Categories: Links BookMarklet
Downloads: Bookmarklet.phpΔ
Questions answered by this recipe
DescriptionYou 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 GNUZoo (guru@gnuzoo.org) Please donate to the author at url: http://gnuzoo.org/GNUZooPayPal
CommentsGreat, thank you. Once you drag these link to your bookmark toolbar, you don't really need the recipe anymore. In fact, the easiest thing to do is to just visit a page on a site where this recipe is enabled, drag the links you want, and that's it. Until this recipe is enable on this page, you can visit the Bookmarklet page that Pm used to test this recipe. Pico August 16, 2006, at 11:42 PM: You're welcome! Sure you can just copy the bookmarklet link, but if you reinstall your system and need to get your bookmarklet back it is good to have your own local copy on your wiki page. It is also good so that people can download any other custom bookmarklet you create. GNUZoo
This is great! How hard would it be to associate custom icons with the bookmarklet buttons? shi: I think this would work if PMWiki lets you put a url onto a custom icon. It is basically a URL that contains up to 256 characters of javascript. GNUZoo
This is all very nifty, but you end up with pmwiki action buttons visible for all webpages. With Dynamic Page Actions you can display action links for logged in authorised editors, but hide them from site visitors who just browse. ~HansB Dynamic Page Actions looks super nifty! Having the the "edit" link displayed can interfere with the display of other aspects of a webpage. The purpose of this recipe is to have the wiki look like an ordinary web page that does not have a login, and only developers, administrators, and people who can login will know about it. I can also make a "login" button. GNUZoo
See Also
Contributors
|