2014-06-25 05:12:07 +00:00
|
|
|
// -*- indent-tabs-mode: nil; js-indent-level: 2 -*-
|
2012-06-25 23:11:16 +00:00
|
|
|
|
|
|
|
/* 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/. */
|
2004-06-19 05:54:09 +00:00
|
|
|
|
2011-07-19 20:16:35 +00:00
|
|
|
"use strict";
|
|
|
|
|
2015-10-14 09:03:40 +00:00
|
|
|
var Cu = Components.utils;
|
|
|
|
Cu.import("resource://gre/modules/AddonManager.jsm");
|
|
|
|
|
2010-05-06 18:12:59 +00:00
|
|
|
function init() {
|
|
|
|
var addon = window.arguments[0];
|
2004-06-19 05:54:09 +00:00
|
|
|
var extensionsStrings = document.getElementById("extensionsStrings");
|
|
|
|
|
2010-10-07 00:20:06 +00:00
|
|
|
document.documentElement.setAttribute("addontype", addon.type);
|
|
|
|
|
2015-10-14 09:03:40 +00:00
|
|
|
var iconURL = AddonManager.getPreferredIconURL(addon, 48, window);
|
|
|
|
if (iconURL) {
|
2010-10-07 00:20:06 +00:00
|
|
|
var extensionIcon = document.getElementById("extensionIcon");
|
2015-10-14 09:03:40 +00:00
|
|
|
extensionIcon.src = iconURL;
|
2010-10-07 00:20:06 +00:00
|
|
|
}
|
|
|
|
|
2010-05-06 18:12:59 +00:00
|
|
|
document.title = extensionsStrings.getFormattedString("aboutWindowTitle", [addon.name]);
|
2004-06-19 05:54:09 +00:00
|
|
|
var extensionName = document.getElementById("extensionName");
|
2010-12-07 00:32:08 +00:00
|
|
|
extensionName.textContent = addon.name;
|
2010-05-06 18:12:59 +00:00
|
|
|
|
2004-06-19 05:54:09 +00:00
|
|
|
var extensionVersion = document.getElementById("extensionVersion");
|
2010-05-06 18:12:59 +00:00
|
|
|
if (addon.version)
|
|
|
|
extensionVersion.setAttribute("value", extensionsStrings.getFormattedString("aboutWindowVersionString", [addon.version]));
|
2009-09-17 09:03:33 +00:00
|
|
|
else
|
|
|
|
extensionVersion.hidden = true;
|
2010-05-06 18:12:59 +00:00
|
|
|
|
2004-06-19 05:54:09 +00:00
|
|
|
var extensionDescription = document.getElementById("extensionDescription");
|
2010-05-06 18:12:59 +00:00
|
|
|
if (addon.description)
|
|
|
|
extensionDescription.textContent = addon.description;
|
2009-09-17 09:03:33 +00:00
|
|
|
else
|
|
|
|
extensionDescription.hidden = true;
|
2010-05-06 18:12:59 +00:00
|
|
|
|
2010-10-07 00:20:06 +00:00
|
|
|
var numDetails = 0;
|
|
|
|
|
2004-06-19 05:54:09 +00:00
|
|
|
var extensionCreator = document.getElementById("extensionCreator");
|
2010-10-07 00:20:06 +00:00
|
|
|
if (addon.creator) {
|
|
|
|
extensionCreator.setAttribute("value", addon.creator);
|
|
|
|
numDetails++;
|
|
|
|
} else {
|
|
|
|
extensionCreator.hidden = true;
|
|
|
|
var extensionCreatorLabel = document.getElementById("extensionCreatorLabel");
|
|
|
|
extensionCreatorLabel.hidden = true;
|
|
|
|
}
|
2010-05-06 18:12:59 +00:00
|
|
|
|
2004-06-19 05:54:09 +00:00
|
|
|
var extensionHomepage = document.getElementById("extensionHomepage");
|
2010-05-06 18:12:59 +00:00
|
|
|
var homepageURL = addon.homepageURL;
|
|
|
|
if (homepageURL) {
|
|
|
|
extensionHomepage.setAttribute("homepageURL", homepageURL);
|
|
|
|
extensionHomepage.setAttribute("tooltiptext", homepageURL);
|
2010-10-07 00:20:06 +00:00
|
|
|
numDetails++;
|
2010-05-06 18:12:59 +00:00
|
|
|
} else {
|
2010-05-01 18:04:44 +00:00
|
|
|
extensionHomepage.hidden = true;
|
|
|
|
}
|
2010-05-06 18:12:59 +00:00
|
|
|
|
2010-10-07 00:20:06 +00:00
|
|
|
numDetails += appendToList("extensionDevelopers", "developersBox", addon.developers);
|
|
|
|
numDetails += appendToList("extensionTranslators", "translatorsBox", addon.translators);
|
|
|
|
numDetails += appendToList("extensionContributors", "contributorsBox", addon.contributors);
|
|
|
|
|
|
|
|
if (numDetails == 0) {
|
|
|
|
var groove = document.getElementById("groove");
|
|
|
|
groove.hidden = true;
|
|
|
|
var extensionDetailsBox = document.getElementById("extensionDetailsBox");
|
|
|
|
extensionDetailsBox.hidden = true;
|
|
|
|
}
|
2010-05-06 18:12:59 +00:00
|
|
|
|
2004-06-19 05:54:09 +00:00
|
|
|
var acceptButton = document.documentElement.getButton("accept");
|
|
|
|
acceptButton.label = extensionsStrings.getString("aboutWindowCloseButton");
|
2015-10-14 09:03:40 +00:00
|
|
|
|
2010-12-07 00:32:08 +00:00
|
|
|
setTimeout(sizeToContent, 0);
|
2004-06-19 05:54:09 +00:00
|
|
|
}
|
2006-07-18 00:25:57 +00:00
|
|
|
|
2010-05-06 18:12:59 +00:00
|
|
|
function appendToList(aHeaderId, aNodeId, aItems) {
|
|
|
|
var header = document.getElementById(aHeaderId);
|
|
|
|
var node = document.getElementById(aNodeId);
|
|
|
|
|
|
|
|
if (!aItems || aItems.length == 0) {
|
|
|
|
header.hidden = true;
|
2010-10-07 00:20:06 +00:00
|
|
|
return 0;
|
2010-05-06 18:12:59 +00:00
|
|
|
}
|
|
|
|
|
2012-05-27 12:21:48 +00:00
|
|
|
for (let currentItem of aItems) {
|
2010-05-06 18:12:59 +00:00
|
|
|
var label = document.createElement("label");
|
2012-05-27 12:21:48 +00:00
|
|
|
label.textContent = currentItem;
|
2010-05-06 18:12:59 +00:00
|
|
|
label.setAttribute("class", "contributor");
|
|
|
|
node.appendChild(label);
|
|
|
|
}
|
2010-10-07 00:20:06 +00:00
|
|
|
|
|
|
|
return aItems.length;
|
2010-05-06 18:12:59 +00:00
|
|
|
}
|
|
|
|
|
2006-07-21 22:10:36 +00:00
|
|
|
function loadHomepage(aEvent) {
|
2006-07-18 00:25:57 +00:00
|
|
|
window.close();
|
2010-05-06 18:12:59 +00:00
|
|
|
openURL(aEvent.target.getAttribute("homepageURL"));
|
2006-07-18 00:25:57 +00:00
|
|
|
}
|