Archive for glbscripts.myfreeforum.org Forum dedicated to Greasemonkey Scripts made for Goal Line Blitz online game.
 



       glbscripts.myfreeforum.org Forum Index -> Original Scripts
Zaqf

Friends script using cookies

I've taken the original friends list script by Branden Guess and heavily modified it to use cookies to store your friend list.  I've also added a "Send PM" link and estimated online/inactive/offline status.



To estimate the online status it uses the agent's last activity time and compares it to the current server time.

The default settings for the statuses are:
Online: activity within 5 minutes
Inactive: 5-20 minutes
Offline: 20+ minutes.

The "status" is not 100% accurate, since I could be active then immediately log off, and it wouldn't show me as "Offline" for 20 minutes, but it will be fairly close.

You'll need to install the follow scripts:

Home page (Script to display the friends):
http://userscripts.org/scripts/show/32650

Agent page (Script to add to friends list, works from agent's profile page):
http://userscripts.org/scripts/show/32649

Notes:
- Mouse over the status will give the last activity time.
- These friends are stored in cookies, so clearing your cookies = erasing your friends list
- Since the above is true there is a "copy/backup" link.  Click it, highlight and copy the text, and save it in a text file or wherever.  You can then click the "paste/restore" link and paste the text back into it if you ever need to restore it. (I know this is kinda lame, but it works until someone comes up with something better!)


Thanks to mw54finest for the idea of basing the status off of last activity, and to Karma99 for the current server time function in your script!  Also thanks to mw54finest, MonsterofMidway, and xtbone1006 for testing and for making suggestions.
a49erfan77

Awesome script, thanks!

Is it possible to move it to the top of your homepage though?
Zaqf

Moving list to the top

Like this?

DeviantWolf

Yeah how can we move it up to the top of the page like you did there?  I like having my friends at the top so I can see quickly and easily who's on without having to scroll
Zaqf

To move this to the top, go to greasemonkey:manage user scripts
Click on "GLB Agent Friends List Cookie" in the left pane and click the "Edit" button in the lower left corner.

Find:

Quote:
htmlFriends += '<br/><br/><div class="medium_head">' + 'My Friends</div>' + '<table><tr>';


And replace it with:

Quote:
htmlFriends += '<div class="medium_head">' + 'My Friends</div>' + '<table><tr>';



Find:

Quote:
container.innerHTML +=  htmlFriends + '</tr></table>' + managecookie;

and Replace it with:

Quote:
var FriendContainer = document.createElement('div');
FriendContainer.id='FriendContainer';
FriendContainer.className = 'FriendContainer';
FriendContainer.innerHTML = (htmlFriends + '</tr></table>' + managecookie + '<br/><br/>');
container.insertBefore(FriendContainer, document.getElementById('teams'));


Save the file and refresh the page.  If you run into problems or don't feel comfortable changing code, I can always post a pre-modified version of the script.  Just let me know.
DeviantWolf

It worked, thanks!
rcillig

awesome thanks alot, great work.
a49erfan77

Thanks!
reficuul

is it possible to make the boxes wrap around instead of extending off the page to the right?

edit: and make the boxes a bit smaller?


sorry i suck at coding unless you tell me what to do  =)
Zaqf

To make the avatars and fonts smaller and make the boxes wrap

Replace this code:
Code:

for(i=0;i<friends.length;i++) {
   htmlFriends += '<td style="text-align: center;"><a href="' +
            friendlink + friends[i] + '" style="text-decoration:none"><img src="' + avatar + friends[i] + '" border="0" width="75" height="75">' + '<br/>' + friends[i+1] + '</a><br/><a href="' + msglink + friends[i] + '">Send PM</a><br/><span style="color:#A8A8A8;font-size:11px;" id="' + friends[i] + '"></span></td>';
            i++
}


