Skip to content

Instantly share code, notes, and snippets.

@yogin
Last active October 19, 2019 22:34
Show Gist options
  • Save yogin/f5f2337009c5263a0518dc94bec60b9d to your computer and use it in GitHub Desktop.
Save yogin/f5f2337009c5263a0518dc94bec60b9d to your computer and use it in GitHub Desktop.
TORN UserScript: Safer Faction Give To User
// ==UserScript==
// @name TORN - Safer Faction Give To User
// @description Removes the background bars in the Faction's Give To User tab, so it is easier to read and search for members
// @version 0.1
// @author Sekor [2170311]
// @namespace https://github.com/yogin
// @homepage https://gist.github.com/yogin/f5f2337009c5263a0518dc94bec60b9d
// @match https://www.torn.com/factions.php?step=your*
// @grant none
// ==/UserScript==
(function() {
'use strict';
var $ = window.jQuery;
var setupEvent = function() {
var user = '';
var balance = 0;
var money = 0;
var $input_money_group = $(".money-wrap .input-money-group");
var $input_money_value = $(".money-wrap .inputs-wrap input[type='hidden'].input-money");
$("#money-user").change(function() {
setTimeout(function() {
user = $("#money-user").val();
balance = $(".money-wrap .userlist-wrapper .user-info-list-wrap .depositor span[alt='"+user+"']").closest(".depositor").find(".money").attr("data-value") || 0;
}, 500);
});
$(".money-wrap .inputs-wrap input[type='text'].input-money").change(function() {
money = $input_money_value.val() || 0;
// console.log("User:"+user+" - Balance:"+balance+" - Money:"+money);
if (parseInt(money) > parseInt(balance)) {
// console.log("Insufficient balance!");
$input_money_group.removeClass("success")
$input_money_group.addClass("error")
}
});
};
setTimeout(setupEvent, 1000);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment