Jump to content


Photo

Monday Night script?

MNF

8 replies to this topic

#1 Brute Squad

Brute Squad

    Veteran

  • Members
  • PipPipPip
  • 1,831 posts
  • Gender:Male

Posted 20 September 2021 - 05:02 PM

Is the mondaynight.js script defunct?  It doesn't seem to be working properly and I don't see it listed at https://www.mflscripts.com/mfl-apps/

 

I know MFL has their own HPM for Monday night, but Habman's was much better.

 

Thanks,

--Brute


www.jorgalink.com

#2 theeohiostate

theeohiostate

    Veteran

  • Members
  • PipPipPip
  • 4,314 posts
  • Gender:Male
  • Location:O-H-I-O

Posted 20 September 2021 - 07:55 PM

its not longer in service , not sure if habman even hosting any of that stuff anylonger , i located the old script file

 

if references some things on his server that i'm sure doesn't work anylonger , maybe he will bring it back to life , if so , here is the original files contents

 

if(mondayReportAlwaysOn == undefined)   var mondayReportAlwaysOn = false;
if(mondayReportClickToStart==undefined) var mondayReportClickToStart = false;
if(mondayReportDecimals==undefined)     var mondayReportDecimals = 0;
if(useOldMondayIconMethod==undefined)   var useOldMondayIconMethod = false;

var mondayReportWeeklyResults = new Array();
var mondayReportLiveScoring   = new Array();


function getMondayNightYTP(starterString) {
   var length = parseInt((starterString.length)/5,10);
   var seconds = 0;
   var yetToPlay = "";
   for (var j=0; j<length; j++) {
    var id = starterString.substr(j*5,4);
    var nflTeamSeconds = parseInt(habGlobalNFLGameSeconds[playerDatabase['pid_' + id].team],10);
    if (nflTeamSeconds>0) {
     var name = formatName(playerDatabase['pid_' + id].name);
     var team = playerDatabase['pid_' + id].team;
     var pos  = playerDatabase['pid_' + id].position;
     yetToPlay +=  name + "<br />" + "(" + team  + "-" + pos + ")<br />";
    }
   }
   if(yetToPlay=="") yetToPlay = "&nbsp;";
   return yetToPlay;
}

