Welcome Guest ( Log In | Register )

12 Pages V   1 2 3 > »   
Reply to this topicStart new topic
> Ticker code new and improved, written completely in javascript
habman
post Aug 23 2007, 10:06 AM
Post #1


Veteran
***

Group: Members
Posts: 1948
Joined: 29-August 05
From: Leamington ON, Canada
Member No.: 3058

2009 MFL: 31589 , 24836


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
CODE
<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/
Go to the top of the page
 
+Quote Post
mmartin68
post Aug 23 2007, 11:00 AM
Post #2


Veteran
***

Group: Members
Posts: 50
Joined: 28-May 07
Member No.: 5183



I copied and pasted it , and it comes out blank. Was there a spot to put in league #? Did I miss it?
Go to the top of the page
 
+Quote Post
habman
post Aug 23 2007, 11:05 AM
Post #3


Veteran
***

Group: Members
Posts: 1948
Joined: 29-August 05
From: Leamington ON, Canada
Member No.: 3058

2009 MFL: 31589 , 24836


QUOTE (mmartin68 @ Aug 23 2007, 01:00 PM) *
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/
Go to the top of the page
 
+Quote Post
MurdahMan
post Aug 23 2007, 11:18 AM
Post #4


Member
**

Group: Members
Posts: 12
Joined: 30-August 06
From: United States
Member No.: 4708

2009 MFL: 53020


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?


--------------------
[list][*]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.[/list]
Go to the top of the page
 
+Quote Post
habman
post Aug 23 2007, 11:27 AM
Post #5


Veteran
***

Group: Members
Posts: 1948
Joined: 29-August 05
From: Leamington ON, Canada
Member No.: 3058

2009 MFL: 31589 , 24836


QUOTE (MurdahMan @ Aug 23 2007, 01:18 PM) *
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/
Go to the top of the page
 
+Quote Post
mmartin68
post Aug 23 2007, 11:38 AM
Post #6


Veteran
***

Group: Members
Posts: 50
Joined: 28-May 07
Member No.: 5183



It is now working but it says "4th error" at the bottom
Go to the top of the page
 
+Quote Post
habman
post Aug 23 2007, 12:06 PM
Post #7


Veteran
***

Group: Members
Posts: 1948
Joined: 29-August 05
From: Leamington ON, Canada
Member No.: 3058

2009 MFL: 31589 , 24836


QUOTE (mmartin68 @ Aug 23 2007, 01:38 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:

CODE
<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/
Go to the top of the page
 
+Quote Post
bonscott
post Aug 23 2007, 12:07 PM
Post #8


Veteran
***

Group: Members
Posts: 4718
Joined: 22-February 04
Member No.: 31

2009 MFL: 33218


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


--------------------
Scott

All Rosters code: http://sidelineleagues.com/forums/index.php?showtopic=18864
Custom CSS upload: http://sidelineleagues.com/forums/index.php?showtopic=15112

Do *NOT* look at the boxscores on nfl.com They are known to be unreliable and rarely updated. You should be looking at the GameBook for the game for the most "official" stats that are available to the public.

Also as noted live scoring on MFL is not official and often defensive stats are delayed. Once the final stats are out early Tuesday after the Monday night game then see what happens.
Go to the top of the page
 
+Quote Post
habman
post Aug 23 2007, 12:10 PM
Post #9


Veteran
***

Group: Members
Posts: 1948
Joined: 29-August 05
From: Leamington ON, Canada
Member No.: 3058

2009 MFL: 31589 , 24836


QUOTE (bonscott @ Aug 23 2007, 02:07 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/
Go to the top of the page
 
+Quote Post
mmartin68
post Aug 23 2007, 12:28 PM
Post #10


Veteran
***

Group: Members
Posts: 50
Joined: 28-May 07
Member No.: 5183



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


QUOTE (habman @ Aug 23 2007, 02:06 PM) *
QUOTE (mmartin68 @ Aug 23 2007, 01:38 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:

CODE
<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.
Go to the top of the page
 
+Quote Post
habman
post Aug 23 2007, 12:37 PM
Post #11


Veteran
***

Group: Members
Posts: 1948
Joined: 29-August 05
From: Leamington ON, Canada
Member No.: 3058

2009 MFL: 31589 , 24836


QUOTE (mmartin68 @ Aug 23 2007, 02:28 PM) *
Do I replace all the code with it or add it to the code.


QUOTE (habman @ Aug 23 2007, 02:06 PM) *

QUOTE (mmartin68 @ Aug 23 2007, 01:38 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:

CODE
<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/
Go to the top of the page
 
+Quote Post
mmartin68
post Aug 23 2007, 12:39 PM
Post #12


Veteran
***

Group: Members
Posts: 50
Joined: 28-May 07
Member No.: 5183



All right replaced it. it is in message 10
Go to the top of the page
 
+Quote Post
bonscott
post Aug 23 2007, 12:41 PM
Post #13


Veteran
***

Group: Members
Posts: 4718
Joined: 22-February 04
Member No.: 31

2009 MFL: 33218


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. wink.gif


--------------------
Scott

All Rosters code: http://sidelineleagues.com/forums/index.php?showtopic=18864
Custom CSS upload: http://sidelineleagues.com/forums/index.php?showtopic=15112

Do *NOT* look at the boxscores on nfl.com They are known to be unreliable and rarely updated. You should be looking at the GameBook for the game for the most "official" stats that are available to the public.

Also as noted live scoring on MFL is not official and often defensive stats are delayed. Once the final stats are out early Tuesday after the Monday night game then see what happens.
Go to the top of the page
 
+Quote Post
onei0087
post Aug 23 2007, 01:32 PM
Post #14


Veteran
***

Group: Members
Posts: 823
Joined: 19-August 04
From: Seattle, WA
Member No.: 1127



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

I added it to my footer in league http://football8.myfantasyleague.com/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:
CODE
<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.
Go to the top of the page
 
+Quote Post
fantavet
post Aug 23 2007, 02:17 PM
Post #15


Veteran
***

Group: Members
Posts: 1006
Joined: 22-February 04
Member No.: 23

2009 MFL: 38174
2010 MFL: 36492


QUOTE (bonscott @ Aug 23 2007, 02:07 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.
Go to the top of the page
 
+Quote Post

12 Pages V   1 2 3 > » 
Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



Lo-Fi Version Time is now: 3rd September 2010 - 11:37 PM