From: pho Date: Sat, 2 Feb 2008 08:14:09 +0000 (+0900) Subject: preparation for page search X-Git-Url: http://git.cielonegro.org/gitweb.cgi?p=Rakka.git;a=commitdiff_plain;h=f7ff1639d50b827a8ce1e4dd3631ce300ecb3d19 preparation for page search darcs-hash:20080202081409-62b54-f18ce73aa8990a31159e47d57f10f1bdd6c9cd67.gz --- diff --git a/Rakka.cabal b/Rakka.cabal index d16fd38..32a2c2a 100644 --- a/Rakka.cabal +++ b/Rakka.cabal @@ -37,6 +37,7 @@ Extra-Source-Files: js/localFile.js js/login.js js/screen.js + js/search.js Flag build-test-suite Description: Build the test suite. diff --git a/Rakka/Wiki/Interpreter/Base.hs b/Rakka/Wiki/Interpreter/Base.hs index f461027..b17af32 100644 --- a/Rakka/Wiki/Interpreter/Base.hs +++ b/Rakka/Wiki/Interpreter/Base.hs @@ -25,6 +25,7 @@ interpreters = [ lineBreakInterp , newPageInterp , editPageInterp , loginInterp + , searchFieldInterp ] @@ -153,9 +154,25 @@ loginInterp iciName = "login" , iciInterpret = \ _ _ -> - let attrs = [ ("type" , "button") - , ("value" , "Login") - , ("class" , "loginButton") + let attrs = [ ("type" , "button") + , ("value", "Login") + , ("class", "loginButton") + ] + in + return (Input attrs) + } + + +-- +searchFieldInterp :: Interpreter +searchFieldInterp + = InlineCommandInterpreter { + iciName = "searchField" + , iciInterpret + = \ _ _ -> + let attrs = [ ("type" , "text") + , ("class", "searchField") ] in return (Input attrs) diff --git a/defaultPages/SideBar/Right.xml b/defaultPages/SideBar/Right.xml index 79612f2..e2a00a2 100644 --- a/defaultPages/SideBar/Right.xml +++ b/defaultPages/SideBar/Right.xml @@ -6,6 +6,7 @@ * * * +* = In other languages = diff --git a/defaultPages/StyleSheet/Default.xml b/defaultPages/StyleSheet/Default.xml index 9f4b8e7..7a5a6ab 100644 --- a/defaultPages/StyleSheet/Default.xml +++ b/defaultPages/StyleSheet/Default.xml @@ -158,6 +158,12 @@ td, th { padding: 0.2em 0 0 0; } +.sideBar input[type="text"], +.sideBar input[type="password"] { + width: 97%; + padding: 1px; +} + table.pageEditor { width: 100%; } @@ -362,6 +368,23 @@ input[type="button"][disabled]:active { background-color: #e0e0e0; } +.sideBar input[type="text"], +.sideBar input[type="password"] { + background-color: #dddddd; + + border-style: inset; + border-width: 1px; + border-color: #dddddd; +} + +.activeField { + color: black; +} + +.inactiveField { + color: #888888; +} + .pageEditor input[type="text"], .pageEditor input[type="file"], .pageEditor textarea { diff --git a/js/Makefile b/js/Makefile index f8f2f28..7063803 100644 --- a/js/Makefile +++ b/js/Makefile @@ -11,6 +11,7 @@ SOURCES = \ login.js \ redirection.js \ screen.js \ + search.js \ $(NULL) COMPRESS = java -jar $(COMPRESSOR) --type js --charset UTF-8 diff --git a/js/search.js b/js/search.js new file mode 100644 index 0000000..c1a90f8 --- /dev/null +++ b/js/search.js @@ -0,0 +1,23 @@ +(function () { + + $(document).ready(function () { + $("input.searchField") + .val("Search") + .removeClass("activeField") + .addClass("inactiveField") + .focus(function () { + if ($(this).attr("class").indexOf("inactiveField")) { + $(this) + .val("") + .removeClass("inactiveField") + .addClass("activeField"); + } + }) + .keypress(function (e) { + if (e.which == 10 || e.which == 13) { + window.location = Rakka.baseURI + "search.html?q=" + encodeURI($(this).val()); + } + }); + }); + +})(); \ No newline at end of file