function doMondayReportTables() {
   var htmlCode = "<table align='center' cellspacing='0' class='homepagemodule report' id='mondayOuterTable'><caption><span>" + mondayReportTitle + "</span></caption><tr>";
   var gameOverCheck = new Array();
   for(var i=0; i<mondayReportLiveScoring.length; i++) {
    var roadYTP     = getMondayNightYTP(mondayReportWeeklyResults[i]['road'][2]);
    var homeYTP     = getMondayNightYTP(mondayReportWeeklyResults[i]['home'][2]);
    if(roadYTP=="&nbsp;"&&homeYTP=="&nbsp;") gameOverCheck[i]=true; else gameOverCheck[i]=false;
   }

   //DO "IN THE BOOKS"
   var htmlTable = "";
   var rowCount = 0;
   for(var i=0; i< mondayReportLiveScoring.length; i++) {
    var roadFID = mondayReportLiveScoring[i]['road'][0];
    var homeFID = mondayReportLiveScoring[i]['home'][0];
    if(roadFID!="BYE"&&homeFID!="BYE") {
     if((mondayReportLiveScoring[i]['road'][2]=="0"&&mondayReportLiveScoring[i]['home'][2]=="0")||gameOverCheck[i]) { 
      var roadScore = parseFloat(mondayReportLiveScoring[i]['road'][1],10); 
      var homeScore = parseFloat(mondayReportLiveScoring[i]['home'][1],10); 
      var roadName    = getHabTeamName(hideMondayTeamName,useMondayNickNames,franchiseNickNames,roadFID);
      var homeName    = getHabTeamName(hideMondayTeamName,useMondayNickNames,franchiseNickNames,homeFID);
      var altRoadName = getHabTeamName(false,false,franchiseNickNames,roadFID);
      var altHomeName = getHabTeamName(false,false,franchiseNickNames,homeFID);
      var roadIcon    = getHabTeamIcon(mondayReportDefaultIcon,mondayReportDefaultLogo,mondayReportIconURL,mondayReportIconExt,"mondayIcon",roadFID,useOldMondayIconMethod);
      var homeIcon    = getHabTeamIcon(mondayReportDefaultIcon,mondayReportDefaultLogo,mondayReportIconURL,mondayReportIconExt,"mondayIcon",homeFID,useOldMondayIconMethod);
      var roadLink    = "<a href='" + baseURLDynamic + "/" + year + "/options?L=" + league_id + "&F=" + roadFID + "&O=07' target='franchisepage' border='0' title='" + altRoadName + "' style='text-decoration: none;'>";
      var homeLink    = "<a href='" + baseURLDynamic + "/" + year + "/options?L=" + league_id + "&F=" + homeFID + "&O=07' target='franchisepage' border='0' title='" + altHomeName + "' style='text-decoration: none;'>";
      if(parseFloat(mondayReportLiveScoring[i]['road'][1],10)>parseFloat(mondayReportLiveScoring[i]['home'][1],10))
       { var roadClass = "mondayWinner"; var homeClass = "mondayLoser"; }
      else if(parseFloat(mondayReportLiveScoring[i]['road'][1],10)<parseFloat(mondayReportLiveScoring[i]['home'][1],10))
            { var roadClass = "mondayLoser"; var homeClass = "mondayWinner"; }
           else { var roadClass = "mondayTied"; var homeClass = "mondayTied"; }
      if(rowCount%2) 
       htmlTable += "<tr class='oddtablerow'><td class='mondayTeam " + roadClass + "'> "  + roadLink + roadIcon + roadName + "</a></td><td class='mondayScore " + roadClass + "'> " + roadScore.toFixed(mondayReportDecimals) + " </td><td class='mondayAtSymbol'>&nbsp; vs. </td><td class='mondayScore " + homeClass + "'> " + homeScore.toFixed(mondayReportDecimals) + "</td><td class='mondayTeam " + homeClass + "'> " + homeLink + homeIcon + homeName + "</a></td></tr>\n";
      else
       htmlTable += "<tr class='eventablerow'><td class='mondayTeam " + roadClass + "'> " + roadLink + roadIcon + roadName + "</a></td><td class='mondayScore " + roadClass + "'> " + roadScore.toFixed(mondayReportDecimals) + " </td><td class='mondayAtSymbol'>&nbsp; vs. </td><td class='mondayScore " + homeClass + "'> " + homeScore.toFixed(mondayReportDecimals) + "</td><td class='mondayTeam " + homeClass + "'> " + homeLink + homeIcon + homeName + "</a></td></tr>\n";
      rowCount++;     
     } //END IF
    }  //END IF
   }   //END LOOP
   if(htmlTable!="") htmlCode += "<th colspan='5' id='inTheBooks'>" + mondayReportTitle1 + "</th>\n" + htmlTable + "\n";

   //DO "RUBBING IT IN"   
   htmlTable = "";
   rowCount = 0;
   for(var i=0; i< mondayReportLiveScoring.length; i++) {
    var roadFID = mondayReportLiveScoring[i]['road'][0];
    var homeFID = mondayReportLiveScoring[i]['home'][0];
    if(roadFID!="BYE"&&homeFID!="BYE") {
     var roadScore = parseFloat(mondayReportLiveScoring[i]['road'][1],10); 
     var homeScore = parseFloat(mondayReportLiveScoring[i]['home'][1],10); 
     var roadTime  = parseInt(mondayReportLiveScoring[i]['road'][2],10); 
     var homeTime  = parseInt(mondayReportLiveScoring[i]['home'][2],10); 
     if(((roadScore>homeScore&&homeTime==0&&roadTime>0)||(homeScore>roadScore&&roadTime==0&&homeTime>0))&&!gameOverCheck[i]) {
      var roadName    = getHabTeamName(hideMondayTeamName,useMondayNickNames,franchiseNickNames,roadFID);
      var homeName    = getHabTeamName(hideMondayTeamName,useMondayNickNames,franchiseNickNames,homeFID);
      var altRoadName = getHabTeamName(false,false,franchiseNickNames,roadFID);
      var altHomeName = getHabTeamName(false,false,franchiseNickNames,homeFID);
      var roadIcon    = getHabTeamIcon(mondayReportDefaultIcon,mondayReportDefaultLogo,mondayReportIconURL,mondayReportIconExt,"mondayIcon",roadFID,useOldMondayIconMethod);
      var homeIcon    = getHabTeamIcon(mondayReportDefaultIcon,mondayReportDefaultLogo,mondayReportIconURL,mondayReportIconExt,"mondayIcon",homeFID,useOldMondayIconMethod);
      var roadLink    = "<a href='" + baseURLDynamic + "/" + year + "/options?L=" + league_id + "&F=" + roadFID + "&O=07' target='franchisepage' border='0' title='" + altRoadName + "' style='text-decoration: none;'>";
      var homeLink    = "<a href='" + baseURLDynamic + "/" + year + "/options?L=" + league_id + "&F=" + homeFID + "&O=07' target='franchisepage' border='0' title='" + altHomeName + "' style='text-decoration: none;'>";
      var roadYTP     = getMondayNightYTP(mondayReportWeeklyResults[i]['road'][2]);
      var homeYTP     = getMondayNightYTP(mondayReportWeeklyResults[i]['home'][2]);
      if(parseFloat(mondayReportLiveScoring[i]['road'][1],10)>parseFloat(mondayReportLiveScoring[i]['home'][1],10))
       { var roadClass = "mondayWinner"; var homeClass = "mondayLoser"; }
      else if(parseFloat(mondayReportLiveScoring[i]['road'][1],10)<parseFloat(mondayReportLiveScoring[i]['home'][1],10))
            { var roadClass = "mondayLoser"; var homeClass = "mondayWinner"; }
           else { var roadClass = "mondayTied"; var homeClass = "mondayTied"; }
      if(rowCount%2) {
       htmlTable += "<tr class='oddtablerow'><td class='mondayTeam " + roadClass + "'> "  + roadLink + roadIcon + roadName + "</a></td><td class='mondayScore " + roadClass + "'> " + roadScore.toFixed(mondayReportDecimals) + " </td><td class='mondayAtSymbol'>&nbsp; vs. </td><td class='mondayScore " + homeClass + "'> " + homeScore.toFixed(mondayReportDecimals) + "</td><td class='mondayTeam " + homeClass + "'> " + homeLink + homeIcon + homeName + "</a></td></tr>\n";
       htmlTable += "<tr class='oddtablerow'><td class='mondayYTP'>"   + roadYTP + "</a><td colspan='3'>&nbsp;</td><td class='mondayYTP'>" + homeYTP + "</td></tr>\n";
      } else {
       htmlTable += "<tr class='eventablerow'><td class='mondayTeam " + roadClass + "'> " + roadLink + roadIcon + roadName + "</a></td><td class='mondayScore " + roadClass + "'> " + roadScore.toFixed(mondayReportDecimals) + " </td><td class='mondayAtSymbol'>&nbsp; vs. </td><td class='mondayScore " + homeClass + "'> " + homeScore.toFixed(mondayReportDecimals) + "</td><td class='mondayTeam " + homeClass + "'> " + homeLink + homeIcon + homeName + "</a></td></tr>\n";
       htmlTable += "<tr class='eventablerow'><td class='mondayYTP'>"   + roadYTP + "</a><td colspan='3'>&nbsp;</td><td class='mondayYTP'>" + homeYTP + "</td></tr>\n";
      }
      rowCount++;     
     } //END IF
    }  //END IF
   }   //END LOOP
   if(htmlTable!="") htmlCode += "<th colspan='5' id='rubbingItIn'>" + mondayReportTitle2 + "</th>\n" + htmlTable + "\n";
   
   //DO "AIN'T OVER YET"
   htmlTable = "";
   rowCount = 0;
   for(var i=0; i< mondayReportLiveScoring.length; i++) {
    var roadFID = mondayReportLiveScoring[i]['road'][0];
    var homeFID = mondayReportLiveScoring[i]['home'][0];
    if(roadFID!="BYE"&&homeFID!="BYE") {
     var roadScore = parseFloat(mondayReportLiveScoring[i]['road'][1],10); 
     var homeScore = parseFloat(mondayReportLiveScoring[i]['home'][1],10); 
     var roadTime  = parseInt(mondayReportLiveScoring[i]['road'][2],10); 
     var homeTime  = parseInt(mondayReportLiveScoring[i]['home'][2],10); 
     if(((roadScore>=homeScore&&homeTime>0)||(homeScore>=roadScore&&roadTime>0))&&!gameOverCheck[i]) {
      var roadName    = getHabTeamName(hideMondayTeamName,useMondayNickNames,franchiseNickNames,roadFID);
      var homeName    = getHabTeamName(hideMondayTeamName,useMondayNickNames,franchiseNickNames,homeFID);
      var altRoadName = getHabTeamName(false,false,franchiseNickNames,roadFID);
      var altHomeName = getHabTeamName(false,false,franchiseNickNames,homeFID);
      var roadIcon    = getHabTeamIcon(mondayReportDefaultIcon,mondayReportDefaultLogo,mondayReportIconURL,mondayReportIconExt,"mondayIcon",roadFID,useOldMondayIconMethod);  // Trailing false is old icon method
      var homeIcon    = getHabTeamIcon(mondayReportDefaultIcon,mondayReportDefaultLogo,mondayReportIconURL,mondayReportIconExt,"mondayIcon",homeFID,useOldMondayIconMethod);  // Trailing false is old icon method
      var roadLink    = "<a href='" + baseURLDynamic + "/" + year + "/options?L=" + league_id + "&F=" + roadFID + "&O=07' target='franchisepage' border='0' title='" + altRoadName + "' style='text-decoration: none;'>";
      var homeLink    = "<a href='" + baseURLDynamic + "/" + year + "/options?L=" + league_id + "&F=" + homeFID + "&O=07' target='franchisepage' border='0'  title='" + altHomeName + "' style='text-decoration: none;'>";
      var roadYTP     = getMondayNightYTP(mondayReportWeeklyResults[i]['road'][2]);
      var homeYTP     = getMondayNightYTP(mondayReportWeeklyResults[i]['home'][2]);
      if(rowCount%2) {
       htmlTable += "<tr class='oddtablerow'><td class='mondayTeam'> " + roadLink + roadIcon + roadName + "</a></td><td class='mondayScore'> " + roadScore.toFixed(mondayReportDecimals) + " </td><td>&nbsp; vs. </td><td class='mondayScore'> " + homeScore.toFixed(mondayReportDecimals) + "</td><td class='mondayTeam'> " + homeLink + homeIcon + homeName + "</a></td></tr>\n";
       htmlTable += "<tr class='oddtablerow'><td class='mondayYTP'>"   + roadYTP + "</a><td colspan='3'>&nbsp;</td><td class='mondayYTP'>" + homeYTP + "</td></tr>\n";
      } else {
       htmlTable += "<tr class='eventablerow'><td class='mondayTeam'> " + roadLink + roadIcon + roadName + "</a></td><td class='mondayScore'> " + roadScore.toFixed(mondayReportDecimals) + " </td><td>&nbsp; vs. </td><td class='mondayScore'> " + homeScore.toFixed(mondayReportDecimals) + "</td><td class='mondayTeam'> " + homeLink + homeIcon + homeName + "</a></td></tr>\n";
       htmlTable += "<tr class='eventablerow'><td class='mondayYTP'>"   + roadYTP + "</a><td colspan='3'>&nbsp;</td><td class='mondayYTP'>" + homeYTP + "</td></tr>\n";
      }
      rowCount++;
     } //END IF     
    }  //END IF
   }   //END LOOP
   if(htmlTable!="") htmlCode += "<th colspan='5' id='aintOverYet'>" + mondayReportTitle3 + "</th>\n" + htmlTable + "\n";
   
   htmlCode += "</tr></table>\n";
   document.getElementById("mondayReport").innerHTML = htmlCode;
}


