...

View Full Version : Right Click Menu - Admin Staff - not disable



Stealth
06-17-2004, 01:13 PM
Hi,

I have a lot of administration functions that need to be used on a regular basis by my administrators. What I would like to do to make the site a little more interesting and easier to use is to make hot spots on the interface that my administrators can right click on *not text fields, images or stuff like that* and can alter the properties of, such as the following situation:

Right click on a user in the user list and bring up a circular scrolling window to the right of the mouse cursor with all the user's details and settings and options to email, update stuff etc. The functions I could call using php/mysql and display with dhtml or something. It's the actual opening of a real dynamic right click menu that I am looking to achieve not disabling it or making a css styled box menu with hyperlinks - but a dynamic right click menu for certain hot spots with lots of functions that otherwise take ages precious moments to scroll through and use.

Any ideas on this?

Willing to put a few pennies towards someone's time on it if necessary, because it's something I've not seen before and can't seem to make myself.

Many thanks ^_^ and lovely forum guys. :D

Stealth

Spudhead
06-17-2004, 01:49 PM
I've got this knocking about - I think another coder here posted it originally - if you just right-click you get the usual context menu but if you hold down the right mouse button, move your mouse down a couple of inches and then release, you get a "hidden" menu. You could probably adapt it to work with hotspots or whatever.

Just copy 'n paste into the <head>, or save to a .js and call the file.



document.write("<style>");document.write(".expanded {position:absolute;padding:1px;font:Arial, Helvetica, sans-serif;font-size:11px;text-align:left;background-color:#D4D0C8;width:150px;border-left :2px solid #FFFFFF;border-top :2px solid #FFFFFF;border-right :2px solid #999999;border-bottom : 2px solid #999999;}");
document.write("a.expanda {padding-left:15px;padding-right:15px;display:block;text-decoration:none;color:#000000;}");
document.write("a.expanda:hover {background-color:#003366;color:#FFFFFF;}");
document.write("</style>");
document.write("<div style=\"display:none\" class=\"expanded\" id=\"altnav\">");
document.write("<a href=\"http://www.news.com\" class=\"expanda\" id=\"navlink\"><div style='float:right;width:20px;text-align:left'>Ctrl+?</div>Option 1</a>");
document.write("<a href=\"http://www.cnn.com\" class=\"expanda\" id=\"navlink\"><div style='float:right;width:20px;text-align:left'>Ctrl+?</div>Option 2</a>");
document.write("</div>");
document.oncontextmenu = null;
document.onmousedown = doDown;
document.onmouseup = doUp;
var timerID = "null";
var ly;
var ny;
var targ;
function doDown(e)
{
clearTimeout(timerID);
document.oncontextmenu = null;
var rightclick;
if (!e) e = window.event
if (e.which) rightclick = (e.which == 3);
else if (e.button) rightclick = (e.button == 2);
try
{
if (e.target) targ = e.target.getAttribute('id');
else if (e.srcElement) targ = e.srcElement.getAttribute('id');
if (targ != "navlink") {document.getElementById('altnav').style.display = 'none';}
}
catch(e)
{
document.getElementById('altnav').style.display = 'none';
}
if (rightclick != false)
{
ly = e.clientY;
}
return false;
}

function doUp(e)
{
var rightclick;
if (!e) e = window.event
if (e.which) rightclick = (e.which == 3);
else if (e.button) rightclick = (e.button == 2);
if (rightclick != false)
{
if (!e) var e = window.event;
ny=e.clientY;
lytemp = ly+50;
if (ny>lytemp)
{
document.getElementById('altnav').style.display = "block";
document.getElementById('altnav').style.left = e.clientX + 2;
document.getElementById('altnav').style.top = ly+2;
window.status = "down menu";
document.oncontextmenu = fakecontext;
timerID = setTimeout("document.getElementById('altnav').style.display = 'none';", 5000);
}
}
ly = null;
ny = null;
}
function fakecontext(){return false;};

Stealth
06-17-2004, 02:47 PM
That's brilliant :)

The only question I've got now is - how do you make it with internal navigation and set a non-box shape?

*thanks you for a quick reply with info :D*

Thankyou ^_^

Stealth :thumbsup:



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum