Add Wikipedia search plugin
authorChip Black <bytex64@bytex64.net>
Mon, 15 Jun 2009 00:34:48 +0000 (19:34 -0500)
committerChip Black <bytex64@bytex64.net>
Mon, 15 Jun 2009 00:34:48 +0000 (19:34 -0500)
plugins/Makefile
plugins/WikipediaSearch.cs [new file with mode: 0644]

index 36d32b0..d09a8c4 100644 (file)
@@ -1,7 +1,7 @@
 CSFLAGS = -debug
 references = -r:../webkit-sharp.dll -pkg:gtk-sharp-2.0
 
-all: Vimish.dll FFNav.dll DefaultPage.dll LoadProgress.dll MiddleClickOpen.dll QuickSearch.dll Session.dll Fullscreen.dll GoogleSearch.dll
+all: Vimish.dll FFNav.dll DefaultPage.dll LoadProgress.dll MiddleClickOpen.dll QuickSearch.dll Session.dll Fullscreen.dll GoogleSearch.dll WikipediaSearch.dll
 
 clean:
        rm -f *.dll *.mdb *.so
diff --git a/plugins/WikipediaSearch.cs b/plugins/WikipediaSearch.cs
new file mode 100644 (file)
index 0000000..7224396
--- /dev/null
@@ -0,0 +1,10 @@
+using System;
+using bytex64.WebThing;
+using System.Text.RegularExpressions;
+
+public class WikipediaSearch : WebThingPlugin, ISearchPlugin {
+    public string SearchTransform(string search) {
+        string[] words = Regex.Split(search, @"\s+");
+        return String.Format("http://www.wikipedia.org/search-redirect.php?search={0}&language=en&go=Go", String.Join("%20", words));
+    }
+}