Jump to content


Photo

Ticker code new and improved


This topic has been archived. This means that you cannot reply to this topic.
185 replies to this topic

#1 habman

habman

    Veteran

  • Members
  • PipPipPip
  • 2,605 posts

Posted 23 August 2007 - 10:06 AM

I have reworked the ticker code entirely in javascript.

What are the benefits of this:
- No iframes
- Less bandwidth usage for my site
- Quicker loading and uses less of MFL's resources
- Easier to implement for the end user



The first few lines of the code have variables that you can change but are not required to.

A little further down is a CSS section where you can add some customization if you want.


Just copy and paste the code into a home page module



Here is the code for those interested:

Last Modified: August 28, 2008
<script language="JavaScript" type="text/javascript">
<!--

//FYI: Script update as of August 28, 2008

//Start ticker manually 
   var tickerClickToStart = false;

//If you wish to use icons from previous iframe ticker
   var useOldIconMethod = false; 

//Icon URL including base name and extension
   var tickerIconURL = ''; 
   var tickerIconExt = 'gif'; 

//Use current league icons  
   var iconTickerLeagueDefault = false; 

//Use current league logos
   var logoTickerLeagueDefault = false;

//Delay in seconds between displayed matchups
   var tickerDelay = 3; 

//Set the number of decimal places
   var tickerDecimals = 0;

//Display Live Scoring Caption above ticker
   var useLiveScoringCaption = true; 

//Hide ties when displaying (W-L-T) 
   var hideTiesInRecord = false; 

//Hide point spreads for upcoming games
   var hideTickerSpread = false; 

//Display ticker on home page only (useful if ticker is in the header)
   var tickerHomeOnly = true;

//Franchise Name or Nickname display
  var hideTickerName = false; 
  var useTickerNickNames = false; 

//Set up your Nick names here if you choose to use them
   var franchiseNickNames = new Object();  
   franchiseNickNames['0001'] = 'NICK 1';  
   franchiseNickNames['0002'] = 'NICK 2';  
   franchiseNickNames['0003'] = 'NICK 3';  
   franchiseNickNames['0004'] = 'NICK 4 ';
//		 .
//		 .
//		etc. 


//-->
</script>


<style type='text/css'>

.tickerinnertable {  
  width: 100%;  /* for fixed width use #px instead of % */
} 

.tickerheader {
}

a.tickerheader:link, a.tickerheader:visited, a.tickerheader:hover, a.tickerheader:active,
a.tickerteam:link,   a.tickerteam:visited,   a.tickerteam:hover,   a.tickerteam:active,
a.tickerscore:link,  a.tickerscore:visited,  a.tickerscore:hover,  a.tickerscore:active,
a.tickerclock:link,  a.tickerclock:visited,  a.tickerclock:hover,  a.tickerclock:active {
  text-decoration: none;
}

.tickerteam { 
  margin: 0px; 
  padding: 0px;
} 

.tickerscore { 
/* font-size: 24px; */
  font-weight: bold;
  margin: 0px; 
  padding: 0px;
} 

.tickerclock { 
  margin: 0px; 
  padding: 0px;
}

.tickericon {
  height:; /* Use #px for fixed width i.e. 100px */
  width:;  
}

.tickerspread {
/*  font-size: 8px; */
  color: red;
}

</style>

<script language="JavaScript" type="text/javascript" src="http://www.habman.com/mfl/apps/js/habman_common.js"></script>
<script language="JavaScript" type="text/javascript" src="http://www.habman.com/mfl/apps/js/ticker.js"></script>

Once the javascript has been fully tested I will post the entire code rather than have it linked from my site.



Here is a brief tutorial on how to implement the images.

There are three ways to do this:

Method #1

If you have icons already setup for your league then just set iconTickerLeagueDefault to true

OR

If you have logos already setup then just set logoTickerLeagueDefault to true

======================================

Method #2

If you have icons already made on a personal site from the old iframe ticker then set useOldIconMethod to true and update the iconURL and iconExt as you did for the iframe ticker.

======================================

Method #3

If you wish to create icons for this ticker from scratch then here is how you would do that.

First create your icons but note that they must be of the same file type. ie gif or bmp or jpg

Next choose a base name for your icons ie. icon or image or franchise

Now assuming you chose the base name "icon" name your icons in the following manner: icon0001, icon0002 etc. for franchise #1, franchise #2 etc.

Upload your icons to a personal site for example mine are located at www.habman.com/images/

Now in the script you would set iconURL = 'http://www.habman.com/images/icon';

Lastly in the script you would set the icon extension iconExt = 'gif'; if they are in the gif format.

That is all.


If you have any questions or issues just ask.
My MFL scripts . . . . . . . . http://www.habman.com/mfl/

#2 mmartin68

mmartin68

    Veteran

  • Members
  • PipPipPip
  • 52 posts

Posted 23 August 2007 - 11:00 AM

I copied and pasted it , and it comes out blank. Was there a spot to put in league #? Did I miss it?

#3 habman

habman

    Veteran

  • Members
  • PipPipPip
  • 2,605 posts

Posted 23 August 2007 - 11:05 AM

I copied and pasted it , and it comes out blank. Was there a spot to put in league #? Did I miss it?



Sorry. I should have mentioned this.


Turn off your advanced editor when pasting the code.


