summaryrefslogtreecommitdiff
path: root/frontend/gamma/js/Clipperz/PM/UI/Mobile/Components/CardList.js
Unidiff
Diffstat (limited to 'frontend/gamma/js/Clipperz/PM/UI/Mobile/Components/CardList.js') (more/less context) (ignore whitespace changes)
-rw-r--r--frontend/gamma/js/Clipperz/PM/UI/Mobile/Components/CardList.js26
1 files changed, 10 insertions, 16 deletions
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Mobile/Components/CardList.js b/frontend/gamma/js/Clipperz/PM/UI/Mobile/Components/CardList.js
index a4aa212..a0e4879 100644
--- a/frontend/gamma/js/Clipperz/PM/UI/Mobile/Components/CardList.js
+++ b/frontend/gamma/js/Clipperz/PM/UI/Mobile/Components/CardList.js
@@ -1,254 +1,248 @@
1/* 1/*
2 2
3Copyright 2008-2011 Clipperz Srl 3Copyright 2008-2013 Clipperz Srl
4 4
5This file is part of Clipperz Community Edition. 5This file is part of Clipperz, the online password manager.
6Clipperz Community Edition is an online password manager.
7For further information about its features and functionalities please 6For further information about its features and functionalities please
8refer to http://www.clipperz.com. 7refer to http://www.clipperz.com.
9 8
10* Clipperz Community Edition is free software: you can redistribute 9* Clipperz is free software: you can redistribute it and/or modify it
11 it and/or modify it under the terms of the GNU Affero General Public 10 under the terms of the GNU Affero General Public License as published
12 License as published by the Free Software Foundation, either version 11 by the Free Software Foundation, either version 3 of the License, or
13 3 of the License, or (at your option) any later version. 12 (at your option) any later version.
14 13
15* Clipperz Community Edition is distributed in the hope that it will 14* Clipperz is distributed in the hope that it will be useful, but
16 be useful, but WITHOUT ANY WARRANTY; without even the implied 15 WITHOUT ANY WARRANTY; without even the implied warranty of
17 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
18 See the GNU Affero General Public License for more details. 17 See the GNU Affero General Public License for more details.
19 18
20* You should have received a copy of the GNU Affero General Public 19* You should have received a copy of the GNU Affero General Public
21 License along with Clipperz Community Edition. If not, see 20 License along with Clipperz. If not, see http://www.gnu.org/licenses/.
22 <http://www.gnu.org/licenses/>.
23 21
24*/ 22*/
25 23
26Clipperz.Base.module('Clipperz.PM.UI.Mobile.Components'); 24Clipperz.Base.module('Clipperz.PM.UI.Mobile.Components');
27 25
28Clipperz.PM.UI.Mobile.Components.CardList = function(args) { 26Clipperz.PM.UI.Mobile.Components.CardList = function(args) {
29 args = args || {}; 27 args = args || {};
30 28
31 Clipperz.PM.UI.Mobile.Components.CardList.superclass.constructor.apply(this, arguments); 29 Clipperz.PM.UI.Mobile.Components.CardList.superclass.constructor.apply(this, arguments);
32 30
33 this._cardDetail = null; 31 this._cardDetail = null;
34 32
35 return this; 33 return this;
36} 34}
37 35
38//============================================================================= 36//=============================================================================
39 37
40Clipperz.Base.extend(Clipperz.PM.UI.Mobile.Components.CardList, Clipperz.PM.UI.Common.Components.BaseComponent, { 38Clipperz.Base.extend(Clipperz.PM.UI.Mobile.Components.CardList, Clipperz.PM.UI.Common.Components.BaseComponent, {
41 39
42 //------------------------------------------------------------------------- 40 //-------------------------------------------------------------------------
43 41
44 'toString': function () { 42 'toString': function () {
45 return "Clipperz.PM.UI.Mobile.Components.CardList component"; 43 return "Clipperz.PM.UI.Mobile.Components.CardList component";
46 }, 44 },
47 45
48 //------------------------------------------------------------------------- 46 //-------------------------------------------------------------------------
49 47
50 'renderSelf': function () { 48 'renderSelf': function () {
51 this.append(this.element(), {tag:'div', cls:'cardList', children:[ 49 this.append(this.element(), {tag:'div', cls:'cardList', children:[
52 {tag:'div', cls:'toolbar', children:[ 50 {tag:'div', cls:'toolbar', children:[
53 {tag:'h1', html:"clipperz"}, 51 {tag:'h1', html:"clipperz"},
54 // {tag:'input', name:'search', type:'search', autocomplete:'off', placeholder:"search", id:this.getId('search')}, 52 // {tag:'input', name:'search', type:'search', autocomplete:'off', placeholder:"search", id:this.getId('search')},
55 {tag:'a', href:'#', id:'settings', cls:'button', html:"*"} 53 {tag:'a', href:'#', id:'settings', cls:'button', html:"*"}
56 ]}, 54 ]},
57 {tag:'div', cls:'scroll', id:this.getId('listBox'), children:[ 55 {tag:'div', cls:'scroll', id:this.getId('listBox'), children:[
58 {tag:'ul', cls:'rounded', id:this.getId('list'), children:[ 56 {tag:'ul', cls:'rounded', id:this.getId('list'), children:[
59 {tag:'li', html:'loading'} 57 {tag:'li', html:'loading'}
60 ]} 58 ]}
61 ]} 59 ]}
62 ]}); 60 ]});
63 61
64 MochiKit.Signal.connect(this.getElement('list'), 'onclick', this, 'cardSelectionHandler'); 62 MochiKit.Signal.connect(this.getElement('list'), 'onclick', this, 'cardSelectionHandler');
65 MochiKit.Signal.connect(this.getElement('list'), 'ontouchstart',this, 'cardSelectionHandler'); 63 MochiKit.Signal.connect(this.getElement('list'), 'ontouchstart',this, 'cardSelectionHandler');
66 // MochiKit.Signal.connect(this.getElement('cardListSearchForm'), 'onsubmit', this,'searchHandler'); 64 // MochiKit.Signal.connect(this.getElement('cardListSearchForm'), 'onsubmit', this,'searchHandler');
67 // MochiKit.Signal.connect(this.getElement('cardListSearchForm'), 'onkeydown', this,'searchHandler'); 65 // MochiKit.Signal.connect(this.getElement('cardListSearchForm'), 'onkeydown', this,'searchHandler');
68 // MochiKit.Signal.connect(this.getElement('cardListSearchForm'), 'onkeyup', this,'searchHandler'); 66 // MochiKit.Signal.connect(this.getElement('cardListSearchForm'), 'onkeyup', this,'searchHandler');
69 67
70 // MochiKit.Signal.connect(this.getElement('cardListPanel'), 'onclick', this,'cardListClickHandler'); 68 // MochiKit.Signal.connect(this.getElement('cardListPanel'), 'onclick', this,'cardListClickHandler');
71 // MochiKit.Signal.connect('backButton', 'onclick', this,'backButtonClickHandler'); 69 // MochiKit.Signal.connect('backButton', 'onclick', this,'backButtonClickHandler');
72 70
73 // MochiKit.Style.hideElement('backButton'); 71 // MochiKit.Style.hideElement('backButton');
74 // MochiKit.Style.hideElement(this.getElement('cardDetail')); 72 // MochiKit.Style.hideElement(this.getElement('cardDetail'));
75 }, 73 },
76 74
77 'showCards': function (someCards) { 75 'showCards': function (someCards) {
78 varcardListElement; 76 varcardListElement;
79 if (this.isFullyRendered() == false) { 77 if (this.isFullyRendered() == false) {
80 this.render(); 78 this.render();
81 }; 79 };
82 80
83 cardListElement = this.getElement('list') 81 cardListElement = this.getElement('list')
84 82
85 cardInfo = { 83 cardInfo = {
86 '_rowObject': MochiKit.Async.succeed, 84 '_rowObject': MochiKit.Async.succeed,
87 '_reference': MochiKit.Base.methodcaller('reference'), 85 '_reference': MochiKit.Base.methodcaller('reference'),
88 '_searchableContent':MochiKit.Base.methodcaller('searchableContent'), 86 '_searchableContent':MochiKit.Base.methodcaller('searchableContent'),
89 'label': MochiKit.Base.methodcaller('label'), 87 'label': MochiKit.Base.methodcaller('label'),
90 'favicon': MochiKit.Base.methodcaller('favicon') 88 'favicon': MochiKit.Base.methodcaller('favicon')
91 }; 89 };
92 90
93//console.log("someCards", someCards);
94 deferredResult = new Clipperz.Async.Deferred("CardList.showCards", {trace:false}); 91 deferredResult = new Clipperz.Async.Deferred("CardList.showCards", {trace:false});
95 deferredResult.addCallback(MochiKit.Base.map, Clipperz.Async.collectResults("CardList.value - collectResults", cardInfo, {trace:false})); 92 deferredResult.addCallback(MochiKit.Base.map, Clipperz.Async.collectResults("CardList.value - collectResults", cardInfo, {trace:false}));
96 deferredResult.addCallback(Clipperz.Async.collectAll); 93 deferredResult.addCallback(Clipperz.Async.collectAll);
97 deferredResult.addCallback(MochiKit.Base.methodcaller('sort', Clipperz.Base.caseInsensitiveKeyComparator('label'))); 94 deferredResult.addCallback(MochiKit.Base.methodcaller('sort', Clipperz.Base.caseInsensitiveKeyComparator('label')));
98 deferredResult.addCallbackPass(MochiKit.DOM.replaceChildNodes, cardListElement); 95 deferredResult.addCallbackPass(MochiKit.DOM.replaceChildNodes, cardListElement);
99 // deferredResult.addCallbackPass(MochiKit.DOM.removeElementClass, cardListElement, 'loading'); 96 // deferredResult.addCallbackPass(MochiKit.DOM.removeElementClass, cardListElement, 'loading');
100 deferredResult.addCallback(MochiKit.Base.map, MochiKit.Base.method(this, 'appendCardToList', cardListElement)); 97 deferredResult.addCallback(MochiKit.Base.map, MochiKit.Base.method(this, 'appendCardToList', cardListElement));
101 deferredResult.callback(someCards); 98 deferredResult.callback(someCards);
102 }, 99 },
103 100
104 'appendCardToList': function (aCardListElement, aCardInfo) { 101 'appendCardToList': function (aCardListElement, aCardInfo) {
105//console.log("appendCardToList", aCardInfo);
106 this.append(aCardListElement, {tag:'li', cls:'cardListItem arrow', cardreference:aCardInfo['_reference'], children:[ 102 this.append(aCardListElement, {tag:'li', cls:'cardListItem arrow', cardreference:aCardInfo['_reference'], children:[
107 {tag:'a', href:'#', html:aCardInfo['label'], children:[ 103 {tag:'a', href:'#', html:aCardInfo['label'], children:[
108 {tag:'small', cls:'favicon', children:[{tag:'img', cls:'favicon', src:aCardInfo['favicon']}]} 104 {tag:'small', cls:'favicon', children:[{tag:'img', cls:'favicon', src:aCardInfo['favicon']}]}
109 ]} 105 ]}
110 ]}); 106 ]});
111 }, 107 },
112 108
113 'cardSelectionHandler': function (anEvent) { 109 'cardSelectionHandler': function (anEvent) {
114 var listElement; 110 var listElement;
115 varcardReference; 111 varcardReference;
116 112
117 anEvent.preventDefault(); 113 anEvent.preventDefault();
118 114
119 listElement = anEvent.target(); 115 listElement = anEvent.target();
120 if (MochiKit.DOM.getNodeAttribute(listElement, 'cardreference') == null) { 116 if (MochiKit.DOM.getNodeAttribute(listElement, 'cardreference') == null) {
121 listElement = MochiKit.DOM.getFirstParentByTagAndClassName(anEvent.target(), tagName='li', className='cardListItem'); 117 listElement = MochiKit.DOM.getFirstParentByTagAndClassName(anEvent.target(), tagName='li', className='cardListItem');
122 } 118 }
123 cardReference = MochiKit.DOM.getNodeAttribute(listElement, 'cardreference'); 119 cardReference = MochiKit.DOM.getNodeAttribute(listElement, 'cardreference');
124console.log("###", listElement, cardReference);
125 //TODO: Notify card with reference MochiKit.DOM.getNodeAttribute(listElement, 'cardreference') has been selected 120 //TODO: Notify card with reference MochiKit.DOM.getNodeAttribute(listElement, 'cardreference') has been selected
126 MochiKit.Signal.signal(this, 'selectedCard', cardReference); 121 MochiKit.Signal.signal(this, 'selectedCard', cardReference);
127 }, 122 },
128 123
129 //------------------------------------------------------------------------- 124 //-------------------------------------------------------------------------
130/* 125/*
131 'searchHandler': function (anEvent) { 126 'searchHandler': function (anEvent) {
132 if ((typeof(anEvent.key()) != 'undefined') && (anEvent.key().string == 'KEY_ENTER')) { //RETURN 127 if ((typeof(anEvent.key()) != 'undefined') && (anEvent.key().string == 'KEY_ENTER')) { //RETURN
133 anEvent.preventDefault(); 128 anEvent.preventDefault();
134 } else { 129 } else {
135 if ((typeof(anEvent.key()) != 'undefined') && (anEvent.key().string == 'KEY_ESCAPE')) { 130 if ((typeof(anEvent.key()) != 'undefined') && (anEvent.key().string == 'KEY_ESCAPE')) {
136 anEvent.target().value = ""; 131 anEvent.target().value = "";
137 } 132 }
138 133
139 if (anEvent.type() == 'keyup') { 134 if (anEvent.type() == 'keyup') {
140 MochiKit.Signal.signal(this, 'searchEvent', anEvent.target().value); 135 MochiKit.Signal.signal(this, 'searchEvent', anEvent.target().value);
141 } 136 }
142 } 137 }
143 }, 138 },
144 139
145 //------------------------------------------------------------------------- 140 //-------------------------------------------------------------------------
146 141
147 'update': function (someObjects) { 142 'update': function (someObjects) {
148 varcardListPanel; 143 varcardListPanel;
149 var i,c; 144 var i,c;
150 145
151 cardListPanel = this.getElement('cardListPanel'); 146 cardListPanel = this.getElement('cardListPanel');
152 cardListPanel.innerHTML = ''; 147 cardListPanel.innerHTML = '';
153 148
154 c = someObjects.length; 149 c = someObjects.length;
155 150
156 for (i=0; i<c; i++) { 151 for (i=0; i<c; i++) {
157 this.append(cardListPanel, {tag:'li', cls:'cardListItem', id:('cardListItem_' + someObjects[i]['_reference']), children:[ 152 this.append(cardListPanel, {tag:'li', cls:'cardListItem', id:('cardListItem_' + someObjects[i]['_reference']), children:[
158 {tag:'img', src:(someObjects[i]['favicon'] ? someObjects[i]['favicon'] : 'data:application/octet-stream;charset=utf-8;base64,AAABAAEAFxcAAAEAGAD8BgAAFgAAACgAAAAXAAAALgAAAAEAGAAAAAAAAAAAABIXAAASFwAAAAAAAAAAAAD///////////////////////////////////////////////////////////////////////////////////////////9zAC////////////////////////////////////////////////////////////////////////////////////////////9pAG////////////////////////////////////////////////////////////////////////////////////////////9rAC////////////////////////////////////////////////////////////////////////////////////////////9yAHP////////////////////////IyMizs7O6urrq6ur////////////Ozs6zs7Ozs7Pq6ur///////////////////////8AAAD////////////////////V1dWXl5eXl5eXl5elpaX4+Pj////Ozs6Xl5eXl5eXl5eenp7///////////////////////8AAAD////////////////////Ozs6Xl5eXl5eXl5eXl5fBwcHq6uqenp6Xl5eXl5eXl5eXl5f///////////////////////8AAAD////////////////////j4+OXl5eXl5eXl5eXl5eXl5elpaWXl5eXl5eXl5eXl5ezs7P///////////////////////8AAAD////////////////////////IyMiXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5eenp7x8fH////////////////////////////////////////////////////4+PilpaWXl5eXl5eXl5eXl5eXl5eXl5eXl5fOzs7////////////////////////////////////////////////////////q6uq6urqXl5eXl5eXl5eXl5eXl5eXl5eenp7V1dX4+Pj///////////////////////8AAAD////////////4+PjOzs6lpaWXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5e6urrj4+P///////////////8AAAD////////////BwcGXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5fx8fH///////////8AAAD///////////+zs7OXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5fj4+P///////////8AAAD////////////IyMiXl5eXl5eXl5eXl5e6urqXl5eXl5eXl5eXl5esrKylpaWXl5eXl5eXl5eenp7x8fH///////////8AAAD////////////////Ozs7Ozs7V1dX4+Pj///+Xl5eXl5eXl5eXl5fOzs7////q6urOzs7Ozs7q6ur///////////////8AAAD///////////////////////////////////+Xl5eXl5eXl5eXl5fOzs7///////////////////////////////////8AAAD///////////////////////////////////+Xl5eXl5eXl5eXl5fOzs7///////////////////////////////////8AAAD///////////////////////////////////+Xl5eXl5eXl5eXl5fOzs7///////////////////////////////////8AAAD////////////////////////////////////IyMiXl5eXl5eenp7x8fH///////////////////////////////////8AAAD////////////////////////////////////////j4+Pj4+Px8fH///////////////////////////////////////8AAAD///////////////////////////////////////////////////////////////////////////////////////////8AAAD///////////////////////////////////////////////////////////////////////////////////////////8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAo=')}, 153 {tag:'img', src:(someObjects[i]['favicon'] ? someObjects[i]['favicon'] : 'data:application/octet-stream;charset=utf-8;base64,AAABAAEAFxcAAAEAGAD8BgAAFgAAACgAAAAXAAAALgAAAAEAGAAAAAAAAAAAABIXAAASFwAAAAAAAAAAAAD///////////////////////////////////////////////////////////////////////////////////////////9zAC////////////////////////////////////////////////////////////////////////////////////////////9pAG////////////////////////////////////////////////////////////////////////////////////////////9rAC////////////////////////////////////////////////////////////////////////////////////////////9yAHP////////////////////////IyMizs7O6urrq6ur////////////Ozs6zs7Ozs7Pq6ur///////////////////////8AAAD////////////////////V1dWXl5eXl5eXl5elpaX4+Pj////Ozs6Xl5eXl5eXl5eenp7///////////////////////8AAAD////////////////////Ozs6Xl5eXl5eXl5eXl5fBwcHq6uqenp6Xl5eXl5eXl5eXl5f///////////////////////8AAAD////////////////////j4+OXl5eXl5eXl5eXl5eXl5elpaWXl5eXl5eXl5eXl5ezs7P///////////////////////8AAAD////////////////////////IyMiXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5eenp7x8fH////////////////////////////////////////////////////4+PilpaWXl5eXl5eXl5eXl5eXl5eXl5eXl5fOzs7////////////////////////////////////////////////////////q6uq6urqXl5eXl5eXl5eXl5eXl5eXl5eenp7V1dX4+Pj///////////////////////8AAAD////////////4+PjOzs6lpaWXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5e6urrj4+P///////////////8AAAD////////////BwcGXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5fx8fH///////////8AAAD///////////+zs7OXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5fj4+P///////////8AAAD////////////IyMiXl5eXl5eXl5eXl5e6urqXl5eXl5eXl5eXl5esrKylpaWXl5eXl5eXl5eenp7x8fH///////////8AAAD////////////////Ozs7Ozs7V1dX4+Pj///+Xl5eXl5eXl5eXl5fOzs7////q6urOzs7Ozs7q6ur///////////////8AAAD///////////////////////////////////+Xl5eXl5eXl5eXl5fOzs7///////////////////////////////////8AAAD///////////////////////////////////+Xl5eXl5eXl5eXl5fOzs7///////////////////////////////////8AAAD///////////////////////////////////+Xl5eXl5eXl5eXl5fOzs7///////////////////////////////////8AAAD////////////////////////////////////IyMiXl5eXl5eenp7x8fH///////////////////////////////////8AAAD////////////////////////////////////////j4+Pj4+Px8fH///////////////////////////////////////8AAAD///////////////////////////////////////////////////////////////////////////////////////////8AAAD///////////////////////////////////////////////////////////////////////////////////////////8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAo=')},
159 {tag:'a', id:('cardListReference_' + someObjects[i]['_reference']), href:'#', html:someObjects[i]['label']} 154 {tag:'a', id:('cardListReference_' + someObjects[i]['_reference']), href:'#', html:someObjects[i]['label']}
160 ]}) 155 ]})
161 156
162 MochiKit.Signal.connect('cardListItem_' + someObjects[i]['_reference'], 'onclick', this, 'cardListClickHandler'); 157 MochiKit.Signal.connect('cardListItem_' + someObjects[i]['_reference'], 'onclick', this, 'cardListClickHandler');
163 } 158 }
164 159
165 }, 160 },
166 161
167 'cardListClickHandler': function (anEvent) { 162 'cardListClickHandler': function (anEvent) {
168 anEvent.preventDefault(); 163 anEvent.preventDefault();
169 164
170 if (/(cardListReference_|cardListItem_)/.test(anEvent.target().id)) { 165 if (/(cardListReference_|cardListItem_)/.test(anEvent.target().id)) {
171 var cardListReference; 166 var cardListReference;
172 167
173 cardListReference = anEvent.target().id.match(/(cardListReference_|cardListItem_)(.*)/)[2]; 168 cardListReference = anEvent.target().id.match(/(cardListReference_|cardListItem_)(.*)/)[2];
174//console.log("Showing detail for card named", cardListReference);
175 MochiKit.Signal.signal(this, 'selectedCard', cardListReference); 169 MochiKit.Signal.signal(this, 'selectedCard', cardListReference);
176 } 170 }
177 }, 171 },
178 172
179 //========================================================================= 173 //=========================================================================
180 174
181 'cardDetail': function (someData) { 175 'cardDetail': function (someData) {
182 if (this._cardDetail == null) { 176 if (this._cardDetail == null) {
183 this._cardDetail = new Clipperz.PM.UI.Mobile.Components.CardDetail({element:this.getElement('cardDetail')}); 177 this._cardDetail = new Clipperz.PM.UI.Mobile.Components.CardDetail({element:this.getElement('cardDetail')});
184 } 178 }
185 179
186 return this._cardDetail; 180 return this._cardDetail;
187 }, 181 },
188 182
189 //------------------------------------------------------------------------- 183 //-------------------------------------------------------------------------
190 184
191 'removeCardDetail': function () { 185 'removeCardDetail': function () {
192 if (this._cardDetail != null) { 186 if (this._cardDetail != null) {
193 this._cardDetail.remove(); 187 this._cardDetail.remove();
194 this._cardDetail = null; 188 this._cardDetail = null;
195 } 189 }
196 }, 190 },
197 191
198 //========================================================================= 192 //=========================================================================
199 193
200 'showCard': function (someData) { 194 'showCard': function (someData) {
201 vardeferredResult; 195 vardeferredResult;
202 varoffset; 196 varoffset;
203 197
204 offset = ((MochiKit.DOM.getNodeAttribute(MochiKit.DOM.currentDocument().body, 'orientation') == 'portrait') ? 320 : 480); 198 offset = ((MochiKit.DOM.getNodeAttribute(MochiKit.DOM.currentDocument().body, 'orientation') == 'portrait') ? 320 : 480);
205 this.cardDetail().render(); 199 this.cardDetail().render();
206 this.cardDetail().setCardReference(someData['_reference']); 200 this.cardDetail().setCardReference(someData['_reference']);
207 MochiKit.Style.setElementPosition(this.cardDetail().element(), {x:offset}); 201 MochiKit.Style.setElementPosition(this.cardDetail().element(), {x:offset});
208 new MochiKit.Visual.Sequence([ 202 new MochiKit.Visual.Sequence([
209 // new MochiKit.Visual.Move(this.cardDetail().element(), {x:offset, y:45, mode:'absolute', duration:0, sync:true}), 203 // new MochiKit.Visual.Move(this.cardDetail().element(), {x:offset, y:45, mode:'absolute', duration:0, sync:true}),
210 new MochiKit.Visual.Parallel([ 204 new MochiKit.Visual.Parallel([
211 new MochiKit.Visual.Move(this.getElement('cardList'), {x:-offset, y:0, mode:'relative',transition:MochiKit.Visual.Transitions.linear, sync:true}), 205 new MochiKit.Visual.Move(this.getElement('cardList'), {x:-offset, y:0, mode:'relative',transition:MochiKit.Visual.Transitions.linear, sync:true}),
212 new MochiKit.Visual.Move(this.getElement('cardDetail'), {x:0, y:45, mode:'absolute',transition:MochiKit.Visual.Transitions.linear, sync:true}), 206 new MochiKit.Visual.Move(this.getElement('cardDetail'), {x:0, y:45, mode:'absolute',transition:MochiKit.Visual.Transitions.linear, sync:true}),
213 // new MochiKit.Visual.ScrollTo('toolbar', {sync:true}), 207 // new MochiKit.Visual.ScrollTo('toolbar', {sync:true}),
214 MochiKit.Visual.appear ('backButton', { transition:MochiKit.Visual.Transitions.linear, sync:true}) 208 MochiKit.Visual.appear ('backButton', { transition:MochiKit.Visual.Transitions.linear, sync:true})
215 ], {duration:1, sync:true}), 209 ], {duration:1, sync:true}),
216 MochiKit.Visual.fade(this.getElement('cardList'), {duration:0, sync:true}) 210 MochiKit.Visual.fade(this.getElement('cardList'), {duration:0, sync:true})
217 ], {}) 211 ], {})
218 212
219 MochiKit.DOM.getElement('pageTitle').innerHTML = someData['title']; 213 MochiKit.DOM.getElement('pageTitle').innerHTML = someData['title'];
220 214
221 return true; 215 return true;
222 }, 216 },
223 217
224 //------------------------------------------------------------------------- 218 //-------------------------------------------------------------------------
225 219
226 'showCardDetails': function (someData) { 220 'showCardDetails': function (someData) {
227 return this.cardDetail().showCardDetails(someData); 221 return this.cardDetail().showCardDetails(someData);
228 }, 222 },
229 223
230 //========================================================================= 224 //=========================================================================
231 225
232 'backButtonClickHandler': function (anEvent) { 226 'backButtonClickHandler': function (anEvent) {
233 varoffset; 227 varoffset;
234 228
235 anEvent.preventDefault(); 229 anEvent.preventDefault();
236 230
237 MochiKit.DOM.getElement('pageTitle').innerHTML = "cards"; 231 MochiKit.DOM.getElement('pageTitle').innerHTML = "cards";
238 232
239 offset = ((MochiKit.DOM.getNodeAttribute(MochiKit.DOM.currentDocument().body, 'orientation') == 'portrait') ? 320 : 480); 233 offset = ((MochiKit.DOM.getNodeAttribute(MochiKit.DOM.currentDocument().body, 'orientation') == 'portrait') ? 320 : 480);
240 MochiKit.Style.setElementPosition(this.getElement('cardList'), {x:-offset}); 234 MochiKit.Style.setElementPosition(this.getElement('cardList'), {x:-offset});
241 MochiKit.DOM.showElement(this.getElement('cardList')); 235 MochiKit.DOM.showElement(this.getElement('cardList'));
242 236
243 new MochiKit.Visual.Parallel([ 237 new MochiKit.Visual.Parallel([
244 new MochiKit.Visual.Move(this.getElement('cardList'), {x:offset, y:0, mode:'relative',transition:MochiKit.Visual.Transitions.linear, sync:true}), 238 new MochiKit.Visual.Move(this.getElement('cardList'), {x:offset, y:0, mode:'relative',transition:MochiKit.Visual.Transitions.linear, sync:true}),
245 new MochiKit.Visual.Move(this.getElement('cardDetail'), {x:offset, y:0, mode:'relative',transition:MochiKit.Visual.Transitions.linear, sync:true}), 239 new MochiKit.Visual.Move(this.getElement('cardDetail'), {x:offset, y:0, mode:'relative',transition:MochiKit.Visual.Transitions.linear, sync:true}),
246 MochiKit.Visual.fade (this.getElement('cardDetail'), { transition:MochiKit.Visual.Transitions.linear, sync:true}), 240 MochiKit.Visual.fade (this.getElement('cardDetail'), { transition:MochiKit.Visual.Transitions.linear, sync:true}),
247 MochiKit.Visual.fade ('backButton', { transition:MochiKit.Visual.Transitions.linear, sync:true}) 241 MochiKit.Visual.fade ('backButton', { transition:MochiKit.Visual.Transitions.linear, sync:true})
248 ], {duration:1, afterFinish:MochiKit.Base.method(this, 'removeCardDetail')}) 242 ], {duration:1, afterFinish:MochiKit.Base.method(this, 'removeCardDetail')})
249 243
250 }, 244 },
251*/ 245*/
252 //========================================================================= 246 //=========================================================================
253 __syntaxFix__: "syntax fix" 247 __syntaxFix__: "syntax fix"
254}); 248});