broke browser.js apart into overlays

added basic support for proposal 8
started to add support for proposal 6 download UI
original proposal 6 code is still buildable too

--HG--
branch : mobile
extra : convert_revision : svn%3A4eb1ac78-321c-0410-a911-ec516a8615a5/projects/fennec/mobile%4012789
This commit is contained in:
mfinkle@mozilla.com 2008-05-02 20:15:45 +00:00
Родитель ca89729ee8
Коммит 47abbbdc65
23 изменённых файлов: 1796 добавлений и 465 удалений

Просмотреть файл

@ -8,7 +8,7 @@ Copyright=Copyright (c) 2008 Mozilla.org
ID={a23983c0-fd0e-11dc-95ff-0800200c9a66}
[Gecko]
MinVersion=@GRE_MILESTONE@
MinVersion=1.9b5pre
MaxVersion=@GRE_MILESTONE@
[XRE]

Просмотреть файл

@ -71,21 +71,21 @@ pref("javascript.options.strict", true);
pref("nglayout.debug.disable_xul_cache", false);
pref("nglayout.debug.disable_xul_fastload", false);
/* download manager */
/* download manager (don't show the window or alert) */
pref("browser.download.useDownloadDir", true);
pref("browser.download.folderList", 0);
pref("browser.download.manager.showAlertOnComplete", true);
pref("browser.download.manager.showAlertOnComplete", false);
pref("browser.download.manager.showAlertInterval", 2000);
pref("browser.download.manager.retention", 2);
pref("browser.download.manager.showWhenStarting", true);
pref("browser.download.manager.useWindow", true);
pref("browser.download.manager.useWindow", false);
pref("browser.download.manager.closeWhenDone", true);
pref("browser.download.manager.openDelay", 0);
pref("browser.download.manager.focusWhenStarting", false);
pref("browser.download.manager.flashCount", 2);
pref("browser.download.manager.displayedHistoryDays", 7);
/* download alerts */
/* download alerts (disabled above) */
pref("alerts.slideIncrement", 1);
pref("alerts.slideIncrementTime", 10);
pref("alerts.totalOpenTime", 6000);

Просмотреть файл

@ -0,0 +1,153 @@
/* ***** BEGIN LICENSE BLOCK *****
* 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 Mozilla Mobile Browser.
*
* The Initial Developer of the Original Code is
* Mozilla Corporation.
* Portions created by the Initial Developer are Copyright (C) 2008
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Mark Finkle <mfinkle@mozilla.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 ***** */
var Bookmarks = {
bookmarks : null,
panel : null,
item : null,
edit : function(aURI) {
this.bookmarks = Cc["@mozilla.org/browser/nav-bookmarks-service;1"].getService(Ci.nsINavBookmarksService);
this.panel = document.getElementById("bookmark_edit");
this.panel.hidden = false; // was initially hidden to reduce Ts
var bookmarkIDs = this.bookmarks.getBookmarkIdsForURI(aURI, {});
if (bookmarkIDs.length > 0) {
this.item = bookmarkIDs[0];
document.getElementById("bookmark_url").value = aURI.spec;
document.getElementById("bookmark_name").value = this.bookmarks.getItemTitle(this.item);
this.panel.openPopup(document.getElementById("tool_star"), "after_end", 0, 0, false, false);
}
},
remove : function() {
if (this.item) {
this.bookmarks.removeItem(this.item);
document.getElementById("tool_star").removeAttribute("starred");
}
this.close();
},
save : function() {
if (this.panel && this.item) {
var ios = Cc["@mozilla.org/network/io-service;1"].getService(Ci.nsIIOService);
var bookmarkURI = ios.newURI(document.getElementById("bookmark_url").value, null, null);
if (bookmarkURI) {
this.bookmarks.setItemTitle(this.item, document.getElementById("bookmark_name").value);
this.bookmarks.changeBookmarkURI(this.item, bookmarkURI);
}
}
this.close();
},
close : function() {
if (this.panel) {
this.item = null;
this.panel.hidePopup();
this.panel = null;
}
},
list : function() {
this.bookmarks = Cc["@mozilla.org/browser/nav-bookmarks-service;1"].getService(Ci.nsINavBookmarksService);
this.panel = document.getElementById("bookmark_picker");
this.panel.hidden = false; // was initially hidden to reduce Ts
var list = document.getElementById("bookmark_list");
while (list.childNodes.length > 0) {
list.removeChild(list.childNodes[0]);
}
var fis = Cc["@mozilla.org/browser/favicon-service;1"].getService(Ci.nsIFaviconService);
var items = this.getBookmarks();
if (items.length > 0) {
for (var i=0; i<items.length; i++) {
var itemId = items[i];
var listItem = document.createElement("richlistitem");
listItem.setAttribute("class", "bookmarklist-item");
var box = document.createElement("vbox");
box.setAttribute("pack", "center");
var image = document.createElement("image");
image.setAttribute("class", "bookmarklist-image");
image.setAttribute("src", fis.getFaviconImageForPage(this.bookmarks.getBookmarkURI(itemId)).spec);
box.appendChild(image);
listItem.appendChild(box);
var label = document.createElement("label");
label.setAttribute("class", "bookmarklist-text");
label.setAttribute("value", this.bookmarks.getItemTitle(itemId));
label.setAttribute("flex", "1");
label.setAttribute("crop", "end");
label.setAttribute("onclick", "Bookmarks.open(" + itemId + ");");
listItem.appendChild(label);
list.appendChild(listItem);
}
this.panel.openPopup(document.getElementById("tool_bookmarks"), "after_end", 0, 0, false, false);
}
},
open : function(aItem) {
var bookmarkURI = this.bookmarks.getBookmarkURI(aItem);
Browser.content.loadURI(bookmarkURI.spec, null, null, false);
this.close();
},
getBookmarks : function() {
var items = [];
var history = Cc["@mozilla.org/browser/nav-history-service;1"].getService(Ci.nsINavHistoryService);
var options = history.getNewQueryOptions();
var query = history.getNewQuery();
query.setFolders([this.bookmarks.bookmarksMenuFolder], 1);
var result = history.executeQuery(query, options);
var rootNode = result.root;
rootNode.containerOpen = true;
var cc = rootNode.childCount;
for (var i=0; i<cc; ++i) {
var node = rootNode.getChild(i);
if (node.type == node.RESULT_TYPE_URI) {
items.push(node.itemId);
}
}
rootNode.containerOpen = false;
return items;
}
};

Просмотреть файл

@ -0,0 +1,77 @@
<?xml version="1.0"?>
<!-- ***** BEGIN LICENSE BLOCK *****
- 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 Mozilla Mobile Browser.
-
- The Initial Developer of the Original Code is
- Mozilla Corporation.
- Portions created by the Initial Developer are Copyright (C) 2008
- the Initial Developer. All Rights Reserved.
-
- Contributor(s):
- Mark Finkle <mfinkle@mozila.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 LGPL or the GPL. 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 ***** -->
<!DOCTYPE overlay SYSTEM "chrome://browser/locale/bookmarks.dtd">
<overlay id="bookmarks-overlay" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<script type="application/x-javascript" src="chrome://browser/content/bookmarks.js"/>
<popupset id="mainPopupSet">
<panel id="bookmark_edit" hidden="true">
<hbox flex="1" align="top">
<image id="bookmark_star"/>
<vbox flex="1">
<label id="bookmark_title" value="&editBookmark.title;" flex="1"/>
<button label="&removeBookmark.label;" oncommand="Bookmarks.remove();"/>
</vbox>
</hbox>
<separator/>
<vbox>
<label value="&bookmarkURL.label;" control="bookmark_url"/>
<textbox id="bookmark_url"/>
<separator class="thin"/>
<label value="&bookmarkName.label;" control="bookmark_name"/>
<textbox id="bookmark_name"/>
</vbox>
<separator/>
<hbox>
<spacer flex="1"/>
<button label="&saveBookmark.label;" oncommand="Bookmarks.save();"/>
<button label="&closeBookmark.label;" oncommand="Bookmarks.close();"/>
</hbox>
</panel>
<panel id="bookmark_picker" hidden="true">
<richlistbox id="bookmark_list" style="border: none !important;">
</richlistbox>
</panel>
</popupset>
</overlay>

Просмотреть файл

