mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-23 09:17:59 +01:00
merge improvements in :echo object
This commit is contained in:
@@ -45,6 +45,9 @@ vimperator.util = {
|
|||||||
{
|
{
|
||||||
var type = typeof(arg);
|
var type = typeof(arg);
|
||||||
|
|
||||||
|
// some objects like window.JSON or getBrowsers()._browsers need the try/catch
|
||||||
|
try
|
||||||
|
{
|
||||||
if (type == "number")
|
if (type == "number")
|
||||||
{
|
{
|
||||||
return "<span style=\"color: red;\">" + arg + "</span>";
|
return "<span style=\"color: red;\">" + arg + "</span>";
|
||||||
@@ -77,8 +80,13 @@ vimperator.util = {
|
|||||||
else
|
else
|
||||||
return "undefined";
|
return "undefined";
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
catch (e)
|
||||||
|
{
|
||||||
|
return "<unknown>";
|
||||||
|
}
|
||||||
|
|
||||||
return arg;
|
return "<unknown type>";
|
||||||
},
|
},
|
||||||
|
|
||||||
// takes a string like 'google bla, www.osnews.com'
|
// takes a string like 'google bla, www.osnews.com'
|
||||||
@@ -160,7 +168,7 @@ vimperator.util = {
|
|||||||
|
|
||||||
highlightURL: function (str, force)
|
highlightURL: function (str, force)
|
||||||
{
|
{
|
||||||
if (force || /^[a-zA-Z]+:\/\/.*\//.test(str))
|
if (force || /^[a-zA-Z]+:\/\//.test(str))
|
||||||
return "<a class='hl-URL' href='" + str + "'>" + vimperator.util.escapeHTML(str) + "</a>";
|
return "<a class='hl-URL' href='" + str + "'>" + vimperator.util.escapeHTML(str) + "</a>";
|
||||||
else
|
else
|
||||||
return str;
|
return str;
|
||||||
|
|||||||
Reference in New Issue
Block a user