Hide the trash icon for read-only pads if we have the edit link in drive
This commit is contained in:
parent
02cc9c8344
commit
3fd5669647
@ -56,6 +56,9 @@
|
|||||||
margin-left: 5px;
|
margin-left: 5px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
&.hidden {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.cryptpad-lag {
|
.cryptpad-lag {
|
||||||
|
|||||||
@ -128,6 +128,9 @@
|
|||||||
.cryptpad-toolbar button#shareButton .large {
|
.cryptpad-toolbar button#shareButton .large {
|
||||||
margin-left: 5px;
|
margin-left: 5px;
|
||||||
}
|
}
|
||||||
|
.cryptpad-toolbar button.hidden {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
.cryptpad-toolbar .cryptpad-lag {
|
.cryptpad-toolbar .cryptpad-lag {
|
||||||
box-sizing: content-box;
|
box-sizing: content-box;
|
||||||
height: 16px;
|
height: 16px;
|
||||||
|
|||||||
@ -581,6 +581,21 @@ define([
|
|||||||
};
|
};
|
||||||
|
|
||||||
// STORAGE
|
// STORAGE
|
||||||
|
var isNotStrongestStored = common.isNotStrongestStored = function (href, recents) {
|
||||||
|
var parsed = parsePadUrl(href);
|
||||||
|
return recents.some(function (pad) {
|
||||||
|
var p = parsePadUrl(pad.href);
|
||||||
|
if (p.type !== parsed.type) { return false; } // Not the same type
|
||||||
|
if (p.hash === parsed.hash) { return false; } // Same hash, not stronger
|
||||||
|
var pHash = parseHash(p.hash);
|
||||||
|
var parsedHash = parseHash(parsed.hash);
|
||||||
|
if (pHash.version !== parsedHash.version) { return false; }
|
||||||
|
if (pHash.channel !== parsedHash.channel) { return false; }
|
||||||
|
if (pHash.mode === 'edit' && parsedHash.mode === 'view') { return true; }
|
||||||
|
if (pHash.mode === parsedHash.mode && parsedHash.present) { return true; }
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
};
|
||||||
var setPadTitle = common.setPadTitle = function (name, cb) {
|
var setPadTitle = common.setPadTitle = function (name, cb) {
|
||||||
var href = window.location.href;
|
var href = window.location.href;
|
||||||
var parsed = parsePadUrl(href);
|
var parsed = parsePadUrl(href);
|
||||||
@ -893,6 +908,11 @@ define([
|
|||||||
'class': "fa fa-trash cryptpad-forget",
|
'class': "fa fa-trash cryptpad-forget",
|
||||||
style: 'font:'+size+' FontAwesome'
|
style: 'font:'+size+' FontAwesome'
|
||||||
});
|
});
|
||||||
|
getRecentPads(function (err, recent) {
|
||||||
|
if (isNotStrongestStored(window.location.href, recent)) {
|
||||||
|
button.addClass('hidden');
|
||||||
|
}
|
||||||
|
});
|
||||||
if (callback) {
|
if (callback) {
|
||||||
button.click(function() {
|
button.click(function() {
|
||||||
var href = window.location.href;
|
var href = window.location.href;
|
||||||
@ -1067,7 +1087,8 @@ define([
|
|||||||
var createLanguageSelector = common.createLanguageSelector = function ($container, $initBlock) {
|
var createLanguageSelector = common.createLanguageSelector = function ($container, $initBlock) {
|
||||||
var options = [];
|
var options = [];
|
||||||
var languages = Messages._languages;
|
var languages = Messages._languages;
|
||||||
for (var l in languages) {
|
var keys = Object.keys(languages).sort();
|
||||||
|
keys.forEach(function (l) {
|
||||||
options.push({
|
options.push({
|
||||||
tag: 'a',
|
tag: 'a',
|
||||||
attributes: {
|
attributes: {
|
||||||
@ -1077,7 +1098,7 @@ define([
|
|||||||
},
|
},
|
||||||
content: languages[l] // Pretty name of the language value
|
content: languages[l] // Pretty name of the language value
|
||||||
});
|
});
|
||||||
}
|
});
|
||||||
var dropdownConfig = {
|
var dropdownConfig = {
|
||||||
text: Messages.language, // Button initial text
|
text: Messages.language, // Button initial text
|
||||||
options: options, // Entries displayed in the menu
|
options: options, // Entries displayed in the menu
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user