aboutsummaryrefslogtreecommitdiff
path: root/js/components/menu/menu.reel/menu.js
diff options
context:
space:
mode:
authorJohn Mayhew2012-07-24 15:46:16 -0700
committerJohn Mayhew2012-07-24 15:46:16 -0700
commit9f240b8b9b1f5fb0f145c343ca5e533e25e81374 (patch)
tree407564eaa6466e8d4cf2eeee0c56dc623243586f /js/components/menu/menu.reel/menu.js
parentd25359c75089215ee48838db081fd3d51cbbd85f (diff)
parent21d74af1e9fc57cc25cea8aa7408beabf79ff2f3 (diff)
downloadninja-9f240b8b9b1f5fb0f145c343ca5e533e25e81374.tar.gz
Merge branch 'master' of github.com:Motorola-Mobility/ninja
Diffstat (limited to 'js/components/menu/menu.reel/menu.js')
-rwxr-xr-xjs/components/menu/menu.reel/menu.js143
1 files changed, 0 insertions, 143 deletions
diff --git a/js/components/menu/menu.reel/menu.js b/js/components/menu/menu.reel/menu.js
deleted file mode 100755
index bf554b37..00000000
--- a/js/components/menu/menu.reel/menu.js
+++ /dev/null
@@ -1,143 +0,0 @@
1/* <copyright>
2Copyright (c) 2012, Motorola Mobility LLC.
3All Rights Reserved.
4
5Redistribution and use in source and binary forms, with or without
6modification, are permitted provided that the following conditions are met:
7
8* Redistributions of source code must retain the above copyright notice,
9 this list of conditions and the following disclaimer.
10
11* Redistributions in binary form must reproduce the above copyright notice,
12 this list of conditions and the following disclaimer in the documentation
13 and/or other materials provided with the distribution.
14
15* Neither the name of Motorola Mobility LLC nor the names of its
16 contributors may be used to endorse or promote products derived from this
17 software without specific prior written permission.
18
19THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
23LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29POSSIBILITY OF SUCH DAMAGE.
30</copyright> */
31
32var Montage = require("montage/core/core").Montage,
33 Component = require("montage/ui/component").Component;
34
35exports.Menu = Montage.create(Component, {
36
37 _currentDocument: {
38 value : null
39 },
40
41 currentDocument : {
42 get : function() {
43 return this._currentDocument;
44 },
45 set : function(value) {
46 if (value === this._currentDocument) {
47 return;
48 }
49
50 this._currentDocument = value;
51 }
52 },
53
54 _active: {
55 value: false
56 },
57
58 active: {
59 get: function() {
60 return this._active;
61 },
62 set: function(value) {
63 this._active = value;
64 }
65 },
66
67 _activeEntry: {
68 value: null
69 },
70
71 activeEntry: {
72 get: function() {
73 return this._activeEntry;
74 },
75 set: function(value) {
76 if(this.active) {
77
78 if(this._activeEntry) this._activeEntry.deselect();
79
80 this._activeEntry = value;
81
82 this._activeEntry.select();
83
84 }
85 }
86 },
87
88 toggleActivation: {
89 value: function(item) {
90 if(this.active) {
91 this._activeEntry.deselect();
92 this._activeEntry = null;
93 this.active = false;
94 this.element.ownerDocument.removeEventListener('mousedown', this, false);
95 } else {
96 this.active = true;
97 this.activeEntry = item;
98 this.element.ownerDocument.addEventListener('mousedown', this, false);
99 }
100 }
101 },
102
103 prepareForDraw: {
104 value: function() {
105
106 }
107 },
108
109 handleMousedown: {
110 value: function(evt) {
111 if(this.active && (this.getZIndex(evt.target) < 9000 || evt.target.id === "topMenu")) {
112 this._activeEntry.deselect();
113 this._activeEntry = null;
114 this.active = false;
115 this.element.ownerDocument.removeEventListener('mousedown', this, false);
116 }
117 }
118 },
119
120 getZIndex: {
121 value: function(elem) {
122
123 var position, value, zIndex;
124 while (elem && elem !== document) {
125// position = elem.style.position;
126 position = document.defaultView.getComputedStyle(elem, "").getPropertyValue("position");
127
128 if (position === "absolute" || position === "relative" || position === "fixed") {
129 // webkit returns a string for zindex value and "" if zindex is not available
130// zIndex = elem.style['z-index'];
131 zIndex = document.defaultView.getComputedStyle(elem, "").getPropertyValue("z-index");
132 value = parseInt(zIndex, 10);
133 if (!isNaN(value) && value !== 0) {
134 return value;
135 }
136 }
137 elem = elem.parentNode;
138 }
139 return 0;
140 }
141 }
142
143});