diff mercurial/templates/static/mercurial.js @ 19428:c3cdba6e5d7f

hgweb: toggleDiffstat function instead of showDiffstat and hideDiffstat This eliminates the need of two almost equal functions, makes the code cleaner.
author Alexander Plavin <me@aplavin.ru>
date Fri, 12 Jul 2013 16:01:11 +0400
parents fa714f3ed298
children 5ec5097b4c0f
line wrap: on
line diff
--- 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';
-}