Add a button to get the read only URL
This commit is contained in:
@@ -488,6 +488,13 @@ define([
|
||||
|
||||
var $rightside = $bar.find('.' + Toolbar.constants.rightside);
|
||||
|
||||
var editHash;
|
||||
var viewHash = Cryptpad.getViewHashFromKeys(info.channel, secret.keys);
|
||||
|
||||
if (!readOnly) {
|
||||
editHash = Cryptpad.getEditHashFromKeys(info.channel, secret.keys);
|
||||
}
|
||||
|
||||
/* add an export button */
|
||||
var $export = $('<button>', {
|
||||
title: Messages.exportButtonTitle,
|
||||
@@ -559,11 +566,26 @@ define([
|
||||
});
|
||||
$rightside.append($forgetPad);
|
||||
|
||||
/* add a 'links' button */
|
||||
var $links = $('<button>', {
|
||||
title: Messages.linksButtonTitle
|
||||
})
|
||||
.text(Messages.linksButton)
|
||||
.addClass('rightside-button')
|
||||
.click(function () {
|
||||
var baseUrl = window.location.origin + window.location.pathname + '#';
|
||||
var content = '<b>' + Messages.readonlyUrl + '</b> : <a target="_blank">' + baseUrl + viewHash + '</a>';
|
||||
if (!readOnly) {
|
||||
content += '<br><b>' + Messages.editUrl + '</b> : <a target="_blank">' + baseUrl + editHash + '</a>';
|
||||
}
|
||||
Cryptpad.alert(content);
|
||||
});
|
||||
$rightside.append($links);
|
||||
|
||||
// set the hash
|
||||
if (!readOnly) {
|
||||
window.location.hash = Cryptpad.getEditHashFromKeys(info.channel, secret.keys);
|
||||
window.location.hash = editHash;
|
||||
}
|
||||
console.log("View Hash : " + Cryptpad.getViewHashFromKeys(info.channel, secret.keys));
|
||||
|
||||
Cryptpad.getPadTitle(function (err, title) {
|
||||
if (err) {
|
||||
|
||||
Reference in New Issue
Block a user