User Pass
Home Sign Up Contact Log In
Bluesman
bluest blues
online
Link
 
Got a new comp today and can't seem to locate the effective level script on league pages, does anyone have one that works?
 
HighRoller74
offline
Link
 
Originally posted by Bluesman
Got a new comp today and can't seem to locate the effective level script on league pages, does anyone have one that works?


You mean the one that does this? If so, please send me a message. I may not see this post again, I rarely come in this forum.

Rank Team Players Age Level Value Eff Level Salary
1 C-Town MF'n Hood 55 388 79 1446.13 84 $23,220,000
2 Tyrrhenian Sea Wasps 53 355 79 1434.39 83 $12,466,000
3 Orlando Prime Timers 55 396 79 1425.74 84 $26,209,480
4 SWAT Team 55 374 79 1422.13 83 $24,218,000
5 Brothers in Arms 55 385 79 1417.50 83 $24,286,000
6 Miami Red Hawks 55 401 79 1416.80 83 $23,220,000
7 THE LOSTENSES MONSTER 55 431 79 1405.82 83 $22,000,000
8 Florida Frenzy 53 388 78 1397.51 83 $25,209,800
9 Asau Golden Eagles 55 408 78 1386.48 83 $19,996,360
10 The Practice Squad Allen Iverson 55 372 78 1385.78 83 $23,879,000
11 Felicus Feline Generals 49 367 79 1355.42 83 $20,921,040
12 Auburn War Eagles 54 340 78 1329.92 82 $15,925,000
Edited by HighRoller74 on Aug 28, 2021 06:22:01
 
slughead42
Don't panic!
offline
Link
 
This one is working for me currently, on Chrome running Tampermonkey:


// ==UserScript==
// @name Player Value To League Page S48 fix
// @namespace pbr
// @include https://goallineblitz.com/game/league.pl?league_id=*
// @include https://glb.warriorgeneral.com/game/league.pl?league_id=*
// @copyright 2010, pabst
// @license (CC) Attribution Share Alike; http://creativecommons.org/licenses/by-sa/3.0/
// @version 13.12.29
// @description Add player value info to GLB league pages.
// ==/UserScript==

window.setTimeout( function() {
var button = document.createElement("input");
button.setAttribute("value","Get Eff Levels");
button.setAttribute("type","button");
button.addEventListener("click", main, true);
button.setAttribute("id","levelbutton");

var endorsements = document.getElementById("endorsements");
endorsements.parentNode.insertBefore(button, endorsements);
}, 100);

var numTeams;
var data = new Array();

function main() {
document.getElementById("levelbutton").disabled = "true";

var conferences = document.getElementsByClassName("conference_table");
numTeams = conferences.length*6;
for (var c=0; c<conferences.length; c++) {
var teams = conferences[c].getElementsByTagName("a");
for (var t=0; t<teams.length; t++) {
// console.log(teams[t].href.toString());
if (teams[t].href.toString().indexOf("team.pl") != -1) {
getInetPage(teams[t].href.toString().replace("team","roster"), handleTeam);
}
}
}
setTimeout(finish, 2000);
}

function tsort(arr, col) {
for (var i=0; i<arr.length-1; i++) {
for (var j=i; j<arr.length; j++) {
if (parseFloat(arr[col]) < parseFloat(arr[j][col])) {
var temp = arr;
arr = arr[j];
arr[j] = temp;
}
}
}
}

