From a74f52a8d206a6d5c3fe27667f1633bf2fc1374d Mon Sep 17 00:00:00 2001 From: Willi Eggeling Date: Sun, 27 Aug 2017 19:19:59 +0200 Subject: fixed link deletion When deleting links, the js of the default theme separated ids by an escaped space ('+'). There was a trailing '+' after the ids which led to the php code detecting multiple values even for single values. In combination with the id '0' this could led to no id found at all and a resulting php error. this commit fixes the behavior and adds an additional error handling and trimming to the php code. --- tpl/default/js/shaarli.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'tpl/default/js/shaarli.js') diff --git a/tpl/default/js/shaarli.js b/tpl/default/js/shaarli.js index 4f49affa..f38ba62f 100644 --- a/tpl/default/js/shaarli.js +++ b/tpl/default/js/shaarli.js @@ -401,14 +401,14 @@ window.onload = function () { 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; } }); } -- cgit v1.2.3 From 206c45bd05a79b5e6d0c51452a6ac69e85cca0b2 Mon Sep 17 00:00:00 2001 From: ArthurHoaro Date: Sat, 2 Sep 2017 13:50:03 +0200 Subject: Firefox Social title: Use document.title instead of RainTPL variable Fixes #929 --- tpl/default/js/shaarli.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'tpl/default/js/shaarli.js') diff --git a/tpl/default/js/shaarli.js b/tpl/default/js/shaarli.js index 4f49affa..e0b4c752 100644 --- a/tpl/default/js/shaarli.js +++ b/tpl/default/js/shaarli.js @@ -607,10 +607,11 @@ 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}", + name: title, description: "The personal, minimalist, super-fast, database free, bookmarking service by the Shaarli community.", author: "Shaarli", version: "1.0.0", -- cgit v1.2.3 From 9c46b347b8118a127ca965106f66bb4d4d43f427 Mon Sep 17 00:00:00 2001 From: ArthurHoaro Date: Sun, 1 Oct 2017 11:49:17 +0200 Subject: Fix jumpy textarea with long content in post edit We manually reset the scroll position, to avoid height = 'auto' jump to the top Fixes #971 --- tpl/default/js/shaarli.js | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'tpl/default/js/shaarli.js') diff --git a/tpl/default/js/shaarli.js b/tpl/default/js/shaarli.js index 1c66ebbd..55656f80 100644 --- a/tpl/default/js/shaarli.js +++ b/tpl/default/js/shaarli.js @@ -275,8 +275,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 () { -- cgit v1.2.3