X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=tpl%2Fdefault%2Fjs%2Fshaarli.js;h=09b07eeddaaa55710ece3f8dc7541f3054746e70;hb=d8acf8550480694d050091e270a06c01e7b313f0;hp=f38ba62ffdb114e88e2df900836c4f19eeecfd7a;hpb=a74f52a8d206a6d5c3fe27667f1633bf2fc1374d;p=github%2Fshaarli%2FShaarli.git diff --git a/tpl/default/js/shaarli.js b/tpl/default/js/shaarli.js index f38ba62f..09b07eed 100644 --- a/tpl/default/js/shaarli.js +++ b/tpl/default/js/shaarli.js @@ -138,6 +138,9 @@ window.onload = function () { }); 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 }); }); } @@ -146,7 +149,7 @@ window.onload = function () { { // 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'; } @@ -155,7 +158,7 @@ window.onload = function () { } } else { - button.title = 'Fold'; + button.title = document.getElementById('translation-fold').innerHTML; if (description != null) { description.style.display = 'block'; } @@ -173,7 +176,7 @@ window.onload = function () { 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(); } }); @@ -275,8 +278,14 @@ window.onload = function () { }; 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 () { @@ -607,11 +616,12 @@ function htmlEntities(str) function activateFirefoxSocial(node) { var loc = location.href; 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",