aboutsummaryrefslogtreecommitdiff
path: root/js/components/popup.reel/popup.js
diff options
context:
space:
mode:
authorJose Antonio Marquez2012-06-17 14:52:20 -0700
committerJose Antonio Marquez2012-06-17 14:52:20 -0700
commitf48416d68e2762ece2816e7e2387f0aa3ffa797f (patch)
tree42ea238f27a56883cae199ee943d82771bee9cca /js/components/popup.reel/popup.js
parentffc03c14fe9cf6c2ba92338aeae89cc1aea51259 (diff)
downloadninja-f48416d68e2762ece2816e7e2387f0aa3ffa797f.tar.gz
Cleaning up element references
Diffstat (limited to 'js/components/popup.reel/popup.js')
-rwxr-xr-xjs/components/popup.reel/popup.js24
1 files changed, 12 insertions, 12 deletions
diff --git a/js/components/popup.reel/popup.js b/js/components/popup.reel/popup.js
index ae483ea9..2d89db13 100755
--- a/js/components/popup.reel/popup.js
+++ b/js/components/popup.reel/popup.js
@@ -104,7 +104,7 @@ exports.Popup = Montage.create(Component, {
104 if (!this._content.style.float) { 104 if (!this._content.style.float) {
105 this._content.style.float = 'left'; 105 this._content.style.float = 'left';
106 } 106 }
107 this.element.getElementsByClassName('content')[0].appendChild(this._content); 107 this.popupContent.appendChild(this._content);
108 // 108 //
109 if (!this.tooltip) { 109 if (!this.tooltip) {
110 this.tooltip = {}; 110 this.tooltip = {};
@@ -113,16 +113,16 @@ exports.Popup = Montage.create(Component, {
113 } 113 }
114 switch (this.tooltip.side.toLowerCase()) { 114 switch (this.tooltip.side.toLowerCase()) {
115 case 'top': 115 case 'top':
116 this.element.style.marginTop = (this.element.getElementsByClassName('tooltip')[0].clientHeight) + 'px'; 116 this.element.style.marginTop = (this.popupTooltip.clientHeight) + 'px';
117 break; 117 break;
118 case 'bottom': 118 case 'bottom':
119 this.element.style.marginTop = -(this.element.clientHeight+(this.element.getElementsByClassName('tooltip')[0].clientHeight)) + 'px'; 119 this.element.style.marginTop = -(this.element.clientHeight+(this.popupTooltip.clientHeight)) + 'px';
120 break; 120 break;
121 case 'left': 121 case 'left':
122 this.element.style.marginLeft = (this.element.getElementsByClassName('tooltip')[0].clientWidth) + 'px'; 122 this.element.style.marginLeft = (this.popupTooltip.clientWidth) + 'px';
123 break; 123 break;
124 case 'right': 124 case 'right':
125 this.element.style.marginLeft = -(this.element.clientWidth + this.element.getElementsByClassName('tooltip')[0].clientWidth) + 'px'; 125 this.element.style.marginLeft = -(this.element.clientWidth + this.popupTooltip.clientWidth) + 'px';
126 break; 126 break;
127 default: 127 default:
128 //console.log("Error: Tooltip side value of "+this.tooltip.side.toLowerCase()+" property not allowed"); 128 //console.log("Error: Tooltip side value of "+this.tooltip.side.toLowerCase()+" property not allowed");
@@ -131,22 +131,22 @@ exports.Popup = Montage.create(Component, {
131 // 131 //
132 switch (this.tooltip.align.toLowerCase()) { 132 switch (this.tooltip.align.toLowerCase()) {
133 case 'top': 133 case 'top':
134 this.element.style.marginTop = -Math.round((this.element.getElementsByClassName('tooltip')[0].clientHeight/2)+this.element.getElementsByClassName('tooltip')[0].offsetTop) + 'px'; 134 this.element.style.marginTop = -Math.round((this.popupTooltip.clientHeight/2)+this.popupTooltip.offsetTop) + 'px';
135 break; 135 break;
136 case 'bottom': 136 case 'bottom':
137 this.element.style.marginTop = -Math.round(this.element.clientHeight-((this.element.clientHeight - this.element.getElementsByClassName('tooltip')[0].offsetTop)-(this.element.getElementsByClassName('tooltip')[0].clientHeight/2))) + 'px'; 137 this.element.style.marginTop = -Math.round(this.element.clientHeight-((this.element.clientHeight - this.popupTooltip.offsetTop)-(this.popupTooltip.clientHeight/2))) + 'px';
138 break; 138 break;
139 case 'left': 139 case 'left':
140 this.element.style.marginLeft = -Math.round(this.element.clientWidth-((this.element.clientWidth - this.element.getElementsByClassName('tooltip')[0].offsetLeft)-(this.element.getElementsByClassName('tooltip')[0].clientWidth/2))) + 'px'; 140 this.element.style.marginLeft = -Math.round(this.element.clientWidth-((this.element.clientWidth - this.popupTooltip.offsetLeft)-(this.popupTooltip.clientWidth/2))) + 'px';
141 break; 141 break;
142 case 'right': 142 case 'right':
143 this.element.style.marginLeft = -(this.element.clientWidth - this.element.getElementsByClassName('tooltip')[0].clientWidth) + 'px'; 143 this.element.style.marginLeft = -(this.element.clientWidth - this.popupTooltip.clientWidth) + 'px';
144 break; 144 break;
145 case 'center': 145 case 'center':
146 this.element.style.marginLeft = -Math.round(this.element.clientWidth/2-((this.element.clientWidth/2 - this.element.getElementsByClassName('tooltip')[0].offsetLeft)-(this.element.getElementsByClassName('tooltip')[0].clientWidth/2))) + 'px'; 146 this.element.style.marginLeft = -Math.round(this.element.clientWidth/2-((this.element.clientWidth/2 - this.popupTooltip.offsetLeft)-(this.popupTooltip.clientWidth/2))) + 'px';
147 break; 147 break;
148 case 'middle': 148 case 'middle':
149 this.element.style.marginTop = -Math.round(this.element.clientHeight/2-((this.element.clientHeight/2 - this.element.getElementsByClassName('tooltip')[0].offsetTop)-(this.element.getElementsByClassName('tooltip')[0].clientHeight/2))) + 'px'; 149 this.element.style.marginTop = -Math.round(this.element.clientHeight/2-((this.element.clientHeight/2 - this.popupTooltip.offsetTop)-(this.popupTooltip.clientHeight/2))) + 'px';
150 break; 150 break;
151 default: 151 default:
152 //console.log("Error: Tooltip align value of "+this.tooltip.align.toLowerCase()+" property not allowed"); 152 //console.log("Error: Tooltip align value of "+this.tooltip.align.toLowerCase()+" property not allowed");
@@ -170,7 +170,7 @@ exports.Popup = Montage.create(Component, {
170 enumerable: true, 170 enumerable: true,
171 value: function () { 171 value: function () {
172 // 172 //
173 var longD = '22px', shortD = '10px', shortP = '-10px', longP = '8px', tip = this.element.getElementsByClassName('tooltip')[0]; 173 var longD = '22px', shortD = '10px', shortP = '-10px', longP = '8px', tip = this.popupTooltip;
174 // 174 //
175 if (this.tooltip && this.tooltip.side) { 175 if (this.tooltip && this.tooltip.side) {
176 switch (this.tooltip.side.toLowerCase()) { 176 switch (this.tooltip.side.toLowerCase()) {