21 lines
517 B
JavaScript
21 lines
517 B
JavaScript
|
|
function GetElement(element) {
|
|
if (typeof element == "string") {
|
|
element = document.getElementById(element);
|
|
}
|
|
return element;
|
|
}
|
|
|
|
function escapeHTML(s) {
|
|
return s.replace(/&/g, '&')
|
|
.replace(/"/g, '"')
|
|
.replace(/</g, '<')
|
|
.replace(/>/g, '>');
|
|
}
|
|
|
|
function fixedEncodeURIComponent(str) {
|
|
return encodeURIComponent(str).replace(/[!'()*]/g, function (c) {
|
|
return '%' + c.charCodeAt(0).toString(16);
|
|
});
|
|
}
|