Skip to content
36 changes: 18 additions & 18 deletions assets/just_custom_fields.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,14 +92,14 @@ function initFieldsetsEdit() {
})

// init delete button on change popup
jQuery('#jcf_ajax_content .jcf_edit_fieldset a.field-control-remove').live('click', function() {
jQuery('#jcf_ajax_content .jcf_edit_fieldset a.field-control-remove').on('click', function() {
var f_id = jQuery(this).parents('form:first').find('input[name=fieldset_id]').val();
jQuery('#jcf_fieldset_' + f_id + ' a.jcf_fieldset_delete').click();
return false;
});

// save on edit form
jQuery('#jcform_edit_fieldset').live('submit', function( e ) {
jQuery('#jcform_edit_fieldset').on('submit', function( e ) {
e.preventDefault();
var f_id = jQuery(this).find('input[name=fieldset_id]').val();
var data = {
Expand Down Expand Up @@ -139,7 +139,7 @@ function initFieldsetsEdit() {
});

// choose base for visibility rule (page template/taxonomy)
jQuery('#rule-based-on').live('change', function() {
jQuery('#rule-based-on').on('change', function() {
var data = {
'based_on': jQuery(this).val(),
'action': 'jcf_get_rule_options',
Expand All @@ -151,7 +151,7 @@ function initFieldsetsEdit() {
});

// choose taxonomy terms for visibility rule
jQuery('#rule-taxonomy').live('change', function() {
jQuery('#rule-taxonomy').on('change', function() {
var data = {
'taxonomy': jQuery(this).val(),
'action': 'jcf_get_taxonomy_terms',
Expand All @@ -165,7 +165,7 @@ function initFieldsetsEdit() {
});

//parse rule block for saving
jQuery('.save_rule_btn, .update_rule_btn').live('click', function(e) {
jQuery('.save_rule_btn, .update_rule_btn').on('click', function(e) {
e.preventDefault();

var f_id = jQuery(this).parents('form').find('input[name=fieldset_id]').val();
Expand Down Expand Up @@ -202,7 +202,7 @@ function initFieldsetsEdit() {
});

// add form for new visibility rule
jQuery('.add_rule_btn').live('click', function(e) {
jQuery('.add_rule_btn').on('click', function(e) {
e.preventDefault();

var data = {
Expand All @@ -216,7 +216,7 @@ function initFieldsetsEdit() {
});

// delete visibility rule
jQuery('a.remove-rule').live('click', function(e) {
jQuery('a.remove-rule').on('click', function(e) {
e.preventDefault();
var rule_id = jQuery(this).data('rule_id');
var f_id = jQuery(this).parents('form').find('input[name=fieldset_id]').val();
Expand All @@ -233,7 +233,7 @@ function initFieldsetsEdit() {
});

// edit visibility rule
jQuery('a.edit-rule').live('click', function(e) {
jQuery('a.edit-rule').on('click', function(e) {
e.preventDefault();
var rule_id = jQuery(this).data('rule_id');
var f_id = jQuery(this).parents('form').find('input[name=fieldset_id]').val();
Expand All @@ -253,22 +253,22 @@ function initFieldsetsEdit() {
});

// show/hide visibility options for fieldset
jQuery('a.visibility_toggle').live('click', function(e) {
jQuery('a.visibility_toggle').on('click', function(e) {
e.preventDefault();
jQuery('#visibility').toggle();
jQuery(this).find('span').toggleClass('dashicons-arrow-down-alt2');
jQuery(this).find('span').toggleClass('dashicons-arrow-up-alt2');
});

// cancel form for add or edit visibility rule
jQuery('.cancel_rule_btn').live('click', function(e) {
jQuery('.cancel_rule_btn').on('click', function(e) {
e.preventDefault();
jQuery(this).parents('fieldset#fieldset_visibility_rules').remove();
jQuery('.add_rule_btn').show();
});

// adding new term for visility
jQuery('.termadd').live('click', function(e) {
jQuery('.termadd').on('click', function(e) {
e.preventDefault();
if ( !jQuery('#new-term').attr('data-term_id') && !jQuery('#new-term').attr('data-term_label') ) {
var taxonomy = jQuery('.taxonomy-options #rule-taxonomy').val();
Expand Down Expand Up @@ -349,7 +349,7 @@ function initFieldsetFields() {
});

// init save button on edit form
jQuery('#jcform_edit_field').live('submit', function( e ) {
jQuery('#jcform_edit_field').on('submit', function( e ) {
e.preventDefault();

// get query string from the form
Expand Down Expand Up @@ -431,7 +431,7 @@ function initFieldsetFields() {
});

// delete button
jQuery('#jcf_fieldsets tbody span.delete a').live('click', function() {
jQuery('#jcf_fieldsets tbody span.delete a').on('click', function() {
if ( confirm(jcf_textdomain.confirm_field_delete) ) {
var row = jQuery(this).parents('tr:first');
var f_id = jQuery(this).parents('tbody:first').attr('id').replace('the-list-', '');
Expand All @@ -452,7 +452,7 @@ function initFieldsetFields() {
})

// edit button
jQuery('#jcf_fieldsets tbody span.edit a, #jcf_fieldsets tbody strong > a').live('click', function() {
jQuery('#jcf_fieldsets tbody span.edit a, #jcf_fieldsets tbody strong > a').on('click', function() {
var f_id = jQuery(this).parents('tbody:first').attr('id').replace('the-list-', '');
var data = {
action: 'jcf_edit_field',
Expand All @@ -470,7 +470,7 @@ function initFieldsetFields() {
})

// delete button in edit form
jQuery('#jcform_edit_field a.field-control-remove').live('click', function( e ) {
jQuery('#jcform_edit_field a.field-control-remove').on('click', function( e ) {
var field_id = jQuery(this).parents('form:first').find('input[name=field_id]').val();
var row = jQuery('#field_row_' + field_id);
row.find('span.delete a').click();
Expand Down Expand Up @@ -556,7 +556,7 @@ function initExport() {
*/
function initImportExportCheckboxes() {
// checked fields
jQuery('#jcf_save_import_fields input[type="checkbox"], #jcf_export_fields input[type="checkbox"]').live('change', function() {
jQuery('#jcf_save_import_fields input[type="checkbox"], #jcf_export_fields input[type="checkbox"]').on('change', function() {
var $this = jQuery(this);
var data_checked = $this.is(':checked');

Expand Down Expand Up @@ -584,7 +584,7 @@ function initImportExportCheckboxes() {
* ajax functions below
*/
function initAjaxBoxClose() {
jQuery('#jcf_ajax_content a.field-control-close').live('click', function() {
jQuery('#jcf_ajax_content a.field-control-close').on('click', function() {
jcf_hide_ajax_container();
});
}
Expand Down Expand Up @@ -791,4 +791,4 @@ function jcf_form_serialize_object( obj ) {
}
});
return data;
}
}
12 changes: 6 additions & 6 deletions components/collection/assets/collection.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jQuery(document).ready(function() {
*/
function initCollectionFields() {
// init add form
jQuery('form.jcform_add_collection_field').live('submit', function( e ) {
jQuery('form.jcform_add_collection_field').on('submit', function( e ) {
e.preventDefault();

var data = {action: 'jcf_add_field'};
Expand All @@ -28,7 +28,7 @@ function initCollectionFields() {
});

// init save button on edit form
jQuery('#jcform_edit_collection_field').live('submit', function( e ) {
jQuery('#jcform_edit_collection_field').on('submit', function( e ) {
e.preventDefault();

// get query string from the form
Expand Down Expand Up @@ -75,7 +75,7 @@ function initCollectionFields() {
});

// edit button
jQuery('#jcf_fieldsets tbody span.edit_collection a').live('click', function() {
jQuery('#jcf_fieldsets tbody span.edit_collection a').on('click', function() {
var f_id = jQuery(this).parents('tbody:first').parents('tbody:first').attr('id').replace('the-list-', '');
var c_id = jQuery(this).data('collection_id');
var data = {
Expand All @@ -93,7 +93,7 @@ function initCollectionFields() {
return false;
})
// delete button
jQuery('#jcf_fieldsets tbody span.delete_collection a').live('click', function() {
jQuery('#jcf_fieldsets tbody span.delete_collection a').on('click', function() {
if ( confirm(jcf_textdomain.confirm_field_delete) ) {
var row = jQuery(this).parents('tr:first');
var f_id = jQuery(this).parents('tbody:first').parents('tbody:first').attr('id').replace('the-list-', '');
Expand All @@ -115,7 +115,7 @@ function initCollectionFields() {
})

// delete button in edit form
jQuery('#jcform_edit_collection_field a.field-control-remove').live('click', function( e ) {
jQuery('#jcform_edit_collection_field a.field-control-remove').on('click', function( e ) {
var field_id = jQuery(this).parents('form:first').find('input[name=field_id]').val();
var row = jQuery('#collection_field_row_' + field_id);
row.find('span.delete_collection a').click();
Expand Down Expand Up @@ -155,4 +155,4 @@ function collectionFieldSortableStop( event, ui, e ) {
};
//pa(data);
jcf_ajax(data, 'json');
}
}
8 changes: 4 additions & 4 deletions components/relatedcontent/related-content.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ function jcf_relatedcontent_init() {

jcf_relatedcontent_max_index = jQuery(jcf_post_body_content_container).find('div.jcf-relatedcontent-row').size();

node.find('div.jcf-relatedcontent-field a.jcf_delete').live('click', function() {
node.find('div.jcf-relatedcontent-field a.jcf_delete').on('click', function() {
var row = jQuery(this).parents('div.jcf-relatedcontent-row:first');
row.find('div.jcf-relatedcontent-container').css({'opacity': 0.3});
row.find('div.jcf-relatedcontent-container .jcf_delete').hide();
Expand All @@ -37,7 +37,7 @@ function jcf_relatedcontent_init() {
return false;
});

node.find('div.jcf-relatedcontent-field a.jcf_cancel').live('click', function() {
node.find('div.jcf-relatedcontent-field a.jcf_cancel').on('click', function() {
var row = jQuery(this).parents('div.jcf-relatedcontent-row:first');
row.find('div.jcf-relatedcontent-container').css({'opacity': 1});
row.find('div.jcf-relatedcontent-container .jcf_delete').show();
Expand All @@ -48,7 +48,7 @@ function jcf_relatedcontent_init() {
});

// add more button
node.find('div.jcf-relatedcontent-field a.jcf_add_more').live('click', function() {
node.find('div.jcf-relatedcontent-field a.jcf_add_more').on('click', function() {
var container = jQuery(this).parent();

jcf_relatedcontent_max_index++;
Expand Down Expand Up @@ -121,4 +121,4 @@ function jcf_relatedcontent_init_sortable(node) {
ui.placeholder.html('<div class="sort-placheholder"></div>');
},
});
}
}
6 changes: 3 additions & 3 deletions components/simplemedia/assets/simplemedia-modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ jQuery(document).ready(function() {
var node = jQuery('#post-body');
}

node.find('div.jcf-simple-row a.jcf_simple_delete').live('click', function( e ) {
node.find('div.jcf-simple-row a.jcf_simple_delete').on('click', function( e ) {
var value_id = jQuery(this).data('field_id');
var row = jQuery(this).parents('div.jcf-simple-row');
// reset value
Expand All @@ -115,7 +115,7 @@ jQuery(document).ready(function() {
return false;
});

node.find('div.jcf-simple-row a.jcf_simple_cancel').live('click', function() {
node.find('div.jcf-simple-row a.jcf_simple_cancel').on('click', function() {
var value_id = jQuery(this).data('field_id');
var row = jQuery(this).parents('div.jcf-simple-row');
jQuery('#' + value_id).prop('disabled', false);
Expand All @@ -124,4 +124,4 @@ jQuery(document).ready(function() {
row.find('#simplemedia-' + value_id).show();
return false;
});
})
})
4 changes: 2 additions & 2 deletions components/table/table.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
jQuery(document).ready(function() {
jQuery('.jcf-table .jcf_add_row').live('click', function() {
jQuery('.jcf-table .jcf_add_row').on('click', function() {
var container = jQuery(this).parent().parent().find('table');
var jcf_table_row_max_index = container.find('tr').size();
jcf_table_row_max_index--;
Expand All @@ -12,7 +12,7 @@ jQuery(document).ready(function() {
return false;
});

jQuery('.jcf-table .jcf_delete_row').live('click', function() {
jQuery('.jcf-table .jcf_delete_row').on('click', function() {
var table = jQuery(this).parents('table');
if (table.find('tr').size() == 4) {
table.find('tr.no-rows').show();
Expand Down
4 changes: 2 additions & 2 deletions controllers/AdminController.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public function addScripts()
wp_register_script(
$slug,
jcf_plugin_url('assets/just_custom_fields.js'),
array( 'jquery', 'json2', 'jquery-form', 'jquery-ui-sortable', 'jquery-migrate' )
array( 'jquery', 'json2', 'jquery-form', 'jquery-ui-sortable' )
);
wp_enqueue_script($slug);
wp_enqueue_script('jquery-ui-autocomplete');
Expand Down Expand Up @@ -103,7 +103,7 @@ public function registerEditAssets()
wp_register_script(
'jcf_edit_post',
jcf_plugin_url('assets/edit_post.js'),
array( 'jquery', 'tags-box', 'jquery-migrate' )
array( 'jquery', 'tags-box' )
);

wp_register_style('jcf_edit_post', jcf_plugin_url('assets/edit_post.css'));
Expand Down
2 changes: 1 addition & 1 deletion controllers/TaxonomyController.php
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ public function addScripts()
wp_register_script(
'jcf_edit_taxonomy',
jcf_plugin_url('assets/edit_taxonomy.js'),
array( 'jquery', 'jquery-migrate' )
array( 'jquery' )
);
wp_enqueue_script('jcf_edit_taxonomy');
}
Expand Down