| 1 |
(function ($) { |
| 2 |
|
| 3 |
$(document).ready(function(){ |
| 4 |
|
| 5 |
// Toggle for all icons |
| 6 |
|
| 7 |
$('.more-icons').on('click', function(e){ |
| 8 |
|
| 9 |
var link = $(this); |
| 10 |
|
| 11 |
e.preventDefault(); |
| 12 |
|
| 13 |
$('.all-icons').slideToggle('slow', function(){ |
| 14 |
if ($(this).is(':visible')) { |
| 15 |
link.addClass('close'); |
| 16 |
} |
| 17 |
else { |
| 18 |
link.removeClass('close'); |
| 19 |
} |
| 20 |
}); |
| 21 |
|
| 22 |
}); |
| 23 |
|
| 24 |
// Push Social Icons to display on click |
| 25 |
|
| 26 |
$( "#base-list li input[type='checkbox']" ).on( "click", function(){ |
| 27 |
var icon = $(this).closest("li").attr( "id" ); |
| 28 |
|
| 29 |
if($(this).prop("checked") == true){ |
| 30 |
if( icon === 'envelope' ){ |
| 31 |
$( "#sortable" ).append('<li id="list_item_'+icon+'"><label><input type="hidden" value="'+icon+'" name="product_share_option[buttons]['+icon+']"><span><i class="fa-solid fa-'+icon+'"></i> Email</span></label></li>'); |
| 32 |
} |
| 33 |
else if( icon === 'pocket' ){ |
| 34 |
$( "#sortable" ).append('<li id="list_item_'+icon+'"><label><input type="hidden" value="'+icon+'" name="product_share_option[buttons]['+icon+']"><span><i class="fa-brands fa-get-'+icon+'"></i> '+icon+'</span></label></li>'); |
| 35 |
} |
| 36 |
else{ |
| 37 |
|
| 38 |
$( "#sortable" ).append('<li id="list_item_'+icon+'"><label><input type="hidden" value="'+icon+'" name="product_share_option[buttons]['+icon+']"><span><i class="fa-brands fa-'+icon+'"></i> '+icon+'</span></label></li>'); |
| 39 |
} |
| 40 |
} |
| 41 |
else if($(this).prop("checked") == false){ |
| 42 |
$( "#sortable li#list_item_"+icon ).remove(); |
| 43 |
} |
| 44 |
} ); |
| 45 |
|
| 46 |
|
| 47 |
// Sortable table header |
| 48 |
|
| 49 |
$('.sortable').sortable({ |
| 50 |
items: 'li', |
| 51 |
cursor: 'move', |
| 52 |
scrollSensitivity: 100, |
| 53 |
helper: function( event, ui ) { |
| 54 |
ui.children().each( function() { |
| 55 |
$( this ).width( $( this ).width() ); |
| 56 |
}); |
| 57 |
return ui; |
| 58 |
}, |
| 59 |
}); |
| 60 |
|
| 61 |
// Color Picker |
| 62 |
$('.color-field').wpColorPicker(); |
| 63 |
|
| 64 |
|
| 65 |
}); |
| 66 |
|
| 67 |
}(jQuery)); |