moped / pc.sk Custom QuickLinks

// ==UserScript==
// @name         pc.sk Custom QuickLinks
// @namespace    pretaktovanie.sk
// @version      0.6
// @description  Presunutie odkazov z rychleho menu do nav-main + Moje Temy
// @author       moped
// @match        https://pretaktovanie.zoznam.sk/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    //get username, apply modifications only for logged in user
    var loggedIn = document.querySelector('#username_logged_in');

    if(loggedIn!==null) {
        var dropdown = document.querySelector('#quick-links');
        var innerMenu = dropdown.querySelector('ul.dropdown-contents');

        //make some space after quick links menu and leave the icon only
        dropdown.setAttribute('style','margin-right:10px;');
        dropdown.querySelector('.dropdown-trigger span').remove();

        //move "FAQ" to dropdown menu
        innerMenu.appendChild(document.querySelector('#nav-main .fa-question-circle').parentNode.parentNode);

        //create "Moje temy" link in quick-links
        var uname = loggedIn.querySelector('.username').innerText;
        var mojeTemy = '<li style="margin-right: 10px;"><a role="menuitem" href="search.php?author='+uname+'&sf=firstpost&sr=topics"><i class="icon fa-file-o fa-fw icon-gray" aria-hidden="true"></i><span>Moje témy</span></a></li>';
        innerMenu.children[5].insertAdjacentHTML('afterend', mojeTemy);

        //copy important links to nav-main
		var links = innerMenu.querySelectorAll('li:not(.separator)');
        var copyLinks = [links[0],links[1],links[2],links[3],links[4],links[5]];
        var linksHtml = "";
        for(var i=0; i<copyLinks.length; i++) {
            linksHtml += '<li style="margin-right: 10px;">' + copyLinks[i].innerHTML + '</li>';
        }
        loggedIn.insertAdjacentHTML('beforebegin', linksHtml);
    }
})();