standard - /* * * Copyright 2007 * * Paulius Uza *...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
/** * * Copyright 2007 * * Paulius Uza * http://www.uza.lt * * Dan Florio * http://www.polygeek.com * * Project website: * http://code.google.com/p/custom-context-menu/ * * -- * RightClick for Flash Player. * Version 0.6.2 * */ var RightClick = { /** * Constructor */ init: function () { this.FlashObjectID = "Captivate"; this.FlashContainerID = "CaptivateContent"; this.Cache = this.FlashObjectID; if(window.addEventListener){ window.addEventListener("mousedown", this.onGeckoMouse(), true); } else { document.getElementById(this.FlashContainerID).onmouseup = function() { document.getElementById(RightClick.FlashContainerID).releaseCapture(); } document.oncontextmenu = function() { if(window.event.srcElement.id == RightClick.FlashObjectID) { return false; } else { RightClick.Cache = "nan"; }} document.getElementById(this.FlashContainerID).onmousedown = RightClick.onIEMouse; } }, /** * GECKO / WEBKIT event overkill * @param {Object} eventObject */ killEvents: function(eventObject) { if(eventObject) { if (eventObject.stopPropagation) eventObject.stopPropagation(); if (eventObject.preventDefault) eventObject.preventDefault(); if (eventObject.preventCapture) eventObject.preventCapture(); if (eventObject.preventBubble) eventObject.preventBubble(); } }, /** * GECKO / WEBKIT call right click * @param {Object} ev */ onGeckoMouse: function(ev) { return function(ev) { if (ev.button == 2) { RightClick.killEvents(ev); if(ev.target.id == RightClick.FlashObjectID && RightClick.Cache == RightClick.FlashObjectID) {
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
RightClick.call(); } RightClick.Cache = ev.target.id; } } }, /** * IE call right click * @param {Object} ev */ onIEMouse: function() { if (event.button == 2) { if(window.event.srcElement.id == RightClick.FlashObjectID && RightClick.Cache == RightClick.FlashObjectID) { RightClick.call(); } document.getElementById(RightClick.FlashContainerID).setCapture(); if(window.event.srcElement.id) RightClick.Cache = window.event.srcElement.id; } }, /** * Main call to Flash External Interface */ call: function() { document.getElementById(this.FlashObjectID).rightClick(); } } /** * SWFObject v1.5: Flash Player detection and embed - http://blog.deconcept.com/swfobject/ * * SWFObject is (c) 2007 Geoff Stearns and is released under the MIT License: * http://www.opensource.org/licenses/mit-license.php * */ if(typeof deconcept=="undefined"){var deconcept=new Object();}if(typeof deconcept.util=="undefined"){deconcept.util=new Object();}if(typeof deconcept.SWFObjectUtil=="undefined"){deconcept.SWFObjectUtil=new
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 4

standard - /* * * Copyright 2007 * * Paulius Uza *...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online