summaryrefslogtreecommitdiffstats
path: root/src/core/resources/devtools_discovery_page.html
blob: 7aac749320c2dc1b7c0aa45ff4f1b34ff8cfbc3b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
<html>
<head>
<title>QtWebEngine Remote Debugging</title>
<style>
body {
  background-color: rgb(245, 245, 245);
  font-family: Helvetica, Arial, sans-serif;
  text-shadow: rgba(255, 255, 255, 0.496094) 0px 1px 0px;
}

#caption {
  color: black;
  font-size: 16px;
  margin-top: 30px;
  margin-bottom: 0px;
  margin-left: 70px;
  height: 20px;
  text-align: left;
}

#items {
  margin-left: 60px;
  margin-right: 60px;
  -webkit-box-orient: horizontal;
  -webkit-box-lines: multiple;
}

.frontend_ref {
  color: black;
  text-decoration: initial;
}

.text {
  background: no-repeat 0;
  background-size: 16px;
  font-size: 12px;
  margin: 4px 0px 0px 4px;
  overflow: hidden;
  padding: 2px 0px 0px 20px;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}
</style>

<script>

function onLoad() {
  var tabsListRequest = new XMLHttpRequest();
  tabsListRequest.open('GET', '/json/list', true);
  tabsListRequest.onreadystatechange = onReady;
  tabsListRequest.send();
}

function onReady() {
  if(this.readyState == 4 && this.status == 200) {
    if(this.response != null)
      var responseJSON = JSON.parse(this.response);
      for (var i = 0; i < responseJSON.length; ++i)
        appendItem(responseJSON[i]);
  }
}

function overrideFrontendUrl(item) {
  if (window.location.hash) {
    var overridden_url = window.location.hash.substr(1);
    var ws_suffix = item.webSocketDebuggerUrl.replace('ws://', 'ws=');
    if (overridden_url.indexOf('?') == -1)
      return overridden_url + '?' + ws_suffix;
    else
      return overridden_url + '&' + ws_suffix;
  }
  return item.devtoolsFrontendUrl;
}

function appendItem(item_object) {
  var frontend_ref;
  if (item_object.devtoolsFrontendUrl) {
    frontend_ref = document.createElement('a');
    frontend_ref.href = overrideFrontendUrl(item_object);
    frontend_ref.title = item_object.title;
  } else {
    frontend_ref = document.createElement('div');
    frontend_ref.title = 'The tab already has an active debug session';
  }
  frontend_ref.className = 'frontend_ref';

  var text = document.createElement('div');
  text.className = 'text';
  text.innerText = item_object.description || item_object.title;
  text.style.cssText = 'background-image:url(' +
                       item_object.faviconUrl + ')';
  frontend_ref.appendChild(text);

  var item = document.createElement('p');
  item.appendChild(frontend_ref);

  document.getElementById('items').appendChild(item);
}
</script>
</head>
<body onload='onLoad()'>
  <div id='caption'>Inspectable pages</div>
  <div id='items'>
  </div>
  <hr>
</body>
</html>