PageRenderTime 24ms CodeModel.GetById 16ms app.highlight 4ms RepoModel.GetById 1ms app.codeStats 0ms

/testing/selenium-core/SeleniumLog.html

http://datanucleus-appengine.googlecode.com/
HTML | 109 lines | 92 code | 17 blank | 0 comment | 0 complexity | 9a10ecd3f526402d70df8427e8708a85 MD5 | raw file
  1<html>
  2
  3<head>
  4<title>Selenium Log Console</title>
  5<link id="cssLink" rel="stylesheet" href="selenium.css" />
  6<script src="scripts/htmlutils.js"></script>
  7<script language="JavaScript">
  8
  9var disabled = true;
 10
 11function logOnLoad() {
 12    var urlConfig = new URLConfiguration();
 13    urlConfig.queryString = window.location.search.substr(1);
 14    var startingThreshold = urlConfig._getQueryParameter("startingThreshold");
 15    setThresholdLevel(startingThreshold);
 16    var buttons = document.getElementsByTagName("input");
 17    for (var i = 0; i < buttons.length; i++) {
 18        addChangeListener(buttons[i]);
 19    }
 20}
 21
 22function enableButtons() {
 23    var buttons = document.getElementsByTagName("input");
 24    for (var i = 0; i < buttons.length; i++) {
 25        buttons[i].disabled = false;
 26        disabled = false;
 27    }
 28}
 29
 30function callBack() {}
 31
 32function changeHandler() {
 33    callBack(getThresholdLevel());
 34}
 35
 36function addChangeListener(element) {
 37    if (window.addEventListener && !window.opera)
 38        element.addEventListener("click", changeHandler, true);
 39    else if (window.attachEvent)
 40        element.attachEvent("onclick", changeHandler);
 41}
 42
 43var logLevels = {
 44    debug: 0,
 45    info: 1,
 46    warn: 2,
 47    error: 3
 48};
 49
 50function getThresholdLevel() {
 51    var buttons = document.getElementById('logLevelChooser').level;
 52    for (var i = 0; i < buttons.length; i++) {
 53        if (buttons[i].checked) {
 54            return buttons[i].value;
 55        }
 56    }
 57}
 58
 59function setThresholdLevel(logLevel) {
 60    var buttons = document.getElementById('logLevelChooser').level;
 61    for (var i = 0; i < buttons.length; i++) {
 62        if (buttons[i].value==logLevel) {
 63            buttons[i].checked = true;
 64        }
 65        else {
 66            buttons[i].checked = false;
 67        }
 68    }
 69}
 70
 71function append(message, logLevel) {
 72    var logLevelThreshold = getThresholdLevel();
 73    if (logLevels[logLevel] < logLevels[logLevelThreshold]) {
 74        return;
 75    }
 76    var log = document.getElementById('log');
 77    var newEntry = document.createElement('li');
 78    newEntry.className = logLevel;
 79    newEntry.appendChild(document.createTextNode(message));
 80    log.appendChild(newEntry);
 81    if (newEntry.scrollIntoView) {
 82        newEntry.scrollIntoView();
 83    }
 84}
 85
 86</script>
 87</head>
 88<body id="logging-console" onload="logOnLoad();">
 89
 90
 91
 92<div id="banner">
 93  <form id="logLevelChooser">
 94      <input id="level-error" type="radio" name="level" disabled='true'
 95             value="error" /><label for="level-error">Error</label>
 96      <input id="level-warn" type="radio" name="level" disabled='true'
 97             value="warn" /><label for="level-warn">Warn</label>
 98      <input id="level-info" type="radio" name="level" disabled='true'
 99             value="info" /><label for="level-info">Info</label>
100      <input id="level-debug" type="radio" name="level" checked="yes" disabled='true'
101             value="debug" /><label for="level-debug">Debug</label>
102  </form>
103  <h1>Selenium Log Console</h1>
104</div>
105
106<ul id="log"></ul>
107
108</body>
109</html>