Hide unwanted targets from pickpocketing crime page to avoid unintended operation.
当前为
// ==UserScript==
// @name block-unwanted-pickpocketing-target
// @namespace nodelore.torn.easy-market
// @version 1.1
// @description Hide unwanted targets from pickpocketing crime page to avoid unintended operation.
// @author nodelore[2786679]
// @license MIT
// @match https://www.torn.com/loader.php?sid=crimes*
// @icon https://www.google.com/s2/favicons?sz=64&domain=torn.com
// @require https://greatest.deepsurf.us/scripts/5679-wait-for-elements/code/Wait%20For%20Elements.js?version=250853
// @grant none
// ==/UserScript==
(function(){
const $ = window.jQuery;
// add targets you want to block here
const block_targets = [
"Gang member",
"Thug",
"Police officer",
"Mobster",
]
// add activities you want to block here
const avoid_activities = [
"Jogging",
"Cycling",
"Walking", // you can remove this to enable showing walking target
]
const updateCrimeOption = function(option){
const titleProps = $(option).find("div[class^='titleAndProps'] div");
const activities = $(option).find("div[class^='activity']");
if(titleProps.length > 0 && activities.length > 0){
const title = titleProps.contents().filter(function(){
return this.nodeType === 3;
}).text();
const activity = activities.contents().filter(function(){
return this.nodeType === 3;
}).text();
if(block_targets.indexOf(title) !== -1){
$(option).hide();
console.log(`hide ${title} who is ${activity}`);
}
else if(avoid_activities.indexOf(activity) !== -1){
$(option).hide();
console.log(`hide ${title} who is ${activity}`);
}
}
}
waitForElems({
sel: '.crime-option',
onmatch: updateCrimeOption
});
})();