1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-22 04:57:59 +01:00

normalise fold markers

This commit is contained in:
Doug Kearns
2007-06-22 10:42:37 +00:00
parent e962dce8af
commit 3bceee7721
11 changed files with 311 additions and 286 deletions

View File

@@ -2,7 +2,7 @@
* also includes methods for dealing with * also includes methods for dealing with
* keywords and search engines * keywords and search engines
*/ */
function Bookmarks()//{{{ function Bookmarks() //{{{
{ {
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
////////////////////// PRIVATE SECTION ///////////////////////////////////////// ////////////////////// PRIVATE SECTION /////////////////////////////////////////
@@ -262,9 +262,9 @@ function Bookmarks()//{{{
return res; return res;
} }
//}}} //}}}
}//}}} } //}}}
function History()//{{{ function History() //{{{
{ {
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
////////////////////// PRIVATE SECTION ///////////////////////////////////////// ////////////////////// PRIVATE SECTION /////////////////////////////////////////
@@ -345,9 +345,9 @@ function History()//{{{
return true; return true;
}; };
//}}} //}}}
}//}}} } //}}}
function Marks()//{{{ function Marks() //{{{
{ {
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
////////////////////// PRIVATE SECTION ///////////////////////////////////////// ////////////////////// PRIVATE SECTION /////////////////////////////////////////
@@ -527,6 +527,6 @@ function Marks()//{{{
return this; return this;
} }
//}}} //}}}
}//}}} } //}}}
// vim: set fdm=marker sw=4 ts=4 et: // vim: set fdm=marker sw=4 ts=4 et:

View File

