NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
// ==UserScript==
// @name Wofh: Price Saver
// @namespace https://ru.waysofhistory.com/
// @version 1.1
// @description Сохраняет цены в Массовой торговле.
// @author Regis
// @match https://*.waysofhistory.com/gen/html/*
// @grant unsafeWindow
// @license MIT
// ==/UserScript==
(function () {
'use strict';
var $ = unsafeWindow.jQuery;
if (!$) {
return;
}
function makeKey(resId) {
return '__ext__price_saver__r' + resId;
}
var body = $("body");
body.on("click", ".js-doFreeMarketBtn", function () {
var resId = $("#tradeFreeMarket-form .resFilter-res.-active").attr('data-res');
var price = $("#tradeFreeMarket-form .tradeFreeMarket-cost-slider input").val();
localStorage.setItem(makeKey(resId), price);
});
body.on("click", "#tradeFreeMarket-form .resFilter-res", function () {
var resId = $("#tradeFreeMarket-form .resFilter-res.-active").attr('data-res');
var price = localStorage.getItem(makeKey(resId));
if (price) {
$("#tradeFreeMarket-form .tradeFreeMarket-cost-slider input").val(price);
}
});
})();