Ticket #607 (closed enhancement: wontfix)
add HREF to permaview command link for rapid bookmarking
| Reported by: | EricShulman | Owned by: | JeremyRuston |
|---|---|---|---|
| Priority: | minor | Milestone: | 2.6.1 |
| Component: | core | Version: | |
| Severity: | trivial | Keywords: | |
| Cc: |
Description (last modified by EricShulman) (diff)
Automatically set the HREF for the 'permaview' sidebar command link so you can use the 'right click' context menu for faster, easier bookmarking. Note that this does not automatically set the permaview in the browser's current location URL... it just sets the HREF on the command link. You still have to click the link to apply the permaview.
config.macros.permaview.handler = function(place)
{
var btn=createTiddlyButton(place,this.label,this.prompt,this.onClick);
addEvent(btn,"mouseover",this.setHREF);
addEvent(btn,"focus",this.setHREF);
};
config.macros.permaview.setHREF = function(event){
var links = [];
story.forEachTiddler(function(title,element) {
links.push(String.encodeTiddlyLink(title));
});
var newURL=document.location.href;
var hashPos=newURL.indexOf("#");
if (hashPos!=-1) newURL=newURL.substr(0,hashPos);
this.href=newURL+"#"+encodeURIComponent(links.join(" "));
}
Note: HREF is added both on 'mouseover' and 'focus' events to account for non-mouse interfaces that use keyboard navigation
This change has been sucessfully implemented as a TiddlyTools CoreTweak?.
Change History
Note: See
TracTickets for help on using
tickets.