@@ -27,7 +27,7 @@ the terms of any one of the MPL, the GPL or the LGPL.
}}} ***** END LICENSE BLOCK *****/ }}} ***** END LICENSE BLOCK *****/
/* [command, action, cancel_hint_mode, always_active] */ /* [command, action, cancel_hint_mode, always_active] */
var g_hint_mappings = [ /*{{{*/ var g_hint_mappings = [ //{{{
/* hint action keys */ /* hint action keys */
["o", "hah.openHints(false, false);", true, false], ["o", "hah.openHints(false, false);", true, false],
["t", "hah.openHints(true, false);", true, false], ["t", "hah.openHints(true, false);", true, false],
@@ -64,9 +64,9 @@ var g_hint_mappings = [ /*{{{*/
["<C-g>", "", true, true], ["<C-g>", "", true, true],
["<C-[>", "", true, true], ["<C-[>", "", true, true],
["<Esc>", "", true, true] ["<Esc>", "", true, true]
]; /*}}}*/ ]; //}}}
function Command(specs, action, extra_info)//{{{ function Command(specs, action, extra_info) //{{{
{ {
if (!specs || !action) if (!specs || !action)
return null; return null;
@@ -129,7 +129,7 @@ function Command(specs, action, extra_info)//{{{
this.completer = extra_info.completer || null; this.completer = extra_info.completer || null;
} }
}//}}} }
Command.prototype.execute = function(args, special, count, modifiers) Command.prototype.execute = function(args, special, count, modifiers)
{ {
@@ -176,9 +176,9 @@ Command.prototype.toString = function()
"\n\taction: " + this.action + "\n\taction: " + this.action +
"\n\tcompleter: " + this.completer + "\n\tcompleter: " + this.completer +
"\n}" "\n}"
} } //}}}
function Commands()//{{{ function Commands() //{{{
{ {
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
////////////////////// PRIVATE SECTION ///////////////////////////////////////// ////////////////////// 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%." 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) if (!cmd)
return; return;
@@ -795,7 +795,11 @@ function execute_command(count, cmd, special, args, modifiers) // {{{
// valid command, call it: // valid command, call it:
command.execute(args, special, count, modifiers); command.execute(args, special, count, modifiers);
} // }}} } //}}}
/////////////////////////////////////////////////////////////////////}}}
// Ex command parsing and execution ////////////////////////////////////
/////////////////////////////////////////////////////////////////////{{{
// return [null, null, null, null, heredoc_tag || false]; // return [null, null, null, null, heredoc_tag || false];
// [count, cmd, special, args] = match; // [count, cmd, special, args] = match;
@@ -852,9 +856,11 @@ function execute(string)
return execute_command.apply(this, tokens); return execute_command.apply(this, tokens);
} }
////////////////////////////////////////////////////////////////////////
// navigation functions /////////////////////////////////////////// {{{1 /////////////////////////////////////////////////////////////////////}}}
//////////////////////////////////////////////////////////////////////// // navigation functions ////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////{{{
function stepInHistory(steps) function stepInHistory(steps)
{ {
var index = getWebNavigation().sessionHistory.index + steps; var index = getWebNavigation().sessionHistory.index + steps;
@@ -893,11 +899,10 @@ function historyGoToEnd()
getWebNavigation().gotoIndex(max); getWebNavigation().gotoIndex(max);
} }
/////////////////////////////////////////////////////////////////////}}}
// url functions ///////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////{{{
////////////////////////////////////////////////////////////////////////
// url functions ////////////////////////////////////////////////// {{{1
////////////////////////////////////////////////////////////////////////
function openURLs(str) function openURLs(str)
{ {
var urls = stringToURLs(str); var urls = stringToURLs(str);
@@ -1027,9 +1032,9 @@ function isDirectory(url)
return false; return false;
} }
//////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////}}}
// frame related functions //////////////////////////////////////// {{{1 // frame related functions /////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////{{{
// TODO: allow callback for filtering out unwanted frames? User defined? // TODO: allow callback for filtering out unwanted frames? User defined?
function focusNextFrame(count, forward) function focusNextFrame(count, forward)
@@ -1122,9 +1127,10 @@ function focusNextFrame(count, forward)
} }
} }
//////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////}}}
// location handling ////////////////////////////////////////////// {{{1 // location handling ///////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////{{{
function getCurrentLocation() function getCurrentLocation()
{ {
return window.content.document.location.href; 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 // takes: -t "foo" -T "tag1,tag2", myurl
// converts that string to a useful url and title, and calls addBookmark // converts that string to a useful url and title, and calls addBookmark
function bmadd(str) 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 /* vimperator has a concept of URL marks
* these provide quick access to URLs with a single character * 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() function tab()
{ {
execute(arguments[0], null, null, {inTab: true}); execute(arguments[0], null, null, {inTab: true});
@@ -1320,9 +1329,10 @@ function updateBufferList()
vimperator.bufferwindow.selectItem(getBrowser().mTabContainer.selectedIndex); vimperator.bufferwindow.selectItem(getBrowser().mTabContainer.selectedIndex);
} }
//////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////}}}
// scrolling ////////////////////////////////////////////////////// {{{1 // scrolling ///////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////{{{
function scrollBufferRelative(right, down) function scrollBufferRelative(right, down)
{ {
var win = document.commandDispatcher.focusedWindow; 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 */ /* also used to zoom out, when factor is negative */
@@ -1439,10 +1449,9 @@ function zoom_to(value)
vimperator.echo("Zoom value: " + value + "%"); vimperator.echo("Zoom value: " + value + "%");
} }
//}}}
//////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////
// misc helper functions ////////////////////////////////////////// {{{1 // misc helper functions ////////////////////////////////////////////{{{
//////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////
function copyToClipboard(str) function copyToClipboard(str)
@@ -1726,5 +1735,6 @@ function evaluateXPath(expression, doc, ordered)
); );
return res; return res;
} }
//}}}
// vim: set fdm=marker sw=4 ts=4 et: // vim: set fdm=marker sw=4 ts=4 et:

View File

