1 dump('entering util/deck.js\n');
3 if (typeof util == 'undefined') util = {};
4 util.deck = function (id) {
6 this.node = document.getElementById(id);
8 JSAN.use('util.error'); this.error = new util.error();
11 var error = 'util.deck: Could not find element ' + id;
12 this.error.sdump('D_ERROR',error);
15 if (this.node.nodeName != 'deck') {
16 var error = 'util.deck: ' + id + 'is not a deck' + "\nIt's a " + this.node.nodeName;
17 this.error.sdump('D_ERROR',error);
24 util.deck.prototype = {
26 'find_index' : function (url) {
28 var nodes = this.node.childNodes;
29 for (var i = 0; i < nodes.length; i++) {
30 if (nodes[i].getAttribute('src') == url) idx = i;
35 'set_iframe' : function (url,params,content_params) {
36 var idx = this.find_index(url);
38 this.node.selectedIndex = idx;
39 return this.node.childNodes[idx];
41 return this.new_iframe(url,params,content_params);
47 'reset_iframe' : function (url,params,content_params) {
48 this.remove_iframe(url);
49 return this.new_iframe(url,params,content_params);
52 'new_iframe' : function (url,params,content_params) {
53 var idx = this.find_index(url);
54 if (idx>-1) throw('An iframe already exists in deck with url = ' + url);
56 var iframe = document.createElement('iframe');
57 iframe.setAttribute('src',url);
58 //iframe.setAttribute('flex','1');
59 //iframe.setAttribute('style','overflow: scroll');
60 //iframe.setAttribute('style','border: solid thin red');
61 this.node.appendChild( iframe );
62 this.node.selectedIndex = this.node.childNodes.length - 1;
65 netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
66 this.error.sdump('D_DECK', 'frame.contentWindow = ' + iframe.contentWindow + '\n');
67 iframe.contentWindow.IAMXUL = true;
68 iframe.contentWindow.xulG = content_params;
70 dump('E: ' + E + '\n');
76 'remove_iframe' : function (url) {
77 var idx = this.find_index(url);
79 this.node.removeChild( this.node.childNodes[ idx ] );
84 dump('exiting util/deck.js\n');