Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 <html> | |
| 2 <head> | |
| 3 <style> | |
| 4 table { | |
| 5 border-collapse:collapse; | |
| 6 } | |
| 7 | |
| 8 td { | |
| 9 border: 1px solid black; | |
| 10 padding-left: 5px; | |
| 11 } | |
| 12 | |
| 13 td.button { | |
| 14 border: none; | |
| 15 } | |
| 16 | |
| 17 td.cookie_count { | |
| 18 text-align: right; | |
| 19 } | |
| 20 | |
| 21 </style> | |
| 22 | |
| 23 <script> | |
| 24 | |
| 25 if (!chrome.cookies) { | 1 if (!chrome.cookies) { |
| 26 chrome.cookies = chrome.experimental.cookies; | 2 chrome.cookies = chrome.experimental.cookies; |
| 27 } | 3 } |
| 28 | 4 |
| 29 // A simple Timer class. | 5 // A simple Timer class. |
| 30 function Timer() { | 6 function Timer() { |
| 31 this.start_ = new Date(); | 7 this.start_ = new Date(); |
| 32 | 8 |
| 33 this.elapsed = function() { | 9 this.elapsed = function() { |
| 34 return (new Date()) - this.start_; | 10 return (new Date()) - this.start_; |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 148 }); | 124 }); |
| 149 } | 125 } |
| 150 | 126 |
| 151 function removeCookie(cookie) { | 127 function removeCookie(cookie) { |
| 152 var url = "http" + (cookie.secure ? "s" : "") + "://" + cookie.domain + | 128 var url = "http" + (cookie.secure ? "s" : "") + "://" + cookie.domain + |
| 153 cookie.path; | 129 cookie.path; |
| 154 chrome.cookies.remove({"url": url, "name": cookie.name}); | 130 chrome.cookies.remove({"url": url, "name": cookie.name}); |
| 155 } | 131 } |
| 156 | 132 |
| 157 function removeCookiesForDomain(domain) { | 133 function removeCookiesForDomain(domain) { |
| 158 var timer = new Timer(); | 134 var timer = new Timer(); |
| 159 cache.getCookies(domain).forEach(function(cookie) { | 135 cache.getCookies(domain).forEach(function(cookie) { |
| 160 removeCookie(cookie); | 136 removeCookie(cookie); |
| 161 }); | 137 }); |
| 162 } | 138 } |
| 163 | 139 |
| 164 function resetTable() { | 140 function resetTable() { |
| 165 var table = select("#cookies"); | 141 var table = select("#cookies"); |
| 166 while (table.rows.length > 1) { | 142 while (table.rows.length > 1) { |
| 167 table.deleteRow(table.rows.length - 1); | 143 table.deleteRow(table.rows.length - 1); |
| 168 } | 144 } |
| 169 } | 145 } |
| 170 | 146 |
| 171 var reload_scheduled = false; | 147 var reload_scheduled = false; |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 262 startListening(); | 238 startListening(); |
| 263 start = new Date(); | 239 start = new Date(); |
| 264 for (var i in cookies) { | 240 for (var i in cookies) { |
| 265 cache.add(cookies[i]); | 241 cache.add(cookies[i]); |
| 266 } | 242 } |
| 267 timer.reset(); | 243 timer.reset(); |
| 268 reloadCookieTable(); | 244 reloadCookieTable(); |
| 269 }); | 245 }); |
| 270 } | 246 } |
| 271 | 247 |
| 272 | 248 document.addEventListener('DOMContentLoaded', onload); |
| 273 </script> | 249 document.body.addEventListener('click', focusFilter); |
| 274 </head> | 250 document.querySelector('#remove_button').addEventListener('click', removeAll); |
| 275 | 251 document.querySelector('#filter_div input').addEventListener('input', reloadCook ieTable); |
| 276 <body onload="onload()" onclick="focusFilter()"> | 252 document.querySelector('#filter_div button').addEventListener('click', resetFilt er); |
|
Mike West
2012/01/26 22:16:33
80+ chars (which you already know).
You'll need t
| |
| 277 <h2>Cookies! ... Nom Nom Nom...</h2> | |
| 278 <button onclick="removeAll()">DELETE ALL!</button> | |
| 279 <div id="filter_div"> | |
| 280 Filter: <input id="filter" type="text" oninput="reloadCookieTable()"> | |
| 281 <button onclick="resetFilter()">x</button> | |
| 282 </div> | |
| 283 <br> | |
| 284 <div id="summary_div"> | |
| 285 Showing <span id="filter_count"></span> of <span id="total_count"></span> cookie domains. | |
| 286 <span id="delete_all_button"></span> | |
| 287 </div> | |
| 288 <br> | |
| 289 <table id="cookies"> | |
| 290 <tr class="header"> | |
| 291 <th>Name</th> | |
| 292 <th>#Cookies</th> | |
| 293 </tr> | |
| 294 </table> | |
| 295 | |
| 296 </body> | |
| 297 </html> | |
| OLD | NEW |