2016-09-26 05:37:42 +00:00
|
|
|
/* global Metamaps */
|
2016-02-03 13:38:41 +00:00
|
|
|
|
2016-09-22 07:21:59 +00:00
|
|
|
import Account from './Account'
|
2016-09-22 09:05:28 +00:00
|
|
|
import Active from './Active'
|
2016-09-22 07:21:59 +00:00
|
|
|
import Admin from './Admin'
|
|
|
|
import AutoLayout from './AutoLayout'
|
|
|
|
import Backbone from './Backbone'
|
|
|
|
import Control from './Control'
|
|
|
|
import Create from './Create'
|
|
|
|
import Debug from './Debug'
|
|
|
|
import Filter from './Filter'
|
2016-09-29 16:20:16 +00:00
|
|
|
import GlobalUI, {
|
2016-09-24 16:27:04 +00:00
|
|
|
Search, CreateMap, ImportDialog, Account as GlobalUI_Account
|
2016-09-29 16:20:16 +00:00
|
|
|
} from './GlobalUI'
|
2016-09-22 07:21:59 +00:00
|
|
|
import Import from './Import'
|
|
|
|
import JIT from './JIT'
|
|
|
|
import Listeners from './Listeners'
|
2016-09-22 15:51:13 +00:00
|
|
|
import Map, { CheatSheet, InfoBox } from './Map'
|
2016-09-22 07:21:59 +00:00
|
|
|
import Mapper from './Mapper'
|
|
|
|
import Mobile from './Mobile'
|
2016-09-22 09:14:34 +00:00
|
|
|
import Mouse from './Mouse'
|
2016-09-22 07:21:59 +00:00
|
|
|
import Organize from './Organize'
|
|
|
|
import PasteInput from './PasteInput'
|
|
|
|
import Realtime from './Realtime'
|
|
|
|
import Router from './Router'
|
2016-09-22 09:14:34 +00:00
|
|
|
import Selected from './Selected'
|
|
|
|
import Settings from './Settings'
|
2016-09-22 07:21:59 +00:00
|
|
|
import Synapse from './Synapse'
|
|
|
|
import SynapseCard from './SynapseCard'
|
|
|
|
import Topic from './Topic'
|
|
|
|
import TopicCard from './TopicCard'
|
|
|
|
import Util from './Util'
|
2016-09-23 00:16:18 +00:00
|
|
|
import Views from './Views'
|
2016-09-22 07:21:59 +00:00
|
|
|
import Visualize from './Visualize'
|
|
|
|
|
2016-09-25 10:49:16 +00:00
|
|
|
Metamaps = window.Metamaps || {}
|
2016-09-22 07:21:59 +00:00
|
|
|
Metamaps.Account = Account
|
2016-09-22 09:05:28 +00:00
|
|
|
Metamaps.Active = Active
|
2016-09-22 07:21:59 +00:00
|
|
|
Metamaps.Admin = Admin
|
|
|
|
Metamaps.AutoLayout = AutoLayout
|
|
|
|
Metamaps.Backbone = Backbone
|
|
|
|
Metamaps.Control = Control
|
|
|
|
Metamaps.Create = Create
|
|
|
|
Metamaps.Debug = Debug
|
|
|
|
Metamaps.Filter = Filter
|
|
|
|
Metamaps.GlobalUI = GlobalUI
|
2016-09-29 16:20:16 +00:00
|
|
|
Metamaps.GlobalUI.Search = Search
|
|
|
|
Metamaps.GlobalUI.CreateMap = CreateMap
|
|
|
|
Metamaps.GlobalUI.Account = GlobalUI_Account
|
2016-09-24 16:27:04 +00:00
|
|
|
Metamaps.GlobalUI.ImportDialog = ImportDialog
|
2016-09-22 07:21:59 +00:00
|
|
|
Metamaps.Import = Import
|
|
|
|
Metamaps.JIT = JIT
|
|
|
|
Metamaps.Listeners = Listeners
|
|
|
|
Metamaps.Map = Map
|
2016-09-22 15:51:13 +00:00
|
|
|
Metamaps.Map.CheatSheet = CheatSheet
|
|
|
|
Metamaps.Map.InfoBox = InfoBox
|
2016-09-22 09:14:34 +00:00
|
|
|
Metamaps.Maps = {}
|
2016-09-22 07:21:59 +00:00
|
|
|
Metamaps.Mapper = Mapper
|
|
|
|
Metamaps.Mobile = Mobile
|
2016-09-22 09:14:34 +00:00
|
|
|
Metamaps.Mouse = Mouse
|
2016-09-22 07:21:59 +00:00
|
|
|
Metamaps.Organize = Organize
|
|
|
|
Metamaps.PasteInput = PasteInput
|
|
|
|
Metamaps.Realtime = Realtime
|
|
|
|
Metamaps.Router = Router
|
2016-09-22 09:14:34 +00:00
|
|
|
Metamaps.Selected = Selected
|
|
|
|
Metamaps.Settings = Settings
|
2016-09-22 07:21:59 +00:00
|
|
|
Metamaps.Synapse = Synapse
|
|
|
|
Metamaps.SynapseCard = SynapseCard
|
|
|
|
Metamaps.Topic = Topic
|
|
|
|
Metamaps.TopicCard = TopicCard
|
|
|
|
Metamaps.Util = Util
|
|
|
|
Metamaps.Views = Views
|
|
|
|
Metamaps.Visualize = Visualize
|
2016-09-22 06:25:49 +00:00
|
|
|
|
2016-09-29 16:20:16 +00:00
|
|
|
document.addEventListener('DOMContentLoaded', function () {
|
2016-09-22 07:29:55 +00:00
|
|
|
// initialize all the modules
|
2016-09-22 09:05:28 +00:00
|
|
|
for (const prop in Metamaps) {
|
2016-09-29 16:20:16 +00:00
|
|
|
// this runs the init function within each sub-object on the Metamaps one
|
|
|
|
if (Metamaps.hasOwnProperty(prop) &&
|
|
|
|
Metamaps[prop] != null &&
|
|
|
|
Metamaps[prop].hasOwnProperty('init') &&
|
|
|
|
typeof (Metamaps[prop].init) === 'function'
|
|
|
|
) {
|
|
|
|
Metamaps[prop].init()
|
|
|
|
}
|
2016-09-22 07:29:55 +00:00
|
|
|
}
|
|
|
|
// load whichever page you are on
|
2016-09-29 16:20:16 +00:00
|
|
|
if (Metamaps.currentSection === 'explore') {
|
|
|
|
const capitalize = Metamaps.currentPage.charAt(0).toUpperCase() + Metamaps.currentPage.slice(1)
|
2016-09-22 07:29:55 +00:00
|
|
|
|
2016-09-29 16:20:16 +00:00
|
|
|
Metamaps.Views.ExploreMaps.setCollection(Metamaps.Maps[capitalize])
|
|
|
|
if (Metamaps.currentPage === 'mapper') {
|
|
|
|
Views.ExploreMaps.fetchUserThenRender()
|
|
|
|
} else {
|
2016-09-22 16:07:30 +00:00
|
|
|
Views.ExploreMaps.render()
|
2016-09-29 16:20:16 +00:00
|
|
|
}
|
|
|
|
GlobalUI.showDiv('#explore')
|
|
|
|
} else if (Metamaps.currentSection === '' && Active.Mapper) {
|
|
|
|
Views.ExploreMaps.setCollection(Metamaps.Maps.Active)
|
|
|
|
Views.ExploreMaps.render()
|
|
|
|
GlobalUI.showDiv('#explore')
|
|
|
|
} else if (Active.Map || Active.Topic) {
|
2016-09-22 07:29:55 +00:00
|
|
|
Metamaps.Loading.show()
|
2016-09-22 10:31:56 +00:00
|
|
|
JIT.prepareVizData()
|
|
|
|
GlobalUI.showDiv('#infovis')
|
2016-09-22 07:29:55 +00:00
|
|
|
}
|
2016-09-29 16:20:16 +00:00
|
|
|
})
|
2016-09-22 07:29:55 +00:00
|
|
|
|
2016-09-22 09:05:28 +00:00
|
|
|
export default Metamaps
|