Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Topics - Forum Conventions
The Noble Talk / Trade discussion userscript!
« on March 26th, 2017, 04:46 AM »
In short, this is pretty much a userscript that sends formatted PMs to users from the offer page. Here's the code!

Code: [Select]
// ==UserScript==
// @name         Discuss Offers
// @namespace
// @version      1.0
// @description  Discuss offers with other Lestrade's users using a template. Intended to be used until the comments system is implemented.
// @author       Alexandra antigravities
// @match*
// @grant        unsafeWindow
// ==/UserScript==

(function() {
    'use strict';
    var templates = {};
    templates.Declined = "Hi! I declined your [url={{offer-url}}]offer[/url] because:\n\n{{reason}}\n\nThanks for the offer anyway! Feel free to send me another!\n\n-Alex";
    templates.Accepted = "Hi, I just wanted to discuss something with you about this [url={{offer-url}}]offer[/url]:\n\n{{reason}}\n\nThanks!\n-Alex"
    templates.Unread = templates.Accepted;
    templates.Completed = templates.Completed;
    templates.Canceled = templates.Accepted;
    templates.Pending = templates.Pending;

    var window = unsafeWindow;
    var st = document.getElementsByTagName("h2")[0];
    var oto;
    if( document.getElementsByTagName("strong")[0].children[0].href.toString() == document.getElementById("userbox").children[0].href.toString() ) oto = document.getElementsByTagName("strong")[1].children[0].getAttribute("data-id");
    else oto = document.getElementsByTagName("strong")[0].children[0].getAttribute("data-id");
    var tmpl = templates[st.innerText.split("current status: ")[1]];
    st.innerHTML += "<br><br><input type='text' id='reason'></input><form action='/pm/?sa=send2' method='post'><input type='hidden' name='" + window.we_sessvar + "' value='" + window.we_sessid + "'></input><input type='hidden' name='subject' value='Re: your offer #" + window.location.toString().split("/")[4] + "'></input><input type='hidden' name='recipient_to[]' value='" + oto + "'></input><input type='hidden' id='m_message' name='message' value=\"" +
    tmpl.replace("{{offer-url}}", window.location.toString()) + "\"/><input type='submit' value='Discuss this offer' onclick=\"document.getElementById('m_message').value=document.getElementById('m_message').value.replace('{{reason}}', document.getElementById('reason').value);\"></input></form>";

You can and should change the templates under the "CHANGE TEMPLATES HERE" comment. Mainly wrote this for myself but figured I'd release it in case it helps anyone else out. Have fun, and happy trading!
The Trader's Clerk / Barter Offer Archive
« on March 18th, 2017, 01:01 AM »
Sayonara, Barter

I figured I'd post this here in case anyone's interested: in the event that another meteor hits, I've started to keep an archive of every offer made, since nobody else has done it. The project is called "Sayonara,", and a crappy frontend (that I plan on improving at some point) to the collected data is here (keep in mind it downloads ~25MB in compressed data, mobile users beware!). I've written a new semi-buggy backend that you should use, here. It is also very far from complete.

If you'd like to conduct your own science experiment with the data, I've made the source to the scraper open and the data files available. Here are offers.lz (huge, ~17mb - an archive of all of the offers), users.lz (big, ~5mb - an archive of basic user information), and items.lz (tiny, ~200kb - an archive of every item that's been mentioned in an offer). A full scrape took approximately 20 hours, but your results may vary. I plan to re-scrape about every week.

Extracting the data to JSON is relatively easy if you have access to Node.js. Simply
Code: [Select]
npm install lz-string
and then
Code: [Select]
var fs = require("fs");
var lz = require("lz-string");

["offers", "users", "items"].forEach(function(v){
  fs.writeFileSync(v + ".json", lz.decompressFromEncodedURIComponent(fs.readFileSync(v + ".json").toString()));

// Ta-da, you should now have ~125M of JSON in the current directory. Isn't file compression amazing?

Have fun! If anyone notices anything wrong with the scraped data, please let me know so I can fix it. Also let me know if you're doing anything interesting with it, I'd love to hear about that!
The Fatal Problem / Issue(s)
« on February 13th, 2017, 11:20 AM »
Figured I'd make a new thread instead of clogging up the existing one.

  • Changing forum profile info nukes avatars
  • No option to change the time zone Oh, oops, I didn't see it. Modify Profile -> Look and Layout

I'll add to this as I find more.