[ Index ] |
PHP Cross Reference of GlotPress |
[Summary view] [Print] [Text view]
1 jQuery(function($) { 2 var $bulkActions = $( '.bulk-action' ), 3 $bulkPriority = $( '.bulk-priority' ); 4 5 $gp.showhide( '#upper-filters-toolbar a.sort', '#upper-filters-toolbar .filters-expanded.sort', { 6 show_text: $gp_translations_options.sort + ' ↓', 7 hide_text: $gp_translations_options.sort + ' ↑', 8 focus: '#sort\\[by\\]\\[original_date_added\\]' 9 }); 10 $gp.showhide( '#upper-filters-toolbar a.filter', '#upper-filters-toolbar .filters-expanded.filters', { 11 show_text: $gp_translations_options.filter + ' ↓', 12 hide_text: $gp_translations_options.filter + ' ↑', 13 focus: '#filters\\[term\\]' 14 }); 15 16 $bulkActions.on( 'change', function() { 17 var $optionSelected = $( 'option:selected', this ); 18 $bulkActions.val( $optionSelected.val() ); 19 if ( 'set-priority' === $optionSelected.val() ) { 20 $bulkPriority.removeClass( 'hidden' ); 21 } else { 22 $bulkPriority.addClass( 'hidden' ); 23 } 24 } ); 25 26 $('form.filters-toolbar.bulk-actions').submit(function(e) { 27 var row_ids = $('input:checked', $('table#translations th.checkbox')).map(function() { 28 return $(this).parents('tr.preview').attr('row'); 29 }).get().join(','); 30 $('input[name="bulk[row-ids]"]', $(this)).val(row_ids); 31 }); 32 33 $('a#export').click(function() { 34 var format = $('#export-format').val(); 35 var what_to_export = $('#what-to-export').val(); 36 var url = ''; 37 if (what_to_export == 'filtered') { 38 var separator = ( $(this).attr('filters').indexOf('?') == -1 )? '?' : '&'; 39 url = $(this).attr('filters') + separator + 'format='+format; 40 } else { 41 url = $(this).attr('href') + '?format='+format; 42 } 43 window.location = url; 44 return false; 45 }); 46 47 var lastClicked = false; 48 // Check all checkboxes from WP common.js, synced with [25141] 49 $('tbody').children().children('.checkbox').find(':checkbox').click( function(e) { 50 var checks, first, last, checked, sliced; 51 52 if ( 'undefined' == e.shiftKey ) { return true; } 53 if ( e.shiftKey ) { 54 if ( !lastClicked ) { return true; } 55 checks = $( lastClicked ).closest( 'table' ).find( ':checkbox' ); 56 first = checks.index( lastClicked ); 57 last = checks.index( this ); 58 checked = $(this).prop('checked'); 59 if ( 0 < first && 0 < last && first != last ) { 60 sliced = ( last > first ) ? checks.slice( first, last ) : checks.slice( last, first ); 61 sliced.prop( 'checked', function() { 62 if ( $(this).closest('tr').is(':visible') ) 63 return checked; 64 65 return false; 66 }); 67 } 68 } 69 lastClicked = this; 70 return true; 71 }); 72 73 $('thead, tfoot').find('.checkbox :checkbox').click( function(e) { 74 var c = $(this).prop('checked'), 75 kbtoggle = 'undefined' == typeof toggleWithKeyboard ? false : toggleWithKeyboard, 76 toggle = e.shiftKey || kbtoggle; 77 78 $(this).closest( 'table' ).children( 'tbody' ).filter(':visible') 79 .children().children('.checkbox').find(':checkbox') 80 .prop('checked', function() { 81 if ( $(this).closest('tr').is(':hidden') ) 82 return false; 83 if ( toggle ) 84 return $(this).prop( 'checked' ); 85 else if (c) 86 return true; 87 return false; 88 }); 89 90 $(this).closest('table').children('thead, tfoot').filter(':visible') 91 .children().children('.checkbox').find(':checkbox') 92 .prop('checked', function() { 93 if ( toggle ) 94 return false; 95 else if (c) 96 return true; 97 return false; 98 }); 99 }); 100 101 });
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Fri Feb 26 01:01:54 2021 | Cross-referenced by PHPXref 0.7.1 |