With this code:
Code:
for(i=0;i<friends.length;i++) {

   htmlFriends += '<td style="text-align: center;float:left;"><a href="' +
            friendlink + friends[i] + '" style="font-size:9px;text-decoration:none"><img src="' + avatar + friends[i] + '" border="0" width="60" height="60">' + '<br/>' + friends[i+1] + '</a><br/><a style="font-size:9px;" href="' + msglink + friends[i] + '">Send PM</a><br/><span style="color:#A8A8A8;font-size:9px;" id="' + friends[i] + '"></span></td>';
            i++

}


It will wrap the pictures based on the width of the GLB site, and not your screen resolution, so you still would have to scroll if you are set at 800x600 or lower.  I get 15 friends to a line with it set this way.  If the pictures are still too large for your liking you can manually change their size.  You see in the code above where it says width="60" height="60"?  Just lower those numbers until the box is small enough.

For anyone who just wants them to wrap, but doesn't want to change the size, all you need to do is change the:

Code:
htmlFriends += '<td style="text-align: center;">


to:

Code:
htmlFriends += '<td style="text-align: center;float:left;">
reficuul

aweosme, works perfect thanks a lot man!
auron341

How do you add friends?
Zaqf

Go to any agents page and there will be a link that says "add to friends"

Just click that link and they'll be added.
auron341

Well I have both scripts and this is what comes up on the other agents page.

http://i86.photobucket.com/albums/k97/auron341/show-2.jpg
rcillig

Ive got 13 friends total but for 2 of them I never get a online of offline under their name like i do for the rest of my friends, any idea why that is and how I can correct it?

Ive added them and removed them several times to see if I can correct the issue.
Zaqf

Can you PM me their names so I can test it out?
deez11010

I'm having problems with this. I click on my friends home page where it says "add to friends" and it does its thing. I go to my home page and this is what I see.




I have FF3, is that the problem?
Zaqf

FF3 is not a problem.  It looks like the player id and player names got shifted into the wrong variable.  I sent you a PM =)
deez11010

w00t!

tyvm for helping me fix it. I'm sure I did something to mess it up. Love the script.

Thanks
BoneZ69

online status

i am not seeing the online status like i was at first i refresh my page and that didn't work so i deleted my cookies and readded them but that still didn't work what do i do here is what it looks like


Kirghiz

Zaqf wrote:
To move this to the top, go to greasemonkey:manage user scripts
Click on "GLB Agent Friends List Cookie" in the left pane and click the "Edit" button in the lower left corner.

Find:

Quote:
htmlFriends += '<br/><br/><div class="medium_head">' + 'My Friends</div>' + '<table><tr>';


And replace it with:

Quote:
htmlFriends += '<div class="medium_head">' + 'My Friends</div>' + '<table><tr>';



Find:

Quote:
container.innerHTML +=  htmlFriends + '</tr></table>' + managecookie;

and Replace it with:

Quote:
var FriendContainer = document.createElement('div');
FriendContainer.id='FriendContainer';
FriendContainer.className = 'FriendContainer';
FriendContainer.innerHTML = (htmlFriends + '</tr></table>' + managecookie + '<br/><br/>');
container.insertBefore(FriendContainer, document.getElementById('teams'));


Save the file and refresh the page.  If you run into problems or don't feel comfortable changing code, I can always post a pre-modified version of the script.  Just let me know.


It won't let me edit it. It keeps popping a My Documents window up when I click on Edit.
reficuul

bump, can we get this to work again.  I like it a lot more than borts version!!
Zaqf

When he added that section it screwed it up if you have the friends list in the middle rather than at the bottom of the page.  I'll take a look and see what's going on.

Quick Fix to get it to show back up in the middle section:

Replace

Code:
container.insertBefore(FriendContainer,document.getElementById('teams'));


with

Code:

container.insertBefore(FriendContainer,document.getElementById('players_teams'));


If the main reason you dislike Bort's is having to click on the friends button to see them, which in turn hides your team, it would probably be pretty easy to fix that instead.
reficuul

ya thats basically why i dont like borts....

I dont want to click back and forth...its just dumb!!  =p

       glbscripts.myfreeforum.org Forum Index -> Original Scripts
Page 1 of 1
Create your own free forum | Buy a domain to use with your forum