mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-12 08:55:47 +01:00
closes #106
This commit is contained in:
@@ -230,6 +230,23 @@ var socket,
|
|||||||
|
|
||||||
app.populate_online_users();
|
app.populate_online_users();
|
||||||
|
|
||||||
|
var url = window.location.href,
|
||||||
|
parts = url.split('/'),
|
||||||
|
active = parts[parts.length-1];
|
||||||
|
|
||||||
|
jQuery('.nav li').removeClass('active');
|
||||||
|
if(active) {
|
||||||
|
jQuery('.nav li a').each(function() {
|
||||||
|
var href = this.getAttribute('href');
|
||||||
|
if(active.match(/^users/))
|
||||||
|
active = 'users';
|
||||||
|
if (href.match(active)) {
|
||||||
|
jQuery(this.parentNode).addClass('active');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
window.scrollTo(0, 1); // rehide address bar on mobile after page load completes.
|
window.scrollTo(0, 1); // rehide address bar on mobile after page load completes.
|
||||||
}, 100);
|
}, 100);
|
||||||
@@ -237,24 +254,6 @@ var socket,
|
|||||||
|
|
||||||
|
|
||||||
jQuery('document').ready(function() {
|
jQuery('document').ready(function() {
|
||||||
|
|
||||||
// On menu click, change "active" state
|
|
||||||
var menuEl = document.querySelector('.nav'),
|
|
||||||
liEls = menuEl.querySelectorAll('li'),
|
|
||||||
logoutEl = document.getElementById('logout'),
|
|
||||||
parentEl;
|
|
||||||
|
|
||||||
menuEl.addEventListener('click', function(e) {
|
|
||||||
parentEl = e.target.parentNode;
|
|
||||||
if (parentEl.nodeName === 'LI') {
|
|
||||||
for(var x=0,numLis=liEls.length;x<numLis;x++) {
|
|
||||||
if (liEls[x] !== parentEl) liEls[x].className = '';
|
|
||||||
else parentEl.className = 'active';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}, false);
|
|
||||||
|
|
||||||
|
|
||||||
addTouchEvents();
|
addTouchEvents();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user