Skip to content

GLB Cut CPU Players - Rc26 fix by RyanCane26

Details

AuthorRyanCane26

LicenseNo License

Categoryglb.warriorgeneral.com

Created

Updated

Size2.0 kB

Statistics

Learn how we calculate statistics in the FAQ.

Failed to fetch stats.

Description

Cuts CPU players to the minimum

Notes

Userstyle doesn't have notes.

Source code

// ==UserScript==
// @name           GLB Cut CPU Players - pabst fix
// @namespace      GLB
// @description    Cuts CPU players to the minimum
// @author	   DDCUnderground
// @match          https://glb.warriorgeneral.com/game/roster.pl?team_id=*
// @require        https://userscripts-mirror.org/scripts/source/74204.user.js
// @version	   23.05.10-RyanCane26
// ==/UserScript==
//

@-moz-document domain("userstyles.world") {
    * {
        color: crimson;
    }
}

@-moz-document url-prefix("https://userstyles.world/docs/") {
    h1, h2, h3 {
        color: tan;
    }
}
$(document).ready(function(){

	// functions
	var buildobj = function(a){
		var newobj = document.createElement(arguments[0]);
		for (var varval = 1; varval < arguments.length; varval++) {
			newobj.setAttribute(arguments[varval],arguments[varval+1]);
			varval++;
		};
		return newobj;
	};



	function cutAllCPUS(){
		$('#ddccutcpus').attr('value','Working');
		$('#ddccutcpus').attr("disabled", "true");

		$('tr[class="alternating_color1"],tr[class="alternating_color2"]').each(function(z){
			//if (z<2) {
				if ($('span[class="cpu"]',$(this)).length > 0) {
					var playerid  = $('a[href*="/game/player.pl?player_id="]',$(this)).attr('href');
					playerid = playerid.substring(playerid.indexOf('player_id=')+10,playerid.length);
					var upgradeData = 'action=Confirm Release&&player_id=' + playerid;
					$.ajax({
						 async: false,
						 type: 'POST',
						 url: "/game/cut_player.pl?player_id="+playerid,
						 data: encodeURI(upgradeData),
						 success: function(returned_data) {
						}
					})
				}
			//}
		})
		window.location.reload();

	}

	var cutcpusbut = buildobj('input','type','button','id','ddccutcpus','Value','Cut CPUs');
	var linebreak = buildobj('br');
	$('.medium_head:first').append(linebreak);
	$('.medium_head:first').append(cutcpusbut);
	$('#ddccutcpus').bind('click',cutAllCPUS, false);

})

Reviews

No reviews yet.