Re: "help" URLs
Re: "help" URLs
- Subject: Re: "help" URLs
- From: Greg Titus <email@hidden>
- Date: Fri, 3 Aug 2001 18:57:44 -0700
On Friday, August 3, 2001, at 09:18 , email@hidden wrote:
In the html docs on classes there are a bunch of "help" URL icons that
can be clicked. However, when I try this I get:
OmniWeb doesn't natively understand "help" URLs, and has no plug-in
currently loaded to deal with them.
So, is there a plug-in I can get? I tried to copy the html doc over to
another drive and tried to get it to run on Netscape, but no go there.
For that matter, what am I missing here; anything important?
I just whipped up a plugin, that you can get at:
ftp://ftp.omnigroup.com/pub/software/MacOSX/10.0/HelpURLs.tar.gz
Just stick it in ~/Library/PlugIns. (You may need to create that folder
first.) Then restart OmniWeb.
It's extremely stupid. It registers for "help:" URLs, and takes whatever
is in the second set of quotes in the URL and sticks it on the
pasteboard. So it'll only work for those little clipboard icons. But I
can't really find any other type of "help:" URL anyway - at least in the
Cocoa docs.
Here's all the code in case anyone is interested in how you extend
OmniWeb. It's a single class called OWHelpProcessor. Here's the header:
#import <OWF/OWProcessor.h>
@class OWAddress;
@interface OWHelpProcessor : OWProcessor
{
OWAddress *address;
}
@end
And here's the implementation:
#import "OWHelpProcessor.h"
#import <OWF/OWF.h>
#import <AppKit/AppKit.h>
@implementation OWHelpProcessor
- initWithPipeline:(OWPipeline *)aPipeline;
{
// grab the address and save it
[super initWithPipeline:aPipeline];
address = [[pipeline lastContent] retain];
return self;
}
- (void)dealloc;
{
[address release];
[super dealloc];
}
- (void)process;
{
NSString *urlContents;
NSArray *parts;
NSPasteboard *pasteboard;
// get the part of the address after help: and split into parts by
quotes
urlContents = [[address url] schemeSpecificPart];
parts = [urlContents componentsSeparatedByString:@"\""];
// if we don't have at least 4 parts, this is some other kind of URL
if ([parts count] < 4)
return;
// stick the fourth part on the pasteboard
pasteboard = [NSPasteboard generalPasteboard];
[pasteboard declareTypes:[NSArray
arrayWithObject:NSStringPboardType] owner:nil];
[pasteboard setString:[parts objectAtIndex:3]
forType:NSStringPboardType];
}
@end
That and some bundle settings that end up in the Info.plist to register
this class as the handler for "help:" URLs, and that's it.
--Greg