Greasy Fork is available in English.

Notification Navbar

Have notifications as a nav link!

질문, 리뷰하거나, 이 스크립트를 신고하세요.
// ==UserScript==
// @name         Notification Navbar
// @namespace    http://tampermonkey.net/
// @version      0.15
// @description  Have notifications as a nav link!
// @author       BigNibba
// @include      https://anilist.co/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    let loggedIn = true;
    let navDiv = document.getElementsByClassName("links")[0]; // gets the navbar
    for(let i = 0; i <= navDiv.childNodes.length-1;i++){
        if(navDiv.childNodes[i].innerText == "Login"){loggedIn = false;} // sees if login is available meaning user is not logged in
    }
    if(loggedIn == true){ // if they are not logged in they won't be able to access notifications
        let notifLink = document.createElement("a");
        notifLink.href="/notifications";
        notifLink.style.padding = "13px";
        notifLink.innerText = "Notifications";
        notifLink.setAttribute("class","link");
        navDiv.insertBefore(notifLink,navDiv.childNodes[12]); // Inserts the notification link before the search bar and after 'Forum'
    }
})();