Source for file profiler.phtml

Documentation is available at profiler.phtml

  1. 1: <?php
  2. 2:  
  3. 3: /**
  4. 4:  * Nette Framework - Profiler screen template.
  5. 5:  *
  6. 6:  * @copyright  Copyright (c) 2004, 2010 David Grudl
  7. 7:  * @license    http://nettephp.com/license  Nette license
  8. 8:  * @link       http://nettephp.com
  9. 9:  * @category   Nette
  10. 10:  * @package    Nette
  11. 11:  *
  12. 12:  * @param      array     $colophons 
  13. 13:  * @return     void 
  14. 14:  */
  15. 15:  
  16. 16:  
  17. 17:  
  18. 18: ?>
  19. 19:  
  20. 20: <style type="text/css">
  21. 21: /* <![CDATA[ */
  22. 22:     #netteProfilerContainer {
  23. 23:         position: fixed;
  24. 24:         _position: absolute;
  25. 25:         right: 5px;
  26. 26:         bottom: 5px;
  27. 27:         z-index: 23178;
  28. 28:     }
  29. 29:  
  30. 30:     #netteProfiler {
  31. 31:         font: normal normal 11px/1.4 Consolas, Arial;
  32. 32:         position: relative;
  33. 33:         padding: 3px;
  34. 34:         color: black;
  35. 35:         background: #EEE;
  36. 36:         border: 1px dotted gray;
  37. 37:         cursor: move;
  38. 38:         opacity: .70;
  39. 39:         =filter: alpha(opacity=70);
  40. 40:     }
  41. 41:  
  42. 42:     #netteProfiler * {
  43. 43:         color: inherit;
  44. 44:         background: inherit;
  45. 45:         text-align: inherit;
  46. 46:     }
  47. 47:  
  48. 48:     #netteProfilerIcon {
  49. 49:         position: absolute;
  50. 50:         right: 0;
  51. 51:         top: 0;
  52. 52:         line-height: 1;
  53. 53:         padding: 2px;
  54. 54:         color: black;
  55. 55:         text-decoration: none;
  56. 56:     }
  57. 57:  
  58. 58:     #netteProfiler:hover {
  59. 59:         opacity: 1;
  60. 60:         =filter: none;
  61. 61:     }
  62. 62:  
  63. 63:     #netteProfiler ul {
  64. 64:         margin: 0;
  65. 65:         padding: 0;
  66. 66:         width: 350px;
  67. 67:     }
  68. 68:  
  69. 69:     #netteProfiler li {
  70. 70:         margin: 0;
  71. 71:         padding: 1px;
  72. 72:         text-align: left;
  73. 73:         list-style: none;
  74. 74:     }
  75. 75:  
  76. 76:     #netteProfiler span[title] {
  77. 77:         border-bottom: 1px dotted gray;
  78. 78:         cursor: help;
  79. 79:     }
  80. 80:  
  81. 81:     #netteProfiler strong {
  82. 82:         color: red;
  83. 83:     }
  84. 84: /* ]]> */
  85. 85: </style>
  86. 86:  
  87. 87:  
  88. 88: <div id="netteProfilerContainer">
  89. 89: <div id="netteProfiler">
  90. 90:     <a id="netteProfilerIcon" href="#"><abbr>&#x25bc;</abbr></a
  91. 91:     ><ul>
  92. 92:     <?php foreach ($colophons as $callback)?>
  93. 93:     <?php foreach ((array) call_user_func($callback'profiler'as $line)?><li><?php echo $line"\n" ?></li><?php endforeach ?>
  94. 94:     <?php endforeach ?>
  95. 95:     </ul>
  96. 96: </div>
  97. 97: </div>
  98. 98:  
  99. 99:  
  100. 100: <script type="text/javascript">
  101. 101: /* <![CDATA[ */
  102. 102: document.getElementById('netteProfiler').onmousedown = function(e) {
  103. 103:     e = e || event;
  104. 104:     this.posX = parseInt(this.style.left + '0');
  105. 105:     this.posY = parseInt(this.style.top + '0');
  106. 106:     this.mouseX = e.clientX;
  107. 107:     this.mouseY = e.clientY;
  108. 108:  
  109. 109:     var thisObj = this;
  110. 110:  
  111. 111:     document.documentElement.onmousemove = function(e) {
  112. 112:         e = e || event;
  113. 113:         thisObj.style.left = (e.clientX - thisObj.mouseX + thisObj.posX) + "px";
  114. 114:         thisObj.style.top = (e.clientY - thisObj.mouseY + thisObj.posY) + "px";
  115. 115:         return false;
  116. 116:     };
  117. 117:  
  118. 118:     document.documentElement.onmouseup = function(e) {
  119. 119:         document.documentElement.onmousemove = null;
  120. 120:         document.documentElement.onmouseup = null;
  121. 121:         document.cookie = 'netteProfilerPosition=' + thisObj.style.left + ':' + thisObj.style.top + '; path=/';
  122. 122:         return false;
  123. 123:     };
  124. 124: };
  125. 125:  
  126. 126: document.getElementById('netteProfilerIcon').onclick = function(e) {
  127. 127:     var arrow = this.getElementsByTagName('abbr')[0];
  128. 128:     var panel = this.nextSibling;
  129. 129:     var collapsed = panel.currentStyle ? panel.currentStyle.display == 'none' : getComputedStyle(panel, null).display == 'none';
  130. 130:  
  131. 131:     arrow.innerHTML = collapsed ? String.fromCharCode(0x25bc) : 'Profiler ' + String.fromCharCode(0x25ba);
  132. 132:     panel.style.display = collapsed ? 'block' : 'none';
  133. 133:     arrow.parentNode.style.position = collapsed ? 'absolute' : 'static';
  134. 134:  
  135. 135:     document.cookie = 'netteProfilerVisible=' + collapsed*1 + '; path=/';
  136. 136:     return false;
  137. 138:  
  138. 139: document.body.appendChild(document.getElementById('netteProfilerContainer'));
  139. 140:  
  140. 141: if (document.cookie.indexOf('netteProfilerVisible=0') > -1) {
  141. 142:     document.getElementById('netteProfilerIcon').onclick();
  142. 144:  
  143. 145: var _nettePos = document.cookie.match(/netteProfilerPosition=([0-9-]+px):([0-9-]+px)/);
  144. 146: if (_nettePos) {
  145. 147:     document.getElementById('netteProfiler').style.left = _nettePos[1];
  146. 148:     document.getElementById('netteProfiler').style.top = _nettePos[2];
  147. 150: /* ]]> */
  148. 151: </script>