To do this goto to COMMISSIONER>SETUP>OTHER SETTINGS

find Use "Advanced Editor" on league type-in boxes? and set it to "no"
My MFL scripts . . . . . . . . http://www.habman.com/mfl/

#4 MurdahMan

MurdahMan

    Member

  • Members
  • PipPip
  • 12 posts

Posted 23 August 2007 - 11:18 AM

Just out of curiosity: Is it possible to put this on a site outside of myfantasyleague.com? If so, what step(s) would I need to take to do so?
  • Some people say winning isn't everything; I say those people never won anything.
  • Some people are like Slinky's, they are not really good for anything but they still bring a smile to your face when you push them down a flight of stairs.

#5 habman

habman

    Veteran

  • Members
  • PipPipPip
  • 2,605 posts

Posted 23 August 2007 - 11:27 AM

Just out of curiosity: Is it possible to put this on a site outside of myfantasyleague.com? If so, what step(s) would I need to take to do so?


No this script must reside within the MFL website otherwise you will get a permssion denied error.
My MFL scripts . . . . . . . . http://www.habman.com/mfl/

#6 mmartin68

mmartin68

    Veteran

  • Members
  • PipPipPip
  • 52 posts

Posted 23 August 2007 - 11:38 AM

It is now working but it says "4th error" at the bottom

#7 habman

habman

    Veteran

  • Members
  • PipPipPip
  • 2,605 posts

Posted 23 August 2007 - 12:06 PM

It is now working but it says "4th error" at the bottom


Thanks for the update.

If you don't mind can you replace your code with the following:

<script language="JavaScript" type="text/javascript" src="http://www.habman.com/mfl/apps/js/jsticker.js"></script>

This will allow me to more easily correct this error.

Thanks.
My MFL scripts . . . . . . . . http://www.habman.com/mfl/

#8 bonscott

bonscott

    Veteran

  • Members
  • PipPipPip
  • 7,647 posts

Posted 23 August 2007 - 12:07 PM

Is this your horizontal ticker or the "box score" type like I have on my site?


 


#9 habman

habman

    Veteran

  • Members
  • PipPipPip
  • 2,605 posts

Posted 23 August 2007 - 12:10 PM

Is this your horizontal ticker or the "box score" type like I have on my site?


Boxscore type like on your site.

Once I get all the bugs worked out of this one I'll do the horizontal one.
My MFL scripts . . . . . . . . http://www.habman.com/mfl/

#10 mmartin68

mmartin68

    Veteran

  • Members
  • PipPipPip
  • 52 posts

Posted 23 August 2007 - 12:28 PM

Do I replace all the code with it or add it to the code.



It is now working but it says "4th error" at the bottom


Thanks for the update.

If you don't mind can you replace your code with the following:

<script language="JavaScript" type="text/javascript" src="http://www.habman.com/mfl/apps/js/jsticker.js"></script>

This will allow me to more easily correct this error.

Thanks.



#11 habman

habman

    Veteran

  • Members
  • PipPipPip
  • 2,605 posts

Posted 23 August 2007 - 12:37 PM

Do I replace all the code with it or add it to the code.




It is now working but it says "4th error" at the bottom


Thanks for the update.

If you don't mind can you replace your code with the following:

<script language="JavaScript" type="text/javascript" src="http://www.habman.com/mfl/apps/js/jsticker.js"></script>

This will allow me to more easily correct this error.

Thanks.

Replace the entire code
My MFL scripts . . . . . . . . http://www.habman.com/mfl/

#12 mmartin68

mmartin68

    Veteran

  • Members
  • PipPipPip
  • 52 posts

Posted 23 August 2007 - 12:39 PM

All right replaced it. it is in message 10

#13 bonscott

bonscott

    Veteran

  • Members
  • PipPipPip
  • 7,647 posts

Posted 23 August 2007 - 12:41 PM

Ok, I've got it on my site and it works with no errors.

Two display things however.

In FireFox there is a small black "triangle" below and to the left of the ticker.
In IE6 (can't upgrade to 7 at work) there is no triangle and the bottom of the box is crammed to the table below it. Doesn't appear to be the same spacing of between tables as with others for some reason (unsure if it's your ticket but the old one did not do this).

Oh, you filled up my homepage messages again. :ph34r:


 


#14 onei0087

onei0087

    Veteran

  • Members
  • PipPipPip
  • 823 posts

Posted 23 August 2007 - 01:32 PM

This is crippling my browsers (IE6,7 and FF)

I added it to my footer in league http://football8.myf...2007/home/89575

It is giving me an error that the browser ran out of memory after becoming unresponsive.

I'm sure I messed it up, but dont know how.

*UPDATE: I pulled the module as I could not access the league at all* Send me a PM if you would like me to turn it back on.

*UPDATE* I replaced the code with:
<script language="JavaScript" type="text/javascript" src="http://www.habman.com/mfl/apps/js/jsticker.js"></script>
And am still having the same issue of running out of memory when saving the message.
Used to be useful.

#15 fantavet

fantavet

    Veteran

  • Members
  • PipPipPip
  • 1,036 posts

Posted 23 August 2007 - 02:17 PM

Is this your horizontal ticker or the "box score" type like I have on my site?


Did you notice that there are 12 home page modules now or is that old news? I just noticed it playing with habman's code.