Bon, vu que mon perso s'est retrouvé sorti de l'univers pour cause d'inactivité (rhâ, j'ai pas reçu de mail, mais ça n'aurait fait que retarder l'échéance), et que je m'étais promis que c'était le dernier, je suis un peu là par miracle.
Personnellement, j'avais utilisé GreaseMonkey (plugin Firefox) pour améliorer l'interface de contrebande : ça virait les contrebandes où on ne pouvait pas accéder, et ça envoyait les informations de la page dans une base de donnée (le POST ci-dessous). Vu que je n'ai pas de compte, je n'ai plus en tête si çà virait les blancs directement dans les chiffres dans l'interface (je crains que non, mais qqu'un qui connait un peu le code pourrait s'en sortir avec ce qui est ci-dessous.
J'avais proposé à la Trinité Divine du jeu de contribuer, mais ce n'était pas dans les objectifs. Du coup je n'ai pas diffusé ce genre de choses...
A noter que j'avais aussi proposé un redesign de l'interface via Stylish (autre plugin Firefox) pour améliorer l'interface (des goûts et des couleurs). C'est dans ce post
viewtopic.php?f=80&t=11117.
@OseF : on s'est peut-être croisé à ton époque... Je pense avoir été un poil plus tardif :
http://histoire1.apocalypsis.org/index.php/Uriel
Bon jeu à tous.
Code : Tout sélectionner
// ==UserScript==
// @name Apocalypsis
// @namespace Apo
// @description Booste l'interface d'Apo qui craint
// @include http://www.apocalypsis.org/commerce/cb_price
// @include http://www.apocalypsis.org/commerce/cb_price?*
// @version 1
// @grant GM_xmlhttpRequest
// ==/UserScript==
//***********************************************
// a function that loads jQuery and calls a callback function when jQuery has finished loading
function addJQuery(callback) {
var script = document.createElement('script');
script.setAttribute('src', '//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js');
script.addEventListener('load', function () {
var script = document.createElement('script');
script.textContent = 'window.jQ=jQuery.noConflict(true);(' + callback.toString() + ')();';
document.body.appendChild(script);
}, false);
document.body.appendChild(script);
}
// the guts of this userscript
function main() {
// Note, jQ replaces $ to avoid conflicts.
function parseCB() {
jQ('.subbox_sub p:nth-of-type(2)') .attr('style', 'color: orange !important');
jQ('.subbox_sub p:nth-of-type(3)') .attr('style', 'color: yellow !important');
var location = jQ('.subbox_sub p:nth-of-type(2)') .text() .replace(new RegExp('.*\\(([0-9.]+)\\)[,.].*', 'g'), '$1');
var taxe = jQ('.subbox_sub p:nth-of-type(3)') .text() .replace(new RegExp('.*([0-9]+).*', 'g'), '$1');
console.log('location [' + location + ']');
console.log('Taxe [' + taxe + ']');
jQ('.subbox_sub .listing') .attr('style', 'color: rose !important');
var prices = [];
jQ('.subbox_sub .listing > tbody > tr') .each(function (index) {
var data = {};
item = jQ(this) .find('td:nth-of-type(1)') .html();
price = jQ(this) .find('td:nth-of-type(2)') .text() .replace(/ /g, '');
tax = jQ(this) .find('td:nth-of-type(3)') .text() .replace(/ /g, '');
stock = jQ(this) .find('td:nth-of-type(6)') .text() .replace(/ /g, '');
jQ(this) .find('td:nth-of-type(6)') .html('<span style="font-family: monospace">'+stock+'</span>');
data['item'] = item;
data['price'] = price;
data['tax'] = tax;
data['stock'] = stock;
data['location'] = location;
prices.push(data);
});
jQ.ajax({
type: "POST",
url : "http://127.0.0.1:8101/prices",
data: JSON.stringify(prices),
timeout: 5000,
crossDomain: true
});
}
// Quickway to find out if script is active
jQ('.subbox.footer .subbox_sub a') .attr('style', 'color: red !important');
jQ('.subbox.footer .subbox_sub a') .text('Apo Engine active');
// hide button
jQ('form[name=cb_prices] :input[type=submit]') .hide();
// and replace it by a hidden field
jQ('form[name=cb_prices]') .append('<input type="hidden" value="Voir" name="e_sub">');
// remove closed CB
//jQ(':input[name=z_cb] option[value="3_4_0_1_4"]').remove();
// submit on selection change
jQ('form[name=cb_prices] :input[name=z_cb]') .on('change', function (event) {
jQ('form[name=cb_prices]') .submit();
});
parseCB();
}
// load jQuery and execute the main function
addJQuery(main);
//***********************************************