1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2026-01-06 15:24:12 +01:00
This commit is contained in:
Kris Maglione
2009-03-30 01:14:46 -04:00
113 changed files with 1839 additions and 712 deletions

View File

@@ -47,11 +47,9 @@
</xul:vbox>
</xul:stack>
<xul:stack class="tab-text-stack">
<xul:label xbl:inherits="value=ordinal" class="tab-text-shadow" liberator:highlight="TabNumber"/>
<xul:label xbl:inherits="value=ordinal" class="tab-text" liberator:highlight="TabNumber"/>
</xul:stack>
<xul:stack class="tab-text-stack" flex="1">
<xul:label flex="1" xbl:inherits="value=label,crop,accesskey" crop="right" class="tab-text-shadow"/>
<xul:label flex="1" xbl:inherits="value=label,crop,accesskey" crop="right" class="tab-text"/>
</xul:stack>
</xul:hbox>

View File

@@ -11,7 +11,7 @@ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
Copyright (c) 2006-2009 by Martin Stubenschrott <stubenschrott@gmx.net>
Copyright (c) 2006-2009 by Martin Stubenschrott <stubenschrott@vimperator.org>
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
@@ -44,7 +44,6 @@ function Buffer() //{{{
// FIXME: This doesn't belong here.
let mainWindowID = config.mainWindowID || "main-window";
let fontSize = util.computedStyle(document.getElementById(mainWindowID)).fontSize;
styles.registerSheet("chrome://liberator/skin/liberator.css");
@@ -125,6 +124,7 @@ function Buffer() //{{{
else
v = win.scrollMaxY / 100 * vertical;
marks.add("'", true);
win.scrollTo(h, v);
}
@@ -147,13 +147,13 @@ function Buffer() //{{{
getter: function () window.fullScreen
});
options.add(["nextpattern"],
options.add(["nextpattern"], // \u00BB is » (>> in a single char)
"Patterns to use when guessing the 'next' page in a document sequence",
"stringlist", "\\bnext\\b,^>$,^(>>|»)$,^(>|»),(>|»)$,\\bmore\\b");
"stringlist", "\\bnext\\b,^>$,^(>>|\u00BB)$,^(>|\u00BB),(>|\u00BB)$,\\bmore\\b");
options.add(["previouspattern"],
options.add(["previouspattern"], // \u00AB is « (<< in a single char)
"Patterns to use when guessing the 'previous' page in a document sequence",
"stringlist", "\\bprev|previous\\b,^<$,^(<<|«)$,^(<|«),(<|«)$");
"stringlist", "\\bprev|previous\\b,^<$,^(<<|\u00AB)$,^(<|\u00AB),(<|\u00AB)$");
options.add(["pageinfo", "pa"], "Desired info on :pa[geinfo]", "charlist", "gfm",
{
@@ -603,6 +603,7 @@ function Buffer() //{{{
commands.add(["st[op]"],
"Stop loading",
<<<<<<< HEAD:common/content/buffer.js
function ()
{
if (config.stop)
@@ -610,6 +611,9 @@ function Buffer() //{{{
else
window.BrowserStop();
},
=======
function () { window.BrowserStop(); },
>>>>>>> a9f04ee3d00b282e7a91b37eb23168fb39e9de5b:common/content/buffer.js
{ argCount: "0" });
commands.add(["vie[wsource]"],
@@ -1034,7 +1038,16 @@ function Buffer() //{{{
}
else if (elemTagName == "input" && elem.getAttribute('type').toLowerCase() == "file")
{
commandline.input("Upload file: ", function (file) elem.value = file, {completer: completion.file, default: elem.value});
commandline.input("Upload file: ", function (path)
{
let file = io.getFile(path);
if (!file.exists())
return liberator.beep();
elem.value = file.path;
}
, {completer: completion.file, default: elem.value});
return;
}
@@ -1144,7 +1157,16 @@ function Buffer() //{{{
}
else if (localName == "input" && elem.getAttribute('type').toLowerCase() == "file")
{
commandline.input("Upload file: ", function (file) elem.value = file, {completer: completion.file, default: elem.value});
commandline.input("Upload file: ", function (path)
{
let file = io.getFile(path);
if (!file.exists())
return liberator.beep();
elem.value = file.path;
}
, {completer: completion.file, default: elem.value});
return;
}
@@ -1297,6 +1319,17 @@ function Buffer() //{{{
scrollToPercentiles(-1, percentage);
},
scrollToRatio: function (x, y)
{
scrollToPercentiles(x * 100, y * 100);
},
scrollTo: function (x, y)
{
marks.add("'", true);
content.scrollTo(x, y);
},
/**
* Scrolls the current buffer laterally to its leftmost.
*/
@@ -1533,12 +1566,11 @@ function Marks() //{{{
function onPageLoad(event)
{
let win = event.originalTarget.defaultView;
for (let i = 0, length = pendingJumps.length; i < length; i++)
for (let [i, mark] in Iterator(pendingJumps))
{
let mark = pendingJumps[i];
if (win && win.location.href == mark.location)
{
win.scrollTo(mark.position.x * win.scrollMaxX, mark.position.y * win.scrollMaxY);
buffer.scrollToRatio(mark.position.x, mark.position.y);
pendingJumps.splice(i, 1);
return;
}
@@ -1583,7 +1615,7 @@ function Marks() //{{{
}
}
function isLocalMark(mark) /^[a-z]$/.test(mark);
function isLocalMark(mark) /^['`a-z]$/.test(mark);
function isURLMark(mark) /^[A-Z0-9]$/.test(mark);
function localMarkIter()
@@ -1744,13 +1776,14 @@ function Marks() //{{{
* @param {string} mark
*/
// TODO: add support for frameset pages
add: function (mark)
add: function (mark, silent)
{
let win = window.content;
if (win.document.body.localName.toLowerCase() == "frameset")
{
liberator.echoerr("Marks support for frameset pages not implemented yet");
if (!silent)
liberator.echoerr("Marks support for frameset pages not implemented yet");
return;
}
@@ -1761,7 +1794,8 @@ function Marks() //{{{
if (isURLMark(mark))
{
urlMarks.set(mark, { location: win.location.href, position: position, tab: tabs.getTab() });
liberator.log("Adding URL mark: " + markToString(mark, urlMarks.get(mark)), 5);
if (!silent)
liberator.log("Adding URL mark: " + markToString(mark, urlMarks.get(mark)), 5);
}
else if (isLocalMark(mark))
{
@@ -1771,7 +1805,8 @@ function Marks() //{{{
localMarks.set(mark, []);
let vals = { location: win.location.href, position: position };
localMarks.get(mark).push(vals);
liberator.log("Adding local mark: " + markToString(mark, vals), 5);
if (!silent)
liberator.log("Adding local mark: " + markToString(mark, vals), 5);
}
},
@@ -1841,7 +1876,7 @@ function Marks() //{{{
return;
}
liberator.log("Jumping to URL mark: " + markToString(mark, slice), 5);
win.scrollTo(slice.position.x * win.scrollMaxX, slice.position.y * win.scrollMaxY);
buffer.scrollToRatio(slice.position.x, slice.position.y);
ok = true;
}
}
@@ -1856,7 +1891,7 @@ function Marks() //{{{
if (win.location.href == lmark.location)
{
liberator.log("Jumping to local mark: " + markToString(mark, lmark), 5);
win.scrollTo(lmark.position.x * win.scrollMaxX, lmark.position.y * win.scrollMaxY);
buffer.scrollToRatio(lmark.position.x, lmark.position.y);
ok = true;
break;
}