function finish() {
if (data.length != numTeams) {
setTimeout(finish, 2000);
return;
}

tsort(data,4);

var text = "";

var str = "<table><tbody>";
var hdr = "<tr class='nonalternating_color'>";
var titles = ["Rank","Team","Players","Age","Level","Value","Eff Level","Salary"];
for (var i=0; i<titles.length; i++) {
hdr += "<td>"+titles+"</td>";
}
hdr += "</tr>";

var cap = document.getElementsByClassName("info_item")[0].lastChild.textContent;
cap = parseFloat(cap.replace(/\$/g,"").replace(/\,/g,""));
var output = str+hdr;
var t = "";
for (var i=0; i<data.length; i++) {
output += "<tr class='alternating_color"+(i%2+1)+"'>";
output += "<td>"+(i+1)+"</td>";

if ((i+1) < 10) text += ".";
text += (i+1)+" ... ";

for (var j=0; j<data.length; j++) {
output += "<td";
if (j == 6) {
output += " style='text-align: right;";
if (parseFloat(data[j].replace(/\$/g,"").replace(/\,/g,"")) > cap) {
output += " color:red;";
}
output += "'";
}
else if (j > 0) {
output += " style='text-align: center'";
}
output += ">"+data[j]+"</td>";

if (j == 0) {
t = data[j].slice(data[j].indexOf(">")+1, data[j].indexOf("</a"));
t = t.replace(/^\s\s*/, '').replace(/\s\s*$/, '');
}
else {
var d = [null, 2, 3, 2, 7, 2, 11];
if (isNaN(data[j].toString().slice(-1)) == true) data[j] = 0;
while (data[j].toString().length < d[j]) data[j] = "."+data[j];
text += data[j] + " ... ";
}

if (j == 6) {
text += t + " ... ";
}
}
output += "</tr>";
text = text.slice(0,text.length-4) + "\n";
}
output += "</tbody></table>";
console.log(text);

var btn = document.getElementById("levelbutton");
btn.style.visibility = "hidden";
btn.style.display = "none";

var div = document.createElement("div");
div.innerHTML = output;

var end = document.getElementById("endorsements");
end.parentNode.insertBefore(div,end);
}

var processed=0;

function handleTeam(address, page) {
processed++;
var pr = page.responseText.replace(/<img/g,"<div").replace(/\/img/g,"/div>");
var team = pr.split('"big_head subhead_head">')[1].split("<")[0];
team = team.split("(")[0].replace(/\s+$/g,"");;

var color="#ff0000";
if (processed > 16) color = "#0000ff";
team = "<a style=color:"+color+" href="+address+">"+team+"</a>";

var text = page.responseText.split("Count:")[1].split("Roster")[0];
var salary = "$"+text.split("($")[1].split("/yr)")[0];
var numPlayers = parseInt(text.split(">")[2]);
var avgLevel = parseInt(text.split("Avg Lv ")[1]);
var avgValue = parseFloat(text.split('margin-bottom: 6px;">')[3].split("</div>"));
var effLevel = parseInt(text.split("Effective Lv ")[1]);

text = page.responseText.split("content_contracts")[0];
text = text.split("content_rosters")[1];
// console.log(text);

var cpuPlayers = text.split('class="cpu"').length - 1;
numPlayers -= cpuPlayers;

var avgAge = 0;
// td class name bug here
var ages = text.split("player_level\">");
if (ages.length > 0) {
for (var i=2; i<ages.length; i=i+2) {
var tmp = ages.split("<")[0];
if (isNaN(parseInt(tmp)) == false) {
avgAge += parseInt(ages);
}
}
}
avgAge = avgAge / numPlayers;
// console.log(team+") "+numPlayers+" - "+cpuPlayers+" - "+avgLevel+" - "+avgValue+" - "+avgAge+" - "+effLevel+" - "+salary);
data.push([team,numPlayers,avgAge.toFixed(0),avgLevel,avgValue.toFixed(2),effLevel,salary]);
document.getElementById("levelbutton").value += ".";
}

function getInetPage(address, func) {
// console.log("getInetPage : "+address);
var req = new XMLHttpRequest();
req.open( 'GET', address, true );
req.onload = function() {
if (this.status != 200) {
alert("pbr gm script: Error "+this.status+" loading "+address);
}
else {
// console.log("loaded: "+address)
func(address,this);
}
};

req.send(null);
return req;
}


 
Bluesman
bluest blues
online
Link
 
Thanks to both of you for helping. I got it working, I use firefox with violentmonkey but when I installed the script for effective level it only had http on the include lines, I had to add a s to them making it https and it started working.
 


You are not logged in. Please log in if you want to post a reply.