www.webdeveloper.com
Results 1 to 2 of 2

Thread: Yahoo Fantasy Baseball script help needed...

  1. #1
    Join Date
    Apr 2010
    Posts
    2

    Yahoo Fantasy Baseball script help needed...

    I use Firefox with Greasemonkey and a javascript that "keeps sorting in Y Fantasy Full games"... It stopped working this year and the site that I got it at (http://userscripts.org) has been down recently... I do not know javascript, so I have no idea where to begin...

    Any one have any idea what this isn't keeping the selected sort when one changes player types?

    Code:
    // ==UserScript==
    // @name		   Keep sorting in Y Fantasy Full Games
    // @namespace	  *
    // @description	On the My Team Page, keeps the selected view when changing days, other stats.  On the Player Search page, keeps the sort when changing player types.
    // @include		http://*.fantasysports.yahoo.com/*/*
    // ==/UserScript==
    
    (function() {
    	// my team age -- when changing dates, keep view
    	loc_search=document.location.search;
    	if(document.getElementById('datenav')){
    		datenav=document.getElementById('datenav');
    		links=datenav.getElementsByTagName('a');
    
    		loc_search=document.location.search;
    		loc_search=loc_search.replace(/date=[\-0-9]*/,"");
    		loc_search=loc_search.replace(/\?/,"");
    		for (var i in links){
    			if(links[i].href){href=links[i].href;
    			href=href.replace(/$/,loc_search);
    			links[i].href=href;
    		}}
    	}
    
    	loc_search=document.location.search;
    	loc_search=loc_search.replace(/(status=\w*|pos=\w*|stat1=\w*|count=[0-9]*)/g,"");
    	loc_search=loc_search.replace(/&&+/g,"&");
    	loc_search=loc_search.replace(/(^\?&|&$)/g,"");
    	
    	// Player search page.  When changing stat filters, keep sort
    	if(document.getElementById('statusselect')){
    		sel=document.getElementById('statusselect');
    		data=loc_search.split('&');
    		for (var i in data){
    			parts=data[i].split('=');
    			ele=document.createElement( 'input' );
    			ele.type='hidden';
    			ele.name=parts[0];
    			ele.value=parts[1];
    			sel.parentNode.insertBefore(ele,sel);	
    		}
    	}
    	
    	// back to my team page.  if changing  in subnav (ie, ave stats to stats, keep timeframe)
    	if(document.getElementById('statnav')){
    		nav=document.getElementById('statnav');
    		links=nav.getElementsByTagName('a');
    
    //		GM_log(links.length);
    		for (i in links){
    
    			if(links[i].href){href=links[i].href;
    			if(! href.match(/stat2/) && ! href.match(/stat1=R/)){
    				//GM_log(href + links[i]);
    				if(href.match(/stat1=A/)){loc_search=loc_search.replace(/stat2=L/,"stat2=AL")}
    				if(href.match(/stat1=A/)){loc_search=loc_search.replace(/stat2=S/,"stat2=AS")}
    				if(href.match(/stat1=S/)){loc_search=loc_search.replace(/stat2=AL/,"stat2=L")}
    				if(href.match(/stat1=S/)){loc_search=loc_search.replace(/stat2=AS/,"stat2=S")}				
    				links[i].href=links[i].href+"&"+loc_search;
    			}}
    		}
    	}
    
    })()

  2. #2
    Join Date
    Apr 2010
    Posts
    2
    Bump...

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles