2014-07-16 18:11:48 +00:00
|
|
|
jQuery( function ( $ ) {
|
|
|
|
|
2015-06-17 14:30:06 +00:00
|
|
|
// Run tipTip
|
2014-07-08 13:14:41 +00:00
|
|
|
function runTipTip() {
|
2015-06-17 14:30:06 +00:00
|
|
|
// Remove any lingering tooltips
|
2014-07-08 13:14:41 +00:00
|
|
|
$( '#tiptip_holder' ).removeAttr( 'style' );
|
|
|
|
$( '#tiptip_arrow' ).removeAttr( 'style' );
|
|
|
|
$( '.tips' ).tipTip({
|
|
|
|
'attribute': 'data-tip',
|
|
|
|
'fadeIn': 50,
|
|
|
|
'fadeOut': 50,
|
2020-05-19 20:40:56 +00:00
|
|
|
'delay': 200,
|
|
|
|
'keepAlive': true
|
2014-07-08 13:14:41 +00:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
runTipTip();
|
|
|
|
|
2015-08-17 10:27:11 +00:00
|
|
|
$( '.wc-metaboxes-wrapper' ).on( 'click', '.wc-metabox > h3', function() {
|
2015-08-14 06:38:22 +00:00
|
|
|
$( this ).parent( '.wc-metabox' ).toggleClass( 'closed' ).toggleClass( 'open' );
|
2014-07-08 13:14:41 +00:00
|
|
|
});
|
|
|
|
|
2015-06-17 14:30:06 +00:00
|
|
|
// Tabbed Panels
|
|
|
|
$( document.body ).on( 'wc-init-tabbed-panels', function() {
|
|
|
|
$( 'ul.wc-tabs' ).show();
|
2020-11-18 17:56:30 +00:00
|
|
|
$( 'ul.wc-tabs a' ).on( 'click', function( e ) {
|
2015-08-21 15:42:34 +00:00
|
|
|
e.preventDefault();
|
2015-06-17 14:30:06 +00:00
|
|
|
var panel_wrap = $( this ).closest( 'div.panel-wrap' );
|
|
|
|
$( 'ul.wc-tabs li', panel_wrap ).removeClass( 'active' );
|
|
|
|
$( this ).parent().addClass( 'active' );
|
|
|
|
$( 'div.panel', panel_wrap ).hide();
|
|
|
|
$( $( this ).attr( 'href' ) ).show();
|
|
|
|
});
|
|
|
|
$( 'div.panel-wrap' ).each( function() {
|
|
|
|
$( this ).find( 'ul.wc-tabs li' ).eq( 0 ).find( 'a' ).click();
|
|
|
|
});
|
|
|
|
}).trigger( 'wc-init-tabbed-panels' );
|
2014-07-08 13:14:41 +00:00
|
|
|
|
2015-06-17 14:30:06 +00:00
|
|
|
// Date Picker
|
2015-04-13 15:37:22 +00:00
|
|
|
$( document.body ).on( 'wc-init-datepickers', function() {
|
2015-06-17 14:30:06 +00:00
|
|
|
$( '.date-picker-field, .date-picker' ).datepicker({
|
|
|
|
dateFormat: 'yy-mm-dd',
|
2015-01-30 11:48:22 +00:00
|
|
|
numberOfMonths: 1,
|
2015-06-17 14:30:06 +00:00
|
|
|
showButtonPanel: true
|
2015-01-30 11:48:22 +00:00
|
|
|
});
|
2015-06-17 14:30:06 +00:00
|
|
|
}).trigger( 'wc-init-datepickers' );
|
2014-07-08 13:14:41 +00:00
|
|
|
|
2015-06-17 14:30:06 +00:00
|
|
|
// Meta-Boxes - Open/close
|
|
|
|
$( '.wc-metaboxes-wrapper' ).on( 'click', '.wc-metabox h3', function( event ) {
|
2014-07-08 13:14:41 +00:00
|
|
|
// If the user clicks on some form input inside the h3, like a select list (for variations), the box should not be toggled
|
2015-07-31 11:39:23 +00:00
|
|
|
if ( $( event.target ).filter( ':input, option, .sort' ).length ) {
|
2015-06-17 14:30:06 +00:00
|
|
|
return;
|
|
|
|
}
|
2014-07-08 13:14:41 +00:00
|
|
|
|
2015-06-17 14:30:06 +00:00
|
|
|
$( this ).next( '.wc-metabox-content' ).stop().slideToggle();
|
2014-07-08 13:14:41 +00:00
|
|
|
})
|
2015-06-17 14:30:06 +00:00
|
|
|
.on( 'click', '.expand_all', function() {
|
|
|
|
$( this ).closest( '.wc-metaboxes-wrapper' ).find( '.wc-metabox > .wc-metabox-content' ).show();
|
2014-07-08 13:14:41 +00:00
|
|
|
return false;
|
|
|
|
})
|
2015-06-17 14:30:06 +00:00
|
|
|
.on( 'click', '.close_all', function() {
|
|
|
|
$( this ).closest( '.wc-metaboxes-wrapper' ).find( '.wc-metabox > .wc-metabox-content' ).hide();
|
2014-07-08 13:14:41 +00:00
|
|
|
return false;
|
|
|
|
});
|
2015-06-17 14:30:06 +00:00
|
|
|
$( '.wc-metabox.closed' ).each( function() {
|
|
|
|
$( this ).find( '.wc-metabox-content' ).hide();
|
2014-07-08 13:14:41 +00:00
|
|
|
});
|
2014-07-16 18:11:48 +00:00
|
|
|
});
|