STORAGE_CHANNELS = 'tvgids-channels' DEFAULT_CHANNELS = [1, 2, 3, 4, 31, 46, 92, 36, 37, 34, 29, 18, 91] DEFAULT_CHANNELS = _.map(DEFAULT_CHANNELS, String) visible = if localStorage.hasOwnProperty(STORAGE_CHANNELS) \ then localStorage.getItem(STORAGE_CHANNELS).split(';') \ else _.pluck(CHANNELS, 'id') _.each CHANNELS, (channel) -> is_visible = _.contains(visible, channel.id) input = $('') input.attr('checked', is_visible) input.change(-> $(@).parent().toggleClass('disabled', not $(@).is(':checked'))) input.change(-> $('#select-channels').submit()) elem = $('