]> gitweb @ CieloNegro.org - Rakka.git/commitdiff
preparation for page search
authorpho <pho@cielonegro.org>
Sat, 2 Feb 2008 08:14:09 +0000 (17:14 +0900)
committerpho <pho@cielonegro.org>
Sat, 2 Feb 2008 08:14:09 +0000 (17:14 +0900)
darcs-hash:20080202081409-62b54-f18ce73aa8990a31159e47d57f10f1bdd6c9cd67.gz

Rakka.cabal
Rakka/Wiki/Interpreter/Base.hs
defaultPages/SideBar/Right.xml
defaultPages/StyleSheet/Default.xml
js/Makefile
js/search.js [new file with mode: 0644]

index d16fd387931012395564476b822bbe082181c282..32a2c2ae3742d7edf72268a2d1c3fcb3aea73b2a 100644 (file)
@@ -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.
index f461027dc339e1049f9543fe36b401f7cf8a275e..b17af3253c1b7031046210d5cd465a67b8467b4b 100644 (file)
@@ -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)
+      }
+
+
+-- <input type="text"
+--        class="searchField" />
+searchFieldInterp :: Interpreter
+searchFieldInterp 
+    = InlineCommandInterpreter {
+        iciName = "searchField"
+      , iciInterpret
+          = \ _ _ ->
+            let attrs = [ ("type" , "text")
+                        , ("class", "searchField")
                         ]
             in
               return (Input attrs)
index 79612f2b41c37ddbc82bf833e87fdfd87f1a5ac1..e2a00a2ae02d11967572758501492ec97e18090b 100644 (file)
@@ -6,6 +6,7 @@
 * <login />
 * <newPage />
 * <editPage />
+* <searchField />
 
 = In other languages =
 <inOtherLanguages />
index 9f4b8e75dfbf32bb3fce47a581c4f452a1f38bf4..7a5a6abd61d96de86b08e938392ce0f144faad4f 100644 (file)
@@ -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 {
index f8f2f2833fb0508aa0750471585764f8837b0bb4..7063803ce53a914f8680f3a7150b585a899e6eb7 100644 (file)
@@ -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 (file)
index 0000000..c1a90f8
--- /dev/null
@@ -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