View File

@@ -11,7 +11,7 @@ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
Copyright (c) 2006-2009 by Martin Stubenschrott <stubenschrott@gmx.net>
Copyright (c) 2006-2009 by Martin Stubenschrott <stubenschrott@vimperator.org>
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

View File

@@ -11,7 +11,7 @@ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
Copyright (c) 2006-2009 by Martin Stubenschrott <stubenschrott@gmx.net>
Copyright (c) 2006-2009 by Martin Stubenschrott <stubenschrott@vimperator.org>
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
@@ -1393,11 +1393,27 @@ function Completion() //{{{
song: function song(context, args)
{
if (args.completeArg == 0)
context.completions = getArtists();
{
context.title = ["Artists"];
context.completions = player.getArtists();
}
else if (args.completeArg == 1)
context.completions = getAlbums(args[0]);
{
context.title = ["Albums by " + args[0]];
context.completions = player.getAlbums(args[0]);
}
else if (args.completeArg == 2)
context.completions = getTracks(args[0],args[1]);
{
context.title = ["Tracks from " + args[1] + " by " + args[0]];
context.completions = player.getTracks(args[0], args[1]);
}
},
playlist: function playlist(context, args)
{
context.title = ["Playlist", "Type"];
context.keys = { text: "name", description: "type" };
context.completions = player.getPlaylists();
},
buffer: function buffer(context)
@@ -1648,6 +1664,14 @@ function Completion() //{{{
context.completions = marks.all;
},
mediaView: function mediaView(context)
{
context.title = ["Media View", "URL"];
context.anchored = false;
context.keys = { text: "contentTitle", description: "contentUrl" };
context.completions = player.getMediaPages();
},
menuItem: function menuItem(context)
{
context.title = ["Menu Path", "Label"];

View File

@@ -11,7 +11,7 @@ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
Copyright (c) 2006-2009 by Martin Stubenschrott <stubenschrott@gmx.net>
Copyright (c) 2006-2009 by Martin Stubenschrott <stubenschrott@vimperator.org>
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

View File

@@ -11,7 +11,7 @@ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
Copyright (c) 2006-2009 by Martin Stubenschrott <stubenschrott@gmx.net>
Copyright (c) 2006-2009 by Martin Stubenschrott <stubenschrott@vimperator.org>
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
@@ -687,7 +687,7 @@ function Events() //{{{
["<Tab>"], "Advance keyboard focus",
function () { document.commandDispatcher.advanceFocus(); });
mappings.add([modes.NORMAL, modes.PLAYER,modes.VISUAL, modes.CARET, modes.INSERT, modes.TEXTAREA],
mappings.add([modes.NORMAL, modes.PLAYER, modes.VISUAL, modes.CARET, modes.INSERT, modes.TEXTAREA],
["<S-Tab>"], "Rewind keyboard focus",
function () { document.commandDispatcher.rewindFocus(); });
@@ -898,6 +898,7 @@ function Events() //{{{
let wasFeeding = this.feedingKeys;
this.feedingKeys = true;
this.duringFeed = this.duringFeed || "";
let wasSilent = commandline.silent;
if (silent)
commandline.silent = silent;
@@ -993,6 +994,15 @@ function Events() //{{{
this.feedingKeys = wasFeeding;
if (silent)
commandline.silent = wasSilent;
if (this.duringFeed != "")
{
//Create a scalar constant for closure.
let duringFeed = this.duringFeed;
this.duringFeed = "";
setTimeout(function () events.feedkeys(duringFeed, false, false, true), 0);
}
}
return i == keys.length;
},
@@ -1357,9 +1367,9 @@ function Events() //{{{
// we can differentiate between a recorded <C-c>
// interrupting whatever it's started and a real <C-c>
// interrupting our playback.
if (events.feedingKeys)
if (events.feedingKeys && !event.isMacro)
{
if (key == "<C-c>" && !event.isMacro)
if (key == "<C-c>")
{
events.feedingKeys = false;
if (modes.isReplaying)
@@ -1371,6 +1381,13 @@ function Events() //{{{
event.stopPropagation();
return true;
}
else
{
events.duringFeed += key;
event.preventDefault();
event.stopPropagation();
return true;
}
}
let stop = true; // set to false if we should NOT consume this event but let Firefox handle it
@@ -1653,13 +1670,16 @@ function Events() //{{{
}
},
// for notifying the user about secure web pages
onSecurityChange: function (webProgress, aRequest, aState)
onSecurityChange: function (webProgress, request, state)
{
if (aState & Ci.nsIWebProgressListener.STATE_IS_INSECURE)
// TODO: do something useful with STATE_SECURE_MED and STATE_SECURE_LOW
if (state & Ci.nsIWebProgressListener.STATE_IS_INSECURE)
statusline.setClass("insecure");
else if (aState & Ci.nsIWebProgressListener.STATE_IS_BROKEN)
else if (state & Ci.nsIWebProgressListener.STATE_IS_BROKEN)
statusline.setClass("broken");
else if (aState & Ci.nsIWebProgressListener.STATE_IS_SECURE)
else if (state & Ci.nsIWebProgressListener.STATE_IDENTITY_EV_TOPLEVEL)
statusline.setClass("extended");
else if (state & Ci.nsIWebProgressListener.STATE_SECURE_HIGH)
statusline.setClass("secure");
},
onStatusChange: function (webProgress, request, status, message)

