Page 1 of 1

How to change the colors of the Winning and Losing picks on

Posted: Tue Sep 10, 2013 9:12 am
by philwojo
I had done this last year, and I forgot about it until today. I have changed the code in the /includes/common.asp file to make it so that a Correct pick and an Incorrect Pick now are different colors than an unplayed game.

So by default all the program did was to make a correct pick "BOLD" but still black. An incorrect pick had a line put through it, and those were good, but I wanted to have more. So now I make my correct picks turn "lime green" and my incorrect picks still have a line put through them, but they also turn "red". Any unplayed games still show in the black. So it is really easy to see results on the page.

To accomplish this open your /includes/common.asp file and then:

Find for an "Incorrect Pick":

Code: Select all

	'--------------------------------------------------------------------------
	' Formats a string to indicate an incorrect pick.
	'--------------------------------------------------------------------------
	function FormatIncorrectPick(str)

		FormatIncorrectPick = "<span style=""text-decoration: line-through;"">" & str & "</span>"

	end function
Change it to look like this:

Code: Select all

	'--------------------------------------------------------------------------
	' Formats a string to indicate an incorrect pick.
	'--------------------------------------------------------------------------
	function FormatIncorrectPick(str)

		FormatIncorrectPick = "<span style=""text-decoration: line-through; color:red"">" & str & "</span>"

	end function
Now Find for a Winning Pick:

Code: Select all

	' Formats a string to indicate the game winner.
	'--------------------------------------------------------------------------
	function FormatWinner(str)

		if USE_POINT_SPREADS then
			FormatWinner = "<em>" & str & "</em>"
		else
			FormatWinner = "<strong>" & str & "</strong>"
		end if

	end function
And change it to look like this:

Code: Select all

	'--------------------------------------------------------------------------
	' Formats a string to indicate the game winner.
	'--------------------------------------------------------------------------
	function FormatWinner(str)

		if USE_POINT_SPREADS then
			FormatWinner = "<em>" & str & "</em>"
		else
			FormatWinner = "<span style=""color:limegreen; Font-weight:bold;"">" & str & "</span>"
		end if

	end function
Where you see the "color:xxxxxxx" parameter, feel free to change to to any colors you like, but here is how mine looks as of now, or at least a snippet of it so you can see a preview.

Image

Hope this helps.

Phil

Re: How to change the colors of the Winning and Losing picks

Posted: Mon Sep 08, 2014 9:34 am
by philwojo
Thought I would bump this to the top for 2014 as it kind of got buried. A simple change, but I think it really adds to the results page personally.

Phil

Re: How to change the colors of the Winning and Losing picks

Posted: Tue Sep 09, 2014 8:20 pm
by lurkmaster1
nice tweak. just added it to mine.

Re: How to change the colors of the Winning and Losing picks

Posted: Sat Sep 13, 2014 5:38 pm
by e93octane
Very Nice.. it seems to carry over to the weekly schedule.. the winner is in green but the loser is not in red or the strike through.. is there a way to get it there also...

Re: How to change the colors of the Winning and Losing picks

Posted: Sat Sep 13, 2014 11:47 pm
by philwojo
I will have to look at the code more that wasn't my intention so it might take some digging. Probably won't get to it until Monday though.

Phil

Re: How to change the colors of the Winning and Losing picks

Posted: Sat Sep 13, 2014 11:50 pm
by e93octane
Great... thanks for taking a look at it.

Re: How to change the colors of the Winning and Losing picks

Posted: Mon Sep 15, 2014 11:28 am
by philwojo
Ok, here is what you need to edit in the "weeklySchedule.asp" file:
Open your weeklySchedule.asp file in an editor and find the following:

Find this:

Code: Select all

			'Highlight the results.
			if result = vid then
				visitor = FormatWinner(visitor)
				vscore  = FormatWinner(vscore)		
			elseif result = rs.Fields("HomeID").Value then
				home   = FormatWinner(home)
				hscore = FormatWinner(hscore)
			end if
Replace it with this:

Code: Select all

			'Highlight the results.
			if result = vid then
				visitor = FormatWinner(visitor)
				vscore  = FormatWinner(vscore)
				home   = FormatIncorrectPick(home)
				hscore = (hscore)
				
			elseif result = rs.Fields("HomeID").Value then
				home   = FormatWinner(home)
				hscore = FormatWinner(hscore)
				visitor = FormatIncorrectPick(visitor)
				vscore  = (vscore)
			end if
That will do the weekly schedule, but you can also do the Weeklyentry.asp file as well. Not sure if you want this, but I noticed it was doing it there as well, so here is how to do that also.

Open your weeklyEntry.asp file:

Find this:

Code: Select all

'Highlight fields based on the game result.
			if games(i).result = games(i).visitorID then
				visitor = FormatWinner(visitor)
			elseif games(i).result = games(i).homeID then
				home = FormatWinner(home)
			elseif games(i).result = TIE_STR then
				tie = FormatWinner(TIE_STR)
			end if
Replace it with this:

Code: Select all

'Highlight fields based on the game result.
			if games(i).result = games(i).visitorID then
				visitor = FormatWinner(visitor)
				home = FormatIncorrectPick(home)
			elseif games(i).result = games(i).homeID then
				home = FormatWinner(home)
				visitor = FormatIncorrectPick(visitor)
			elseif games(i).result = TIE_STR then
				tie = FormatWinner(TIE_STR)
			end if
Hope that is what you were looking for.

Phil

Re: How to change the colors of the Winning and Losing picks on

Posted: Mon Sep 15, 2014 8:09 pm
by e93octane
Got it... its working like a charm on both the weekly schedule and weekly entry !! Thanks for your help :)

Re: How to change the colors of the Winning and Losing picks on

Posted: Sat Sep 20, 2014 8:17 pm
by sledge4
I'm late to the party here, but I did all the updates noted in common.asp, yet I don't see these taking effect on the weeklyResults.asp page. Are there a different set of instructions for that page?

Re: How to change the colors of the Winning and Losing picks on

Posted: Sat Sep 20, 2014 10:53 pm
by philwojo
Yes see 2 posts above your last one there are separate edits to make that work.

Phil

Re: How to change the colors of the Winning and Losing picks on

Posted: Thu Jul 09, 2015 10:21 am
by giz83
Great edit. This really adds to the results pages. Thanks.

Re: How to change the colors of the Winning and Losing picks on

Posted: Thu Jul 09, 2015 11:31 am
by philwojo
Glad you like it, I know my users have enjoyed that change, just makes things easier to look at with a quick glance.

Phil

Re: How to change the colors of the Winning and Losing picks on

Posted: Wed Aug 17, 2022 7:47 am
by P2W
Very nice. Thank you :D ซื้อบัตร Razer

Re: How to change the colors of the Winning and Losing picks on

Posted: Wed Aug 17, 2022 9:11 am
by messi999
Very informative. Thank you.


Re: How to change the colors of the Winning and Losing picks on

Posted: Thu Feb 23, 2023 8:00 am
by P2W
Very informative. Thank you. ซื้อบัตร Razer