Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 <html> | 1 <html> |
| 2 <head> | 2 <head> |
| 3 <title>Inspectable pages</title> | 3 <title>Inspectable pages</title> |
| 4 <style> | 4 <style> |
| 5 body { | 5 body { |
| 6 color: #222; | 6 color: #222; |
| 7 font-family: Helvetica, Arial, sans-serif; | 7 font-family: Helvetica, Arial, sans-serif; |
| 8 margin: 0; | 8 margin: 0; |
| 9 text-shadow: rgba(255, 255, 255, 0.496094) 0px 1px 0px; | 9 text-shadow: rgba(255, 255, 255, 0.496094) 0px 1px 0px; |
| 10 } | 10 } |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 77 | 77 |
| 78 function onReady() { | 78 function onReady() { |
| 79 if(this.readyState == 4 && this.status == 200) { | 79 if(this.readyState == 4 && this.status == 200) { |
| 80 if(this.response != null) | 80 if(this.response != null) |
| 81 var responseJSON = JSON.parse(this.response); | 81 var responseJSON = JSON.parse(this.response); |
| 82 for (var i = 0; i < responseJSON.length; ++i) | 82 for (var i = 0; i < responseJSON.length; ++i) |
| 83 appendItem(responseJSON[i]); | 83 appendItem(responseJSON[i]); |
| 84 } | 84 } |
| 85 } | 85 } |
| 86 | 86 |
| 87 function overrideFrontendUrl(item) { | |
| 88 if (window.location.hash) { | |
| 89 var overridden_url = window.location.hash.substr(1); | |
| 90 var ws_suffix = item.webSocketDebuggerUrl.replace('ws://', 'ws='); | |
| 91 if (overridden_url.indexOf('?') == -1) | |
| 92 return overridden_url + '?' + ws_suffix; | |
| 93 else | |
| 94 return overridden_url + '&' + ws_suffix; | |
| 95 } | |
| 96 return item.devtoolsFrontendUrl; | |
| 97 } | |
| 98 | |
| 99 function appendItem(item_object) { | 87 function appendItem(item_object) { |
| 100 var item_element; | 88 var item_element; |
| 101 if (item_object.devtoolsFrontendUrl) { | 89 if (item_object.devtoolsFrontendUrl) { |
| 102 item_element = document.createElement('a'); | 90 item_element = document.createElement('a'); |
| 103 item_element.href = overrideFrontendUrl(item_object); | 91 item_element.href = item_object.devtoolsFrontendUrl; |
| 104 item_element.title = item_object.title; | 92 item_element.title = item_object.title; |
| 93 item_element.addEventListener('click', onItemClicked.bind(null, item_element .href)); | |
| 105 } else { | 94 } else { |
| 106 item_element = document.createElement('div'); | 95 item_element = document.createElement('div'); |
| 107 item_element.className = 'connected'; | 96 item_element.className = 'connected'; |
| 108 item_element.title = 'The tab already has an active debug session'; | 97 item_element.title = 'The tab already has an active debug session'; |
| 109 } | 98 } |
| 110 item_element.classList.add('item'); | 99 item_element.classList.add('item'); |
| 111 | 100 |
| 112 var description = document.createElement('div'); | 101 var description = document.createElement('div'); |
| 113 description.className = 'description'; | 102 description.className = 'description'; |
| 114 | 103 |
| 115 var title = document.createElement('div'); | 104 var title = document.createElement('div'); |
| 116 title.className = 'title'; | 105 title.className = 'title'; |
| 117 title.textContent = item_object.description || item_object.title; | 106 title.textContent = item_object.description || item_object.title; |
| 118 title.style.cssText = 'background-image:url(' + | 107 title.style.cssText = 'background-image:url(' + |
| 119 item_object.faviconUrl + ')'; | 108 item_object.faviconUrl + ')'; |
| 120 description.appendChild(title); | 109 description.appendChild(title); |
| 121 | 110 |
| 122 var subtitle = document.createElement('div'); | 111 var subtitle = document.createElement('div'); |
| 123 subtitle.className = 'subtitle'; | 112 subtitle.className = 'subtitle'; |
| 124 subtitle.textContent = (item_object.url || '').substring(0, 300); | 113 subtitle.textContent = (item_object.url || '').substring(0, 300); |
| 125 description.appendChild(subtitle); | 114 description.appendChild(subtitle); |
| 126 | 115 |
| 127 item_element.appendChild(description); | 116 item_element.appendChild(description); |
| 128 | 117 |
| 129 document.getElementById('items').appendChild(item_element); | 118 document.getElementById('items').appendChild(item_element); |
| 130 } | 119 } |
| 120 | |
| 121 function onItemClicked(url, event) { | |
| 122 fetch("/json/new?" + url); | |
|
dgozman
2016/10/30 03:14:46
What is this doing?
lushnikov
2016/10/31 22:47:26
Since we cannot navigate to chrome-devtools scheme
| |
| 123 event.preventDefault(); | |
| 124 event.stopPropagation(); | |
| 125 } | |
| 126 | |
| 131 </script> | 127 </script> |
| 132 </head> | 128 </head> |
| 133 <body onload='onLoad()'> | 129 <body onload='onLoad()'> |
| 134 <div id='caption'>Inspectable pages</div> | 130 <div id='caption'>Inspectable pages</div> |
| 135 <hr> | 131 <hr> |
| 136 <div id='items'> | 132 <div id='items'> |
| 137 </div> | 133 </div> |
| 138 </body> | 134 </body> |
| 139 </html> | 135 </html> |
| OLD | NEW |