<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -5,11 +5,14 @@
 &lt;/head&gt;
 &lt;body&gt;
   &lt;h1&gt;Observe the Firebug Console&lt;/h1&gt;
-  &lt;a href=&quot;#&quot; id=&quot;remove_from_dom&quot;&gt;Remove from DOM (stops the intervals)&lt;/a&gt;&lt;br /&gt;
-  &lt;a href=&quot;#&quot; id=&quot;toggle_visibility&quot;&gt;Toggle visibility (pauses/resumes the intervals)&lt;/a&gt;&lt;br /&gt;
-  &lt;a href=&quot;#&quot; id=&quot;pause_resume&quot;&gt;Pause/Resume&lt;/a&gt;&lt;br /&gt;
+
+  &lt;a href=&quot;#&quot; id=&quot;pause&quot;&gt;Pause&lt;/a&gt; / 
+  &lt;a href=&quot;#&quot; id=&quot;resume&quot;&gt;Resume&lt;/a&gt;&lt;br /&gt;
   &lt;a href=&quot;#&quot; id=&quot;stop&quot;&gt;Stop&lt;/a&gt;&lt;br /&gt;
-  &lt;a href=&quot;#&quot; id=&quot;start_another&quot;&gt;Start another on top of exisiting one&lt;/a&gt;&lt;br /&gt;
+  &lt;a href=&quot;#&quot; id=&quot;start_another&quot;&gt;Start another&lt;/a&gt;&lt;br /&gt;
+  &lt;a href=&quot;#&quot; id=&quot;toggle_visibility&quot;&gt;Toggle visibility (pauses/resumes the intervals)&lt;/a&gt;&lt;br /&gt;
+  &lt;a href=&quot;#&quot; id=&quot;remove_from_dom&quot;&gt;Remove widget from DOM (stops the intervals)&lt;/a&gt;&lt;br /&gt;
+
   &lt;script type=&quot;text/javascript&quot;&gt;
     $(&quot;#remove_from_dom&quot;).click(function(){
       $(&quot;#tagsoup1&quot;).empty()
@@ -21,10 +24,12 @@
       return false
     });
 
-    $(&quot;#pause_resume&quot;).toggle(function(){
+    $(&quot;#pause&quot;).click(function(){
       $(&quot;#widget&quot;).data(&quot;foo&quot;).should_pause = true
       return false
-    }, function() {
+    });
+
+    $(&quot;#resume&quot;).click(function(){
       $(&quot;#widget&quot;).data(&quot;foo&quot;).should_pause = false
       return false
     });
@@ -36,23 +41,22 @@
     
     $(&quot;#start_another&quot;).click(function(){
       $(&quot;#widget&quot;).at_intervals(function(){
-        console.log(&quot;Another one...&quot;)
+        console.log(&quot;Doing some other work now...&quot;)
       }, { name: &quot;foo&quot;, delay: 500 })
       return false
     })
   &lt;/script&gt;
 
-
   &lt;div id=&quot;tagsoup1&quot;&gt;
     &lt;div id=&quot;tagsoup2&quot;&gt;
 
-      &lt;div id=&quot;widget&quot;&gt;
-        &lt;p&gt;Widget with setIntervals. Self-contained piece of code and looks.&lt;/p&gt;
+      &lt;div id=&quot;widget&quot; style=&quot;border: 1px dotted gray; margin: 2em; padding: 1em; height: 150px&quot;&gt;
+        &lt;p&gt;A widget. Self-contained piece of code and looks.&lt;/p&gt;
         &lt;div id=&quot;logic&quot; style=&quot;background-color: red; width: 66px; height: 66px&quot;&gt;&lt;/div&gt;
 
         &lt;script type=&quot;text/javascript&quot;&gt;
           $(&quot;#widget&quot;).at_intervals(function(){
-            console.log(&quot;working...&quot;)
+            console.log(&quot;Working...&quot;)
             $(&quot;#logic&quot;).toggle(200)
           }, { name: &quot;foo&quot; });
         &lt;/script&gt;</diff>
      <filename>example.html</filename>
    </modified>
    <modified>
      <diff>@@ -12,23 +12,23 @@
       
       var helper = {
         should_stop: function() { // used to completely remove the interval
-          return this.removed_from_dom() || this.user_wants_to_stop()
+          return !this.element_in_dom() || this.user_wants_to_stop()
         },
         should_work: function() { // used to pause/resume the interval
-          return this.is_visible() &amp;&amp; !this.user_wants_to_pause()
-        },
-        removed_from_dom: function() {
-          return e.parents(&quot;html&quot;).length == 0
+          return this.element_visible() &amp;&amp; !this.user_wants_to_pause()
         },
         user_wants_to_stop: function() {
           return e.data(name).should_stop == true
         },
-        is_visible: function() {
-          return e.parents(&quot;*&quot;).andSelf().not(&quot;:visible&quot;).length == 0
-        },
         user_wants_to_pause: function() {
           return e.data(name).should_pause == true
         },
+        element_in_dom: function() {
+          return e.parents(&quot;html&quot;).length &gt; 0
+        },
+        element_visible: function() {
+          return e.parents(&quot;*&quot;).andSelf().not(&quot;:visible&quot;).length == 0
+        },
         stop: function(interval_id) {
           clearInterval(interval_id)
           e.removeData(name)</diff>
      <filename>jquery.at_intervals.js</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>25dae3aea3f5e7483ee94d3d40f949815eeae5da</id>
    </parent>
  </parents>
  <author>
    <name>Jacek Becela</name>
    <email>jacek.becela@gmail.com</email>
  </author>
  <url>http://github.com/ncr/at_intervals/commit/78c05b821e0ff5010fdc52c8fafb7677c433b051</url>
  <id>78c05b821e0ff5010fdc52c8fafb7677c433b051</id>
  <committed-date>2009-01-03T05:50:03-08:00</committed-date>
  <authored-date>2009-01-03T05:50:03-08:00</authored-date>
  <message>Updated examples and refactored private functions</message>
  <tree>299d112f3f6d5f8568041216f0e72f153af46117</tree>
  <committer>
    <name>Jacek Becela</name>
    <email>jacek.becela@gmail.com</email>
  </committer>
</commit>
