1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-21 22:37:58 +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

@@ -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"