]> git.wh0rd.org - tt-rss.git/blob - lib/dijit/_base/popup.js.uncompressed.js
upgrade dojo to 1.8.3 (refs #570)
[tt-rss.git] / lib / dijit / _base / popup.js.uncompressed.js
1 define("dijit/_base/popup", [
2 "dojo/dom-class", // domClass.contains
3 "dojo/_base/window",
4 "../popup",
5 "../BackgroundIframe" // just loading for back-compat, in case client code is referencing it
6 ], function(domClass, win, popup){
7
8 // module:
9 // dijit/_base/popup
10
11 /*=====
12 return {
13 // summary:
14 // Deprecated. Old module for popups, new code should use dijit/popup directly.
15 };
16 =====*/
17
18
19 // Hack support for old API passing in node instead of a widget (to various methods)
20 var origCreateWrapper = popup._createWrapper;
21 popup._createWrapper = function(widget){
22 if(!widget.declaredClass){
23 // make fake widget to pass to new API
24 widget = {
25 _popupWrapper: (widget.parentNode && domClass.contains(widget.parentNode, "dijitPopup")) ?
26 widget.parentNode : null,
27 domNode: widget,
28 destroy: function(){},
29 ownerDocument: widget.ownerDocument,
30 ownerDocumentBody: win.body(widget.ownerDocument)
31 };
32 }
33 return origCreateWrapper.call(this, widget);
34 };
35
36 // Support old format of orient parameter
37 var origOpen = popup.open;
38 popup.open = function(/*__OpenArgs*/ args){
39 // Convert old hash structure (ex: {"BL": "TL", ...}) of orient to format compatible w/new popup.open() API.
40 // Don't do conversion for:
41 // - null parameter (that means to use the default positioning)
42 // - "R" or "L" strings used to indicate positioning for context menus (when there is no around node)
43 // - new format, ex: ["below", "above"]
44 // - return value from deprecated dijit.getPopupAroundAlignment() method,
45 // ex: ["below", "above"]
46 if(args.orient && typeof args.orient != "string" && !("length" in args.orient)){
47 var ary = [];
48 for(var key in args.orient){
49 ary.push({aroundCorner: key, corner: args.orient[key]});
50 }
51 args.orient = ary;
52 }
53
54 return origOpen.call(this, args);
55 };
56
57 return popup;
58 });