FVToolkit-Sidebar

scrollable sidebar with all villagers

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name         FVToolkit-Sidebar
// @namespace    CuteHornyUnicorn
// @version      0.1a4
// @description  scrollable sidebar with all villagers
// @author       CuteHornyUnicorn
// @include      http://www.furvilla.com/*
// @grant        none
// ==/UserScript==
/*jshint multistr: true */


var sidebar = document.createElement('div');
sidebar.setAttribute('class', 'FVTK-rsidebar');
sidebar.style = 'position: fixed;\
    right: -20px;\
    top: -20px;\
    overflow:scroll;\
    height: 108%;\
    width: 230px;\
    visibility: hidden;\
';

sidebar.innerHTML = '\
    <div class="widget">\
         <div class="widget-content" style="visibility: visible;">\
         </div>\
    </div>\
';

document.body.appendChild(sidebar);


var getPage = function(url, callback) {
    var req = new XMLHttpRequest();
    req.onload = function() {
        if ( callback && typeof(callback) === 'function' ) {
            callback( this.responseXML );
        }
    };
    req.open( 'GET', url );
    req.responseType = 'document';
    req.send();
};

getPage( '/profile', function(response) {
    var sidebarWidget = document.querySelector( '.FVTK-rsidebar > .widget' );
    var sidebarWidgetContent = sidebarWidget.querySelector('.widget-content');
    var listVillagers = response.querySelector( '.villagers-list' );
    var ulStore = listVillagers.querySelectorAll('ul > li');
   for (var liContent of ulStore) {
              var VilCareer = liContent.querySelector('.villager-info');
       if (VilCareer !== null) {
              VilCareer = VilCareer.textContent.trim().toLowerCase();
              if (VilCareer == 'animal husbandry') {
                  VilCareer = 'breeder';
              }
                     if (VilCareer == 'construction worker') {
                  VilCareer = 'carpenter';
              }

       var replaceLinks = liContent.innerHTML;
       replaceLinks = replaceLinks.replace('villager/','career/'+VilCareer+'/');
       liContent.innerHTML = replaceLinks;
          }

var villager = document.createElement('div');
villager.setAttribute('class', 'text-center');
sidebarWidgetContent.appendChild(villager);
villager.innerHTML = liContent.innerHTML;
   }
});


function addGlobalStyle(css) {
    var head, style;
    head = document.getElementsByTagName('head')[0];
    if (!head) { return; }
    style = document.createElement('style');
    style.type = 'text/css';
    style.innerHTML = css;
    head.appendChild(style);
}

	addGlobalStyle("\
\
.FVTK-rsidebar .text-center {\
text-align: left;\
height: 80px;\
}\
.FVTK-rsidebar .text-center .villager-avatar {\
width:75px;\
border-radius: 0px !important;\
}\
\
.FVTK-rsidebar .text-center p {\
text-align: left;\
font-size: 10px;\
width: 60%;\
position: relative;\
top: -80px;\
margin-left: 80px;\
margin-bottom: 0px;\
}\
\
.FVTK-rsidebar .text-center p a {\
}\
\
.adsbygoogle {\
display: none !important;\
}\
");