##############################################################################1#2# CoCalc: Collaborative Calculation in the Cloud3#4# Copyright (C) 2015 -- 2016, SageMath, Inc.5#6# This program is free software: you can redistribute it and/or modify7# it under the terms of the GNU General Public License as published by8# the Free Software Foundation, either version 3 of the License, or9# (at your option) any later version.10#11# This program is distributed in the hope that it will be useful,12# but WITHOUT ANY WARRANTY; without even the implied warranty of13# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the14# GNU General Public License for more details.15#16# You should have received a copy of the GNU General Public License17# along with this program. If not, see <http://www.gnu.org/licenses/>.18#19###############################################################################2021{redux} = require('./smc-react')2223# Calling set_window_title will set the title, but also put a notification24# count to the left of the title; if called with no arguments just updates25# the count, maintaining the previous title.26notify_count = undefined27exports.set_notify_count_function = (f) -> notify_count = f2829last_title = ''30exports.set_window_title = (title) ->31if not title?32title = last_title33last_title = title34u = notify_count?()35if u36title = "(#{u}) #{title}"37site_name = redux.getStore('customize').get('site_name')38if title.length > 039document.title = title + " - " + site_name40else41document.title = site_name4243