mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-24 06:22:26 +01:00
Refactor HTML generation to use E4X. Could use some refactoring.
This commit is contained in:
@@ -45,22 +45,22 @@ liberator.util = { //{{{
|
||||
{
|
||||
if (type == "number")
|
||||
{
|
||||
return "<span style=\"color: red;\">" + arg + "</span>";
|
||||
return <span style="color: red;">{arg}</span>;
|
||||
}
|
||||
else if (type == "string")
|
||||
{
|
||||
if (processStrings)
|
||||
arg = '"' + liberator.util.escapeHTML(arg.replace(/\n/, "\\n")) + '"';
|
||||
arg = <>"{arg.replace(/\n/, "\\n")}"</>;
|
||||
|
||||
return "<span style=\"color: green;\">" + arg + "</span>";
|
||||
return <span style="color: green;">{arg}</span>;
|
||||
}
|
||||
else if (type == "boolean")
|
||||
{
|
||||
return "<span style=\"color: blue;\">" + arg + "</span>";
|
||||
return <span style="color: blue;">{arg}</span>;
|
||||
}
|
||||
else if (arg == null || arg == "undefined")
|
||||
{
|
||||
return "<span style=\"color: blue;\">" + arg + "</span>";
|
||||
return <span style="color: blue;">{arg}</span>;
|
||||
}
|
||||
else if (type == "object" || type == "function")
|
||||
{
|
||||
@@ -193,7 +193,7 @@ liberator.util = { //{{{
|
||||
highlightURL: function (str, force)
|
||||
{
|
||||
if (force || /^[a-zA-Z]+:\/\//.test(str))
|
||||
return "<a class='hl-URL' href='#'>" + liberator.util.escapeHTML(str) + "</a>";
|
||||
return <a class="hl-URL" href="#">{str}</a>;
|
||||
else
|
||||
return str;
|
||||
},
|
||||
@@ -251,6 +251,12 @@ liberator.util = { //{{{
|
||||
return string;
|
||||
},
|
||||
|
||||
range: function (start, end)
|
||||
{
|
||||
while (start < end)
|
||||
yield start++;
|
||||
},
|
||||
|
||||
// same as Firefox's readFromClipboard function, but needed for apps like Thunderbird
|
||||
readFromClipboard: function ()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user