Skip to content

Node.js based forum software built for the modern web

feat: add a new hook to override generateUrl in navigator.js

Barış Soner Uşaklı68a8db856a9d
diff --git a/public/src/modules/navigator.js b/public/src/modules/navigator.js
index 8c557985c3..0776f04c4b 100644
--- a/public/src/modules/navigator.js
+++ b/public/src/modules/navigator.js
@@ -441,7 +441,13 @@ define('navigator', [
function generateUrl(index) {
const pathname = window.location.pathname.replace(config.relative_path, '');
const parts = pathname.split('/');
- return parts[1] + '/' + parts[2] + '/' + parts[3] + (index ? '/' + index : '');
+ const newUrl = parts[1] + '/' + parts[2] + '/' + parts[3] + (index ? '/' + index : '');
+ const data = {
+ newUrl,
+ index,
+ };
+ hooks.fire('filter:navigator.generateUrl', data);
+ return data.newUrl;
}
navigator.getCount = () => count;