mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-21 18:07:58 +01:00
remove unnecessary parentheses from typeof operands
This commit is contained in:
@@ -1347,7 +1347,7 @@ function zoom_to(value)
|
|||||||
value = 100;
|
value = 100;
|
||||||
|
|
||||||
// convert to int, if string was given
|
// convert to int, if string was given
|
||||||
if (typeof(value) != "number")
|
if (typeof value != "number")
|
||||||
{
|
{
|
||||||
oldval = value;
|
oldval = value;
|
||||||
value = parseInt(oldval, 10);
|
value = parseInt(oldval, 10);
|
||||||
|
|||||||
@@ -413,11 +413,11 @@ function get_pref(name, forced_default)
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (typeof(default_value) == "string")
|
if (typeof default_value == "string")
|
||||||
pref = g_vimperator_prefs.getCharPref(name);
|
pref = g_vimperator_prefs.getCharPref(name);
|
||||||
else if (typeof(default_value) == "number")
|
else if (typeof default_value == "number")
|
||||||
pref = g_vimperator_prefs.getIntPref(name);
|
pref = g_vimperator_prefs.getIntPref(name);
|
||||||
else if (typeof(default_value) == "boolean")
|
else if (typeof default_value == "boolean")
|
||||||
pref = g_vimperator_prefs.getBoolPref(name);
|
pref = g_vimperator_prefs.getBoolPref(name);
|
||||||
else
|
else
|
||||||
pref = default_value;
|
pref = default_value;
|
||||||
@@ -436,11 +436,11 @@ function get_firefox_pref(name, default_value)
|
|||||||
var pref;
|
var pref;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (typeof(default_value) == "string")
|
if (typeof default_value == "string")
|
||||||
pref = g_firefox_prefs.getCharPref(name);
|
pref = g_firefox_prefs.getCharPref(name);
|
||||||
else if (typeof(default_value) == "number")
|
else if (typeof default_value == "number")
|
||||||
pref = g_firefox_prefs.getIntPref(name);
|
pref = g_firefox_prefs.getIntPref(name);
|
||||||
else if (typeof(default_value) == "boolean")
|
else if (typeof default_value == "boolean")
|
||||||
pref = g_firefox_prefs.getBoolPref(name);
|
pref = g_firefox_prefs.getBoolPref(name);
|
||||||
else
|
else
|
||||||
pref = default_value;
|
pref = default_value;
|
||||||
@@ -460,28 +460,28 @@ function set_pref(name, value)
|
|||||||
if (!g_vimperator_prefs)
|
if (!g_vimperator_prefs)
|
||||||
g_vimperator_prefs = g_firefox_prefs.getBranch("extensions.vimperator.");
|
g_vimperator_prefs = g_firefox_prefs.getBranch("extensions.vimperator.");
|
||||||
|
|
||||||
if (typeof(value) == "string")
|
if (typeof value == "string")
|
||||||
g_vimperator_prefs.setCharPref(name, value);
|
g_vimperator_prefs.setCharPref(name, value);
|
||||||
else if (typeof(value) == "number")
|
else if (typeof value == "number")
|
||||||
g_vimperator_prefs.setIntPref(name, value);
|
g_vimperator_prefs.setIntPref(name, value);
|
||||||
else if (typeof(value) == "boolean")
|
else if (typeof value == "boolean")
|
||||||
g_vimperator_prefs.setBoolPref(name, value);
|
g_vimperator_prefs.setBoolPref(name, value);
|
||||||
else
|
else
|
||||||
vimperator.echoerr("Unkown typeof pref: " + value);
|
vimperator.echoerr("Unknown typeof pref: " + value);
|
||||||
}
|
}
|
||||||
|
|
||||||
function set_firefox_pref(name, value)
|
function set_firefox_pref(name, value)
|
||||||
{
|
{
|
||||||
// NOTE: firefox prefs are always inititialized, no need to re-init
|
// NOTE: firefox prefs are always inititialized, no need to re-init
|
||||||
|
|
||||||
if (typeof(value) == "string")
|
if (typeof value == "string")
|
||||||
g_firefox_prefs.setCharPref(name, value);
|
g_firefox_prefs.setCharPref(name, value);
|
||||||
else if (typeof(value) == "number")
|
else if (typeof value == "number")
|
||||||
g_firefox_prefs.setIntPref(name, value);
|
g_firefox_prefs.setIntPref(name, value);
|
||||||
else if (typeof(value) == "boolean")
|
else if (typeof value == "boolean")
|
||||||
g_firefox_prefs.setBoolPref(name, value);
|
g_firefox_prefs.setBoolPref(name, value);
|
||||||
else
|
else
|
||||||
vimperator.echoerr("Unkown typeof pref: " + value);
|
vimperator.echoerr("Unknown typeof pref: " + value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -524,7 +524,7 @@ function set_showtabline(value)
|
|||||||
|
|
||||||
function set_titlestring(value)
|
function set_titlestring(value)
|
||||||
{
|
{
|
||||||
if (!value || typeof(value) != "string")
|
if (!value || typeof value != "string")
|
||||||
value = get_pref("titlestring");
|
value = get_pref("titlestring");
|
||||||
|
|
||||||
document.getElementById("main-window").setAttribute("titlemodifier", value);
|
document.getElementById("main-window").setAttribute("titlemodifier", value);
|
||||||
|
|||||||
@@ -110,7 +110,7 @@ function CommandLine ()
|
|||||||
// Sets the prompt - for example, : or /
|
// Sets the prompt - for example, : or /
|
||||||
function setPrompt(prompt)
|
function setPrompt(prompt)
|
||||||
{
|
{
|
||||||
if (typeof(prompt) != "string")
|
if (typeof prompt != "string")
|
||||||
prompt = "";
|
prompt = "";
|
||||||
|
|
||||||
prompt_widget.value = prompt;
|
prompt_widget.value = prompt;
|
||||||
@@ -738,7 +738,7 @@ function StatusLine()
|
|||||||
|
|
||||||
this.updateUrl = function(url)
|
this.updateUrl = function(url)
|
||||||
{
|
{
|
||||||
if (!url || typeof(url) != "string")
|
if (!url || typeof url != "string")
|
||||||
url = getCurrentLocation();
|
url = getCurrentLocation();
|
||||||
|
|
||||||
url_widget.value = url;
|
url_widget.value = url;
|
||||||
@@ -746,7 +746,7 @@ function StatusLine()
|
|||||||
|
|
||||||
this.updateInputBuffer = function(buffer)
|
this.updateInputBuffer = function(buffer)
|
||||||
{
|
{
|
||||||
if (!buffer || typeof(buffer) != "string")
|
if (!buffer || typeof buffer != "string")
|
||||||
buffer = "";
|
buffer = "";
|
||||||
|
|
||||||
inputbuffer_widget.value = buffer;
|
inputbuffer_widget.value = buffer;
|
||||||
@@ -757,9 +757,9 @@ function StatusLine()
|
|||||||
if (!progress)
|
if (!progress)
|
||||||
progress = "";
|
progress = "";
|
||||||
|
|
||||||
if (typeof(progress) == "string")
|
if (typeof progress == "string")
|
||||||
progress_widget.value = progress;
|
progress_widget.value = progress;
|
||||||
else if (typeof(progress) == "number")
|
else if (typeof progress == "number")
|
||||||
{
|
{
|
||||||
var progress_str = "";
|
var progress_str = "";
|
||||||
if (progress <= 0)
|
if (progress <= 0)
|
||||||
@@ -785,9 +785,9 @@ function StatusLine()
|
|||||||
// you can omit either of the 2 arguments
|
// you can omit either of the 2 arguments
|
||||||
this.updateTabCount = function(cur_index, total_tabs)
|
this.updateTabCount = function(cur_index, total_tabs)
|
||||||
{
|
{
|
||||||
if(!cur_index || typeof(cur_index != "number"))
|
if(!cur_index || typeof cur_index != "number")
|
||||||
cur_index = vimperator.tabs.index() + 1;
|
cur_index = vimperator.tabs.index() + 1;
|
||||||
if(!total_tabs || typeof(cur_index != "number"))
|
if(!total_tabs || typeof cur_index != "number")
|
||||||
total_tabs = vimperator.tabs.count();
|
total_tabs = vimperator.tabs.count();
|
||||||
|
|
||||||
tabcount_widget.value = "[" + cur_index.toString() + "/" + total_tabs.toString() + "]";
|
tabcount_widget.value = "[" + cur_index.toString() + "/" + total_tabs.toString() + "]";
|
||||||
@@ -796,7 +796,7 @@ function StatusLine()
|
|||||||
// percent is given between 0 and 1
|
// percent is given between 0 and 1
|
||||||
this.updateBufferPosition = function(percent)
|
this.updateBufferPosition = function(percent)
|
||||||
{
|
{
|
||||||
if(!percent || typeof(percent) != "number")
|
if(!percent || typeof percent != "number")
|
||||||
{
|
{
|
||||||
var win = document.commandDispatcher.focusedWindow;
|
var win = document.commandDispatcher.focusedWindow;
|
||||||
percent = win.scrollMaxY == 0 ? -1 : win.scrollY / win.scrollMaxY;
|
percent = win.scrollMaxY == 0 ? -1 : win.scrollY / win.scrollMaxY;
|
||||||
|
|||||||
@@ -246,7 +246,7 @@ function Vimperator() //{{{1
|
|||||||
mode = main;
|
mode = main;
|
||||||
extended_mode = this.modes.NONE;
|
extended_mode = this.modes.NONE;
|
||||||
}
|
}
|
||||||
if (typeof(extended) === "number")
|
if (typeof extended === "number")
|
||||||
extended_mode = extended;
|
extended_mode = extended;
|
||||||
|
|
||||||
if (!silent)
|
if (!silent)
|
||||||
@@ -742,7 +742,7 @@ function Tabs() //{{{1
|
|||||||
if (spec === undefined || spec === "")
|
if (spec === undefined || spec === "")
|
||||||
return position;
|
return position;
|
||||||
|
|
||||||
if (typeof(spec) === "number")
|
if (typeof spec === "number")
|
||||||
position = spec;
|
position = spec;
|
||||||
else if (spec === "$")
|
else if (spec === "$")
|
||||||
return last;
|
return last;
|
||||||
|
|||||||
Reference in New Issue
Block a user