mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-22 00:37:58 +01:00
Merge branch 'master' of kmaglione@git.vimperator.org:/git/vimperator/liberator
This commit is contained in:
@@ -1169,10 +1169,10 @@ function Completion() //{{{
|
||||
let styles = {};
|
||||
|
||||
buffer.alternateStyleSheets.forEach(function (style) {
|
||||
if (style.title in styles)
|
||||
styles[style.title].push(style.href);
|
||||
else
|
||||
styles[style.title] = [style.href];
|
||||
if (!(style.title in styles))
|
||||
styles[style.title] = [];
|
||||
|
||||
styles[style.title].push(style.href || "inline");
|
||||
});
|
||||
|
||||
context.completions = [[s, styles[s].join(", ")] for (s in styles)];
|
||||
@@ -1606,9 +1606,9 @@ function Completion() //{{{
|
||||
// if the 'complete' argument is passed like "h", it temporarily overrides the complete option
|
||||
url: function url(context, complete)
|
||||
{
|
||||
var numLocationCompletions = 0; // how many async completions did we already return to the caller?
|
||||
var start = 0;
|
||||
var skip = context.filter.match("^.*" + options["urlseparator"]); // start after the last 'urlseparator'
|
||||
let numLocationCompletions = 0; // how many async completions did we already return to the caller?
|
||||
let start = 0;
|
||||
let skip = context.filter.match("^.*" + options["urlseparator"]); // start after the last 'urlseparator'
|
||||
if (skip)
|
||||
context.advance(skip[0].length);
|
||||
|
||||
|
||||
@@ -207,7 +207,7 @@ function AutoCommands() //{{{
|
||||
}
|
||||
});
|
||||
|
||||
var list = template.commandOutput(
|
||||
let list = template.commandOutput(
|
||||
<table>
|
||||
<tr highlight="Title">
|
||||
<td colspan="2">----- Auto Commands -----</td>
|
||||
@@ -282,7 +282,7 @@ function Events() //{{{
|
||||
|
||||
try // not every extension has a getBrowser() method
|
||||
{
|
||||
var tabcontainer = getBrowser().mTabContainer;
|
||||
let tabcontainer = getBrowser().mTabContainer;
|
||||
if (tabcontainer) // not every VIM-like extension has a tab container
|
||||
{
|
||||
tabcontainer.addEventListener("TabMove", function (event)
|
||||
@@ -434,14 +434,14 @@ function Events() //{{{
|
||||
|
||||
function isFormElemFocused()
|
||||
{
|
||||
var elt = window.document.commandDispatcher.focusedElement;
|
||||
let elt = window.document.commandDispatcher.focusedElement;
|
||||
if (elt == null)
|
||||
return false;
|
||||
|
||||
try
|
||||
{ // sometimes the elt doesn't have .localName
|
||||
var tagname = elt.localName.toLowerCase();
|
||||
var type = elt.type.toLowerCase();
|
||||
let tagname = elt.localName.toLowerCase();
|
||||
let type = elt.type.toLowerCase();
|
||||
|
||||
if ((tagname == "input" && (type != "image")) ||
|
||||
tagname == "textarea" ||
|
||||
@@ -524,7 +524,7 @@ function Events() //{{{
|
||||
if (options["focuscontent"])
|
||||
{
|
||||
setTimeout(function () {
|
||||
var focused = document.commandDispatcher.focusedElement;
|
||||
let focused = document.commandDispatcher.focusedElement;
|
||||
if (focused && (focused.value !== undefined) && focused.value.length == 0)
|
||||
focused.blur();
|
||||
}, 100);
|
||||
@@ -741,7 +741,7 @@ function Events() //{{{
|
||||
|
||||
playMacro: function (macro)
|
||||
{
|
||||
var res = false;
|
||||
let res = false;
|
||||
if (!/[a-zA-Z0-9@]/.test(macro) && macro.length == 1)
|
||||
{
|
||||
liberator.echoerr("E354: Invalid register name: '" + macro + "'");
|
||||
@@ -794,13 +794,13 @@ function Events() //{{{
|
||||
if (!filter)
|
||||
return macros;
|
||||
|
||||
var re = new RegExp(filter);
|
||||
let re = new RegExp(filter);
|
||||
return ([macro, keys] for ([macro, keys] in macros) if (re.test(macro)));
|
||||
},
|
||||
|
||||
deleteMacros: function (filter)
|
||||
{
|
||||
var re = new RegExp(filter);
|
||||
let re = new RegExp(filter);
|
||||
|
||||
for (let [item,] in macros)
|
||||
{
|
||||
@@ -817,13 +817,13 @@ function Events() //{{{
|
||||
// if you want < to be taken literally, prepend it with a \\
|
||||
feedkeys: function (keys, noremap, silent)
|
||||
{
|
||||
var doc = window.document;
|
||||
var view = window.document.defaultView;
|
||||
var escapeKey = false; // \ to escape some special keys
|
||||
let doc = window.document;
|
||||
let view = window.document.defaultView;
|
||||
let escapeKey = false; // \ to escape some special keys
|
||||
|
||||
var wasFeeding = this.feedingKeys;
|
||||
let wasFeeding = this.feedingKeys;
|
||||
this.feedingKeys = true;
|
||||
var wasSilent = commandline.silent;
|
||||
let wasSilent = commandline.silent;
|
||||
if (silent)
|
||||
commandline.silent = silent;
|
||||
|
||||
@@ -1041,7 +1041,7 @@ function Events() //{{{
|
||||
modes.show();
|
||||
|
||||
// TODO: allow macros to be continued when page does not fully load with an option
|
||||
var ret = (buffer.loaded == 1);
|
||||
let ret = (buffer.loaded == 1);
|
||||
if (!ret)
|
||||
liberator.echoerr("Page did not load completely in " + ms + " milliseconds. Macro stopped.");
|
||||
liberator.dump("done waiting: " + ret);
|
||||
@@ -1066,8 +1066,8 @@ function Events() //{{{
|
||||
|
||||
function hasHTMLDocument(win) win && win.document && win.document instanceof HTMLDocument
|
||||
|
||||
var win = window.document.commandDispatcher.focusedWindow;
|
||||
var elem = window.document.commandDispatcher.focusedElement;
|
||||
let win = window.document.commandDispatcher.focusedWindow;
|
||||
let elem = window.document.commandDispatcher.focusedElement;
|
||||
|
||||
if (win && win.top == content && liberator.has("tabs"))
|
||||
tabs.localStore.focusedFrame = win;
|
||||
@@ -1136,8 +1136,8 @@ function Events() //{{{
|
||||
|
||||
onSelectionChange: function (event)
|
||||
{
|
||||
var couldCopy = false;
|
||||
var controller = document.commandDispatcher.getControllerForCommand("cmd_copy");
|
||||
let couldCopy = false;
|
||||
let controller = document.commandDispatcher.getControllerForCommand("cmd_copy");
|
||||
if (controller && controller.isCommandEnabled("cmd_copy"))
|
||||
couldCopy = true;
|
||||
|
||||
@@ -1176,7 +1176,7 @@ function Events() //{{{
|
||||
{
|
||||
case modes.NORMAL:
|
||||
// clear any selection made
|
||||
var selection = window.content.getSelection();
|
||||
let selection = window.content.getSelection();
|
||||
try
|
||||
{ // a simple if (selection) does not seem to work
|
||||
selection.collapseToStart();
|
||||
@@ -1606,7 +1606,7 @@ function Events() //{{{
|
||||
},
|
||||
setOverLink : function (link, b)
|
||||
{
|
||||
var ssli = options["showstatuslinks"];
|
||||
let ssli = options["showstatuslinks"];
|
||||
if (link && ssli)
|
||||
{
|
||||
if (ssli == 1)
|
||||
@@ -1635,7 +1635,7 @@ function Events() //{{{
|
||||
prefObserver: {
|
||||
register: function ()
|
||||
{
|
||||
var prefService = Components.classes["@mozilla.org/preferences-service;1"]
|
||||
const prefService = Components.classes["@mozilla.org/preferences-service;1"]
|
||||
.getService(Components.interfaces.nsIPrefService);
|
||||
this._branch = prefService.getBranch(""); // better way to monitor all changes?
|
||||
this._branch.QueryInterface(Components.interfaces.nsIPrefBranch2);
|
||||
@@ -1658,7 +1658,7 @@ function Events() //{{{
|
||||
switch (aData)
|
||||
{
|
||||
case "accessibility.browsewithcaret":
|
||||
var value = options.getPref("accessibility.browsewithcaret", false);
|
||||
let value = options.getPref("accessibility.browsewithcaret", false);
|
||||
liberator.mode = value ? modes.CARET : modes.NORMAL;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -337,7 +337,7 @@ function Search() //{{{
|
||||
// TODO: backwards seems impossible i fear :(
|
||||
find: function (str, backwards)
|
||||
{
|
||||
var fastFind = getBrowser().fastFind;
|
||||
let fastFind = getBrowser().fastFind;
|
||||
|
||||
processUserPattern(str);
|
||||
|
||||
@@ -359,8 +359,8 @@ function Search() //{{{
|
||||
if (getBrowser().fastFind.searchString != lastSearchString)
|
||||
this.find(lastSearchString, false);
|
||||
|
||||
var up = reverse ? !lastSearchBackwards : lastSearchBackwards;
|
||||
var result = getBrowser().fastFind.findAgain(up, linksOnly);
|
||||
let up = reverse ? !lastSearchBackwards : lastSearchBackwards;
|
||||
let result = getBrowser().fastFind.findAgain(up, linksOnly);
|
||||
|
||||
if (result == Components.interfaces.nsITypeAheadFind.FIND_NOTFOUND)
|
||||
{
|
||||
|
||||
@@ -1846,7 +1846,7 @@ function StatusLine() //{{{
|
||||
// tab numbers set
|
||||
if (options.get("guioptions").has("n", "N"))
|
||||
{
|
||||
for (let [i, tab] in Iterator(getBrowser().mTabs))
|
||||
for (let [i, tab] in util.Array.iterator2(getBrowser().mTabs))
|
||||
tab.setAttribute("ordinal", i + 1);
|
||||
}
|
||||
|
||||
|
||||
@@ -220,7 +220,7 @@ const config = { //{{{
|
||||
"Open homepage in a new tab",
|
||||
function ()
|
||||
{
|
||||
var homepages = gHomeButton.getHomePage();
|
||||
let homepages = gHomeButton.getHomePage();
|
||||
liberator.open(homepages, /\bhomepage\b/.test(options["activate"]) ?
|
||||
liberator.NEW_TAB : liberator.NEW_BACKGROUND_TAB);
|
||||
});
|
||||
@@ -233,22 +233,21 @@ const config = { //{{{
|
||||
{
|
||||
if (/^file:\/|^\//.test(url))
|
||||
{
|
||||
//var strippedFilename = url.replace(/^(file:\/\/)?(.*)/, "$2");
|
||||
var file = io.getFile(url);
|
||||
if (!file.exists() || !file.isDirectory())
|
||||
return false;
|
||||
else
|
||||
return true;
|
||||
let file = io.getFile(url);
|
||||
return file.exists() && file.isDirectory();
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
// for all other locations just check if the URL ends with /
|
||||
return /\/$/.test(url);
|
||||
}
|
||||
}
|
||||
|
||||
if (count < 1)
|
||||
count = 1;
|
||||
|
||||
var url = buffer.URL;
|
||||
// XXX
|
||||
let url = buffer.URL;
|
||||
for (let i = 0; i < count; i++)
|
||||
{
|
||||
if (isDirectory(url))
|
||||
@@ -259,10 +258,8 @@ const config = { //{{{
|
||||
url = url.replace(/^(.*:\/+.*?)\/+$/, "$1/"); // get rid of more than 1 / at the end
|
||||
|
||||
if (url == buffer.URL)
|
||||
{
|
||||
liberator.beep();
|
||||
return;
|
||||
}
|
||||
else
|
||||
liberator.open(url);
|
||||
},
|
||||
{ flags: Mappings.flags.COUNT });
|
||||
@@ -271,7 +268,7 @@ const config = { //{{{
|
||||
"Go to the root of the website",
|
||||
function ()
|
||||
{
|
||||
var uri = content.document.location;
|
||||
let uri = content.document.location;
|
||||
if (/(about|mailto):/.test(uri.protocol)) // exclude these special protocols for now
|
||||
{
|
||||
liberator.beep();
|
||||
@@ -321,7 +318,7 @@ const config = { //{{{
|
||||
"Redraw the screen",
|
||||
function ()
|
||||
{
|
||||
var wu = window.QueryInterface(Components.interfaces.nsIInterfaceRequestor).
|
||||
let wu = window.QueryInterface(Components.interfaces.nsIInterfaceRequestor).
|
||||
getInterface(Components.interfaces.nsIDOMWindowUtils);
|
||||
wu.redraw();
|
||||
modes.show();
|
||||
@@ -401,7 +398,7 @@ const config = { //{{{
|
||||
{
|
||||
setter: function (value)
|
||||
{
|
||||
var ioService = Components.classes['@mozilla.org/network/io-service;1']
|
||||
const ioService = Components.classes['@mozilla.org/network/io-service;1']
|
||||
.getService(Components.interfaces.nsIIOService2);
|
||||
|
||||
ioService.offline = !value;
|
||||
@@ -424,7 +421,7 @@ const config = { //{{{
|
||||
{
|
||||
try
|
||||
{
|
||||
var id = config.mainWindowID || "main-window";
|
||||
let id = config.mainWindowID || "main-window";
|
||||
document.getElementById(id).setAttribute("titlemodifier", value);
|
||||
if (window.content.document.title.length > 0)
|
||||
document.title = window.content.document.title + " - " + value;
|
||||
|
||||
Reference in New Issue
Block a user