Package buildbot :: Package status :: Package web :: Module console_js
[frames] | no frames]

Source Code for Module buildbot.status.web.console_js

 1  JAVASCRIPT = ''' 
 2  // <;![Cdata[ 
 3  // 
 4   
 5  // 
 6  // Functions used to display the build status bubble on box click. 
 7  // 
 8   
 9  // show the build status box. This is called when the user clicks on a block. 
10  function showBuildBox(url, event) { 
11      //  Find the current curson position. 
12      var cursorPosTop = (window.event ? window.event.clientY : event.pageY) 
13      var cursorPosLeft = (window.event ? window.event.clientX : event.pageX) 
14   
15      // Offset the position by 5, to make the window appears under the cursor. 
16      cursorPosTop  = cursorPosTop  + document.body.scrollTop -5 ;     
17      cursorPosLeft = cursorPosLeft  + document.body.scrollLeft - 5; 
18   
19      // Move the div (hidden) under the cursor. 
20      var divBox = document.getElementById('divBox'); 
21      divBox.style.top = parseInt(cursorPosTop) + 'px'; 
22      divBox.style.left = parseInt(cursorPosLeft) + 'px'; 
23   
24      // Reload the hidden frame with the build page we want to show. 
25      // The onload even on this frame will update the div and make it visible. 
26      document.getElementById("frameBox").src = url 
27       
28      // We don't want to reload the page. 
29      return false; 
30  } 
31   
32  // OnLoad handler for the iframe containing the build to show. 
33  function updateDiv(event) {  
34      // Get the frame innerHTML. 
35      var iframeContent = document.getElementById("frameBox").contentWindow.document.body.innerHTML; 
36   
37      // If there is any content, update the div, and make it visible. 
38      if (iframeContent) { 
39          var divBox = document.getElementById('divBox');  
40          divBox.innerHTML = iframeContent ; 
41          divBox.style.display = "block"; 
42      } 
43  }  
44   
45  // Util functions to know if an element is contained inside another element. 
46  // We use this to know when we mouse out our build status div. 
47  function containsDOM (container, containee) { 
48      var isParent = false; 
49      do { 
50          if ((isParent = container == containee)) 
51              break; 
52          containee = containee.parentNode; 
53      } while (containee != null); 
54   
55      return isParent; 
56  } 
57   
58  // OnMouseOut handler. Returns true if the mouse moved out of the element. 
59  // It is false if the mouse is still in the element, but in a blank part of it, 
60  // like in an empty table cell. 
61  function checkMouseLeave(element, event) { 
62    if (element.contains && event.toElement) { 
63      return !element.contains(event.toElement); 
64    } 
65    else if (event.relatedTarget) { 
66      return !containsDOM(element, event.relatedTarget); 
67    } 
68  } 
69   
70  // ]]>  
71  ''' 
72