NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
// ==UserScript== // @name lj stat // @namespace torn.com // @include *torn.com/* // @author Ahab [1735214] // @version 0.1 // @license MIT // ==/UserScript== var observerTarget = $('div[class*="users___"]')[0]; var observerConfig = { attributes: false, childList: true, characterData: false, subtree: false }; var observer = new MutationObserver(function(mutations) { setTimeout(() => { $('div[aria-label*="Love Juice Taken"]').closest($('div[class*="statRow___"]')).remove() lj(); }, 1000); }); observer.observe(observerTarget, observerConfig); function lj(){ var amount = $('div[id*="drugs"]').parent()[2].children.length -1 var drug = ['Cannabis','Ecstasy','Ketamine','LSD','Opium','Shrooms','Speed','PCP','Xanax','Vicodin'] var users = [0,0,0,0,0] var ht = "" for (var i = 0; i < amount; i++) { users[i] += parseInt($('div[aria-label^="Drugs used"]').parent().children()[i+1].outerText.split('\n')[1].replace(/\,/g,'')) } for (var x = 0; x < drug.length; x++) { for (i = 0; i < amount; i++) { users[i] -= $('div[aria-label^="'+drug[x]+' taken"]').parent().children()[i+1].outerText.split('\n')[1].replace(/\,/g,'') } } for (i = 0; i < amount; i++) { ht += '<div class="statValue___3QuK8"><span>'+users[i]+'</span></div>' } $('div[id*="drugs"]').closest($('div[class*="category___"]')).find($('div[class*="statRows___"]')).append('<div class="statRow___3cwCz" tabindex="0"><div class="statName___2Spao chartAvailable___6Pd6L" aria-label="Love Juice Taken,">Love Juice Taken</div>'+ht) }