зеркало из https://github.com/mozilla/pjs.git
More extensions FE stuff (170006) not used yet
This commit is contained in:
Родитель
692654b112
Коммит
5b6153f52a
|
@ -0,0 +1,112 @@
|
|||
|
||||
function EM_NS(aProperty)
|
||||
{
|
||||
return "http://www.mozilla.org/2004/em-rdf#" + aProperty;
|
||||
}
|
||||
|
||||
var gExtensionID = "";
|
||||
var gExtensionDB = null;
|
||||
|
||||
function init()
|
||||
{
|
||||
gExtensionID = window.arguments[0];
|
||||
gExtensionDB = window.arguments[1];
|
||||
|
||||
var extensionsStrings = document.getElementById("extensionsStrings");
|
||||
|
||||
var rdfs = Components.classes["@mozilla.org/rdf/rdf-service;1"]
|
||||
.getService(Components.interfaces.nsIRDFService);
|
||||
|
||||
var extension = rdfs.GetResource(gExtensionID);
|
||||
|
||||
// Name
|
||||
var nameArc = rdfs.GetResource(EM_NS("name"));
|
||||
var name = gExtensionDB.GetTarget(extension, nameArc, true);
|
||||
name = name.QueryInterface(Components.interfaces.nsIRDFLiteral).Value;
|
||||
// Version
|
||||
var versionArc = rdfs.GetResource(EM_NS("version"));
|
||||
var version = gExtensionDB.GetTarget(extension, versionArc, true);
|
||||
version = version.QueryInterface(Components.interfaces.nsIRDFLiteral).Value;
|
||||
// Description
|
||||
var descriptionArc = rdfs.GetResource(EM_NS("description"));
|
||||
var description = gExtensionDB.GetTarget(extension, descriptionArc, true);
|
||||
description = description.QueryInterface(Components.interfaces.nsIRDFLiteral).Value;
|
||||
// Home Page URL
|
||||
var homepageArc = rdfs.GetResource(EM_NS("homepageURL"));
|
||||
var homepage = gExtensionDB.GetTarget(extension, homepageArc, true);
|
||||
homepage = homepage.QueryInterface(Components.interfaces.nsIRDFLiteral).Value;
|
||||
// Creator
|
||||
var creatorArc = rdfs.GetResource(EM_NS("creator"));
|
||||
var creator = gExtensionDB.GetTarget(extension, creatorArc, true);
|
||||
creator = creator.QueryInterface(Components.interfaces.nsIRDFLiteral).Value;
|
||||
|
||||
document.documentElement.setAttribute("title", extensionsStrings.getFormattedString("aboutWindowTitle", [name]));
|
||||
var extensionName = document.getElementById("extensionName");
|
||||
extensionName.setAttribute("value", name);
|
||||
var extensionVersion = document.getElementById("extensionVersion");
|
||||
extensionVersion.setAttribute("value", extensionsStrings.getFormattedString("aboutWindowVersionString", [version]));
|
||||
|
||||
var extensionDescription = document.getElementById("extensionDescription");
|
||||
extensionDescription.appendChild(document.createTextNode(description));
|
||||
|
||||
var extensionCreator = document.getElementById("extensionCreator");
|
||||
extensionCreator.setAttribute("value", creator);
|
||||
|
||||
var extensionHomepage = document.getElementById("extensionHomepage");
|
||||
extensionHomepage.setAttribute("href", homepage);
|
||||
extensionHomepage.setAttribute("tooltiptext", homepage);
|
||||
|
||||
var contributorsBox = document.getElementById("contributorsBox");
|
||||
var contributorsArc = rdfs.GetResource(EM_NS("contributor"));
|
||||
var contributors = gExtensionDB.GetTargets(extension, contributorsArc, true);
|
||||
var count = 0;
|
||||
while (contributors.hasMoreElements()) {
|
||||
var contributor = contributors.getNext().QueryInterface(Components.interfaces.nsIRDFLiteral).Value;
|
||||
var label = document.createElement("label");
|
||||
label.setAttribute("value", contributor);
|
||||
label.setAttribute("class", "contributor");
|
||||
contributorsBox.appendChild(label);
|
||||
++count;
|
||||
}
|
||||
if (count == 0)
|
||||
document.getElementById("extensionContributors").hidden = true;
|
||||
|
||||
var acceptButton = document.documentElement.getButton("accept");
|
||||
acceptButton.label = extensionsStrings.getString("aboutWindowCloseButton");
|
||||
}
|
||||
|
||||
# -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
#
|
||||
# The contents of this file are subject to the Mozilla Public License Version
|
||||
# 1.1 (the "License"); you may not use this file except in compliance with
|
||||
# the License. You may obtain a copy of the License at
|
||||
# http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
# for the specific language governing rights and limitations under the
|
||||
# License.
|
||||
#
|
||||
# The Original Code is The Extension Manager.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Ben Goodger.
|
||||
# Portions created by the Initial Developer are Copyright (C) 2004
|
||||
# the Initial Developer. All Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
# Ben Goodger <ben@bengoodger.com>
|
||||
#
|
||||
# Alternatively, the contents of this file may be used under the terms of
|
||||
# either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
# in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
# of those above. If you wish to allow use of your version of this file only
|
||||
# under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
# use your version of this file under the terms of the MPL, indicate your
|
||||
# decision by deleting the provisions above and replace them with the notice
|
||||
# and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
# the provisions above, a recipient may use your version of this file under
|
||||
# the terms of any one of the MPL, the GPL or the LGPL.
|
||||
#
|
||||
# ***** END LICENSE BLOCK *****
|
|
@ -37,10 +37,37 @@
|
|||
# ***** END LICENSE BLOCK *****
|
||||
|
||||
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://mozapps/skin/extensions/about.css" type="text/css"?>
|
||||
|
||||
<!DOCTYPE dialog SYSTEM "chrome://mozapps/locale/extensions/about.dtd">
|
||||
|
||||
<dialog id="genericAbout"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
buttons="accept" onload="init();" onaccept="close();">
|
||||
|
||||
<script type="application/x-javascript" src="chrome://mozapps/content/extensions/about.js"/>
|
||||
|
||||
<stringbundleset id="aboutSet">
|
||||
<stringbundle id="extensionsStrings" src="chrome://mozapps/locale/extensions/extensions.properties"/>
|
||||
</stringbundleset>
|
||||
|
||||
<vbox id="clientBox" flex="1">
|
||||
<label id="extensionName" crop="right"/>
|
||||
<label id="extensionVersion" crop="right"/>
|
||||
<description id="extensionDescription"/>
|
||||
|
||||
<label id="extensionCreatorLabel">&creator.label;</label>
|
||||
<hbox id="creatorBox">
|
||||
<label id="extensionCreator" flex="1" crop="right"/>
|
||||
<label id="extensionHomepage" onclick="window.opener.openURL(event.target.getAttribute('href'));">&homepage.label;</label>
|
||||
</hbox>
|
||||
|
||||
<label id="extensionContributors">&contributors.label;</label>
|
||||
<vbox flex="1" id="contributorsBox"/>
|
||||
</vbox>
|
||||
|
||||
<separator id="groove" class="groove"/>
|
||||
|
||||
</dialog>
|
||||
|
||||
|
|
@ -102,55 +102,98 @@ function fireEventForElement(aElement, aEventType)
|
|||
|
||||
function onExtensionViewOptions(aEvent)
|
||||
{
|
||||
var optionsURL = aEvent.target.getAttribute("optionsURL");
|
||||
var optionsURL = gExtensionsView.selected.getAttribute("optionsURL");
|
||||
if (optionsURL != "")
|
||||
openDialog(optionsURL, "", "chrome,modal");
|
||||
}
|
||||
|
||||
function onExtensionVisitHomepage(aEvent)
|
||||
{
|
||||
var homepageURL = aEvent.target.getAttribute("homepageURL");
|
||||
if (homepageURL != "") {
|
||||
dump("*** attempting to load " + homepageURL + "\n");
|
||||
var uri = Components.classes["@mozilla.org/network/standard-url;1"]
|
||||
.createInstance(Components.interfaces.nsIURI);
|
||||
uri.spec = homepageURL;
|
||||
var homepageURL = gExtensionsView.selected.getAttribute("homepageURL");
|
||||
if (homepageURL != "")
|
||||
openURL(homepageURL);
|
||||
}
|
||||
|
||||
function openURL(aURL)
|
||||
{
|
||||
# If we're not a browser, use the external protocol service to load the URI.
|
||||
#ifndef MOZ_PHOENIX
|
||||
var protocolSvc = Components.classes["@mozilla.org/uriloader/external-protocol-service;1"]
|
||||
.getService(Components.interfaces.nsIExternalProtocolService);
|
||||
if (protocolSvc.isExposedProtocol(uri.scheme))
|
||||
protocolSvc.loadUrl(uri);
|
||||
var uri = Components.classes["@mozilla.org/network/standard-url;1"]
|
||||
.createInstance(Components.interfaces.nsIURI);
|
||||
uri.spec = aURL;
|
||||
|
||||
var protocolSvc = Components.classes["@mozilla.org/uriloader/external-protocol-service;1"]
|
||||
.getService(Components.interfaces.nsIExternalProtocolService);
|
||||
if (protocolSvc.isExposedProtocol(uri.scheme))
|
||||
protocolSvc.loadUrl(uri);
|
||||
# If we're a browser, open a new browser window instead.
|
||||
#else
|
||||
openDialog("chrome://browser/content/browser.xul", "_blank", "chrome,all,dialog=no", homepageURL, null, null);
|
||||
openDialog("chrome://browser/content/browser.xul", "_blank", "chrome,all,dialog=no", aURL, null, null);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
function onExtensionViewAbout(aEvent)
|
||||
{
|
||||
var aboutURL = aEvent.target.getAttribute("aboutURL");
|
||||
var aboutURL = gExtensionsView.selected.getAttribute("aboutURL");
|
||||
if (aboutURL != "")
|
||||
openDialog(aboutURL, "", "chrome,modal");
|
||||
else
|
||||
openDialog("chrome://mozapps/content/extensions/about.xul", "", "chrome,modal", aEvent.target.id);
|
||||
openDialog("chrome://mozapps/content/extensions/about.xul", "", "chrome,modal", gExtensionsView.selected.id, gExtensionsView.database);
|
||||
}
|
||||
|
||||
function onExtensionMoveTop(aEvent)
|
||||
{
|
||||
var rdfs = Components.classes["@mozilla.org/rdf/rdf-service;1"].getService(Components.interfaces.nsIRDFService);
|
||||
|
||||
var extensions = rdfs.GetResource("urn:mozilla:extension:root");
|
||||
var container = Components.classes["@mozilla.org/rdf/container;1"].createInstance(Components.interfaces.nsIRDFContainer);
|
||||
container.Init(gExtensionManager.datasource, extensions);
|
||||
|
||||
var extension = rdfs.GetResource(aEvent.target.id);
|
||||
var index = container.IndexOf(extension);
|
||||
if (index > 1) {
|
||||
container.RemoveElement(extension, false);
|
||||
container.InsertElementAt(extension, 1, true);
|
||||
}
|
||||
|
||||
flushDataSource();
|
||||
}
|
||||
|
||||
function onExtensionMoveUp(aEvent)
|
||||
{
|
||||
var rdfs = Components.classes["@mozilla.org/rdf/rdf-service;1"].getService(Components.interfaces.nsIRDFService);
|
||||
|
||||
var extensions = rdfs.GetResource("urn:mozilla:extension:root");
|
||||
var container = Components.classes["@mozilla.org/rdf/container;1"].createInstance(Components.interfaces.nsIRDFContainer);
|
||||
container.Init(gExtensionManager.datasource, extensions);
|
||||
|
||||
var extension = rdfs.GetResource(aEvent.target.id);
|
||||
var index = container.IndexOf(extension);
|
||||
if (index > 1) {
|
||||
container.RemoveElement(extension, false);
|
||||
container.InsertElementAt(extension, index - 1, true);
|
||||
}
|
||||
|
||||
flushDataSource();
|
||||
}
|
||||
|
||||
function onExtensionMoveDown(aEvent)
|
||||
{
|
||||
var rdfs = Components.classes["@mozilla.org/rdf/rdf-service;1"].getService(Components.interfaces.nsIRDFService);
|
||||
|
||||
var extensions = rdfs.GetResource("urn:mozilla:extension:root");
|
||||
var container = Components.classes["@mozilla.org/rdf/container;1"].createInstance(Components.interfaces.nsIRDFContainer);
|
||||
container.Init(gExtensionManager.datasource, extensions);
|
||||
|
||||
var extension = rdfs.GetResource(aEvent.target.id);
|
||||
var index = container.IndexOf(extension);
|
||||
var count = container.GetCount();
|
||||
if (index < count) {
|
||||
container.RemoveElement(extension, false);
|
||||
container.InsertElementAt(extension, index + 1, true);
|
||||
}
|
||||
|
||||
flushDataSource();
|
||||
}
|
||||
|
||||
function onExtensionUpdate(aEvent)
|
||||
|
@ -168,6 +211,14 @@ function onExtensionUninstall(aEvent)
|
|||
|
||||
}
|
||||
|
||||
function flushDataSource()
|
||||
{
|
||||
#if 0
|
||||
var rds = gExtensionManager.datasource.QueryInterface(Components.interfaces.nsIRDFDataSource);
|
||||
if (rds)
|
||||
rds.Flush();
|
||||
#endif
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Startup, Shutdown
|
||||
|
@ -196,7 +247,7 @@ function Startup()
|
|||
gExtensionsView.addEventListener("extension-disable", onExtensionEnableDisable, false);
|
||||
gExtensionsView.addEventListener("extension-move-top", onExtensionMoveTop, false);
|
||||
gExtensionsView.addEventListener("extension-move-up", onExtensionMoveUp, false);
|
||||
gExtensionsView.addEventListener("extension-move-dn", onExtensionMoveDn, false);
|
||||
gExtensionsView.addEventListener("extension-move-dn", onExtensionMoveDown, false);
|
||||
|
||||
// Finally, update the UI.
|
||||
gExtensionsView.database.AddDataSource(gExtensionManager.datasource);
|
||||
|
@ -229,9 +280,17 @@ function buildContextMenu(aEvent)
|
|||
popup.removeChild(popup.firstChild);
|
||||
|
||||
var menus = gWindowState == "extensions" ? gExtensionContextMenus : gThemeContextMenus;
|
||||
for (var i = 0; i < menus.length; ++i)
|
||||
popup.appendChild(document.getElementById(menus[i]).cloneNode(true));
|
||||
for (var i = 0; i < menus.length; ++i) {
|
||||
var clonedMenu = document.getElementById(menus[i]).cloneNode(true);
|
||||
clonedMenu.id = clonedMenu.id + "_clone";
|
||||
popup.appendChild(clonedMenu);
|
||||
}
|
||||
|
||||
var extensionsStrings = document.getElementById("extensionsStrings");
|
||||
var menuitem_about = document.getElementById("menuitem_about_clone");
|
||||
var name = document.popupNode.getAttribute("name");
|
||||
menuitem_about.setAttribute("label", extensionsStrings.getFormattedString("aboutExtension", [name]));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -63,8 +63,9 @@
|
|||
</stringbundleset>
|
||||
|
||||
<keyset id="extensionsKeys">
|
||||
<key id="key_close" key="&cmd.close.commandKey;" oncommand="closeWindow(true);" modifiers="accel"/>
|
||||
<key id="key_info" key="&cmd.info.commandKey;" oncommand="onExtensionsShowInfo();" modifiers="accel"/>
|
||||
<key id="key_close" key="&cmd.close.commandKey;" oncommand="closeWindow(true);" modifiers="accel"/>
|
||||
<key id="key_info" key="&cmd.info.commandKey;" oncommand="onExtensionViewAbout();" modifiers="accel"/>
|
||||
<key id="key_options" key="&cmd.options.commandKey;" oncommand="onExtensionViewOptions();" modifiers="accel"/>
|
||||
</keyset>
|
||||
|
||||
<vbox id="contextMenuPalette" hidden="true">
|
||||
|
|
|
@ -1,54 +1,7 @@
|
|||
<!ENTITY name.label "Name">
|
||||
<!ENTITY progress.label "Progress">
|
||||
<!ENTITY status.label "Status">
|
||||
<!ENTITY timeremaining.label "Time Remaining">
|
||||
<!ENTITY transferred.label "Transferred">
|
||||
<!ENTITY transferrate.label "Speed">
|
||||
<!ENTITY timeelapsed.label "Time Elapsed">
|
||||
<!ENTITY status.label "Status">
|
||||
<!--<!ENTITY progresstext.label "%">-->
|
||||
<!ENTITY source.label "Source">
|
||||
|
||||
<!ENTITY done.label "Done">
|
||||
<!ENTITY cancel.label "Cancel">
|
||||
<!ENTITY canceled.label "Canceled">
|
||||
<!ENTITY launch.label "Launch">
|
||||
<!ENTITY divider.label "-">
|
||||
<!ENTITY show.label "Show">
|
||||
<!ENTITY open.label "Open">
|
||||
<!ENTITY retry.label "Retry">
|
||||
<!ENTITY remove.label "Remove">
|
||||
<!ENTITY pause.label "Pause">
|
||||
<!ENTITY resume.label "Resume">
|
||||
|
||||
<!ENTITY installing.label "Installing...">
|
||||
<!ENTITY pending.label "Queued, please wait...">
|
||||
<!ENTITY failed.label "Failed">
|
||||
|
||||
<!ENTITY extensions.title "Extensions">
|
||||
|
||||
<!ENTITY cmd.pause.label "Pause">
|
||||
<!ENTITY cmd.pause.accesskey "P">
|
||||
<!ENTITY cmd.resume.label "Resume">
|
||||
<!ENTITY cmd.resume.accesskey "R">
|
||||
<!ENTITY cmd.cancel.label "Cancel">
|
||||
<!ENTITY cmd.cancel.accesskey "C">
|
||||
<!ENTITY cmd.show.label "Show">
|
||||
<!ENTITY cmd.show.accesskey "S">
|
||||
<!ENTITY cmd.show.tooltipWin "Show this file in Explorer">
|
||||
<!ENTITY cmd.show.tooltipMac "Show this file in Finder">
|
||||
<!ENTITY cmd.show.tooltipUnix "Show this file in a browser window">
|
||||
<!ENTITY cmd.open.label "Open">
|
||||
<!ENTITY cmd.open.accesskey "O">
|
||||
<!ENTITY cmd.openWith.label "Open With...">
|
||||
<!ENTITY cmd.openWith.accesskey "h">
|
||||
<!ENTITY cmd.retry.label "Retry">
|
||||
<!ENTITY cmd.retry.accesskey "R">
|
||||
<!ENTITY cmd.remove.label "Remove">
|
||||
<!ENTITY cmd.remove.accesskey "e">
|
||||
<!ENTITY cmd.properties.label "Properties">
|
||||
<!ENTITY cmd.properties.accesskey "i">
|
||||
<!ENTITY cmd.info.commandKey "i">
|
||||
<!ENTITY cmd.options.commandKey ",">
|
||||
|
||||
<!ENTITY cmd.close.commandKey "w">
|
||||
|
||||
|
@ -66,7 +19,7 @@
|
|||
<!ENTITY cmd.homepage.label "Visit Home Page">
|
||||
<!ENTITY cmd.homepage.accesskey "H">
|
||||
<!ENTITY cmd.about.label "About this Extension">
|
||||
<!ENTITY cmd.about.accesskey "E">
|
||||
<!ENTITY cmd.about.accesskey "A">
|
||||
<!ENTITY cmd.uninstall.label "Uninstall">
|
||||
<!ENTITY cmd.uninstall.accesskey "i">
|
||||
<!ENTITY cmd.update.label "Update">
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
aboutWindowTitle=About %S
|
||||
aboutWindowCloseButton=Close
|
||||
aboutWindowVersionString=version %S
|
||||
aboutExtension=About %S...
|
|
@ -32,10 +32,12 @@ en-US.jar:
|
|||
locale/en-US/mozapps/downloads/downloadProperties.dtd (downloads/locale/downloadProperties.dtd)
|
||||
locale/en-US/mozapps/extensions/extensions.dtd (extensions/locale/extensions.dtd)
|
||||
locale/en-US/mozapps/extensions/extensions.properties (extensions/locale/extensions.properties)
|
||||
locale/en-US/mozapps/extensions/about.dtd (extensions/locale/about.dtd)
|
||||
locale/en-US/mozapps/contents.rdf (contents-locale.rdf)
|
||||
|
||||
classic.jar:
|
||||
skin/classic/mozapps/extensions/extensions.css (extensions/skin/extensions.css)
|
||||
skin/classic/mozapps/extensions/about.css (extensions/skin/about.css)
|
||||
skin/classic/mozapps/shared/richview.xml (shared/skin/richview.xml)
|
||||
skin/classic/mozapps/shared/richview.css (shared/skin/richview.css)
|
||||
skin/classic/mozapps/shared/viewFader.png (shared/skin/viewFader.png)
|
||||
|
|
Загрузка…
Ссылка в новой задаче