// ==UserScript== // @name FR - AH - Lowest Auction Price // @namespace https://github.com/flamyfox/FrFun // @version 0.1 // @description Average Price and Cheapest Per item // @author flamyfox // @match http://www1.flightrising.com/auction-house/buy/realm/* // @exclude http://www1.flightrising.com/auction-house/buy/realm/app* // @exclude http://www1.flightrising.com/auction-house/buy/realm/dragons* // @exclude http://www1.flightrising.com/auction-house/buy/realm/fam* // @exclude http://www1.flightrising.com/auction-house/buy/realm/skins* // @grant none // ==/UserScript== var iPer, iPerPoint, minPrice, minPP; $(document).ready(function() { chkPer(); //listener $("#bPer").bind("click",function() { chkPer(); }); $("#bRest").bind("click",function() { minPrice= ""; iPer = ""; minPP = ""; iPerPoint = ""; $("#lowestText").text("--"); }); }); function chkPer(){ var temp; $("#ah-content>.ah-listing-row").each(function() { //当前行(loop) var thisLine = $(this); /////仅食物需要此块,因为需要计算每点价格 //获取物品(图片)id var iID = thisLine.attr("data-listing-itemid"); //获取物品详细页面 var iDetailUrl = "http://flightrising.com/includes/itemajax.php?id="+ iID +"&tab=food"; //获取食物点数 var foodPoint = $("#tooltip-"+iID).find(".foodval").text().replace("Food Points: ",""); //console.log(iID,foodPoint); //获取总价 var price = thisLine.find(".ah-listing-cost").text(); //获取数量 var iNum = thisLine.find(".ah-listing-icon").attr("data-quantity"); if ( !iNum ){ iNum= 1;//如果没有数量则计为1,例如宠物,装饰 } //计算单价 iPer = price / iNum; iPerPoint = iPer / foodPoint; temp = "
Per:" + iPer.toFixed(2); if(foodPoint){ temp = temp + ", PP:" + iPerPoint.toFixed(2) + "
"; }else{ temp = temp+ ""; } thisLine.find(".per").remove(); thisLine.find(".ah-listing-currency").append(temp); }); }