Shartak Rearrange Inventory

rearranges a few inventory items

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           Shartak Rearrange Inventory
// @namespace      http://userscripts.org/users/125692
// @description    rearranges a few inventory items
// @include        http://www.shartak.com/game.cgi
// @version 1.1
// ==/UserScript==

var a= document.getElementsByClassName("nodot inventory");
var first=a[0].firstElementChild;
var last=a[0].lastElementChild;
var target;
var b;

b= document.getElementsByClassName("inv-08 invtype-tool");//active GPS
if(b.length>0){
    target=b[0];
    var c=document.getElementsByClassName("timenowshown");
    var buttons=c[0].nextElementSibling;
    var newElement = document.createElement("ul");
    c[0].parentNode.insertBefore(newElement,buttons);
    newElement.appendChild(target);
	target.className="";//get rid of class name for this moved gps!
}


b= document.getElementsByClassName("inv-07 invtype-healing");//healing herbs
if(b.length>0){
    target=b[0];
    a[0].insertBefore(target,first);
}

b= document.getElementsByClassName("inv-06 invtype-healing");//FAKS
if(b.length>0){
    target=b[0];
    a[0].insertBefore(target,first);
}

b= document.getElementsByClassName("inv-0W invtype-drink");//empties
if(b.length>0){
    target=b[0];
    a[0].insertBefore(target,last.nextSibling);
}

b= document.getElementsByClassName("inv-0X invtype-drink");//native empties
if(b.length>0){
    target=b[0];
    a[0].insertBefore(target,last.nextSibling);
}