kittyfluff / gaia market item listed

// ==UserScript==
// @name gaia market item listed
// @namespace kittyfluff
// @version 0.12
// @match *.gaiaonline.com/marketplace/mystore*
// @match *.gaiaonline.com/marketplace/userstore*
// ==/UserScript==

// shows the number of current items listed when a store is visited

// although own number of items on sale can be visible from the main marketpalce-page anyway =w=

var shopOpened = document.getElementsByClassName("otab selected"),
    stock = 0,
    noSaleItems = "";

if (shopOpened) { // own or other shop is open
  stock = document.getElementsByClassName("A");
  if (! stock.length) { // then maybe other shop is opened
    stock = document.getElementsByClassName("vend_rows_sh_rowA");
  }
  if (stock.length) {
    noSaleItems = stock[0].getElementsByClassName("nolistings first last");
    stock = stock.length;
    if (noSaleItems.length) {
      stock--;
    }
    shopOpened[0].innerHTML += " (" + stock + ")";
  }      
}