function doMondayNightReport() {
  document.getElementById("mondayReportIframe").innerHTML = "<iframe src='" + habBaseURL + "/" + year + "/live_scoring_summary?L=" + league_id +  "&App=mon' style='width: 0; height: 0; border: 0px;'></iframe>";
  document.getElementById("mondayReportIframe").innerHTML = "";

  habXMLAttempt = 0;
  habXMLSuccess = false;
  while (!habXMLSuccess&&habXMLAttempt<2) { // Two attempts at grabbing XML data
   mondayReportWeeklyResults = makeSyncHttpRequest(habBaseURL+"/"+year+"/export?TYPE=weeklyResults&L="+league_id+"&W="+liveScoringWeek+"&rand=" + Math.random(), 'parseHabWeeklyResultsXML','weeklyResults',true);
  }

  habXMLAttempt = 0;
  habXMLSuccess = false;
  while (!habXMLSuccess&&habXMLAttempt<2) { // Two attempts at grabbing XML data
   mondayReportLiveScoring   = makeSyncHttpRequest(habBaseURL+"/"+year+"/export?TYPE=liveScoring&L="+league_id+"&W="+liveScoringWeek+"&rand=" + Math.random(), 'parseHabLiveScoringXML','liveScoring',true);
  }

  makeSyncHttpRequest(habBaseURL+"/"+year+"/export?TYPE=nflSchedule&W="+liveScoringWeek+"&rand=" + Math.random(), 'parseHabNFLScheduleXML','nflSchedule',false);
  doMondayReportTables();

}


