2 var $ = require('jquery');
3 var context = require('gitter-web-client-context');
4 var clientEnv = require('gitter-client-env');
5 var onready = require('./utils/onready');
6 var appEvents = require('./utils/appevents');
7 var apiClient = require('./components/api-client');
8 var HeaderView = require('./views/app/headerView');
9 var rightToolbarModel = require('./models/right-toolbar-model');
11 require('./components/timezone-cookie');
12 require('./views/widgets/preload');
13 require('./components/dozy');
14 require('./template/helpers/all');
15 require('./components/bug-reporting');
16 require('./utils/tracking');
17 require('./components/ping');
19 require('@gitterhq/styleguide/css/components/buttons.css');
22 require('./components/link-handler').installLinkHandler();
23 appEvents.on('navigation', function(url) {
24 window.location = url;
27 $('#noindex').on('change', function() {
28 var noindex = $('#noindex')[0].checked;
31 .put('', { noindex: !noindex })
34 'Room indexing disabled. The change will take effect the next time a search engine crawls this room.';
35 $('#noindexStatus').html(!noindex ? msg : '');
38 $('#noindexStatus').html('Oops, something went wrong. Reload and try again.');
41 // When a user clicks an internal link, prevent it from opening in a new window
42 $(document).on('click', 'a.link', function(e) {
43 var basePath = clientEnv['basePath'];
44 var href = e.target.getAttribute('href');
45 if (!href || href.indexOf(basePath) !== 0) {
50 window.parent.location.href = href;
55 model: context.troupe(),
56 rightToolbarModel: rightToolbarModel,