Index: chrome/common/extensions/docs/examples/api/cookies/manager.js |
diff --git a/chrome/common/extensions/docs/examples/api/cookies/manager.html b/chrome/common/extensions/docs/examples/api/cookies/manager.js |
similarity index 83% |
copy from chrome/common/extensions/docs/examples/api/cookies/manager.html |
copy to chrome/common/extensions/docs/examples/api/cookies/manager.js |
index 8c644c92edbbb734f059ae473f1cab87f7ed2825..6fa16d80c15eeab09cfc9dd782ac747c0a413da8 100644 |
--- a/chrome/common/extensions/docs/examples/api/cookies/manager.html |
+++ b/chrome/common/extensions/docs/examples/api/cookies/manager.js |
@@ -1,26 +1,6 @@ |
-<html> |
-<head> |
-<style> |
-table { |
- border-collapse:collapse; |
-} |
- |
-td { |
- border: 1px solid black; |
- padding-left: 5px; |
-} |
- |
-td.button { |
- border: none; |
-} |
- |
-td.cookie_count { |
- text-align: right; |
-} |
- |
-</style> |
- |
-<script> |
+// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
if (!chrome.cookies) { |
chrome.cookies = chrome.experimental.cookies; |
@@ -155,10 +135,10 @@ function removeCookie(cookie) { |
} |
function removeCookiesForDomain(domain) { |
- var timer = new Timer(); |
- cache.getCookies(domain).forEach(function(cookie) { |
+ var timer = new Timer(); |
+ cache.getCookies(domain).forEach(function(cookie) { |
removeCookie(cookie); |
- }); |
+ }); |
} |
function resetTable() { |
@@ -269,29 +249,12 @@ function onload() { |
}); |
} |
- |
-</script> |
-</head> |
- |
-<body onload="onload()" onclick="focusFilter()"> |
-<h2>Cookies! ... Nom Nom Nom...</h2> |
-<button onclick="removeAll()">DELETE ALL!</button> |
-<div id="filter_div"> |
-Filter: <input id="filter" type="text" oninput="reloadCookieTable()"> |
-<button onclick="resetFilter()">x</button> |
-</div> |
-<br> |
-<div id="summary_div"> |
-Showing <span id="filter_count"></span> of <span id="total_count"></span> cookie domains. |
-<span id="delete_all_button"></span> |
-</div> |
-<br> |
-<table id="cookies"> |
-<tr class="header"> |
-<th>Name</th> |
-<th>#Cookies</th> |
-</tr> |
-</table> |
- |
-</body> |
-</html> |
+document.addEventListener('DOMContentLoaded', function() { |
+ onload(); |
+ document.body.addEventListener('click', focusFilter); |
+ document.querySelector('#remove_button').addEventListener('click', removeAll); |
+ document.querySelector('#filter_div input').addEventListener( |
+ 'input', reloadCookieTable); |
+ document.querySelector('#filter_div button').addEventListener( |
+ 'click', resetFilter); |
+}); |