View File

@@ -1,4 +1,4 @@
/***** B/GIN LICENSE BLOCK ***** {{{
/***** 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
@@ -11,7 +11,7 @@ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
Copyright (c) 2006-2009 by Martin Stubenschrott <stubenschrott@gmx.net>
Copyright (c) 2006-2009 by Martin Stubenschrott <stubenschrott@vimperator.org>
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

View File

@@ -11,7 +11,7 @@ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
Copyright (c) 2006-2009 by Martin Stubenschrott <stubenschrott@gmx.net>
Copyright (c) 2006-2009 by Martin Stubenschrott <stubenschrott@vimperator.org>
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

View File

@@ -11,7 +11,7 @@ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
Copyright (c) 2006-2009 by Martin Stubenschrott <stubenschrott@gmx.net>
Copyright (c) 2006-2009 by Martin Stubenschrott <stubenschrott@vimperator.org>
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

View File

@@ -11,7 +11,7 @@ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
Copyright (c) 2006-2009 by Martin Stubenschrott <stubenschrott@gmx.net>
Copyright (c) 2006-2009 by Martin Stubenschrott <stubenschrott@vimperator.org>
Code based on venkman
Alternatively, the contents of this file may be used under the terms of
@@ -105,12 +105,7 @@ function IO() //{{{
.map(function (dir) dir == "" ? io.getCurrentDirectory().path : dir);
}
function replacePathSep(path)
{
if (WINDOWS)
return path.replace("/", "\\");
return path;
}
function replacePathSep(path) path.replace("/", IO.PATH_SEP, "g");
function joinPaths(head, tail)
{
@@ -278,7 +273,7 @@ function IO() //{{{
function (args)
{
// TODO: "E172: Only one file name allowed"
let filename = args[0] || "~/" + (WINDOWS ? "_" : ".") + EXTENSION_NAME + "rc";
let filename = args[0] || io.getRCFile(null, true).path;
let file = io.getFile(filename);
if (file.exists() && !args.bang)
@@ -459,11 +454,6 @@ function IO() //{{{
*/
sourcing: null,
/**
* @property {string} The OS's path separator.
*/
pathSeparator: WINDOWS ? "\\" : "/",
/**
* Expands "~" and environment variables in <b>path</b>.
*
@@ -554,10 +544,12 @@ function IO() //{{{
* Returns the first user RC file found in <b>dir</b>.
*
* @param {string} dir The directory to search.
* @param {boolean} always When true, return a path whether
* the file exists or not.
* @default $HOME.
* @returns {nsIFile} The RC file or null if none is found.
*/
getRCFile: function (dir)
getRCFile: function (dir, always)
{
dir = dir || "~";
@@ -571,8 +563,9 @@ function IO() //{{{
return rcFile1;
else if (rcFile2.exists() && rcFile2.isFile())
return rcFile2;
else
return null;
else if (always)
return rcFile1;
return null;
},
// return a nsILocalFile for path where you can call isDirectory(), etc. on
@@ -1107,6 +1100,12 @@ lookup:
}; //}}}
IO.PATH_SEP = (function () {
let file = services.create("file");
file.append("foo");
return file.path[0];
})();
/**
* @property {string} The value of the $VIMPERATOR_RUNTIME environment
* variable.
@@ -1126,8 +1125,6 @@ IO.expandPath = function (path, relative)
{
// TODO: proper pathname separator translation like Vim - this should be done elsewhere
const WINDOWS = liberator.has("Win32");
if (WINDOWS)
path = path.replace("/", "\\", "g");
// expand any $ENV vars - this is naive but so is Vim and we like to be compatible
// TODO: Vim does not expand variables set to an empty string (and documents it).
@@ -1141,7 +1138,8 @@ IO.expandPath = function (path, relative)
path = expand(path);
// expand ~
if (!relative && (WINDOWS ? /^~(?:$|[\\\/])/ : /^~(?:$|\/)/).test(path))
// Yuck.
if (!relative && RegExp("~(?:$|[/" + util.escapeRegex(IO.PATH_SEP) + "])").test(path))
{
// Try $HOME first, on all systems
let home = services.get("environment").get("HOME");
@@ -1157,11 +1155,7 @@ IO.expandPath = function (path, relative)
// TODO: Vim expands paths twice, once before checking for ~, once
// after, but doesn't document it. Is this just a bug? --Kris
path = expand(path);
if (WINDOWS)
path = path.replace("/", "\\", "g");
return path;
return path.replace("/", IO.PATH_SEP, "g");
};
// vim: set fdm=marker sw=4 ts=4 et:

View File

@@ -11,7 +11,7 @@ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
Copyright (c) 2006-2009 by Martin Stubenschrott <stubenschrott@gmx.net>
Copyright (c) 2006-2009 by Martin Stubenschrott <stubenschrott@vimperator.org>
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
@@ -83,9 +83,6 @@ const liberator = (function () //{{{
{
if (nError++ == 0)
window.toJavaScriptConsole();
liberator.dump("Error loading module - "+ name + "..");
liberator.dump(e);
liberator.dump(e.stack);
liberator.reportError(e);
}
}
@@ -1229,7 +1226,12 @@ const liberator = (function () //{{{
config.features.push(getPlatformFeature());
config.defaults = config.defaults || {};
config.guioptions = config.guioptions || {};
config.browserModes = config.browserModes || [modes.NORMAL];
// -> we can't use this, since config.browserModes might already be defined as a getter-only
// TODO: also change the other config.* defaults?
// config.browserModes = config.browserModes || [modes.NORMAL];
if (!config.browserModes)
config.browserModes = [modes.NORMAL];
config.mailModes = config.mailModes || [modes.NORMAL];
// TODO: suitable defaults?
//config.mainWidget
@@ -1290,11 +1292,12 @@ const liberator = (function () //{{{
// TODO: we should have some class where all this guioptions stuff fits well
hideGUI();
// finally, read a ~/.vimperatorrc and plugin/**.{vimp,js}
// finally, read the RC file and source plugins
// make sourcing asynchronous, otherwise commands that open new tabs won't work
setTimeout(function () {
let init = services.get("environment").get(config.name.toUpperCase() + "_INIT");
let extensionName = config.name.toUpperCase();
let init = services.get("environment").get(extensionName + "_INIT");
let rcFile = io.getRCFile("~");
if (init)
@@ -1302,7 +1305,10 @@ const liberator = (function () //{{{
else
{
if (rcFile)
{
io.source(rcFile.path, true);
services.get("environment").set("MY_" + extensionName + "RC", rcFile.path);
}
else
liberator.log("No user RC file found", 3);
}
@@ -1319,7 +1325,7 @@ const liberator = (function () //{{{
// after sourcing the initialization files, this function will set
// all gui options to their default values, if they have not been
// set before by any rc file
// set before by any RC file
for (let option in options)
{
if (option.setter)

View File

@@ -13,7 +13,7 @@ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
Copyright (c) 2006-2009 by Martin Stubenschrott <stubenschrott@gmx.net>
Copyright (c) 2006-2009 by Martin Stubenschrott <stubenschrott@vimperator.org>
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

View File

@@ -11,7 +11,7 @@ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
Copyright (c) 2006-2009 by Martin Stubenschrott <stubenschrott@gmx.net>
Copyright (c) 2006-2009 by Martin Stubenschrott <stubenschrott@vimperator.org>
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
@@ -257,8 +257,11 @@ function Mappings() //{{{
addMapCommands("", [modes.NORMAL], "");
addMapCommands("c", [modes.COMMAND_LINE], "command line");
addMapCommands("i", [modes.INSERT, modes.TEXTAREA], "insert");
// FIXME
if (liberator.has("mail"))
addMapCommands("m", [modes.MESSAGE], "message");
if (liberator.has("player"))
addMapCommands("p", [modes.PLAYER], "player");
/////////////////////////////////////////////////////////////////////////////}}}
////////////////////// PUBLIC SECTION //////////////////////////////////////////

View File

@@ -11,7 +11,7 @@ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
Copyright (c) 2006-2009 by Martin Stubenschrott <stubenschrott@gmx.net>
Copyright (c) 2006-2009 by Martin Stubenschrott <stubenschrott@vimperator.org>
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
@@ -277,6 +277,8 @@ const modes = (function () //{{{
self.addMode("OUTPUT_MULTILINE", true);
self.addMode("SEARCH_FORWARD", true);
self.addMode("SEARCH_BACKWARD", true);
self.addMode("SEARCH_VIEW_FORWARD", true);
self.addMode("SEARCH_VIEW_BACKWARD", true);
self.addMode("MENU", true); // a popupmenu is active
self.addMode("LINE", true); // linewise visual mode
self.addMode("PROMPT", true);

View File

@@ -11,7 +11,7 @@ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
Copyright (c) 2006-2009 by Martin Stubenschrott <stubenschrott@gmx.net>
Copyright (c) 2006-2009 by Martin Stubenschrott <stubenschrott@vimperator.org>
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

View File

@@ -71,9 +71,10 @@ Highlights.prototype.CSS = <![CDATA[
LineNr color: orange; background: white;
Question color: green; background: white; font-weight: bold;
StatusLine color: white; background: black;
StatusLineBroken color: black; background: #FF6060 /* light-red */
StatusLineSecure color: black; background: #B0FF00 /* light-green */
StatusLine color: white; background: black;
StatusLineBroken color: black; background: #FFa0a0 /* light-red */
StatusLineSecure color: black; background: #a0a0FF /* light-blue */
StatusLineExtended color: black; background: #a0FFa0 /* light-green */
TabClose
TabIcon

