Source for file profiler.phtml
Documentation is available at profiler.phtml
- 1: <?php
- 3: /**
- 4: * Nette Framework - Profiler screen template.
- 5: *
- 6: * Copyright (c) 2004, 2009 David Grudl (http://davidgrudl.com)
- 7: *
- 8: * This source file is subject to the "Nette license" that is bundled
- 9: * with this package in the file license.txt.
- 10: *
- 11: * For more information please see http://nettephp.com
- 12: *
- 19: *
- 22: */
- 26: ?>
- 28: <style type="text/css">
- 29: /* <![CDATA[ */
- 30: #netteProfilerContainer {
- 31: position: fixed;
- 32: _position: absolute;
- 33: right: 5px;
- 34: bottom: 5px;
- 35: z-index: 23178;
- 36: }
- 38: #netteProfiler {
- 39: font: normal normal 11px/1.4 Consolas, Arial;
- 40: position: relative;
- 41: padding: 3px;
- 42: color: black;
- 43: background: #EEE;
- 44: border: 1px dotted gray;
- 45: cursor: move;
- 46: opacity: .70;
- 47: =filter: alpha(opacity=70);
- 48: }
- 50: #netteProfiler * {
- 51: color: inherit;
- 52: background: inherit;
- 53: text-align: inherit;
- 54: }
- 56: #netteProfilerIcon {
- 57: position: absolute;
- 58: right: 0;
- 59: top: 0;
- 60: line-height: 1;
- 61: padding: 2px;
- 62: color: black;
- 63: text-decoration: none;
- 64: }
- 66: #netteProfiler:hover {
- 67: opacity: 1;
- 68: =filter: none;
- 69: }
- 71: #netteProfiler ul {
- 72: margin: 0;
- 73: padding: 0;
- 74: width: 350px;
- 75: }
- 77: #netteProfiler li {
- 78: margin: 0;
- 79: padding: 1px;
- 80: text-align: left;
- 81: list-style: none;
- 82: }
- 84: #netteProfiler span[title] {
- 85: border-bottom: 1px dotted gray;
- 86: cursor: help;
- 87: }
- 89: #netteProfiler strong {
- 90: color: red;
- 91: }
- 92: /* ]]> */
- 93: </style>
- 96: <div id="netteProfilerContainer">
- 97: <div id="netteProfiler">
- 98: <a id="netteProfilerIcon" href="#"><abbr>▼</abbr></a
- 99: ><ul>
- 101: <?php foreach ((array) call_user_func($callback, 'profiler') as $line): ?><li><?php echo $line, "\n" ?></li><?php endforeach ?>
- 103: </ul>
- 104: </div>
- 105: </div>
- 108: <script type="text/javascript">
- 109: /* <![CDATA[ */
- 110: document.getElementById('netteProfiler').onmousedown = function(e) {
- 111: e = e || event;
- 112: this.posX = parseInt(this.style.left + '0');
- 113: this.posY = parseInt(this.style.top + '0');
- 114: this.mouseX = e.clientX;
- 115: this.mouseY = e.clientY;
- 117: var thisObj = this;
- 119: document.documentElement.onmousemove = function(e) {
- 120: e = e || event;
- 121: thisObj.style.left = (e.clientX - thisObj.mouseX + thisObj.posX) + "px";
- 122: thisObj.style.top = (e.clientY - thisObj.mouseY + thisObj.posY) + "px";
- 123: return false;
- 124: };
- 126: document.documentElement.onmouseup = function(e) {
- 127: document.documentElement.onmousemove = null;
- 128: document.documentElement.onmouseup = null;
- 129: document.cookie = 'netteProfilerPosition=' + thisObj.style.left + ':' + thisObj.style.top + '; path=/';
- 130: return false;
- 131: };
- 132: };
- 134: document.getElementById('netteProfilerIcon').onclick = function(e) {
- 135: var arrow = this.getElementsByTagName('abbr')[0];
- 136: var panel = this.nextSibling;
- 137: var collapsed = panel.currentStyle ? panel.currentStyle.display == 'none' : getComputedStyle(panel, null).display == 'none';
- 139: arrow.innerHTML = collapsed ? String.fromCharCode(0x25bc) : 'Profiler ' + String.fromCharCode(0x25ba);
- 140: panel.style.display = collapsed ? 'block' : 'none';
- 141: arrow.parentNode.style.position = collapsed ? 'absolute' : 'static';
- 143: document.cookie = 'netteProfilerVisible=' + collapsed*1 + '; path=/';
- 144: return false;
- 145: }
- 147: document.body.appendChild(document.getElementById('netteProfilerContainer'));
- 149: if (document.cookie.indexOf('netteProfilerVisible=0') > -1) {
- 150: document.getElementById('netteProfilerIcon').onclick();
- 151: }
- 153: var _nettePos = document.cookie.match(/netteProfilerPosition=([0-9-]+px):([0-9-]+px)/);
- 154: if (_nettePos) {
- 155: document.getElementById('netteProfiler').style.left = _nettePos[1];
- 156: document.getElementById('netteProfiler').style.top = _nettePos[2];
- 157: }
- 158: /* ]]> */
- 159: </script>