[Pkg-ocaml-maint-commits] r6286 - /trunk/tools/ocaml_transition_monitor/ocaml_transition_monitor.js

glondu-guest at users.alioth.debian.org glondu-guest at users.alioth.debian.org
Sat Feb 28 10:03:19 UTC 2009


Author: glondu-guest
Date: Sat Feb 28 10:03:19 2009
New Revision: 6286

URL: http://svn.debian.org/wsvn/?sc=1&rev=6286
Log:
More robust update function

Don't rely on some unknown internal state of the browser to toggle the
visibility of packages. This version works even when following a link
and coming back.


Modified:
    trunk/tools/ocaml_transition_monitor/ocaml_transition_monitor.js

Modified: trunk/tools/ocaml_transition_monitor/ocaml_transition_monitor.js
URL: http://svn.debian.org/wsvn/trunk/tools/ocaml_transition_monitor/ocaml_transition_monitor.js?rev=6286&op=diff
==============================================================================
--- trunk/tools/ocaml_transition_monitor/ocaml_transition_monitor.js (original)
+++ trunk/tools/ocaml_transition_monitor/ocaml_transition_monitor.js Sat Feb 28 10:03:19 2009
@@ -10,13 +10,30 @@
   Dependencies: jquery.
 */
 
-$(document).ready(function () {
-  function update () {
+function update () {
     $("#count").html(" ("+$(".src").filter(":visible").length+")");
-  };
-  $("#good").click(function () { $(".src").filter(".good").parent().toggle(); update(); });
-  $("#bad").click(function () { $(".src").filter(".bad").parent().toggle(); update(); });
-  $("#unknown").click(function () { $(".src").filter(".unknown").parent().toggle(); update(); });
-  $(".src").filter(".unknown").parent().hide();
-  update();
-});
+    if ($("#good").is(":checked")) {
+        $(".src").filter(".good").parent().show();
+    } else {
+        $(".src").filter(".good").parent().hide();
+    }
+    if ($("#bad").is(":checked")) {
+        $(".src").filter(".bad").parent().show();
+    } else {
+        $(".src").filter(".bad").parent().hide();
+    }
+    if ($("#unknown").is(":checked")) {
+        $(".src").filter(".unknown").parent().show();
+    } else {
+        $(".src").filter(".unknown").parent().hide();
+    }
+};
+
+function init () {
+    $("#good").click(update);
+    $("#bad").click(update);
+    $("#unknown").click(update);
+    update();
+}
+
+$(document).ready(init);




More information about the Pkg-ocaml-maint-commits mailing list