@@ -298,6 +298,16 @@ var ReplyWithHeader = {
298
298
return recipients . trim ( ) ;
299
299
} ,
300
300
301
+ getHeaderQuotSeq : function ( selectedOption ) {
302
+ let quotSeq = {
303
+ 0 : [ 'subject' , 'date' , 'from' , 'to' , 'cc' ] , // Default
304
+ 1 : [ 'from' , 'date' , 'to' , 'cc' , 'subject' ] , // Outlook
305
+ 2 : [ 'from' , 'date' , 'subject' ] , // Simple
306
+ 3 : [ 'from' , 'to' , 'cc' , 'date' , 'subject' ] // Lookout
307
+ } ;
308
+ return quotSeq [ selectedOption ] ;
309
+ } ,
310
+
301
311
parseMsgHeader : function ( hdr ) {
302
312
// Decoding values into object
303
313
// Ref: https://developer.mozilla.org/en-US/docs/Mozilla/Tech/XPCOM/Reference/Interface/nsIMsgDBHdr
@@ -328,6 +338,8 @@ var ReplyWithHeader = {
328
338
let rawHdr = this . getMsgHeader ( this . messageUri ) ;
329
339
let pHeader = this . parseMsgHeader ( rawHdr ) ;
330
340
let headerQuotLblSeq = this . prefs . headerQuotLblSeq ;
341
+ let headerQuotLblSeqValues = this . getHeaderQuotSeq ( headerQuotLblSeq ) ;
342
+ this . log . debug ( 'headerQuotLblSeq: ' + headerQuotLblSeq + ' \tValues: ' + headerQuotLblSeqValues ) ;
331
343
332
344
var rwhHdr = '<div id="rwhMsgHeader">' ;
333
345
@@ -341,10 +353,19 @@ var ReplyWithHeader = {
341
353
let fontSize = this . prefs . headerFontSize ;
342
354
let fontSizeUnit = this . prefs . headerFontSizeUnit ;
343
355
let fontColor = this . prefs . headerFontColor ;
356
+ let systemFontColor = this . prefs . headerSystemFontColor ;
357
+ let systemFontFace = this . prefs . headerSystemFontFace ;
358
+ this . log . debug ( 'System Font face: ' + systemFontFace + '\tSystem Font Color: ' + systemFontColor ) ;
344
359
this . log . debug ( 'Font face: ' + fontFace + '\tFont size: ' + fontSize + fontSizeUnit + '\tColor: ' + fontColor ) ;
345
360
346
- let htmlTagPrefix = '<div style="font-family:' + fontFace + ' !important; color:'
347
- + fontColor + ' !important; font-size:' + fontSize + fontSizeUnit + ' !important;">' ;
361
+ let htmlTagPrefix = '<div style="' ;
362
+ if ( ! systemFontFace ) {
363
+ htmlTagPrefix += 'font-family:' + fontFace + ' !important;' ;
364
+ }
365
+ if ( ! systemFontColor ) {
366
+ htmlTagPrefix += ' color:' + fontColor + ' !important;' ;
367
+ }
368
+ htmlTagPrefix += ' font-size:' + fontSize + fontSizeUnit + ' !important;">' ;
348
369
let htmlTagSuffix = '</div>' ;
349
370
350
371
let lineColor = this . prefs . headerSepLineColor ;
@@ -353,38 +374,16 @@ var ReplyWithHeader = {
353
374
354
375
rwhHdr += this . createBrTags ( this . prefs . beforeHdrSpaceCnt ) ;
355
376
356
- rwhHdr += htmlTagPrefix + '<b>' + this . i18n . from [ locale ] + '</b> ' + pHeader . from + htmlTagSuffix ;
357
-
358
- if ( headerQuotLblSeq == 0 ) { // jshint ignore:line
359
- rwhHdr += htmlTagPrefix + '<b>' + this . i18n . subject [ locale ] + '</b> ' + pHeader . subject + htmlTagSuffix ;
360
- rwhHdr += htmlTagPrefix + '<b>' + this . i18n . date [ locale ] + '</b> ' + pHeader . date + htmlTagSuffix ;
361
- rwhHdr += htmlTagPrefix + '<b>' + this . i18n . to [ locale ] + '</b> ' + pHeader . to + htmlTagSuffix ;
362
-
363
- if ( pHeader . cc ) {
364
- rwhHdr += htmlTagPrefix + '<b>' + this . i18n . cc [ locale ] + '</b> ' + pHeader . cc + htmlTagSuffix ;
377
+ headerQuotLblSeqValues . forEach ( function ( hdrKey , _ ) {
378
+ let lbl = this . i18n [ hdrKey ] [ locale ]
379
+ if ( headerQuotLblSeq == 1 && hdrKey == 'date' ) {
380
+ lbl = this . i18n [ 'sent' ] [ locale ]
365
381
}
366
- } else if ( headerQuotLblSeq == 3 ) {
367
- rwhHdr += htmlTagPrefix + '<b>' + this . i18n . to [ locale ] + '</b> ' + pHeader . to + htmlTagSuffix ;
368
382
369
- if ( pHeader . cc ) {
370
- rwhHdr += htmlTagPrefix + '<b>' + this . i18n . cc [ locale ] + '</b> ' + pHeader . cc + htmlTagSuffix ;
371
- }
372
- rwhHdr += htmlTagPrefix + '<b>' + this . i18n . date [ locale ] + '</b> ' + pHeader . date + htmlTagSuffix ;
373
- rwhHdr += htmlTagPrefix + '<b>' + this . i18n . subject [ locale ] + '</b> ' + pHeader . subject + htmlTagSuffix ;
374
- } else if ( headerQuotLblSeq == 1 ) {
375
- rwhHdr += htmlTagPrefix + '<b>' + this . i18n . sent [ locale ] + '</b> ' + pHeader . date + htmlTagSuffix ;
376
- rwhHdr += htmlTagPrefix + '<b>' + this . i18n . to [ locale ] + '</b> ' + pHeader . to + htmlTagSuffix ;
377
-
378
- if ( pHeader . cc ) {
379
- rwhHdr += htmlTagPrefix + '<b>' + this . i18n . cc [ locale ] + '</b> ' + pHeader . cc + htmlTagSuffix ;
383
+ if ( pHeader [ hdrKey ] ) {
384
+ rwhHdr += htmlTagPrefix + '<b>' + lbl + '</b> ' + pHeader [ hdrKey ] + htmlTagSuffix ;
380
385
}
381
-
382
- rwhHdr += htmlTagPrefix + '<b>' + this . i18n . subject [ locale ] + '</b> ' + pHeader . subject + htmlTagSuffix ;
383
-
384
- } else if ( headerQuotLblSeq == 2 ) {
385
- rwhHdr += htmlTagPrefix + '<b>' + this . i18n . sent [ locale ] + '</b> ' + pHeader . date + htmlTagSuffix ;
386
- rwhHdr += htmlTagPrefix + '<b>' + this . i18n . subject [ locale ] + '</b> ' + pHeader . subject + htmlTagSuffix ;
387
- }
386
+ } , this ) ;
388
387
389
388
} else { // for plain/text emails
390
389
if ( ! this . prefs . excludePlainTxtHdrPrefix ) {
@@ -399,38 +398,17 @@ var ReplyWithHeader = {
399
398
400
399
rwhHdr += this . createBrTags ( this . prefs . beforeHdrSpaceCnt ) ;
401
400
402
- rwhHdr += this . i18n . from [ locale ] + ' ' + pHeader . from + '<br/>' ;
403
-
404
- if ( headerQuotLblSeq == 0 ) { // jshint ignore:line
405
- rwhHdr += this . i18n . subject [ locale ] + ' ' + pHeader . subject + '<br/>' ;
406
- rwhHdr += this . i18n . date [ locale ] + ' ' + pHeader . date + '<br/>' ;
407
- rwhHdr += this . i18n . to [ locale ] + ' ' + pHeader . to + '<br/>' ;
408
-
409
- if ( pHeader . cc ) {
410
- rwhHdr += this . i18n . cc [ locale ] + ' ' + pHeader . cc + '<br/>' ;
401
+ headerQuotLblSeqValues . forEach ( function ( hdrKey , _ ) {
402
+ let lbl = this . i18n [ hdrKey ] [ locale ]
403
+ if ( headerQuotLblSeq == 1 && hdrKey == 'date' ) {
404
+ lbl = this . i18n [ 'sent' ] [ locale ]
411
405
}
412
- } else if ( headerQuotLblSeq == 3 ) {
413
- rwhHdr += this . i18n . to [ locale ] + ' ' + pHeader . to + '<br/>' ;
414
406
415
- if ( pHeader . cc ) {
416
- rwhHdr += this . i18n . cc [ locale ] + ' ' + pHeader . cc + '<br/>' ;
417
- }
418
- rwhHdr += this . i18n . date [ locale ] + ' ' + pHeader . date + '<br/>' ;
419
- rwhHdr += this . i18n . subject [ locale ] + ' ' + pHeader . subject + '<br/>' ;
420
- } else if ( headerQuotLblSeq == 1 ) {
421
- rwhHdr += this . i18n . sent [ locale ] + ' ' + pHeader . date + '<br/>' ;
422
- rwhHdr += this . i18n . to [ locale ] + ' ' + pHeader . to + '<br/>' ;
423
-
424
- if ( pHeader . cc ) {
425
- rwhHdr += this . i18n . cc [ locale ] + ' ' + pHeader . cc + '<br/>' ;
407
+ if ( pHeader [ hdrKey ] ) {
408
+ rwhHdr += lbl + ' ' + pHeader [ hdrKey ] + '<br/>' ;
426
409
}
410
+ } , this ) ;
427
411
428
- rwhHdr += this . i18n . subject [ locale ] + ' ' + pHeader . subject + '<br/>' ;
429
-
430
- } else if ( headerQuotLblSeq == 2 ) {
431
- rwhHdr += this . i18n . sent [ locale ] + ' ' + pHeader . date + '<br/>' ;
432
- rwhHdr += this . i18n . subject [ locale ] + ' ' + pHeader . subject + '<br/>' ;
433
- }
434
412
}
435
413
436
414
rwhHdr += this . createBrTags ( this . prefs . afterHdrSpaceCnt ) ;
0 commit comments