| 1 |
// Story Budget specific JS, assumes that ef_date.js has already been included |
| 2 |
|
| 3 |
jQuery( document ).ready( function ( $ ) { |
| 4 |
// Make print link open up print dialog |
| 5 |
$( '#print_link' ).on( 'click', function () { |
| 6 |
window.print(); |
| 7 |
return false; |
| 8 |
} ); |
| 9 |
|
| 10 |
// Hide a single section when directed |
| 11 |
$( 'h3.hndle,div.handlediv' ).on( 'click', function () { |
| 12 |
$( this ).parent().children( 'div.inside' ).toggle(); |
| 13 |
} ); |
| 14 |
|
| 15 |
// Change number of columns when choosing a new number from Screen Options |
| 16 |
|
| 17 |
const columnsSwitch = $( 'input[name=ef_story_budget_screen_columns]' ); |
| 18 |
columnsSwitch.on( 'click', function () { |
| 19 |
const numColumns = parseInt( $( this ).val() ); |
| 20 |
const classPrefix = 'columns-number-'; |
| 21 |
$( '.postbox-container' ) |
| 22 |
.removeClass( function () { |
| 23 |
for ( var index = 1, c = []; index <= columnsSwitch.length; index++ ) { |
| 24 |
c.push( classPrefix + index ); |
| 25 |
} |
| 26 |
return c.join( ' ' ); |
| 27 |
} ) |
| 28 |
.addClass( classPrefix + numColumns ); |
| 29 |
} ); |
| 30 |
|
| 31 |
$( 'h2 a.change-date' ).on( 'click', function () { |
| 32 |
$( this ).hide(); |
| 33 |
$( 'h2 form .form-value' ).hide(); |
| 34 |
$( 'h2 form input' ).show(); |
| 35 |
$( 'h2 form a.change-date-cancel' ).show(); |
| 36 |
return false; |
| 37 |
} ); |
| 38 |
|
| 39 |
$( 'h2 form a.change-date-cancel' ).on( 'click', function () { |
| 40 |
$( this ).hide(); |
| 41 |
$( 'h2 form .form-value' ).show(); |
| 42 |
$( 'h2 form input' ).hide(); |
| 43 |
$( 'h2 form a.change-date' ).show(); |
| 44 |
return false; |
| 45 |
} ); |
| 46 |
} ); |
| 47 |
|