});
foldAllButton.firstElementChild.classList.toggle('fa-chevron-down');
foldAllButton.firstElementChild.classList.toggle('fa-chevron-up');
+ foldAllButton.title = state === 'down'
+ ? document.getElementById('translation-fold-all').innerHTML
+ : document.getElementById('translation-expand-all').innerHTML
});
});
}
{
// Switch fold/expand - up = fold
if (button.classList.contains('fa-chevron-up')) {
- button.title = 'Expand';
+ button.title = document.getElementById('translation-expand').innerHTML;
if (description != null) {
description.style.display = 'none';
}
}
}
else {
- button.title = 'Fold';
+ button.title = document.getElementById('translation-fold').innerHTML;
if (description != null) {
description.style.display = 'block';
}
var deleteLinks = document.querySelectorAll('.confirm-delete');
[].forEach.call(deleteLinks, function(deleteLink) {
deleteLink.addEventListener('click', function(event) {
- if(! confirm('Are you sure you want to delete this link ?')) {
+ if(! confirm(document.getElementById('translation-delete-link').innerHTML)) {
event.preventDefault();
}
});
};
function init () {
function resize () {
+ /* Fix jumpy resizing: https://stackoverflow.com/a/18262927/1484919 */
+ var scrollTop = window.pageYOffset ||
+ (document.documentElement || document.body.parentNode || document.body).scrollTop;
+
description.style.height = 'auto';
description.style.height = description.scrollHeight+10+'px';
+
+ window.scrollTo(0, scrollTop);
}
/* 0-timeout to get the already changed text */
function delayedResize () {
var message = 'Are you sure you want to delete '+ links.length +' links?\n';
message += 'This action is IRREVERSIBLE!\n\nTitles:\n';
- var ids = '';
+ var ids = [];
links.forEach(function(item) {
message += ' - '+ item['title'] +'\n';
- ids += item['id'] +'+';
+ ids.push(item['id']);
});
if (window.confirm(message)) {
- window.location = '?delete_link&lf_linkdate='+ ids +'&token='+ token.value;
+ window.location = '?delete_link&lf_linkdate='+ ids.join('+') +'&token='+ token.value;
}
});
}
function activateFirefoxSocial(node) {
var loc = location.href;
- var baseURL = loc.substring(0, loc.lastIndexOf("/"));
+ var baseURL = loc.substring(0, loc.lastIndexOf("/") + 1);
+ var title = document.title;
// Keeping the data separated (ie. not in the DOM) so that it's maintainable and diffable.
var data = {
- name: "{$shaarlititle}",
- description: "The personal, minimalist, super-fast, database free, bookmarking service by the Shaarli community.",
+ name: title,
+ description: document.getElementById('translation-delete-link').innerHTML,
author: "Shaarli",
version: "1.0.0",
icon32URL: baseURL + "/images/favicon.ico",
icon64URL: baseURL + "/images/favicon.ico",
- shareURL: baseURL + "{noparse}?post=%{url}&title=%{title}&description=%{text}&source=firefoxsocialapi{/noparse}",
+ shareURL: baseURL + "?post=%{url}&title=%{title}&description=%{text}&source=firefoxsocialapi",
homepageURL: baseURL
};
node.setAttribute("data-service", JSON.stringify(data));