2014-11-20 15:41:53 -05:00
|
|
|
CampaignList = require('views/play/WorldMapView').campaigns
|
|
|
|
|
|
|
|
# TODO: Is this file structured correctly?
|
|
|
|
|
|
|
|
# Per-campaign options, with default fallback set
|
|
|
|
options =
|
|
|
|
'default':
|
|
|
|
autocompleteFontSizePx: 16
|
2014-11-22 00:02:35 -05:00
|
|
|
backspaceThrottle: false
|
2014-11-20 15:41:53 -05:00
|
|
|
'dungeon':
|
|
|
|
autocompleteFontSizePx: 20
|
2014-11-22 00:02:35 -05:00
|
|
|
backspaceThrottle: true
|
2014-11-20 15:41:53 -05:00
|
|
|
|
|
|
|
module.exports = CampaignOptions =
|
|
|
|
getCampaignForSlug: (slug) ->
|
|
|
|
return unless slug
|
|
|
|
for campaign in CampaignList
|
|
|
|
for level in campaign.levels
|
|
|
|
return campaign.id if level.id is slug
|
|
|
|
|
|
|
|
getOption: (levelSlug, option) ->
|
|
|
|
return unless levelSlug and option
|
|
|
|
return unless campaign = CampaignOptions.getCampaignForSlug levelSlug
|
|
|
|
return options[campaign]?[option] if options[campaign]?[option]?
|
|
|
|
return options.default[option] if options.default[option]?
|