mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-22 23:58:00 +01:00
always specify the radix arg when calling parseInt rather than rely on it
'guessing' correctly
This commit is contained in:
@@ -448,7 +448,7 @@ vimperator.Buffer = function() //{{{
|
|||||||
|
|
||||||
var match;
|
var match;
|
||||||
if (match = buffer.match(/^(\d+):?/))
|
if (match = buffer.match(/^(\d+):?/))
|
||||||
return vimperator.tabs.select(parseInt(match[1]) - 1, false); // make it zero-based
|
return vimperator.tabs.select(parseInt(match[1], 10) - 1, false); // make it zero-based
|
||||||
|
|
||||||
var matches = [];
|
var matches = [];
|
||||||
var lower_buffer = buffer.toLowerCase();
|
var lower_buffer = buffer.toLowerCase();
|
||||||
|
|||||||
@@ -363,7 +363,7 @@ vimperator.Commands = function() //{{{
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case OPTION_INT:
|
case OPTION_INT:
|
||||||
arg = parseInt(arg);
|
arg = parseInt(arg, 10);
|
||||||
if (isNaN(arg))
|
if (isNaN(arg))
|
||||||
{
|
{
|
||||||
vimperator.echoerr("Numeric argument required for integer option: " + optname);
|
vimperator.echoerr("Numeric argument required for integer option: " + optname);
|
||||||
@@ -499,7 +499,7 @@ vimperator.Commands = function() //{{{
|
|||||||
|
|
||||||
// parse count
|
// parse count
|
||||||
if (matches[0])
|
if (matches[0])
|
||||||
matches[0] = parseInt(matches[0]);
|
matches[0] = parseInt(matches[0], 10);
|
||||||
else
|
else
|
||||||
matches[0] = -1;
|
matches[0] = -1;
|
||||||
|
|
||||||
@@ -1812,7 +1812,7 @@ vimperator.Commands = function() //{{{
|
|||||||
}
|
}
|
||||||
else if (/^\d+$/.test(args))
|
else if (/^\d+$/.test(args))
|
||||||
{
|
{
|
||||||
var index = parseInt(args) - 1;
|
var index = parseInt(args, 10) - 1;
|
||||||
if (index < vimperator.tabs.count())
|
if (index < vimperator.tabs.count())
|
||||||
vimperator.tabs.select(index, true);
|
vimperator.tabs.select(index, true);
|
||||||
else
|
else
|
||||||
@@ -2150,14 +2150,14 @@ vimperator.Commands = function() //{{{
|
|||||||
}
|
}
|
||||||
else if (/^\d+$/.test(args))
|
else if (/^\d+$/.test(args))
|
||||||
{
|
{
|
||||||
level = parseInt(args);
|
level = parseInt(args, 10);
|
||||||
}
|
}
|
||||||
else if (/^[+-]\d+$/.test(args))
|
else if (/^[+-]\d+$/.test(args))
|
||||||
{
|
{
|
||||||
if (special)
|
if (special)
|
||||||
level = vimperator.buffer.fullZoom + parseInt(args);
|
level = vimperator.buffer.fullZoom + parseInt(args, 10);
|
||||||
else
|
else
|
||||||
level = vimperator.buffer.textZoom + parseInt(args);
|
level = vimperator.buffer.textZoom + parseInt(args, 10);
|
||||||
|
|
||||||
// relative args shouldn't take us out of range
|
// relative args shouldn't take us out of range
|
||||||
if (level < 1)
|
if (level < 1)
|
||||||
|
|||||||
@@ -67,9 +67,9 @@ vimperator.Tabs = function() //{{{
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (spec.match(/^([+-]\d+)$/)) // relative position +/-N
|
if (spec.match(/^([+-]\d+)$/)) // relative position +/-N
|
||||||
position += parseInt(spec);
|
position += parseInt(spec, 10);
|
||||||
else // absolute position
|
else // absolute position
|
||||||
position = parseInt(spec);
|
position = parseInt(spec, 10);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (position > last)
|
if (position > last)
|
||||||
|
|||||||
@@ -699,7 +699,7 @@ vimperator.CommandLine = function() //{{{
|
|||||||
case "<LeftMouse>":
|
case "<LeftMouse>":
|
||||||
if (event.originalTarget.className == "hl-URL buffer-list")
|
if (event.originalTarget.className == "hl-URL buffer-list")
|
||||||
{
|
{
|
||||||
vimperator.tabs.select(parseInt(event.originalTarget.parentNode.parentNode.firstChild.textContent) - 1);
|
vimperator.tabs.select(parseInt(event.originalTarget.parentNode.parentNode.firstChild.textContent, 10) - 1);
|
||||||
close_window = true;
|
close_window = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -195,7 +195,7 @@ const vimperator = (function() //{{{
|
|||||||
// Number
|
// Number
|
||||||
else if (match = string.match(/^(\d+)$/))
|
else if (match = string.match(/^(\d+)$/))
|
||||||
{
|
{
|
||||||
return parseInt(match[1]);
|
return parseInt(match[1], 10);
|
||||||
}
|
}
|
||||||
|
|
||||||
var reference = this.variableReference(string);
|
var reference = this.variableReference(string);
|
||||||
|
|||||||
Reference in New Issue
Block a user