function doMondayCheck() { 
  var rightNow = new Date(currentServerTime*1000);
  var today = rightNow.getDay();
  if(today==1) return true; else return false;
}

var isMonday = doMondayCheck();

if(isMonday||mondayReportAlwaysOn) {
 if(!mondayReportClickToStart) {
  document.write("<div id='mondayReport'></div>");
  document.write("<div id='mondayReportIframe'></div>");
  setTimeout("doMondayNightReport()",500); 
 } else {
  document.write("<div id='mondayReport'><center><a href='#1' onclick='doMondayNightReport();' id='mondayNightClick'><span class='habClickToStart'>Click to Display Monday Night Report</span></a><br /><br /></center></div>");
  document.write("<div id='mondayReportIframe'></div>");
 }
}

All the scripts I post were created by Habman , with some small contributions from myself. The man has done an outstanding job giving the community a variety of options to enhance the site. Thank you sir !!


#3 Brute Squad

Brute Squad

    Veteran

  • Members
  • PipPipPip
  • 1,831 posts
  • Gender:Male

Posted 21 September 2021 - 03:24 PM

Thank you!


www.jorgalink.com

#4 habman

habman

    Veteran

  • Members
  • PipPipPip
  • 2,904 posts
  • Gender:Male
  • Location:Leamington ON, Canada

  • 2021 MFL: 55681
  • , 18835

