Greasy Fork

Greasy Fork is available in English.

The West - Market best bids

Market utility for highlighting the best bids.

当前为 2015-01-17 提交的版本,查看 最新版本

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name The West - Market best bids
// @namespace TomRobert
// @author Esperiano (modified by Darius II; updated by Tom Robert)
// @description Market utility for highlighting the best bids.
// @include http://*.the-west.*/game.php*
// @version 0.3.1
// @supportURL
// @grant none
// ==/UserScript==
TWPT_inject = function () {
  if (document.getElementById('TWPT_js'))
  {
    alert('Script already installed');
    return;
  }
  var twpdjs = document.createElement('script');
  twpdjs.setAttribute('type', 'text/javascript');
  twpdjs.setAttribute('language', 'javascript');
  twpdjs.setAttribute('id', 'TWPT_js');
  twpdjs.innerHTML = '(' + (function () {
    version = '0.3.1',
    name = 'Market best bids',
    author = 'Esperiano (modified by Darius II; updated by Tom Robert)',
    id_scripts = '7391';
    min_gameversion = '2.05';
    max_gameversion = Game.version.toString();
    website = 'http://greasyfork.icu/scripts/7391',
    TheWestApi.register('TW-Mbb', name, min_gameversion, max_gameversion, author, website).setGui('<br>Market utility for highlighting the best bids.<br><br><span style="color:green;">Green</span> – Bid is lower than the purchase price.<br>Black -  Bid is equal to the purchase price.<br><span style="color:blue;">Blue</span> – Bid is between 100% and 200% of the purchase price.<br><span style="color:red;">Red</span> – Bid is more than 200% of the purchase price.<br><br><i>' + name + ' v' + version + '</i>');
    var windows = document.getElementById('windows');
    windows.addEventListener('DOMNodeInserted', OnNodeInserted, false);
    function OnNodeInserted(event) {
      if ($('#market_buytable').length) {
        var szakup = document.getElementById('market_buytable');
        //var produkty = zakup.getElementsByClassName("row");
        //var nrow=produkty.length-1;
        setTimeout(colorize(szakup), 1000);
      }
    }
    function colorize(zakup) {
      var zakup = zakup;
      var produkty = zakup.getElementsByClassName('row');
      var nrow = produkty.length - 1;
      // Ilość sprzedawanych szt //Ricavo la quantità dei pezzi in vendita
      var il = produkty[nrow].getElementsByClassName('mpb_stack'); // pobranie ilości
      il = il[0].getElementsByTagName('div');
      il = il[0].textContent;
      // Cena kup teraz //Ricavo il compra subito dell'oggetto in vendita
      if (produkty[nrow].getElementsByClassName('mpb_buynow')) {
        var cena_oryginalna = produkty[nrow].getElementsByClassName('mpb_buynow'); // pobranie ceny kup teraz //PREZZO COMPRA ORA ASTA
        kupno = cena_oryginalna[0].textContent;
        kupno = kupno.replace('$', '');
        kupno = kupno.replace(/\./g, '');
        kupno = kupno.replace(/\,/g, ''); // usunięcie z ceny bez przecinków i kropek oraz $ //PREZZO COMPRA ORA SENZA PUNTI(ITA), VIRGOLE(ENG) E $
      }
      // Cena aukcyjna //Rivavo il prezzo d'asta dell'oggetto in vendita

      var cenal_oryginalna = produkty[nrow].getElementsByClassName('mpb_bid'); // pobranie ceny licytacji
      licyt = cenal_oryginalna[0].textContent;
      licyt = licyt.replace('$', '');
      licyt = licyt.replace(/\./g, '');
      licyt = licyt.replace(/\,/g, '');
      var cena = kupno / il;
      if(!kupno||(licyt<kupno&&licyt)){
			cena=licyt/il;
		}
      var nazwa_oryginalna = produkty[nrow].getElementsByClassName('mpb_article'); //pobranie nazwy
      var obj;
      var cena_obj;
      nazwa_obj = nazwa_oryginalna[0].textContent;
      for (i = 0; i < 185206; i++) {
        if (ItemManager.get(i)) {
          obj = ItemManager.get(i).name;
          if (obj == nazwa_obj) {
            cena_obj = ItemManager.get(i).price;
          }
        }
      }
      if (cena < cena_obj) {
        cena_oryginalna[0].style.color = 'green';
        cenal_oryginalna[0].style.color = 'green';
      }
      if ((cena > cena_obj) && (cena <= cena_obj * 2)) {
        cena_oryginalna[0].style.color = 'blue';
        cenal_oryginalna[0].style.color = 'blue';
      }
      if (cena > cena_obj * 2) {
        cena_oryginalna[0].style.color = 'red';
        cenal_oryginalna[0].style.color = 'red';
      }
    }
  }).toString() + ')();';
  document.body.appendChild(twpdjs);
};
if (location.href.indexOf('.the-west.') != - 1 && location.href.indexOf('game.php') != - 1)
setTimeout(TWPT_inject, 2500, false);