41 getService(Components.interfaces.nsINavHistoryService);
48 BW_frame = document.getElementById(
"theframe");
50 var
options = BW_historyService.getNewQueryOptions();
51 options.sortingMode = options.SORT_BY_DATE_DESCENDING;
52 options.resultType = options.RESULTS_AS_VISIT;
53 options.maxResults = 200;
54 var query = BW_historyService.getNewQuery();
55 BW_result = BW_historyService.executeQuery(query, options);
56 BW_result.root.containerOpen =
true;
58 BW_frame.contentWindow.addEventListener(
"load",
BW_fill,
true);
60 if (loadedIframe && loadedBretts)
69 if (loadedIframe && loadedBretts)
76 for (var
i = host.length - 2;
i > 0;
i --) {
80 return host.substr(
i + 1);
94 BW_frame.setAttribute(
'onload',
'');
96 var container = BW_result.root;
97 var length = container.childCount;
98 dump(
"doc = " + BW_frame.contentDocument +
"\n");
99 var
doc = BW_frame.contentDocument;
101 var
ios = Components.classes[
"@mozilla.org/network/io-service;1"].
102 getService(Components.interfaces.nsIIOService);
103 var dateformat = Components.classes[
"@mozilla.org/intl/scriptabledateformat;1"]
104 .getService(Components.interfaces.nsIScriptableDateFormat);
106 var table = doc.createElement(
'table');
107 doc.body.appendChild(table);
109 var counts =
new Array(240);
110 for (var
i = 0;
i < counts.length;
i ++) {
114 var
now =
new Date();
118 now.setMilliseconds(0);
119 now.setDate(now.getDate()+1);
120 var tonightUS = now.getTime() * 1000;
121 var usPerHour = 3600000000;
123 var previousSession = -1;
124 var previousMS = 18437736874454810627;
125 var previousHost =
"";
126 for (var
i = 0;
i < length;
i ++) {
127 var child = container.getChild(
i);
128 child.QueryInterface(Components.interfaces.nsINavHistoryVisitResultNode);
131 var thisBin = Math.floor((tonightUS - child.time) / usPerHour);
132 if (thisBin >= 0 && thisBin < counts.length) {
133 counts[thisBin] = counts[thisBin] + 1;
136 var ms = child.time / 1000;
137 var addedTime =
false;
138 if (previousMS - ms > 600000) {
140 var
t =
new Date(ms);
141 var tr = doc.createElement(
'tr');
142 table.appendChild(tr);
143 var
td = doc.createElement(
'td');
144 td.setAttribute(
'colspan',
'2');
145 td.setAttribute(
'class',
'time');
148 var timestring = dateformat.FormatDateTime(
"",
149 dateformat.dateFormatShort,
150 dateformat.timeFormatNoSeconds,
157 var timetext = doc.createTextNode(timestring);
158 td.appendChild(timetext);
162 var tr = doc.createElement(
'tr');
163 table.appendChild(tr);
177 var
td = doc.createElement(
'td');
178 td.setAttribute(
'valign',
'top');
179 td.setAttribute(
'align',
'right');
180 td.setAttribute(
'class',
'host');
183 if (addedTime || host != previousHost) {
185 var hosttext = doc.createTextNode(host);
186 td.appendChild(hosttext);
191 var td = doc.createElement(
'td');
192 td.setAttribute(
'valign',
'top');
195 if (! addedTime && (
i == 0 || child.sessionId != previousSession))
196 td.setAttribute(
'class',
'itemnew');
198 td.setAttribute(
'class',
'item');
202 var titlediv = doc.createElement(
'div');
203 titlediv.setAttribute(
'class',
'title');
205 var imgelt = doc.createElement(
'img');
207 imgelt.setAttribute(
'src', child.icon.spec);
209 imgelt.setAttribute(
'src',
'chrome://browser/skin/places/defaultFavicon.png');
210 imgelt.setAttribute(
'width', 16);
211 imgelt.setAttribute(
'height', 16);
212 imgelt.setAttribute(
'class',
'favicon');
213 titlediv.appendChild(imgelt);
215 var titletext = doc.createTextNode(child.title);
216 titlediv.appendChild(titletext);
217 td.appendChild(titlediv);
242 var urldiv = doc.createElement(
'div');
243 urldiv.setAttribute(
'class',
'url');
244 var urltext = doc.createTextNode(spec);
245 urldiv.appendChild(urltext);
246 td.appendChild(urldiv);
251 var counts2 =
new Array(counts.length);
252 for (var
i = 0;
i < counts.length;
i ++) {
255 for (var j = -2; j <= 2; j ++) {
256 if (
i + j < 0)
continue;
257 if (
i + j >= counts.length)
continue;
259 if (j == -2 || j == 2) scale = 0.33;
260 else if (j == -1 || j == 1) scale = 0.66;
262 acc += counts[
i+j] * scale;
265 counts2[
i] = Math.round(acc);
269 var daylist = document.getElementById(
"daylist");
270 for (var
i = 0;
i < counts2.length / 24;
i ++) {
271 var
day = document.createElement(
'hbox');
272 day.setAttribute(
'align',
'center');
274 day.setAttribute(
'class',
'day2');
276 day.setAttribute(
'class',
'day1');
277 daylist.appendChild(day);
279 var text = document.createTextNode(
"Today - " +
i );
280 var description = document.createElement(
'description');
281 description.setAttribute(
'flex',
'1');
282 description.appendChild(text);
283 day.appendChild(description);
285 var bars = document.createElement(
'vbox');
286 bars.setAttribute(
'align',
'end');
287 day.appendChild(bars);
289 for (var b = 0; b < 24; b++) {
290 var box = document.createElement(
'hbox');
291 box.setAttribute(
'width',
'' + counts2[
i*24 + b]);
292 box.setAttribute(
'height',
'1');
293 box.setAttribute(
'class',
'green');
294 bars.appendChild(box);
function doc() browser.contentDocument
getService(Ci.sbIFaceplateManager)
_getSelectedPageStyle s i