]> gitweb @ CieloNegro.org - Rakka.git/blobdiff - js/search.js
preparation for page search
[Rakka.git] / js / search.js
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