View File

@@ -11,7 +11,7 @@ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
Copyright (c) 2006-2009 by Martin Stubenschrott <stubenschrott@gmx.net>
Copyright (c) 2006-2009 by Martin Stubenschrott <stubenschrott@vimperator.org>
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
@@ -49,7 +49,7 @@ function Tabs() //{{{
tabmail.__defineGetter__("mTabs", function () this.tabContainer.childNodes);
tabmail.__defineGetter__("mCurrentTab", function () this.tabContainer.selectedItem);
tabmail.__defineGetter__("mStrip", function () this.tabStrip);
tabmail.__defineGetter__("browsers", function () [browser for (browser in Iterator(this.mTabs))] );
tabmail.__defineGetter__("browsers", function () [browser for (browser in Iterator(this.mTabs))]);
}
return tabmail;
};
@@ -687,9 +687,10 @@ function Tabs() //{{{
{
let tabStrip = null;
// FIXME: why is this app specific conditional code here?
if (config.hostApplication == "Firefox")
tabStrip = getBrowser().mStrip.getElementsByClassName("tabbrowser-tabs")[0];
else if (config.hostApplication == "Thunderbird")
else if (/^(Thunderbird|Songbird)$/.test(config.hostApplication))
tabStrip = getBrowser().mStrip;
return tabStrip;

View File

@@ -11,7 +11,7 @@ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
Copyright (c) 2006-2009 by Martin Stubenschrott <stubenschrott@gmx.net>
Copyright (c) 2006-2009 by Martin Stubenschrott <stubenschrott@vimperator.org>
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

View File

@@ -11,7 +11,7 @@ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
Copyright (c) 2006-2009 by Martin Stubenschrott <stubenschrott@gmx.net>
Copyright (c) 2006-2009 by Martin Stubenschrott <stubenschrott@vimperator.org>
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
@@ -58,6 +58,11 @@ function CommandLine() //{{{
get length() this._messages.length,
clear: function clear()
{
this._messages = [];
},
add: function add(message)
{
if (!message)
@@ -772,6 +777,11 @@ function CommandLine() //{{{
"number", 500,
{ validator: function (value) value >= 0 });
options.add(["maxitems"],
"Maximum number of items to display at once",
"number", 20,
{ validator: function (value) value >= 0 });
options.add(["messages", "msgs"],
"Number of messages to store in the message history",
"number", 100,
@@ -975,6 +985,22 @@ function CommandLine() //{{{
},
{ argCount: "0" });
commands.add(["messc[lear]"],
"Clear the message history",
function () { messageHistory.clear(); },
{ argCount: "0" });
commands.add(["sil[ent]"],
"Run a command silently",
function (args)
{
commandline.runSilently(function () liberator.execute(args[0]));
},
{
completer: function (context) completion.ex(context),
literal: 0
});
/////////////////////////////////////////////////////////////////////////////}}}
////////////////////// PUBLIC SECTION //////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////{{{
@@ -1704,8 +1730,6 @@ function ItemList(id) //{{{
////////////////////// PRIVATE SECTION /////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////{{{
const CONTEXT_LINES = 3;
var maxItems = 20;
var completionElements = [];
var iframe = document.getElementById(id);
@@ -1761,7 +1785,7 @@ function ItemList(id) //{{{
<div key="completions"/>
<div highlight="Completions">
{
template.map(util.range(0, maxItems * 2), function (i)
template.map(util.range(0, options["maxitems"] * 2), function (i)
<span highlight="CompItem">
<li highlight="NonText">~</li>
</span>)
@@ -1797,7 +1821,7 @@ function ItemList(id) //{{{
* Uses the entries in "items" to fill the listbox and does incremental
* filling to speed up things.
*
* @param {number} offset Start at this index and show maxItems.
* @param {number} offset Start at this index and show options["maxitems"].
*/
function fill(offset)
{
@@ -1807,11 +1831,11 @@ function ItemList(id) //{{{
return false;
startIndex = offset;
endIndex = Math.min(startIndex + maxItems, items.allItems.items.length);
endIndex = Math.min(startIndex + options["maxitems"], items.allItems.items.length);
let haveCompletions = false;
let off = 0;
let end = startIndex + maxItems;
let end = startIndex + options["maxitems"];
function getRows(context)
{
function fix(n) Math.max(0, Math.min(len, n));
@@ -1925,6 +1949,8 @@ function ItemList(id) //{{{
let sel = selIndex;
let len = items.allItems.items.length;
let newOffset = startIndex;
let maxItems = options["maxitems"];
let contextLines = (maxItems > 3)? 3 : Math.max(0, maxItems - 1);
if (index == -1 || index == null || index == len) // wrapped around
{
@@ -1935,10 +1961,10 @@ function ItemList(id) //{{{
}
else
{
if (index <= startIndex + CONTEXT_LINES)
newOffset = index - CONTEXT_LINES;
if (index >= endIndex - CONTEXT_LINES)
newOffset = index + CONTEXT_LINES - maxItems + 1;
if (index <= startIndex + contextLines)
newOffset = index - contextLines;
if (index >= endIndex - contextLines)
newOffset = index + contextLines - maxItems + 1;
newOffset = Math.min(newOffset, len - maxItems);
newOffset = Math.max(newOffset, 0);
@@ -2018,16 +2044,18 @@ function StatusLine() //{{{
/**
* Update the status bar to indicate how secure the website is:
* extended - Secure connection with Extended Validation(EV) certificate.
* secure - Secure connection with valid certificate.
* broken - Secure connection with invalid certificate, or
* mixed content.
* insecure - Insecure connection.
*
* @param {'secure'|'broken'|'insecure'} type
* @param {'extended'|'secure'|'broken'|'insecure'} type
*/
setClass: function setClass(type)
{
const highlightGroup = {
extended: "StatusLineExtended",
secure: "StatusLineSecure",
broken: "StatusLineBroken",
insecure: "StatusLine"

View File

@@ -11,7 +11,7 @@ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
Copyright (c) 2006-2009 by Martin Stubenschrott <stubenschrott@gmx.net>
Copyright (c) 2006-2009 by Martin Stubenschrott <stubenschrott@vimperator.org>
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
@@ -249,6 +249,40 @@ const util = { //{{{
return delimiter + str.replace(/([\\'"])/g, "\\$1").replace("\n", "\\n", "g").replace("\t", "\\t", "g") + delimiter;
},
/**
* Split a string on literal occurances of a marker.
*
* Specifically this ignores occurences preceded by a backslash, or
* contained within 'single' or "double" quotes.
*
* It assumes backslash escaping on strings, and will thus not count quotes
* that are preceded by a backslash or within other quotes as starting or
* ending quoted sections of the string.
*
* @param {string} str
* @param {RegExp} marker
*/
splitLiteral: function splitLiteral(str, marker)
{
let results = [];
let resep = RegExp(/^(([^\\'"]|\\.|'([^\\']|\\.)*'|"([^\\"]|\\.)*")*?)/.source + marker.source);
let cont = true;
while (cont)
{
cont = false;
str = str.replace(resep, function (match, before)
{
results.push(before);
cont = true;
return "";
});
}
results.push(str);
return results;
},
/**
* Converts <b>bytes</b> to a pretty printed data size string.
*
@@ -618,7 +652,7 @@ const util = { //{{{
*/
stringToURLArray: function stringToURLArray(str)
{
let urls = str.split(RegExp("\\s*" + options["urlseparator"] + "\\s*"));
let urls = util.splitLiteral(str, RegExp("\\s*" + options["urlseparator"] + "\\s*"));
return urls.map(function (url) {
try
@@ -641,7 +675,7 @@ const util = { //{{{
// Ok, not a valid proto. If it looks like URL-ish (foo.com/bar),
// let Gecko figure it out.
if (/[.]/.test(url) && !/\s/.test(url) || /^[\w-.]+:\d+(?:\/|$)/.test(url))
if (/[.\/]/.test(url) && !/\s/.test(url) || /^[\w-.]+:\d+(?:\/|$)/.test(url))
return url;
// TODO: it would be clearer if the appropriate call to