@@ -6,7 +6,7 @@ var g_substrings = [];
* used for the 'longest' setting for wildmode * used for the 'longest' setting for wildmode
* *
*/ */
function get_longest_substring()/*{{{*/ function get_longest_substring() //{{{
{ {
if (g_substrings.length == 0) if (g_substrings.length == 0)
return ''; return '';
@@ -18,11 +18,11 @@ function get_longest_substring()/*{{{*/
} }
//alert(longest); //alert(longest);
return longest; return longest;
}/*}}}*/ } //}}}
// function uses smartcase // function uses smartcase
// list = [ [['com1', 'com2'], 'text'], [['com3', 'com4'], 'text'] ] // list = [ [['com1', 'com2'], 'text'], [['com3', 'com4'], 'text'] ]
function build_longest_common_substring(list, filter)/*{{{*/ function build_longest_common_substring(list, filter) //{{{
{ {
var filtered = []; var filtered = [];
//var filter_length = filter.length; //var filter_length = filter.length;
@@ -65,10 +65,10 @@ function build_longest_common_substring(list, filter)/*{{{*/
} }
} }
return filtered; return filtered;
}/*}}}*/ } //}}}
/* this function is case sensitive */ /* this function is case sensitive */
function build_longest_starting_substring(list, filter)/*{{{*/ function build_longest_starting_substring(list, filter) //{{{
{ {
var filtered = []; var filtered = [];
//var filter_length = filter.length; //var filter_length = filter.length;
@@ -95,7 +95,7 @@ function build_longest_starting_substring(list, filter)/*{{{*/
} }
} }
return filtered; return filtered;
}/*}}}*/ } //}}}
/* /*
* filter a list of urls * filter a list of urls
@@ -104,7 +104,7 @@ function build_longest_starting_substring(list, filter)/*{{{*/
* depending on the 'complete' option * depending on the 'complete' option
* if the 'complete' argument is passed like "h", it temproarily overrides 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(); var completions = new Array();
g_substrings = []; g_substrings = [];
@@ -124,10 +124,10 @@ function get_url_completions(filter, complete)/*{{{*/
} }
return completions; return completions;
}/*}}}*/ } //}}}
/* discard all entries in the 'urls' array, which don't match 'filter */ /* 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 = []; var filtered = [];
// completions which don't match the url but just the description // 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); return filtered.concat(additional_completions);
}/*}}}*/ } //}}}
function get_search_completions(filter)/*{{{*/ function get_search_completions(filter) //{{{
{ {
var engines = vimperator.bookmarks.getSearchEngines().concat(vimperator.bookmarks.getKeywords()); var engines = vimperator.bookmarks.getSearchEngines().concat(vimperator.bookmarks.getKeywords());
@@ -197,21 +197,21 @@ function get_search_completions(filter)/*{{{*/
return [[$_[0]], $_[1]]; return [[$_[0]], $_[1]];
}); });
return build_longest_common_substring(mapped, filter); return build_longest_common_substring(mapped, filter);
}/*}}}*/ } //}}}
function get_history_completions(filter) function get_history_completions(filter) //{{{
{ {
var items = vimperator.history.get(); var items = vimperator.history.get();
return filter_url_array(items, filter); return filter_url_array(items, filter);
} } //}}}
function get_bookmark_completions(filter) function get_bookmark_completions(filter) //{{{
{ {
var bookmarks = vimperator.bookmarks.get(); var bookmarks = vimperator.bookmarks.get();
return filter_url_array(bookmarks, filter); return filter_url_array(bookmarks, filter);
} } //}}}
function get_file_completions(filter)/*{{{*/ function get_file_completions(filter) //{{{
{ {
//var completions = new Array(); //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 */ /* 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); return build_longest_starting_substring(mapped, new_filter);
}/*}}}*/ } //}}}
function get_help_completions(filter)/*{{{*/ function get_help_completions(filter) //{{{
{ {
var help_array = [[["introduction"], "Introductory text"], var help_array = [[["introduction"], "Introductory text"],
[["mappings"], "Normal mode commands"], [["mappings"], "Normal mode commands"],
@@ -280,9 +280,9 @@ function get_help_completions(filter)/*{{{*/
}); });
return build_longest_common_substring(help_array, filter); return build_longest_common_substring(help_array, filter);
}/*}}}*/ } //}}}
function get_command_completions(filter)/*{{{*/ function get_command_completions(filter) //{{{
{ {
//g_completions = []; //g_completions = [];
g_substrings = []; g_substrings = [];
@@ -297,9 +297,9 @@ function get_command_completions(filter)/*{{{*/
for (var command in vimperator.commands) for (var command in vimperator.commands)
completions.push([command.long_names, command.short_help]); completions.push([command.long_names, command.short_help]);
return build_longest_starting_substring(completions, filter); return build_longest_starting_substring(completions, filter);
}/*}}}*/ } //}}}
function get_options_completions(filter, unfiltered)/*{{{*/ function get_options_completions(filter, unfiltered) //{{{
{ {
g_substrings = []; g_substrings = [];
var options_completions = []; var options_completions = [];
@@ -379,9 +379,9 @@ function get_options_completions(filter, unfiltered)/*{{{*/
} }
return options_completions; return options_completions;
}/*}}}*/ } //}}}
function get_buffer_completions(filter)/*{{{*/ function get_buffer_completions(filter) //{{{
{ {
g_substrings = []; g_substrings = [];
var items = []; var items = [];
@@ -415,9 +415,9 @@ function get_buffer_completions(filter)/*{{{*/
return [$_[0][0], $_[1]]; return [$_[0][0], $_[1]];
}); });
return build_longest_common_substring(items, filter); return build_longest_common_substring(items, filter);
}/*}}}*/ } //}}}
function exTabCompletion(str) function exTabCompletion(str) //{{{
{ {
var [count, cmd, special, args] = tokenize_ex(str); var [count, cmd, special, args] = tokenize_ex(str);
var completions = new Array; var completions = new Array;
@@ -448,6 +448,6 @@ function exTabCompletion(str)
} }
} }
return [start, completions]; return [start, completions];
} } //}}}
// vim: set fdm=marker sw=4 ts=4 et: // vim: set fdm=marker sw=4 ts=4 et:

