JS: Base functions
This commit is contained in:
@@ -1 +1,20 @@
|
||||
|
||||
|
||||
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);
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user