mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-23 05:57:58 +01:00
use the singleton construction idiom to create vimperator.hints
This commit is contained in:
@@ -28,6 +28,10 @@ the terms of any one of the MPL, the GPL or the LGPL.
|
|||||||
|
|
||||||
vimperator.Hints = function () //{{{
|
vimperator.Hints = function () //{{{
|
||||||
{
|
{
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
////////////////////// PRIVATE SECTION /////////////////////////////////////////
|
||||||
|
/////////////////////////////////////////////////////////////////////////////{{{
|
||||||
|
|
||||||
var submode = ""; // used for extended mode, can be "o", "t", "y", etc.
|
var submode = ""; // used for extended mode, can be "o", "t", "y", etc.
|
||||||
var hintString = ""; // the typed string part of the hint is in this string
|
var hintString = ""; // the typed string part of the hint is in this string
|
||||||
var hintNumber = 0; // only the numerical part of the hint
|
var hintNumber = 0; // only the numerical part of the hint
|
||||||
@@ -467,12 +471,14 @@ vimperator.Hints = function () //{{{
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////}}}
|
||||||
////////////////////// PUBLIC SECTION //////////////////////////////////////////
|
////////////////////// PUBLIC SECTION //////////////////////////////////////////
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////{{{
|
||||||
|
|
||||||
|
return {
|
||||||
|
|
||||||
// TODO: implement framesets
|
// TODO: implement framesets
|
||||||
this.show = function (mode, minor, filter)
|
show: function (mode, minor, filter)
|
||||||
{
|
{
|
||||||
if (mode == vimperator.modes.EXTENDED_HINT && !/^[;asoOtTwWyY]$/.test(minor))
|
if (mode == vimperator.modes.EXTENDED_HINT && !/^[;asoOtTwWyY]$/.test(minor))
|
||||||
{
|
{
|
||||||
@@ -509,14 +515,14 @@ vimperator.Hints = function () //{{{
|
|||||||
}
|
}
|
||||||
else // still hints visible
|
else // still hints visible
|
||||||
return true;
|
return true;
|
||||||
};
|
},
|
||||||
|
|
||||||
this.hide = function ()
|
hide: function ()
|
||||||
{
|
{
|
||||||
removeHints(0);
|
removeHints(0);
|
||||||
};
|
},
|
||||||
|
|
||||||
this.onEvent = function (event)
|
onEvent: function (event)
|
||||||
{
|
{
|
||||||
var key = vimperator.events.toString(event);
|
var key = vimperator.events.toString(event);
|
||||||
var followFirst = false;
|
var followFirst = false;
|
||||||
@@ -672,6 +678,8 @@ vimperator.Hints = function () //{{{
|
|||||||
showHints();
|
showHints();
|
||||||
processHints(followFirst);
|
processHints(followFirst);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// FIXME: add resize support
|
// FIXME: add resize support
|
||||||
@@ -685,6 +693,7 @@ vimperator.Hints = function () //{{{
|
|||||||
// doc = window.content.document;
|
// doc = window.content.document;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
//}}}
|
||||||
}; //}}}
|
}; //}}}
|
||||||
|
|
||||||
// vim: set fdm=marker sw=4 ts=4 et:
|
// vim: set fdm=marker sw=4 ts=4 et:
|
||||||
|
|||||||
@@ -613,7 +613,7 @@ const vimperator = (function () //{{{
|
|||||||
vimperator.log("Loading module quickmarks...", 3);
|
vimperator.log("Loading module quickmarks...", 3);
|
||||||
vimperator.quickmarks = vimperator.QuickMarks();
|
vimperator.quickmarks = vimperator.QuickMarks();
|
||||||
vimperator.log("Loading module hints...", 3);
|
vimperator.log("Loading module hints...", 3);
|
||||||
vimperator.hints = new vimperator.Hints();
|
vimperator.hints = vimperator.Hints();
|
||||||
vimperator.log("Loading module io...", 3);
|
vimperator.log("Loading module io...", 3);
|
||||||
vimperator.io = vimperator.IO();
|
vimperator.io = vimperator.IO();
|
||||||
vimperator.log("Loading module completion...", 3);
|
vimperator.log("Loading module completion...", 3);
|
||||||
|
|||||||
Reference in New Issue
Block a user