paxt001/status-pages/dhl_redirect_tracking_page....

33 lines
1.1 KiB
JavaScript
Raw Normal View History

2019-06-04 11:20:29 +02:00
// ==UserScript==
// @name Redirect DHL tracking page
// @description Redirects to a more static version of the tracking page that doesn't reset after a short time.
// @version 2019.06.28.1
2019-06-04 11:20:29 +02:00
// @author tastytea
// @copyright 2019, tastytea (https://tastytea.de/)
// @license GPL-3.0-only
// @namespace tastytea.de
// @homepageURL https://schlomp.space/tastytea/userscripts
// @supportURL https://schlomp.space/tastytea/userscripts/issues
// @downloadURL https://schlomp.space/tastytea/userscripts/raw/branch/main/status-pages/dhl_redirect_tracking_page.user.js
// @grant none
// @match https://*.dhl.de/*idc=*
2019-06-04 11:28:06 +02:00
// @run-at document-start
2019-06-04 11:20:29 +02:00
// @inject-into content
// ==/UserScript==
const re = new RegExp(
'dhl\.de(?:/nextt-online-public)?/([^/]{2})/.+idc=([0-9]+)');
2019-06-06 02:16:57 +02:00
const result = re.exec(window.location.href);
2019-06-04 11:20:29 +02:00
2019-06-06 02:16:57 +02:00
if (result.length < 3)
{
console.error("Could not extract language or shipment number.");
}
else
{
const lang = result[1];
const idc = result[2];
window.location.assign("https://nolp.dhl.de/nextt-online-public/" + lang
+ "/search?piececode=" + idc);
}