Posted 23 September 2021 - 12:45 PM

I am in the process of bringing this back to life.  I will need at east until Monday to fully test it out though.



#5 Brute Squad

Brute Squad

    Veteran

  • Members
  • PipPipPip
  • 1,831 posts
  • Gender:Male

Posted 23 September 2021 - 04:46 PM

That would be great.  :D  Thanks, Habman! 


www.jorgalink.com

#6 habman

habman

    Veteran

  • Members
  • PipPipPip
  • 2,904 posts
  • Gender:Male
  • Location:Leamington ON, Canada

  • 2021 MFL: 55681
  • , 18835

Posted 27 September 2021 - 07:00 AM

Hi Brute,

 

I have a script working on my site.

 

Check it out (top left in home tab) https://www68.myfant...21/home/29385#0

 

Let me know of any changes you would like to see before I share the code.



#7 Moon

Moon

    Veteran

  • Members
  • PipPipPip
  • 112 posts
  • Gender:Male
  • Location:CT

  • 2021 MFL: 46365

Posted 27 September 2021 - 02:12 PM

Nice - like how the games are organized by likely/possible outcomes. Definite add when you post the code.



#8 theeohiostate

theeohiostate

    Veteran

  • Members
  • PipPipPip
  • 4,314 posts
  • Gender:Male
  • Location:O-H-I-O

Posted 27 September 2021 - 03:09 PM

also coming soon...... , we created a new All My Leagues module to show all your MFL leagues at a snapshot

 

https://www63.myfant...&O=247&SEQNO=17

 

you have to have more than 1 MFL League to view the report , otherwise for owners only in 1 league its not visible as its not needed


All the scripts I post were created by Habman , with some small contributions from myself. The man has done an outstanding job giving the community a variety of options to enhance the site. Thank you sir !!


#9 Brute Squad

Brute Squad

    Veteran

  • Members
  • PipPipPip
  • 1,831 posts
  • Gender:Male

Posted 28 September 2021 - 11:23 AM

Hi Brute,

 

I have a script working on my site.

 

Check it out (top left in home tab) https://www68.myfant...21/home/29385#0

 

Let me know of any changes you would like to see before I share the code.

 

Looks great...don't see anything I'd change.  Really appreciate all your efforts!


www.jorgalink.com



Reply to this topic



  


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users