mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-11 08:25:46 +01:00
replace self links client side
This commit is contained in:
@@ -90,6 +90,7 @@ var socket,
|
||||
|
||||
socket.on('event:connect', function (data) {
|
||||
app.username = data.username;
|
||||
app.userslug = data.userslug;
|
||||
app.uid = data.uid;
|
||||
app.isAdmin = data.isAdmin;
|
||||
|
||||
@@ -285,6 +286,16 @@ var socket,
|
||||
});
|
||||
};
|
||||
|
||||
app.replaceSelfLinks = function(selector) {
|
||||
selector = selector || $('a');
|
||||
selector.each(function() {
|
||||
var href = $(this).attr('href')
|
||||
if (href && app.userslug) {
|
||||
$(this).attr('href', href.replace(/\[self\]/g, app.userslug));
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
app.processPage = function () {
|
||||
app.populateOnlineUsers();
|
||||
|
||||
@@ -299,6 +310,8 @@ var socket,
|
||||
|
||||
app.createStatusTooltips();
|
||||
|
||||
app.replaceSelfLinks();
|
||||
|
||||
setTimeout(function () {
|
||||
window.scrollTo(0, 1); // rehide address bar on mobile after page load completes.
|
||||
}, 100);
|
||||
|
||||
Reference in New Issue
Block a user