This is an automated email from the ASF dual-hosted git repository. sebb pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/incubator-ponymail-foal.git
commit 4f28f433185615bdc6316b9ff09bdb567f20c960 Author: Sebb <[email protected]> AuthorDate: Thu Nov 18 01:29:22 2021 +0000 Regen --- webui/js/ponymail.js | 230 ++++++++++++++++++++++++--------------------------- 1 file changed, 106 insertions(+), 124 deletions(-) diff --git a/webui/js/ponymail.js b/webui/js/ponymail.js index 20065ea..31e471e 100644 --- a/webui/js/ponymail.js +++ b/webui/js/ponymail.js @@ -16,7 +16,7 @@ */ // THIS IS AN AUTOMATICALLY COMBINED FILE. PLEASE EDIT source/*.js!! -const PONYMAIL_REVISION = "aebb932"; +const PONYMAIL_REVISION = "2048044"; @@ -408,7 +408,7 @@ function fixup_urls(splicer) { //splicer = splicer.innerText; } /* Array holding text and links */ - var i, m, t, textbits, url, urls; + let i, m, t, textbits, url, urls; textbits = []; /* Find the first link, if any */ @@ -492,7 +492,7 @@ function cut_trailer(splicer) { function color_diff_lines(diff) { let lines = diff.split(/[\r\n]+/); let ret = []; - for (var z = 0; z < lines.length; z++) { + for (let z = 0; z < lines.length; z++) { let line = lines[z]; let color = 'grey'; if (line[0] == '@') color = 'blue'; @@ -517,7 +517,7 @@ function fixup_diffs(splicer) { splicer = splicer.innerText; } /* Array holding text and links */ - var i, m, t, diff, diffs; + let i, m, t, diff, diffs; let textbits = []; /* Find the first link, if any */ @@ -564,7 +564,7 @@ function fixup_diffs(splicer) { // Function for turning quotes into quote segments function fixup_quotes(splicer) { if (splicer[splicer.length - 1] !== "\n") splicer += "\n"; //tweak to make quotes match the last line if no newline on it. - var hideQuotes, i, m, qdiv, quote, quotes, t, textbits; + let hideQuotes, i, m, qdiv, quote, quotes, t, textbits; hideQuotes = true; if (prefs.compactQuotes === false && !chatty_layout) { hideQuotes = false; @@ -592,7 +592,7 @@ function fixup_quotes(splicer) { t = splicer.substr(0, i); let diffed = fixup_diffs(cut_trailer(t)); if (isArray(diffed)) { - for (var z = 0; z < diffed.length; z++) textbits.push(fixup_urls(diffed[z])); + for (let z = 0; z < diffed.length; z++) textbits.push(fixup_urls(diffed[z])); } else textbits.push(fixup_urls(diffed)); splicer = splicer.substr(i); } @@ -630,7 +630,7 @@ function fixup_quotes(splicer) { /* push the remaining text into textbits */ let diffed = fixup_diffs(cut_trailer(splicer)); if (isArray(diffed)) { - for (var z = 0; z < diffed.length; z++) diffed[z] = fixup_urls(diffed[z]); + for (let z = 0; z < diffed.length; z++) diffed[z] = fixup_urls(diffed[z]); } else diffed = fixup_urls(diffed); textbits.push(new HTML('span', {}, diffed)); @@ -1029,7 +1029,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; @@ -1041,8 +1041,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) @@ -1066,15 +1066,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 = " " + name + ": " label.setAttribute("for", "datepicker_radio_" + id) @@ -1100,15 +1100,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 = DATE_UNITS[unit] + let N = document.getElementById('datepicker_lti').value + let unit = document.getElementById('datepicker_lts').value + let unitt = DATE_UNITS[unit] if (parseInt(N) != 1) { unitt += "s" } @@ -1124,9 +1124,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 = DATE_UNITS[unit] + let N = document.getElementById('datepicker_mti').value + let unit = document.getElementById('datepicker_mts').value + let unitt = DATE_UNITS[unit] if (parseInt(N) != 1) { unitt += "s" } @@ -1141,8 +1141,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 @@ -1164,16 +1164,15 @@ function calcTimespan(what) { } } -// datePicker: spawns a date picker with various +// datePicker: spawns a date picker with letious // 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) div.setAttribute("id", "datepicker_popup") div.setAttribute("class", "datepicker") } @@ -1183,21 +1182,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)", @@ -1211,9 +1210,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')") @@ -1221,7 +1220,7 @@ function datePicker(parent, seedPeriod) { mtdiv.appendChild(mti) - var mts = makeSelect({ + let mts = makeSelect({ 'd': "Day(s)", 'w': 'Week(s)', 'M': "Month(s)", @@ -1236,9 +1235,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)") @@ -1246,7 +1245,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)") @@ -1259,7 +1258,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()") @@ -1274,18 +1273,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" @@ -1301,12 +1300,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" @@ -1322,8 +1321,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] @@ -1334,11 +1333,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() } @@ -1352,15 +1351,13 @@ 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 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])/) - ptype = 'lt' - var unitt = DATE_UNITS[m[2]] + let m = seedPeriod.match(/lte=(\d+)([dMyw])/) + let unitt = DATE_UNITS[m[2]] if (parseInt(m[1]) != 1) { unitt += "s" } @@ -1369,9 +1366,8 @@ function datePickerValue(seedPeriod) { // More than N units ago? if (seedPeriod.match(/gte/)) { - ptype = 'mt' - var m = seedPeriod.match(/gte=(\d+)([dMyw])/) - var unitt = DATE_UNITS[m[2]] + let m = seedPeriod.match(/gte=(\d+)([dMyw])/) + let unitt = DATE_UNITS[m[2]] if (parseInt(m[1]) != 1) { unitt += "s" } @@ -1380,9 +1376,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] } @@ -1390,10 +1385,9 @@ 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) + let dfrom = new Date(parseInt(mr[1]), parseInt(mr[2]) - 1, 1, 0, 0, 0) rv = MONTHS[dfrom.getMonth()] + ', ' + mr[1] } } @@ -1406,21 +1400,17 @@ 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 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])/) - ptype = 'lt' - rv = "<" + m[1] + m[2] + " ago" + let m = seedPeriod.match(/lte=(\d+)([dMyw])/) dbl = "lte=" + (parseInt(m[1]) * 2) + m[2] // N months ago @@ -1449,11 +1439,11 @@ function datePickerDouble(seedPeriod) { // More than N units ago? if (seedPeriod.match(/gte/)) { - ptype = 'mt' - var m = seedPeriod.match(/gte=(\d+)([dMyw])/) - rv = ">" + m[1] + m[2] + " ago" + let m = seedPeriod.match(/gte=(\d+)([dMyw])/) dbl = "gte=" + (parseInt(m[1]) * 2) + m[2] - tspan = parseInt(parseInt(m[1]) * 30.4) + // Can't really figure out a timespan for this, so...null! + // This also sort of invalidates use on the trend page, but meh.. + tspan = null dfrom = null // Months @@ -1475,20 +1465,14 @@ function datePickerDouble(seedPeriod) { if (m[2] == "w") { dto.setDate(dto.getDate() - (parseInt(m[1]) * 7)) } - - // Can't really figure out a timespan for this, so...null! - // This also sort of invalidates use on the trend page, but meh.. - tspan = null } // Date range? 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 dfrom = new Date(parseInt(mf[1]), parseInt(mf[2]) - 1, parseInt(mf[3]), 0, 0, 0) @@ -1499,7 +1483,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 { @@ -1518,10 +1502,8 @@ function datePickerDouble(seedPeriod) { // Specific month? 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 dfrom = new Date(parseInt(mr[1]), parseInt(mr[2]) - 1, 1, 0, 0, 0) // end at 23:59:59 @@ -1531,7 +1513,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 { @@ -1568,7 +1550,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') @@ -1582,28 +1564,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);") @@ -1637,15 +1619,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) } @@ -1653,13 +1635,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) } @@ -1674,7 +1656,7 @@ function drawCalendarPicker(obj, date) { table.appendChild(tr) tr = document.createElement('tr'); } - td = document.createElement('td') + let td = document.createElement('td') // onclick for setting the calendarPicker's parent to this val. td.setAttribute("onclick", "setCalendarDate('" + mat.getFullYear() + '-' + (mat.getMonth() + 1) + '-' + mat.getDate() + "');") td.innerHTML = mat.getDate() @@ -1697,7 +1679,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') @@ -1709,14 +1691,14 @@ function showCalendarPicker(parent, seedDate) { // 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") @@ -1725,7 +1707,7 @@ function showCalendarPicker(parent, seedDate) { 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" @@ -1870,7 +1852,7 @@ function hideWindows(force_all) { // Finally, check for other opened emails, close 'em all let placeholders = document.getElementsByClassName('email_placeholder'); - for (var i = 0; i < placeholders.length; i++) { + for (let i = 0; i < placeholders.length; i++) { if (placeholders[i].style.display == 'block') { console.log("Hiding placeholder %s".format(placeholders[i].getAttribute('id'))); placeholders[i].style.display = 'none'; @@ -1882,7 +1864,7 @@ function hideWindows(force_all) { } placeholders = document.getElementsByClassName('email_placeholder_chatty'); - for (var i = 0; i < placeholders.length; i++) { + for (let i = 0; i < placeholders.length; i++) { if (placeholders[i].style.display == 'block') { console.log("Hiding placeholder %s".format(placeholders[i].getAttribute('id'))); placeholders[i].style.display = 'none'; @@ -2010,8 +1992,8 @@ function list_index(state, json) { } } else { let letters = 'abcdefghijklmnopqrstuvwxyz#'; - for (var i = 0; i < letters.length; i++) { - let letter = letters[i].toUpperCase(); + for (let i = 0; i < letters.length; i++) { + letter = letters[i].toUpperCase(); // declared above let li = new HTML('li', { onclick: 'list_index({letter: "%s"});'.format(letter), class: (letter == 'A') ? 'active' : null @@ -2049,7 +2031,7 @@ function list_index_onepage(state, json) { let domains = Object.keys(json.lists); domains.sort(); let letter = ''; - for (var i = 0; i < domains.length; i++) { + for (let i = 0; i < domains.length; i++) { let domain = domains[i]; let l = domain[0]; if (l != letter) { @@ -2578,7 +2560,7 @@ function listview_threaded(json, start) { function find_email(id) { let json = current_json; - for (var i = 0; i < json.emails.length; i++) { + for (let i = 0; i < json.emails.length; i++) { if (json.emails[i].id == id) return json.emails[i]; } return null; @@ -2610,7 +2592,7 @@ function count_people(thread, hash) { } } let n = 0; - for (var _ in ppl) n++; + for (let _ in ppl) n++; return n; } @@ -3888,7 +3870,6 @@ const HTML = (function() { function HTML(type, params, children) { /* create the raw element, or clone if passed an existing element */ - var child, j, len, val; if (typeof type === 'object') { this.element = type.cloneNode(); } else { @@ -3897,8 +3878,8 @@ const HTML = (function() { /* If params have been passed, set them */ if (isHash(params)) { - for (var key in params) { - val = params[key]; + for (let key in params) { + let val = params[key]; /* Standard string value? */ if (typeof val === "string" || typeof val === 'number') { @@ -3910,7 +3891,7 @@ const 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 + "!"; @@ -3931,6 +3912,7 @@ const HTML = (function() { /* If children is an array of elems, iterate and add */ if (isArray(children)) { + let child, j, len; for (j = 0, len = children.length; j < len; j++) { child = children[j]; @@ -3963,7 +3945,7 @@ const 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]; @@ -3988,7 +3970,7 @@ HTMLElement.prototype.inject = function(child) { */ HTMLElement.prototype.empty = function() { - var ndiv; + let ndiv; ndiv = this.cloneNode(); this.parentNode.replaceChild(ndiv, this); return ndiv; @@ -4058,7 +4040,7 @@ function search_set_list(what) { ponymail_search_list = what; let links = document.getElementsByClassName('searchlistoption'); let whatxt = "this list" - for (var i = 0; i < links.length; i++) { + for (let i = 0; i < links.length; i++) { let el = links[i]; if (el.getAttribute("id").match(what)) { el.setAttribute("class", "searchlistoption checked");
