Merge #15489 - Use onhashchange event instead of polling for hash changes

Signed-off-by: William Desportes <williamdes@wdes.fr>
This commit is contained in:
William Desportes 2019-10-17 23:02:54 +02:00
commit 582a013f35
No known key found for this signature in database
GPG Key ID: 90A0EF1B8251A889

View File

@ -636,23 +636,18 @@ AJAX.registerOnload('config.js', function () {
setupConfigTabs();
adjustPrefsNotification();
// tab links handling, check each 200ms
// tab links handling
// (works with history in FF, further browser support here would be an overkill)
var prevHash;
var tabCheckFnc = function () {
if (location.hash !== prevHash) {
prevHash = location.hash;
if (prevHash.match(/^#tab_[a-zA-Z0-9_]+$/)) {
// session ID is sometimes appended here
var hash = prevHash.substr(5).split('&')[0];
if ($('#' + hash).length) {
setTab(hash);
}
window.onhashchange = function () {
if (location.hash.match(/^#tab_[a-zA-Z0-9_]+$/)) {
// session ID is sometimes appended here
var hash = location.hash.substr(5).split('&')[0];
if ($('#' + hash).length) {
setTab(hash);
}
}
};
tabCheckFnc();
setInterval(tabCheckFnc, 200);
window.onhashchange();
});
//