MyspaceMozilla





MyspaceMozilla 0.9 Beta - Coding MySpaceMozilla

How to dynamically alter your right click menu

I have created a function that you can use that will allow you to alter one of the 4 'slots' on the right-click menu whenever you are on a MySpace page.

Currently these 4 slots are:

IDLabel NameFunction
rightclick-item1View Source - MySpace profileCopyLinkSource()
rightclick-item2Send Mail to this profileprofilesendmail()
rightclick-item3Add this profile as a friendprofileaddfriend()
rightclick-item4Block this profileprofileblock()

The ID refers to the unique ID name these 4 slots have. They cannot change.

The Label Name refers to what is displayed to the user when they hit right click on their mouse button. This is literally just text, so you can change it to whatever you want.

The Function refers to the function that gets executed when you select that option. The function can either be an inbuilt function (as the list above is) or one you have created on your own.

To change any of these 'slots' with one of your own, you need to use the following function.

MSM_rightclickoptions(id,label name,function)

This function call will be in your msmscript.js file which is located in your myspacemozilla folder on your C Drive.

The function call itself will be placed inside the MSM_initial function.

A very simple example

To give you a real example of how you would actually use this, lets say you wanted to change the last item 'Block this profile' so that it became 'Send Mail to this profile' (this would result in two lots of the same thing on the right click menu because both slots 2 and 4 would now be the same thing, but stay with me here this is just an example, I will give you more practical examples as we go down).

So to do this we would open up msmscript.js file, and inside the MSM_initial function we would write the following:

MSM_rightclickoptions('rightclick-item4','Send Mail to this Profile','profilesendmail()');

This is telling the MSM_rightclickoptions function that we want to change Slot 4. That we want to change what is displayed to the user to read 'Send Mail to this Profile' and that when the user selects this option, to have it execute the profilesendmail function (an inbuilt function within MSM).

Now save the msmscript.js file, and restart your Firefox browser. Now go into myspace and right click, you should notice that you no longer have the Block this profile option, BUT you should instead have in its place an option to 'Send Mail to this profile'.

A practical example from scratch

In this example we will change the first slot 'View Source - MySpace Profile' and replace it with a function we are going to create that will take us straight to our favourite MySpace Group - MySpaceMozilla! :)

So first things first, open up msmscript.js and at the bottom of the file lets create a custom function that we will call.

function goHere(){
content.document.location.href = "http://groups.myspace.com/index.cfm?fuseaction=groups.groupProfile&groupid=105124202";
}


Pretty simple huh, this is simply telling the browser to go the address we have just specified.

Now lets make a call for that function by placing this text within the MSM_initial function:

MSM_rightclickoptions('rightclick-item1','Take me to the MySpaceMozilla group','goHere()');

As you can see we are telling the MSM_rightclickoptions function that we want to change Slot 1. We want it to say 'Take me to the MySpaceMozilla group' and when people click on it we want it to execute the goHere() function which we have already created.

Now save the file. Restart your Firefox browser. Go to MySpace and right click on your mouse button. You should see it there. Click on the option and it should take you to the MySpaceMozilla Group.

If you want to use some other inbuilt functions (in particular those you see in 'MySpaceMozilla Options') please click here for a list of the more popular ones, so that you can incorporate them onto your right click menu bar if you wish.







If you require any more help please contact me on Myspace at www.myspace.com/myspacemozilla

Cheers,

Dave





Midi