diff --git a/ChangeLog b/ChangeLog index 692ab265..c3501fc2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,6 +3,7 @@ date: * version 0.4 * fixed saving of session * fixed hints display when zooming in/out of a web page + * added 'B' command for continous buffer display * changed hintsize to 12px by default * 'previewheight' setting to set the maximum size for the preview window * showmode setting which shows the current mode in the command line (patch from Виктор Кожухаров) diff --git a/Makefile b/Makefile new file mode 100644 index 00000000..03ba4b61 --- /dev/null +++ b/Makefile @@ -0,0 +1,73 @@ +#### configuration + +VERSION = 0.4 + +JAR_FILES = ${shell find chrome/content/ -type f -a ! -path '*CVS*'} chrome.manifest +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} + +ZIP = zip + +# find the vimperator chrome dir + +FIREFOX_DEFAULT = $(wildcard ${HOME}/.mozilla/firefox/*.default) +VIMPERATOR_CHROME = $(wildcard ${FIREFOX_DEFAULT}/extensions/{f9570b26-e246-4753-9b68-61aa95994237}/chrome/) + +# specify V=1 on make line to see more verbose output +Q=$(if ${V},,@) + +#### rules + +.PHONY: all help info needs_chrome_dir jar xpi install clean +all: help + +help: + @echo "vimperator ${VERSION} build" + @echo + @echo " make help - display this 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 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 -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}" + +needs_chrome_dir: + test -d "${VIMPERATOR_CHROME}" + +xpi: ${RELEASE} +jar: ${JAR} + +install: needs_chrome_dir ${JAR} + @echo "Installing JAR..." + ${Q}cp -v ${JAR} ${VIMPERATOR_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}" + +${JAR}: ${JAR_FILES} + @echo "Building JAR..." + ${Q}${ZIP} -r ${JAR} ${JAR_FILES} + @echo "SUCCESS: ${JAR}" diff --git a/build.sh b/build.sh deleted file mode 100755 index 852b72b2..00000000 --- a/build.sh +++ /dev/null @@ -1,23 +0,0 @@ -VERSION=0.3 -FILES="chrome/content/ chrome.manifest" - -# echo Building XPI... -# zip conkeror-$VERSION.xpi $FILES install.js -# mv conkeror-$VERSION.xpi ../downloads - -zip -r chrome/vimperator.jar $FILES -#cp vimperator.jar chrome -# also put it in our firefox install -cp -v chrome/vimperator.jar '/home/maxauthority/.mozilla/firefox/kc3gnd7k.default/extensions/{f9570b26-e246-4753-9b68-61aa95994237}/chrome' - -# Build an xpi -if [ x$1 = xxpi ]; then - echo Building XPI... - zip -r vimperator_$VERSION.xpi chrome/vimperator.jar install.rdf chrome.manifest TODO - mv vimperator-firefox-$VERSION.xpi ../downloads -fi - - -if [ x$1 = xtest ]; then - cp -v chrome/vimperator.jar '/home/test/.mozilla/firefox/7ij36ukn.default/extensions/{f9570b26-e246-4753-9b68-61aa95994237}/chrome' -fi diff --git a/chrome/content/vimperator/commands.js b/chrome/content/vimperator/commands.js index 101926e6..66e7f54e 100644 --- a/chrome/content/vimperator/commands.js +++ b/chrome/content/vimperator/commands.js @@ -391,7 +391,7 @@ var g_mappings = [/*{{{*/ [ ["B"], "Toggle buffer list", - "Open the preview window with all currently opened tabs", + "Toggle the preview window with all currently opened tabs.", buffer_preview_toggle, ], [ @@ -1601,7 +1601,22 @@ function set(args, special) function source(filename) { - echoerr("Soucing not yet implemented"); + + + + //echoerr("Soucing not yet implemented"); + var fd = fopen(filename, "<"); + var s = fd.read(); + fd.close(); + + try + { + eval(s); + } + catch(e) + { + alert(e); + } } @@ -1806,7 +1821,6 @@ table.settings th {\ - // list all installed themes and extensions diff --git a/chrome/content/vimperator/file.js b/chrome/content/vimperator/file.js new file mode 100644 index 00000000..2f404614 --- /dev/null +++ b/chrome/content/vimperator/file.js @@ -0,0 +1,161 @@ +/***** 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 +1.1 (the "License"); you may not use this file except in compliance with +the License. You may obtain a copy of the License at +http://www.mozilla.org/MPL/ + +Software distributed under the License is distributed on an "AS IS" basis, +WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +for the specific language governing rights and limitations under the +License. + +(c) 2006-2007: Martin Stubenschrott + Code based on venkman + +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 +the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +in which case the provisions of the GPL or the LGPL are applicable instead +of those above. If you wish to allow use of your version of this file only +under the terms of either the GPL or the LGPL, and not to allow others to +use your version of this file under the terms of the MPL, indicate your +decision by deleting the provisions above and replace them with the notice +and other provisions required by the GPL or the LGPL. If you do not delete +the provisions above, a recipient may use your version of this file under +the terms of any one of the MPL, the GPL or the LGPL. +}}} ***** END LICENSE BLOCK *****/ + + +const PERM_IWOTH = 00002; /* write permission, others */ +const PERM_IWGRP = 00020; /* write permission, group */ + +const MODE_RDONLY = 0x01; +const MODE_WRONLY = 0x02; +const MODE_RDWR = 0x04; +const MODE_CREATE = 0x08; +const MODE_APPEND = 0x10; +const MODE_TRUNCATE = 0x20; +const MODE_SYNC = 0x40; +const MODE_EXCL = 0x80; + + +function fopen (path, mode, perms, tmp) +{ + return new LocalFile(path, mode, perms, tmp); +} + +function LocalFile(file, mode, perms, tmp) +{ + const classes = Components.classes; + const interfaces = Components.interfaces; + + const LOCALFILE_CTRID = "@mozilla.org/file/local;1"; + const FILEIN_CTRID = "@mozilla.org/network/file-input-stream;1"; + const FILEOUT_CTRID = "@mozilla.org/network/file-output-stream;1"; + const SCRIPTSTREAM_CTRID = "@mozilla.org/scriptableinputstream;1"; + + const nsIFile = interfaces.nsIFile; + const nsILocalFile = interfaces.nsILocalFile; + const nsIFileOutputStream = interfaces.nsIFileOutputStream; + const nsIFileInputStream = interfaces.nsIFileInputStream; + const nsIScriptableInputStream = interfaces.nsIScriptableInputStream; + + if (typeof perms == "undefined") + perms = 0666 & ~(PERM_IWOTH | PERM_IWGRP); + + if (typeof mode == "string") + { + switch (mode) + { + case ">": + mode = MODE_WRONLY | MODE_CREATE | MODE_TRUNCATE; + break; + case ">>": + mode = MODE_WRONLY | MODE_CREATE | MODE_APPEND; + break; + case "<": + mode = MODE_RDONLY; + break; + default: + throw "Invalid mode ``" + mode + "''"; + } + } + + if (typeof file == "string") + { + this.localFile = classes[LOCALFILE_CTRID].createInstance(nsILocalFile); + this.localFile.initWithPath(file); + } + else if (file instanceof nsILocalFile) + { + this.localFile = file; + } + else + { + throw "bad type for argument |file|."; + } + + this.path = this.localFile.path; + + if (mode & (MODE_WRONLY | MODE_RDWR)) + { + this.outputStream = + classes[FILEOUT_CTRID].createInstance(nsIFileOutputStream); + this.outputStream.init(this.localFile, mode, perms, 0); + } + + if (mode & (MODE_RDONLY | MODE_RDWR)) + { + var is = classes[FILEIN_CTRID].createInstance(nsIFileInputStream); + is.init(this.localFile, mode, perms, tmp); + this.inputStream = + classes[SCRIPTSTREAM_CTRID].createInstance(nsIScriptableInputStream); + this.inputStream.init(is); + } +} + + +LocalFile.prototype.write = +function fo_write(buf) +{ + if (!("outputStream" in this)) + throw "file not open for writing."; + + return this.outputStream.write(buf, buf.length); +} + +LocalFile.prototype.read = +function fo_read(max) +{ + if (!("inputStream" in this)) + throw "file not open for reading."; + + var av = this.inputStream.available(); + if (typeof max == "undefined") + max = av; + + if (!av) + return null; + + var rv = this.inputStream.read(max); + return rv; +} + +LocalFile.prototype.close = +function fo_close() +{ + if ("outputStream" in this) + this.outputStream.close(); + if ("inputStream" in this) + this.inputStream.close(); +} + +LocalFile.prototype.flush = +function fo_close() +{ + return this.outputStream.flush(); +} + +// vim: set fdm=marker sw=4 ts=4 et: diff --git a/chrome/content/vimperator/vimperator.js b/chrome/content/vimperator/vimperator.js index afe4da42..3ebcddcd 100644 --- a/chrome/content/vimperator/vimperator.js +++ b/chrome/content/vimperator/vimperator.js @@ -123,9 +123,13 @@ nsBrowserStatusHandler.prototype = }, onLocationChange:function (aWebProgress, aRequest, aLocation) { - UpdateBackForwardButtons(); + // firefox 3.0 doesn't seem to have them anymore + if (UpdateBackForwardButtons) + UpdateBackForwardButtons(); + var url = aLocation.spec; - gURLBar.value = url; // also update the original firefox location bar + if (gURLBar) + gURLBar.value = url; // also update the original firefox location bar // onLocationChange is also called when switching/deleting tabs if (hah.currentMode() != HINT_MODE_ALWAYS) @@ -256,6 +260,10 @@ function init() } g_history.unshift([url, title]); } + + // also reset the buffer list, since the url titles are valid here + if (g_bufshow) + bufshow("", false); } , null); diff --git a/chrome/content/vimperator/vimperator.xul b/chrome/content/vimperator/vimperator.xul index 47055db8..d2dec2f9 100644 --- a/chrome/content/vimperator/vimperator.xul +++ b/chrome/content/vimperator/vimperator.xul @@ -42,6 +42,7 @@ the terms of any one of the MPL, the GPL or the LGPL.