View File

@@ -46,7 +46,7 @@ function fopen (path, mode, perms, tmp)
return new LocalFile(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 classes = Components.classes;
const interfaces = Components.interfaces; const interfaces = Components.interfaces;
@@ -174,5 +174,6 @@ function fo_close()
{ {
return this.outputStream.flush(); return this.outputStream.flush();
} }
//}}}
// vim: set fdm=marker sw=4 ts=4 et: // vim: set fdm=marker sw=4 ts=4 et:

View File

@@ -1,4 +1,4 @@
/***** BEGIN LICENSE BLOCK ***** /***** BEGIN LICENSE BLOCK ***** {{{
Version: MPL 1.1/GPL 2.0/LGPL 2.1 Version: MPL 1.1/GPL 2.0/LGPL 2.1
The contents of this file are subject to the Mozilla Public License Version 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 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 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. the terms of any one of the MPL, the GPL or the LGPL.
***** END LICENSE BLOCK *****/ }}} ***** END LICENSE BLOCK *****/
// Finder for vimperator // Finder for vimperator
// Author: Nigel McNie <http://nigel.mcnie.name/> // Author: Nigel McNie <http://nigel.mcnie.name/>
@@ -241,7 +241,7 @@ function abs_point (node) {
// Vimperator searcher // Vimperator searcher
// make sure you only create this object when the "vimperator" object is ready // make sure you only create this object when the "vimperator" object is ready
//Vimperator.prototype.search = new function() //Vimperator.prototype.search = new function()
function Search() function Search() //{{{
{ {
var self = this; // needed for callbacks since "this" is the "vimperator" object in a callback var self = this; // needed for callbacks since "this" is the "vimperator" object in a callback
this.gWin = null; this.gWin = null;
@@ -457,7 +457,7 @@ function Search()
point, matchRange, matchRange, dir); point, matchRange, matchRange, dir);
} }
} }
} } //}}}
// @TODO should be moved into commands.js // @TODO should be moved into commands.js
vimperator.commands.add(new Command(["noh[lsearch]"], vimperator.commands.add(new Command(["noh[lsearch]"],

View File

@@ -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. the terms of any one of the MPL, the GPL or the LGPL.
}}} ***** END LICENSE BLOCK *****/ }}} ***** END LICENSE BLOCK *****/
function help(section, easter) function help(section, easter) //{{{
{ {
if (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) // horizontal offset is annoying, set it to 0 (use pos[0] if you want horizontal offset)
window.content.scrollTo(0, pos[1]); window.content.scrollTo(0, pos[1]);
} }
} } //}}}
// vim: set fdm=marker sw=4 ts=4 et: // vim: set fdm=marker sw=4 ts=4 et:

View File

