[ Index ] |
MailPress 7.2 |
[ Index ] [ Classes ] [ Functions ] [ Variables ] [ Constants ] [ Statistics ] |
[Summary view] [Print] [Text view]
1 //user_mailinglists 2 3 jQuery(document).ready( function() { 4 var noSyncChecks = false, syncChecks; 5 6 // mailinglist tabs 7 jQuery('#mailinglist-tabs a').click(function(){ 8 var t = jQuery(this).attr('href'); 9 jQuery(this).parent().addClass('tabs').siblings('li').removeClass('tabs'); 10 jQuery('.tabs-panel').hide(); 11 jQuery(t).show(); 12 if ( '#mailinglists-all' == t ) 13 deleteUserSetting('mailinglists'); 14 else 15 setUserSetting('mailinglists','pop'); 16 return false; 17 }); 18 if ( getUserSetting('mailinglists') ) 19 jQuery('#mailinglist-tabs a[href="#mailinglists-pop"]').click(); 20 21 // Ajax mailinglist 22 jQuery('#newmailinglist').one( 'focus', function() { jQuery(this).val( '' ).removeClass( 'form-input-tip' ) } ); 23 jQuery('#mailinglist-add-sumbit').click(function(){jQuery('#newmailinglist').focus();}); 24 25 syncChecks = function() { 26 if ( noSyncChecks ) 27 return; 28 noSyncChecks = true; 29 var th = jQuery(this), c = th.is(':checked'), id = th.val().toString(); 30 jQuery('#in-mailinglist-' + id + ', #in-popular-mailinglist-' + id).attr( 'checked', c ); 31 noSyncChecks = false; 32 }; 33 34 popularMailinglists = jQuery('#mailinglistchecklist-pop :checkbox').map( function() { return parseInt(jQuery(this).val(), 10); } ).get().join(','); 35 mailinglistAddBefore = function( s ) { 36 if ( !jQuery('#newmailinglist').val() ) 37 return false; 38 s.data += '&popular_ids=' + popularMailinglists + '&' + jQuery( '#mailinglistchecklist :checked' ).serialize(); 39 return s; 40 }; 41 42 mailinglistAddAfter = function( r, s ) { 43 var newMailinglistParent = jQuery('#newmailinglist_parent'), newMailinglistParentOption = newMailinglistParent.find( 'option[value="-1"]' ); 44 jQuery(s.what + ' response_data', r).each( function() { 45 var t = jQuery(jQuery(this).text()); 46 t.find( 'label' ).each( function() { 47 var th = jQuery(this), val = th.find('input').val(), id = th.find('input')[0].id, name, o; 48 jQuery('#' + id).change( syncChecks ).change(); 49 if ( newMailinglistParent.find( 'option[value="' + val + '"]' ).size() ) 50 return; 51 name = jQuery.trim( th.text() ); 52 o = jQuery( '<option value="' + parseInt( val, 10 ) + '"></option>' ).text( name ); 53 newMailinglistParent.prepend( o ); 54 } ); 55 newMailinglistParentOption.attr( 'selected', 'selected' ); 56 } ); 57 }; 58 59 jQuery('#mailinglistchecklist').wpList( { 60 alt: '', 61 response: 'mailinglist-ajax-response', 62 addBefore: mailinglistAddBefore, 63 addAfter: mailinglistAddAfter 64 } ); 65 66 jQuery('#mailinglist-add-toggle').click( function() { 67 jQuery('#mailinglist-adder').toggleClass( 'wp-hidden-children' ); 68 jQuery('#mailinglist-tabs a[href="#mailinglists-all"]').click(); 69 return false; 70 } ); 71 72 jQuery('.mailinglistchecklist .popular-mailinglist :checkbox').change( syncChecks ).filter( ':checked' ).change(), sticky = ''; 73 });
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Tue May 19 15:55:14 2020 | Cross-referenced by PHPXref 0.7.1 |