You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
1.0 KiB
36 lines
1.0 KiB
const REGULAR_STRING = { |
|
HTML_STYLE_TAG: '<[^<>]+>', |
|
ENTER: '[\n\r]', |
|
}; |
|
|
|
Utils = { |
|
htmlDecode: function (text) { |
|
return !text ? "" : (text + "").replaceAll("&|$|{|}|"|<|>| ", function (v) { |
|
switch (v) { |
|
case "&": |
|
return "&"; |
|
case "$": |
|
return "$"; |
|
case "{": |
|
return "{"; |
|
case "}": |
|
return "}"; |
|
case """: |
|
return "\""; |
|
case "<": |
|
return "<"; |
|
case ">": |
|
return ">"; |
|
case " ": |
|
default: |
|
return " "; |
|
} |
|
}); |
|
}, |
|
|
|
getPlainText: function (name) { |
|
return Utils.htmlDecode( |
|
name.replace(new RegExp(REGULAR_STRING.HTML_STYLE_TAG, "gm"), '').replace(new RegExp(REGULAR_STRING.ENTER, "gm"), '') |
|
) |
|
} |
|
}
|
|
|