diff options
Diffstat (limited to 'node_modules/montage/ui/feed-reader/feed-reader.reel')
-rw-r--r-- | node_modules/montage/ui/feed-reader/feed-reader.reel/feed-reader.html | 26 | ||||
-rw-r--r-- | node_modules/montage/ui/feed-reader/feed-reader.reel/feed-reader.js | 51 |
2 files changed, 74 insertions, 3 deletions
diff --git a/node_modules/montage/ui/feed-reader/feed-reader.reel/feed-reader.html b/node_modules/montage/ui/feed-reader/feed-reader.reel/feed-reader.html index a3523001..646fd01e 100644 --- a/node_modules/montage/ui/feed-reader/feed-reader.reel/feed-reader.html +++ b/node_modules/montage/ui/feed-reader/feed-reader.reel/feed-reader.html | |||
@@ -53,7 +53,15 @@ | |||
53 | "module": "montage/ui/feed-reader/feed-reader.reel", | 53 | "module": "montage/ui/feed-reader/feed-reader.reel", |
54 | "name": "FeedReader", | 54 | "name": "FeedReader", |
55 | "properties": { | 55 | "properties": { |
56 | "element": {"#": "feed-reader"} | 56 | "element": {"#": "feed-reader"}, |
57 | "repetition": {"@": "repetition"} | ||
58 | }, | ||
59 | "bindings": { | ||
60 | "items": { | ||
61 | "boundObject": {"@": "repetition"}, | ||
62 | "boundObjectPropertyPath": "objects", | ||
63 | "oneway": true | ||
64 | } | ||
57 | } | 65 | } |
58 | } | 66 | } |
59 | 67 | ||
@@ -61,8 +69,20 @@ | |||
61 | </script> | 69 | </script> |
62 | 70 | ||
63 | <style> | 71 | <style> |
64 | .feed-reader { | 72 | div.feed-reader { |
65 | padding: 10px; | 73 | padding: 10px; |
74 | } | ||
75 | |||
76 | .feed-entry { | ||
77 | display: none; | ||
78 | } | ||
79 | |||
80 | .montage-hidden { | ||
81 | display: none; | ||
82 | } | ||
83 | |||
84 | .active { | ||
85 | display: block; | ||
66 | } | 86 | } |
67 | 87 | ||
68 | </style> | 88 | </style> |
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 838a957d..d5c9ca17 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,7 +40,13 @@ exports.FeedReader = Montage.create(Component, { | |||
40 | this._fetchFeed(); | 40 | this._fetchFeed(); |
41 | } | 41 | } |
42 | }, | 42 | }, |
43 | |||
44 | // time in ms between slides | ||
45 | interval: {value: 3000, distinct: true}, | ||
46 | |||
47 | repetition: {enumerable: false, value: null}, | ||
43 | 48 | ||
49 | maxEntries: {value: 10, distinct: true}, | ||
44 | entries: {value: null}, | 50 | entries: {value: null}, |
45 | 51 | ||
46 | 52 | ||
@@ -55,6 +61,51 @@ exports.FeedReader = Montage.create(Component, { | |||
55 | //Notifier.hide(); | 61 | //Notifier.hide(); |
56 | } | 62 | } |
57 | }, | 63 | }, |
64 | |||
65 | |||
66 | feedEntryTimer: {enumerable: false, value: null}, | ||
67 | _items: { | ||
68 | value: null | ||
69 | }, | ||
70 | items: { | ||
71 | get: function() { | ||
72 | return this._items; | ||
73 | }, | ||
74 | set: function(value) { | ||
75 | this._items = value; | ||
76 | // reset the counter | ||
77 | console.log('got items'); | ||
78 | this.activeIndex = 0; | ||
79 | |||
80 | if(this.feedEntryTimer) { | ||
81 | window.clearInterval(this.feedEntryTimer); | ||
82 | } | ||
83 | var self = this, maxEntries = self.maxEntries; | ||
84 | |||
85 | this.feedEntryTimer = setInterval(function() { | ||
86 | var index = self.activeIndex + 1; | ||
87 | if(index > maxEntries) { | ||
88 | index = 0; | ||
89 | } | ||
90 | if(index < 0) { | ||
91 | index = 0; | ||
92 | } | ||
93 | self.activeIndex = index; | ||
94 | |||
95 | }, this.interval); | ||
96 | } | ||
97 | }, | ||
98 | |||
99 | _activeIndex: {value: null}, | ||
100 | activeIndex: { | ||
101 | get: function() { | ||
102 | return this._activeIndex || 0; | ||
103 | }, | ||
104 | set: function(value) { | ||
105 | this._activeIndex = value; | ||
106 | this.repetition.activeIndexes = [value]; | ||
107 | } | ||
108 | }, | ||
58 | 109 | ||
59 | _fetchFeed: { | 110 | _fetchFeed: { |
60 | value: function() { | 111 | value: function() { |