Contact
CoCalc Logo Icon
StoreFeaturesDocsShareSupport News AboutSign UpSign In
| Download
Views: 39550
1
##############################################################################
2
#
3
# CoCalc: Collaborative Calculation in the Cloud
4
#
5
# Copyright (C) 2015 -- 2016, SageMath, Inc.
6
#
7
# This program is free software: you can redistribute it and/or modify
8
# it under the terms of the GNU General Public License as published by
9
# the Free Software Foundation, either version 3 of the License, or
10
# (at your option) any later version.
11
#
12
# This program is distributed in the hope that it will be useful,
13
# but WITHOUT ANY WARRANTY; without even the implied warranty of
14
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
# GNU General Public License for more details.
16
#
17
# You should have received a copy of the GNU General Public License
18
# along with this program. If not, see <http://www.gnu.org/licenses/>.
19
#
20
###############################################################################
21
22
{redux} = require('./smc-react')
23
24
# Calling set_window_title will set the title, but also put a notification
25
# count to the left of the title; if called with no arguments just updates
26
# the count, maintaining the previous title.
27
notify_count = undefined
28
exports.set_notify_count_function = (f) -> notify_count = f
29
30
last_title = ''
31
exports.set_window_title = (title) ->
32
if not title?
33
title = last_title
34
last_title = title
35
u = notify_count?()
36
if u
37
title = "(#{u}) #{title}"
38
site_name = redux.getStore('customize').get('site_name')
39
if title.length > 0
40
document.title = title + " - " + site_name
41
else
42
document.title = site_name
43