From f8938300d3d8d4b64c173a6c63d6851641e670a2 Mon Sep 17 00:00:00 2001 From: Daniel Gruno Date: Sun, 7 Jan 2018 16:54:50 +0100 Subject: [PATCH 1/2] If we hit >12 levels of nesting, start cutting padding This prevents the width of emails in nested view from shrinking to no width. This addresses #426 --- site/js/dev/ponymail_assign_vars.js | 1 + site/js/dev/ponymail_email_displays.js | 16 ++++++++++++---- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/site/js/dev/ponymail_assign_vars.js b/site/js/dev/ponymail_assign_vars.js index 068a5639..dbeed72e 100644 --- a/site/js/dev/ponymail_assign_vars.js +++ b/site/js/dev/ponymail_assign_vars.js @@ -60,6 +60,7 @@ var pending_urls = {} // URL list for GetAsync's support functions (such as the var pb_refresh = 0 var treeview_guard = {} var mbox_month = null +var max_nesting = 12 var URL_BASE = pm_config.URLBase ? pm_config.URLBase.replace(/\/+/g, "/") : "" diff --git a/site/js/dev/ponymail_email_displays.js b/site/js/dev/ponymail_email_displays.js index b4403992..76d56992 100644 --- a/site/js/dev/ponymail_email_displays.js +++ b/site/js/dev/ponymail_email_displays.js @@ -144,7 +144,18 @@ function displayEmail(json, id, level) { } // Default theme else { - thread.setAttribute("class", "reply bs-callout bs-callout-" + cols[parseInt(Math.random() * cols.length - 0.01)]) + tclass = "reply bs-callout bs-callout-" + cols[parseInt(Math.random() * cols.length - 0.01)] + // If we hit max_nesting levels, discard nesting display further down. + // Otherwise, we risk squeezing it into oblivion. + thread.style.padding = "5px" + thread.style.fontFamily = "Hack" + + if (level >= max_nesting) { + tclass = "reply" // No bs-callout if we nest too deep. + thread.style.paddingLeft = "0px"; // remove padding, left and right + thread.style.paddingRight = "0px"; + } + thread.setAttribute("class", tclass) thread.style.background = estyle thread.style.marginTop = "30px" thread.innerHTML += '   ' @@ -156,9 +167,6 @@ function displayEmail(json, id, level) { thread.innerHTML += "
" - //thread.style.border = "1px dotted #666" - thread.style.padding = "5px" - thread.style.fontFamily = "Hack" var fields = ['From', 'To', 'CC', 'Subject', 'Date'] for (var i in fields) { From ec2e136d1090287c11e6f2c623c68cd2a166c698 Mon Sep 17 00:00:00 2001 From: Daniel Gruno Date: Sun, 7 Jan 2018 16:56:36 +0100 Subject: [PATCH 2/2] Regenerate JS --- site/js/ponymail.js | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/site/js/ponymail.js b/site/js/ponymail.js index 84fa8eb6..2b4be050 100644 --- a/site/js/ponymail.js +++ b/site/js/ponymail.js @@ -68,6 +68,7 @@ var pending_urls = {} // URL list for GetAsync's support functions (such as the var pb_refresh = 0 var treeview_guard = {} var mbox_month = null +var max_nesting = 12 var URL_BASE = pm_config.URLBase ? pm_config.URLBase.replace(/\/+/g, "/") : "" @@ -1506,7 +1507,18 @@ function displayEmail(json, id, level) { } // Default theme else { - thread.setAttribute("class", "reply bs-callout bs-callout-" + cols[parseInt(Math.random() * cols.length - 0.01)]) + tclass = "reply bs-callout bs-callout-" + cols[parseInt(Math.random() * cols.length - 0.01)] + // If we hit max_nesting levels, discard nesting display further down. + // Otherwise, we risk squeezing it into oblivion. + thread.style.padding = "5px" + thread.style.fontFamily = "Hack" + + if (level >= max_nesting) { + tclass = "reply" // No bs-callout if we nest too deep. + thread.style.paddingLeft = "0px"; // remove padding, left and right + thread.style.paddingRight = "0px"; + } + thread.setAttribute("class", tclass) thread.style.background = estyle thread.style.marginTop = "30px" thread.innerHTML += '   ' @@ -1518,9 +1530,6 @@ function displayEmail(json, id, level) { thread.innerHTML += "
" - //thread.style.border = "1px dotted #666" - thread.style.padding = "5px" - thread.style.fontFamily = "Hack" var fields = ['From', 'To', 'CC', 'Subject', 'Date'] for (var i in fields) {