]> git.wh0rd.org Git - tt-rss.git/blob - lib/dijit/TooltipDialog.js.uncompressed.js
update dojo to 1.7.3
[tt-rss.git] / lib / dijit / TooltipDialog.js.uncompressed.js
1 require({cache:{
2 'url:dijit/templates/TooltipDialog.html':"<div role=\"presentation\" tabIndex=\"-1\">\n\t<div class=\"dijitTooltipContainer\" role=\"presentation\">\n\t\t<div class =\"dijitTooltipContents dijitTooltipFocusNode\" data-dojo-attach-point=\"containerNode\" role=\"dialog\"></div>\n\t</div>\n\t<div class=\"dijitTooltipConnector\" role=\"presentation\"></div>\n</div>\n"}});
3 define("dijit/TooltipDialog", [
4         "dojo/_base/declare", // declare
5         "dojo/dom-class", // domClass.replace
6         "dojo/_base/event", // event.stop
7         "dojo/keys", // keys
8         "dojo/_base/lang", // lang.hitch
9         "./focus",
10         "./layout/ContentPane",
11         "./_DialogMixin",
12         "./form/_FormMixin",
13         "./_TemplatedMixin",
14         "dojo/text!./templates/TooltipDialog.html",
15         "."             // exports methods to dijit global
16 ], function(declare, domClass, event, keys, lang,
17                         focus, ContentPane, _DialogMixin, _FormMixin, _TemplatedMixin, template, dijit){
18
19 /*=====
20         var ContentPane = dijit.layout.ContentPane;
21         var _DialogMixin = dijit._DialogMixin;
22         var _FormMixin = dijit.form._FormMixin;
23         var _TemplatedMixin = dijit._TemplatedMixin;
24 =====*/
25
26         // module:
27         //              dijit/TooltipDialog
28         // summary:
29         //              Pops up a dialog that appears like a Tooltip
30
31
32         return declare("dijit.TooltipDialog",
33                 [ContentPane, _TemplatedMixin, _FormMixin, _DialogMixin], {
34                 // summary:
35                 //              Pops up a dialog that appears like a Tooltip
36
37                 // title: String
38                 //              Description of tooltip dialog (required for a11y)
39                 title: "",
40
41                 // doLayout: [protected] Boolean
42                 //              Don't change this parameter from the default value.
43                 //              This ContentPane parameter doesn't make sense for TooltipDialog, since TooltipDialog
44                 //              is never a child of a layout container, nor can you specify the size of
45                 //              TooltipDialog in order to control the size of an inner widget.
46                 doLayout: false,
47
48                 // autofocus: Boolean
49                 //              A Toggle to modify the default focus behavior of a Dialog, which
50                 //              is to focus on the first dialog element after opening the dialog.
51                 //              False will disable autofocusing. Default: true
52                 autofocus: true,
53
54                 // baseClass: [protected] String
55                 //              The root className to use for the various states of this widget
56                 baseClass: "dijitTooltipDialog",
57
58                 // _firstFocusItem: [private] [readonly] DomNode
59                 //              The pointer to the first focusable node in the dialog.
60                 //              Set by `dijit._DialogMixin._getFocusItems`.
61                 _firstFocusItem: null,
62
63                 // _lastFocusItem: [private] [readonly] DomNode
64                 //              The pointer to which node has focus prior to our dialog.
65                 //              Set by `dijit._DialogMixin._getFocusItems`.
66                 _lastFocusItem: null,
67
68                 templateString: template,
69
70                 _setTitleAttr: function(/*String*/ title){
71                         this.containerNode.title = title;
72                         this._set("title", title)
73                 },
74
75                 postCreate: function(){
76                         this.inherited(arguments);
77                         this.connect(this.containerNode, "onkeypress", "_onKey");
78                 },
79
80                 orient: function(/*DomNode*/ node, /*String*/ aroundCorner, /*String*/ corner){
81                         // summary:
82                         //              Configure widget to be displayed in given position relative to the button.
83                         //              This is called from the dijit.popup code, and should not be called
84                         //              directly.
85                         // tags:
86                         //              protected
87                         var newC = "dijitTooltipAB" + (corner.charAt(1) == 'L' ? "Left" : "Right")
88                                         + " dijitTooltip"
89                                         + (corner.charAt(0) == 'T' ? "Below" : "Above");
90
91                         domClass.replace(this.domNode, newC, this._currentOrientClass || "");
92                         this._currentOrientClass = newC;
93                 },
94
95                 focus: function(){
96                         // summary:
97                         //              Focus on first field
98                         this._getFocusItems(this.containerNode);
99                         focus.focus(this._firstFocusItem);
100                 },
101
102                 onOpen: function(/*Object*/ pos){
103                         // summary:
104                         //              Called when dialog is displayed.
105                         //              This is called from the dijit.popup code, and should not be called directly.
106                         // tags:
107                         //              protected
108
109                         this.orient(this.domNode,pos.aroundCorner, pos.corner);
110                         this._onShow(); // lazy load trigger
111                 },
112
113                 onClose: function(){
114                         // summary:
115                         //              Called when dialog is hidden.
116                         //              This is called from the dijit.popup code, and should not be called directly.
117                         // tags:
118                         //              protected
119                         this.onHide();
120                 },
121
122                 _onKey: function(/*Event*/ evt){
123                         // summary:
124                         //              Handler for keyboard events
125                         // description:
126                         //              Keep keyboard focus in dialog; close dialog on escape key
127                         // tags:
128                         //              private
129
130                         var node = evt.target;
131                         if(evt.charOrCode === keys.TAB){
132                                 this._getFocusItems(this.containerNode);
133                         }
134                         var singleFocusItem = (this._firstFocusItem == this._lastFocusItem);
135                         if(evt.charOrCode == keys.ESCAPE){
136                                 // Use setTimeout to avoid crash on IE, see #10396.
137                                 setTimeout(lang.hitch(this, "onCancel"), 0);
138                                 event.stop(evt);
139                         }else if(node == this._firstFocusItem && evt.shiftKey && evt.charOrCode === keys.TAB){
140                                 if(!singleFocusItem){
141                                         focus.focus(this._lastFocusItem); // send focus to last item in dialog
142                                 }
143                                 event.stop(evt);
144                         }else if(node == this._lastFocusItem && evt.charOrCode === keys.TAB && !evt.shiftKey){
145                                 if(!singleFocusItem){
146                                         focus.focus(this._firstFocusItem); // send focus to first item in dialog
147                                 }
148                                 event.stop(evt);
149                         }else if(evt.charOrCode === keys.TAB){
150                                 // we want the browser's default tab handling to move focus
151                                 // but we don't want the tab to propagate upwards
152                                 evt.stopPropagation();
153                         }
154                 }
155         });
156 });