NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
// ==UserScript==
// @name MafiEra ISO Tool
// @version 1
// @namespace http://www.fireblend.com/
// @updateURL https://openuserjs.org/meta/Fireblend/MafiEra_ISO_Tool.meta.js
// @downloadURL https://openuserjs.org/src/scripts/Fireblend/MafiEra_ISO_Tool.user.js
// @license MIT
// @icon https://media.discordapp.net/attachments/165286383257255936/429860317649174529/imageedit__4571108207.png
// @homepageURL http://www.fireblend.com/
// @author Sergio Morales
// @description Add an ISO link to make user-specific searches easier!
// @include http*://www.resetera.com/threads/*
// @include http*://www.resetera.com/threads/*/*
// @require https://code.jquery.com/ui/1.12.1/jquery-ui.js
// @resource customCSS https://code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css
// @run-at document-idle
// @grant GM_addStyle
// @grant GM_getResourceText
// ==/UserScript==
(function () {
'use strict';
function addISOLinks() {
var locations = document.getElementsByClassName("message-userDetails")
Array.prototype.forEach.call(locations, function (location) {
var player_name = location.getElementsByClassName("message-name")[0].textContent
var a1 = makeLink(player_name);
location.appendChild(a1);
});
}
function makeLink(player_name) {
var search_url = "https://www.resetera.com/search/1/?q=%2A&t=post&c[thread]=***GAMETHREAD***&c[users]=***PLAYER***&o=date";
var url_parts = window.location.href.split(".");
var after_point = url_parts[url_parts.length - 1];
var thread_id = after_point.split("/")[0]
search_url = search_url.replace("***GAMETHREAD***", thread_id);
search_url = search_url.replace("***PLAYER***", player_name);
var a = document.createElement('a');
a.setAttribute('style', 'cursor:pointer; font-size:10px;');
a.setAttribute('target', '_blank');
a.setAttribute('href', search_url);
a.style.alignSelf = "center";
a.appendChild(document.createTextNode("ISO"));
return a;
}
addISOLinks();
})();