WoW Remote AH Enhancement

WoW Remote Auction House Enhancements

As of 27. 09. 2016. See the latest version.

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         WoW Remote AH Enhancement
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  WoW Remote Auction House Enhancements
// @author       Scott Mundorff
// @match        https://us.battle.net/wow/en/vault/character/auction/*
// @grant        none
// @require http://code.jquery.com/jquery-latest.js
// ==/UserScript==
var idleTime = 0;
$(document).ready(function(){
    //Increment the idle time counter every minute.
    var idleInterval = setInterval(timerIncrement, 60000); // 1 minute

    //Zero the idle timer on mouse movement.
    $(this).mousemove(function (e) {
        idleTime = 0;
    });
    $(this).keypress(function (e) {
        idleTime = 0;
    });
    
    if(Auction.page == "browse"){
        var items = $("div.auction-house").children("div.table").find("td.item").parent();
        $(items).each(function(key){
            // show ilvl inline
            ParseILvl(this);
        });
        /*
        $("div.profile-sidebar-inner").css("height","auto");
        $("ul.profile-sidebar-menu > li").css("float","left");
        $("div.profile-sidebar-crest").css("display","none");
        $("div.profile-contents").css("width","");
        $("div.profile-contents").css("float","");
        */
    }else if(Auction.page == "create"){
        // select 12 hours
        $("#form-duration").val(0);
        // select per item pricing
        $("#form-priceType").val("perItem");
        // add onclick to ("#similar-auctions .similar-items .table tr")
        $("#similar-auctions .similar-items .table tr .price").click(undercut);
        $("#similar-auctions .similar-items .table tr .price").first().click();
    }
    // Auction.page
    Auction.toasts["AHEnhanced"] = "AH Enhanced Loaded";
    Auction.toast("AHEnhanced",3000,"");
});

function undercut(){
    var gold = $(this).children(".icon-gold").first().text();
    var silver = $(this).children(".icon-silver").first().text();
    var copper = $(this).children(".icon-copper").first().text();
    var money = Auction.deformatMoney(gold, silver, copper);
    if($(this).parent().children().first().text() != Auction.character.name)
        money -= 1;
    AuctionCreate.setStarting(money * 0.98);
    AuctionCreate.setBuyout(money);
}

function ParseILvl(item){
    var level = $(item).children("td.level");
    var minLvl = $(level).children("div").children("strong").first().text();
    var iLvl = $(level).children("div").children("strong").last().text();
    $(level).text(minLvl + " / i" + iLvl);
}

function timerIncrement() {
    idleTime = idleTime + 1;
    if (idleTime > 5) { // 20 minutes
        window.location.reload();
    }
}