# HG changeset patch # User Alexander Plavin # Date 1373630471 -14400 # Node ID c3cdba6e5d7f06935022639bc339a495eb4f2e93 # Parent 80983af366b5e22cb12c9be5da9b117b4b4acf43 hgweb: toggleDiffstat function instead of showDiffstat and hideDiffstat This eliminates the need of two almost equal functions, makes the code cleaner. diff -r 80983af366b5 -r c3cdba6e5d7f mercurial/templates/paper/changeset.tmpl --- a/mercurial/templates/paper/changeset.tmpl Wed Jul 03 21:50:20 2013 +0900 +++ b/mercurial/templates/paper/changeset.tmpl Fri Jul 12 16:01:11 2013 +0400 @@ -66,9 +66,9 @@ diffstat {diffsummary} - [+] + [+] diff -r 80983af366b5 -r c3cdba6e5d7f mercurial/templates/static/mercurial.js --- a/mercurial/templates/static/mercurial.js Wed Jul 03 21:50:20 2013 +0900 +++ b/mercurial/templates/static/mercurial.js Fri Jul 12 16:01:11 2013 +0400 @@ -265,12 +265,9 @@ } })(document, RegExp, Math, isNaN, Date, false, true) -function showDiffstat() { - document.getElementById('diffstatdetails').style.display = 'inline'; - document.getElementById('diffstatexpand').style.display = 'none'; +function toggleDiffstat() { + var curdetails = document.getElementById('diffstatdetails').style.display; + var curexpand = curdetails == 'none' ? 'inline' : 'none'; + document.getElementById('diffstatdetails').style.display = curexpand; + document.getElementById('diffstatexpand').style.display = curdetails; } - -function hideDiffstat() { - document.getElementById('diffstatdetails').style.display = 'none'; - document.getElementById('diffstatexpand').style.display = 'inline'; -} diff -r 80983af366b5 -r c3cdba6e5d7f tests/test-hgweb-commands.t --- a/tests/test-hgweb-commands.t Wed Jul 03 21:50:20 2013 +0900 +++ b/tests/test-hgweb-commands.t Fri Jul 12 16:01:11 2013 +0400 @@ -423,9 +423,9 @@ 2 files changed, 2 insertions(+), 0 deletions(-) - [+] + [+]