$(document).ready(function() { $.getJSON('/hibernate/search/documentation.json', function (json) { var currentUrl = window.location.pathname; var match = new RegExp('^' + json.pattern.replace('${version}', '([^/]+)').replace('${page}', '(.+\\.html)') + '$').exec(currentUrl); if (match.length != 3) { return; } var currentVersion = match[1]; var currentPage = match[2]; var currentHash = window.location.hash; if (currentVersion == json.stable || currentVersion == json.development || currentVersion == 'stable') { return; } var redirectPage; if (currentVersion in json.versions && currentPage in json.versions[currentVersion].redirects) { redirectPage = json.versions[currentVersion].redirects[currentPage]; } else { redirectPage = ''; } stableUrl = json.pattern.replace('${version}', json.stable).replace('${page}', redirectPage + currentHash); $('head').append(''); $('body').append('
This content refers to an outdated version of ' + json.project + '. Go to latest stable: version ' + json.stable +'.
'); }) });