From 7c0da590e19e3f0b942c6442b2d50c9ab1ef65de Mon Sep 17 00:00:00 2001 From: Christophe Matthieu Date: Wed, 16 Oct 2013 12:45:45 +0200 Subject: [IMP] website: after save reload page with the same scrolling bzr revid: chm@openerp.com-20131016104545-e415ixicw2crci2w --- addons/website/static/src/js/website.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'addons/website/static/src/js/website.js') diff --git a/addons/website/static/src/js/website.js b/addons/website/static/src/js/website.js index 1f4e54b43df..963a0b1664d 100644 --- a/addons/website/static/src/js/website.js +++ b/addons/website/static/src/js/website.js @@ -38,7 +38,12 @@ return $.when.apply(null, dones); }; website.reload = function () { - window.location.href = window.location.href.replace(/unable_editor(=[^&]*)?|#.*/g, ''); + location.hash = "scrollTop=" + window.document.body.scrollTop; + if (location.search.indexOf("unable_editor") > -1) { + window.location.href = window.location.href.replace(/unable_editor(=[^&]*)?/g, ''); + } else { + window.location.reload(); + } }; var all_ready = null; @@ -167,6 +172,11 @@ website.init_kanban(this); }); + setTimeout(function () { + if (window.location.hash.indexOf("scrollTop=") > -1) { + window.document.body.scrollTop = +location.hash.match(/scrollTop=([0-9]+)/)[1]; + } + },0); }); return website; -- cgit v1.2.3