2016-09-22 15:21:59 +08:00
|
|
|
import Account from './Account'
|
2016-09-22 17:05:28 +08:00
|
|
|
import Active from './Active'
|
2016-09-22 15:21:59 +08:00
|
|
|
import Admin from './Admin'
|
|
|
|
import AutoLayout from './AutoLayout'
|
2017-01-03 16:12:58 -05:00
|
|
|
import Cable from './Cable'
|
2016-09-22 15:21:59 +08:00
|
|
|
import Control from './Control'
|
|
|
|
import Create from './Create'
|
2017-01-03 16:12:58 -05:00
|
|
|
import DataModel from './DataModel'
|
2016-09-22 15:21:59 +08:00
|
|
|
import Debug from './Debug'
|
|
|
|
import Filter from './Filter'
|
2016-09-30 00:20:16 +08:00
|
|
|
import GlobalUI, {
|
2016-12-04 20:02:24 +00:00
|
|
|
Search, CreateMap, ImportDialog, Account as GlobalUIAccount,
|
|
|
|
NotificationIcon
|
2016-09-30 00:20:16 +08:00
|
|
|
} from './GlobalUI'
|
2016-09-22 15:21:59 +08:00
|
|
|
import Import from './Import'
|
|
|
|
import JIT from './JIT'
|
|
|
|
import Listeners from './Listeners'
|
2016-10-02 21:10:41 +08:00
|
|
|
import Loading from './Loading'
|
2016-09-22 23:51:13 +08:00
|
|
|
import Map, { CheatSheet, InfoBox } from './Map'
|
2016-09-22 15:21:59 +08:00
|
|
|
import Mapper from './Mapper'
|
|
|
|
import Mobile from './Mobile'
|
2016-09-22 17:14:34 +08:00
|
|
|
import Mouse from './Mouse'
|
2016-09-22 15:21:59 +08:00
|
|
|
import Organize from './Organize'
|
|
|
|
import PasteInput from './PasteInput'
|
|
|
|
import Realtime from './Realtime'
|
|
|
|
import Router from './Router'
|
2016-09-22 17:14:34 +08:00
|
|
|
import Selected from './Selected'
|
|
|
|
import Settings from './Settings'
|
2016-09-22 15:21:59 +08:00
|
|
|
import Synapse from './Synapse'
|
|
|
|
import SynapseCard from './SynapseCard'
|
|
|
|
import Topic from './Topic'
|
|
|
|
import Util from './Util'
|
2016-09-22 20:16:18 -04:00
|
|
|
import Views from './Views'
|
2016-09-22 15:21:59 +08:00
|
|
|
import Visualize from './Visualize'
|
|
|
|
|
2016-10-03 08:32:37 +08:00
|
|
|
const Metamaps = window.Metamaps || {}
|
2016-09-22 15:21:59 +08:00
|
|
|
Metamaps.Account = Account
|
2016-09-22 17:05:28 +08:00
|
|
|
Metamaps.Active = Active
|
2016-09-22 15:21:59 +08:00
|
|
|
Metamaps.Admin = Admin
|
|
|
|
Metamaps.AutoLayout = AutoLayout
|
2017-01-03 16:12:58 -05:00
|
|
|
Metamaps.Cable = Cable
|
2016-09-22 15:21:59 +08:00
|
|
|
Metamaps.Control = Control
|
|
|
|
Metamaps.Create = Create
|
2017-01-03 16:12:58 -05:00
|
|
|
Metamaps.DataModel = DataModel
|
2016-09-22 15:21:59 +08:00
|
|
|
Metamaps.Debug = Debug
|
|
|
|
Metamaps.Filter = Filter
|
|
|
|
Metamaps.GlobalUI = GlobalUI
|
2016-09-30 00:20:16 +08:00
|
|
|
Metamaps.GlobalUI.Search = Search
|
|
|
|
Metamaps.GlobalUI.CreateMap = CreateMap
|
2016-10-02 21:41:05 +08:00
|
|
|
Metamaps.GlobalUI.Account = GlobalUIAccount
|
2016-09-25 00:27:04 +08:00
|
|
|
Metamaps.GlobalUI.ImportDialog = ImportDialog
|
2016-12-04 20:02:24 +00:00
|
|
|
Metamaps.GlobalUI.NotificationIcon = NotificationIcon
|
2016-09-22 15:21:59 +08:00
|
|
|
Metamaps.Import = Import
|
|
|
|
Metamaps.JIT = JIT
|
|
|
|
Metamaps.Listeners = Listeners
|
2016-10-02 21:10:41 +08:00
|
|
|
Metamaps.Loading = Loading
|
2016-09-22 15:21:59 +08:00
|
|
|
Metamaps.Map = Map
|
2016-09-22 23:51:13 +08:00
|
|
|
Metamaps.Map.CheatSheet = CheatSheet
|
|
|
|
Metamaps.Map.InfoBox = InfoBox
|
2016-09-22 17:14:34 +08:00
|
|
|
Metamaps.Maps = {}
|
2016-09-22 15:21:59 +08:00
|
|
|
Metamaps.Mapper = Mapper
|
|
|
|
Metamaps.Mobile = Mobile
|
2016-09-22 17:14:34 +08:00
|
|
|
Metamaps.Mouse = Mouse
|
2016-09-22 15:21:59 +08:00
|
|
|
Metamaps.Organize = Organize
|
|
|
|
Metamaps.PasteInput = PasteInput
|
|
|
|
Metamaps.Realtime = Realtime
|
|
|
|
Metamaps.Router = Router
|
2016-09-22 17:14:34 +08:00
|
|
|
Metamaps.Selected = Selected
|
|
|
|
Metamaps.Settings = Settings
|
2016-09-22 15:21:59 +08:00
|
|
|
Metamaps.Synapse = Synapse
|
|
|
|
Metamaps.SynapseCard = SynapseCard
|
|
|
|
Metamaps.Topic = Topic
|
|
|
|
Metamaps.Util = Util
|
|
|
|
Metamaps.Views = Views
|
|
|
|
Metamaps.Visualize = Visualize
|
2016-09-22 14:25:49 +08:00
|
|
|
|
2016-11-07 15:25:08 -05:00
|
|
|
document.addEventListener('DOMContentLoaded', function() {
|
2016-09-22 15:29:55 +08:00
|
|
|
// initialize all the modules
|
2016-09-22 17:05:28 +08:00
|
|
|
for (const prop in Metamaps) {
|
2016-09-30 00:20:16 +08: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'
|
|
|
|
) {
|
2016-10-02 21:41:05 +08:00
|
|
|
Metamaps[prop].init(Metamaps.ServerData)
|
2016-09-30 00:20:16 +08:00
|
|
|
}
|
2016-09-22 15:29:55 +08:00
|
|
|
}
|
|
|
|
// load whichever page you are on
|
2016-09-30 00:20:16 +08:00
|
|
|
if (Metamaps.currentSection === 'explore') {
|
|
|
|
const capitalize = Metamaps.currentPage.charAt(0).toUpperCase() + Metamaps.currentPage.slice(1)
|
2016-09-22 15:29:55 +08:00
|
|
|
|
2016-10-03 08:32:37 +08:00
|
|
|
Views.ExploreMaps.setCollection(DataModel.Maps[capitalize])
|
2016-09-30 00:20:16 +08:00
|
|
|
if (Metamaps.currentPage === 'mapper') {
|
2016-11-07 15:25:08 -05:00
|
|
|
Views.ExploreMaps.fetchUserThenRender()
|
2016-09-30 00:20:16 +08:00
|
|
|
} else {
|
2016-11-07 15:25:08 -05:00
|
|
|
Views.ExploreMaps.render()
|
2016-09-30 00:20:16 +08:00
|
|
|
}
|
|
|
|
GlobalUI.showDiv('#explore')
|
|
|
|
} else if (Metamaps.currentSection === '' && Active.Mapper) {
|
2016-11-07 15:25:08 -05:00
|
|
|
Views.ExploreMaps.setCollection(DataModel.Maps.Active)
|
|
|
|
Views.ExploreMaps.render()
|
2016-09-30 00:20:16 +08:00
|
|
|
GlobalUI.showDiv('#explore')
|
|
|
|
} else if (Active.Map || Active.Topic) {
|
2016-10-03 08:32:37 +08:00
|
|
|
Loading.show()
|
2016-09-22 18:31:56 +08:00
|
|
|
JIT.prepareVizData()
|
|
|
|
GlobalUI.showDiv('#infovis')
|
2016-09-22 15:29:55 +08:00
|
|
|
}
|
2016-09-30 00:20:16 +08:00
|
|
|
})
|
2016-09-22 15:29:55 +08:00
|
|
|
|
2016-09-22 17:05:28 +08:00
|
|
|
export default Metamaps
|