| OLD | NEW |
| 1 <html> | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 <head> | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 <style> | 3 // found in the LICENSE file. |
| 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 | 4 |
| 25 if (!chrome.cookies) { | 5 if (!chrome.cookies) { |
| 26 chrome.cookies = chrome.experimental.cookies; | 6 chrome.cookies = chrome.experimental.cookies; |
| 27 } | 7 } |
| 28 | 8 |
| 29 // A simple Timer class. | 9 // A simple Timer class. |
| 30 function Timer() { | 10 function Timer() { |
| 31 this.start_ = new Date(); | 11 this.start_ = new Date(); |
| 32 | 12 |
| 33 this.elapsed = function() { | 13 this.elapsed = function() { |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 }); | 128 }); |
| 149 } | 129 } |
| 150 | 130 |
| 151 function removeCookie(cookie) { | 131 function removeCookie(cookie) { |
| 152 var url = "http" + (cookie.secure ? "s" : "") + "://" + cookie.domain + | 132 var url = "http" + (cookie.secure ? "s" : "") + "://" + cookie.domain + |
| 153 cookie.path; | 133 cookie.path; |
| 154 chrome.cookies.remove({"url": url, "name": cookie.name}); | 134 chrome.cookies.remove({"url": url, "name": cookie.name}); |
| 155 } | 135 } |
| 156 | 136 |
| 157 function removeCookiesForDomain(domain) { | 137 function removeCookiesForDomain(domain) { |
| 158 var timer = new Timer(); | 138 var timer = new Timer(); |
| 159 cache.getCookies(domain).forEach(function(cookie) { | 139 cache.getCookies(domain).forEach(function(cookie) { |
| 160 removeCookie(cookie); | 140 removeCookie(cookie); |
| 161 }); | 141 }); |
| 162 } | 142 } |
| 163 | 143 |
| 164 function resetTable() { | 144 function resetTable() { |
| 165 var table = select("#cookies"); | 145 var table = select("#cookies"); |
| 166 while (table.rows.length > 1) { | 146 while (table.rows.length > 1) { |
| 167 table.deleteRow(table.rows.length - 1); | 147 table.deleteRow(table.rows.length - 1); |
| 168 } | 148 } |
| 169 } | 149 } |
| 170 | 150 |
| 171 var reload_scheduled = false; | 151 var reload_scheduled = false; |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 262 startListening(); | 242 startListening(); |
| 263 start = new Date(); | 243 start = new Date(); |
| 264 for (var i in cookies) { | 244 for (var i in cookies) { |
| 265 cache.add(cookies[i]); | 245 cache.add(cookies[i]); |
| 266 } | 246 } |
| 267 timer.reset(); | 247 timer.reset(); |
| 268 reloadCookieTable(); | 248 reloadCookieTable(); |
| 269 }); | 249 }); |
| 270 } | 250 } |
| 271 | 251 |
| 272 | 252 document.addEventListener('DOMContentLoaded', function() { |
| 273 </script> | 253 onload(); |
| 274 </head> | 254 document.body.addEventListener('click', focusFilter); |
| 275 | 255 document.querySelector('#remove_button').addEventListener('click', removeAll); |
| 276 <body onload="onload()" onclick="focusFilter()"> | 256 document.querySelector('#filter_div input').addEventListener( |
| 277 <h2>Cookies! ... Nom Nom Nom...</h2> | 257 'input', reloadCookieTable); |
| 278 <button onclick="removeAll()">DELETE ALL!</button> | 258 document.querySelector('#filter_div button').addEventListener( |
| 279 <div id="filter_div"> | 259 'click', resetFilter); |
| 280 Filter: <input id="filter" type="text" oninput="reloadCookieTable()"> | 260 }); |
| 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 |