Mercurial > hg > soundsoftware-site
comparison public/javascripts/.svn/text-base/context_menu.js.svn-base @ 245:051f544170fe
* Update to SVN trunk revision 4993
author | Chris Cannam |
---|---|
date | Thu, 03 Mar 2011 11:42:28 +0000 |
parents | 8661b858af72 |
children | cbce1fd3b1b7 |
comparison
equal
deleted
inserted
replaced
244:8972b600f4fb | 245:051f544170fe |
---|---|
9 this.url = url; | 9 this.url = url; |
10 this.createMenu(); | 10 this.createMenu(); |
11 | 11 |
12 if (!observingContextMenuClick) { | 12 if (!observingContextMenuClick) { |
13 Event.observe(document, 'click', this.Click.bindAsEventListener(this)); | 13 Event.observe(document, 'click', this.Click.bindAsEventListener(this)); |
14 Event.observe(document, (window.opera ? 'click' : 'contextmenu'), this.RightClick.bindAsEventListener(this)); | 14 Event.observe(document, 'contextmenu', this.RightClick.bindAsEventListener(this)); |
15 observingContextMenuClick = true; | 15 observingContextMenuClick = true; |
16 } | 16 } |
17 | 17 |
18 this.unselectAll(); | 18 this.unselectAll(); |
19 this.lastSelected = null; | 19 this.lastSelected = null; |
21 | 21 |
22 RightClick: function(e) { | 22 RightClick: function(e) { |
23 this.hideMenu(); | 23 this.hideMenu(); |
24 // do not show the context menu on links | 24 // do not show the context menu on links |
25 if (Event.element(e).tagName == 'A') { return; } | 25 if (Event.element(e).tagName == 'A') { return; } |
26 // right-click simulated by Alt+Click with Opera | |
27 if (window.opera && !e.altKey) { return; } | |
28 var tr = Event.findElement(e, 'tr'); | 26 var tr = Event.findElement(e, 'tr'); |
29 if (tr == document || tr == undefined || !tr.hasClassName('hascontextmenu')) { return; } | 27 if (tr == document || tr == undefined || !tr.hasClassName('hascontextmenu')) { return; } |
30 Event.stop(e); | 28 Event.stop(e); |
31 if (!this.isSelected(tr)) { | 29 if (!this.isSelected(tr)) { |
32 this.unselectAll(); | 30 this.unselectAll(); |
37 }, | 35 }, |
38 | 36 |
39 Click: function(e) { | 37 Click: function(e) { |
40 this.hideMenu(); | 38 this.hideMenu(); |
41 if (Event.element(e).tagName == 'A') { return; } | 39 if (Event.element(e).tagName == 'A') { return; } |
42 if (window.opera && e.altKey) { return; } | |
43 if (Event.isLeftClick(e) || (navigator.appVersion.match(/\bMSIE\b/))) { | 40 if (Event.isLeftClick(e) || (navigator.appVersion.match(/\bMSIE\b/))) { |
44 var tr = Event.findElement(e, 'tr'); | 41 var tr = Event.findElement(e, 'tr'); |
45 if (tr!=null && tr!=document && tr.hasClassName('hascontextmenu')) { | 42 if (tr!=null && tr!=document && tr.hasClassName('hascontextmenu')) { |
46 // a row was clicked, check if the click was on checkbox | 43 // a row was clicked, check if the click was on checkbox |
47 var box = Event.findElement(e, 'input'); | 44 var box = Event.findElement(e, 'input'); |