# HG changeset patch # User Denis Laxalde # Date 1491205225 -7200 # Node ID 70377de005a0913714d4f61c2a4e0f55e0f3d48d # Parent 654e9a1c8a6ca2af95bae90ecbc4c1d50fe60d2b hgweb: use a function expression for the install listener of followlines UI We define the listener of document's "DOMContentLoaded" inline in registration and use a function expression (anonymous) with everything inside. This makes it clearer that this file is not a library of JavaScript functions but rather an executable script. (Most of changes consists of reindenting the "followlinesBox" function, so mostly white space changes.) diff -r 654e9a1c8a6c -r 70377de005a0 mercurial/templates/static/linerangelog.js --- a/mercurial/templates/static/linerangelog.js Sun Apr 02 12:02:17 2017 +0900 +++ b/mercurial/templates/static/linerangelog.js Mon Apr 03 09:40:25 2017 +0200 @@ -6,7 +6,7 @@ // GNU General Public License version 2 or any later version. //** Install event listeners for line block selection and followlines action */ -function installLineSelect() { +document.addEventListener('DOMContentLoaded', function() { var sourcelines = document.getElementsByClassName('sourcelines')[0]; if (typeof sourcelines === 'undefined') { return; @@ -127,37 +127,35 @@ sourcelines.addEventListener('click', lineSelectStart); -} + //** return a
and inner cancel + var button = document.createElement('button'); + button.textContent = 'x'; + buttonDiv.appendChild(button); + div.appendChild(buttonDiv); - // - var button = document.createElement('button'); - button.textContent = 'x'; - buttonDiv.appendChild(button); - div.appendChild(buttonDiv); - - //