mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-21 23:08:00 +01:00
added goUp() and isDirectory(uri) functions
gu and gU mappings for going up
This commit is contained in:
@@ -1,9 +1,12 @@
|
|||||||
<pre>
|
<pre>
|
||||||
date:
|
date:
|
||||||
* version 0.4
|
* version 0.4
|
||||||
|
* extension GUID was changed to 'vimperator@mozdev.net' -> YOU WILL HAVE
|
||||||
|
TO UNINSTALL ANY OLD VIMPERATOR INSTALLATION BEFORE INSTALLING THIS VERSION
|
||||||
* support for 'wildmode' completion setting
|
* support for 'wildmode' completion setting
|
||||||
* changed regexp search to normal text search for completion -> massive speedup, but limited functionality
|
* changed regexp search to normal text search for completion -> massive speedup, but limited functionality
|
||||||
* support for :open ./ , :open .. and :open ... (patch from Lee Hinman)
|
* support for :open ./ , :open .. and :open ... (patch from Lee Hinman)
|
||||||
|
'gu' and <BackSpace> goes up a directory component, gU and <C-BackSpace> to the root directory
|
||||||
* Esc now doesn't stop loading the webpage, use Ctrl-c instead, :stop command added
|
* Esc now doesn't stop loading the webpage, use Ctrl-c instead, :stop command added
|
||||||
* changed hinttags to work with dict.leo.org and hintstyle to work with digg.com
|
* changed hinttags to work with dict.leo.org and hintstyle to work with digg.com
|
||||||
* :back! goes to beginning of history now
|
* :back! goes to beginning of history now
|
||||||
@@ -13,6 +16,7 @@ date:
|
|||||||
(patch from Viktor Kojouharov)
|
(patch from Viktor Kojouharov)
|
||||||
* :source support, and auto-sourcing ~/.vimperatorrc on startup
|
* :source support, and auto-sourcing ~/.vimperatorrc on startup
|
||||||
* :javascript <<EOF support to execute multiline javascript code
|
* :javascript <<EOF support to execute multiline javascript code
|
||||||
|
also changed :exec to behave more vim like
|
||||||
* fixed saving of session
|
* fixed saving of session
|
||||||
* fixed hints display when zooming in/out of a web page
|
* fixed hints display when zooming in/out of a web page
|
||||||
* added 'B' command for continous buffer display
|
* added 'B' command for continous buffer display
|
||||||
@@ -27,6 +31,7 @@ date:
|
|||||||
* Support for space/shift-space/alt-left/alt-right keys without beeping
|
* Support for space/shift-space/alt-left/alt-right keys without beeping
|
||||||
* :open without argument reloads current page, :tabopen opens an empty tab
|
* :open without argument reloads current page, :tabopen opens an empty tab
|
||||||
* added 'n' and 'N' to repeat a search
|
* added 'n' and 'N' to repeat a search
|
||||||
|
* many small bug fixes
|
||||||
|
|
||||||
17/04/2007:
|
17/04/2007:
|
||||||
* version 0.3
|
* version 0.3
|
||||||
|
|||||||
3
TODO
3
TODO
@@ -40,10 +40,9 @@ FEATURES:
|
|||||||
6 Shift-Insert in textboxes pastes selection contents
|
6 Shift-Insert in textboxes pastes selection contents
|
||||||
6 page info support (ctrl-g, g<C-g>)
|
6 page info support (ctrl-g, g<C-g>)
|
||||||
5 Use arrow keys in preview window, and ctrl-w+j/k to switch to from preview window
|
5 Use arrow keys in preview window, and ctrl-w+j/k to switch to from preview window
|
||||||
5 Sort :open completion by date?
|
5 Sort :open completion by date? (use 'wildsort')
|
||||||
5 make use of the ] and [ keys to e.g. jump to the next heading ]], next image ]i, previous textbox [t and so on
|
5 make use of the ] and [ keys to e.g. jump to the next heading ]], next image ]i, previous textbox [t and so on
|
||||||
5 add tag support to adding/deleting bookmarks
|
5 add tag support to adding/deleting bookmarks
|
||||||
4 change :exec to behave more vim like, and add a seperate :javascript << EOF command
|
|
||||||
4 Support multiple top-level windows?
|
4 Support multiple top-level windows?
|
||||||
3 Splitting Windows with [:sp :vsp ctrl-w,s ctrl-w,v] and closing with [ctrl-w,q], moving with [ctrl-w,w or tab]
|
3 Splitting Windows with [:sp :vsp ctrl-w,s ctrl-w,v] and closing with [ctrl-w,q], moving with [ctrl-w,w or tab]
|
||||||
have a look into the split browser extension
|
have a look into the split browser extension
|
||||||
|
|||||||
@@ -124,7 +124,7 @@ var g_commands = [/*{{{*/
|
|||||||
[
|
[
|
||||||
["buffers", "files", "ls"],
|
["buffers", "files", "ls"],
|
||||||
["buffers"],
|
["buffers"],
|
||||||
"Shows a list of all buffers",
|
"Show a list of all buffers",
|
||||||
"If the list is already shown, close the preview window.",
|
"If the list is already shown, close the preview window.",
|
||||||
buffer_preview_toggle,
|
buffer_preview_toggle,
|
||||||
null
|
null
|
||||||
@@ -157,7 +157,7 @@ var g_commands = [/*{{{*/
|
|||||||
[
|
[
|
||||||
["execute", "exe"],
|
["execute", "exe"],
|
||||||
["exe[cute] {expr1} [ ... ]"],
|
["exe[cute] {expr1} [ ... ]"],
|
||||||
"Executes the string that results from the evaluation of {expr1} as an Ex command.",
|
"Execute the string that results from the evaluation of {expr1} as an Ex command.",
|
||||||
"<code>:execute "echo test"</code> would show a message with the text "test".<br/>",
|
"<code>:execute "echo test"</code> would show a message with the text "test".<br/>",
|
||||||
execute,
|
execute,
|
||||||
null
|
null
|
||||||
@@ -772,6 +772,20 @@ var g_mappings = [/*{{{*/
|
|||||||
"Count is supported, <code class=mapping>3L</code> goes forward 3 steps.",
|
"Count is supported, <code class=mapping>3L</code> goes forward 3 steps.",
|
||||||
function(count) { stepInHistory(count > 0 ? count : 1); }
|
function(count) { stepInHistory(count > 0 ? count : 1); }
|
||||||
],
|
],
|
||||||
|
[
|
||||||
|
["gu", "<BackSpace>"],
|
||||||
|
["{count}gu", "{count}<BackSpace>"],
|
||||||
|
"Go up one directory component",
|
||||||
|
"Count is supported, <code class=mapping>2gu</code> on <code>http://www.example.com/dir1/dir2/file.htm</code> would open <code>http://www.example.com/dir1/</code>",
|
||||||
|
goUp
|
||||||
|
],
|
||||||
|
[
|
||||||
|
["gU", "<C-BackSpace>"],
|
||||||
|
["gU", "<C-BackSpace>"],
|
||||||
|
"Go up one directory component",
|
||||||
|
"<code class=mapping>gU</code> on <code>http://www.example.com/dir1/dir2/file.htm</code> opens <code>http://www.example.com/</code>",
|
||||||
|
function(count) { openURLs("..."); }
|
||||||
|
],
|
||||||
|
|
||||||
/* hint managment */
|
/* hint managment */
|
||||||
[
|
[
|
||||||
@@ -1325,6 +1339,30 @@ function stringToURLs(str)
|
|||||||
return urls;
|
return urls;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* returns true if the currently loaded URI is
|
||||||
|
* a directory or false if it is a file
|
||||||
|
* if passed 'url' is null, use current directory
|
||||||
|
*/
|
||||||
|
function isDirectory(url)
|
||||||
|
{
|
||||||
|
if (url.match(/^file:\/\//) || url.match(/^\//))
|
||||||
|
{
|
||||||
|
var stripedFilename = url.replace(/^(file:\/\/)?(.*)/, "$2");
|
||||||
|
var file = fopen(stripedFilename, '<');
|
||||||
|
if (!file)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (file.localFile.isDirectory())
|
||||||
|
return true;
|
||||||
|
else
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
// for all other locations just check if the URL ends with /
|
||||||
|
if (url.match(/\/$/))
|
||||||
|
return true;
|
||||||
|
else
|
||||||
|
return false;
|
||||||
|
}
|
||||||
////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////
|
||||||
// frame related functions //////////////////////////////////////// {{{1
|
// frame related functions //////////////////////////////////////// {{{1
|
||||||
////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////
|
||||||
@@ -1381,6 +1419,23 @@ function getCurrentLocation()
|
|||||||
return content.document.location.href;
|
return content.document.location.href;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function goUp(count)
|
||||||
|
{
|
||||||
|
var gocmd = "";
|
||||||
|
if (isDirectory(getCurrentLocation()))
|
||||||
|
gocmd = "../";
|
||||||
|
else
|
||||||
|
gocmd = "./";
|
||||||
|
|
||||||
|
if (count < 1)
|
||||||
|
count = 1;
|
||||||
|
|
||||||
|
for(var i=0; i<count-1; i--)
|
||||||
|
gocmd += "../";
|
||||||
|
|
||||||
|
openURLs(gocmd);
|
||||||
|
}
|
||||||
|
|
||||||
function yankCurrentLocation()
|
function yankCurrentLocation()
|
||||||
{
|
{
|
||||||
var loc = getCurrentLocation();
|
var loc = getCurrentLocation();
|
||||||
|
|||||||
@@ -41,20 +41,20 @@ function help(section, easter)
|
|||||||
var style = "<style type='text/css'>\
|
var style = "<style type='text/css'>\
|
||||||
table.vimperator {\
|
table.vimperator {\
|
||||||
border-width: 1px 1px 1px 1px;\
|
border-width: 1px 1px 1px 1px;\
|
||||||
border-spacing: 5px;\
|
/*border-spacing: 5px;*/\
|
||||||
border-style: dotted dotted dotted dotted;\
|
border-style: dotted dotted dotted dotted;\
|
||||||
border-color: gray gray gray gray;\
|
border-color: gray gray gray gray;\
|
||||||
border-collapse: separate;\
|
border-collapse: separate;\
|
||||||
background-color: white;\
|
background-color: white;\
|
||||||
}\
|
}\
|
||||||
table.vimperator th {\
|
table.vimperator th {\
|
||||||
border-width: 1px 1px 1px 1px;\
|
border-width: 0px 0px 0px 0px;\
|
||||||
padding: 3px 3px 3px 3px;\
|
/*padding: 3px 3px 3px 3px;*/\
|
||||||
border-style: hidden hidden hidden hidden;\
|
border-style: hidden hidden hidden hidden;\
|
||||||
border-color: gray gray gray gray;\
|
border-color: gray gray gray gray;\
|
||||||
}\
|
}\
|
||||||
table.vimperator td {\
|
table.vimperator td {\
|
||||||
border-width: 1px 1px 1px 1px;\
|
border-width: 0px 0px 0px 0px;\
|
||||||
padding: 3px 3px 3px 3px;\
|
padding: 3px 3px 3px 3px;\
|
||||||
border-style: hidden hidden hidden hidden;\
|
border-style: hidden hidden hidden hidden;\
|
||||||
border-color: gray gray gray gray;\
|
border-color: gray gray gray gray;\
|
||||||
@@ -76,6 +76,7 @@ td.usage code {\
|
|||||||
tr.tag code {\
|
tr.tag code {\
|
||||||
font-weight: bold;\
|
font-weight: bold;\
|
||||||
font-size: 1opx;\
|
font-size: 1opx;\
|
||||||
|
font-color: red;\
|
||||||
margin-left: 2em;\
|
margin-left: 2em;\
|
||||||
}\
|
}\
|
||||||
tr.desciption {\
|
tr.desciption {\
|
||||||
|
|||||||
Reference in New Issue
Block a user