[ Index ]

MailPress 7.2

[ Index ]     [ Classes ]     [ Functions ]     [ Variables ]     [ Constants ]     [ Statistics ]    

title

Body

[close]

/mp-admin/js/ -> mails.js (source)

   1  // mails
   2  
   3  var mp_mails = {
   4      theList : null,
   5      theExtraList : null,
   6  
   7      init : function() {
   8          mp_mails.theList     = jQuery('#the-mail-list').wpList( { alt: '', dimAfter: mp_mails.dimAfter, delBefore: mp_mails.delBefore, delAfter: mp_mails.delAfter, addColor: 'none' } );
   9          mp_mails.theExtraList     = jQuery('#the-extra-mail-list').wpList( { alt: '', delColor: 'none', addColor: 'none' } );
  10  
  11          // delete
  12          jQuery('.delete a[class^="delete"]').click(function(){return false;});
  13      },
  14  
  15      dimAfter : function( r, settings ) {
  16           var id = jQuery('id',r).text();
  17           var item = jQuery('item',r).text();
  18           var rc = jQuery('rc',r).text();
  19  
  20           var old_status = jQuery('old_status',r).text();
  21           var new_status = jQuery('new_status',r).text();
  22  
  23          if (rc == 0)
  24          {
  25              jQuery('tr#mail-' + id).after(item).remove();
  26              jQuery('li span.mail-count-'+old_status).each( function() {
  27                  var a = jQuery(this);
  28                  var n = parseInt(a.html(),10);
  29                  n = n - 1;
  30                  if ( n < 0 ) { n = 0; }
  31                  a.html( n.toString() );
  32              });
  33              jQuery('li span.mail-count-'+new_status).each( function() {
  34                  var a = jQuery(this);
  35                  var n = parseInt(a.html(),10);
  36                  n = n + 1;
  37                  if ( n < 0 ) { n = 0; }
  38                  a.html( n.toString() );
  39              });
  40          }
  41      },
  42  
  43      delBefore : function(s) {
  44          if ( 'undefined' != showNotice ) return showNotice.warn() ? s : false;
  45          return s;
  46      },
  47  
  48      delAfter : function( r, settings ) {
  49          jQuery('li span.mail-count').each( function() {
  50              var a = jQuery(this);
  51              var n = parseInt(a.html(),10);
  52              n = n + ( jQuery('#' + settings.element).is('.unapproved') ? -1 : 1 );
  53              if ( n < 0 ) { n = 0; }
  54              a.html( n.toString() );
  55          });
  56          jQuery('.post-com-count span.mail-count').each( function() {
  57              var a = jQuery(this);
  58              if ( jQuery('#' + settings.element).is('.unapproved') ) { // we deleted an unapproved mail, decrement pending title
  59                  var t = parseInt(a.parent().attr('title'), 10);
  60                  if ( t < 1 ) { return; }
  61                  t = t - 1;
  62                  a.parent().attr('title', MP_AdminPageL10n.pending.replace( /%i%/, t.toString() ) );
  63                  if ( 0 === t ) { a.parents('strong:first').replaceWith( a.parents('strong:first').html() ); }
  64                  return;
  65              }
  66              var n = parseInt(a.html(),10) - 1;
  67              a.html( n.toString() );
  68          });
  69  
  70          if ( mp_mails.theExtraList.size() == 0 || mp_mails.theExtraList.children().size() == 0 ) {
  71              return;
  72          }
  73  
  74          mp_mails.theList.get(0).wpList.add( mp_mails.theExtraList.children(':eq(0)').remove().clone() );
  75          jQuery('#get-extra-mails').submit();
  76      }
  77  };
  78  jQuery(document).ready( function() { mp_mails.init(); });


Generated: Tue May 19 15:55:14 2020 Cross-referenced by PHPXref 0.7.1