1 sdump('D_TRACE','Loading clam_shell.js\n');
3 function clam_shell_init(p) {
4 dump("TESTING: clam_shell.js: " + mw.G['main_test_variable'] + '\n');
7 get_widget(p.w.document,p.clamshell).orient = 'horizontal';
8 } else if (p.vertical) {
9 get_widget(p.w.document,p.clamshell).orient = 'vertical';
12 var nl = get_widget(p.clamshell).getElementsByTagName('deck');
13 var first_deck = nl[0];
14 var second_deck = nl[1];
16 p.w.first_deck = first_deck;
17 p.w.second_deck = second_deck;
18 p.w.get_card_in_first_deck = function (idx) {
20 return first_deck.childNodes[ idx ];
22 return first_deck.selectedPanel;
24 p.w.get_card_in_second_deck = function (idx) {
26 return second_deck.childNodes[ idx ];
28 return second_deck.selectedPanel;
30 p.w.set_first_deck = function (idx) { return set_deck(p.w.document,first_deck,idx); };
31 p.w.set_second_deck = function (idx) { return set_deck(p.w.document,second_deck,idx); };
32 p.w.replace_card_in_first_deck = function (idx,chrome,params) {
33 return replace_card_in_deck(p.w.document,first_deck,idx,chrome,params);
35 p.w.replace_card_in_second_deck = function (idx,chrome,params) {
36 return replace_card_in_deck(p.w.document,second_deck,idx,chrome,params);
38 p.w.new_card_in_first_deck = function (chrome,params) {
39 return new_card_in_deck(p.w.document,first_deck,chrome,params);
41 p.w.new_card_in_second_deck = function (chrome,params) {
42 return new_card_in_deck(p.w.document,second_deck,chrome,params);
47 function new_card_in_deck(doc,deck,chrome,params) {
48 deck = get_widget(doc,deck);
49 var new_card = document.createElement('iframe');
50 new_card.setAttribute('flex','1');
51 new_card.setAttribute('src',chrome);
52 deck.appendChild(new_card);
53 new_card.setAttribute('id','card_'+(deck.childNodes.length-1));
56 function replace_card_in_deck(doc,deck,idx,chrome,params) {
57 deck = get_widget(doc,deck);
58 var old_card = deck.childNodes[ idx ];
59 var new_card = document.createElement('iframe');
60 new_card.setAttribute('flex','1');
61 new_card.setAttribute('src',chrome);
62 deck.appendChild(new_card);
63 deck.replaceChild(new_card,old_card);
64 new_card.setAttribute('id','card_'+idx);
65 new_card.contentWindow.mw = mw;
67 new_card.contentWindow.params = params;
68 return new_card.contentWindow;