зеркало из https://github.com/mozilla/ubiquity.git
Enabled context menus and tooltips on Ubiquity panel. Removed #330 hack which started to behave badly since Fx3.6 (possibly related to Bug 543190).
This commit is contained in:
Родитель
b5e9e6693e
Коммит
92ad8f453a
|
@ -1,7 +1,6 @@
|
|||
<?xml version="1.0"?>
|
||||
<?xml-stylesheet href="chrome://ubiquity/skin/browser.css" type="text/css"?>
|
||||
<!DOCTYPE window SYSTEM "chrome://ubiquity/locale/coreubiquity.dtd" >
|
||||
|
||||
<overlay xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
xmlns:svg="http://www.w3.org/2000/svg">
|
||||
<script type="application/javascript;version=1.8"
|
||||
|
@ -11,13 +10,15 @@
|
|||
<script type="application/javascript;version=1.8"
|
||||
src="chrome://ubiquity/content/browser.js"/>
|
||||
<popupset id="mainPopupSet">
|
||||
<panel id="ubiquity-transparent-panel">
|
||||
<panel id="ubiquity-transparent-panel"
|
||||
context="contentAreaContextMenu"
|
||||
oncontextmenu="gUbiquity.closeWindow(); return false">
|
||||
<div id="ubiquity-panel"
|
||||
xmlns="http://www.w3.org/1999/xhtml"
|
||||
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
<div id="ubiquity-frame">
|
||||
<div id="ubiquity-entry-container">
|
||||
<input id="ubiquity-entry"/>
|
||||
<input id="ubiquity-entry" oncontextmenu="event.stopPropagation()"/>
|
||||
</div>
|
||||
<div id="ubiquity-suggest-container">
|
||||
<iframe id="ubiquity-suggest"
|
||||
|
@ -27,6 +28,7 @@
|
|||
<div id="ubiquity-preview">
|
||||
<xul:browser id="ubiquity-browser"
|
||||
type="content" width="490" height="500"
|
||||
tooltip="aHTMLTooltip" oncontextmenu="event.stopPropagation()"
|
||||
disablesecurity="true" disablehistory="true"/>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -67,7 +67,6 @@ function Ubiquity(msgPanel, textBox, cmdManager) {
|
|||
textBox.addEventListener("keydown", this, false);
|
||||
textBox.addEventListener("keypress", this, false);
|
||||
textBox.addEventListener("keyup", this, false);
|
||||
if (this.Utils.OS === "WINNT") textBox.addEventListener("blur", this, false);
|
||||
|
||||
msgPanel.addEventListener("popupshowing", this, false);
|
||||
msgPanel.addEventListener("popupshown", this, false);
|
||||
|
@ -136,13 +135,6 @@ Ubiquity.prototype = {
|
|||
get inputLimit U_getInputLimit() this.__prefs.getValue(
|
||||
"extensions.ubiquity.inputLimit", this.__DEFAULT_INPUT_LIMIT),
|
||||
|
||||
__onblur: function U__onBlur() {
|
||||
// Hackish fix for #330.
|
||||
setTimeout(function U__refocusTextBox(self) {
|
||||
if (self.isWindowOpen) self.__textBox.focus();
|
||||
}, 99, this);
|
||||
},
|
||||
|
||||
__onmousemove: function U__onMouseMove(event) {
|
||||
this.__x = event.screenX;
|
||||
this.__y = event.screenY;
|
||||
|
@ -254,29 +246,24 @@ Ubiquity.prototype = {
|
|||
},
|
||||
|
||||
__onclick: function U__onClick(event) {
|
||||
// middle: open link / execute, right: close panel, left: both
|
||||
// left: open link / execute; middle: same but without closing panel
|
||||
var {button, target, view} = event;
|
||||
MOUSE_EXECUTE:
|
||||
if (button !== 2 &&
|
||||
view.location.href === "chrome://ubiquity/content/suggest.html") {
|
||||
if (button === 2) return;
|
||||
if (view.location.href === "chrome://ubiquity/content/suggest.html") {
|
||||
for (let lm = target, hilited = /\bhilited\b/;; lm = lm.parentNode) {
|
||||
if (!lm || !("hasAttribute" in lm)) break MOUSE_EXECUTE;
|
||||
if (!lm || !("className" in lm)) return;
|
||||
if (hilited.test(lm.className)) break;
|
||||
}
|
||||
this.execute();
|
||||
if (button === 0) this.closeWindow();
|
||||
return true;
|
||||
}
|
||||
if (button !== 2) {
|
||||
do var {href} = target;
|
||||
while (!href && (target = target.parentNode));
|
||||
else {
|
||||
do var {href} = target; while (!href && (target = target.parentNode));
|
||||
if (!href ||
|
||||
/^javascript:/.test(href) ||
|
||||
~href.lastIndexOf("resource://ubiquity/preview.html#", 0))
|
||||
return false;
|
||||
~href.lastIndexOf("javascript:", 0) ||
|
||||
~href.lastIndexOf("resource://ubiquity/preview.html#", 0)) return;
|
||||
this.Utils.openUrlInBrowser(href);
|
||||
}
|
||||
if (button !== 1) this.closeWindow();
|
||||
if (button === 0) this.closeWindow();
|
||||
return true;
|
||||
},
|
||||
|
||||
|
|
|
@ -126,6 +126,7 @@ CommandManager.prototype = {
|
|||
handleEvent: function CM_handleEvent(event) {
|
||||
switch (event.type) {
|
||||
case "click": {
|
||||
if (event.button === 2) return;
|
||||
let {target} = event;
|
||||
do {
|
||||
if (!("hasAttribute" in target)) return;
|
||||
|
|
Загрузка…
Ссылка в новой задаче