Adds auction house link for selected items, sets currency to gems, duration to 7 days
当前为
// ==UserScript==
// @name Flight Rising - Auction House Improvements (Seller)
// @author Necramancy
// @description Adds auction house link for selected items, sets currency to gems, duration to 7 days
// @namespace https://greasyfork.org/users/547396
// @match https://*.flightrising.com/auction-house/sell/realm/*
// @grant none
// @version 0.1
// ==/UserScript==
(function() {
'use strict';
var clickPanel = document.getElementById('ah-sell-left'),
sellItem = document.getElementById('ah-sell-itemname'),
sURL = window.location.href,
bURL = sURL.replace('sell', 'buy');
clickPanel.addEventListener('click', function ( e ) {
var itemName = e.path[1].dataset.name;
if ( sURL.toString().indexOf('dragons') <= -1 ){
createButton( itemName );
}
selectGemsDays();
});
function createButton( item ) {
var ahButton = document.createElement('a');
ahButton.href = bURL + '?itemname=' + item;
ahButton.target = '_blank';
ahButton.innerText = 'Auction House →';
// Styles
ahButton.classList.add('redbutton');
ahButton.classList.add('anybutton');
ahButton.style.display = 'block';
ahButton.style.margin = '10px auto';
ahButton.style.padding = '5px 8px';
ahButton.style.fontSize = '10px';
ahButton.style.width = '100px';
sellItem.appendChild(ahButton);
}
// Automatically select gems and 7 days
function selectGemsDays() {
var gems = document.getElementById('ah-sell-currency-gems'),
days = document.getElementById('ah-sell-duration');
// Comment out if you do not want gems/7 days auto-selected
gems.checked = true;
days.options.selectedIndex = 2;
}
})();