Commit 6be5b093 authored by Taddeüs Kroes's avatar Taddeüs Kroes

Page now centers on indicator when loaded

parent 8e725094
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
#FETCH_URL = 'http://www.tvgids.nl/json/lists/programs.php' #FETCH_URL = 'http://www.tvgids.nl/json/lists/programs.php'
FETCH_URL = 'programs.php' FETCH_URL = 'programs.php'
HOUR_WIDTH = 200 HOUR_WIDTH = 200
SCROLL_MULTIPLIER = HOUR_WIDTH #SCROLL_MULTIPLIER = HOUR_WIDTH
# #
# Utils # Utils
...@@ -47,7 +47,6 @@ ChannelList = Backbone.Collection.extend( ...@@ -47,7 +47,6 @@ ChannelList = Backbone.Collection.extend(
initialize: (models, options) -> initialize: (models, options) ->
#_.each(CHANNELS, (props, id) => @add(_.extend({id: id}, props))) #_.each(CHANNELS, (props, id) => @add(_.extend({id: id}, props)))
@fetchVisible() @fetchVisible()
#@fetchPrograms(0) #@fetchPrograms(0)
...@@ -155,6 +154,7 @@ AppView = Backbone.View.extend( ...@@ -155,6 +154,7 @@ AppView = Backbone.View.extend(
initialize: -> initialize: ->
@updateIndicator() @updateIndicator()
@centerIndicator()
@listenTo(Channels, 'reset', @addChannels) @listenTo(Channels, 'reset', @addChannels)
Channels.fetch() Channels.fetch()
...@@ -180,6 +180,9 @@ AppView = Backbone.View.extend( ...@@ -180,6 +180,9 @@ AppView = Backbone.View.extend(
updateIndicator: -> updateIndicator: ->
@$('.indicator').css('left', time2px(seconds_today(Date.now())) + 'px') @$('.indicator').css('left', time2px(seconds_today(Date.now())) + 'px')
centerIndicator: ->
@el.scrollLeft = @$('.indicator').position().left - @$el.width() / 2
fetchPrograms: -> fetchPrograms: ->
Channels.fetchPrograms(Settings.get('day')) Channels.fetchPrograms(Settings.get('day'))
) )
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment