1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-23 13:22:28 +01:00

merge improvements in :echo object

This commit is contained in:
Doug Kearns
2007-11-13 06:00:32 +00:00
parent 0f9951e048
commit 2985555caa

View File

@@ -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 "&lt;unknown&gt;";
}
return arg; return "&lt;unknown type&gt;";
}, },
// 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;