| 201 | }; |
| 202 | |
| 203 | var popoverElement = function() { |
| 204 | var object = { |
| 205 | init : function() { |
| 206 | this.element = angular.element( |
| 207 | '<div class="popover popover-incode top">' + |
| 208 | '<div class="arrow"></div>' + |
| 209 | '<div class="popover-inner">' + |
| 210 | '<div class="popover-title"><code></code></div>' + |
| 211 | '<div class="popover-content"></div>' + |
| 212 | '</div>' + |
| 213 | '</div>' |
| 214 | ); |
| 215 | this.node = this.element[0]; |
| 216 | this.element.css({ |
| 217 | 'display':'block', |
| 218 | 'position':'absolute' |
| 219 | }); |
| 220 | angular.element(document.body).append(this.element); |
| 221 | |
| 222 | var inner = this.element.children()[1]; |
| 223 | this.titleElement = angular.element(inner.childNodes[0].firstChild); |
| 224 | this.contentElement = angular.element(inner.childNodes[1]); |
| 225 | |
| 226 | //stop the click on the tooltip |
| 227 | this.element.bind('click', function(event) { |
| 228 | event.preventDefault(); |
| 229 | event.stopPropagation(); |
| 230 | }); |
| 231 | |
| 232 | var self = this; |
| 233 | angular.element(document.body).bind('click',function(event) { |
| 234 | if(self.visible()) self.hide(); |
| 235 | }); |
| 236 | }, |
| 237 | |
| 238 | show : function(x,y) { |
| 239 | this.element.addClass('visible'); |
| 240 | this.position(x || 0, y || 0); |
| 241 | }, |
| 242 | |
| 243 | hide : function() { |
| 244 | this.element.removeClass('visible'); |
| 245 | this.position(-9999,-9999); |
| 246 | }, |
| 247 | |
| 248 | visible : function() { |
| 249 | return this.position().y >= 0; |
| 250 | }, |
| 251 | |
| 252 | isSituatedAt : function(element) { |
| 253 | return this.besideElement ? element[0] == this.besideElement[0] : false; |
| 254 | }, |
| 255 | |
| 256 | title : function(value) { |
| 257 | return this.titleElement.html(value); |
| 258 | }, |
| 259 | |
| 260 | content : function(value) { |