Merge branch 'master' of github.com:xwiki-labs/cryptpad

pull/1/head
Caleb James DeLisle 8 years ago
commit 516e25f0dc

@ -1,6 +1,7 @@
<!DOCTYPE html>
<html class="cp code">
<head>
<title>CryptPad</title>
<meta content="text/html; charset=utf-8" http-equiv="content-type"/>
<script data-main="main" src="/bower_components/requirejs/require.js"></script>
<script>

@ -174,7 +174,9 @@ define([
defaultTitle: defaultName
}
};
obj.metadata.title = document.title;
if (!initializing) {
obj.metadata.title = document.title;
}
// set mode too...
obj.highlightMode = module.highlightMode;
@ -348,6 +350,7 @@ define([
var updateMetadata = function(shjson) {
// Extract the user list (metadata) from the hyperjson
var json = (shjson === "") ? "" : JSON.parse(shjson);
var titleUpdated = false;
if (json && json.metadata) {
if (json.metadata.users) {
var userData = json.metadata.users;
@ -358,9 +361,13 @@ define([
updateDefaultTitle(json.metadata.defaultTitle);
}
if (typeof json.metadata.title !== "undefined") {
updateTitle(json.metadata.title);
updateTitle(json.metadata.title || defaultName);
titleUpdated = true;
}
}
if (!titleUpdated) {
updateTitle(defaultName);
}
};
var onInit = config.onInit = function (info) {
@ -500,15 +507,6 @@ define([
// set the hash
if (!readOnly) { Cryptpad.replaceHash(editHash); }
Cryptpad.getPadTitle(function (err, title) {
if (err) {
console.log("Unable to get pad title");
console.error(err);
return;
}
updateTitle(title || defaultName);
});
};
var unnotify = module.unnotify = function () {

@ -1,6 +1,7 @@
<!DOCTYPE html>
<html class="cp pad">
<head>
<title>CryptPad</title>
<meta content="text/html; charset=utf-8" http-equiv="content-type"/>
<link rel="icon" type="image/png"
href="/customize/main-favicon.png"

@ -370,7 +370,9 @@ define([
defaultTitle: defaultName
}
};
hjson[3].metadata.title = document.title;
if (!initializing) {
hjson[3].metadata.title = document.title;
}
return stringify(hjson);
};
@ -438,6 +440,7 @@ define([
// Extract the user list (metadata) from the hyperjson
var hjson = JSON.parse(shjson);
var peerMetadata = hjson[3];
var titleUpdated = false;
if (peerMetadata && peerMetadata.metadata) {
if (peerMetadata.metadata.users) {
var userData = peerMetadata.metadata.users;
@ -448,9 +451,13 @@ define([
updateDefaultTitle(peerMetadata.metadata.defaultTitle);
}
if (typeof peerMetadata.metadata.title !== "undefined") {
updateTitle(peerMetadata.metadata.title);
updateTitle(peerMetadata.metadata.title || defaultName);
titleUpdated = true;
}
}
if (!titleUpdated) {
updateTitle(defaultName);
}
};
var unnotify = function () {
@ -622,15 +629,6 @@ define([
// set the hash
if (!readOnly) { Cryptpad.replaceHash(editHash); }
Cryptpad.getPadTitle(function (err, title) {
if (err) {
console.error(err);
console.log("Couldn't get pad title");
return;
}
updateTitle(title || defaultName);
});
};
// this should only ever get called once, when the chain syncs

@ -466,10 +466,13 @@ define([
var renameCb = function (err, title) {
if (err) { return; }
document.title = title;
APP.proxy.info.title = title;
APP.proxy.info.title = title === defaultName ? "" : title;
};
var suggestName = function (fallback) {
if (document.title === defaultName) {
return fallback || "";
}
return document.title || defaultName || "";
};
@ -692,15 +695,6 @@ define([
// set the hash
if (!readOnly) { Cryptpad.replaceHash(editHash); }
Cryptpad.getPadTitle(function (err, title) {
if (err) {
console.error(err);
console.log("Couldn't get pad title");
return;
}
updateTitle(title || defaultName);
});
};
var disconnect = function (info) {

@ -1,6 +1,7 @@
<!DOCTYPE html>
<html class="cp slide">
<head>
<title>CryptPad</title>
<meta content="text/html; charset=utf-8" http-equiv="content-type"/>
<script data-main="main" src="/bower_components/requirejs/require.js"></script>
<script>

@ -215,7 +215,9 @@ define([
defaultTitle: defaultName
}
};
obj.metadata.title = APP.title;
if (!initializing) {
obj.metadata.title = APP.title;
}
if (textColor) {
obj.metadata.color = textColor;
}
@ -383,6 +385,7 @@ define([
var updateMetadata = function(shjson) {
// Extract the user list (metadata) from the hyperjson
var json = (shjson === "") ? "" : JSON.parse(shjson);
var titleUpdated = false;
if (json && json.metadata) {
if (json.metadata.users) {
var userData = json.metadata.users;
@ -393,10 +396,14 @@ define([
updateDefaultTitle(json.metadata.defaultTitle);
}
if (typeof json.metadata.title !== "undefined") {
updateTitle(json.metadata.title);
updateTitle(json.metadata.title || defaultName);
titleUpdated = true;
}
updateColors(json.metadata.color, json.metadata.backColor);
}
if (!titleUpdated) {
updateTitle(defaultName);
}
};
var renameCb = function (err, title) {
@ -589,15 +596,6 @@ define([
if (!window.location.hash || window.location.hash === '#') {
Cryptpad.replaceHash(editHash);
}
Cryptpad.getPadTitle(function (err, title) {
if (err) {
console.log("Unable to get pad title");
console.error(err);
return;
}
updateTitle(title || defaultName);
});
};
var unnotify = module.unnotify = function () {

Loading…
Cancel
Save