Add slide number in the title in slide2

This commit is contained in:
yflory
2017-09-08 18:21:11 +02:00
parent c3a07e879c
commit 514bff7065
6 changed files with 28 additions and 15 deletions

View File

@@ -107,12 +107,28 @@ define([
});
});
var currentTitle;
var currentTabTitle;
var setDocumentTitle = function () {
if (!currentTabTitle) {
document.title = currentTitle || 'CryptPad';
return;
}
var title = currentTabTitle.replace(/\{title\}/g, currentTitle || 'CryptPad');
document.title = title;
};
sframeChan.on('Q_SET_PAD_TITLE_IN_DRIVE', function (newTitle, cb) {
document.title = newTitle;
currentTitle = newTitle;
setDocumentTitle();
Cryptpad.renamePad(newTitle, undefined, function (err) {
if (err) { cb('ERROR'); } else { cb(); }
});
});
sframeChan.on('EV_SET_TAB_TITLE', function (newTabTitle) {
currentTabTitle = newTabTitle;
setDocumentTitle();
});
sframeChan.on('Q_SETTINGS_SET_DISPLAY_NAME', function (newName, cb) {
Cryptpad.setDisplayName(newName, function (err) {

View File

@@ -32,7 +32,6 @@ define(['jquery'], function ($) {
}
};
// update title: href is optional; if not specified, we use window.location.href
exp.updateTitle = function (newTitle, cb) {
cb = cb || $.noop;
if (newTitle === exp.title) { return; }

View File

@@ -83,6 +83,9 @@ define([
funcs.notify = function () {
ctx.sframeChan.event('EV_NOTIFY');
};
funcs.setTabTitle = function (newTitle) {
ctx.sframeChan.event('EV_SET_TAB_TITLE', newTitle);
};
funcs.setLoginRedirect = function (cb) {
cb = cb || $.noop;

View File

@@ -43,7 +43,13 @@ define({
// This changes the pad title in drive ONLY, the pad title needs to be changed inside of the
// iframe and synchronized with the other users. This will not trigger a EV_METADATA_UPDATE
// because the metadata contained in EV_METADATA_UPDATE does not contain the pad title.
// It also sets the page (tab) title to the selected title, unles it is overridden by
// the EV_SET_TAB_TITLE event.
'Q_SET_PAD_TITLE_IN_DRIVE': true,
// Set the page title (tab title) to the selected value which will override the pad title.
// The new title value can contain {title}, which will be replaced by the pad title when it
// is set or modified.
'EV_SET_TAB_TITLE': true,
// Update the user's display-name which will be shown to contacts and people in the same pads.
'Q_SETTINGS_SET_DISPLAY_NAME': true,