1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2026-02-11 09:15:47 +01:00

Makefile fixes and much sexier help file

This commit is contained in:
Martin Stubenschrott
2007-04-29 00:26:31 +00:00
parent 896b83521a
commit 92c863442d
6 changed files with 147 additions and 115 deletions

View File

@@ -189,7 +189,7 @@ var g_commands = [/*{{{*/
],
[
["history", "hs"],
["hs {filter}"],
["history {filter}"],
"Show recently visited URLs",
"Open the preview window at the bottom of the screen for all history items which match the filter string either in the title or URL.",
"Close this window with <code>:pclose</code> or open entries with double click in the current tab or middle click in a new tab.",
@@ -198,7 +198,7 @@ var g_commands = [/*{{{*/
],
[
["javascript", "js"],
["javascript {cmd}", "javascript &lt;&lt;{endpattern}<br/>{script}<br/>{endpattern}"],
["javascript {cmd}", "javascript &lt;&lt; {endpattern}<br/>{script}<br/>{endpattern}"],
"Run any javascript command through eval()",
"Acts as a javascript interpreter by passing the argument to <code>eval()</code>.<br/>" +
"<code>:javascript alert('Hello world')</code> would show a dialog box with the text \"Hello world\".<br/>" +
@@ -234,17 +234,17 @@ var g_commands = [/*{{{*/
],
[
["open", "op", "o", "edit", "e"],
["open [url] [| [url]]"],
["open [url] [| url]"],
"Open one ore more URLs in the current tab",
"Multiple URLs can be separated with the | character.<br/>" +
"Each |-separated token is analazed and in this order:<br/>"+
"<ol><li>Opened with the specified search engine if the token looks like a search string and the first word of the token is the name of a search engine (<code>:open wiki linus torvalds</code> will open the wikipedia entry for linux torvalds).</li>"+
"Each |-separated token is analayzed and in this order:<br/>"+
"<ol><li>Opened with the specified search engine if the token looks like a search string and the first word of the token is the name of a search engine (<code class=command>:open wiki linus torvalds</code> will open the wikipedia entry for linux torvalds).</li>"+
" <li>Transformed to a relative URL of the current location if it starts with . or .. or ...;<br/>... is special and goes to the moves up the directory hierarchy as far as possible.<br/>"+
" - <code class=command>:open ...</code> with current location <code>http://www.example.com/dir1/dir2/file.html</code> will open <code>http://www.example.com</code><br/>"+
" - <code class=command>:open ./foo.html</code> with current location <code>http://www.example.com/dir1/dir2/file.html</code> will open <code>http://www.example.com/dir1/dir2/foo.html</code></li>"+
" <code class=command>:open ...</code> with current location <code>http://www.example.com/dir1/dir2/file.html</code> will open <code>http://www.example.com</code><br/>"+
" <code class=command>:open ./foo.html</code> with current location <code>http://www.example.com/dir1/dir2/file.html</code> will open <code>http://www.example.com/dir1/dir2/foo.html</code></li>"+
" <li>Opened with the default search engine if the first word is no search engine (<code>:open linus torvalds</code> will open a google search for linux torvalds).</li>"+
" <li>Passed directly to Firefox in all other cases (<code>:open www.osnews.com | www.slashdot.org</code> will open OSNews in the current, and Slashdot in a new background tab).</li></ol>"+
"You WILL be able to use <code>:open [-T \"linux\"] torvalds&lt;Tab&gt;</code> to complete bookmarks with tag \"linux\" and which contain \"torvalds\". Note that -T support is only available for tab completion, not for the actual command.<br/>"+
" <li>Passed directly to Firefox in all other cases (<code class=command>:open www.osnews.com | www.slashdot.org</code> will open OSNews in the current, and Slashdot in a new background tab).</li></ol>"+
"You WILL be able to use <code class=command>:open [-T \"linux\"] torvalds&lt;Tab&gt;</code> to complete bookmarks with tag \"linux\" and which contain \"torvalds\". Note that -T support is only available for tab completion, not for the actual command.<br/>"+
"The items which are completed on <code>&lt;Tab&gt;</code> are specified in the <code>'complete'</code> option.<br/>"+
"Without argument, reloads the current page.<br/>"+
"Without argument but with !, reloads the current page skipping the cache.",
@@ -307,8 +307,8 @@ var g_commands = [/*{{{*/
[
["restart"],
["restart"],
"Forces the browser to restart.",
null,
"Force the browser to restart",
"Useful when installing extenstions.",
restart,
null
],
@@ -816,6 +816,7 @@ var g_mappings = [/*{{{*/
"Then press <code>AB</code> to select the hint. Now press <code class=mapping>y</code> to yank its location.<br/>"+
"Actions for selected hints in ExtendedHint mode are:<br/>"+
"<ul><li><code class=mapping>y</code> to yank its location</li>"+
" <li><code class=mapping>Y</code> to yank its text description</li>"+
" <li><code class=mapping>o</code> to open its location in the current tab</li>"+
" <li><code class=mapping>t</code> to open its location in a new tab</li>"+
" <li><code class=mapping>O</code> to open its location in an <code class=command>:open</code> query (not implemented yet)</li>"+
@@ -985,7 +986,8 @@ var g_hint_mappings = [ /*{{{*/
["t", "hah.openHints(true, false);", true, false],
["<C-w>", "hah.openHints(false, true );", true, false],
["s", "echoerr('Saving of links not yet implemented');", true, false],
["y", "hah.yankHints();", true, false],
["y", "hah.yankUrlHints();", true, false],
["Y", "hah.yankTextHints();", true, false],
[",", "g_inputbuffer+=','; hah.setCurrentState(0);", false, true],
[":", "openVimperatorBar(null);", false, true],
/* movement keys */

View File

@@ -38,76 +38,6 @@ function help(section, easter)
var doc = window.content.document;
var style = "<style type='text/css'>\
table.vimperator {\
border-width: 1px 1px 1px 1px;\
/*border-spacing: 5px;*/\
border-style: dotted dotted dotted dotted;\
border-color: gray gray gray gray;\
border-collapse: separate;\
background-color: white;\
width: 800px !important;\
}\
table.vimperator th {\
border-width: 0px 0px 0px 0px;\
/*padding: 3px 3px 3px 3px;*/\
border-style: hidden hidden hidden hidden;\
border-color: gray gray gray gray;\
}\
table.vimperator td {\
border-width: 0px 0px 0px 0px;\
padding: 3px 3px 3px 3px;\
border-style: hidden hidden hidden hidden;\
border-color: gray gray gray gray;\
background-color: rgb(250, 240, 230);\
}\
tr.tag {\
text-align: right;\
border-spacing: 13px 10px 13px 10px;\
}\
tr.tag td {\
width: 100%;\
padding: 3px 0px 3px 0px;\
}\
tr.tag code, td.usage code {\
margin: 0px 2px;\
}\
td.usage code {\
white-space: nowrap;\
}\
tr.tag code {\
font-weight: bold;\
font-size: 12px;\
color: red;\
margin-left: 2em;\
}\
tr.desciption {\
margin-bottom: 4px;\
}\
table.commands td {\
background-color: rgb(250, 240, 230);\
}\
table.commands th {\
background-color: rgb(250, 240, 230);\
}\
table.mappings td {\
background-color: rgb(230, 240, 250);\
}\
table.mappings th {\
background-color: rgb(230, 240, 250);\
}\
table.settings td {\
background-color: rgb(240, 250, 230);\
}\
table.settings th {\
background-color: rgb(240, 250, 230);\
}\
.command { font-weight: bold; color: #632610; }\
.mapping { font-weight: bold; color: #102663; }\
.setting { font-weight: bold; color: #106326; }\
</style>";
var header = '<h1 align=center>Vimperator</h1>' +
'<p align=center><b>First there was a Navigator, then there was an Explorer.<br/>'+
'Later it was time for a Konqueror. Now it\'s time for an Imperator, the VIMperator :)</b></p>';
@@ -137,7 +67,7 @@ table.settings th {\
'Of course as a believer in free open source software, only make a donation if you really like Vimperator, and the money doesn\'t hurt - otherwise just use it, recommend it and like it :)</p>'
// xxx: for firebug: :exec Firebug.toggleBar(true)
// xxx: for firebug: :js Firebug.toggleBar(true)
/* commands = array where help information is located
* color = used for background of the table
@@ -150,6 +80,7 @@ table.settings th {\
var ret = "";
for (var i=0; i < commands.length; i++)
{
// the tags which are printed on the top right
ret += '<tr class="tag"><td colspan="2">';
for (var j=0; j < commands[i][COMMANDS].length; j++)
{
@@ -158,6 +89,8 @@ table.settings th {\
cmd_name = cmd_name.replace(/>/g, "&gt;");
ret += "<code id='" + commands[i][COMMANDS][j] + "'>" +beg+ cmd_name +end+ '</code>';
}
// the usage information for the command
ret += '</td></tr><tr class="description"><td class="usage" valign="top">';
for (var j=0; j < commands[i][USAGE].length; j++)
{
@@ -165,14 +98,19 @@ table.settings th {\
usage = usage.replace(/<(?!br\/>)/g, "&lt;");
usage = usage.replace(/[^b][^r][^\/]>/g, "&gt;");
// color {count} and [url] arguments in the usage, not nice and error prone but the regexp work (for now)
usage = usage.replace(/(^|;|\n|\s|\]|\}|=|<br\/?>)({.*?}|\[.*?\])/gm, "$1<span class=argument>$2</span>");
//usage = usage.replace(/(\s)({|\[)(.*)(\]|})(.*)/g, "<span class=argument>$1$2$3$4$5</span>");
ret += "<code>" +beg+ usage +end+ '</code><br/>';
}
ret += '</td><td>';
// the actual help text with the first line in bold
if (commands[i][SHORTHELP])
{
ret += "<b>";
ret += commands[i][SHORTHELP]; // the help description
ret += "</b><br>";
ret += "</b><br/>";
if(func) // for settings whe print default values here, e.g.
{
ret += func.call(this, commands[i]);
@@ -184,6 +122,10 @@ table.settings th {\
else
ret += "Sorry, no help available";
ret += '</td></tr>';
// add more space between entries
if (i < commands.length-1)
ret += '<tr class="seperator"></tr>';
}
return ret;
}
@@ -232,7 +174,8 @@ table.settings th {\
settings += '</table></p>';
var fulldoc = '<html><head><title>Vimperator help</title>' +
style +
// XXX: stylesheet broken here? Have to add it in the vimperator.xul file
'<link rel="stylesheet" href="chrome://vimperator/content/default.css" type="text/css">'+
'</head><body><pre style="white-space: -moz-pre-wrap !important;">' + // should change that to: white-space: pre-wrap; once CSS3 hits firefox
header +
introduction +
@@ -241,6 +184,8 @@ table.settings th {\
settings +
'</pre></body></html>'
// fulldoc = '<html><head><title>Vimperator help</title><!--link rel="stylesheet" href="chrome://vimperator/content/default.css" type="text/css"--></head><body><p class=moo>hallo</p></body></html>';
doc.open();
doc.write(fulldoc);
doc.close();

View File

@@ -212,9 +212,9 @@ function hit_a_hint()
if (linkCount == 0 && hintmode != HINT_MODE_ALWAYS)
{
beep();
alert('h');
//alert('h');
this.disableHahMode(win);
alert('g');
//alert('g');
// setCurrentMode(MODE_NORMAL);
// linkNumString = '';
// hintedElems = [];
@@ -250,7 +250,7 @@ function hit_a_hint()
function removeHints(win)
{
if (!win)
win = window._content;
win = window.content;
var doc = win.document;
var res = doc.evaluate("//HINTS/SPAN", doc, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);
@@ -419,14 +419,17 @@ function hit_a_hint()
* @return -1 if already disabled
*/
//function disableHahMode(event)
this.disableHahMode = function(win)
this.disableHahMode = function(win, silent)
{
if(!isHahModeEnabled)
return;
setCurrentMode(MODE_NORMAL);
isHahModeEnabled = false;
hintmode = HINT_MODE_QUICK;
linkNumString = '';
hintedElems = [];
if (get_pref("showmode"))
if (!silent && get_pref("showmode"))
echo('');
removeHints(win);
@@ -512,7 +515,7 @@ function hit_a_hint()
return 0;
};
this.yankHints = function()
this.yankUrlHints = function()
{
var loc = "";
var elems = hah.hintedElements();
@@ -524,6 +527,28 @@ function hit_a_hint()
loc += tmp + "\n";
}
// disable the hints before we can echo() an information
this.disableHahMode(null, true);
copyToClipboard(loc);
echo("Yanked " + loc);
};
this.yankTextHints = function()
{
var loc = "";
var elems = hah.hintedElements();
var tmp = "";
for(i=0; i<elems.length; i++)
{
tmp = elems[i].refElem.textContent;
if (typeof(tmp) != 'undefined' && tmp.length > 0)
loc += tmp + "\n";
}
// disable the hints before we can echo() an information
this.disableHahMode(null, true);
copyToClipboard(loc);
echo("Yanked " + loc);
};

View File

@@ -29,6 +29,9 @@ the terms of any one of the MPL, the GPL or the LGPL.
<?xml-stylesheet href="chrome://browser/skin/" type="text/css"?>
<!-- The stylesheet which is used for the :help command -->
<?xml-stylesheet href="chrome://vimperator/content/default.css" type="text/css"?>
<overlay id="vimperator"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:nc="http://home.netscape.com/NC-rdf#"