Modified: comdev/reporter.apache.org/trunk/site/wizard/js/wizard.js
URL: 
http://svn.apache.org/viewvc/comdev/reporter.apache.org/trunk/site/wizard/js/wizard.js?rev=1926997&r1=1926996&r2=1926997&view=diff
==============================================================================
--- comdev/reporter.apache.org/trunk/site/wizard/js/wizard.js (original)
+++ comdev/reporter.apache.org/trunk/site/wizard/js/wizard.js Sun Jul  6 
12:44:52 2025
@@ -23,17 +23,17 @@
 ******************************************/
 
 // URL calls currently 'in escrow'. This controls the spinny wheel animation
-var async_escrow = {}
-var async_maxwait = 250; // ms to wait before displaying spinner
-var async_status = 'clear';
-var async_cache = {}
-var no_spinner = true;
+let async_escrow = {}
+let async_maxwait = 250; // ms to wait before displaying spinner
+let async_status = 'clear';
+let async_cache = {}
+let no_spinner = true;
 
 // Escrow spinner check
 async function escrow_check() {
     let now = new Date();
     let show_spinner = false;
-    for (var k in async_escrow) {
+    for (let k in async_escrow) {
         if ( (now - async_escrow[k]) > async_maxwait ) {
             show_spinner = true;
             break;
@@ -78,8 +78,8 @@ async function GET(url, callback, state,
     method = method || 'get'
     console.log("Fetching JSON resource at %s".format(url))
     let pkey = "GET-%s-%s".format(callback, url);
-    let res = undefined;
-    let res_json = undefined;
+    let res;
+    let res_json;
     state = state || {};
     state.url = url;
     if (state && state.cached === true && async_cache[url]) {
@@ -213,7 +213,7 @@ Number.prototype.pretty = function(fix)
  */
 
 Number.prototype.pad = function(n) {
-  var str;
+  let str;
   str = String(this);
 
   /* Do we need to pad? if so, do it using String.repeat */
@@ -227,7 +227,7 @@ Number.prototype.pad = function(n) {
 /* Func for converting a date to YYYY-MM-DD HH:MM */
 
 Date.prototype.ISOBare = function() {
-  var M, d, h, m, y;
+  let M, d, h, m, y;
   y = this.getFullYear();
   m = (this.getMonth() + 1).pad(2);
   d = this.getDate().pad(2);
@@ -254,7 +254,7 @@ isHash = function(value) {
 /* Remove an array element by value */
 
 Array.prototype.remove = function(val) {
-  var i, item, j, len;
+  let i, item, j, len;
   for (i = j = 0, len = this.length; j < len; i = ++j) {
     item = this[i];
     if (item === val) {
@@ -268,7 +268,7 @@ Array.prototype.remove = function(val) {
 
 /* Check if array has value */
 Array.prototype.has = function(val) {
-  var i, item, j, len;
+  let i, item, j, len;
   for (i = j = 0, len = this.length; j < len; i = ++j) {
     item = this[i];
     if (item === val) {
@@ -283,10 +283,10 @@ Array.prototype.has = function(val) {
  Fetched from source/datepicker.js
 ******************************************/
 
-var months = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 
'August', 'September', 'October', 'November', 'December'];
-var datepicker_spawner = null
-var calendarpicker_spawner = null
-var units = {
+let months = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 
'August', 'September', 'October', 'November', 'December'];
+let datepicker_spawner = null
+let calendarpicker_spawner = null
+let units = {
     w: 'week',
     d: 'day',
     M: 'month',
@@ -305,7 +305,7 @@ function fixupPicker(obj) {
 }
 // makeSelect: Creates a <select> object with options
 function makeSelect(options, id, selval) {
-    var sel = document.createElement('select')
+    let sel = document.createElement('select')
     sel.addEventListener("focus", function(event){
         $('html').on('hide.bs.dropdown', function (e) {
             return false;
@@ -317,8 +317,8 @@ function makeSelect(options, id, selval)
     sel.setAttribute("name", id)
     sel.setAttribute("id", id)
     // For each options element, create it in the DOM
-    for (var key in options) {
-        var opt = document.createElement('option')
+    for (let key in options) {
+        let opt = document.createElement('option')
         // Hash or array?
         if (typeof key == "string") {
             opt.setAttribute("value", key)
@@ -342,15 +342,15 @@ function makeSelect(options, id, selval)
 // and puts div2 into the right column,
 // and 'name' as text in the left one.
 function splitDiv(id, name, div2) {
-    var div = document.createElement('div')
-    var subdiv = document.createElement('div')
-    var radio = document.createElement('input')
+    let div = document.createElement('div')
+    let subdiv = document.createElement('div')
+    let radio = document.createElement('input')
     radio.setAttribute("type", "radio")
     radio.setAttribute("name", "datepicker_radio")
     radio.setAttribute("value", name)
     radio.setAttribute("id", "datepicker_radio_" + id)
     radio.setAttribute("onclick", "calcTimespan('"+ id + "')")
-    var label = document.createElement('label')
+    let label = document.createElement('label')
     label.innerHTML = "&nbsp; " + name + ": "
     label.setAttribute("for", "datepicker_radio_" + id)
     
@@ -376,15 +376,15 @@ function splitDiv(id, name, div2) {
 // for the datepicker choice and puts it in the datepicker's
 // spawning input/select element.
 function calcTimespan(what) {
-    var wat = ""
-    var tval = ""
+    let wat = ""
+    let tval = ""
     
     // Less than N units ago?
     if (what == 'lt') {
         // Get unit and how many units
-        var N = document.getElementById('datepicker_lti').value
-        var unit = document.getElementById('datepicker_lts').value
-        var unitt = units[unit]
+        let N = document.getElementById('datepicker_lti').value
+        let unit = document.getElementById('datepicker_lts').value
+        let unitt = units[unit]
         if (parseInt(N) != 1) {
             unitt += "s"
         }
@@ -400,9 +400,9 @@ function calcTimespan(what) {
     // More than N units ago?
     if (what == 'mt') {
         // As above, get unit and no of units.
-        var N = document.getElementById('datepicker_mti').value
-        var unit = document.getElementById('datepicker_mts').value
-        var unitt = units[unit]
+        let N = document.getElementById('datepicker_mti').value
+        let unit = document.getElementById('datepicker_mts').value
+        let unitt = units[unit]
         if (parseInt(N) != 1) {
             unitt += "s"
         }
@@ -417,8 +417,8 @@ function calcTimespan(what) {
     // Date range?
     if (what == 'cd') {
         // Get From and To values
-        var f = document.getElementById('datepicker_cfrom').value
-        var t = document.getElementById('datepicker_cto').value
+        let f = document.getElementById('datepicker_cfrom').value
+        let t = document.getElementById('datepicker_cto').value
         // construct timespan val + description if both from and to are valid
         if (f.length > 0 && t.length > 0) {
             wat = "From " + f + " to " + t
@@ -444,12 +444,12 @@ function calcTimespan(what) {
 // timespan options right next to the parent caller.
 function datePicker(parent, seedPeriod) {
     datepicker_spawner = parent
-    var div = document.getElementById('datepicker_popup')
+    let div = document.getElementById('datepicker_popup')
     
     // If the datepicker object doesn't exist, spawn it
     if (!div) {
         div = document.createElement('div')
-        var id = parseInt(Math.random() * 10000).toString(16)
+        let id = parseInt(Math.random() * 10000).toString(16)
         div.setAttribute("id", "datepicker_popup")
         div.setAttribute("class", "datepicker")
     }
@@ -459,21 +459,21 @@ function datePicker(parent, seedPeriod)
     div.style.display = "block"
     
     // Position the datepicker next to whatever called it
-    var bb = parent.getBoundingClientRect()
+    let bb = parent.getBoundingClientRect()
     div.style.top = (bb.bottom + 8) + "px"
     div.style.left = (bb.left + 32) + "px"
     
     
     // -- Less than N $units ago
-    var ltdiv = document.createElement('div')
-    var lti = document.createElement('input')
+    let ltdiv = document.createElement('div')
+    let lti = document.createElement('input')
     lti.setAttribute("id", "datepicker_lti")
     lti.style.width = "48px"
     lti.setAttribute("onkeyup", "calcTimespan('lt')")
     lti.setAttribute("onblur", "calcTimespan('lt')")
     ltdiv.appendChild(lti)
     
-    var lts = makeSelect({
+    let lts = makeSelect({
         'd': "Day(s)",
         'w': 'Week(s)',
         'M': "Month(s)",
@@ -487,9 +487,9 @@ function datePicker(parent, seedPeriod)
     
     
     // -- More than N $units ago
-    var mtdiv = document.createElement('div')
+    let mtdiv = document.createElement('div')
     
-    var mti = document.createElement('input')
+    let mti = document.createElement('input')
     mti.style.width = "48px"
     mti.setAttribute("id", "datepicker_mti")
     mti.setAttribute("onkeyup", "calcTimespan('mt')")
@@ -497,7 +497,7 @@ function datePicker(parent, seedPeriod)
     mtdiv.appendChild(mti)
     
     
-    var mts = makeSelect({
+    let mts = makeSelect({
         'd': "Day(s)",
         'w': 'Week(s)',
         'M': "Month(s)",
@@ -512,9 +512,9 @@ function datePicker(parent, seedPeriod)
     
     // -- Calendar timespan
     // This is just two text fields, the calendarPicker sub-plugin populates 
them
-    var cdiv = document.createElement('div')
+    let cdiv = document.createElement('div')
     
-    var cfrom = document.createElement('input')
+    let cfrom = document.createElement('input')
     cfrom.style.width = "90px"
     cfrom.setAttribute("id", "datepicker_cfrom")
     cfrom.setAttribute("onfocus", "showCalendarPicker(this)")
@@ -522,7 +522,7 @@ function datePicker(parent, seedPeriod)
     cdiv.appendChild(document.createTextNode('From: '))
     cdiv.appendChild(cfrom)
     
-    var cto = document.createElement('input')
+    let cto = document.createElement('input')
     cto.style.width = "90px"
     cto.setAttribute("id", "datepicker_cto")
     cto.setAttribute("onfocus", "showCalendarPicker(this)")
@@ -535,7 +535,7 @@ function datePicker(parent, seedPeriod)
     
     
     // -- Magic button that sends the timespan back to the caller
-    var okay = document.createElement('input')
+    let okay = document.createElement('input')
     okay.setAttribute("type", "button")
     okay.setAttribute("value", "Okay")
     okay.setAttribute("onclick", "setDatepickerDate()")
@@ -548,18 +548,18 @@ function datePicker(parent, seedPeriod)
     // This is for recalcing the set options if spawned from a
     // select/input box with an existing value derived from an
     // earlier call to datePicker
-    var ptype = ""
-    var pvalue = parent.hasAttribute("data") ? parent.getAttribute("data") : 
parent.value
+    let ptype = ""
+    let pvalue = parent.hasAttribute("data") ? parent.getAttribute("data") : 
parent.value
     if (pvalue.search(/=|-/) != -1) {
         
         // Less than N units ago?
         if (pvalue.match(/lte/)) {
-            var m = pvalue.match(/lte=(\d+)([dMyw])/)
+            let m = pvalue.match(/lte=(\d+)([dMyw])/)
             ptype = 'lt'
             if (m) {
                 document.getElementById('datepicker_lti').value = m[1]
-                var sel = document.getElementById('datepicker_lts')
-                for (var i in sel.options) {
+                let sel = document.getElementById('datepicker_lts')
+                for (let i in sel.options) {
                     if (parseInt(i) >= 0) {
                         if (sel.options[i].value == m[2]) {
                             sel.options[i].selected = "selected"
@@ -575,12 +575,12 @@ function datePicker(parent, seedPeriod)
         // More than N units ago?
         if (pvalue.match(/gte/)) {
             ptype = 'mt'
-            var m = pvalue.match(/gte=(\d+)([dMyw])/)
+            let m = pvalue.match(/gte=(\d+)([dMyw])/)
             if (m) {
                 document.getElementById('datepicker_mti').value = m[1]
-                var sel = document.getElementById('datepicker_mts')
+                let sel = document.getElementById('datepicker_mts')
                 // Go through the unit values, select the one we use
-                for (var i in sel.options) {
+                for (let i in sel.options) {
                     if (parseInt(i) >= 0) {
                         if (sel.options[i].value == m[2]) {
                             sel.options[i].selected = "selected"
@@ -596,8 +596,8 @@ function datePicker(parent, seedPeriod)
         if (pvalue.match(/dfr/)) {
             ptype = 'cd'
             // Make sure we have both a dfr and a dto here, catch them
-            var mf = pvalue.match(/dfr=(\d+-\d+-\d+)/)
-            var mt = pvalue.match(/dto=(\d+-\d+-\d+)/)
+            let mf = pvalue.match(/dfr=(\d+-\d+-\d+)/)
+            let mt = pvalue.match(/dto=(\d+-\d+-\d+)/)
             if (mf && mt) {
                 // easy peasy, just set two text fields!
                 document.getElementById('datepicker_cfrom').value = mf[1]
@@ -608,11 +608,11 @@ function datePicker(parent, seedPeriod)
         if (pvalue.match(/(\d{4})-(\d+)/)) {
             ptype = 'cd'
             // Make sure we have both a dfr and a dto here, catch them
-            var m = pvalue.match(/(\d{4})-(\d+)/)
+            let m = pvalue.match(/(\d{4})-(\d+)/)
             if (m.length == 3) {
                 // easy peasy, just set two text fields!
-                var dfrom = new Date(parseInt(m[1]),parseInt(m[2])-1,1, 0, 0, 
0)
-                var dto = new Date(parseInt(m[1]),parseInt(m[2]),0, 23, 59, 59)
+                let dfrom = new Date(parseInt(m[1]),parseInt(m[2])-1,1, 0, 0, 
0)
+                let dto = new Date(parseInt(m[1]),parseInt(m[2]),0, 23, 59, 59)
                 document.getElementById('datepicker_cfrom').value = m[0] + "-" 
+ dfrom.getDate()
                 document.getElementById('datepicker_cto').value = m[0] + "-" + 
dto.getDate()
             }
@@ -626,15 +626,15 @@ function datePickerValue(seedPeriod) {
     // This is for recalcing the set options if spawned from a
     // select/input box with an existing value derived from an
     // earlier call to datePicker
-    var ptype = ""
-    var rv = seedPeriod
+    let ptype = ""
+    let rv = seedPeriod
     if (seedPeriod && seedPeriod.search && seedPeriod.search(/=|-/) != -1) {
         
         // Less than N units ago?
         if (seedPeriod.match(/lte/)) {
-            var m = seedPeriod.match(/lte=(\d+)([dMyw])/)
+            let m = seedPeriod.match(/lte=(\d+)([dMyw])/)
             ptype = 'lt'
-            var unitt = units[m[2]]
+            let unitt = units[m[2]]
             if (parseInt(m[1]) != 1) {
                 unitt += "s"
             }
@@ -644,8 +644,8 @@ function datePickerValue(seedPeriod) {
         // More than N units ago?
         if (seedPeriod.match(/gte/)) {
             ptype = 'mt'
-            var m = seedPeriod.match(/gte=(\d+)([dMyw])/)
-            var unitt = units[m[2]]
+            let m = seedPeriod.match(/gte=(\d+)([dMyw])/)
+            let unitt = units[m[2]]
             if (parseInt(m[1]) != 1) {
                 unitt += "s"
             }
@@ -655,8 +655,8 @@ function datePickerValue(seedPeriod) {
         // Date range?
         if (seedPeriod.match(/dfr/)) {
             ptype = 'cd'
-            var mf = seedPeriod.match(/dfr=(\d+-\d+-\d+)/)
-            var mt = seedPeriod.match(/dto=(\d+-\d+-\d+)/)
+            let mf = seedPeriod.match(/dfr=(\d+-\d+-\d+)/)
+            let mt = seedPeriod.match(/dto=(\d+-\d+-\d+)/)
             if (mf && mt) {
                 rv = "From " + mf[1] + " to " + mt[1]
             }
@@ -665,7 +665,7 @@ function datePickerValue(seedPeriod) {
         // Month??
         if (seedPeriod.match(/^(\d+)-(\d+)$/)) {
             ptype = 'mr' // just a made up thing...(month range)
-            var mr = seedPeriod.match(/(\d+)-(\d+)/)
+            let mr = seedPeriod.match(/(\d+)-(\d+)/)
             if (mr) {
                 dfrom = new Date(parseInt(mr[1]),parseInt(mr[2])-1,1, 0, 0, 0)
                 rv = months[dfrom.getMonth()] + ', ' + mr[1]
@@ -680,19 +680,19 @@ function datePickerDouble(seedPeriod) {
     // This basically takes a date-arg and doubles it backwards
     // so >=3M becomes =>6M etc. Also returns the cutoff for
     // the original date and the span in days of the original
-    var ptype = ""
-    var rv = seedPeriod
-    var dbl = seedPeriod
-    var tspan = 1
-    var dfrom = new Date()
-    var dto = new Date()
+    let ptype = ""
+    let rv = seedPeriod
+    let dbl = seedPeriod
+    let tspan = 1
+    let dfrom = new Date()
+    let dto = new Date()
     
     // datepicker range?
     if (seedPeriod && seedPeriod.search && seedPeriod.search(/=/) != -1) {
         
         // Less than N units ago?
         if (seedPeriod.match(/lte/)) {
-            var m = seedPeriod.match(/lte=(\d+)([dMyw])/)
+            let m = seedPeriod.match(/lte=(\d+)([dMyw])/)
             ptype = 'lt'
             rv = "<" + m[1] + m[2] + " ago"
             dbl = "lte=" + (parseInt(m[1])*2) + m[2]
@@ -724,7 +724,7 @@ function datePickerDouble(seedPeriod) {
         // More than N units ago?
         if (seedPeriod.match(/gte/)) {
             ptype = 'mt'
-            var m = seedPeriod.match(/gte=(\d+)([dMyw])/)
+            let m = seedPeriod.match(/gte=(\d+)([dMyw])/)
             rv = ">" + m[1] + m[2] + " ago"
             dbl = "gte=" + (parseInt(m[1])*2) + m[2]
             tspan = parseInt(parseInt(m[1]) * 30.4)
@@ -759,8 +759,8 @@ function datePickerDouble(seedPeriod) {
         if (seedPeriod.match(/dfr/)) {
             ptype = 'cd'
             // Find from and to
-            var mf = seedPeriod.match(/dfr=(\d+)-(\d+)-(\d+)/)
-            var mt = seedPeriod.match(/dto=(\d+)-(\d+)-(\d+)/)
+            let mf = seedPeriod.match(/dfr=(\d+)-(\d+)-(\d+)/)
+            let mt = seedPeriod.match(/dto=(\d+)-(\d+)-(\d+)/)
             if (mf && mt) {
                 rv = "from " + mf[1] + " to " + mt[1]
                 // Starts at 00:00:00 on from date
@@ -773,7 +773,7 @@ function datePickerDouble(seedPeriod) {
                 tspan = parseInt((dto.getTime() - dfrom.getTime() + 5000) / 
(1000*86400))
                 
                 // double the distance
-                var dpast = new Date(dfrom)
+                let dpast = new Date(dfrom)
                 dpast.setDate(dpast.getDate() - tspan)
                 dbl = seedPeriod.replace(/dfr=[^|]+/, "dfr=" + 
(dpast.getFullYear()) + '-' + (dpast.getMonth()+1) + '-' + dpast.getDate())
             } else {
@@ -793,7 +793,7 @@ function datePickerDouble(seedPeriod) {
     else if (seedPeriod.match(/^(\d+)-(\d+)$/)) {
         // just a made up thing...(month range)
         ptype = 'mr' 
-        var mr = seedPeriod.match(/(\d+)-(\d+)/)
+        let mr = seedPeriod.match(/(\d+)-(\d+)/)
         if (mr) {
             rv = seedPeriod
             // Same as before, start at 00:00:00
@@ -805,7 +805,7 @@ function datePickerDouble(seedPeriod) {
             tspan = parseInt((dto.getTime() - dfrom.getTime() + 5000) / 
(1000*86400))
             
             // Double timespan
-            var dpast = new Date(dfrom)
+            let dpast = new Date(dfrom)
             dpast.setDate(dpast.getDate() - tspan)
             dbl = "dfr=" + (dpast.getFullYear()) + '-' + (dpast.getMonth()+1) 
+ '-' + dpast.getDate() + "|dto=" + (dto.getFullYear()) + '-' + 
(dto.getMonth()+1) + '-' + dto.getDate()
         } else {
@@ -842,7 +842,7 @@ function findParent(el, name) {
 
 // function for hiding the date picker
 function blurDatePicker(evt) {
-    var es = evt ? (evt.target || evt.srcElement) : null;
+    let es = evt ? (evt.target || evt.srcElement) : null;
     if ((!es || !es.parentNode || (!findParent(es, "datepicker_popup") && 
!findParent(es, "calendarpicker_popup"))) && !(es ? es : 
"null").toString().match(/javascript:void/)) {
         document.getElementById('datepicker_popup').style.display = "none"
         $('html').trigger('hide.bs.dropdown')
@@ -856,28 +856,28 @@ function drawCalendarPicker(obj, date) {
     obj.focus()
     
     // Default to NOW for calendar.
-    var now = new Date()
+    let now = new Date()
     
     // if called with an existing date (YYYY-MM-DD),
     // convert it to a JS date object and use that for
     // rendering the calendar
     if (date) {
-        var ar = date.split(/-/)
+        let ar = date.split(/-/)
         now = new Date(ar[0],parseInt(ar[1])-1,ar[2])
     }
-    var days = ['Mon','Tue','Wed','Thu','Fri','Sat','Sun']
-    var mat = now
+    let days = ['Mon','Tue','Wed','Thu','Fri','Sat','Sun']
+    let mat = now
     
     // Go to first day of the month
     mat.setDate(1)
     
     obj.innerHTML = "<h3>" + months[mat.getMonth()] + ", " + mat.getFullYear() 
+ ":</h3>"
-    var tm = mat.getMonth()
+    let tm = mat.getMonth()
     
     // -- Nav buttons --
     
     // back-a-year button
-    var a = document.createElement('a')
+    let a = document.createElement('a')
     fixupPicker(a)
     a.setAttribute("onclick", "drawCalendarPicker(this.parentNode, '" + 
(mat.getFullYear()-1) + '-' + (mat.getMonth()+1) + '-' + mat.getDate() + "');")
     a.setAttribute("href", "javascript:void(0);")
@@ -911,15 +911,15 @@ function drawCalendarPicker(obj, date) {
     
     
     // Table containing the dates of the selected month
-    var table = document.createElement('table')
+    let table = document.createElement('table')
     
     table.setAttribute("border", "1")
     table.style.margin = "0 auto"
     
     // Add header day names
-    var tr = document.createElement('tr');
-    for (var m = 0; m < 7; m++) {
-        var td = document.createElement('th')
+    let tr = document.createElement('tr');
+    for (let m = 0; m < 7; m++) {
+        let td = document.createElement('th')
         td.innerHTML = days[m]
         tr.appendChild(td)
     }
@@ -927,13 +927,13 @@ function drawCalendarPicker(obj, date) {
     
     // Until we hit the first day in a month, add blank days
     tr = document.createElement('tr');
-    var weekday = mat.getDay()
+    let weekday = mat.getDay()
     if (weekday == 0) {
         weekday = 7
     }
     weekday--;
-    for (var i = 0; i < weekday; i++) {
-        var td = document.createElement('td')
+    for (let i = 0; i < weekday; i++) {
+        let td = document.createElement('td')
         tr.appendChild(td)
     }
     
@@ -969,7 +969,7 @@ function setCalendarDate(what) {
     
     
     calendarpicker_spawner.value = what
-    var div = document.getElementById('calendarpicker_popup')
+    let div = document.getElementById('calendarpicker_popup')
     div.parentNode.focus()
     div.style.display = "none"
     calcTimespan('cd')
@@ -981,14 +981,14 @@ function showCalendarPicker(parent, seed
     
     // If supplied with a YYYY-MM-DD date, use this to seed the calendar
     if (!seedDate) {
-        var m = parent.value.match(/(\d+-\d+(-\d+)?)/)
+        let m = parent.value.match(/(\d+-\d+(-\d+)?)/)
         if (m) {
             seedDate = m[1]
         }
     }
     
     // Show or create the calendar object
-    var div = document.getElementById('calendarpicker_popup')
+    let div = document.getElementById('calendarpicker_popup')
     if (!div) {
         div = document.createElement('div')
         div.setAttribute("id", "calendarpicker_popup")
@@ -997,7 +997,7 @@ function showCalendarPicker(parent, seed
         div.innerHTML = "Calendar goes here..."
     }
     div.style.display = "block"
-    var bb = parent.getBoundingClientRect()
+    let bb = parent.getBoundingClientRect()
     
     // Align with the calling object, slightly below
     div.style.top = (bb.bottom + 8) + "px"
@@ -1096,7 +1096,7 @@ function show_draft_list(state, json) {
     txt += "<h6>Found the following saved drafts for %s:</h6>".format(project);
     txt += "<small style='font-size: 0.75rem;'><ul style='margin: 0px; 
padding: 10px;'>"
     filenames.sort();
-    for (var i = filenames.length -1; i >= 0; i--) {
+    for (let i = filenames.length -1; i >= 0; i--) {
         let ts = filenames[i];
         let del = ''
         if (saved_drafts[ts].yours) {
@@ -1128,7 +1128,7 @@ function deleted_draft(state, json) {
     if (json.message) {
         modal("Draft was successfully removed.");
         let filenames = Object.keys(saved_drafts);
-        for (var i = 0; i < filenames.length; i++) {
+        for (let i = 0; i < filenames.length; i++) {
             let ts = filenames[i];
             let fn = saved_drafts[ts].filename;
             if (fn == state.filename) {
@@ -1276,7 +1276,7 @@ function generate_pmc_roster(pdata) {
     let no_added = 0;
     let last_added = null;
     txt += "Community changes, past quarter:\n";
-    for (var availid in changes) {
+    for (let availid in changes) {
         let change = changes[availid];
         let name = change[0];
         let added = moment(change[1]*1000.0);
@@ -1306,7 +1306,7 @@ function generate_pmc_roster(pdata) {
     three_months_ago = now.subtract(3, 'months');
     no_added = 0;
     last_added = null;
-    for (var availid in changes) {
+    for (let availid in changes) {
         let change = changes[availid];
         let name = change[0];
         let added = moment(change[1]*1000.0);
@@ -1359,7 +1359,7 @@ function generate_meta(data) {
       let ntxt = "";
       let a = comment.match(/(?:^|\n)([a-z0-9]+: 
[\s\S\r\n]+?)(?=(\n[a-z0-9]+:|$))/gi);
       if (a) {
-        for (var i = 0; i < a.length; i++) {
+        for (let i = 0; i < a.length; i++) {
           let cmt = a[i];
           cmt = cmt.replace(/[\r\n]+/g, ' ').replace(/([a-z0-9]+:)/, (a) => 
"<kbd>"+a+"</kbd><br/>");
           ntxt += cmt + "<br/>";
@@ -1395,7 +1395,7 @@ function splash(state, json, all) {
     let keys = json.pdata;
     if (all) keys = cycles;
     let found = 0;
-    for (var key in keys) {
+    for (let key in keys) {
         found++;
         if (pdata.pmcsummary[key]) {
             let tlpname = pdata.pmcsummary[key].name;
@@ -1429,7 +1429,7 @@ function health_tips(data) {
     let haskibble = data.kibble && Object.keys(data.kibble) > 0;
     let txt = "";    
     // Mailing list changes
-    for (var ml in data.delivery[project]) {
+    for (let ml in data.delivery[project]) {
         let mldata = data.delivery[project][ml];
         let a = ml.match(/([^-]+)-(.+)/);
         ml = "%s@%s.apache.org".format(a[2], a[1]);
@@ -1617,7 +1617,7 @@ function health_tips(data) {
         showit = true;
         let ul = new HTML('ul');
         let arr = data.kibble.busiest.email;
-        for (var i = 0; i < arr.length; i++) {
+        for (let i = 0; i < arr.length; i++) {
           let ml = arr[i].source.split('?')[1];
           let li = new HTML('li', {}, [
                                        new HTML("kbd", {}, ml),
@@ -1636,7 +1636,7 @@ function health_tips(data) {
         showit = true;
         let ul = new HTML('ul');
         let arr = data.kibble.busiest.github;
-        for (var i = 0; i < arr.length; i++) {
+        for (let i = 0; i < arr.length; i++) {
           let li = new HTML('li', {}, [
                                        new HTML("a", {href: arr[i].url}, 
arr[i].url.replace('https://github.com/apache/', '')),
                                        new HTML('i', {style: {display: 
'inline-block', textIndent: '10px'}}, arr[i].subject),
@@ -1653,7 +1653,7 @@ function health_tips(data) {
         showit = true;
         let ul = new HTML('ul');
         let arr = data.kibble.busiest.jira;
-        for (var i = 0; i < arr.length; i++) {
+        for (let i = 0; i < arr.length; i++) {
           let li = new HTML('li', {}, [
                                        new HTML("a", {href: arr[i].url}, 
arr[i].key),
                                        new HTML('i', {style: {display: 
'inline-block', textIndent: '10px'}}, arr[i].subject),
@@ -1696,7 +1696,7 @@ function activity_tips(data) {
     let rtxt = "";
     let new_releases = 0;
     let ages = [];
-    for (var rel in data.releases[project]) {
+    for (let rel in data.releases[project]) {
         let reldate = moment(data.releases[project][rel] * 1000.0);
         if (reldate > three_months_ago) {
           new_releases++;
@@ -1710,7 +1710,7 @@ function activity_tips(data) {
     let releases_picked = {};
     while (ages.length) {
       let ts = ages.shift();
-      for (var rel in data.releases[project]) {
+      for (let rel in data.releases[project]) {
         if (releases_shown >= to_show) break;
           let reldate = moment(data.releases[project][rel] * 1000.0);
           if (releases_picked[rel]) continue;
@@ -1740,7 +1740,7 @@ function should_reflow(txt, chars) {
   if (typeof txt != 'string') return false;
   chars = chars || 80;
   let lines = txt.split(/[\r\n]+/g);
-  for (var i = 0; i < lines.length; i++) {
+  for (let i = 0; i < lines.length; i++) {
     if (lines[i].length > chars && lines[i].match(/\s/)) return true;
   }
   return false;
@@ -1753,7 +1753,7 @@ function reflow(txt, chars) {
   if (!words) return txt;
   let x = 0;
   let output = "";
-  for (var i = 0; i < words.length; i++) {
+  for (let i = 0; i < words.length; i++) {
     let word = words[i];
     x += word.length;
     if (x > chars) {
@@ -1782,7 +1782,7 @@ function compile_check(pdata, editor) {
 
 function show_examples(examples, title) {
   let out = "<p>Here are some good examples of what to write in your 
<kbd>%s</kbd> section:</p>".format(title);
-  for (var i = 0; i < examples.length; i++) {
+  for (let i = 0; i < examples.length; i++) {
     out += "<pre style='background: #FFE; border: 0.75px solid #3339; padding: 
3px; border-radius: 3px;'>" + examples[i] + "</pre><hr/>";
   }
   title = "Examples for %s:".format(title);
@@ -1818,7 +1818,7 @@ function init_wizard(so) {
     } else {
         document.title = so ? "ASF Project Statistics: %s".format(project) : 
"ASF Board Report Wizard: %s".format(project);
         let titles = document.getElementsByClassName("title");
-        for (var i in titles) {
+        for (let i in titles) {
             titles[i].innerText = document.title;
         }
         if (so) {
@@ -1860,7 +1860,7 @@ function prime_wizard(state, json) {
     pdata = json;
     document.title = (statsonly ? "ASF Project Statistics: %s" : "ASF Board 
Report Wizard: %s").format(json.pdata[project].name);
     let titles = document.getElementsByClassName("title");
-    for (var i in titles) {
+    for (let i in titles) {
         titles[i].innerText = document.title;
     }
     
@@ -1918,9 +1918,9 @@ const reporting_date_shifts = { // Dates
 }
 
 function getWednesdays(mo, y) {
-       var d = new Date();
+       let d = new Date();
        d.setFullYear(y, mo, 1)
-       var month = d.getMonth(),
+       let month = d.getMonth(),
                wednesdays = [];
 
        // Get the first Wednesday (day 3 of week) in the month
@@ -1950,12 +1950,12 @@ function everyMonth(s) {
        return s == 'Every month'
 }
 
-var m = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 
'August', 'September', 'October', 'November', 'December']
+let m = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 
'August', 'September', 'October', 'November', 'December']
 
 // Format the report month array. Assumes that non-month values appear first
 
 function formatRm(array) {
-    var first = array[0]
+    let first = array[0]
     if (array.length == 1) { // e.g. every month
         return first
     }
@@ -1966,16 +1966,16 @@ function formatRm(array) {
 }
 
 function getReportDate(json, pmc, dateOnly, agenda) {
-       var today = new Date()
+       let today = new Date()
 
-       var dates = [] // the entries must be in date order
+       let dates = [] // the entries must be in date order
 
-       var rm = json[pmc] // reporting months for the pmc
+       let rm = json[pmc] // reporting months for the pmc
 
        // First check if the list contains an every month indicator
        // This is necessary to ensure that the dates are added to the list in 
order
-       for (var i = 0; i < rm.length; i++) {
-               var sm = rm[i];
+       for (let i = 0; i < rm.length; i++) {
+               let sm = rm[i];
                if (everyMonth(sm)) {
                        rm = m // reset to every month
                        break
@@ -1983,10 +1983,10 @@ function getReportDate(json, pmc, dateOn
        }
 
     // Find the 3rd Wed in each month for this year
-    var this_year = today.getFullYear();
+    let this_year = today.getFullYear();
        // Check the months in order, so it does not matter if the data is 
unordered
-       for (var x = 0; x < m.length; x++) {
-               for (var i = 0; i < rm.length; i++) {
+       for (let x = 0; x < m.length; x++) {
+               for (let i = 0; i < rm.length; i++) {
                        if (m[x] == rm[i]) {
                                dates.push(getWednesdays(x, this_year)[2])
                        }
@@ -1994,8 +1994,8 @@ function getReportDate(json, pmc, dateOn
        }
        // Also for next year to allow for year-end wrap-round
        // cannot combine with the code above because that would destroy the 
order
-       for (var x = 0; x < m.length; x++) {
-               for (var i = 0; i < rm.length; i++) {
+       for (let x = 0; x < m.length; x++) {
+               for (let i = 0; i < rm.length; i++) {
                        if (m[x] == rm[i]) {
                                dates.push(getWednesdays(x, this_year+1)[2])
                        }
@@ -2053,13 +2053,13 @@ function getReportDate(json, pmc, dateOn
 #}, "Some text inside a div")
  */
 
-var txt = (msg) => document.createTextNode(msg);
+let txt = (msg) => document.createTextNode(msg);
 
-var HTML = (function() {
+let HTML = (function() {
   function HTML(type, params, children) {
 
     /* create the raw element, or clone if passed an existing element */
-    var child, j, len, val;
+    let child, j, len, val;
     if (typeof type === 'object') {
       this.element = type.cloneNode();
     } else {
@@ -2068,7 +2068,7 @@ var HTML = (function() {
 
     /* If params have been passed, set them */
     if (isHash(params)) {
-      for (var key in params) {
+      for (let key in params) {
         val = params[key];
 
         /* Standard string value? */
@@ -2081,7 +2081,7 @@ var HTML = (function() {
         } else if (isHash(val)) {
 
           /* Are we trying to set multiple sub elements, like a style? */
-          for (var subkey in val) {
+          for (let subkey in val) {
             let subval = val[subkey];
             if (!this.element[key]) {
               throw "No such attribute, " + key + "!";
@@ -2134,7 +2134,7 @@ var HTML = (function() {
  */
 
 HTMLElement.prototype.inject = function(child) {
-  var item, j, len;
+  let item, j, len;
   if (isArray(child)) {
     for (j = 0, len = child.length; j < len; j++) {
       item = child[j];
@@ -2159,7 +2159,7 @@ HTMLElement.prototype.inject = function(
  */
 
 HTMLElement.prototype.empty = function() {
-  var ndiv;
+  let ndiv;
   ndiv = this.cloneNode();
   this.parentNode.replaceChild(ndiv, this);
   return ndiv;
@@ -2183,12 +2183,12 @@ function StatisticsPage(layout, pdata) {
     wrapper.style.padding = '8px';
     wrapper.style.height = 'auto';
     wrapper.innerHTML = "";
-    for (var i = 0; i < layout.length; i++) {
+    for (let i = 0; i < layout.length; i++) {
         let step = layout[i];
         if (step.statsgenerator||step.tipgenerator) {
             let thtml = new HTML('p');
             let f = Function('a', 'b', "return 
%s(a,b);".format(step.statsgenerator||step.tipgenerator));
-            data = f(pdata, {});
+            let data = f(pdata, {});
             if (typeof data == 'string') thtml.innerHTML += data;
             else if (typeof data == 'object') thtml.inject(data);
             thtml.inject(new HTML('hr'));
@@ -2198,7 +2198,7 @@ function StatisticsPage(layout, pdata) {
     
     headers = $(wrapper).find("h4");
     let toc = "<ul style='background: #3333;'>";
-    for (var i = 0; i < headers.length; i++) {
+    for (let i = 0; i < headers.length; i++) {
         let t = headers[i].innerText.replace(/:.*$/, '');
         let id = t.replace(/\s+/g, '').toLowerCase();
         headers[i].setAttribute('id', id);
@@ -2268,7 +2268,7 @@ function statistics_roster(pdata) {
     let no_added = 0;
     let last_added = null;
     txt += "<h5>Community changes, past quarter:</h5><ul>";
-    for (var availid in changes) {
+    for (let availid in changes) {
         let change = changes[availid];
         let name = change[0];
         let added = moment(change[1] * 1000.0);
@@ -2298,7 +2298,7 @@ function statistics_roster(pdata) {
     three_months_ago = now.subtract(3, 'months');
     no_added = 0;
     last_added = null;
-    for (var availid in changes) {
+    for (let availid in changes) {
         let change = changes[availid];
         let name = change[0];
         let added = moment(change[1] * 1000.0);
@@ -2347,12 +2347,12 @@ function kibble_mailstats(xhtml, timeser
         ['threads'],
         ['authors']
     ];
-    for (var i = 0; i < 27; i++) {
+    for (let i = 0; i < 27; i++) {
         let date = moment.utc().subtract(i, 
'weeks').startOf('week').weekday(1);
         let c = 0;
         let o = 0;
         let a = 0;
-        for (var n = 0; n < timeseries.length; n++) {
+        for (let n = 0; n < timeseries.length; n++) {
             let el = timeseries[n];
             if (el.date == date.unix()) {
                 c = el['emails'];
@@ -2434,7 +2434,7 @@ function statistics_health(data) {
     html.inject(new HTML('div', {}, `(as at ${data.email_date})`));
     let txt = "";
     // Mailing list changes
-    for (var ml in data.delivery[project]) {
+    for (let ml in data.delivery[project]) {
 
         let xhtml = new HTML('div', {
             style: {
@@ -2474,7 +2474,7 @@ function statistics_health(data) {
                 ['x'],
                 [ml]
             ];
-            for (var i = 0; i < 27; i++) {
+            for (let i = 0; i < 27; i++) {
                 let date = moment.utc().subtract(i, 
'weeks').startOf('week').weekday(4);
                 cols[0].push(date);
                 cols[1].push(mldata.weekly[date.unix()] || 0);
@@ -2603,11 +2603,11 @@ function statistics_health(data) {
                 ['Tickets opened'],
                 ['Tickets closed']
             ];
-            for (var i = 0; i < 27; i++) {
+            for (let i = 0; i < 27; i++) {
                 let date = moment.utc().subtract(i, 
'weeks').startOf('week').weekday(1);
                 let c = 0;
                 let o = 0;
-                for (var n = 0; n < data.kibble.timeseries.jira.length; n++) {
+                for (let n = 0; n < data.kibble.timeseries.jira.length; n++) {
                     let el = data.kibble.timeseries.jira[n];
                     if (el.date == date.unix()) {
                         c = el['issues closed']
@@ -2732,10 +2732,10 @@ function statistics_health(data) {
                 ['x'],
                 ['Commits']
             ];
-            for (var i = 0; i < 27; i++) {
+            for (let i = 0; i < 27; i++) {
                 let date = moment.utc().subtract(i, 
'weeks').startOf('week').weekday(1);
                 let c = 0;
-                for (var n = 0; n < data.kibble.timeseries.commits.length; 
n++) {
+                for (let n = 0; n < data.kibble.timeseries.commits.length; 
n++) {
                     let el = data.kibble.timeseries.commits[n];
                     if (el.date == date.unix()) {
                         c = el['commits']
@@ -2853,11 +2853,11 @@ function statistics_health(data) {
                 ['PRs opened'],
                 ['PRs closed']
             ];
-            for (var i = 0; i < 27; i++) {
+            for (let i = 0; i < 27; i++) {
                 let date = moment.utc().subtract(i, 
'weeks').startOf('week').weekday(1);
                 let c = 0;
                 let o = 0;
-                for (var n = 0; n < data.kibble.timeseries.github.length; n++) 
{
+                for (let n = 0; n < data.kibble.timeseries.github.length; n++) 
{
                     let el = data.kibble.timeseries.github[n];
                     if (el.date == date.unix()) {
                         c = el['pull requests closed']
@@ -2981,11 +2981,11 @@ function statistics_health(data) {
                 ['issues opened'],
                 ['issues closed']
             ];
-            for (var i = 0; i < 27; i++) {
+            for (let i = 0; i < 27; i++) {
                 let date = moment.utc().subtract(i, 
'weeks').startOf('week').weekday(1);
                 let c = 0;
                 let o = 0;
-                for (var n = 0; n < data.kibble.timeseries.github.length; n++) 
{
+                for (let n = 0; n < data.kibble.timeseries.github.length; n++) 
{
                     let el = data.kibble.timeseries.github[n];
                     if (el.date == date.unix()) {
                         c = el['issues closed']
@@ -3060,7 +3060,7 @@ function statistics_health(data) {
             showit = true;
             let ul = new HTML('ul');
             let arr = data.kibble.busiest.email;
-            for (var i = 0; i < arr.length; i++) {
+            for (let i = 0; i < arr.length; i++) {
                 let ml = arr[i].source.split('?')[1];
                 let li = new HTML('li', {}, [
                     new HTML("kbd", {}, ml),
@@ -3089,7 +3089,7 @@ function statistics_health(data) {
             txt += "<h5>Busiest GitHub issues/PRs:</h5>";
             let ul = new HTML('ul');
             let arr = data.kibble.busiest.github;
-            for (var i = 0; i < arr.length; i++) {
+            for (let i = 0; i < arr.length; i++) {
                 let li = new HTML('li', {}, [
                     new HTML("a", {
                         href: arr[i].url
@@ -3118,7 +3118,7 @@ function statistics_health(data) {
             txt += "<h5>Busiest JIRA tickets:</h5>";
             let ul = new HTML('ul');
             let arr = data.kibble.busiest.jira;
-            for (var i = 0; i < arr.length; i++) {
+            for (let i = 0; i < arr.length; i++) {
                 let li = new HTML('li', {}, [
                     new HTML("a", {
                         href: arr[i].url
@@ -3151,7 +3151,7 @@ function statistics_health(data) {
     
     headers = $(html).find("h5");
     let toc = "<ul>";
-    for (var i = 0; i < headers.length; i++) {
+    for (let i = 0; i < headers.length; i++) {
         let t = headers[i].innerText.replace(/:.*$/, '');
         let id = t.replace(/\s+/g, '').toLowerCase();
         headers[i].setAttribute('id', id);
@@ -3175,7 +3175,7 @@ function statistics_releases(data) {
     let rtxt = "";
     let new_releases = 0;
     let ages = [];
-    for (var rel in data.releases[project]) {
+    for (let rel in data.releases[project]) {
         let reldate = moment(data.releases[project][rel] * 1000.0);
         if (reldate > three_months_ago) {
             new_releases++;
@@ -3189,7 +3189,7 @@ function statistics_releases(data) {
     let releases_picked = {};
     while (ages.length) {
       let ts = ages.shift();
-      for (var rel in data.releases[project]) {
+      for (let rel in data.releases[project]) {
         if (releases_shown >= to_show) break;
           let reldate = moment(data.releases[project][rel] * 1000.0);
           if (releases_picked[rel]) continue;
@@ -3264,7 +3264,7 @@ function ReportStepper(div, editor, layo
         
         // build the step div
         this.object.innerHTML = '';
-        for (var i = 0; i < this.layout.length; i++) {
+        for (let i = 0; i < this.layout.length; i++) {
             let element = this.layout[i];
             let wrapper = new HTML('div', {class: 'wizard-step-wrapper'});
             let x = i;
@@ -3307,7 +3307,7 @@ function ReportStepper(div, editor, layo
             if (step.minchars)  {
                 this.editor.parse(true);
                 let chars_remain = step.minchars;
-                for (var n = 0; n < this.editor.sections.length; n++ ) {
+                for (let n = 0; n < this.editor.sections.length; n++ ) {
                     let sct = this.editor.sections[n];
                     if (sct.title == (step.rawname||step.description) && 
sct.text.indexOf(PLACEHOLDER) == -1) {
                         chars_remain = step.minchars - sct.text.length;
@@ -3449,14 +3449,14 @@ function UnifiedEditor_find_section(e) {
     if (nextheader) {
         let title = nextheader[nextheader.length-1].replace(/:[\s\S]*?$/, 
'').replace(/^##\s+/, '');
         custom_step.description = title;
-        for (var i = 0; i < this.layout.length; i++) {
+        for (let i = 0; i < this.layout.length; i++) {
             let step = this.layout[i];
             if (title == (step.rawname || step.description)) {
                 at_step = i;
             }
         }
     } else {
-        for (var i = 0; i < this.layout.length; i++) {
+        for (let i = 0; i < this.layout.length; i++) {
             let step = this.layout[i];
             let tline = "## %s".format(step.rawname || step.description);
             if (tprec.indexOf(tline) != -1) {
@@ -3530,7 +3530,7 @@ function UnifiedEditor_parse_report(quie
 function UnifiedEditor_mark_section(title) {
     this.parse(true);
     let foundit = false;
-    for (var i = 0; i < this.sections.length; i++) {
+    for (let i = 0; i < this.sections.length; i++) {
         let section = this.sections[i];
         if (section.title == title && section.text.indexOf(PLACEHOLDER) == -1 
&& section.text.length > 4) {
             //console.log("Marking entire %s section from %u to 
%u".format(title, this.sections[i].start, this.sections[i].end))
@@ -3556,7 +3556,7 @@ function UnifiedEditor_reset() {
     }
     this.report = "";
     this.changed = true;
-    for (var i = 0; i < this.layout.length; i++) {
+    for (let i = 0; i < this.layout.length; i++) {
         let step = this.layout[i];
         if (!step.noinput || step.rawname) {
             this.report += "## %s:\n".format(step.rawname || step.description);
@@ -3580,12 +3580,12 @@ function UnifiedEditor_compile() {
     let text = "";
       let required_sections = [];
       this.parse();
-      for (var i = 0; i < this.layout.length; i++) {
+      for (let i = 0; i < this.layout.length; i++) {
         let step = this.layout[i];
         if (!step.noinput) {
           let found = false;
           required_sections.push(step.rawname||step.description);
-          for (var n = 0; n < this.sections.length; n++) {
+          for (let n = 0; n < this.sections.length; n++) {
             if (this.sections[n].title == (step.rawname||step.description)) {
               found = true;
               if (this.sections[n].text.indexOf(PLACEHOLDER) != -1) {
@@ -3617,7 +3617,7 @@ function UnifiedEditor_compile() {
       }
       
       // Remark on additional sections not required
-      for (var n = 0; n < this.sections.length; n++) {
+      for (let n = 0; n < this.sections.length; n++) {
           if (!required_sections.has(this.sections[n].title)) {
             text += "<li><span style='display: inline-block; width: 20px; 
font-size: 18px; color: pink;'>&#8253;</span> Found custom section 
<kbd>%s</kbd></li>".format(this.sections[n].title);
           }
@@ -3726,10 +3726,10 @@ class Flow {
         new RegExp(`(.{1,${len}})( +|$\\n?)|(.{1,${len}})`, "g"),
         `$1$3\n${indent}`
       ).trim()
-    };
+    }
 
     return lines.join("\n")
-  };
+  }
 
   // reflow text.  Indent is a string containing the amount of spaces that are
   // to be added to each line.  The Incubator has special punctuation rules 
that
@@ -3751,7 +3751,7 @@ class Flow {
       if (/^\s*\w/m.test(lines[i]) && !/^\s*\d+\./m.test(lines[i])) {
         lines.splice(i - 1, 2, lines[i - 1] + lines[i].replace(/^\s*/m, " "))
       }
-    };
+    }
 
     // reflow each line
     let len = 78 - indent.length;
@@ -3782,8 +3782,8 @@ class Flow {
           ).replace(indent, "").replace(/[\n\r]+$/m, "")
         }
       }
-    };
+    }
 
     return lines.join("\n")
   }
-};
+}



Reply via email to