Don't Hunt

Disables the hunting screen to prevent you from using your energy while in SA.

K instalaci tototo skriptu si budete muset nainstalovat rozšíření jako Tampermonkey, Greasemonkey nebo Violentmonkey.

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

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Userscripts.

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

K instalaci tohoto skriptu si budete muset nainstalovat manažer uživatelských skriptů.

(Už mám manažer uživatelských skriptů, nechte mě ho nainstalovat!)

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.

(Už mám manažer uživatelských stylů, nechte mě ho nainstalovat!)

// ==UserScript==
// @name         Don't Hunt
// @namespace    https://greatest.deepsurf.us/en/scripts/402084-don-t-hunt
// @version      1.0
// @description  Disables the hunting screen to prevent you from using your energy while in SA.
// @author       cryosis7 [926640]
// @match        https://www.torn.com/index.php?page=hunting
// ==/UserScript==

'use strict'

let blocker = elementCreator('div', { 'class': 'm-top10' });
blocker.appendChild(elementCreator('div', { 'class': 'title-black top-round', 'aria-level': '5' }, 'STOP'));
let body = (elementCreator('div', { 'class': 'bottom-round cont-gray p10' }))
body.appendChild(elementCreator('p', null, "You are <span style='color: red; font-weight:bold'>NOT</span> allowed to use your energy to hunt!"));
body.appendChild(document.createElement('br'));
blocker.appendChild(body)

document.querySelector('.hunt').replaceWith(blocker);

/**
 * Creates an HTML element according to the given parameters
 * 
 * @param {String} type The HTML type to create ('div')
 * @param {Object} attributes Attributes to set {'class': 'wrapper'}
 * @param {String} text 'Inner text/html to set'
 */
function elementCreator(type = 'div', attributes, text) {
    let el = document.createElement(type);
    for (let attribute in attributes)
        el.setAttribute(attribute, attributes[attribute])
    if (text) el.innerHTML = text;
    return el
}