aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorValerio Virgillito2012-03-20 14:21:40 -0700
committerValerio Virgillito2012-03-20 14:21:40 -0700
commit803286628560fd79a57028c65c42c7f19a89c746 (patch)
treeab2941ee4a72651c44f50beaa438fcc3a48fbdcc
parentc0a1164b5e84098e005f076de5eddd0e60387286 (diff)
parent54a8b7c30ab8ca909b71ef15b9c89cb940b77022 (diff)
downloadninja-803286628560fd79a57028c65c42c7f19a89c746.tar.gz
Merge branch 'master' of github.com:francoisfrisch/ninja-internal
-rw-r--r--node_modules/montage/ui/feed-reader/feed-reader.reel/feed-reader.js61
1 files changed, 31 insertions, 30 deletions
diff --git a/node_modules/montage/ui/feed-reader/feed-reader.reel/feed-reader.js b/node_modules/montage/ui/feed-reader/feed-reader.reel/feed-reader.js
index 49ce6523..0d5d7bb1 100644
--- a/node_modules/montage/ui/feed-reader/feed-reader.reel/feed-reader.js
+++ b/node_modules/montage/ui/feed-reader/feed-reader.reel/feed-reader.js
@@ -40,35 +40,39 @@ exports.FeedReader = Montage.create(Component, {
40 this._fetchFeed(); 40 this._fetchFeed();
41 } 41 }
42 }, 42 },
43 43
44 // time in ms between slides 44 // time in ms between slides
45 interval: {value: 3, distinct: true}, 45 interval: {value: 3, distinct: true},
46 46
47 maxEntries: {value: 10, distinct: true}, 47 maxEntries: {value: 10, distinct: true},
48 48
49 entries: {value: null}, 49 entries: {value: null},
50 50
51 _feedDisplayMode: {value: null}, 51 _feedDisplayMode: {value: null},
52 feedDisplayMode: { 52 feedDisplayMode: {
53 get: function() { 53 get: function() {
54 return this._feedDisplayMode; 54 return this._feedDisplayMode;
55 }, 55 },
56 set: function(value) { 56 set: function(value) {
57 this._feedDisplayMode = value; 57
58 this.removeEntryAnimation();
59 this._feedDisplayMode = value;
60
61 this.addEntryAnimation();
58 } 62 }
59 }, 63 },
60 64
61 65
62 feedEntryTimer: {enumerable: false, value: null}, 66 feedEntryTimer: {enumerable: false, value: null},
63 67
64 68
65 activeFeedEntry: {value: null}, 69 activeFeedEntry: {value: null},
66 _activeIndex: {value: null}, 70 _activeIndex: {value: null},
67 activeIndex: { 71 activeIndex: {
68 get: function() { 72 get: function() {
69 return this._activeIndex || 0; 73 return this._activeIndex || 0;
70 }, 74 },
71 set: function(index) { 75 set: function(index) {
72 if(this.entries) { 76 if(this.entries) {
73 var max = this.entries.length-1; 77 var max = this.entries.length-1;
74 if(index > max) { 78 if(index > max) {
@@ -77,17 +81,17 @@ exports.FeedReader = Montage.create(Component, {
77 if(index < 0) { 81 if(index < 0) {
78 index = 0; 82 index = 0;
79 } 83 }
80 this._activeIndex = index; 84 this._activeIndex = index;
81 this.activeFeedEntry = this.entries[this._activeIndex]; 85 this.activeFeedEntry = this.entries[this._activeIndex];
82 } else { 86 } else {
83 this._activeIndex = 0; 87 this._activeIndex = 0;
84 } 88 }
85 } 89 }
86 }, 90 },
87 91
88 _fetchFeed: { 92 _fetchFeed: {
89 value: function() { 93 value: function() {
90 94
91 var url = this.feedURL; 95 var url = this.feedURL;
92 var feed = new google.feeds.Feed(url); 96 var feed = new google.feeds.Feed(url);
93 feed.setNumEntries(10); 97 feed.setNumEntries(10);
@@ -100,43 +104,40 @@ exports.FeedReader = Montage.create(Component, {
100 if(result.error) { 104 if(result.error) {
101 self.entries = []; 105 self.entries = [];
102 } else { 106 } else {
103 //console.log('entries: ', result.feed.entries); 107 //console.log('entries: ', result.feed.entries);
104 self.addEntryAnimation(); 108 self.addEntryAnimation();
105 self.entries = result.feed.entries; 109 self.entries = result.feed.entries;
106 this._activeIndex = 0; 110 this._activeIndex = 0;
107 } 111 }
108 112
109 113
110 }); 114 });
111 } 115 }
112 }, 116 },
113 117
114 addEntryAnimation: { 118 addEntryAnimation: {
115 value: function() { 119 value: function() {
116 var self = this; 120 var self = this;
117 if("animation" == this.feedDisplayMode) { 121 if("animation" == this.feedDisplayMode) {
118
119 this.element.addEventListener('webkitAnimationStart', this); 122 this.element.addEventListener('webkitAnimationStart', this);
120 this.element.addEventListener('webkitAnimationIteration', this); 123 this.element.addEventListener('webkitAnimationIteration', this);
121 this.element.addEventListener('webkitAnimationEnd', this); 124 this.element.addEventListener('webkitAnimationEnd', this);
122
123
124
125 } else { 125 } else {
126 // timer 126 // timer
127 this.feedEntryTimer = setInterval(function() { 127 this.feedEntryTimer = setInterval(function() {
128 self.activeIndex = self.activeIndex + 1; 128 self.activeIndex = self.activeIndex + 1;
129 }, (this.interval * 1000)); 129 }, (this.interval * 1000));
130 } 130 }
131 } 131 }
132 }, 132 },
133 133
134 removeEntryAnimation: { 134 removeEntryAnimation: {
135 value: function() { 135 value: function() {
136 if("animation" == this.feedDisplayMode) { 136 if("animation" == this.feedDisplayMode) {
137 this.element.removeEventListener('webkitAnimationStart', this); 137 this.element.removeEventListener('webkitAnimationStart', this);
138 this.element.removeEventListener('webkitAnimationIteration', this); 138 this.element.removeEventListener('webkitAnimationIteration', this);
139 this.element.removeEventListener('webkitAnimationEnd', this); 139 this.element.removeEventListener('webkitAnimationEnd', this);
140
140 } else { 141 } else {
141 if(this.feedEntryTimer) { 142 if(this.feedEntryTimer) {
142 window.clearInterval(this.feedEntryTimer); 143 window.clearInterval(this.feedEntryTimer);
@@ -144,34 +145,34 @@ exports.FeedReader = Montage.create(Component, {
144 } 145 }
145 } 146 }
146 }, 147 },
147 148
148 handleWebkitAnimationStart: { 149 handleWebkitAnimationStart: {
149 value: function() { 150 value: function() {
150 console.log('animation start'); 151 console.log('animation start');
151 } 152 }
152 }, 153 },
153 154
154 handleWebkitAnimationIteration: { 155 handleWebkitAnimationIteration: {
155 value: function() { 156 value: function() {
156 console.log('animation iteration'); 157 console.log('animation iteration');
157 this.activeIndex = this.activeIndex + 1; 158 this.activeIndex = this.activeIndex + 1;
158 } 159 }
159 }, 160 },
160 161
161 handleWebkitAnimationEnd: { 162 handleWebkitAnimationEnd: {
162 value: function() { 163 value: function() {
163 console.log('animation end'); 164 console.log('animation end');
164 } 165 }
165 }, 166 },
166 167
167 prepareForDraw: { 168 prepareForDraw: {
168 value: function() { 169 value: function() {
169 } 170 }
170 }, 171 },
171 172
172 draw: { 173 draw: {
173 value: function() { 174 value: function() {
174 175
175 } 17