mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2026-02-13 05:35:45 +01:00
Merge branch 'master' into xulmus
This commit is contained in:
@@ -81,11 +81,11 @@ $(RDF): $(RDF_IN) Makefile
|
||||
< $< > $@
|
||||
@echo "SUCCESS: $@"
|
||||
|
||||
clean: $(LOCALES:%=%.clean)
|
||||
clean: $(LOCALEDIR)/$(LOCALES:%=%.clean)
|
||||
@echo "General $(NAME) cleanup..."
|
||||
rm -f $(JAR) $(XPI)
|
||||
|
||||
distclean: $(LOCALES:%=%.distclean) clean
|
||||
distclean: $(LOCALEDIR)/$(LOCALES:%=%.distclean) clean
|
||||
@echo "More $(NAME) cleanup..."
|
||||
rm -rf $(BUILD_DIR)
|
||||
|
||||
|
||||
@@ -57,5 +57,6 @@ $(ADC_FILES): %.html: %.txt $(BASE)/Makefile.doc $(ADC_DEPS)
|
||||
version.html: ../../NEWS $(BASE)/Makefile.doc $(ADC_DEPS)
|
||||
@echo "DOC locale/$(LOCALE)/$@"
|
||||
# NOTE: asciidoc doesn't source the conf file implicitly when processing stdin
|
||||
sed -e '1i\HEADER' -e '/^[0-9]/d' -e '/^ \+\* version /s/.*version \+\([0-9.]\+\).*/section:Version{nbsp}\1[version-\1]\
|
||||
sed -e '1i\
|
||||
HEADER' -e '/^[0-9]/d' -e '/^ \+\* version /s/.*version \+\([0-9.]\+\).*/section:Version{nbsp}\1[version-\1]\
|
||||
/' ../../NEWS | ${ASCIIDOC} -f asciidoc.conf -a doctitle=version.html -o version.html -
|
||||
|
||||
@@ -658,7 +658,11 @@ CompletionContext.prototype = {
|
||||
this.tabPressed = false;
|
||||
this.title = ["Completions"];
|
||||
this.updateAsync = false;
|
||||
this.waitingForTab = false;
|
||||
try
|
||||
{
|
||||
this.waitingForTab = false;
|
||||
}
|
||||
catch (e) {}
|
||||
|
||||
this.cancelAll();
|
||||
|
||||
@@ -677,7 +681,11 @@ CompletionContext.prototype = {
|
||||
for each (let context in this.contexts)
|
||||
{
|
||||
context.hasItems = false;
|
||||
context.incomplete = false;
|
||||
try
|
||||
{
|
||||
context.incomplete = false;
|
||||
}
|
||||
catch (e) {}
|
||||
}
|
||||
},
|
||||
|
||||
@@ -685,8 +693,9 @@ CompletionContext.prototype = {
|
||||
* Wait for all subcontexts to complete.
|
||||
*
|
||||
* @param {boolean} interruptible When true, the call may be interrupted
|
||||
* via <C-c>. In this case, "Interrupted" may be thrown.
|
||||
* via <C-c>, in which case, "Interrupted" may be thrown.
|
||||
* @param {number} timeout The maximum time, in milliseconds, to wait.
|
||||
* If 0 or null, wait indefinately.
|
||||
*/
|
||||
wait: function wait(interruptable, timeout)
|
||||
{
|
||||
|
||||
@@ -607,8 +607,12 @@ function Editor() //{{{
|
||||
unselectText: function ()
|
||||
{
|
||||
let elem = window.document.commandDispatcher.focusedElement;
|
||||
if (elem && elem.selectionEnd)
|
||||
elem.selectionEnd = elem.selectionStart;
|
||||
// A error occurs if the element has been removed when "elem.selectionStart" is executed.
|
||||
try {
|
||||
if (elem && elem.selectionEnd)
|
||||
elem.selectionEnd = elem.selectionStart;
|
||||
}
|
||||
catch (e) {}
|
||||
},
|
||||
|
||||
selectedText: function ()
|
||||
@@ -619,12 +623,23 @@ function Editor() //{{{
|
||||
|
||||
pasteClipboard: function ()
|
||||
{
|
||||
if (liberator.has("Win32"))
|
||||
{
|
||||
this.executeCommand("cmd_paste");
|
||||
return;
|
||||
}
|
||||
|
||||
// FIXME: #93 (<s-insert> in the bottom of a long textarea bounces up)
|
||||
let elem = window.document.commandDispatcher.focusedElement;
|
||||
|
||||
if (elem.setSelectionRange && util.readFromClipboard())
|
||||
// readFromClipboard would return 'undefined' if not checked
|
||||
// dunno about .setSelectionRange
|
||||
{
|
||||
// This is a hacky fix - but it works.
|
||||
let curTop = elem.scrollTop;
|
||||
let curLeft = elem.scrollLeft;
|
||||
|
||||
let rangeStart = elem.selectionStart; // caret position
|
||||
let rangeEnd = elem.selectionEnd;
|
||||
let tempStr1 = elem.value.substring(0, rangeStart);
|
||||
@@ -633,6 +648,9 @@ function Editor() //{{{
|
||||
elem.value = tempStr1 + tempStr2 + tempStr3;
|
||||
elem.selectionStart = rangeStart + tempStr2.length;
|
||||
elem.selectionEnd = elem.selectionStart;
|
||||
|
||||
elem.scrollTop = curTop;
|
||||
elem.scrollLeft = curLeft;
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
@@ -639,7 +639,7 @@ function Events() //{{{
|
||||
{
|
||||
for (let [,dir] in Iterator(dirs))
|
||||
{
|
||||
liberator.echomsg('Searching for "macros/*" in ' + dir.path.quote(), 2);
|
||||
liberator.echomsg('Searching for "macros/*" in "' + dir.path + '"', 2);
|
||||
|
||||
liberator.log("Sourcing macros directory: " + dir.path + "...", 3);
|
||||
|
||||
@@ -932,6 +932,8 @@ function Events() //{{{
|
||||
{
|
||||
if (!ctrl && !alt && !shift && !meta)
|
||||
return false; // an invalid key like <a>
|
||||
else if (shift)
|
||||
keyname = keyname.toUpperCase();
|
||||
charCode = keyname.charCodeAt(0);
|
||||
}
|
||||
else if (keyname.toLowerCase() == "space")
|
||||
@@ -1388,8 +1390,11 @@ function Events() //{{{
|
||||
if (key == "<C-c>" && !event.isMacro)
|
||||
{
|
||||
events.feedingKeys = false;
|
||||
if (lastMacro)
|
||||
if (modes.isReplaying)
|
||||
{
|
||||
modes.isReplaying = false;
|
||||
setTimeout(function () { liberator.echomsg("Canceled playback of macro '" + lastMacro + "'"); }, 100);
|
||||
}
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
return true;
|
||||
@@ -1709,7 +1714,7 @@ function Events() //{{{
|
||||
{
|
||||
setTimeout(statusline.updateUrl, 100);
|
||||
},
|
||||
setOverLink : function (link, b)
|
||||
setOverLink: function (link, b)
|
||||
{
|
||||
let ssli = options["showstatuslinks"];
|
||||
if (link && ssli)
|
||||
@@ -1773,11 +1778,12 @@ function Events() //{{{
|
||||
|
||||
window.XULBrowserWindow = self.progressListener;
|
||||
window.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIWebNavigation)
|
||||
.QueryInterface(Ci.nsIDocShellTreeItem).treeOwner
|
||||
.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIXULWindow)
|
||||
.XULBrowserWindow = window.XULBrowserWindow;
|
||||
.getInterface(Ci.nsIWebNavigation)
|
||||
.QueryInterface(Ci.nsIDocShellTreeItem)
|
||||
.treeOwner
|
||||
.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIXULWindow)
|
||||
.XULBrowserWindow = self.progressListener;
|
||||
try
|
||||
{
|
||||
getBrowser().addProgressListener(self.progressListener, Ci.nsIWebProgress.NOTIFY_ALL);
|
||||
|
||||
@@ -165,8 +165,76 @@ function Hints() //{{{
|
||||
text = elem.textContent.toLowerCase();
|
||||
|
||||
span = baseNodeAbsolute.cloneNode(true);
|
||||
span.style.left = Math.max((rect.left + scrollX), scrollX) + "px";
|
||||
span.style.top = Math.max((rect.top + scrollY), scrollY) + "px";
|
||||
|
||||
let leftpos = Math.max((rect.left + scrollX), scrollX);
|
||||
let toppos = Math.max((rect.top + scrollY), scrollY);
|
||||
|
||||
if (tagname == "area")
|
||||
{
|
||||
// TODO: Maybe put the following into a seperate function
|
||||
try
|
||||
{
|
||||
// Need to add the offset to the area element.
|
||||
// Always try to find the top-left point, as per vimperator default.
|
||||
let shape = elem.getAttribute("shape").toLowerCase();
|
||||
let coordstr = elem.getAttribute("coords");
|
||||
// Technically it should be only commas, but hey
|
||||
coordstr = coordstr.replace(/\s+[;,]\s+/g, ",").replace(/\s+/g, ",");
|
||||
let coords = coordstr.split(",").map(Number);
|
||||
|
||||
if ((shape == "rect" || shape == "rectangle") && coords.length == 4)
|
||||
{
|
||||
leftpos += coords[0];
|
||||
toppos += coords[1];
|
||||
}
|
||||
else if (shape == "circle" && coords.length == 3)
|
||||
{
|
||||
leftpos += coords[0] - coords[2] / Math.sqrt(2);
|
||||
toppos += coords[1] - coords[2] / Math.sqrt(2);
|
||||
}
|
||||
else if ((shape == "poly" || shape == "polygon") && coords.length % 2 == 0)
|
||||
{
|
||||
let leftbound = Infinity;
|
||||
let topbound = Infinity;
|
||||
|
||||
// First find the top-left corner of the bounding rectangle (offset from image topleft can be noticably suboptimal)
|
||||
for (let i = 0; i < coords.length; i += 2)
|
||||
{
|
||||
leftbound = Math.min(coords[i], leftbound);
|
||||
topbound = Math.min(coords[i+1], topbound);
|
||||
}
|
||||
|
||||
let curtop = null;
|
||||
let curleft = null;
|
||||
let curdist = Infinity;
|
||||
|
||||
// Then find the closest vertex. (we could generalise to nearest point on an edge, but I doubt there is a need)
|
||||
for (let i = 0; i < coords.length; i += 2)
|
||||
{
|
||||
let leftoffset = coords[i] - leftbound;
|
||||
let topoffset = coords[i+1] - topbound;
|
||||
let dist = Math.sqrt(leftoffset * leftoffset + topoffset * topoffset);
|
||||
if (dist < curdist)
|
||||
{
|
||||
curdist = dist;
|
||||
curleft = coords[i];
|
||||
curtop = coords[i+1];
|
||||
}
|
||||
}
|
||||
|
||||
// If we found a satisfactory offset, let's use it.
|
||||
if (curdist < Infinity)
|
||||
{
|
||||
leftpos += curleft;
|
||||
toppos += curtop;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (e) {} //badly formed document, or shape == "default" in which case we don't move the hint
|
||||
}
|
||||
|
||||
span.style.left = leftpos + "px";
|
||||
span.style.top = toppos + "px";
|
||||
fragment.appendChild(span);
|
||||
|
||||
pageHints.push([elem, text, span, null, elem.style.backgroundColor, elem.style.color]);
|
||||
|
||||
@@ -250,7 +250,7 @@ function IO() //{{{
|
||||
|
||||
if (!found)
|
||||
{
|
||||
liberator.echoerr("E344: Can't find directory " + arg.quote() + " in cdpath\n"
|
||||
liberator.echoerr("E344: Can't find directory \"" + arg + "\" in cdpath\n"
|
||||
+ "E472: Command failed");
|
||||
}
|
||||
}
|
||||
@@ -283,7 +283,7 @@ function IO() //{{{
|
||||
|
||||
if (file.exists() && !args.bang)
|
||||
{
|
||||
liberator.echoerr("E189: " + filename.quote() + " exists (add ! to override)");
|
||||
liberator.echoerr("E189: \"" + filename + "\" exists (add ! to override)");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -302,7 +302,7 @@ function IO() //{{{
|
||||
}
|
||||
catch (e)
|
||||
{
|
||||
liberator.echoerr("E190: Cannot open " + filename.quote() + " for writing");
|
||||
liberator.echoerr("E190: Cannot open \"" + filename + "\" for writing");
|
||||
liberator.log("Could not write to " + file.path + ": " + e.message); // XXX
|
||||
}
|
||||
},
|
||||
@@ -524,7 +524,7 @@ function IO() //{{{
|
||||
|
||||
if (!dir.exists() || !dir.isDirectory())
|
||||
{
|
||||
liberator.echoerr("E344: Can't find directory " + dir.path.quote() + " in path");
|
||||
liberator.echoerr("E344: Can't find directory \"" + dir.path + "\" in path");
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -555,6 +555,7 @@ function IO() //{{{
|
||||
*
|
||||
* @param {string} dir The directory to search.
|
||||
* @default $HOME.
|
||||
* @returns {nsIFile} The RC file or null if none is found.
|
||||
*/
|
||||
getRCFile: function (dir)
|
||||
{
|
||||
@@ -842,7 +843,7 @@ lookup:
|
||||
let found = false;
|
||||
|
||||
// FIXME: should use original arg string
|
||||
liberator.echomsg("Searching for " + paths.join(" ").quote() + " in " + options["runtimepath"].quote(), 2);
|
||||
liberator.echomsg("Searching for \"" + paths.join(" ") + "\" in \"" + options["runtimepath"] + "\"", 2);
|
||||
|
||||
outer:
|
||||
for (let [,dir] in Iterator(dirs))
|
||||
@@ -851,7 +852,7 @@ lookup:
|
||||
{
|
||||
let file = joinPaths(dir, path);
|
||||
|
||||
liberator.echomsg("Searching for " + file.path.quote(), 3);
|
||||
liberator.echomsg("Searching for \"" + file.path + "\"", 3);
|
||||
|
||||
if (file.exists() && file.isFile() && file.isReadable())
|
||||
{
|
||||
@@ -865,7 +866,7 @@ lookup:
|
||||
}
|
||||
|
||||
if (!found)
|
||||
liberator.echomsg("not found in 'runtimepath': " + paths.join(" ").quote(), 1); // FIXME: should use original arg string
|
||||
liberator.echomsg("not found in 'runtimepath': \"" + paths.join(" ") + "\"", 1); // FIXME: should use original arg string
|
||||
|
||||
return found;
|
||||
},
|
||||
@@ -892,9 +893,9 @@ lookup:
|
||||
if (!silent)
|
||||
{
|
||||
if (file.exists() && file.isDirectory())
|
||||
liberator.echomsg("Cannot source a directory: " + filename.quote(), 0);
|
||||
liberator.echomsg("Cannot source a directory: \"" + filename + "\"", 0);
|
||||
else
|
||||
liberator.echomsg("could not source: " + filename.quote(), 1);
|
||||
liberator.echomsg("could not source: \"" + filename + "\"", 1);
|
||||
|
||||
liberator.echoerr("E484: Can't open file " + filename);
|
||||
}
|
||||
@@ -902,7 +903,7 @@ lookup:
|
||||
return;
|
||||
}
|
||||
|
||||
liberator.echomsg("sourcing " + filename.quote(), 2);
|
||||
liberator.echomsg("sourcing \"" + filename + "\"", 2);
|
||||
|
||||
let str = self.readFile(file);
|
||||
let uri = services.get("io").newFileURI(file);
|
||||
@@ -1012,7 +1013,7 @@ lookup:
|
||||
if (scriptNames.indexOf(file.path) == -1)
|
||||
scriptNames.push(file.path);
|
||||
|
||||
liberator.echomsg("finished sourcing " + filename.quote(), 2);
|
||||
liberator.echomsg("finished sourcing \"" + filename + "\"", 2);
|
||||
|
||||
liberator.log("Sourced: " + filename, 3);
|
||||
}
|
||||
|
||||
@@ -268,7 +268,7 @@ const liberator = (function () //{{{
|
||||
|
||||
for (let [,dialog] in Iterator(dialogs))
|
||||
{
|
||||
if (arg == dialog[0])
|
||||
if (util.compareIgnoreCase(arg, dialog[0]) == 0)
|
||||
{
|
||||
dialog[2]();
|
||||
return;
|
||||
@@ -285,7 +285,11 @@ const liberator = (function () //{{{
|
||||
{
|
||||
argCount: "1",
|
||||
bang: true,
|
||||
completer: function (context, args) completion.dialog(context)
|
||||
completer: function (context)
|
||||
{
|
||||
context.ignoreCase = true;
|
||||
return completion.dialog(context);
|
||||
}
|
||||
});
|
||||
|
||||
commands.add(["em[enu]"],
|
||||
@@ -1029,11 +1033,11 @@ const liberator = (function () //{{{
|
||||
return;
|
||||
}
|
||||
|
||||
liberator.echomsg('Searching for "plugin/**/*.{js,vimp}" in '
|
||||
+ [dir.path.replace(/.plugin$/, "") for each (dir in dirs)].join(",").quote(), 2);
|
||||
liberator.echomsg('Searching for "plugin/**/*.{js,vimp}" in "'
|
||||
+ [dir.path.replace(/.plugin$/, "") for each (dir in dirs)].join(",") + '"', 2);
|
||||
|
||||
dirs.forEach(function (dir) {
|
||||
liberator.echomsg("Searching for " + (dir.path + "/**/*.{js,vimp}").quote(), 3);
|
||||
liberator.echomsg("Searching for \"" + (dir.path + "/**/*.{js,vimp}") + "\"", 3);
|
||||
sourceDirectory(dir);
|
||||
});
|
||||
},
|
||||
@@ -1291,12 +1295,12 @@ const liberator = (function () //{{{
|
||||
setTimeout(function () {
|
||||
|
||||
let init = services.get("environment").get(config.name.toUpperCase() + "_INIT");
|
||||
let rcFile = io.getRCFile("~");
|
||||
|
||||
if (init)
|
||||
liberator.execute(init);
|
||||
else
|
||||
{
|
||||
let rcFile = io.getRCFile("~");
|
||||
|
||||
if (rcFile)
|
||||
io.source(rcFile.path, true);
|
||||
else
|
||||
@@ -1306,7 +1310,7 @@ const liberator = (function () //{{{
|
||||
if (options["exrc"])
|
||||
{
|
||||
let localRCFile = io.getRCFile(io.getCurrentDirectory().path);
|
||||
if (localRCFile)
|
||||
if (localRCFile && !localRCFile.equals(rcFile))
|
||||
io.source(localRCFile.path, true);
|
||||
}
|
||||
|
||||
@@ -1421,16 +1425,24 @@ window.liberator = liberator;
|
||||
// FIXME: Ugly, etc.
|
||||
window.addEventListener("liberatorHelpLink", function (event) {
|
||||
let elem = event.target;
|
||||
|
||||
if (/^(option|mapping|command)$/.test(elem.className))
|
||||
var tag = elem.textContent.replace(/\s.*/, "");
|
||||
if (/^(mapping|command)$/.test(elem.className))
|
||||
tag = tag.replace(/^\d+/, "");
|
||||
if (elem.className == "command")
|
||||
tag = tag.replace(/\[.*?\]/g, "");
|
||||
tag = tag.replace(/\[.*?\]/g, "").replace(/!$/, "");
|
||||
|
||||
if (tag)
|
||||
var page = liberator.findHelp(tag);
|
||||
|
||||
if (page)
|
||||
{
|
||||
elem.href = "chrome://liberator/locale/" + page;
|
||||
},
|
||||
true, true);
|
||||
if (buffer.URL.replace(/#.*/, "") == elem.href.replace(/#.*/, "")) // XXX
|
||||
setTimeout(function () { content.postMessage("fragmentChange", "*"); }, 0);
|
||||
}
|
||||
}, true, true);
|
||||
|
||||
// called when the chrome is fully loaded and before the main window is shown
|
||||
window.addEventListener("load", liberator.startup, false);
|
||||
|
||||
@@ -626,6 +626,7 @@ function Tabs() //{{{
|
||||
completer: function (context)
|
||||
{
|
||||
context.anchored = false;
|
||||
context.compare = CompletionContext.Sort.unsorted;
|
||||
context.keys = { text: function (item) item.state.entries[0].url, description: "title" };
|
||||
context.completions = tabs.closedTabs;
|
||||
},
|
||||
|
||||
@@ -224,6 +224,7 @@ const template = {
|
||||
return s + <>{str.substr(start)}</>;
|
||||
},
|
||||
|
||||
// FIXME: why is href="#"?
|
||||
highlightURL: function highlightURL(str, force)
|
||||
{
|
||||
if (force || /^[a-zA-Z]+:\/\//.test(str))
|
||||
@@ -263,7 +264,7 @@ const template = {
|
||||
<td class="indicator">{idx == index ? ">" : ""}</td>
|
||||
<td>{Math.abs(idx - index)}</td>
|
||||
<td style="width: 250px; max-width: 500px; overflow: hidden;">{val.title}</td>
|
||||
<td><a href="#" highlight="URL jump-list">{val.URI.spec}</a></td>
|
||||
<td><a href={val.URI.spec} highlight="URL jump-list">{val.URI.spec}</a></td>
|
||||
</tr>)
|
||||
}
|
||||
</table>);
|
||||
|
||||
@@ -1210,7 +1210,7 @@ function CommandLine() //{{{
|
||||
submit: callback,
|
||||
change: extra.onChange,
|
||||
complete: extra.completer,
|
||||
cancel: extra.onCancel,
|
||||
cancel: extra.onCancel
|
||||
};
|
||||
|
||||
modes.push(modes.COMMAND_LINE, modes.PROMPT);
|
||||
@@ -1282,20 +1282,17 @@ function CommandLine() //{{{
|
||||
}
|
||||
else if (event.type == "input")
|
||||
{
|
||||
//liberator.dump("input: " + command);
|
||||
this.resetCompletions();
|
||||
liberator.triggerCallback("change", currentExtendedMode, command);
|
||||
}
|
||||
else if (event.type == "keypress")
|
||||
{
|
||||
let key = events.toString(event);
|
||||
if (completions)
|
||||
completions.previewClear();
|
||||
if (!currentExtendedMode)
|
||||
return true;
|
||||
|
||||
let key = events.toString(event);
|
||||
//liberator.log("command line handling key: " + key + "\n");
|
||||
|
||||
// user pressed ENTER to carry out a command
|
||||
// user pressing ESCAPE is handled in the global onEscape
|
||||
// FIXME: <Esc> should trigger "cancel" event
|
||||
@@ -1412,25 +1409,53 @@ function CommandLine() //{{{
|
||||
let closeWindow = false;
|
||||
let passEvent = false;
|
||||
|
||||
function isScrollable() !win.scrollMaxY == 0;
|
||||
function atEnd() win.scrollY / win.scrollMaxY >= 1;
|
||||
let key = events.toString(event);
|
||||
|
||||
if (event.type == "click")
|
||||
// TODO: Wouldn't multiple handlers be cleaner? --djk
|
||||
if (event.type == "click" && event.target instanceof HTMLAnchorElement)
|
||||
{
|
||||
if (event.target instanceof HTMLAnchorElement && event.button < 2)
|
||||
function openLink(where)
|
||||
{
|
||||
event.preventDefault();
|
||||
let target = event.button == 0 ? liberator.CURRENT_TAB : liberator.NEW_TAB;
|
||||
// FIXME: Why is this needed? --djk
|
||||
if (event.target.getAttribute("href") == "#")
|
||||
liberator.open(event.target.textContent, target);
|
||||
liberator.open(event.target.textContent, where);
|
||||
else
|
||||
liberator.open(event.target.href, target);
|
||||
liberator.open(event.target.href, where);
|
||||
}
|
||||
|
||||
switch (key)
|
||||
{
|
||||
case "<LeftMouse>":
|
||||
// FIXME: the :ls output no longer wraps the buffer URL in an anchor element
|
||||
if (event.originalTarget.getAttributeNS(NS.uri, "highlight") == "URL buffer-list")
|
||||
{
|
||||
event.preventDefault();
|
||||
tabs.select(parseInt(event.originalTarget.parentNode.parentNode.firstChild.textContent, 10) - 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
openLink(liberator.CURRENT_TAB);
|
||||
}
|
||||
break;
|
||||
case "<MiddleMouse>":
|
||||
case "<C-LeftMouse>":
|
||||
case "<C-M-LeftMouse>":
|
||||
openLink(liberator.NEW_BACKGROUND_TAB);
|
||||
break;
|
||||
case "<S-MiddleMouse>":
|
||||
case "<C-S-LeftMouse>":
|
||||
case "<C-M-S-LeftMouse>":
|
||||
openLink(liberator.NEW_TAB);
|
||||
break;
|
||||
case "<S-LeftMouse>":
|
||||
openLink(liberator.NEW_WINDOW);
|
||||
break;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
let key = events.toString(event);
|
||||
|
||||
if (startHints)
|
||||
{
|
||||
statusline.updateInputBuffer("");
|
||||
@@ -1439,6 +1464,9 @@ function CommandLine() //{{{
|
||||
return;
|
||||
}
|
||||
|
||||
function isScrollable() !win.scrollMaxY == 0;
|
||||
function atEnd() win.scrollY / win.scrollMaxY >= 1;
|
||||
|
||||
switch (key)
|
||||
{
|
||||
case "<Esc>":
|
||||
@@ -1488,34 +1516,6 @@ function CommandLine() //{{{
|
||||
break;
|
||||
|
||||
// TODO: <LeftMouse> on the prompt line should scroll one page
|
||||
case "<LeftMouse>":
|
||||
if (event.originalTarget.getAttributeNS(NS.uri, "highlight") == "URL buffer-list")
|
||||
{
|
||||
tabs.select(parseInt(event.originalTarget.parentNode.parentNode.firstChild.textContent, 10) - 1);
|
||||
closeWindow = true;
|
||||
break;
|
||||
}
|
||||
else if (event.originalTarget.localName.toLowerCase() == "a")
|
||||
{
|
||||
liberator.open(event.originalTarget.textContent);
|
||||
break;
|
||||
}
|
||||
case "<A-LeftMouse>": // for those not owning a 3-button mouse
|
||||
case "<MiddleMouse>":
|
||||
if (event.originalTarget.localName.toLowerCase() == "a")
|
||||
{
|
||||
let where = /\btabopen\b/.test(options["activate"]) ?
|
||||
liberator.NEW_TAB : liberator.NEW_BACKGROUND_TAB;
|
||||
liberator.open(event.originalTarget.textContent, where);
|
||||
}
|
||||
break;
|
||||
|
||||
// let Firefox handle those to select table cells or show a context menu
|
||||
case "<C-LeftMouse>":
|
||||
case "<RightMouse>":
|
||||
case "<C-S-LeftMouse>":
|
||||
break;
|
||||
|
||||
// page down
|
||||
case "f":
|
||||
if (options["more"] && isScrollable())
|
||||
@@ -1606,7 +1606,7 @@ function CommandLine() //{{{
|
||||
if (passEvent)
|
||||
events.onKeyPress(event);
|
||||
}
|
||||
else // set update the prompt string
|
||||
else
|
||||
{
|
||||
commandline.updateMorePrompt(showMorePrompt, showMoreHelpPrompt);
|
||||
}
|
||||
@@ -1710,7 +1710,7 @@ function ItemList(id) //{{{
|
||||
if (!iframe)
|
||||
{
|
||||
liberator.log("No iframe with id: " + id + " found, strange things may happen!"); // "The truth is out there..." -- djk
|
||||
return;
|
||||
return; // XXX
|
||||
}
|
||||
|
||||
function dom(xml, map) util.xmlToDom(xml, doc, map);
|
||||
|
||||
@@ -577,7 +577,7 @@ const util = { //{{{
|
||||
*/
|
||||
readFromClipboard: function readFromClipboard()
|
||||
{
|
||||
let url;
|
||||
let str;
|
||||
|
||||
try
|
||||
{
|
||||
@@ -599,12 +599,12 @@ const util = { //{{{
|
||||
if (data)
|
||||
{
|
||||
data = data.value.QueryInterface(Ci.nsISupportsString);
|
||||
url = data.data.substring(0, dataLen.value / 2);
|
||||
str = data.data.substring(0, dataLen.value / 2);
|
||||
}
|
||||
}
|
||||
catch (e) {}
|
||||
|
||||
return url;
|
||||
return str;
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user