@@ -1,4 +1,4 @@
/** /***** BEGIN LICENSE BLOCK ***** {{{
* *
* Mozilla Public License Notice * Mozilla Public License Notice
* *
@@ -20,9 +20,9 @@
* Contributor(s): Pekka Sillanpaa, Paul Stone * Contributor(s): Pekka Sillanpaa, Paul Stone
* adapted for vimperator use by: Martin Stubenschrott * 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 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.document.addEventListener("pageshow", initDoc, null);
window.addEventListener("resize", onResize, null); window.addEventListener("resize", onResize, null);
} } //}}}
var hah = new hit_a_hint(); var hah = new hit_a_hint();

View File

@@ -1,4 +1,3 @@
// TODO: document
function Map(mode, cmds, act, extra_info) //{{{ function Map(mode, cmds, act, extra_info) //{{{
{ {
if (!mode || (!cmds || !cmds.length) || !act) if (!mode || (!cmds || !cmds.length) || !act)
@@ -56,7 +55,7 @@ Map.prototype.toString = function()
"\n}" "\n}"
} //}}} } //}}}
function Mappings()//{{{ function Mappings() //{{{
{ {
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
////////////////////// PRIVATE SECTION ///////////////////////////////////////// ////////////////////// PRIVATE SECTION /////////////////////////////////////////
@@ -664,7 +663,7 @@ function Mappings()//{{{
//}}} //}}}
// TODO: Convert these to the new mappings model // TODO: Convert these to the new mappings model
var hint_maps = [ var hint_maps = [ //{{{
/* hint action keys */ /* hint action keys */
["o", "hah.openHints(false, false);", true, false], ["o", "hah.openHints(false, false);", true, false],
["t", "hah.openHints(true, false);", true, false], ["t", "hah.openHints(true, false);", true, false],
@@ -701,7 +700,7 @@ function Mappings()//{{{
["<C-g>", "", true, true], ["<C-g>", "", true, true],
["<C-[>", "", true, true], ["<C-[>", "", true, true],
["<Esc>", "", true, true] ["<Esc>", "", true, true]
]; ]; //}}}
}//}}} } //}}}
// vim: set fdm=marker sw=4 ts=4 et: // vim: set fdm=marker sw=4 ts=4 et:

View File

