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.
42 lines
1.0 KiB
42 lines
1.0 KiB
var entityMap = {
|
|
"&": "&",
|
|
"<": "<",
|
|
">": ">",
|
|
'"': '"',
|
|
"'": ''',
|
|
"/": '/'
|
|
};
|
|
|
|
function escapeHtml(string) {
|
|
return String(string).replace(/[&<>"'\/]/g, function (s) {
|
|
return entityMap[s];
|
|
});
|
|
}
|
|
|
|
function popup(mylink, windowname) {
|
|
return popupSize(mylink, windowname, 400, 200);
|
|
}
|
|
|
|
function popupSize(mylink, windowname, width, height) {
|
|
var href;
|
|
if (typeof(mylink) == "string") {
|
|
href = mylink;
|
|
} else {
|
|
href = mylink.href;
|
|
}
|
|
|
|
var w = window.open(href, windowname, "width=" + width + ",height=" + height + ",scrollbars=yes,resizable=yes");
|
|
w.focus();
|
|
w.moveTo(300, 200);
|
|
return false;
|
|
}
|
|
|
|
function updateQueryStringParameter(uri, key, value) {
|
|
var re = new RegExp("([?&])" + key + "=.*?(&|$)", "i");
|
|
if (uri.match(re)) {
|
|
return uri.replace(re, '$1' + key + "=" + value + '$2');
|
|
} else {
|
|
var separator = uri.indexOf('?') !== -1 ? "&" : "?";
|
|
return uri + separator + key + "=" + value;
|
|
}
|
|
}
|
|
|