fedilove-ui/static/fedilove-no-react.js

38 lines
991 B
JavaScript
Raw Normal View History

//alert(window.location.pathname);
function flag_main_content_as(tag) {
var a = document.querySelector('.main-content');
var contains = false;
for (var i = 0; i < a.classList.length; i++) {
if (a.classList[i] == tag) {
contains = true;
break;
}
}
if (!contains) {
a.classList += " "+tag;
}
}
function fedilove_customization() {
document.querySelector('.main-content').classList = "main-content";
document.querySelector('#chat-compose-global').style = 'visibility: collapse';
if (window.location.pathname.startsWith('/statuses/')) {
// this is ugly enough, so we will use CSS for the rest xD
flag_main_content_as('chat');
document.querySelector('#chat-compose-global').style = '';
}
}
var theurl = null;
setInterval(function() {
var newurl = window.location.pathname;
if (newurl != theurl) {
fedilove_customization();
theurl = newurl;
}
}, 500);