-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
21 lines (19 loc) · 780 Bytes
/
script.js
File metadata and controls
21 lines (19 loc) · 780 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// Redirect helper: send /the-office-games -> /fg
(function() {
try {
// Normalize pathname by removing trailing slashes
const pathname = window.location.pathname.replace(/\/+$|^$/g, '') || '/';
// Remove trailing slash for comparison
const normalized = pathname.replace(/\/+$/, '');
if (normalized === '/the-office-games' || normalized === 'the-office-games') {
const search = window.location.search || '';
const hash = window.location.hash || '';
const target = `${window.location.origin}/fg${search}${hash}`;
// Use replace so the redirect doesn't create an extra history entry
window.location.replace(target);
}
} catch (e) {
// Fail silently on older browsers or unexpected environments
console.error('Redirect script error:', e);
}
})();