mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-31 01:34:09 +02:00
JS: Introduce Icinga.Utils.addUrlFlag()
This commit is contained in:
parent
8da37e5ca2
commit
4d02d8f6d6
@ -210,6 +210,30 @@
|
|||||||
return params;
|
return params;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add the specified flag to the given URL
|
||||||
|
*
|
||||||
|
* @param {string} url
|
||||||
|
* @param {string} flag
|
||||||
|
*
|
||||||
|
* @returns {string}
|
||||||
|
*/
|
||||||
|
addUrlFlag: function (url, flag) {
|
||||||
|
var pos = url.lastIndexOf('#');
|
||||||
|
|
||||||
|
if (url.indexOf('?') !== -1) {
|
||||||
|
flag = '&' + flag;
|
||||||
|
} else {
|
||||||
|
flag = '?' + flag;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pos === -1) {
|
||||||
|
return url + flag;
|
||||||
|
}
|
||||||
|
|
||||||
|
return url.slice(0, pos) + flag + url.slice(pos);
|
||||||
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check whether two HTMLElements overlap
|
* Check whether two HTMLElements overlap
|
||||||
*
|
*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user