hwm_links_to_auction

Shows some links to offers in auction (2016.04.18)

目前為 2016-04-18 提交的版本,檢視 最新版本

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

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

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name           hwm_links_to_auction
// @homepage       https://greasyfork.org/ru/scripts/18926-hwm-links-to-auction
// @description    Shows some links to offers in auction (2016.04.18)
// @version        2.21
// @include        http://178.248.235.15/auction.php
// @include        http://*.heroeswm.*/auction.php
// @include        http://*.lordswm.*/auction.php
// @include	   http://178.248.235.15/auction.php?cat=my&sort=0
// @include	   http://*.heroeswm.*/auction.php?cat=my&sort=0
// @icon           	https://app.box.com/representation/file_version_34029013909/image_2048/1.png?shared_name=hz97b2qwo2ycc5ospb7ccffn13w3ehc4
// @namespace ee3188f25b047f7229cc78df2e732ef3
// ==/UserScript==
(function () {
var version	= "2.21";
var elements = new Array('abrasive', 'snake_poison', 'tiger_tusk', 'ice_crystal', 'moon_stone', 'fire_crystal', 'meteorit', 'witch_flower', 'wind_flower', 'fern_flower', 'badgrib');
var res = {
	'b_wood'	: 1,
	'b_ore'		: 2,
	'b_mercury'	: 3,
	'b_sulphur'	: 4,
	'b_crystal'	: 5,
	'b_gem'		: 6
	};
var sectors = {
	"Empire Capital":"01",
	"East River":"02",
	"Tiger Lake":"03",
	"Rogue Wood":"04",
	"Wolf Dale":"05",
	"Peaceful Camp":"06",
	"Lizard Lowland":"07",
	"Green Wood":"08",
	"Eagle Nest":"09",
	"Portal Ruins":"10",
	"Dragon Caves":"11",
	"Shining Spring":"12",
	"Sunny Sity":"13",
	"Magma Mines":"14",
	"Bear' Mountain":"15",
	"Fairy Trees":"16",
	"Harbour City":"17",
	"Mithril Coast":"18",
	"GreatWall":"19",
	"Titan's Valley":"20",
	"Fishing Village":"21",
	"Kingdom Capital":"22",
	"Ungovernable Steppe":"23",
	"Crystal Garden":"24",
	"East Island":"25",
	"Wilderness":"26",
	"Sublime Arbor":"27"
};

var type_arts, art, search_s, elem, link_art, bool_el;
var ems2, ems;
ems = document.querySelectorAll( "b > a[href*='auction_lot_protocol.php']");		//Ї®«гзЁ«Ё ¬ ббЁў ўлбв ў«Ґ­­ле «®в®ў
for (var i=0;i<ems.length;i++) {
	elem = ems[i].parentNode.parentNode.parentNode.childNodes[0].childNodes[0];
	if (elem.tagName == 'IMG'){							//аҐбл Ё н«Ґ¬Ґ­вл
		art = elem.getAttribute('src');
	        art = art.substring(art.lastIndexOf("/")+1,art.length-4);
		bool_el = false;
		for (var j=0;j<elements.length;j++) if (elements[j] == art) bool_el = true;
		if (bool_el)			link_art = 'http://'+location.hostname+'/auction.php?cat=elements&art_type='+art;
		else	if (res[art] != null)	link_art = 'http://'+location.hostname+'/auction.php?cat=res&type='+res[art];
			else	if (art == 'house_cert'){
					ems2 = ems[i].parentNode.parentNode.childNodes[3].data.replace(/(^\s+|\s+$)/g,'');
//			                alert(':'+ems2+':'+sectors[ems2]);
					link_art = 'http://'+location.hostname+'/auction.php?cat=cert&sort=0&art_type=sec_'+sectors[ems2];
				}
	} else {
		if (elem.tagName == 'A'){							//Їа®бвлҐ  авл
			art = elem.getAttribute('href');
		        art = art.substring(art.indexOf("=")+1);
		}
		if (elem.tagName == 'TABLE'){    						//б«®¦­®б®бв ў­лҐ Ё«Ё Ё¬Ґ­­лҐ  авл
			elem = elem.childNodes[0].childNodes[0].childNodes[0].childNodes[0];
			if (elem.tagName == 'TABLE') {						//б«®¦­®б®бв ў­лҐ Ё¬Ґ­­лҐ  авл
				elem = elem.childNodes[0].childNodes[0].childNodes[0].childNodes[0];
			}
			art = elem.getAttribute('href');
		        art = art.substring(art.indexOf("=")+1,art.indexOf("&"));
		}
		search_s = "option[value*='"+art+"']";
		ems2 = document.querySelectorAll(search_s);
		if (ems2.length > 0) {
			type_arts = ems2[0].getAttribute('value');
			type_arts = type_arts.substring(0,type_arts.indexOf("#"));
			link_art = 'http://'+location.hostname+'/auction.php?cat='+type_arts+'&art_type='+art;
		}
	}
	elem = ems[i].parentNode.parentNode;
	elem.appendChild(document.createElement('br'));
	var newa = document.createElement('a');
	newa.innerHTML = '<B>HA PblHOK</B> &gt;&gt;';
	newa.href = link_art;
	newa.setAttribute('class', 'pi');
	elem.appendChild(newa);
}
})();