+/* Web Scripting {{{ */
++ (NSString *) webScriptNameForSelector:(SEL)selector {
+ if (selector == @selector(getPackageById:))
+ return @"getPackageById";
+ else if (selector == @selector(setButton:withStyle:toFunction:))
+ return @"setButton";
+ else if (selector == @selector(supports:))
+ return @"supports";
+ else
+ return nil;
+}
+
++ (BOOL) isSelectorExcludedFromWebScript:(SEL)selector {
+ return [self webScriptNameForSelector:selector] == nil;
+}
+
+- (BOOL) supports:(NSString *)feature {
+ return [feature isEqualToString:@"window.open"];
+}
+
+- (Package *) getPackageById:(NSString *)id {
+ return [[Database sharedInstance] packageWithName:id];
+}
+
+- (void) setButton:(NSString *)button withStyle:(NSString *)style toFunction:(id)function {
+ NSLog(@"b:%@", button);
+ NSLog(@"f:%@", [function class]);
+
+ if (button_ != nil)
+ [button_ autorelease];
+ button_ = button == nil ? nil : [button retain];
+
+ if (style_ != nil)
+ [style_ autorelease];
+ style_ = style == nil ? nil : [style retain];
+
+ if (function_ != nil)
+ [function_ autorelease];
+ function_ = function == nil ? nil : [function retain];
+}
+/* }}} */
+