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

@@ -1,21 +1,45 @@
#### configuration
TOP = $(shell pwd)
VERSION = 0.4
OS = $(shell uname -s)
DATE = $(shell date "+%Y/%m/%d")
JAR_FILES = ${shell find chrome/content/ -type f -a ! -path '*CVS*' ! -name 'tags'} chrome.manifest
JAR_DIRS = $(foreach f,${JAR_FILES},$(dir $f))
JAR = chrome/vimperator.jar
RELEASE_FILES = ${JAR} install.rdf chrome.manifest TODO AUTHORS Donators ChangeLog Makefile
RELEASE_DIR = ../downloads
RELEASE_XPI = vimperator_${VERSION}.xpi
RELEASE = ${RELEASE_DIR}/${RELEASE_XPI}
XPI_TXT_FILES = install.rdf chrome.manifest TODO AUTHORS Donators ChangeLog
XPI_DIRS = $(foreach f,${XPI_FILES},$(dir $f))
XPI_BIN_FILES = ${JAR} Makefile
XPI_FILES = ${XPI_BIN_FILES} ${XPI_TXT_FILES}
XPI_NAME = vimperator_${VERSION}.xpi
XPI = ../downloads/${XPI_NAME}
BUILD_DIR=build.${VERSION}.${OS}
BUILD_JAR_DIR=${BUILD_DIR}/jar
BUILD_XPI_DIR=${BUILD_DIR}/xpi
BUILD_JAR_SUBDIRS=$(sort ${JAR_DIRS:%=${BUILD_JAR_DIR}/%})
BUILD_XPI_SUBDIRS=$(sort ${XPI_DIRS:%=${BUILD_XPI_DIR}/%})
ZIP = zip
# find the vimperator chrome dir
ifeq (${OS},Darwin)
FIREFOX_DEFAULT = $(wildcard ${HOME}/Library/Application\ Support/Firefox/Profiles/*default)
else
FIREFOX_DEFAULT = $(wildcard ${HOME}/.mozilla/firefox/*.default)
VIMPERATOR_CHROME = ${FIREFOX_DEFAULT}/extensions/vimperator@mozdev.org/chrome/
endif
VIMPERATOR_CHROME_EMAIL = ${FIREFOX_DEFAULT}/extensions/vimperator@mozdev.org/chrome/
FOUND_CHROME_UUID = $(dir $(wildcard ${FIREFOX_DEFAULT}/extensions/{*-*-*-*-*}/chrome/vimperator.jar))
FOUND_CHROME_EMAIL = $(dir $(wildcard ${VIMPERATOR_CHROME_EMAIL}))
FOUND_CHROME = $(if ${FOUND_CHROME_UUID},${FOUND_CHROME_UUID},${FOUND_CHROME_EMAIL})
INSTALL_CHROME = $(if ${FOUND_CHROME},${FOUND_CHROME},${VIMPERATOR_CHROME_EMAIL})
# specify V=1 on make line to see more verbose output
Q=$(if ${V},,@)
@@ -33,44 +57,77 @@ help:
@echo " make info - shome some info about the system"
@echo " make jar - build a JAR (${JAR})"
@echo " make install - install into your firefox dir (run info)"
@echo " make xpi - build an XPI (${RELEASE_XPI})"
@echo " make xpi - build an XPI (${XPI_NAME})"
@echo " make clean - clean up"
@echo
@echo "running some commands with V=1 will show more build details"
info:
@echo "version ${VERSION}"
@echo "release file ${RELEASE}"
@echo "release file ${XPI}"
@echo -e "jar files $(shell echo ${JAR_FILES} | sed 's/ /\\n /g' )"
@test -d "${FIREFOX_DEFAULT}" || ( echo "E: didn't find your .mozilla/firefox/*.default/ dir" ; false )
@echo "firefox default ${FIREFOX_DEFAULT}"
@test -d "${VIMPERATOR_CHROME}" || ( echo "E: didn't find an existing vimperator chrome dir" ; false )
@echo "vimperator chrome ${VIMPERATOR_CHROME}"
@test -d "${FOUND_CHROME}" || ( echo "E: didn't find an existing vimperator chrome dir" ; false )
@[ -n "${FOUND_CHROME_UUID}" ] && \
echo "vimperator chrome ${FOUND_CHROME_UUID}" || true
@[ -n "${FOUND_CHROME_EMAIL}" ] && \
echo "vimperator chrome ${FOUND_CHROME_EMAIL}" || true
@[ -z "${FOUND_CHROME_UUID}" -o -z "${FOUND_CHROME_EMAIL}" ] || \
(echo "E: you have multiple vimperator's installed, you need to fix that" ; false)
needs_chrome_dir:
@echo "Checking chrome dir..."
-${Q}mkdir -p "${VIMPERATOR_CHROME}"
${Q}test -d "${VIMPERATOR_CHROME}"
-${Q}mkdir -p "${INSTALL_CHROME}"
${Q}test -d "${INSTALL_CHROME}"
xpi: ${RELEASE}
xpi: ${XPI}
jar: ${JAR}
install: needs_chrome_dir ${JAR}
@echo "Installing JAR..."
${Q}cp ${CP_V} ${JAR} ${VIMPERATOR_CHROME}
${Q}cp ${CP_V} ${JAR} ${INSTALL_CHROME}
clean:
@echo "Cleanup..."
${Q}rm -f ${JAR} ${XPI}
${Q}find . -name '*~' -exec rm -f {} \;
${RELEASE}: ${RELEASE_FILES}
@echo "Building XPI..."
@mkdir -p ${RELEASE_DIR}
${Q}${ZIP} -r ${RELEASE} ${RELEASE_FILES}
@echo "SUCCESS: ${RELEASE}"
#### xpi
${JAR}: ${JAR_FILES}
${BUILD_XPI_SUBDIRS}:
@mkdir -p $@
${XPI}: ${BUILD_XPI_SUBDIRS} ${XPI_FILES}
@echo "Building XPI..."
${Q}for f in ${XPI_BIN_FILES} ; do \
cp $$f ${BUILD_XPI_DIR}/$$f ; \
done
${Q}for f in ${XPI_TXT_FILES} ; do \
sed -e "s,###VERSION###,${VERSION},g" \
-e "s,###DATE###,${DATE},g" \
< $$f > ${BUILD_XPI_DIR}/$$f ; \
( diff -q $$f ${BUILD_XPI_DIR}/$$f 1>/dev/null ) || \
( echo "modified: $$f" ; \
diff -u $$f ${BUILD_XPI_DIR}/$$f | grep '^[-+][^-+]' ) ; \
done
${Q}( cd ${BUILD_XPI_DIR} && ${ZIP} -r ${TOP}/${XPI} ${XPI_FILES} )
@echo "SUCCESS: ${XPI}"
#### jar
${BUILD_JAR_SUBDIRS}:
@mkdir -p $@
${JAR}: ${BUILD_JAR_SUBDIRS} ${JAR_FILES}
@echo "Building JAR..."
${Q}${ZIP} -r ${JAR} ${JAR_FILES}
${Q}for f in ${JAR_FILES} ; do \
sed -e "s,###VERSION###,${VERSION},g" \
-e "s,###DATE###,${DATE},g" \
< $$f > ${BUILD_JAR_DIR}/$$f ; \
( diff -q $$f ${BUILD_JAR_DIR}/$$f 1>/dev/null ) || \
( echo "modified: $$f" ; \
diff -u $$f ${BUILD_JAR_DIR}/$$f | grep '^[-+][^-+]' ) ; \
done
${Q}( cd ${BUILD_JAR_DIR} && ${ZIP} -r ${TOP}/${JAR} ${JAR_FILES} )
@echo "SUCCESS: ${JAR}"

2
TODO
View File

@@ -19,7 +19,7 @@ FEATURES:
8 :open .. -> Up one directory, :cd goes to top location, [Backspace] command shortcut, use count (:3cd goes 3 levels up)
8 downloading of links to filesystem (:save <filename>)
8 provide a buffer on the bottom where more than 1 line messages can be shown, preferrable
with color support (for things like :ls)
with color support (for things like :echo line1\nline2)
8 middleclick in content == p, and if command line is open, paste there the clipboard buffer
8 [ctrl-o/i] to Go back to a Previous Position (done partly, however currenty does not use a per tab jumplist)
8 Use our own find-as-you-type mechanism (like conkeror does)

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