mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-22 00:17:58 +01:00
normalise fold markers
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
* also includes methods for dealing with
|
||||
* keywords and search engines
|
||||
*/
|
||||
function Bookmarks()//{{{
|
||||
function Bookmarks() //{{{
|
||||
{
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
////////////////////// PRIVATE SECTION /////////////////////////////////////////
|
||||
@@ -262,9 +262,9 @@ function Bookmarks()//{{{
|
||||
return res;
|
||||
}
|
||||
//}}}
|
||||
}//}}}
|
||||
} //}}}
|
||||
|
||||
function History()//{{{
|
||||
function History() //{{{
|
||||
{
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
////////////////////// PRIVATE SECTION /////////////////////////////////////////
|
||||
@@ -345,9 +345,9 @@ function History()//{{{
|
||||
return true;
|
||||
};
|
||||
//}}}
|
||||
}//}}}
|
||||
} //}}}
|
||||
|
||||
function Marks()//{{{
|
||||
function Marks() //{{{
|
||||
{
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
////////////////////// PRIVATE SECTION /////////////////////////////////////////
|
||||
@@ -527,6 +527,6 @@ function Marks()//{{{
|
||||
return this;
|
||||
}
|
||||
//}}}
|
||||
}//}}}
|
||||
} //}}}
|
||||
|
||||
// vim: set fdm=marker sw=4 ts=4 et:
|
||||
|
||||
@@ -27,7 +27,7 @@ the terms of any one of the MPL, the GPL or the LGPL.
|
||||
}}} ***** END LICENSE BLOCK *****/
|
||||
|
||||
/* [command, action, cancel_hint_mode, always_active] */
|
||||
var g_hint_mappings = [ /*{{{*/
|
||||
var g_hint_mappings = [ //{{{
|
||||
/* hint action keys */
|
||||
["o", "hah.openHints(false, false);", true, false],
|
||||
["t", "hah.openHints(true, false);", true, false],
|
||||
@@ -64,9 +64,9 @@ var g_hint_mappings = [ /*{{{*/
|
||||
["<C-g>", "", true, true],
|
||||
["<C-[>", "", true, true],
|
||||
["<Esc>", "", true, true]
|
||||
]; /*}}}*/
|
||||
]; //}}}
|
||||
|
||||
function Command(specs, action, extra_info)//{{{
|
||||
function Command(specs, action, extra_info) //{{{
|
||||
{
|
||||
if (!specs || !action)
|
||||
return null;
|
||||
@@ -129,7 +129,7 @@ function Command(specs, action, extra_info)//{{{
|
||||
this.completer = extra_info.completer || null;
|
||||
}
|
||||
|
||||
}//}}}
|
||||
}
|
||||
|
||||
Command.prototype.execute = function(args, special, count, modifiers)
|
||||
{
|
||||
@@ -176,9 +176,9 @@ Command.prototype.toString = function()
|
||||
"\n\taction: " + this.action +
|
||||
"\n\tcompleter: " + this.completer +
|
||||
"\n}"
|
||||
}
|
||||
} //}}}
|
||||
|
||||
function Commands()//{{{
|
||||
function Commands() //{{{
|
||||
{
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
////////////////////// PRIVATE SECTION /////////////////////////////////////////
|
||||
@@ -767,10 +767,10 @@ function Commands()//{{{
|
||||
help: "{value} can be between 25 and 500%. If it is omitted, zoom is reset to 100%."
|
||||
}
|
||||
));
|
||||
//}}}
|
||||
}//}}}
|
||||
//}}}
|
||||
} //}}}
|
||||
|
||||
function execute_command(count, cmd, special, args, modifiers) // {{{
|
||||
function execute_command(count, cmd, special, args, modifiers) //{{{
|
||||
{
|
||||
if (!cmd)
|
||||
return;
|
||||
@@ -795,7 +795,11 @@ function execute_command(count, cmd, special, args, modifiers) // {{{
|
||||
// valid command, call it:
|
||||
command.execute(args, special, count, modifiers);
|
||||
|
||||
} // }}}
|
||||
} //}}}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////}}}
|
||||
// Ex command parsing and execution ////////////////////////////////////
|
||||
/////////////////////////////////////////////////////////////////////{{{
|
||||
|
||||
// return [null, null, null, null, heredoc_tag || false];
|
||||
// [count, cmd, special, args] = match;
|
||||
@@ -852,9 +856,11 @@ function execute(string)
|
||||
|
||||
return execute_command.apply(this, tokens);
|
||||
}
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// navigation functions /////////////////////////////////////////// {{{1
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/////////////////////////////////////////////////////////////////////}}}
|
||||
// navigation functions ////////////////////////////////////////////////
|
||||
/////////////////////////////////////////////////////////////////////{{{
|
||||
|
||||
function stepInHistory(steps)
|
||||
{
|
||||
var index = getWebNavigation().sessionHistory.index + steps;
|
||||
@@ -893,11 +899,10 @@ function historyGoToEnd()
|
||||
getWebNavigation().gotoIndex(max);
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////}}}
|
||||
// url functions ///////////////////////////////////////////////////////
|
||||
/////////////////////////////////////////////////////////////////////{{{
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// url functions ////////////////////////////////////////////////// {{{1
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
function openURLs(str)
|
||||
{
|
||||
var urls = stringToURLs(str);
|
||||
@@ -1027,9 +1032,9 @@ function isDirectory(url)
|
||||
return false;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// frame related functions //////////////////////////////////////// {{{1
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
/////////////////////////////////////////////////////////////////////}}}
|
||||
// frame related functions /////////////////////////////////////////////
|
||||
/////////////////////////////////////////////////////////////////////{{{
|
||||
|
||||
// TODO: allow callback for filtering out unwanted frames? User defined?
|
||||
function focusNextFrame(count, forward)
|
||||
@@ -1122,9 +1127,10 @@ function focusNextFrame(count, forward)
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// location handling ////////////////////////////////////////////// {{{1
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
/////////////////////////////////////////////////////////////////////}}}
|
||||
// location handling ///////////////////////////////////////////////////
|
||||
/////////////////////////////////////////////////////////////////////{{{
|
||||
|
||||
function getCurrentLocation()
|
||||
{
|
||||
return window.content.document.location.href;
|
||||
@@ -1182,8 +1188,9 @@ function getCurrentLinkLocation()
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// high level bookmark/history related functions ////////////////// {{{1
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// high level bookmark/history related functions ///////////////////////
|
||||
/////////////////////////////////////////////////////////////////////{{{
|
||||
|
||||
// takes: -t "foo" -T "tag1,tag2", myurl
|
||||
// converts that string to a useful url and title, and calls addBookmark
|
||||
function bmadd(str)
|
||||
@@ -1246,9 +1253,10 @@ function hsshow(filter, fullmode)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// url marks functions //////////////////////////////////////////// {{{1
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
/////////////////////////////////////////////////////////////////////}}}
|
||||
// url marks functions /////////////////////////////////////////////////
|
||||
/////////////////////////////////////////////////////////////////////{{{
|
||||
|
||||
/* vimperator has a concept of URL marks
|
||||
* these provide quick access to URLs with a single character
|
||||
*
|
||||
@@ -1276,9 +1284,10 @@ function show_url_marks(mark)
|
||||
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// tab/buffer related functions /////////////////////////////////// {{{1
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
/////////////////////////////////////////////////////////////////////}}}
|
||||
// tab/buffer related functions ////////////////////////////////////////
|
||||
/////////////////////////////////////////////////////////////////////{{{
|
||||
|
||||
function tab()
|
||||
{
|
||||
execute(arguments[0], null, null, {inTab: true});
|
||||
@@ -1320,9 +1329,10 @@ function updateBufferList()
|
||||
vimperator.bufferwindow.selectItem(getBrowser().mTabContainer.selectedIndex);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// scrolling ////////////////////////////////////////////////////// {{{1
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
/////////////////////////////////////////////////////////////////////}}}
|
||||
// scrolling ///////////////////////////////////////////////////////////
|
||||
/////////////////////////////////////////////////////////////////////{{{
|
||||
|
||||
function scrollBufferRelative(right, down)
|
||||
{
|
||||
var win = document.commandDispatcher.focusedWindow;
|
||||
@@ -1371,7 +1381,7 @@ function scrollBufferAbsolute(horizontal, vertical)
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// zooming //////////////////////////////////////////////////////// {{{1
|
||||
// zooming //////////////////////////////////////////////////////////{{{
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/* also used to zoom out, when factor is negative */
|
||||
@@ -1439,10 +1449,9 @@ function zoom_to(value)
|
||||
|
||||
vimperator.echo("Zoom value: " + value + "%");
|
||||
}
|
||||
|
||||
|
||||
//}}}
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// misc helper functions ////////////////////////////////////////// {{{1
|
||||
// misc helper functions ////////////////////////////////////////////{{{
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
function copyToClipboard(str)
|
||||
@@ -1726,5 +1735,6 @@ function evaluateXPath(expression, doc, ordered)
|
||||
);
|
||||
return res;
|
||||
}
|
||||
//}}}
|
||||
|
||||
// vim: set fdm=marker sw=4 ts=4 et:
|
||||
|
||||
@@ -6,7 +6,7 @@ var g_substrings = [];
|
||||
* used for the 'longest' setting for wildmode
|
||||
*
|
||||
*/
|
||||
function get_longest_substring()/*{{{*/
|
||||
function get_longest_substring() //{{{
|
||||
{
|
||||
if (g_substrings.length == 0)
|
||||
return '';
|
||||
@@ -18,11 +18,11 @@ function get_longest_substring()/*{{{*/
|
||||
}
|
||||
//alert(longest);
|
||||
return longest;
|
||||
}/*}}}*/
|
||||
} //}}}
|
||||
|
||||
// function uses smartcase
|
||||
// list = [ [['com1', 'com2'], 'text'], [['com3', 'com4'], 'text'] ]
|
||||
function build_longest_common_substring(list, filter)/*{{{*/
|
||||
function build_longest_common_substring(list, filter) //{{{
|
||||
{
|
||||
var filtered = [];
|
||||
//var filter_length = filter.length;
|
||||
@@ -65,10 +65,10 @@ function build_longest_common_substring(list, filter)/*{{{*/
|
||||
}
|
||||
}
|
||||
return filtered;
|
||||
}/*}}}*/
|
||||
} //}}}
|
||||
|
||||
/* this function is case sensitive */
|
||||
function build_longest_starting_substring(list, filter)/*{{{*/
|
||||
function build_longest_starting_substring(list, filter) //{{{
|
||||
{
|
||||
var filtered = [];
|
||||
//var filter_length = filter.length;
|
||||
@@ -95,7 +95,7 @@ function build_longest_starting_substring(list, filter)/*{{{*/
|
||||
}
|
||||
}
|
||||
return filtered;
|
||||
}/*}}}*/
|
||||
} //}}}
|
||||
|
||||
/*
|
||||
* filter a list of urls
|
||||
@@ -104,7 +104,7 @@ function build_longest_starting_substring(list, filter)/*{{{*/
|
||||
* depending on the 'complete' option
|
||||
* if the 'complete' argument is passed like "h", it temproarily overrides the complete option
|
||||
*/
|
||||
function get_url_completions(filter, complete)/*{{{*/
|
||||
function get_url_completions(filter, complete) //{{{
|
||||
{
|
||||
var completions = new Array();
|
||||
g_substrings = [];
|
||||
@@ -124,10 +124,10 @@ function get_url_completions(filter, complete)/*{{{*/
|
||||
}
|
||||
|
||||
return completions;
|
||||
}/*}}}*/
|
||||
} //}}}
|
||||
|
||||
/* discard all entries in the 'urls' array, which don't match 'filter */
|
||||
function filter_url_array(urls, filter)/*{{{*/
|
||||
function filter_url_array(urls, filter) //{{{
|
||||
{
|
||||
var filtered = [];
|
||||
// completions which don't match the url but just the description
|
||||
@@ -184,9 +184,9 @@ function filter_url_array(urls, filter)/*{{{*/
|
||||
}
|
||||
|
||||
return filtered.concat(additional_completions);
|
||||
}/*}}}*/
|
||||
} //}}}
|
||||
|
||||
function get_search_completions(filter)/*{{{*/
|
||||
function get_search_completions(filter) //{{{
|
||||
{
|
||||
var engines = vimperator.bookmarks.getSearchEngines().concat(vimperator.bookmarks.getKeywords());
|
||||
|
||||
@@ -197,21 +197,21 @@ function get_search_completions(filter)/*{{{*/
|
||||
return [[$_[0]], $_[1]];
|
||||
});
|
||||
return build_longest_common_substring(mapped, filter);
|
||||
}/*}}}*/
|
||||
} //}}}
|
||||
|
||||
function get_history_completions(filter)
|
||||
function get_history_completions(filter) //{{{
|
||||
{
|
||||
var items = vimperator.history.get();
|
||||
return filter_url_array(items, filter);
|
||||
}
|
||||
} //}}}
|
||||
|
||||
function get_bookmark_completions(filter)
|
||||
function get_bookmark_completions(filter) //{{{
|
||||
{
|
||||
var bookmarks = vimperator.bookmarks.get();
|
||||
return filter_url_array(bookmarks, filter);
|
||||
}
|
||||
} //}}}
|
||||
|
||||
function get_file_completions(filter)/*{{{*/
|
||||
function get_file_completions(filter) //{{{
|
||||
{
|
||||
//var completions = new Array();
|
||||
/* This is now also used as part of the url completion, so the substrings shouldn't be cleared for that case */
|
||||
@@ -249,9 +249,9 @@ function get_file_completions(filter)/*{{{*/
|
||||
});
|
||||
|
||||
return build_longest_starting_substring(mapped, new_filter);
|
||||
}/*}}}*/
|
||||
} //}}}
|
||||
|
||||
function get_help_completions(filter)/*{{{*/
|
||||
function get_help_completions(filter) //{{{
|
||||
{
|
||||
var help_array = [[["introduction"], "Introductory text"],
|
||||
[["mappings"], "Normal mode commands"],
|
||||
@@ -280,9 +280,9 @@ function get_help_completions(filter)/*{{{*/
|
||||
});
|
||||
|
||||
return build_longest_common_substring(help_array, filter);
|
||||
}/*}}}*/
|
||||
} //}}}
|
||||
|
||||
function get_command_completions(filter)/*{{{*/
|
||||
function get_command_completions(filter) //{{{
|
||||
{
|
||||
//g_completions = [];
|
||||
g_substrings = [];
|
||||
@@ -297,9 +297,9 @@ function get_command_completions(filter)/*{{{*/
|
||||
for (var command in vimperator.commands)
|
||||
completions.push([command.long_names, command.short_help]);
|
||||
return build_longest_starting_substring(completions, filter);
|
||||
}/*}}}*/
|
||||
} //}}}
|
||||
|
||||
function get_options_completions(filter, unfiltered)/*{{{*/
|
||||
function get_options_completions(filter, unfiltered) //{{{
|
||||
{
|
||||
g_substrings = [];
|
||||
var options_completions = [];
|
||||
@@ -379,9 +379,9 @@ function get_options_completions(filter, unfiltered)/*{{{*/
|
||||
}
|
||||
|
||||
return options_completions;
|
||||
}/*}}}*/
|
||||
} //}}}
|
||||
|
||||
function get_buffer_completions(filter)/*{{{*/
|
||||
function get_buffer_completions(filter) //{{{
|
||||
{
|
||||
g_substrings = [];
|
||||
var items = [];
|
||||
@@ -415,9 +415,9 @@ function get_buffer_completions(filter)/*{{{*/
|
||||
return [$_[0][0], $_[1]];
|
||||
});
|
||||
return build_longest_common_substring(items, filter);
|
||||
}/*}}}*/
|
||||
} //}}}
|
||||
|
||||
function exTabCompletion(str)
|
||||
function exTabCompletion(str) //{{{
|
||||
{
|
||||
var [count, cmd, special, args] = tokenize_ex(str);
|
||||
var completions = new Array;
|
||||
@@ -448,6 +448,6 @@ function exTabCompletion(str)
|
||||
}
|
||||
}
|
||||
return [start, completions];
|
||||
}
|
||||
} //}}}
|
||||
|
||||
// vim: set fdm=marker sw=4 ts=4 et:
|
||||
|
||||
@@ -46,7 +46,7 @@ function fopen (path, mode, perms, tmp)
|
||||
return new LocalFile(path, mode, perms, tmp);
|
||||
}
|
||||
|
||||
function LocalFile(file, mode, perms, tmp)
|
||||
function LocalFile(file, mode, perms, tmp) // {{{
|
||||
{
|
||||
const classes = Components.classes;
|
||||
const interfaces = Components.interfaces;
|
||||
@@ -174,5 +174,6 @@ function fo_close()
|
||||
{
|
||||
return this.outputStream.flush();
|
||||
}
|
||||
//}}}
|
||||
|
||||
// vim: set fdm=marker sw=4 ts=4 et:
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/***** BEGIN LICENSE BLOCK *****
|
||||
/***** 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
|
||||
@@ -26,7 +26,7 @@ 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 *****/
|
||||
}}} ***** END LICENSE BLOCK *****/
|
||||
|
||||
// Finder for vimperator
|
||||
// Author: Nigel McNie <http://nigel.mcnie.name/>
|
||||
@@ -241,7 +241,7 @@ function abs_point (node) {
|
||||
// Vimperator searcher
|
||||
// make sure you only create this object when the "vimperator" object is ready
|
||||
//Vimperator.prototype.search = new function()
|
||||
function Search()
|
||||
function Search() //{{{
|
||||
{
|
||||
var self = this; // needed for callbacks since "this" is the "vimperator" object in a callback
|
||||
this.gWin = null;
|
||||
@@ -457,7 +457,7 @@ function Search()
|
||||
point, matchRange, matchRange, dir);
|
||||
}
|
||||
}
|
||||
}
|
||||
} //}}}
|
||||
|
||||
// @TODO should be moved into commands.js
|
||||
vimperator.commands.add(new Command(["noh[lsearch]"],
|
||||
|
||||
@@ -26,7 +26,7 @@ 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 *****/
|
||||
|
||||
function help(section, easter)
|
||||
function help(section, easter) //{{{
|
||||
{
|
||||
if (easter)
|
||||
{
|
||||
@@ -264,6 +264,6 @@ function help(section, easter)
|
||||
// horizontal offset is annoying, set it to 0 (use pos[0] if you want horizontal offset)
|
||||
window.content.scrollTo(0, pos[1]);
|
||||
}
|
||||
}
|
||||
} //}}}
|
||||
|
||||
// vim: set fdm=marker sw=4 ts=4 et:
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/**
|
||||
/***** BEGIN LICENSE BLOCK ***** {{{
|
||||
*
|
||||
* Mozilla Public License Notice
|
||||
*
|
||||
@@ -20,9 +20,9 @@
|
||||
* Contributor(s): Pekka Sillanpaa, Paul Stone
|
||||
* adapted for vimperator use by: Martin Stubenschrott
|
||||
*
|
||||
*/
|
||||
}}} ***** END LICENSE BLOCK *****/
|
||||
|
||||
function hit_a_hint()
|
||||
function hit_a_hint() //{{{
|
||||
{
|
||||
const HINT_PREFIX = 'hah_hint_'; // prefix for the hint id
|
||||
|
||||
@@ -681,7 +681,7 @@ function hit_a_hint()
|
||||
|
||||
window.document.addEventListener("pageshow", initDoc, null);
|
||||
window.addEventListener("resize", onResize, null);
|
||||
}
|
||||
} //}}}
|
||||
|
||||
var hah = new hit_a_hint();
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// TODO: document
|
||||
function Map(mode, cmds, act, extra_info) //{{{
|
||||
{
|
||||
if (!mode || (!cmds || !cmds.length) || !act)
|
||||
@@ -56,7 +55,7 @@ Map.prototype.toString = function()
|
||||
"\n}"
|
||||
} //}}}
|
||||
|
||||
function Mappings()//{{{
|
||||
function Mappings() //{{{
|
||||
{
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
////////////////////// PRIVATE SECTION /////////////////////////////////////////
|
||||
@@ -664,7 +663,7 @@ function Mappings()//{{{
|
||||
//}}}
|
||||
|
||||
// TODO: Convert these to the new mappings model
|
||||
var hint_maps = [
|
||||
var hint_maps = [ //{{{
|
||||
/* hint action keys */
|
||||
["o", "hah.openHints(false, false);", true, false],
|
||||
["t", "hah.openHints(true, false);", true, false],
|
||||
@@ -701,7 +700,7 @@ function Mappings()//{{{
|
||||
["<C-g>", "", true, true],
|
||||
["<C-[>", "", true, true],
|
||||
["<Esc>", "", true, true]
|
||||
];
|
||||
}//}}}
|
||||
]; //}}}
|
||||
} //}}}
|
||||
|
||||
// vim: set fdm=marker sw=4 ts=4 et:
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
function Option(names, type, extra_info)//{{{
|
||||
function Option(names, type, extra_info) //{{{
|
||||
{
|
||||
if (!names || !type)
|
||||
return null;
|
||||
@@ -79,9 +79,9 @@ function Option(names, type, extra_info)//{{{
|
||||
"\n\tvalidator: " + this.validator +
|
||||
"\n}"
|
||||
}
|
||||
}//}}}
|
||||
} //}}}
|
||||
|
||||
function Options()//{{{
|
||||
function Options() //{{{
|
||||
{
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
////////////////////// PRIVATE SECTION /////////////////////////////////////////
|
||||
@@ -484,6 +484,6 @@ function Options()//{{{
|
||||
setShowTabline(this.showtabline);
|
||||
setGuiOptions(this.guioptions);
|
||||
setTitleString(this.titlestring);
|
||||
}//}}}
|
||||
} //}}}
|
||||
|
||||
// vim: set fdm=marker sw=4 ts=4 et:
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
// XXX: move somehere else!
|
||||
|
||||
function multiliner(line, prev_match, heredoc)
|
||||
function multiliner(line, prev_match, heredoc) //{{{
|
||||
{
|
||||
var end = true;
|
||||
var match = tokenize_ex(line, prev_match[4]);
|
||||
@@ -39,8 +38,7 @@ function multiliner(line, prev_match, heredoc)
|
||||
}
|
||||
}
|
||||
return [prev_match, heredoc, end];
|
||||
}
|
||||
|
||||
} //}}}
|
||||
|
||||
/*
|
||||
* This class is used for prompting of user input and echoing of messages
|
||||
@@ -48,11 +46,12 @@ function multiliner(line, prev_match, heredoc)
|
||||
* it consists of a prompt and command field
|
||||
* be sure to only create objects of this class when the chrome is ready
|
||||
*/
|
||||
function CommandLine ()
|
||||
function CommandLine() //{{{
|
||||
{
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
////////////////////// PRIVATE SECTION /////////////////////////////////////////
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/////////////////////////////////////////////////////////////////////////////{{{
|
||||
|
||||
const UNINITIALIZED = -2; // notifies us, if we need to start history/tab-completion from the beginning
|
||||
const HISTORY_SIZE = 500;
|
||||
|
||||
@@ -148,9 +147,9 @@ function CommandLine ()
|
||||
history = history.slice(HISTORY_SIZE / 10);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/////////////////////////////////////////////////////////////////////////////}}}
|
||||
////////////////////// PUBLIC SECTION //////////////////////////////////////////
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/////////////////////////////////////////////////////////////////////////////{{{
|
||||
|
||||
this.getCommand = function()
|
||||
{
|
||||
@@ -501,7 +500,8 @@ function CommandLine ()
|
||||
{
|
||||
Options.setPref("commandline_history", history.join("\n"));
|
||||
}
|
||||
}
|
||||
//}}}
|
||||
} //}}}
|
||||
|
||||
/**
|
||||
* The list which is used for the completion box, the preview window and the buffer preview window
|
||||
@@ -509,8 +509,12 @@ function CommandLine ()
|
||||
* @param id: the id of the the XUL widget which we want to fill
|
||||
* @param options: an optional hash which modifies the behavior of the list
|
||||
*/
|
||||
function InformationList(id, options)
|
||||
function InformationList(id, options) //{{{
|
||||
{
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
////////////////////// PRIVATE SECTION /////////////////////////////////////////
|
||||
/////////////////////////////////////////////////////////////////////////////{{{
|
||||
|
||||
const CONTEXT_LINES = 3;
|
||||
var max_items = 10;
|
||||
var min_items = 1;
|
||||
@@ -591,9 +595,9 @@ function InformationList(id, options)
|
||||
return (i-startindex);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/////////////////////////////////////////////////////////////////////////////}}}
|
||||
////////////////////// PUBLIC SECTION //////////////////////////////////////////
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/////////////////////////////////////////////////////////////////////////////{{{
|
||||
|
||||
/**
|
||||
* Show the completion list window
|
||||
@@ -702,13 +706,15 @@ function InformationList(id, options)
|
||||
else
|
||||
return false;
|
||||
}
|
||||
}
|
||||
//}}}
|
||||
} //}}}
|
||||
|
||||
function StatusLine()
|
||||
function StatusLine() //{{{
|
||||
{
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
////////////////////// PRIVATE SECTION /////////////////////////////////////////
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/////////////////////////////////////////////////////////////////////////////{{{
|
||||
|
||||
// our status bar fields
|
||||
var statusline_widget = document.getElementById("vimperator-statusline");
|
||||
var url_widget = document.getElementById("vimperator-statusline-field-url");
|
||||
@@ -717,9 +723,10 @@ function StatusLine()
|
||||
var tabcount_widget = document.getElementById("vimperator-statusline-field-tabcount");
|
||||
var bufferposition_widget = document.getElementById("vimperator-statusline-field-bufferposition");
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/////////////////////////////////////////////////////////////////////////////}}}
|
||||
////////////////////// PUBLIC SECTION //////////////////////////////////////////
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/////////////////////////////////////////////////////////////////////////////{{{
|
||||
|
||||
// use names for the color or "transparent" to remove color information
|
||||
this.setColor = function(color)
|
||||
{
|
||||
@@ -808,6 +815,7 @@ function StatusLine()
|
||||
|
||||
bufferposition_widget.value = bufferposition_str;
|
||||
};
|
||||
}
|
||||
//}}}
|
||||
} //}}}
|
||||
|
||||
// vim: set fdm=marker sw=4 ts=4 et:
|
||||
|
||||
@@ -35,9 +35,10 @@ var popup_allowed_events; // need to change and reset this firefox pref XXX: mov
|
||||
window.addEventListener("load", init, false);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// init/uninit //////////////////////////////////////////////////// {{{1
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
function init()
|
||||
// init/uninit /////////////////////////////////////////////////////////
|
||||
/////////////////////////////////////////////////////////////////////{{{
|
||||
|
||||
function init() //{{{
|
||||
{
|
||||
window.dump("in init\n");
|
||||
// init the main object
|
||||
@@ -127,9 +128,9 @@ function init()
|
||||
|
||||
window.addEventListener("unload", unload, false);
|
||||
vimperator.log("Vimperator fully initialized", 1);
|
||||
}
|
||||
} //}}}
|
||||
|
||||
function unload()
|
||||
function unload() //{{{
|
||||
{
|
||||
/*** save our preferences ***/
|
||||
vimperator.commandline.destroy();
|
||||
@@ -140,15 +141,15 @@ function unload()
|
||||
if (Options.getFirefoxPref('dom.popup_allowed_events', 'change click dblclick mouseup reset submit')
|
||||
== popup_allowed_events + " keypress")
|
||||
Options.setFirefoxPref('dom.popup_allowed_events', popup_allowed_events);
|
||||
}
|
||||
} //}}}
|
||||
//}}}
|
||||
|
||||
|
||||
|
||||
function Vimperator() //{{{1
|
||||
function Vimperator() //{{{
|
||||
{
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
////////////////////// PRIVATE SECTION /////////////////////////////////////////
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/////////////////////////////////////////////////////////////////////////////{{{
|
||||
|
||||
this.modes = { // actually not private, but Firefox complains if this doesn't come first
|
||||
// main modes
|
||||
NONE: 0,
|
||||
@@ -213,9 +214,10 @@ function Vimperator() //{{{1
|
||||
vimperator.echo("-- " + str_mode + str_extended + " --");
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/////////////////////////////////////////////////////////////////////////////}}}
|
||||
////////////////////// PUBLIC SECTION //////////////////////////////////////////
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/////////////////////////////////////////////////////////////////////////////{{{
|
||||
|
||||
this.version = "###VERSION### CVS (created: ###DATE###)";
|
||||
|
||||
/////////////// callbacks ////////////////////////////
|
||||
@@ -344,13 +346,14 @@ function Vimperator() //{{{1
|
||||
}
|
||||
this.log(string, level);
|
||||
}
|
||||
}
|
||||
//}}}
|
||||
} //}}}
|
||||
|
||||
function Events() //{{{1
|
||||
function Events() //{{{
|
||||
{
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
////////////////////// CONSTRUCTOR /////////////////////////////////////////////
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/////////////////////////////////////////////////////////////////////////////{{{
|
||||
|
||||
// this handler is for middle click only in the content
|
||||
//window.addEventListener("mousedown", onVimperatorKeypress, true);
|
||||
@@ -395,9 +398,10 @@ function Events() //{{{1
|
||||
//alert("titlechanged");
|
||||
}, null);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/////////////////////////////////////////////////////////////////////////////}}}
|
||||
////////////////////// PRIVATE SECTION /////////////////////////////////////////
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/////////////////////////////////////////////////////////////////////////////{{{
|
||||
|
||||
function onPageLoad(event)
|
||||
{
|
||||
if (event.originalTarget instanceof HTMLDocument)
|
||||
@@ -431,9 +435,10 @@ function Events() //{{{1
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/////////////////////////////////////////////////////////////////////////////}}}
|
||||
////////////////////// PUBLIC SECTION //////////////////////////////////////////
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/////////////////////////////////////////////////////////////////////////////{{{
|
||||
|
||||
this.destroy = function()
|
||||
{
|
||||
// BIG TODO: removeEventListeners() to avoid mem leaks
|
||||
@@ -759,14 +764,14 @@ function Events() //{{{1
|
||||
.getInterface(Components.interfaces.nsIXULWindow)
|
||||
.XULBrowserWindow = window.XULBrowserWindow;
|
||||
getBrowser().addProgressListener(this.progressListener, Components.interfaces.nsIWebProgress.NOTIFY_ALL);
|
||||
|
||||
}
|
||||
//}}}
|
||||
} //}}}
|
||||
|
||||
// this function converts the given event to
|
||||
// a keycode which can be used in mappings
|
||||
// e.g. pressing ctrl+n would result in the string "<C-n>"
|
||||
// null if unknown key
|
||||
KeyboardEvent.prototype.toString = function ()
|
||||
KeyboardEvent.prototype.toString = function() //{{{
|
||||
{
|
||||
var key = String.fromCharCode(this.charCode);
|
||||
var modifier = "";
|
||||
@@ -853,18 +858,18 @@ KeyboardEvent.prototype.toString = function ()
|
||||
}
|
||||
else // a key like F1 is always enclosed in < and >
|
||||
return "<" + modifier + key + ">";
|
||||
}
|
||||
} //}}}
|
||||
|
||||
/** provides functions for working with tabs
|
||||
* XXX: ATTENTION: We are planning to move to the FUEL API once we switch to
|
||||
* Firefox 3.0, then this class should go away and their tab methods should be used
|
||||
* @deprecated
|
||||
*/
|
||||
function Tabs() //{{{1
|
||||
function Tabs() //{{{
|
||||
{
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
////////////////////// PRIVATE SECTION /////////////////////////////////////////
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/////////////////////////////////////////////////////////////////////////////{{{
|
||||
/** @param spec can either be:
|
||||
* - an absolute integer
|
||||
* - "" for the current tab
|
||||
@@ -907,9 +912,9 @@ function Tabs() //{{{1
|
||||
return position;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/////////////////////////////////////////////////////////////////////////////}}}
|
||||
////////////////////// PUBLIC SECTION //////////////////////////////////////////
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/////////////////////////////////////////////////////////////////////////////{{{
|
||||
// @returns the index of the currently selected tab starting with 0
|
||||
this.index = function(tab)
|
||||
{
|
||||
@@ -1036,11 +1041,12 @@ function Tabs() //{{{1
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
//}}}
|
||||
} //}}}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// DOM related helper functions /////////////////////////////////// {{{1
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// DOM related helper functions ////////////////////////////////////////
|
||||
/////////////////////////////////////////////////////////////////////{{{
|
||||
function isFormElemFocused()
|
||||
{
|
||||
var elt = document.commandDispatcher.focusedElement;
|
||||
@@ -1059,5 +1065,6 @@ function isFormElemFocused()
|
||||
|
||||
return false;
|
||||
}
|
||||
//}}}
|
||||
|
||||
// vim: set fdm=marker sw=4 ts=4 et:
|
||||
|
||||
Reference in New Issue
Block a user