@ -39,285 +39,13 @@
const Cc = Components.classes;
const Ci = Components.interfaces;
const Cu = Components.utils;
const TOOLBARSTATE_LOADING = 1;
const TOOLBARSTATE_LOADED = 2;
const TOOLBARSTATE_TYPING = 3;
const TOOLBARSTATE_INDETERMINATE = 4;
var LocationBar = {
_urlbar : null,
_throbber : null,
_favicon : null,
_faviconAdded : false,
_linkAdded : function(aEvent) {
var link = aEvent.originalTarget;
var rel = link.rel && link.rel.toLowerCase();
if (!link || !link.ownerDocument || !rel || !link.href)
return;
var rels = rel.split(/\s+/);
if (rels.indexOf("icon") != -1) {
this._favicon.setAttribute("src", link.href);
this._throbber.setAttribute("src", "");
this._faviconAdded = true;
}
},
init : function() {
this._urlbar = document.getElementById("urlbar");
this._urlbar.addEventListener("focus", this, false);
this._urlbar.addEventListener("input", this, false);
this._throbber = document.getElementById("urlbar-throbber");
this._favicon = document.getElementById("urlbar-favicon");
this._favicon.addEventListener("error", this, false);
Browser.content.addEventListener("DOMLinkAdded", this, true);
},
update : function(aState) {
var go = document.getElementById("cmd_go");
var search = document.getElementById("cmd_search");
var reload = document.getElementById("cmd_reload");
var stop = document.getElementById("cmd_stop");
if (aState == TOOLBARSTATE_INDETERMINATE) {
this._faviconAdded = false;
aState = TOOLBARSTATE_LOADED;
this.setURI();
}
if (aState == TOOLBARSTATE_LOADING) {
go.collapsed = true;
search.collapsed = true;
reload.collapsed = true;
stop.collapsed = false;
this._throbber.setAttribute("src", "chrome://browser/skin/images/throbber.gif");
this._favicon.setAttribute("src", "");
this._faviconAdded = false;
}
else if (aState == TOOLBARSTATE_LOADED) {
go.collapsed = true;
search.collapsed = true;
reload.collapsed = false;
stop.collapsed = true;
this._throbber.setAttribute("src", "");
if (this._faviconAdded == false) {
var ios = Cc["@mozilla.org/network/io-service;1"].getService(Ci.nsIIOService);
var faviconURI = ios.newURI(Browser.content.browser.currentURI.prePath + "/favicon.ico", null, null);
var fis = Cc["@mozilla.org/browser/favicon-service;1"].getService(Ci.nsIFaviconService);
if (fis.isFailedFavicon(faviconURI))
faviconURI = ios.newURI("chrome://browser/skin/images/default-favicon.png", null, null);
this._favicon.setAttribute("src", faviconURI.spec);
this._faviconAdded = true;
}
}
else if (aState == TOOLBARSTATE_TYPING) {
reload.collapsed = true;
stop.collapsed = true;
go.collapsed = false;
search.collapsed = false;
this._throbber.setAttribute("src", "chrome://browser/skin/images/throbber.png");
this._favicon.setAttribute("src", "");
}
},
/* Set the location to the current content */
setURI : function() {
// Update UI for history
var browser = Browser.content.browser;
var back = document.getElementById("cmd_back");
var forward = document.getElementById("cmd_forward");
back.setAttribute("disabled", !browser.canGoBack);
forward.setAttribute("disabled", !browser.canGoForward);
// Check for a bookmarked page
var star = document.getElementById("tool_star");
star.removeAttribute("starred");
var bms = Cc["@mozilla.org/browser/nav-bookmarks-service;1"].getService(Ci.nsINavBookmarksService);
var bookmarks = bms.getBookmarkIdsForURI(browser.currentURI, {});
if (bookmarks.length > 0) {
star.setAttribute("starred", "true");
}
var uri = browser.currentURI.spec;
if (uri == "about:blank") {
uri = "";
this._urlbar.focus();
}
this._urlbar.value = uri;
},
revertURI : function() {
// Reset the current URI from the browser if the histroy list is not open
if (this._urlbar.popupOpen == false)
this.setURI();
// If the value isn't empty and the urlbar has focus, select the value.
if (this._urlbar.value && this._urlbar.hasAttribute("focused"))
this._urlbar.select();
return (this._urlbar.popupOpen == false);
},
goToURI : function() {
Browser.content.loadURI(this._urlbar.value, null, null, false);
},
search : function() {
var queryURI = "http://www.google.com/search?q=" + this._urlbar.value + "&hl=en&lr=&btnG=Search";
Browser.content.loadURI(queryURI, null, null, false);
},
getURLBar : function() {
return this._urlbar;
},
handleEvent: function (aEvent) {
switch (aEvent.type) {
case "DOMLinkAdded":
this._linkAdded(aEvent);
break;
case "focus":
setTimeout(function() { aEvent.target.select(); }, 0);
break;
case "input":
this.update(TOOLBARSTATE_TYPING);
break;
case "error":
this._favicon.setAttribute("src", "chrome://browser/skin/images/default-favicon.png");
break;
}
}
};
var Bookmarks = {
bookmarks : null,
panel : null,
item : null,
edit : function(aURI) {
this.bookmarks = Cc["@mozilla.org/browser/nav-bookmarks-service;1"].getService(Ci.nsINavBookmarksService);
this.panel = document.getElementById("bookmark_edit");
this.panel.hidden = false; // was initially hidden to reduce Ts
var bookmarkIDs = this.bookmarks.getBookmarkIdsForURI(aURI, {});
if (bookmarkIDs.length > 0) {
this.item = bookmarkIDs[0];
document.getElementById("bookmark_url").value = aURI.spec;
document.getElementById("bookmark_name").value = this.bookmarks.getItemTitle(this.item);
this.panel.openPopup(document.getElementById("tool_star"), "after_end", 0, 0, false, false);
}
},
remove : function() {
if (this.item) {
this.bookmarks.removeItem(this.item);
document.getElementById("tool_star").removeAttribute("starred");
}
this.close();
},
save : function() {
if (this.panel && this.item) {
var ios = Cc["@mozilla.org/network/io-service;1"].getService(Ci.nsIIOService);
var bookmarkURI = ios.newURI(document.getElementById("bookmark_url").value, null, null);
if (bookmarkURI) {
this.bookmarks.setItemTitle(this.item, document.getElementById("bookmark_name").value);
this.bookmarks.changeBookmarkURI(this.item, bookmarkURI);
}
}
this.close();
},
close : function() {
if (this.panel) {
this.item = null;
this.panel.hidePopup();
this.panel = null;
}
},
list : function() {
this.bookmarks = Cc["@mozilla.org/browser/nav-bookmarks-service;1"].getService(Ci.nsINavBookmarksService);
this.panel = document.getElementById("bookmark_picker");
this.panel.hidden = false; // was initially hidden to reduce Ts
var list = document.getElementById("bookmark_list");
while (list.childNodes.length > 0) {
list.removeChild(list.childNodes[0]);
}
var fis = Cc["@mozilla.org/browser/favicon-service;1"].getService(Ci.nsIFaviconService);
var items = this.getBookmarks();
if (items.length > 0) {
for (var i=0; i<items.length; i++) {
var itemId = items[i];
var listItem = document.createElement("richlistitem");
listItem.setAttribute("class", "bookmarklist-item");
var box = document.createElement("vbox");
box.setAttribute("pack", "center");
var image = document.createElement("image");
image.setAttribute("class", "bookmarklist-image");
image.setAttribute("src", fis.getFaviconImageForPage(this.bookmarks.getBookmarkURI(itemId)).spec);
box.appendChild(image);
listItem.appendChild(box);
var label = document.createElement("label");
label.setAttribute("class", "bookmarklist-text");
label.setAttribute("value", this.bookmarks.getItemTitle(itemId));
label.setAttribute("flex", "1");
label.setAttribute("crop", "end");
label.setAttribute("onclick", "Bookmarks.open(" + itemId + ");");
listItem.appendChild(label);
list.appendChild(listItem);
}
this.panel.openPopup(document.getElementById("tool_bookmarks"), "after_end", 0, 0, false, false);
}
},
open : function(aItem) {
var bookmarkURI = this.bookmarks.getBookmarkURI(aItem);
Browser.content.loadURI(bookmarkURI.spec, null, null, false);
this.close();
},
getBookmarks : function() {
var items = [];
var history = Cc["@mozilla.org/browser/nav-history-service;1"].getService(Ci.nsINavHistoryService);
var options = history.getNewQueryOptions();
var query = history.getNewQuery();
query.setFolders([this.bookmarks.bookmarksMenuFolder], 1);
var result = history.executeQuery(query, options);
var rootNode = result.root;
rootNode.containerOpen = true;
var cc = rootNode.childCount;
for (var i=0; i<cc; ++i) {
var node = rootNode.getChild(i);
if (node.type == node.RESULT_TYPE_URI) {
items.push(node.itemId);
}
}
rootNode.containerOpen = false;
return items;
}
};
var LocationBar = null;
function getBrowser() {
return Browser.content.browser;
}
var Browser = {
_content : null,
@ -339,7 +67,7 @@ var Browser = {
},
_tabSelect : function(aEvent) {
LocationBar.update(TOOLBARSTATE_INDETERMINATE);
//LocationBar.update(TOOLBARSTATE_INDETERMINATE);
},
_popupShowing : function(aEvent) {
@ -431,6 +159,10 @@ dump("misspelling\n");
this.prefs = Cc["@mozilla.org/preferences-service;1"].getService(Ci.nsIPrefBranch2);
window.controllers.appendController(this);
if (LocationBar)
window.controllers.appendController(LocationBar);
if (HUDBar)
window.controllers.appendController(HUDBar);
var ios = Cc["@mozilla.org/network/io-service;1"].getService(Ci.nsIIOService);
var styleSheets = Cc["@mozilla.org/content/style-sheet-service;1"].getService(Ci.nsIStyleSheetService);
@ -457,7 +189,11 @@ dump("misspelling\n");
this._content.addBrowser("about:blank", null, null, false);
LocationBar.init();
if (LocationBar)
LocationBar.init();
if (HUDBar)
HUDBar.init();
DownloadMonitor.init();
Cc["@mozilla.org/login-manager;1"].getService(Ci.nsILoginManager);
// Determine the initial launch page
@ -471,11 +207,15 @@ dump("misspelling\n");
// Use a commandline parameter
if (window.arguments && window.arguments[0]) {
var cmdLine = window.arguments[0].QueryInterface(Ci.nsICommandLine);
if (cmdLine.length == 1) {
whereURI = cmdLine.resolveURI(cmdLine.getArgument(0));
if (whereURI)
whereURI = whereURI.spec;
try {
var cmdLine = window.arguments[0].QueryInterface(Ci.nsICommandLine);
if (cmdLine.length == 1) {
whereURI = cmdLine.resolveURI(cmdLine.getArgument(0));
if (whereURI)
whereURI = whereURI.spec;
}
}
catch (e) {
}
}
@ -512,14 +252,6 @@ dump("misspelling\n");
supportsCommand : function(cmd) {
var isSupported = false;
switch (cmd) {
case "cmd_back":
case "cmd_forward":
case "cmd_reload":
case "cmd_stop":
case "cmd_search":
case "cmd_go":
case "cmd_star":
case "cmd_bookmarks":
case "cmd_newTab":
case "cmd_closeTab":
case "cmd_switchTab":
@ -544,55 +276,6 @@ dump("misspelling\n");
var browser = this.content.browser;
switch (cmd) {
case "cmd_back":
browser.stop();
browser.goBack();
break;
case "cmd_forward":
browser.stop();
browser.goForward();
break;
case "cmd_reload":
browser.reload();
break;
case "cmd_stop":
browser.stop();
break;
case "cmd_search":
{
LocationBar.search();
break;
}
case "cmd_go":
{
LocationBar.goToURI();
break;
}
case "cmd_star":
{
var bookmarkURI = browser.currentURI;
var bookmarkTitle = browser.contentDocument.title;
var bookmarks = Cc["@mozilla.org/browser/nav-bookmarks-service;1"].getService(Ci.nsINavBookmarksService);
if (bookmarks.getBookmarkIdsForURI(bookmarkURI, {}).length == 0) {
var bookmarkId = bookmarks.insertBookmark(bookmarks.bookmarksMenuFolder, bookmarkURI, bookmarks.DEFAULT_INDEX, bookmarkTitle);
document.getElementById("tool_star").setAttribute("starred", "true");
var ios = Cc["@mozilla.org/network/io-service;1"].getService(Ci.nsIIOService);
var favicon = document.getElementById("urlbar-favicon");
var faviconURI = ios.newURI(favicon.src, null, null);
var fis = Cc["@mozilla.org/browser/favicon-service;1"].getService(Ci.nsIFaviconService);
fis.setAndLoadFaviconForPage(bookmarkURI, faviconURI, true);
}
else {
Bookmarks.edit(bookmarkURI);
}
break;
}
case "cmd_bookmarks":
Bookmarks.list();
break;
case "cmd_newTab":
this.content.addBrowser("about:blank", null, null, false);
break;
@ -664,11 +347,17 @@ ProgressController.prototype = {
if (aStateFlags & Ci.nsIWebProgressListener.STATE_IS_NETWORK) {
if (aRequest && aWebProgress.DOMWindow == this._browser.contentWindow) {
if (aStateFlags & Ci.nsIWebProgressListener.STATE_START) {
LocationBar.update(TOOLBARSTATE_LOADING);
if (LocationBar)
LocationBar.update(TOOLBARSTATE_LOADING);
if (HUDBar)
HUDBar.update(TOOLBARSTATE_LOADING);
}
else if (aStateFlags & Ci.nsIWebProgressListener.STATE_STOP) {
this._browser.zoomController.scale = 1;
LocationBar.update(TOOLBARSTATE_LOADED);
if (LocationBar)
LocationBar.update(TOOLBARSTATE_LOADED);
if (HUDBar)
HUDBar.update(TOOLBARSTATE_LOADED);
}
}
}
@ -689,7 +378,10 @@ ProgressController.prototype = {
// This method is called to indicate a change to the current location.
onLocationChange : function(aWebProgress, aRequest, aLocation) {
if (aWebProgress.DOMWindow == this._browser.contentWindow) {
LocationBar.setURI(aLocation.spec);
if (LocationBar)
LocationBar.setURI(aLocation.spec);
if (HUDBar)
HUDBar.setURI(aLocation.spec);
}
},
@ -702,7 +394,6 @@ ProgressController.prototype = {
onSecurityChange : function(aWebProgress, aRequest, aState) {
},
/* nsISupports */
QueryInterface : function(aIID) {
if (aIID.equals(Components.interfaces.nsIWebProgressListener) ||
aIID.equals(Components.interfaces.nsISupportsWeakReference) ||
@ -747,7 +438,7 @@ MouseController.prototype = {
mousedown: function(aEvent)
{
var self = this;
this._contextID = setTimeout(function() { self.contextMenu(aEvent); }, 900);
this._contextID = setTimeout(function() { self.contextMenu(aEvent); }, 750);
if (aEvent.target instanceof HTMLInputElement ||
aEvent.target instanceof HTMLTextAreaElement ||
@ -841,11 +532,13 @@ MouseController.prototype = {
mousePan: function(aEvent)
{
var delta = aEvent.timeStamp - this.lastEvent.timeStamp;
var x = aEvent.clientX - this.lastEvent.clientX;
var y = aEvent.clientY - this.lastEvent.clientY;
if (Math.abs(x) < 5 && Math.abs(y) < 5)
return;
if (100 > delta || (8 > Math.abs(x) && 8 > Math.abs(y)))
return;
dump("##: " + delta + " [" + x + ", " + y + "]\n");
if (this._contextID) {
clearTimeout(this._contextID);
this._contextID = null;
@ -853,7 +546,7 @@ MouseController.prototype = {
if (this.lastEvent) {
aEvent.momentum = {
time: Math.max(aEvent.timeStamp - this.lastEvent.timeStamp, 1),
time: Math.max(delta, 1),
x: x,
y: y
};
@ -888,6 +581,8 @@ MouseController.prototype = {
contextMenu: function(aEvent)
{
if (HUDBar)
HUDBar.show();
if (this._contextID && this._browser.contextMenu) {
document.popupNode = aEvent.target;
var popup = document.getElementById(this._browser.contextMenu);

Просмотреть файл

@ -41,6 +41,9 @@
<?xml-stylesheet href="chrome://browser/skin/browser.css" type="text/css"?>
<?xml-stylesheet href="chrome://browser/content/deckbrowser.css" type="text/css"?>
<?xul-overlay href="chrome://browser/content/hud.xul"?>
<?xul-overlay href="chrome://browser/content/downloads.xul"?>
<!DOCTYPE window SYSTEM "chrome://browser/locale/browser.dtd">
<window id="main-window" title="&browser.title;"
@ -48,22 +51,14 @@
onload="Browser.startup();"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<script src="chrome://global/content/inlineSpellCheckUI.js"/>
<script src="chrome://browser/content/commandUtil.js"/>
<script src="chrome://browser/content/browser.js"/>
<script type="application/x-javascript" src="chrome://global/content/inlineSpellCheckUI.js"/>
<script type="application/x-javascript" src="chrome://browser/content/commandUtil.js"/>
<script type="application/x-javascript" src="chrome://browser/content/browser.js"/>
<commandset id="cmdset_main">
<command id="cmd_back" label="&back.label;" disabled="true" oncommand="CommandUpdater.doCommand(this.id);"/>
<command id="cmd_forward" label="&forward.label;" disabled="true" oncommand="CommandUpdater.doCommand(this.id);"/>
<command id="cmd_reload" label="&reload.label;" collapsed="true" oncommand="CommandUpdater.doCommand(this.id);"/>
<command id="cmd_stop" label="&stop.label;" collapsed="true" oncommand="CommandUpdater.doCommand(this.id);"/>
<command id="cmd_search" label="&search.label;" collapsed="true" oncommand="CommandUpdater.doCommand(this.id);"/>
<command id="cmd_go" label="&go.label;" oncommand="CommandUpdater.doCommand(this.id);"/>
<command id="cmd_star" label="&star.label;" oncommand="CommandUpdater.doCommand(this.id);"/>
<command id="cmd_bookmarks" label="&bookmarks.label;" oncommand="CommandUpdater.doCommand(this.id);"/>
<command id="cmd_newTab" oncommand="CommandUpdater.doCommand(this.id);"/>
<command id="cmd_closeTab" oncommand="CommandUpdater.doCommand(this.id);"/>
<command id="cmd_switchTab" oncommand="CommandUpdater.doCommand(this.id);"/>
<command id="cmd_newTab" label="New Tab" oncommand="CommandUpdater.doCommand(this.id);"/>
<command id="cmd_closeTab" label="Close Tab" oncommand="CommandUpdater.doCommand(this.id);"/>
<command id="cmd_switchTab" label="Tabs" oncommand="CommandUpdater.doCommand(this.id);"/>
<command id="cmd_menu" oncommand="CommandUpdater.doCommand(this.id);"/>
<command id="cmd_fullscreen" oncommand="CommandUpdater.doCommand(this.id);"/>
<command id="cmd_addons" oncommand="CommandUpdater.doCommand(this.id);"/>
@ -106,35 +101,6 @@
<panel type="autocomplete" id="popup_autocomplete" noautofocus="true"/>
<panel id="bookmark_edit" hidden="true">
<hbox flex="1" align="top">
<image id="bookmark_star"/>
<vbox flex="1">
<label id="bookmark_title" value="&editBookmark.title;" flex="1"/>
<button label="&removeBookmark.label;" oncommand="Bookmarks.remove();"/>
</vbox>
</hbox>
<separator/>
<vbox>
<label value="&bookmarkURL.label;" control="bookmark_url"/>
<textbox id="bookmark_url"/>
<separator class="thin"/>
<label value="&bookmarkName.label;" control="bookmark_name"/>
<textbox id="bookmark_name"/>
</vbox>
<separator/>
<hbox>
<spacer flex="1"/>
<button label="&saveBookmark.label;" oncommand="Bookmarks.save();"/>
<button label="&closeBookmark.label;" oncommand="Bookmarks.close();"/>
</hbox>
</panel>
<panel id="bookmark_picker" hidden="true">
<richlistbox id="bookmark_list" style="border: none !important;">
</richlistbox>
</panel>
<menupopup id="popup_content">
<menuitem id="menuitem_noSuggestions" disabled="true" label="&noSuggestions.label;"/>
<menuitem id="menuitem_addToDictionary" label="&addToDictionary.label;" oncommand="InlineSpellCheckerUI.addToDictionary();"/>
@ -158,31 +124,8 @@
</menupopup>
</popupset>
<toolbox>
<toolbar id="toolbar_main" mode="icons">
<toolbarbutton id="tool_back" tooltiptext="&back.tooltip;" command="cmd_back"/>
<toolbarbutton id="tool_forward" tooltiptext="&forward.tooltip;" command="cmd_forward"/>
<toolbaritem id="urlbar-container" flex="1">
<stack id="urlbar-image-stack">
<image id="urlbar-throbber" src="throbber.png"/>
<image id="urlbar-favicon" src=""/>
</stack>
<textbox id="urlbar" type="autocomplete" autocompletesearch="history" enablehistory="false" maxrows="6" completeselectedindex="true" flex="1"
ontextentered="LocationBar.goToURI();" ontextreverted="LocationBar.revertURI();"/>
<hbox id="urlbar-icons">
<toolbarbutton id="tool_search" tooltiptext="&search.tooltip;" command="cmd_search"/>
<toolbarbutton id="tool_go" tooltiptext="&go.tooltip;" command="cmd_go"/>
<toolbarbutton id="tool_reload" tooltiptext="&reload.tooltip;" command="cmd_reload"/>
<toolbarbutton id="tool_stop" tooltiptext="&stop.tooltip;" command="cmd_stop"/>
</hbox>
</toolbaritem>
<toolbarbutton id="tool_star" tooltiptext="&star.tooltip;" command="cmd_star"/>
<toolbarbutton id="tool_bookmarks" tooltiptext="&bookmarks.tooltip;" command="cmd_bookmarks"/>
</toolbar>
</toolbox>
<vbox id="browser" flex="1">
<deckbrowser id="content" contentcontextmenu="popup_content" autocompletepopup="popup_autocomplete" flex="1">
<deckbrowser id="content" autocompletepopup="popup_autocomplete" flex="1">
</deckbrowser>
</vbox>

Просмотреть файл

@ -23,6 +23,9 @@
<content>
<xul:deck anonid="container" class="deckbrowser-container" flex="1">
</xul:deck>
<xul:vbox anonid="renderspace" class="deckbrowser-renderspace" collapsed="true" flex="1">
<html:canvas id="render"/>
</xul:vbox>
<xul:vbox anonid="tabspace" class="deckbrowser-tabspace" collapsed="true" align="center" flex="1">
<xul:description anonid="title" class="deckbrowser-title" crop="end"/>
<xul:description anonid="uri" class="deckbrowser-uri" crop="center"/>

Просмотреть файл

@ -0,0 +1,156 @@
/* ***** BEGIN LICENSE BLOCK *****
* 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 Mozilla Mobile Browser.
*
* The Initial Developer of the Original Code is
* Mozilla Corporation.
* Portions created by the Initial Developer are Copyright (C) 2008
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Mark Finkle <mfinkle@mozilla.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 ***** */
var DownloadMonitor = {
_dlmgr : null,
_panel : null,
_activeStr : null,
_pausedStr : null,
_lastTime : Infinity,
_listening : false,
init : function DM_init() {
// Load the modules to help display strings
Cu.import("resource://gre/modules/DownloadUtils.jsm");
Cu.import("resource://gre/modules/PluralForm.jsm");
// Initialize "private" member variables
this._dlmgr = Cc["@mozilla.org/download-manager;1"].getService(Ci.nsIDownloadManager);
this._panel = document.getElementById("download-monitor");
this._status = document.getElementById("download-monitor-status");
this._time = document.getElementById("download-monitor-time");
// Cache the status strings
/*
let (bundle = document.getElementById("bundle_browser")) {
this._activeStr = bundle.getString("activeDownloads");
this._pausedStr = bundle.getString("pausedDownloads");
}
*/
this._activeStr = "1 active download (#2);#1 active downloads (#2)";
this._pausedStr = "1 paused download;#1 paused downloads";
this._dlmgr.addListener(this);
this._listening = true;
this.updateStatus();
},
uninit: function DM_uninit() {
if (this._listening)
this._dlmgr.removeListener(this);
},
/**
* Update status based on the number of active and paused downloads
*/
updateStatus: function DM_updateStatus() {
let numActive = this._dlmgr.activeDownloadCount;
// Hide the panel and reset the "last time" if there's no downloads
if (numActive == 0) {
this._panel.hidePopup();
this._lastTime = Infinity;
return;
}
// Find the download with the longest remaining time
let numPaused = 0;
let maxTime = -Infinity;
let dls = this._dlmgr.activeDownloads;
while (dls.hasMoreElements()) {
let dl = dls.getNext().QueryInterface(Ci.nsIDownload);
if (dl.state == this._dlmgr.DOWNLOAD_DOWNLOADING) {
// Figure out if this download takes longer
if (dl.speed > 0 && dl.size > 0)
maxTime = Math.max(maxTime, (dl.size - dl.amountTransferred) / dl.speed);
else
maxTime = -1;
}
else if (dl.state == this._dlmgr.DOWNLOAD_PAUSED)
numPaused++;
}
// Get the remaining time string and last sec for time estimation
let timeLeft;
[timeLeft, this._lastTime] = DownloadUtils.getTimeLeft(maxTime, this._lastTime);
// Figure out how many downloads are currently downloading
let numDls = numActive - numPaused;
let status = this._activeStr;
// If all downloads are paused, show the paused message instead
if (numDls == 0) {
numDls = numPaused;
status = this._pausedStr;
}
// Get the correct plural form and insert the number of downloads and time
// left message if necessary
status = PluralForm.get(numDls, status);
status = status.replace("#1", numDls);
// Update the panel and show it
this._status.value = status;
this._time.value = timeLeft;
this._panel.hidden = false;
this._panel.openPopup(null, "", 60, 50, false, false);
},
onProgressChange: function() {
this.updateStatus();
},
onDownloadStateChange: function() {
this.updateStatus();
},
onStateChange: function(aWebProgress, aRequest, aStateFlags, aStatus, aDownload) {
},
onSecurityChange: function(aWebProgress, aRequest, aState, aDownload) {
},
QueryInterface : function(aIID) {
if (aIID.equals(Components.interfaces.nsIDownloadProgressListener) ||
aIID.equals(Components.interfaces.nsISupportsWeakReference) ||
aIID.equals(Components.interfaces.nsISupports))
return this;
throw Components.results.NS_ERROR_NO_INTERFACE;
}
};

Просмотреть файл

@ -0,0 +1,61 @@
<?xml version="1.0"?>
<!-- ***** BEGIN LICENSE BLOCK *****
- 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 Mozilla Mobile Browser.
-
- The Initial Developer of the Original Code is
- Mozilla Corporation.
- Portions created by the Initial Developer are Copyright (C) 2008
- the Initial Developer. All Rights Reserved.
-
- Contributor(s):
- Mark Finkle <mfinkle@mozila.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 LGPL or the GPL. 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 ***** -->
<overlay id="downloads-overlay" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<script type="application/x-javascript" src="chrome://browser/content/downloads.js"/>
<popupset id="mainPopupSet">
<panel id="download-monitor" hidden="true">
<hbox>
<vbox>
<image id="download-monitor-progress"/>
</vbox>
<vbox>
<description id="download-monitor-status"/>
<description id="download-monitor-time"/>
</vbox>
<vbox>
<image id="download-monitor-close"/>
</vbox>
</hbox>
</panel>
</popupset>
</overlay>

Просмотреть файл

@ -0,0 +1,544 @@
/* ***** BEGIN LICENSE BLOCK *****
* 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 Mozilla Mobile Browser.
*
* The Initial Developer of the Original Code is
* Mozilla Corporation.
* Portions created by the Initial Developer are Copyright (C) 2008
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Mark Finkle <mfinkle@mozilla.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 ***** */
const TOOLBARSTATE_LOADING = 1;
const TOOLBARSTATE_LOADED = 2;
const TOOLBARSTATE_INDETERMINATE = 3;
const PANELMODE_VIEW = 1;
const PANELMODE_VIEWMENU = 2;
const PANELMODE_EDIT = 3;
const PANELMODE_BOOKMARK = 4;
var HUDBar = {
_panel : null,
_caption : null,
_edit : null,
_throbber : null,
_favicon : null,
_faviconAdded : false,
_fadeoutID : null,
_allowHide : true,
_titleChanged : function(aEvent) {
if (aEvent.target != getBrowser().contentDocument)
return;
this._caption.value = aEvent.target.title;
},
_linkAdded : function(aEvent) {
var link = aEvent.originalTarget;
var rel = link.rel && link.rel.toLowerCase();
if (!link || !link.ownerDocument || !rel || !link.href)
return;
var rels = rel.split(/\s+/);
if (rels.indexOf("icon") != -1) {
this._throbber.setAttribute("src", "");
this._setIcon(link.href);
}
},
_setIcon : function(aURI) {
var ios = Cc["@mozilla.org/network/io-service;1"].getService(Ci.nsIIOService);
var faviconURI = ios.newURI(aURI, null, null);
var fis = Cc["@mozilla.org/browser/favicon-service;1"].getService(Ci.nsIFaviconService);
if (fis.isFailedFavicon(faviconURI))
faviconURI = ios.newURI("chrome://browser/skin/images/default-favicon.png", null, null);
fis.setAndLoadFaviconForPage(getBrowser().currentURI, faviconURI, true);
this._favicon.setAttribute("src", faviconURI.spec);
this._faviconAdded = true;
},
_getBookmarks : function(aFolders) {
var items = [];
var hs = Cc["@mozilla.org/browser/nav-history-service;1"].getService(Ci.nsINavHistoryService);
var options = hs.getNewQueryOptions();
//options.resultType = options.RESULTS_AS_URI;
var query = hs.getNewQuery();
query.setFolders(aFolders, 1);
var result = hs.executeQuery(query, options);
var rootNode = result.root;
rootNode.containerOpen = true;
var cc = rootNode.childCount;
for (var i=0; i<cc; ++i) {
var node = rootNode.getChild(i);
items.push(node);
}
rootNode.containerOpen = false;
return items;
},
_getHistory : function(aCount) {
var items = [];
var hs = Cc["@mozilla.org/browser/nav-history-service;1"].getService(Ci.nsINavHistoryService);
var options = hs.getNewQueryOptions();
options.queryType = options.QUERY_TYPE_HISTORY;
//options.sortingMode = options.SORT_BY_VISITCOUNT_DESCENDING;
options.maxResults = aCount;
//options.resultType = Ci.nsINavHistoryQueryOptions.RESULTS_AS_URI;
var query = hs.getNewQuery();
var result = hs.executeQuery(query, options);
var rootNode = result.root;
rootNode.containerOpen = true;
var cc = rootNode.childCount;
for (var i=0; i<cc; ++i) {
var node = rootNode.getChild(i);
items.push(node);
}
rootNode.containerOpen = false;
return items;
},
init : function() {
this._panel = document.getElementById("hud-ui");
this._panel.addEventListener("popuphiding", this, false);
this._caption = document.getElementById("hudbar-caption");
this._caption.addEventListener("click", this, false);
this._edit = document.getElementById("hudbar-edit");
this._edit.addEventListener("focus", this, false);
this._edit.addEventListener("keypress", this, false);
this._throbber = document.getElementById("hudbar-throbber");
this._favicon = document.getElementById("hudbar-favicon");
this._favicon.addEventListener("error", this, false);
this._menu = document.getElementById("hudmenu");
Browser.content.addEventListener("DOMTitleChanged", this, true);
Browser.content.addEventListener("DOMLinkAdded", this, true);
},
update : function(aState) {
if (aState == TOOLBARSTATE_INDETERMINATE) {
this._faviconAdded = false;
aState = TOOLBARSTATE_LOADED;
this.setURI();
}
var hudbar = document.getElementById("hudbar-container");
if (aState == TOOLBARSTATE_LOADING) {
this._showMode(PANELMODE_VIEW);
hudbar.setAttribute("mode", "loading");
this._throbber.setAttribute("src", "chrome://browser/skin/images/throbber.gif");
this._favicon.setAttribute("src", "");
this._faviconAdded = false;
}
else if (aState == TOOLBARSTATE_LOADED) {
hudbar.setAttribute("mode", "view");
this._throbber.setAttribute("src", "");
if (this._faviconAdded == false) {
var faviconURI = getBrowser().currentURI.prePath + "/favicon.ico";
this._setIcon(faviconURI);
}
if (this._allowHide)
this.hide(3000);
this._allowHide = true;
}
},
/* Set the location to the current content */
setURI : function() {
var browser = getBrowser();
var back = document.getElementById("cmd_back");
var forward = document.getElementById("cmd_forward");
back.setAttribute("disabled", !browser.canGoBack);
forward.setAttribute("disabled", !browser.canGoForward);
// Check for a bookmarked page
var star = document.getElementById("hudbar-star");
star.removeAttribute("starred");
var bms = Cc["@mozilla.org/browser/nav-bookmarks-service;1"].getService(Ci.nsINavBookmarksService);
var bookmarks = bms.getBookmarkIdsForURI(browser.currentURI, {});
if (bookmarks.length > 0) {
star.setAttribute("starred", "true");
}
var uri = browser.currentURI.spec;
if (uri == "about:blank") {
uri = "";
this._showMode(PANELMODE_EDIT);
this._allowHide = false;
}
this._caption.value = uri;
this._edit.value = uri;
},
goToURI : function(aURI) {
if (!aURI)
aURI = this._edit.value;
getBrowser().loadURI(aURI, null, null, false);
if (this._panel.state == "open")
this._showMode(PANELMODE_VIEW);
},
search : function() {
var queryURI = "http://www.google.com/search?q=" + this._edit.value + "&hl=en&lr=&btnG=Search";
getBrowser().loadURI(queryURI, null, null, false);
if (this._panel.state == "open")
this._showMode(PANELMODE_VIEW);
},
_showMode : function(aMode) {
if (this._fadeoutID) {
clearTimeout(this._fadeoutID);
this._fadeoutID = null;
}
var hudbar = document.getElementById("hudbar-container");
var hudbmk = document.getElementById("hudbookmark-container");
var hudexpand = document.getElementById("hudexpand-container");
if (aMode == PANELMODE_VIEW || aMode == PANELMODE_VIEWMENU) {
hudbar.setAttribute("mode", "view");
this._edit.hidden = true;
this._caption.hidden = false;
hudbmk.hidden = true;
hudexpand.hidden = true;
if (aMode == PANELMODE_VIEWMENU) {
this._menu.hidden = false;
this._menu.openPopupAtScreen((window.innerWidth - this._menu.boxObject.width) / 2, (window.innerHeight - this._menu.boxObject.height) / 2);
}
}
else if (aMode == PANELMODE_EDIT) {
hudbar.setAttribute("mode", "edit");
this._caption.hidden = true;
this._edit.hidden = false;
this._edit.focus();
this._menu.hidePopup();
this.showHistory();
hudbmk.hidden = true;
//hudexpand.style.height = window.innerHeight - (30 + hudbar.boxObject.height);
hudexpand.hidden = false;
}
else if (aMode == PANELMODE_BOOKMARK) {
hudbar.setAttribute("mode", "view");
this._edit.hidden = true;
this._caption.hidden = false;
this._menu.hidePopup();
hudexpand.hidden = true;
hudbmk.hidden = false;
}
},
_showPlaces : function(aItems) {
var list = document.getElementById("hudlist-items");
while (list.childNodes.length > 0) {
list.removeChild(list.childNodes[0]);
}
var ios = Cc["@mozilla.org/network/io-service;1"].getService(Ci.nsIIOService);
var fis = Cc["@mozilla.org/browser/favicon-service;1"].getService(Ci.nsIFaviconService);
if (aItems.length > 0) {
for (var i=0; i<aItems.length; i++) {
let node = aItems[i];
let listItem = document.createElement("richlistitem");
listItem.setAttribute("class", "hudlist-item");
let box = document.createElement("vbox");
box.setAttribute("pack", "center");
let image = document.createElement("image");
image.setAttribute("class", "hudlist-image");
let icon = node.icon ? node.icon.spec : fis.getFaviconImageForPage(ios.newURI(node.uri, null, null)).spec
image.setAttribute("src", icon);
box.appendChild(image);
listItem.appendChild(box);
let label = document.createElement("label");
label.setAttribute("class", "hudlist-text");
label.setAttribute("value", node.title);
label.setAttribute("flex", "1");
label.setAttribute("crop", "end");
listItem.appendChild(label);
list.appendChild(listItem);
listItem.addEventListener("click", function() { HUDBar.goToURI(node.uri); }, true);
}
}
list.focus();
},
showHistory : function() {
this._showPlaces(this._getHistory(6));
},
showBookmarks : function () {
var bms = Cc["@mozilla.org/browser/nav-bookmarks-service;1"].getService(Ci.nsINavBookmarksService);
this._showPlaces(this._getBookmarks([bms.bookmarksMenuFolder]));
},
show : function() {
this._panel.hidden = false; // was initially hidden to reduce Ts
this._panel.width = window.innerWidth - 20;
this._showMode(PANELMODE_VIEWMENU);
this._panel.openPopup(null, "", 10, 5, false, false);
this._allowHide = false;
},
hide : function(aFadeout) {
if (!aFadeout) {
if (this._allowHide) {
this._menu.hidePopup();
this._panel.hidePopup();
}
this._allowHide = true;
}
else {
var self = this;
this.fadeoutID = setTimeout(function() { self.hide(); }, aFadeout);
}
},
handleEvent: function (aEvent) {
switch (aEvent.type) {
case "DOMTitleChanged":
this._titleChanged(aEvent);
break;
case "DOMLinkAdded":
this._linkAdded(aEvent);
break;
case "popuphiding":
this._showMode(PANELMODE_VIEW);
break;
case "click":
this._showMode(PANELMODE_EDIT);
break;
case "focus":
setTimeout(function() { aEvent.target.select(); }, 0);
break;
case "keypress":
if (aEvent.keyCode == 13)
this.goToURI();
break;
case "error":
this._favicon.setAttribute("src", "chrome://browser/skin/images/default-favicon.png");
break;
}
},
supportsCommand : function(cmd) {
var isSupported = false;
switch (cmd) {
case "cmd_back":
case "cmd_forward":
case "cmd_reload":
case "cmd_stop":
case "cmd_search":
case "cmd_go":
case "cmd_star":
case "cmd_bookmarks":
case "cmd_newTab":
case "cmd_closeTab":
case "cmd_switchTab":
case "cmd_menu":
case "cmd_fullscreen":
case "cmd_addons":
case "cmd_downloads":
isSupported = true;
break;
default:
isSupported = false;
break;
}
return isSupported;
},
isCommandEnabled : function(cmd) {
return true;
},
doCommand : function(cmd) {
var browser = getBrowser();
switch (cmd) {
case "cmd_back":
browser.stop();
browser.goBack();
break;
case "cmd_forward":
browser.stop();
browser.goForward();
break;
case "cmd_reload":
browser.reload();
break;
case "cmd_stop":
browser.stop();
break;
case "cmd_search":
this.search();
break;
case "cmd_go":
this.goToURI();
break;
case "cmd_star":
{
var bookmarkURI = browser.currentURI;
var bookmarkTitle = browser.contentDocument.title;
var bookmarks = Cc["@mozilla.org/browser/nav-bookmarks-service;1"].getService(Ci.nsINavBookmarksService);
if (bookmarks.getBookmarkIdsForURI(bookmarkURI, {}).length == 0) {
var bookmarkId = bookmarks.insertBookmark(bookmarks.bookmarksMenuFolder, bookmarkURI, bookmarks.DEFAULT_INDEX, bookmarkTitle);
document.getElementById("hudbar-star").setAttribute("starred", "true");
var ios = Cc["@mozilla.org/network/io-service;1"].getService(Ci.nsIIOService);
var favicon = document.getElementById("hudbar-favicon");
var faviconURI = ios.newURI(favicon.src, null, null);
var fis = Cc["@mozilla.org/browser/favicon-service;1"].getService(Ci.nsIFaviconService);
fis.setAndLoadFaviconForPage(bookmarkURI, faviconURI, true);
}
else {
this._showMode(PANELMODE_BOOKMARK);
BookmarkHelper.edit(bookmarkURI);
}
break;
}
case "cmd_bookmarks":
Bookmarks.list();
break;
case "cmd_addons":
{
const EMTYPE = "Extension:Manager";
var aOpenMode = "extensions";
var wm = Cc["@mozilla.org/appshell/window-mediator;1"].getService(Ci.nsIWindowMediator);
var needToOpen = true;
var windowType = EMTYPE + "-" + aOpenMode;
var windows = wm.getEnumerator(windowType);
while (windows.hasMoreElements()) {
var theEM = windows.getNext().QueryInterface(Ci.nsIDOMWindowInternal);
if (theEM.document.documentElement.getAttribute("windowtype") == windowType) {
theEM.focus();
needToOpen = false;
break;
}
}
if (needToOpen) {
const EMURL = "chrome://mozapps/content/extensions/extensions.xul?type=" + aOpenMode;
const EMFEATURES = "chrome,dialog=no,resizable=yes";
window.openDialog(EMURL, "", EMFEATURES);
}
break;
}
case "cmd_downloads":
Cc["@mozilla.org/download-manager-ui;1"].getService(Ci.nsIDownloadManagerUI).show(window);
}
}
};
var BookmarkHelper = {
_item : null,
_uri : null,
_bmksvc : null,
_tagsvc : null,
edit : function(aURI) {
this._bmksvc = Cc["@mozilla.org/browser/nav-bookmarks-service;1"].getService(Ci.nsINavBookmarksService);
this._tagsvc = Cc["@mozilla.org/browser/tagging-service;1"].getService(Ci.nsITaggingService);
this._uri = aURI;
var bookmarkIDs = this._bmksvc.getBookmarkIdsForURI(this._uri, {});
if (bookmarkIDs.length > 0) {
this._item = bookmarkIDs[0];
document.getElementById("hudbookmark-name").value = this._bmksvc.getItemTitle(this._item);
var currentTags = this._tagsvc.getTagsForURI(this._uri, {});
document.getElementById("hudbookmark-tags").value = currentTags.join(" ");
}
},
remove : function() {
if (this._item) {
this._bmksvc.removeItem(this._item);
document.getElementById("hudbar-star").removeAttribute("starred");
}
this.close();
},
save : function() {
if (this._item) {
// Update the name
this._bmksvc.setItemTitle(this._item, document.getElementById("hudbookmark-name").value);
// Update the tags
var taglist = document.getElementById("hudbookmark-tags").value;
var currentTags = this._tagsvc.getTagsForURI(this._uri, {});
var tags = taglist.split(" ");;
if (tags.length > 0 || currentTags.length > 0) {
var tagsToRemove = [];
var tagsToAdd = [];
var i;
for (i=0; i<currentTags.length; i++) {
if (tags.indexOf(currentTags[i]) == -1)
tagsToRemove.push(currentTags[i]);
}
for (i=0; i<tags.length; i++) {
if (currentTags.indexOf(tags[i]) == -1)
tagsToAdd.push(tags[i]);
}
if (tagsToAdd.length > 0)
this._tagsvc.tagURI(this._uri, tagsToAdd);
if (tagsToRemove.length > 0)
this._tagsvc.untagURI(this._uri, tagsToRemove);
}
}
this.close();
},
close : function() {
this._item = null;
HUDBar.hide();
}
};

Просмотреть файл

@ -0,0 +1,149 @@
<?xml version="1.0"?>
<!-- ***** BEGIN LICENSE BLOCK *****
- 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 Mozilla Mobile Browser.
-
- The Initial Developer of the Original Code is
- Mozilla Corporation.
- Portions created by the Initial Developer are Copyright (C) 2008
- the Initial Developer. All Rights Reserved.
-
- Contributor(s):
- Mark Finkle <mfinkle@mozila.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 LGPL or the GPL. 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 ***** -->
<?xml-stylesheet href="chrome://browser/skin/hud.css" type="text/css"?>
<!DOCTYPE overlay SYSTEM "chrome://browser/locale/hud.dtd">
<overlay id="hud-overlay" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<script type="application/x-javascript" src="chrome://browser/content/hud.js"/>
<commandset id="cmdset_main">
<command id="cmd_back" label="&back.label;" disabled="true" oncommand="CommandUpdater.doCommand(this.id);"/>
<command id="cmd_forward" label="&forward.label;" disabled="true" oncommand="CommandUpdater.doCommand(this.id);"/>
<command id="cmd_reload" label="&reload.label;" oncommand="CommandUpdater.doCommand(this.id);"/>
<command id="cmd_stop" label="&stop.label;" oncommand="CommandUpdater.doCommand(this.id);"/>
<command id="cmd_search" label="&search.label;" oncommand="CommandUpdater.doCommand(this.id);"/>
<command id="cmd_go" label="&go.label;" oncommand="CommandUpdater.doCommand(this.id);"/>
<command id="cmd_star" label="&star.label;" oncommand="CommandUpdater.doCommand(this.id);"/>
<command id="cmd_bookmarks" label="&bookmarks.label;" oncommand="CommandUpdater.doCommand(this.id);"/>
</commandset>
<popupset id="mainPopupSet">
<panel id="hud-ui">
<vbox flex="1">
<hbox id="hudbar-container">
<stack id="hudbar-image-stack">
<image id="hudbar-throbber" src=""/>
<image id="hudbar-favicon" src=""/>
</stack>
<description id="hudbar-caption" crop="end" flex="1"/>
<textbox id="hudbar-edit" flex="1" hidden="true"/>
<hbox id="hudbar-icons">
<toolbarbutton id="hudbar-reload" command="cmd_reload"/>
<toolbarbutton id="hudbar-stop" command="cmd_stop"/>
<toolbarbutton id="hudbar-star" command="cmd_star"/>
<toolbarbutton id="hudbar-search" command="cmd_search"/>
<toolbarbutton id="hudbar-go" command="cmd_go"/>
</hbox>
</hbox>
<vbox id="hudbookmark-container" hidden="true">
<hbox flex="1">
<vbox>
<image id="hudbookmark-image" src="chrome://browser/skin/images/starred48.png"/>
</vbox>
<grid id="hudbookmark-grid" flex="1">
<columns>
<column/>
<column flex="1"/>
</columns>
<rows>
<row>
<label value="Name:" for="hudbookmark-name"/>
<textbox id="hudbookmark-name"/>
</row>
<row>
<label value="Folder:" for="hudbookmark-folder"/>
<textbox id="hudbookmark-folder"/>
</row>
<row>
<label value="Tags:" for="hudbookmark-tags"/>
<textbox id="hudbookmark-tags"/>
</row>
</rows>
</grid>
</hbox>
<separator />
<hbox>
<button label="Remove Bookmark" oncommand="BookmarkHelper.remove()"/>
<spacer flex="1"/>
<button label="Cancel" oncommand="BookmarkHelper.close()"/>
<button label="Done" oncommand="BookmarkHelper.save()"/>
</hbox>
</vbox>
<vbox id="hudexpand-container" hidden="true">
<hbox id="hudlist-container" flex="1">
<richlistbox id="hudlist-items" flex="1"/>
</hbox>
<separator class="thin"/>
<hbox id="hudbuttons" flex="1">
<button id="hudbuttons-bookmarks" label="Bookmarks" oncommand="HUDBar.showBookmarks()"/>
<spacer flex="1"/>
<hbox>
<image id="hudbuttons-close" onclick="HUDBar.hide()"/>
</hbox>
</hbox>
</vbox>
</vbox>
</panel>
<panel id="hudmenu" hidden="true">
<vbox id="hudmenu-container">
<grid id="hudmenu-grid">
<columns>
<column flex="1"/>
<column flex="1"/>
</columns>
<rows>
<row>
<button command="cmd_back"/>
<button command="cmd_forward"/>
</row>
<row>
<button command="cmd_newTab"/>
<button command="cmd_switchTab"/>
</row>
</rows>
</grid>
</vbox>
</panel>
</popupset>
</overlay>

Просмотреть файл

@ -0,0 +1,276 @@
/* ***** BEGIN LICENSE BLOCK *****
* 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 Mozilla Mobile Browser.
*
* The Initial Developer of the Original Code is
* Mozilla Corporation.
* Portions created by the Initial Developer are Copyright (C) 2008
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Mark Finkle <mfinkle@mozilla.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 ***** */
const TOOLBARSTATE_LOADING = 1;
const TOOLBARSTATE_LOADED = 2;
const TOOLBARSTATE_TYPING = 3;
const TOOLBARSTATE_INDETERMINATE = 4;
var LocationBar = {
_urlbar : null,
_throbber : null,
_favicon : null,
_faviconAdded : false,
_linkAdded : function(aEvent) {
var link = aEvent.originalTarget;
var rel = link.rel && link.rel.toLowerCase();
if (!link || !link.ownerDocument || !rel || !link.href)
return;
var rels = rel.split(/\s+/);
if (rels.indexOf("icon") != -1) {
this._favicon.setAttribute("src", link.href);
this._throbber.setAttribute("src", "");
this._faviconAdded = true;
}
},
init : function() {
this._urlbar = document.getElementById("urlbar");
this._urlbar.addEventListener("focus", this, false);
this._urlbar.addEventListener("input", this, false);
this._throbber = document.getElementById("urlbar-throbber");
this._favicon = document.getElementById("urlbar-favicon");
this._favicon.addEventListener("error", this, false);
Browser.content.addEventListener("DOMLinkAdded", this, true);
},
update : function(aState) {
var go = document.getElementById("cmd_go");
var search = document.getElementById("cmd_search");
var reload = document.getElementById("cmd_reload");
var stop = document.getElementById("cmd_stop");
if (aState == TOOLBARSTATE_INDETERMINATE) {
this._faviconAdded = false;
aState = TOOLBARSTATE_LOADED;
this.setURI();
}
if (aState == TOOLBARSTATE_LOADING) {
go.collapsed = true;
search.collapsed = true;
reload.collapsed = true;
stop.collapsed = false;
this._throbber.setAttribute("src", "chrome://browser/skin/images/throbber.gif");
this._favicon.setAttribute("src", "");
this._faviconAdded = false;
}
else if (aState == TOOLBARSTATE_LOADED) {
go.collapsed = true;
search.collapsed = true;
reload.collapsed = false;
stop.collapsed = true;
this._throbber.setAttribute("src", "");
if (this._faviconAdded == false) {
var ios = Cc["@mozilla.org/network/io-service;1"].getService(Ci.nsIIOService);
var faviconURI = ios.newURI(Browser.content.browser.currentURI.prePath + "/favicon.ico", null, null);
var fis = Cc["@mozilla.org/browser/favicon-service;1"].getService(Ci.nsIFaviconService);
if (fis.isFailedFavicon(faviconURI))
faviconURI = ios.newURI("chrome://browser/skin/images/default-favicon.png", null, null);
this._favicon.setAttribute("src", faviconURI.spec);
this._faviconAdded = true;
}
}
else if (aState == TOOLBARSTATE_TYPING) {
reload.collapsed = true;
stop.collapsed = true;
go.collapsed = false;
search.collapsed = false;
this._throbber.setAttribute("src", "chrome://browser/skin/images/throbber.png");
this._favicon.setAttribute("src", "");
}
},
/* Set the location to the current content */
setURI : function() {
// Update UI for history
var browser = Browser.content.browser;
var back = document.getElementById("cmd_back");
var forward = document.getElementById("cmd_forward");
back.setAttribute("disabled", !browser.canGoBack);
forward.setAttribute("disabled", !browser.canGoForward);
// Check for a bookmarked page
var star = document.getElementById("tool_star");
star.removeAttribute("starred");
var bms = Cc["@mozilla.org/browser/nav-bookmarks-service;1"].getService(Ci.nsINavBookmarksService);
var bookmarks = bms.getBookmarkIdsForURI(browser.currentURI, {});
if (bookmarks.length > 0) {
star.setAttribute("starred", "true");
}
var uri = browser.currentURI.spec;
if (uri == "about:blank") {
uri = "";
this._urlbar.focus();
}
this._urlbar.value = uri;
},
revertURI : function() {
// Reset the current URI from the browser if the histroy list is not open
if (this._urlbar.popupOpen == false)
this.setURI();
// If the value isn't empty and the urlbar has focus, select the value.
if (this._urlbar.value && this._urlbar.hasAttribute("focused"))
this._urlbar.select();
return (this._urlbar.popupOpen == false);
},
goToURI : function() {
Browser.content.loadURI(this._urlbar.value, null, null, false);
},
search : function() {
var queryURI = "http://www.google.com/search?q=" + this._urlbar.value + "&hl=en&lr=&btnG=Search";
Browser.content.loadURI(queryURI, null, null, false);
},
getURLBar : function() {
return this._urlbar;
},
handleEvent: function (aEvent) {
switch (aEvent.type) {
case "DOMLinkAdded":
this._linkAdded(aEvent);
break;
case "focus":
setTimeout(function() { aEvent.target.select(); }, 0);
break;
case "input":
this.update(TOOLBARSTATE_TYPING);
break;
case "error":
this._favicon.setAttribute("src", "chrome://browser/skin/images/default-favicon.png");
break;
}
},
supportsCommand : function(cmd) {
var isSupported = false;
switch (cmd) {
case "cmd_back":
case "cmd_forward":
case "cmd_reload":
case "cmd_stop":
case "cmd_search":
case "cmd_go":
case "cmd_star":
case "cmd_bookmarks":
isSupported = true;
break;
default:
isSupported = false;
break;
}
return isSupported;
},
isCommandEnabled : function(cmd) {
return true;
},
doCommand : function(cmd) {
var browser = Browser.content.browser;
switch (cmd) {
case "cmd_back":
browser.stop();
browser.goBack();
break;
case "cmd_forward":
browser.stop();
browser.goForward();
break;
case "cmd_reload":
browser.reload();
break;
case "cmd_stop":
browser.stop();
break;
case "cmd_search":
{
this.search();
break;
}
case "cmd_go":
{
this.goToURI();
break;
}
case "cmd_star":
{
var bookmarkURI = browser.currentURI;
var bookmarkTitle = browser.contentDocument.title;
var bookmarks = Cc["@mozilla.org/browser/nav-bookmarks-service;1"].getService(Ci.nsINavBookmarksService);
if (bookmarks.getBookmarkIdsForURI(bookmarkURI, {}).length == 0) {
var bookmarkId = bookmarks.insertBookmark(bookmarks.bookmarksMenuFolder, bookmarkURI, bookmarks.DEFAULT_INDEX, bookmarkTitle);
document.getElementById("tool_star").setAttribute("starred", "true");
var ios = Cc["@mozilla.org/network/io-service;1"].getService(Ci.nsIIOService);
var favicon = document.getElementById("urlbar-favicon");
var faviconURI = ios.newURI(favicon.src, null, null);
var fis = Cc["@mozilla.org/browser/favicon-service;1"].getService(Ci.nsIFaviconService);
fis.setAndLoadFaviconForPage(bookmarkURI, faviconURI, true);
}
else {
Bookmarks.edit(bookmarkURI);
}
break;
}
case "cmd_bookmarks":
Bookmarks.list();
break;
}
}
};

Просмотреть файл

@ -0,0 +1,80 @@
<?xml version="1.0"?>
<!-- ***** BEGIN LICENSE BLOCK *****
- 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 Mozilla Mobile Browser.
-
- The Initial Developer of the Original Code is
- Mozilla Corporation.
- Portions created by the Initial Developer are Copyright (C) 2008
- the Initial Developer. All Rights Reserved.
-
- Contributor(s):
- Mark Finkle <mfinkle@mozila.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 LGPL or the GPL. 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 ***** -->
<!DOCTYPE overlay SYSTEM "chrome://browser/locale/toolbar.dtd">
<overlay id="toolbar-overlay" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<script type="application/x-javascript" src="chrome://browser/content/toolbar.js"/>
<commandset id="cmdset_main">
<command id="cmd_back" label="&back.label;" disabled="true" oncommand="CommandUpdater.doCommand(this.id);"/>
<command id="cmd_forward" label="&forward.label;" disabled="true" oncommand="CommandUpdater.doCommand(this.id);"/>
<command id="cmd_reload" label="&reload.label;" oncommand="CommandUpdater.doCommand(this.id);"/>
<command id="cmd_stop" label="&stop.label;" oncommand="CommandUpdater.doCommand(this.id);"/>
<command id="cmd_search" label="&search.label;" oncommand="CommandUpdater.doCommand(this.id);"/>
<command id="cmd_go" label="&go.label;" oncommand="CommandUpdater.doCommand(this.id);"/>
<command id="cmd_star" label="&star.label;" oncommand="CommandUpdater.doCommand(this.id);"/>
<command id="cmd_bookmarks" label="&bookmarks.label;" oncommand="CommandUpdater.doCommand(this.id);"/>
</commandset>
<toolbox insertbefore="browser">
<toolbar id="toolbar_main" mode="icons">
<toolbarbutton id="tool_back" command="cmd_back"/>
<toolbarbutton id="tool_forward" command="cmd_forward"/>
<toolbaritem id="urlbar-container" flex="1">
<stack id="urlbar-image-stack">
<image id="urlbar-throbber" src="throbber.png"/>
<image id="urlbar-favicon" src=""/>
</stack>
<textbox id="urlbar" type="autocomplete" autocompletesearch="history" enablehistory="false" maxrows="6" completeselectedindex="true" flex="1"
ontextentered="LocationBar.goToURI();" ontextreverted="LocationBar.revertURI();"/>
<hbox id="urlbar-icons">
<toolbarbutton id="tool_search" command="cmd_search"/>
<toolbarbutton id="tool_go" command="cmd_go"/>
<toolbarbutton id="tool_reload" command="cmd_reload"/>
<toolbarbutton id="tool_stop" command="cmd_stop"/>
</hbox>
</toolbaritem>
<toolbarbutton id="tool_star" command="cmd_star"/>
<toolbarbutton id="tool_bookmarks" command="cmd_bookmarks"/>
</toolbar>
</toolbox>
</overlay>

Просмотреть файл

@ -9,6 +9,14 @@ browser.jar:
content/deckbrowser.css (content/deckbrowser.css)
content/scrollbars.css (content/scrollbars.css)
content/content.css (content/content.css)
content/toolbar.xul (content/toolbar.xul)
content/toolbar.js (content/toolbar.js)
content/bookmarks.xul (content/bookmarks.xul)
content/bookmarks.js (content/bookmarks.js)
content/downloads.xul (content/downloads.xul)
content/downloads.js (content/downloads.js)
content/hud.xul (content/hud.xul)
content/hud.js (content/hud.js)
% content branding %branding/
% locale branding @AB_CD@ %branding/
branding/brand.dtd (locale/@AB_CD@/brand/brand.dtd)
@ -17,8 +25,10 @@ browser.jar:
classic.jar:
% skin browser classic/1.0 %
browser.css (skin/browser.css)
hud.css (skin/hud.css)
images/bookmarks.png (skin/images/bookmarks.png)
images/close.png (skin/images/close.png)
images/close-small.png (skin/images/close-small.png)
images/default-favicon.png (skin/images/default-favicon.png)
images/go-arrow.png (skin/images/go-arrow.png)
images/page-starred.png (skin/images/page-starred.png)
@ -29,7 +39,11 @@ classic.jar:
images/throbber.png (skin/images/throbber.png)
images/throbber.gif (skin/images/throbber.gif)
images/toolbar.png (skin/images/toolbar.png)
images/mono-toolbar.png (skin/images/mono-toolbar.png)
@AB_CD@.jar:
% locale browser @AB_CD@ %
browser.dtd (locale/@AB_CD@/browser.dtd)
bookmarks.dtd (locale/@AB_CD@/bookmarks.dtd)
hud.dtd (locale/@AB_CD@/hud.dtd)
toolbar.dtd (locale/@AB_CD@/toolbar.dtd)

Просмотреть файл

@ -0,0 +1,6 @@
<!ENTITY editBookmark.title "Edit Bookmark">
<!ENTITY bookmarkURL.label "Address:">
<!ENTITY bookmarkName.label "Name:">
<!ENTITY removeBookmark.label "Remove Bookmark">
<!ENTITY saveBookmark.label "Done">
<!ENTITY closeBookmark.label "Cancel">

Просмотреть файл

@ -1,20 +1,4 @@
<!ENTITY browser.title "Firefox">
<!ENTITY back.label "Back">
<!ENTITY back.tooltip "Back">
<!ENTITY forward.label "Forward">
<!ENTITY forward.tooltip "Forward">
<!ENTITY reload.label "Reload">
<!ENTITY reload.tooltip "Reload">
<!ENTITY stop.label "Stop">
<!ENTITY stop.tooltip "Stop">
<!ENTITY search.label "Search">
<!ENTITY search.tooltip "Search">
<!ENTITY go.label "Go">
<!ENTITY go.tooltip "Go">
<!ENTITY star.label "Star">
<!ENTITY star.tooltip "Bookmark this page">
<!ENTITY bookmarks.label "Bookmarks">
<!ENTITY bookmarks.tooltip "View bookmarks">
<!ENTITY cut.label "Cut">
<!ENTITY copy.label "Copy">
@ -29,10 +13,3 @@
<!ENTITY closeTab.label "Close Tab">
<!ENTITY switchTab.label "Switch Tab...">
<!ENTITY addons.label "Add-ons">
<!ENTITY editBookmark.title "Edit Bookmark">
<!ENTITY bookmarkURL.label "Address:">
<!ENTITY bookmarkName.label "Name:">
<!ENTITY removeBookmark.label "Remove Bookmark">
<!ENTITY saveBookmark.label "Done">
<!ENTITY closeBookmark.label "Cancel">

Просмотреть файл

@ -0,0 +1,16 @@
<!ENTITY back.label "Back">
<!ENTITY back.tooltip "Back">
<!ENTITY forward.label "Forward">
<!ENTITY forward.tooltip "Forward">
<!ENTITY reload.label "Reload">
<!ENTITY reload.tooltip "Reload">
<!ENTITY stop.label "Stop">
<!ENTITY stop.tooltip "Stop">
<!ENTITY search.label "Search">
<!ENTITY search.tooltip "Search">
<!ENTITY go.label "Go">
<!ENTITY go.tooltip "Go">
<!ENTITY star.label "Star">
<!ENTITY star.tooltip "Bookmark this page">
<!ENTITY bookmarks.label "Bookmarks">
<!ENTITY bookmarks.tooltip "View bookmarks">

Просмотреть файл

@ -0,0 +1,16 @@
<!ENTITY back.label "Back">
<!ENTITY back.tooltip "Back">
<!ENTITY forward.label "Forward">
<!ENTITY forward.tooltip "Forward">
<!ENTITY reload.label "Reload">
<!ENTITY reload.tooltip "Reload">
<!ENTITY stop.label "Stop">
<!ENTITY stop.tooltip "Stop">
<!ENTITY search.label "Search">
<!ENTITY search.tooltip "Search">
<!ENTITY go.label "Go">
<!ENTITY go.tooltip "Go">
<!ENTITY star.label "Star">
<!ENTITY star.tooltip "Bookmark this page">
<!ENTITY bookmarks.label "Bookmarks">
<!ENTITY bookmarks.tooltip "View bookmarks">

Просмотреть файл

@ -53,10 +53,6 @@ menuitem {
font-size: 16.75pt !important;
}
.menu-text {
padding-start-value: 0px !important;
}
label,
description,
textbox {
@ -78,14 +74,6 @@ toolbar {
padding-right: 6px;
}
toolbar[mode="icons"] .toolbarbutton-text {
display: none !important;
}
toolbar[mode="text"] .toolbarbutton-icon {
display: none;
}
toolbarbutton {
-moz-appearance: none !important;
-moz-box-orient: vertical;
@ -96,6 +84,10 @@ toolbarbutton {
list-style-image: url("chrome://browser/skin/images/toolbar.png");
}
toolbarbutton .toolbarbutton-text {
display: none !important;
}
toolbarbutton:hover,
toolbarbutton:hover:active,
toolbarbutton[open="true"] {
@ -122,7 +114,7 @@ toolbarbutton[open="true"] {
/*list-style-image: url("moz-icon://stock/gtk-go-forward?size=toolbar&state=disabled");*/
}
#tool_reload {
#tool_reload, #hudbar-reload {
-moz-image-region: rect(0px 96px 24px 72px);
/*list-style-image: url("moz-icon://stock/gtk-refresh?size=toolbar");*/
}
@ -132,7 +124,7 @@ toolbarbutton[open="true"] {
/*list-style-image: url("moz-icon://stock/gtk-refresh?size=toolbar&state=disabled");*/
}
#tool_stop {
#tool_stop, #hudbar-stop {
-moz-image-region: rect(0px 72px 24px 48px);
/*list-style-image: url("moz-icon://stock/gtk-stop?size=toolbar");*/
}
@ -150,11 +142,11 @@ toolbarbutton[open="true"] {
list-style-image: url(chrome://browser/skin/images/go-arrow.png);
}
#tool_star {
#tool_star, #hudbar-star {
list-style-image: url(chrome://browser/skin/images/star-page.png);
}
#tool_star[starred="true"] {
#tool_star[starred="true"], #hudbarstar[starred="true"] {
list-style-image: url(chrome://browser/skin/images/page-starred.png);
}
@ -264,12 +256,12 @@ toolbarbutton[open="true"] {
}
.deckpage-close {
width: 24px;
height: 24px;
-moz-image-region: rect(0px, 16px, 16px, 0px);
list-style-image: url(chrome://browser/skin/images/close.png);
width: 32px;
height: 32px;
list-style-image: url(chrome://browser/skin/images/close-small.png);
}
/*
.deckpage-close:hover {
-moz-image-region: rect(0px, 32px, 16px, 16px);
}
*/

173
mobile/chrome/skin/hud.css Normal file
Просмотреть файл

@ -0,0 +1,173 @@
/* ***** BEGIN LICENSE BLOCK *****
* 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 Mozilla Mobile Browser.
*
* The Initial Developer of the Original Code is
* Mozilla Corporation.
* Portions created by the Initial Developer are Copyright (C) 2008
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Mark Finkle <mfinkle@mozilla.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 ***** */
#hud-ui, #hudmenu {
-moz-appearance: none;
padding: 8px !important;
background-color: rgba(68,68,68,0.9);
border: 1px solid rgba(255,255,255,0.25);
-moz-border-radius: 14px;
color: #ffffff;
}
#hudbar-container toolbarbutton {
-moz-appearance: none !important;
-moz-box-orient: vertical;
min-width: 0px;
padding: 5px !important;
margin: 0px !important;
-moz-margin-end: 0px;
list-style-image: url("chrome://browser/skin/images/mono-toolbar.png");
}
/*
toolbarbutton .toolbarbutton-text {
display: none !important;
}
toolbarbutton:hover,
toolbarbutton:hover:active,
toolbarbutton[open="true"] {
border-color: transparent;
}
*/
#hudbar-reload {
-moz-image-region: rect(0px 108px 36px 72px);
}
#hudbar-stop {
-moz-image-region: rect(0px 216px 36px 180px);
}
#hudbar-star {
-moz-image-region: rect(0px 144px 36px 108px);
}
#hudbar-star[starred="true"] {
-moz-image-region: rect(0px 180px 36px 144px);
}
#hudbar-search {
-moz-image-region: rect(0px 36px 36px 0px);
}
#hudbar-go {
-moz-image-region: rect(0px 72px 36px 36px);
}
#hudbar-container[mode="loading"] > #hudbar-icons > #hudbar-go,
#hudbar-container[mode="loading"] > #hudbar-icons > #hudbar-search,
#hudbar-container[mode="loading"] > #hudbar-icons > #hudbar-reload,
#hudbar-container[mode="loading"] > #hudbar-icons > #hudbar-star {
visibility: collapse;
}
#hudbar-container[mode="view"] > #hudbar-icons > #hudbar-go,
#hudbar-container[mode="view"] > #hudbar-icons > #hudbar-search,
#hudbar-container[mode="view"] > #hudbar-icons > #hudbar-stop {
visibility: collapse;
}
#hudbar-container[mode="edit"] > #hudbar-icons > #hudbar-reload,
#hudbar-container[mode="edit"] > #hudbar-icons > #hudbar-star,
#hudbar-container[mode="edit"] > #hudbar-icons > #hudbar-stop {
visibility: collapse;
}
#hudbar-container {
-moz-box-align: center;
border: 1px solid transparent;
-moz-border-radius: 14px;
}
#hudbar-container[mode="edit"] {
-moz-box-orient: horizontal;
-moz-box-align: center;
background-color: #fff;
border-color: #000;
}
#hudbar-caption {
margin: 2px 8px 2px 8px;
}
#hudbar-edit {
-moz-appearance: none !important;
padding: 0px !important;
border: none !important;
}
#hudlist-items {
-moz-appearance: none !important;
background-color: transparent;
border: 2px solid #fff !important;
-moz-border-radius: 14px;
margin-top: 12px
}
.hudlist-item {
-moz-appearance: none !important;
margin: 8px;
color: #fff;
}
.hudlist-image {
width: 24px;
height: 24px;
}
/* favicon images are 16x16 */
#hudbar-image-stack {
width: 36px;
height: 36px;
margin: 2px 2px 2px 12px;
}
/* urlbar toolbuttons images are 36x36 */
#hudbar-icons {
height: 36px;
-moz-box-align: center;
-moz-padding-end: 2px;
}
#hudbuttons-close {
list-style-image: url(chrome://browser/skin/images/close-small.png);
}
#hudbookmark-grid row {
-moz-box-align: center;
}

Двоичные данные
mobile/chrome/skin/images/close-small.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 1.8 KiB

Двоичные данные
mobile/chrome/skin/images/close.png

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 1.8 KiB

После

Ширина:  |  Высота:  |  Размер: 1.6 KiB

Двоичные данные
mobile/chrome/skin/images/mono-toolbar.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 3.4 KiB