@@ -1,4 +1,4 @@
function Option(names, type, extra_info)//{{{ function Option(names, type, extra_info) //{{{
{ {
if (!names || !type) if (!names || !type)
return null; return null;
@@ -79,9 +79,9 @@ function Option(names, type, extra_info)//{{{
"\n\tvalidator: " + this.validator + "\n\tvalidator: " + this.validator +
"\n}" "\n}"
} }
}//}}} } //}}}
function Options()//{{{ function Options() //{{{
{ {
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
////////////////////// PRIVATE SECTION ///////////////////////////////////////// ////////////////////// PRIVATE SECTION /////////////////////////////////////////
@@ -484,6 +484,6 @@ function Options()//{{{
setShowTabline(this.showtabline); setShowTabline(this.showtabline);
setGuiOptions(this.guioptions); setGuiOptions(this.guioptions);
setTitleString(this.titlestring); setTitleString(this.titlestring);
}//}}} } //}}}
// vim: set fdm=marker sw=4 ts=4 et: // vim: set fdm=marker sw=4 ts=4 et:

View File

@@ -1,6 +1,5 @@
// XXX: move somehere else! // XXX: move somehere else!
function multiliner(line, prev_match, heredoc) //{{{
function multiliner(line, prev_match, heredoc)
{ {
var end = true; var end = true;
var match = tokenize_ex(line, prev_match[4]); var match = tokenize_ex(line, prev_match[4]);
@@ -39,8 +38,7 @@ function multiliner(line, prev_match, heredoc)
} }
} }
return [prev_match, heredoc, end]; return [prev_match, heredoc, end];
} } //}}}
/* /*
* This class is used for prompting of user input and echoing of messages * 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 * it consists of a prompt and command field
* be sure to only create objects of this class when the chrome is ready * be sure to only create objects of this class when the chrome is ready
*/ */
function CommandLine () function CommandLine() //{{{
{ {
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
////////////////////// PRIVATE SECTION ///////////////////////////////////////// ////////////////////// PRIVATE SECTION /////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////{{{
const UNINITIALIZED = -2; // notifies us, if we need to start history/tab-completion from the beginning const UNINITIALIZED = -2; // notifies us, if we need to start history/tab-completion from the beginning
const HISTORY_SIZE = 500; const HISTORY_SIZE = 500;
@@ -148,9 +147,9 @@ function CommandLine ()
history = history.slice(HISTORY_SIZE / 10); history = history.slice(HISTORY_SIZE / 10);
} }
//////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////}}}
////////////////////// PUBLIC SECTION ////////////////////////////////////////// ////////////////////// PUBLIC SECTION //////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////{{{
this.getCommand = function() this.getCommand = function()
{ {
@@ -501,7 +500,8 @@ function CommandLine ()
{ {
Options.setPref("commandline_history", history.join("\n")); Options.setPref("commandline_history", history.join("\n"));
} }
} //}}}
} //}}}
/** /**
* The list which is used for the completion box, the preview window and the buffer preview window * 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 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 * @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; const CONTEXT_LINES = 3;
var max_items = 10; var max_items = 10;
var min_items = 1; var min_items = 1;
@@ -591,9 +595,9 @@ function InformationList(id, options)
return (i-startindex); return (i-startindex);
} }
//////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////}}}
////////////////////// PUBLIC SECTION ////////////////////////////////////////// ////////////////////// PUBLIC SECTION //////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////{{{
/** /**
* Show the completion list window * Show the completion list window
@@ -702,13 +706,15 @@ function InformationList(id, options)
else else
return false; return false;
} }
} //}}}
} //}}}
function StatusLine() function StatusLine() //{{{
{ {
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
////////////////////// PRIVATE SECTION ///////////////////////////////////////// ////////////////////// PRIVATE SECTION /////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////{{{
// our status bar fields // our status bar fields
var statusline_widget = document.getElementById("vimperator-statusline"); var statusline_widget = document.getElementById("vimperator-statusline");
var url_widget = document.getElementById("vimperator-statusline-field-url"); 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 tabcount_widget = document.getElementById("vimperator-statusline-field-tabcount");
var bufferposition_widget = document.getElementById("vimperator-statusline-field-bufferposition"); var bufferposition_widget = document.getElementById("vimperator-statusline-field-bufferposition");
//////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////}}}
////////////////////// PUBLIC SECTION ////////////////////////////////////////// ////////////////////// PUBLIC SECTION //////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////{{{
// use names for the color or "transparent" to remove color information // use names for the color or "transparent" to remove color information
this.setColor = function(color) this.setColor = function(color)
{ {
@@ -808,6 +815,7 @@ function StatusLine()
bufferposition_widget.value = bufferposition_str; bufferposition_widget.value = bufferposition_str;
}; };
} //}}}
} //}}}
// vim: set fdm=marker sw=4 ts=4 et: // vim: set fdm=marker sw=4 ts=4 et:

View File

@@ -35,9 +35,10 @@ var popup_allowed_events; // need to change and reset this firefox pref XXX: mov
window.addEventListener("load", init, false); window.addEventListener("load", init, false);
//////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////
// init/uninit //////////////////////////////////////////////////// {{{1 // init/uninit /////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////{{{
function init()
function init() //{{{
{ {
window.dump("in init\n"); window.dump("in init\n");
// init the main object // init the main object
@@ -127,9 +128,9 @@ function init()
window.addEventListener("unload", unload, false); window.addEventListener("unload", unload, false);
vimperator.log("Vimperator fully initialized", 1); vimperator.log("Vimperator fully initialized", 1);
} } //}}}
function unload() function unload() //{{{
{ {
/*** save our preferences ***/ /*** save our preferences ***/
vimperator.commandline.destroy(); vimperator.commandline.destroy();
@@ -140,15 +141,15 @@ function unload()
if (Options.getFirefoxPref('dom.popup_allowed_events', 'change click dblclick mouseup reset submit') if (Options.getFirefoxPref('dom.popup_allowed_events', 'change click dblclick mouseup reset submit')
== popup_allowed_events + " keypress") == popup_allowed_events + " keypress")
Options.setFirefoxPref('dom.popup_allowed_events', popup_allowed_events); Options.setFirefoxPref('dom.popup_allowed_events', popup_allowed_events);
} } //}}}
//}}}
function Vimperator() //{{{
function Vimperator() //{{{1
{ {
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
////////////////////// PRIVATE SECTION ///////////////////////////////////////// ////////////////////// PRIVATE SECTION /////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////{{{
this.modes = { // actually not private, but Firefox complains if this doesn't come first this.modes = { // actually not private, but Firefox complains if this doesn't come first
// main modes // main modes
NONE: 0, NONE: 0,
@@ -213,9 +214,10 @@ function Vimperator() //{{{1
vimperator.echo("-- " + str_mode + str_extended + " --"); vimperator.echo("-- " + str_mode + str_extended + " --");
} }
//////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////}}}
////////////////////// PUBLIC SECTION ////////////////////////////////////////// ////////////////////// PUBLIC SECTION //////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////{{{
this.version = "###VERSION### CVS (created: ###DATE###)"; this.version = "###VERSION### CVS (created: ###DATE###)";
/////////////// callbacks //////////////////////////// /////////////// callbacks ////////////////////////////
@@ -344,13 +346,14 @@ function Vimperator() //{{{1
} }
this.log(string, level); this.log(string, level);
} }
} //}}}
} //}}}
function Events() //{{{1 function Events() //{{{
{ {
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
////////////////////// CONSTRUCTOR ///////////////////////////////////////////// ////////////////////// CONSTRUCTOR /////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////{{{
// this handler is for middle click only in the content // this handler is for middle click only in the content
//window.addEventListener("mousedown", onVimperatorKeypress, true); //window.addEventListener("mousedown", onVimperatorKeypress, true);
@@ -395,9 +398,10 @@ function Events() //{{{1
//alert("titlechanged"); //alert("titlechanged");
}, null); }, null);
//////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////}}}
////////////////////// PRIVATE SECTION ///////////////////////////////////////// ////////////////////// PRIVATE SECTION /////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////{{{
function onPageLoad(event) function onPageLoad(event)
{ {
if (event.originalTarget instanceof HTMLDocument) if (event.originalTarget instanceof HTMLDocument)
@@ -431,9 +435,10 @@ function Events() //{{{1
} }
} }
//////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////}}}
////////////////////// PUBLIC SECTION ////////////////////////////////////////// ////////////////////// PUBLIC SECTION //////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////{{{
this.destroy = function() this.destroy = function()
{ {
// BIG TODO: removeEventListeners() to avoid mem leaks // BIG TODO: removeEventListeners() to avoid mem leaks
@@ -759,14 +764,14 @@ function Events() //{{{1
.getInterface(Components.interfaces.nsIXULWindow) .getInterface(Components.interfaces.nsIXULWindow)
.XULBrowserWindow = window.XULBrowserWindow; .XULBrowserWindow = window.XULBrowserWindow;
getBrowser().addProgressListener(this.progressListener, Components.interfaces.nsIWebProgress.NOTIFY_ALL); getBrowser().addProgressListener(this.progressListener, Components.interfaces.nsIWebProgress.NOTIFY_ALL);
//}}}
} } //}}}
// this function converts the given event to // this function converts the given event to
// a keycode which can be used in mappings // a keycode which can be used in mappings
// e.g. pressing ctrl+n would result in the string "<C-n>" // e.g. pressing ctrl+n would result in the string "<C-n>"
// null if unknown key // null if unknown key
KeyboardEvent.prototype.toString = function () KeyboardEvent.prototype.toString = function() //{{{
{ {
var key = String.fromCharCode(this.charCode); var key = String.fromCharCode(this.charCode);
var modifier = ""; var modifier = "";
@@ -853,18 +858,18 @@ KeyboardEvent.prototype.toString = function ()
} }
else // a key like F1 is always enclosed in < and > else // a key like F1 is always enclosed in < and >
return "<" + modifier + key + ">"; return "<" + modifier + key + ">";
} } //}}}
/** provides functions for working with tabs /** provides functions for working with tabs
* XXX: ATTENTION: We are planning to move to the FUEL API once we switch to * 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 * Firefox 3.0, then this class should go away and their tab methods should be used
* @deprecated * @deprecated
*/ */
function Tabs() //{{{1 function Tabs() //{{{
{ {
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
////////////////////// PRIVATE SECTION ///////////////////////////////////////// ////////////////////// PRIVATE SECTION /////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////{{{
/** @param spec can either be: /** @param spec can either be:
* - an absolute integer * - an absolute integer
* - "" for the current tab * - "" for the current tab
@@ -907,9 +912,9 @@ function Tabs() //{{{1
return position; return position;
} }
//////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////}}}
////////////////////// PUBLIC SECTION ////////////////////////////////////////// ////////////////////// PUBLIC SECTION //////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////{{{
// @returns the index of the currently selected tab starting with 0 // @returns the index of the currently selected tab starting with 0
this.index = function(tab) this.index = function(tab)
{ {
@@ -1036,11 +1041,12 @@ function Tabs() //{{{1
} }
} }
*/ */
} //}}}
} //}}}
//////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////
// DOM related helper functions /////////////////////////////////// {{{1 // DOM related helper functions ////////////////////////////////////////
//////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////{{{
function isFormElemFocused() function isFormElemFocused()
{ {
var elt = document.commandDispatcher.focusedElement; var elt = document.commandDispatcher.focusedElement;
@@ -1059,5 +1065,6 @@ function isFormElemFocused()
return false; return false;
} }
//}}}
// vim: set fdm=marker sw=4 ts=4 et: // vim: set fdm=marker sw=4 ts=4 et: