This file is indexed.

/usr/share/xul-ext/lightbeam/data/infobar.js is in xul-ext-lightbeam 1.3.1+dfsg-1ubuntu1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
(function (global) {
// Used for managing the DOM for infobar part of the page
'use strict';

var g = global;
global.initMap = function initMap(mapcanvas, mapDocument) {
  var onDragMap = false;
  var mapDragStart = {};

  var oriMapViewBox = mapcanvas.getAttribute('viewBox');

  // update info when clicking on a node in the graph visualization
  document.querySelector('#content').addEventListener('click', function (event) {
    // click could happen on .node or an element inside of .node
    if (event.target.mozMatchesSelector('.node, .node *')) {
      var node = event.target;
      var name;
      if (node.mozMatchesSelector('[type=checkbox], td [type=checkbox]')) return;
      while (node.mozMatchesSelector('.node *')) {
        node = node.parentElement;
      }
      if (node.dataset && node.dataset.isBlocked) {
        return;
      }
      name = node.getAttribute("data-name");
      selectedNodeEffect(name);
      updateInfo(name);
    }
  }, false);

  document.querySelector(".connections-list ul").addEventListener("click", function (event) {
    var name = event.target.textContent;
    var previouslySelected = document.querySelector(".connections-list ul li[data-selected]");
    if (previouslySelected) {
      document.querySelector(".connections-list ul li[data-selected]").removeAttribute("data-selected");
    }
    event.target.setAttribute("data-selected", true);
    resetAllGlow("connected");
    connectedNodeEffect(name);
  });
  var currentRequest;
  // get server info from http://freegeoip.net
  function getServerInfo(nodeName, callback) {
    var info = parseUri(nodeName); // uses Steven Levithan's parseUri 1.2.2
    var jsonURL = "http://freegeoip.net/json/" + info.host;
    var request = new XMLHttpRequest();
    currentRequest = info.host;
    request.open("GET", jsonURL, true);
    request.onload = function () {
      if (currentRequest === info.host) {
        callback((request.status === 200) ? JSON.parse(request.responseText) : false);
      }
    };
    request.send(null);
  }

  // reset map
  function resetMap() {
    var preHighlight = mapDocument.querySelectorAll(".highlight-country");
    if (preHighlight) {
      toArray(preHighlight).forEach(function (element) {
        element.classList.remove("highlight-country");
      });
    }
    mapcanvas.setAttribute("viewBox", oriMapViewBox);
  }

  // update map
  function updateMap(countryCode) {
    var countryOnMap = mapcanvas.getElementById(countryCode);
    if (!countryOnMap) {
      console.log('no country found for country code "%s"', countryCode);
      return;
    }
    countryOnMap.classList.add('highlight-country');

    // position the highlighted country in center
    var svgViewBox = mapcanvas.getAttribute("viewBox").split(" ");
    var worldDimen = mapcanvas.getBoundingClientRect();
    var countryDimen = countryOnMap.getBoundingClientRect();

    var ratio = svgViewBox[2] / worldDimen.width;
    var worldCenter = {
      x: 0.5 * worldDimen.width + worldDimen.left,
      y: 0.5 * worldDimen.height + worldDimen.top
    };
    var countryCenter = {
      x: 0.5 * countryDimen.width + countryDimen.left,
      y: 0.5 * countryDimen.height + countryDimen.top
    };

    var newViewBox = {
      x: (countryCenter.x - worldCenter.x) * ratio,
      y: (countryCenter.y - worldCenter.y) * ratio,
      w: svgViewBox[2],
      h: svgViewBox[3]
    };
    setZoom(newViewBox, mapcanvas);
  }

  document.querySelector(".pref-action .block").addEventListener('click', function (evt) {
    var site = this.dataset.siteName;
    confirmBlockSitesDialog(function (confirmed) {
      if (confirmed) {
        userSettings[site] = 'block';
        global.self.port.emit('updateBlocklist', site, true);
        showSitePref(site);
      }
    });
    evt.preventDefault();
  });

  document.querySelector(".pref-action .unblock").addEventListener('click', function (evt) {
    var site = this.dataset.siteName;
    userSettings[site] = '';
    global.self.port.emit('updateBlocklist', site, false);
    showSitePref(site);
    evt.preventDefault();
  });

  // updates info on the info panel
  function updateInfo(nodeName) {

    // get server info and then update content on the info panel
    getServerInfo(nodeName, function (data) {
      var nodeList = aggregate.nodeForKey(nodeName);
      showFavIcon(nodeName);
      showFirstAndLastAccess(nodeList[nodeName]);
      showSitePref(nodeName);
      showConnectionsList(nodeName, nodeList);
      // display site profile in Info Panel 
      showSiteProfile();
      // update map after we have loaded the SVG
      showServerLocation(data);
    });

  }

  function showFavIcon(nodeName) {
    var title = document.querySelector('.holder .title');
    while (title.childNodes.length) {
      title.removeChild(title.firstChild);
    }
    title.appendChild(elem(nodeName, {
      src: 'http://' + nodeName + '/favicon.ico',
      'class': 'favicon'
    }));
    title.appendChild(document.createTextNode(nodeName));
  }

  function showFirstAndLastAccess(site) {
    var firstAccess = formattedDate(site.firstAccess, "long");
    var lastAccess = formattedDate(site.lastAccess, "long");
    document.querySelector('.info-first-access').textContent = firstAccess;
    document.querySelector('.info-last-access').textContent = lastAccess;
  }

  function showSitePref(nodeName) {
    var prefTag = document.querySelector(".pref-tag");
    var blockButton = document.querySelector(".pref-action .block");
    var unblockButton = document.querySelector(".pref-action .unblock");
    var sitePref = userSettings[nodeName];
    if (sitePref) {
      prefTag.querySelector("img").src = "icons/lightbeam_icon_" + sitePref + ".png";
      prefTag.querySelector("span").className = "";
      prefTag.querySelector("span").classList.add(sitePref + "-text");
      prefTag.querySelector("span").textContent = (sitePref == "hide") ? "hidden" : sitePref + "ed";
      prefTag.classList.remove("hidden");
      if (sitePref == "block") {
        unblockButton.classList.remove("hidden");
        blockButton.classList.add("hidden");
      } else {
        unblockButton.classList.add("hidden");
        blockButton.classList.remove("hidden");
      }
    } else {
      prefTag.classList.add("hidden");
      unblockButton.classList.add("hidden");
      blockButton.classList.remove("hidden");
    }
    unblockButton.dataset.siteName = nodeName;
    blockButton.dataset.siteName = nodeName;
  }

  function showConnectionsList(nodeName, nodeList) {
    var htmlList = elem('ul');
    var numConnectedSites = 0;
    for (var key in nodeList) {
      if (key != nodeName) { // connected site
        htmlList.appendChild(elem('li', {}, key));
        numConnectedSites++;
      }
    }
    document.querySelector(".num-connected-sites").textContent = numConnectedSites + " " + singularOrPluralNoun(numConnectedSites, "site");

    var list = document.querySelector(".connections-list");
    list.removeChild(list.querySelector('ul'));
    list.appendChild(htmlList);
  }

  function showServerLocation(serverData) {
    if (!serverData || serverData.country_name === "Reserved") {
      document.querySelector("#country").textContent = "(Unable to find server location)";
      resetMap();
    } else {
      // update country info only when it is different from the current one
      if (serverData.country_name !== document.querySelector("#country").textContent) {
        resetMap();
        document.querySelector("#country").textContent = serverData.country_name;
        updateMap(serverData.country_code.toLowerCase());
      }
    }
  }

  function showSiteProfile() {
    var siteProfileTab = document.querySelector(".toggle-site-profile");
    var contentToBeShown = document.querySelector(".site-profile-content");
    var infoPanelOpen = document.querySelector("#content").classList.contains("showinfo");
    var siteProfileTabActive = document.querySelector(".toggle-site-profile").classList.contains("active");
    if (!infoPanelOpen) {
      document.querySelector("#content").classList.add("showinfo");
      showInfoPanelTab(siteProfileTab, contentToBeShown);
    }

    if (infoPanelOpen) {
      if (!siteProfileTabActive) {
        // make the previously active tab inactive
        deactivatePreviouslyActiveTab();
        showInfoPanelTab(siteProfileTab, contentToBeShown);
      }
    }

    document.querySelector(".toggle-site-profile").classList.remove("disabled");
  }


  /* mapcanvas events */
  mapcanvas.addEventListener("mousedown", function (event) {
    onDragMap = true;
    mapDragStart.x = event.clientX;
    mapDragStart.y = event.clientY;
  }, false);

  mapcanvas.addEventListener("mousemove", function (event) {
    if (onDragMap) {
      mapcanvas.style.cursor = "-moz-grab";
      var offsetX = (Math.ceil(event.clientX) - mapDragStart.x);
      var offsetY = (Math.ceil(event.clientY) - mapDragStart.y);
      var box = getZoom(mapcanvas);
      box.x -= (offsetX * 10);
      box.y -= (offsetY * 10);
      mapDragStart.x += offsetX;
      mapDragStart.y += offsetY;
      setZoom(box, mapcanvas);
    }

  }, false);

  mapcanvas.addEventListener("mouseup", function (event) {
    onDragMap = false;
    mapcanvas.style.cursor = "default";
  }, false);

  mapcanvas.addEventListener("mouseleave", function (event) {
    onDragMap = false;
    mapcanvas.style.cursor = "default";
  }, false);

  mapDocument.addEventListener("wheel", function (event) {
    if (event.target.mozMatchesSelector(".mapcanvas, .mapcanvas *")) {
      zoomWithinLimit(event, mapcanvas, mapZoomInLimit, mapZoomOutLimit);
    }
  }, false);


};


/* Info Panel Tabs ======================================== */


/* Toggle Site Profile */
document.querySelector(".toggle-site-profile").addEventListener("click", function () {
  var tabClicked = document.querySelector(".toggle-site-profile");
  if (!tabClicked.classList.contains("disabled")) {
    var contentToBeShown = document.querySelector(".site-profile-content");
    toggleInfoPanelTab(tabClicked, contentToBeShown);
  }
});

/* Toggle About */
document.querySelector(".toggle-about").addEventListener("click", function () {
  var tabClicked = document.querySelector(".toggle-about");
  var contentToBeShown = document.querySelector(".about-content");
  toggleInfoPanelTab(tabClicked, contentToBeShown);
});

/* Toggle Help Sections */
global.helpOnClick = function helpOnClick() {
  var tabClicked = document.querySelector(".toggle-help");
  var contentToBeShown = document.querySelector(".help-content ." + global.currentVisualization.name + "-view-help");
  toggleInfoPanelTab(tabClicked, contentToBeShown);
};

document.querySelector(".toggle-help").addEventListener("click", helpOnClick);


function toggleInfoPanelTab(tabClicked, contentToBeShown) {
  var infoPanelOpen = document.querySelector("#content").classList.contains("showinfo");
  var isActiveTab = tabClicked.classList.contains("active");
  if (infoPanelOpen) {
    if (isActiveTab) { // collapse info panel
      document.querySelector("#content").classList.remove("showinfo");
      tabClicked.classList.remove("active");
      tabClicked.querySelector("img").classList.remove("hidden");
      tabClicked.querySelector("i").classList.add("hidden");
    } else {
      // make the previously active tab inactive
      deactivatePreviouslyActiveTab();
      // make the selected tab active
      showInfoPanelTab(tabClicked, contentToBeShown);
    }
  } else {
    // open the info panel and make the selected tab active
    document.querySelector("#content").classList.add("showinfo");
    showInfoPanelTab(tabClicked, contentToBeShown);
  }
}


function deactivatePreviouslyActiveTab() {
  var previouslyActiveTab = document.querySelector(".info-panel-controls ul li.active");
  if (previouslyActiveTab) {
    previouslyActiveTab.classList.remove("active");
    previouslyActiveTab.querySelector("img").classList.remove("hidden");
    previouslyActiveTab.querySelector("i").classList.add("hidden");
  }
}


// make the selected tab active
function showInfoPanelTab(tabClicked, contentToBeShown) {
  tabClicked.classList.add("active");
  tabClicked.querySelector("img").classList.add("hidden");
  tabClicked.querySelector("i").classList.remove("hidden");
  hideAllInfoPanelContentExcept(contentToBeShown);
}


function hideAllInfoPanelContentExcept(elmToShow) {
  document.querySelector(".site-profile-content").classList.add("hidden");
  document.querySelector(".help-content .graph-view-help").classList.add("hidden");
  document.querySelector(".help-content .list-view-help").classList.add("hidden");
  document.querySelector(".about-content").classList.add("hidden");
  if (elmToShow) {
    elmToShow.classList.remove("hidden");
  }
}

})(this);