view cs/index.html @ 134:e3dd2ebf1299

myrss2: FEEDS: add PBS NewHour, The Drive; update Nautilus; remove Roads & Kingdom
author paulo
date Mon, 14 Mar 2022 08:10:48 +0000
parents 4d3f845c4ef2
children
line source
1 <html>
2 <head>
3 <link rel="stylesheet" type="text/css" href="index.css">
4 <script type="text/javascript" src="cookies.js"></script>
5 </head>
7 <body>
8 <h1>Cookies set</h1>
9 <div id="set_cookies"></div>
10 <div>
11 <input id="set_k">
12 <input type="password" id="set_v">
13 <input type="button" value="Set" onclick="set()">
14 </div>
15 </body>
16 <script type="text/javascript">
17 var setCookiesDiv = document.getElementById("set_cookies");
18 var setK = document.getElementById("set_k");
19 var setV = document.getElementById("set_v");
21 function addSetCookie(k, v) {
22 var d = document.createElement("div");
24 var kInput = document.createElement("input");
25 kInput.disabled = true;
26 kInput.value = k;
28 var vInput = document.createElement("input");
29 vInput.type = "password";
30 vInput.disabled = true;
31 vInput.value = v;
33 var unset = document.createElement("input");
34 unset.type = "button";
35 unset.value = "Unset";
36 unset.onclick = function() {
37 docCookies.removeItem(k, "/", "pauloang.com", true);
38 setCookiesDiv.removeChild(d);
39 };
41 d.appendChild(kInput);
42 d.appendChild(vInput);
43 d.appendChild(unset);
45 setCookiesDiv.appendChild(d);
46 }
48 function clear() {
49 while (setCookiesDiv.firstChild) {
50 setCookiesDiv.removeChild(setCookiesDiv.firstChild);
51 }
52 }
54 function load() {
55 clear();
56 for (var i=0; i<docCookies.keys().length; i++) {
57 var k = docCookies.keys()[i];
58 if (docCookies.hasItem(k)) {
59 var v = docCookies.getItem(k);
60 addSetCookie(k, v);
61 }
62 }
63 }
65 function set() {
66 docCookies.setItem(setK.value, setV.value, 600, "/", "pauloang.com", true);
67 setK.value = "";
68 setV.value = "";
69 load();
70 }
72 load();
73 </script>
74 </html>