mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-22 05:07:59 +01:00
move win.res guard clause after initialisation of win in loadCoord()
This commit is contained in:
@@ -70,11 +70,12 @@ function Hints() //{{{
|
|||||||
|
|
||||||
this.loadCoord = function(winId, i)
|
this.loadCoord = function(winId, i)
|
||||||
{
|
{
|
||||||
|
win = wins[winId];
|
||||||
|
|
||||||
// win.res is not ready when loading has not finished yet
|
// win.res is not ready when loading has not finished yet
|
||||||
if(!win.res)
|
if (!win.res)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
win = wins[winId];
|
|
||||||
var elem = win.res.snapshotItem(i);
|
var elem = win.res.snapshotItem(i);
|
||||||
|
|
||||||
if (elem)
|
if (elem)
|
||||||
@@ -270,7 +271,7 @@ function Hints() //{{{
|
|||||||
|
|
||||||
function onResize(event)
|
function onResize(event)
|
||||||
{
|
{
|
||||||
if(event)
|
if (event)
|
||||||
doc = event.originalTarget;
|
doc = event.originalTarget;
|
||||||
else
|
else
|
||||||
doc = window.content.document;
|
doc = window.content.document;
|
||||||
@@ -335,9 +336,9 @@ function Hints() //{{{
|
|||||||
// make all links the same length
|
// make all links the same length
|
||||||
var hintLength = 1;
|
var hintLength = 1;
|
||||||
var tmp = linkCount;
|
var tmp = linkCount;
|
||||||
while((tmp /= hintCharacters.length) > 1.0)
|
while ((tmp /= hintCharacters.length) > 1.0)
|
||||||
hintLength++;
|
hintLength++;
|
||||||
while(str.length < hintLength)
|
while (str.length < hintLength)
|
||||||
{
|
{
|
||||||
result += hintCharacters.charAt(0).toUpperCase();
|
result += hintCharacters.charAt(0).toUpperCase();
|
||||||
hintLength--;
|
hintLength--;
|
||||||
@@ -376,7 +377,7 @@ function Hints() //{{{
|
|||||||
{
|
{
|
||||||
hintElem = getHintById(linkNumString);
|
hintElem = getHintById(linkNumString);
|
||||||
setHintStyle(hintElem, styleStringFocus);
|
setHintStyle(hintElem, styleStringFocus);
|
||||||
if(hintElem)
|
if (hintElem)
|
||||||
setMouseOverElement(hintElem.refElem);
|
setMouseOverElement(hintElem.refElem);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -420,7 +421,7 @@ function Hints() //{{{
|
|||||||
//function disableHahMode(event)
|
//function disableHahMode(event)
|
||||||
this.disableHahMode = function(win)
|
this.disableHahMode = function(win)
|
||||||
{
|
{
|
||||||
if(!isHahModeEnabled)
|
if (!isHahModeEnabled)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
vimperator.setMode(vimperator.modes.NORMAL);
|
vimperator.setMode(vimperator.modes.NORMAL);
|
||||||
@@ -437,7 +438,7 @@ function Hints() //{{{
|
|||||||
linkNumString = '';
|
linkNumString = '';
|
||||||
state = 0;
|
state = 0;
|
||||||
|
|
||||||
while(hintedElems.length > 0)
|
while (hintedElems.length > 0)
|
||||||
{
|
{
|
||||||
var elem = hintedElems.pop();
|
var elem = hintedElems.pop();
|
||||||
if (!elem)
|
if (!elem)
|
||||||
@@ -467,7 +468,7 @@ function Hints() //{{{
|
|||||||
{
|
{
|
||||||
var x = 0, y = 0;
|
var x = 0, y = 0;
|
||||||
|
|
||||||
while(hintedElems.length > 0)
|
while (hintedElems.length > 0)
|
||||||
{
|
{
|
||||||
var elem = hintedElems.pop();
|
var elem = hintedElems.pop();
|
||||||
if (!elem)
|
if (!elem)
|
||||||
@@ -515,7 +516,7 @@ function Hints() //{{{
|
|||||||
var loc = "";
|
var loc = "";
|
||||||
var elems = this.hintedElements();
|
var elems = this.hintedElements();
|
||||||
var tmp = "";
|
var tmp = "";
|
||||||
for(i = 0; i < elems.length; i++)
|
for (i = 0; i < elems.length; i++)
|
||||||
{
|
{
|
||||||
tmp = elems[i].refElem.href;
|
tmp = elems[i].refElem.href;
|
||||||
if (typeof(tmp) != 'undefined' && tmp.length > 0)
|
if (typeof(tmp) != 'undefined' && tmp.length > 0)
|
||||||
@@ -538,7 +539,7 @@ function Hints() //{{{
|
|||||||
var loc = "";
|
var loc = "";
|
||||||
var elems = this.hintedElements();
|
var elems = this.hintedElements();
|
||||||
var tmp = "";
|
var tmp = "";
|
||||||
for(i = 0; i < elems.length; i++)
|
for (i = 0; i < elems.length; i++)
|
||||||
{
|
{
|
||||||
tmp = elems[i].refElem.textContent;
|
tmp = elems[i].refElem.textContent;
|
||||||
if (typeof(tmp) != 'undefined' && tmp.length > 0)
|
if (typeof(tmp) != 'undefined' && tmp.length > 0)
|
||||||
@@ -622,7 +623,7 @@ function Hints() //{{{
|
|||||||
//calculate how many characters a hint must have
|
//calculate how many characters a hint must have
|
||||||
var hintLength = 1;
|
var hintLength = 1;
|
||||||
var tmp = linkCount;
|
var tmp = linkCount;
|
||||||
while((tmp /= hintCharacters.length) > 1.0)
|
while ((tmp /= hintCharacters.length) > 1.0)
|
||||||
hintLength++;
|
hintLength++;
|
||||||
|
|
||||||
if (linkNumString.length >= hintLength)
|
if (linkNumString.length >= hintLength)
|
||||||
@@ -642,7 +643,7 @@ function Hints() //{{{
|
|||||||
hints = doc.createElement('HINTS');
|
hints = doc.createElement('HINTS');
|
||||||
hints.id = "hah_hints";
|
hints.id = "hah_hints";
|
||||||
hints.valid_hint_count = 0; // initially 0 elements are usable as hints
|
hints.valid_hint_count = 0; // initially 0 elements are usable as hints
|
||||||
if(doc.body)
|
if (doc.body)
|
||||||
doc.body.appendChild(hints);
|
doc.body.appendChild(hints);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user