Author: michiel
Date: 2010-04-06 18:18:44 +0200 (Tue, 06 Apr 2010)
New Revision: 41778

Modified:
   
mmbase/branches/MMBase-1_9/applications/searchrelate/src/main/webapp/mmbase/searchrelate/Searcher.js.jsp
Log:
used live events to make the implicitsAreHidden method ciomplete deprecated. It 
simply uses the CSS settings now.

Modified: 
mmbase/branches/MMBase-1_9/applications/searchrelate/src/main/webapp/mmbase/searchrelate/Searcher.js.jsp
===================================================================
--- 
mmbase/branches/MMBase-1_9/applications/searchrelate/src/main/webapp/mmbase/searchrelate/Searcher.js.jsp
    2010-04-06 15:40:59 UTC (rev 41777)
+++ 
mmbase/branches/MMBase-1_9/applications/searchrelate/src/main/webapp/mmbase/searchrelate/Searcher.js.jsp
    2010-04-06 16:18:44 UTC (rev 41778)
@@ -34,6 +34,48 @@
                     this.relater = new MMBaseRelater(this);
                 }
             });
+
+       /*
+        * If you defined in your CSS that 'implicit' search results are not 
visible at all, then
+        * this method arranges the texts on the search buttons accordingly
+        * (between 'search' and 'close').
+        */
+        $("div.mm_related").
+           live("mmsrPaged",
+                function (e, status, relater, searcher) {
+                     var anchor = $(searcher.div).find("a.search")[0];
+                     anchor.searcher = searcher;
+                     var div = searcher.getResultDiv();
+                    if(! div.implicitIsVisible) {
+                        if (searcher.offset == 0 && ! 
$(div).hasClass("implicit")) {
+                            $(anchor).text('<fmt:message key="close" />');
+                        } else {
+                            $(anchor).text('<fmt:message key="search" />');
+                        }
+                    }
+
+                });
+
+       $("input.search").
+           live("keyup",
+                function(e) {
+                    var target = e.target;
+                    var anchor = 
$(target).closest("div.searchable").find("a.search")[0];
+
+                     var searcher = anchor.searcher;
+                     if (searcher != null) {
+                        var div = searcher.getResultDiv();
+                        if(! div.implicitIsVisible) {
+                            if (searcher.offset == 0 && searcher.value == 
$(target).val() && ! $(div).hasClass("implicit")) {
+                                $(anchor).text('<fmt:message key="close" />');
+                            } else {
+                                $(anchor).text('<fmt:message key="search" />');
+                            }
+                        }
+                     }
+                }
+               );
+
     });
 
 /**
@@ -738,6 +780,11 @@
     var newSearch = val;
     var rep = this.getResultDiv();
 
+    if ($(rep).hasClass("implicit")) {
+       rep.implicitIsVisible = $(rep).is(":visible");
+    }
+
+
     if (newSearch != this.value) {
         $(rep).removeClass("implicit");
         this.searchResults = {};
@@ -814,40 +861,10 @@
 
 
 /**
- * If you defined in your CSS that 'implicit' search results are not visible 
at all, then
- * you can call this method to bind events to change the texts on the search 
buttons accordingly
- * (between 'search' and 'close').
+ @deprecated Arranged automaticly.
  */
 MMBaseSearcher.prototype.implicitsAreHidden = function() {
-    $(document).bind("mmsrPaged",
-                     function (e, status, relater, searcher) {
-                         var anchor = $(searcher.div).find("a.search")[0];
-                         anchor.searcher = searcher;
-                         var div = searcher.getResultDiv();
-                         if (searcher.offset == 0 && ! 
$(div).hasClass("implicit")) {
-                             $(anchor).text('<fmt:message key="close" />');
-                         } else {
-                             $(anchor).text('<fmt:message key="search" />');
-                         }
-
-                     });
-
-    $(document).keyup(function(e) {
-            var target = e.target;
-            if (target.tagName == "input" && $(target).hasClass("search")) {
-                var anchor = $(target).closest("fieldset").find("a")[0];
-                var searcher = anchor.searcher;
-                if (searcher != null) {
-                    var div = searcher.getResultDiv();
-                    if (searcher.offset == 0 && searcher.value == 
$(target).val() && ! $(div).hasClass("implicit")) {
-                        $(anchor).text('<fmt:message key="close" />');
-                    } else {
-                        $(anchor).text('<fmt:message key="search" />');
-                    }
-                }
-            }
-
-        });
+    //DEPRECETATEd
 };
 
 

_______________________________________________
Cvs mailing list
[email protected]
http://lists.mmbase.org/mailman/listinfo/cvs

Reply via email to