mirror of
https://github.com/cryptpad/cryptpad.git
synced 2026-09-14 11:05:41 +05:00
Deduplicate code for iframe title
This commit is contained in:
parent
48446d2482
commit
b78ec996ec
@ -45,7 +45,6 @@ define([
|
|||||||
Flatpickr
|
Flatpickr
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
document.title = Messages.adminPage;
|
|
||||||
var APP = {
|
var APP = {
|
||||||
'instanceStatus': {}
|
'instanceStatus': {}
|
||||||
};
|
};
|
||||||
|
|||||||
@ -1,7 +1,6 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html class="cp-app-noscroll">
|
<html class="cp-app-noscroll">
|
||||||
<head>
|
<head>
|
||||||
<title></title>
|
|
||||||
<meta content="text/html; charset=utf-8" http-equiv="content-type"/>
|
<meta content="text/html; charset=utf-8" http-equiv="content-type"/>
|
||||||
<script src="/customize/pre-loading.js?ver=1.1"></script>
|
<script src="/customize/pre-loading.js?ver=1.1"></script>
|
||||||
<link href="/customize/src/pre-loading.css?ver=1.0" rel="stylesheet" type="text/css">
|
<link href="/customize/src/pre-loading.css?ver=1.0" rel="stylesheet" type="text/css">
|
||||||
|
|||||||
@ -54,7 +54,6 @@ define([
|
|||||||
Share, Access, Properties
|
Share, Access, Properties
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
document.title = Messages.calendar;
|
|
||||||
var SaveAs = window.saveAs;
|
var SaveAs = window.saveAs;
|
||||||
var APP = window.APP = {
|
var APP = window.APP = {
|
||||||
calendars: {}
|
calendars: {}
|
||||||
|
|||||||
@ -62,9 +62,6 @@ define([
|
|||||||
Messages,
|
Messages,
|
||||||
CMeditor)
|
CMeditor)
|
||||||
{
|
{
|
||||||
Messages.application = "Application"; // XXX
|
|
||||||
Messages.cryptpad_title = "CryptPad"; // XXX
|
|
||||||
document.title = Messages.type.code + " " + Messages.application + " - " + Messages.cryptpad_title;
|
|
||||||
window.CodeMirror = CMeditor;
|
window.CodeMirror = CMeditor;
|
||||||
|
|
||||||
var MEDIA_TAG_MODES = Object.freeze([
|
var MEDIA_TAG_MODES = Object.freeze([
|
||||||
|
|||||||
@ -2695,7 +2695,7 @@ define([
|
|||||||
gridIcon,
|
gridIcon,
|
||||||
listIcon
|
listIcon
|
||||||
]));
|
]));
|
||||||
$button.attr('aria-label', 'View Mode Button');
|
$button.attr('aria-label', 'View Mode Button'); // XXX missing key?
|
||||||
var $gridIcon = $(gridIcon);
|
var $gridIcon = $(gridIcon);
|
||||||
var $listIcon = $(listIcon);
|
var $listIcon = $(listIcon);
|
||||||
var showMode = function (mode) {
|
var showMode = function (mode) {
|
||||||
|
|||||||
@ -662,23 +662,17 @@ define([
|
|||||||
|
|
||||||
var loadInitDocument = function (type, useNewDefault) {
|
var loadInitDocument = function (type, useNewDefault) {
|
||||||
var newText;
|
var newText;
|
||||||
Messages.application = "Application"; // XXX
|
|
||||||
Messages.cryptpad_title = "CryptPad"; // XXX
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case 'sheet' :
|
case 'sheet' :
|
||||||
document.title = Messages.type.sheet + " " + Messages.application + " - " + Messages.cryptpad_title;
|
|
||||||
newText = EmptyCell(useNewDefault);
|
newText = EmptyCell(useNewDefault);
|
||||||
break;
|
break;
|
||||||
case 'doc':
|
case 'doc':
|
||||||
document.title = Messages.type.doc + " " + Messages.application + " - " + Messages.cryptpad_title;
|
|
||||||
newText = EmptyDoc();
|
newText = EmptyDoc();
|
||||||
break;
|
break;
|
||||||
case 'presentation':
|
case 'presentation':
|
||||||
document.title = Messages.type.presentation + " " + Messages.application + " - " + Messages.cryptpad_title;
|
|
||||||
newText = EmptySlide();
|
newText = EmptySlide();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
document.title = Messages.application + " - " + Messages.cryptpad_title;
|
|
||||||
newText = '';
|
newText = '';
|
||||||
}
|
}
|
||||||
return new Blob([newText], {type: 'text/plain'});
|
return new Blob([newText], {type: 'text/plain'});
|
||||||
|
|||||||
@ -73,7 +73,6 @@ define([
|
|||||||
ApiConfig.httpSafeOrigin + (pathname || window.location.pathname) + 'inner.html?' +
|
ApiConfig.httpSafeOrigin + (pathname || window.location.pathname) + 'inner.html?' +
|
||||||
requireConfig.urlArgs + '#' + encodeURIComponent(JSON.stringify(req)));
|
requireConfig.urlArgs + '#' + encodeURIComponent(JSON.stringify(req)));
|
||||||
$i.attr('allowfullscreen', 'true');
|
$i.attr('allowfullscreen', 'true');
|
||||||
// $i.attr('title', 'iframe'); // XXX to be fixed
|
|
||||||
$('iframe-placeholder').after($i).remove();
|
$('iframe-placeholder').after($i).remove();
|
||||||
|
|
||||||
// This is a cheap trick to avoid loading sframe-channel in parallel with the
|
// This is a cheap trick to avoid loading sframe-channel in parallel with the
|
||||||
@ -1230,6 +1229,8 @@ define([
|
|||||||
};
|
};
|
||||||
addCommonRpc(sframeChan, isSafe);
|
addCommonRpc(sframeChan, isSafe);
|
||||||
|
|
||||||
|
var SecureModal = {};
|
||||||
|
|
||||||
var currentTitle;
|
var currentTitle;
|
||||||
var currentTabTitle;
|
var currentTabTitle;
|
||||||
var titleSuffix = (Utils.Util.find(Utils, ['Instance','name','default']) || '').trim();
|
var titleSuffix = (Utils.Util.find(Utils, ['Instance','name','default']) || '').trim();
|
||||||
@ -1237,12 +1238,16 @@ define([
|
|||||||
titleSuffix = window.location.hostname;
|
titleSuffix = window.location.hostname;
|
||||||
}
|
}
|
||||||
var setDocumentTitle = function () {
|
var setDocumentTitle = function () {
|
||||||
|
var newTitle;
|
||||||
if (!currentTabTitle) {
|
if (!currentTabTitle) {
|
||||||
document.title = currentTitle || 'CryptPad';
|
newTitle = currentTitle || 'CryptPad';
|
||||||
return;
|
} else {
|
||||||
|
var title = currentTabTitle.replace(/\{title\}/g, currentTitle || 'CryptPad');
|
||||||
|
newTitle = title + ' - ' + titleSuffix;
|
||||||
}
|
}
|
||||||
var title = currentTabTitle.replace(/\{title\}/g, currentTitle || 'CryptPad');
|
document.title = newTitle;
|
||||||
document.title = title + ' - ' + titleSuffix;
|
sframeChan.event('EV_IFRAME_TITLE', newTitle);
|
||||||
|
if (SecureModal.modal) { SecureModal.modal.setTitle(newTitle); }
|
||||||
};
|
};
|
||||||
|
|
||||||
var setPadTitle = function (data, cb) {
|
var setPadTitle = function (data, cb) {
|
||||||
@ -1513,7 +1518,6 @@ define([
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Secure modal
|
// Secure modal
|
||||||
var SecureModal = {};
|
|
||||||
// Create or display the iframe and modal
|
// Create or display the iframe and modal
|
||||||
var getPropChannels = function () {
|
var getPropChannels = function () {
|
||||||
var channels = {};
|
var channels = {};
|
||||||
@ -1558,8 +1562,12 @@ define([
|
|||||||
if (!cfg.hidden) {
|
if (!cfg.hidden) {
|
||||||
SecureModal.modal.refresh(cfg, function () {
|
SecureModal.modal.refresh(cfg, function () {
|
||||||
SecureModal.$iframe.show();
|
SecureModal.$iframe.show();
|
||||||
|
setDocumentTitle();
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
SecureModal.modal.refresh(cfg, function () {
|
||||||
|
setDocumentTitle();
|
||||||
|
});
|
||||||
SecureModal.$iframe.hide();
|
SecureModal.$iframe.hide();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -995,6 +995,10 @@ define([
|
|||||||
UI.alert(Messages.chrome68);
|
UI.alert(Messages.chrome68);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
ctx.sframeChan.on('EV_IFRAME_TITLE', function (title) {
|
||||||
|
document.title = title;
|
||||||
|
});
|
||||||
|
|
||||||
funcs.isPadStored(function (err, val) {
|
funcs.isPadStored(function (err, val) {
|
||||||
if (err || !val) { return; }
|
if (err || !val) { return; }
|
||||||
UIElements.displayCrowdfunding(funcs);
|
UIElements.displayCrowdfunding(funcs);
|
||||||
|
|||||||
@ -1,7 +1,6 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html class="cp-app-noscroll">
|
<html class="cp-app-noscroll">
|
||||||
<head>
|
<head>
|
||||||
<title></title>
|
|
||||||
<meta content="text/html; charset=utf-8" http-equiv="content-type"/>
|
<meta content="text/html; charset=utf-8" http-equiv="content-type"/>
|
||||||
<script src="/customize/pre-loading.js?ver=1.1"></script>
|
<script src="/customize/pre-loading.js?ver=1.1"></script>
|
||||||
<link href="/customize/src/pre-loading.css?ver=1.0" rel="stylesheet" type="text/css">
|
<link href="/customize/src/pre-loading.css?ver=1.0" rel="stylesheet" type="text/css">
|
||||||
|
|||||||
@ -24,7 +24,6 @@ define([
|
|||||||
UI
|
UI
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
document.title = Messages.contacts_title;
|
|
||||||
var APP = {};
|
var APP = {};
|
||||||
|
|
||||||
var common;
|
var common;
|
||||||
|
|||||||
@ -12,9 +12,6 @@ define([
|
|||||||
Messages,
|
Messages,
|
||||||
pako,
|
pako,
|
||||||
X2JS) {
|
X2JS) {
|
||||||
Messages.application = "Application"; // XXX
|
|
||||||
Messages.cryptpad_title = "CryptPad"; // XXX
|
|
||||||
document.title = Messages.type.diagram + " " + Messages.application + " - " + Messages.cryptpad_title;
|
|
||||||
const Nacl = window.nacl;
|
const Nacl = window.nacl;
|
||||||
|
|
||||||
// As described here: https://drawio-app.com/extracting-the-xml-from-mxfiles/
|
// As described here: https://drawio-app.com/extracting-the-xml-from-mxfiles/
|
||||||
|
|||||||
@ -31,7 +31,6 @@ define([
|
|||||||
AppConfig,
|
AppConfig,
|
||||||
Messages)
|
Messages)
|
||||||
{
|
{
|
||||||
document.title = Messages.settings_cat_drive;
|
|
||||||
var APP = {};
|
var APP = {};
|
||||||
var SHARED_FOLDER_NAME = Messages.fm_sharedFolderName;
|
var SHARED_FOLDER_NAME = Messages.fm_sharedFolderName;
|
||||||
|
|
||||||
|
|||||||
@ -75,9 +75,6 @@ define([
|
|||||||
Sortable
|
Sortable
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
Messages.application = "Application"; // XXX
|
|
||||||
Messages.cryptpad_title = "CryptPad"; // XXX
|
|
||||||
document.title = Messages.type.form + " " + Messages.application + " - " + Messages.cryptpad_title;
|
|
||||||
var APP = window.APP = {
|
var APP = window.APP = {
|
||||||
blocks: {}
|
blocks: {}
|
||||||
};
|
};
|
||||||
|
|||||||
@ -52,9 +52,6 @@ define([
|
|||||||
jKanban,
|
jKanban,
|
||||||
Export)
|
Export)
|
||||||
{
|
{
|
||||||
Messages.application = "Application"; // XXX
|
|
||||||
Messages.cryptpad_title = "CryptPad"; // XXX
|
|
||||||
document.title = Messages.type.kanban + " " + Messages.application + " - " + Messages.cryptpad_title;
|
|
||||||
var verbose = function (x) { console.log(x); };
|
var verbose = function (x) { console.log(x); };
|
||||||
verbose = function () {}; // comment out to enable verbose logging
|
verbose = function () {}; // comment out to enable verbose logging
|
||||||
var onRedraw = Util.mkEvent();
|
var onRedraw = Util.mkEvent();
|
||||||
|
|||||||
@ -75,9 +75,6 @@ define([
|
|||||||
AppConfig,
|
AppConfig,
|
||||||
Test */
|
Test */
|
||||||
) {
|
) {
|
||||||
Messages.application = "Application"; // XXX
|
|
||||||
Messages.cryptpad_title = "CryptPad"; // XXX
|
|
||||||
document.title = Messages.type.pad + " " + Messages.application + " - " + Messages.cryptpad_title;
|
|
||||||
var DiffDom = window.diffDOM;
|
var DiffDom = window.diffDOM;
|
||||||
|
|
||||||
var slice = function(coll) {
|
var slice = function(coll) {
|
||||||
|
|||||||
@ -1,7 +1,6 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html class="cp-app-noscroll">
|
<html class="cp-app-noscroll">
|
||||||
<head>
|
<head>
|
||||||
<title></title>
|
|
||||||
<meta content="text/html; charset=utf-8" http-equiv="content-type"/>
|
<meta content="text/html; charset=utf-8" http-equiv="content-type"/>
|
||||||
<script src="/customize/pre-loading.js?ver=1.1"></script>
|
<script src="/customize/pre-loading.js?ver=1.1"></script>
|
||||||
<link href="/customize/src/pre-loading.css?ver=1.0" rel="stylesheet" type="text/css">
|
<link href="/customize/src/pre-loading.css?ver=1.0" rel="stylesheet" type="text/css">
|
||||||
|
|||||||
@ -49,7 +49,6 @@ define([
|
|||||||
CodeMirror
|
CodeMirror
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
document.title = Messages.profileButton;
|
|
||||||
var APP = window.APP = {
|
var APP = window.APP = {
|
||||||
_onRefresh: []
|
_onRefresh: []
|
||||||
};
|
};
|
||||||
|
|||||||
@ -187,8 +187,12 @@ define([
|
|||||||
sframeChan.event('EV_REFRESH', data);
|
sframeChan.event('EV_REFRESH', data);
|
||||||
cb();
|
cb();
|
||||||
};
|
};
|
||||||
|
var setTitle = function (title) {
|
||||||
|
sframeChan.event('EV_IFRAME_TITLE', title);
|
||||||
|
};
|
||||||
return {
|
return {
|
||||||
refresh: refresh
|
refresh: refresh,
|
||||||
|
setTitle: setTitle
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
return {
|
return {
|
||||||
|
|||||||
@ -1,7 +1,6 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html class="cp-app-noscroll">
|
<html class="cp-app-noscroll">
|
||||||
<head>
|
<head>
|
||||||
<title></title>
|
|
||||||
<meta content="text/html; charset=utf-8" http-equiv="content-type"/>
|
<meta content="text/html; charset=utf-8" http-equiv="content-type"/>
|
||||||
<script src="/customize/pre-loading.js?ver=1.1"></script>
|
<script src="/customize/pre-loading.js?ver=1.1"></script>
|
||||||
<link href="/customize/src/pre-loading.css?ver=1.0" rel="stylesheet" type="text/css">
|
<link href="/customize/src/pre-loading.css?ver=1.0" rel="stylesheet" type="text/css">
|
||||||
|
|||||||
@ -41,7 +41,6 @@ define([
|
|||||||
Constants,
|
Constants,
|
||||||
Login
|
Login
|
||||||
) {
|
) {
|
||||||
document.title = Messages.settings_title;
|
|
||||||
var saveAs = window.saveAs;
|
var saveAs = window.saveAs;
|
||||||
var APP = window.APP = {};
|
var APP = window.APP = {};
|
||||||
|
|
||||||
|
|||||||
@ -59,9 +59,6 @@ define([
|
|||||||
Messages,
|
Messages,
|
||||||
CMeditor)
|
CMeditor)
|
||||||
{
|
{
|
||||||
Messages.application = "Application"; // XXX
|
|
||||||
Messages.cryptpad_title = "CryptPad"; // XXX
|
|
||||||
document.title = Messages.type.slide + " " + Messages.application + " - " + Messages.cryptpad_title;
|
|
||||||
window.CodeMirror = CMeditor;
|
window.CodeMirror = CMeditor;
|
||||||
|
|
||||||
var SLIDE_BACKCOLOR_ID = "cp-app-slide-toolbar-backcolor";
|
var SLIDE_BACKCOLOR_ID = "cp-app-slide-toolbar-backcolor";
|
||||||
|
|||||||
@ -48,7 +48,6 @@ define([
|
|||||||
Backup,
|
Backup,
|
||||||
Messages)
|
Messages)
|
||||||
{
|
{
|
||||||
document.title = Messages.type.teams;
|
|
||||||
var APP = {
|
var APP = {
|
||||||
teams: {}
|
teams: {}
|
||||||
};
|
};
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user