Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 17 additions & 17 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
10 changes: 5 additions & 5 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
6 changes: 3 additions & 3 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
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: 3 additions & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Tags: custom, fields, custom fields, meta, post meta, object meta, editor, custo
Author: JustCoded / Alex Prokopenko
Author URI: http://justcoded.com/
Requires at least: 4.7
Tested up to: 5.5
Tested up to: 5.6
Stable tag: trunk
License: GNU General Public License v2

Expand Down Expand Up @@ -84,6 +84,8 @@ To upgrade remove the old plugin folder. After than follow the installation step
2. The edit post page meta box with fields created on the settings page

== Changelog ==
* Version 3.3.3 - 15 January 2021
* Issue fix: Replaced .live method by .on at js scripts.
* Version 3.3.2 - 12 August 2020
* Issue fix: Added jQuery migrate for dependents scripts
* Tests: New tests with WordPress 5.5
Expand Down