Pickpocket Cyclists

Hilight cyclists and hide police officers

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name         Pickpocket Cyclists
// @namespace    http://tampermonkey.net/
// @version      0.2
// @description  Hilight cyclists and hide police officers
// @author       Baskerville
// @match        https://www.torn.com/loader.php?sid=crimes
// @icon         https://www.google.com/s2/favicons?sz=64&domain=torn.com
// @grant        none
// @license      MIT
// ==/UserScript==

const bell = new Audio('https://mhece.com/media/bicycle-bell.mp3')

function picker(){
    const l = document.querySelectorAll('div.crime-option')
    for(const div of l){
        let b = div.querySelector('.titleAndProps___DdeVu').textContent
        if (b.includes('Cyclist')){
            const green = '#ccffcc'
            if(div.style.backgroundColor != green){
                div.style.backgroundColor = green
                bell.play()
            }
        }
        else if (b.includes('Police')){
            div.style.display = 'none'
        }
    }
}

// Options for the observer (which mutations to observe)
const config = { attributes: true, childList: true, subtree: true }
const observer = new MutationObserver(picker)
observer.observe(document.body, config)