2018-01-19 09:32:20 +01:00
|
|
|
chrome.webRequest.onBeforeRequest.addListener(function(details) {
|
|
|
|
let url = details.url;
|
|
|
|
|
|
|
|
for(expression of [
|
|
|
|
/^https?:\/\/doc\.qt\.io\/qt-[0-9\.]+(.*)$/g,
|
|
|
|
/^https?:\/\/doc\.qt\.io\/archives\/qt-[0-9\.]+(.*)$/g,
|
|
|
|
/^https?:\/\/developer\.qt\.nokia\.com\/doc\/qt-[0-9\.]+(.*)$/g,
|
|
|
|
/^https?:\/\/qt\.nokia\.com\/doc(.*)$/g,
|
2018-03-16 21:34:17 +01:00
|
|
|
/^https?:\/\/doc\.qt\.nokia\.com\/(?:main\-snapshot|latest|stable|[0-9\.]+)(.*)$/g,
|
|
|
|
/^https?:\/\/doc\.trolltech\.com\/(?:main\-snapshot|latest|stable|[0-9\.]+)(.*)$/g
|
2018-01-19 09:32:20 +01:00
|
|
|
]) {
|
|
|
|
let match = expression.exec(url);
|
|
|
|
if(match !== null) {
|
|
|
|
return { redirectUrl: 'https://doc.qt.io/qt-5' + match[1] };
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
{
|
|
|
|
let match = /https?:\/\/bugreports\.qt\.nokia\.com\/(.*)$/g.exec(url);
|
|
|
|
if(match !== null) {
|
|
|
|
return { redirectUrl: 'https://bugreports.qt.io/' + match[1] };
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
{
|
|
|
|
let match = /https?:\/\/lists\.qt\.nokia\.com\/(.*)$/g.exec(url);
|
|
|
|
if(match !== null) {
|
|
|
|
return { redirectUrl: 'http://lists.qt-project.org\/' + match[1] };
|
|
|
|
};
|
|
|
|
}
|
|
|
|
}, {
|
|
|
|
urls : ["<all_urls>"]
|
|
|
|
}, ["blocking"]);
|