• Further to https://www.ads-software.com/support/topic/duplicate-content-36/, here is updated code that fixes the dupliate id issue and ignores elements without an id attribute.
    This is based on version 2.0.0 of the plugin.

    
                if (settings.enable) {
    
                    // Hide table. We might need it again!
                    tableHTML.hide();
                    
                    // Rename all the elements in the table to avoid duplicate ids
                    // Based on https://www.ads-software.com/support/topic/duplicate-content-36/
                    if (tableHTML.attr('id') !== undefined) {
                    	tableHTML.attr('id','temp-'+tableHTML.attr('id'));
                    }
    
                    $('*', tableHTML).each(function() {
                    	if ($(this).attr('id') !== undefined) {
                    		$(this).attr('id','temp-'+$(this).attr('id'));
                    	}
                    });
    
                    // Display responsive version after table.
                    tableHTML.after(display);
    
                } else {
    
                    $(".ml-responsive-table").remove();
    
                    // Restore the original ids
                    if (tableHTML.attr('id') !== undefined) {
                    	tableHTML.attr('id',tableHTML.attr('id').replace('temp-'));
                    }
    
                    $('*', tableHTML).each(function() {
    
                        var orig_id = $(this).attr('id');
                        if (orig_id !== undefined) {
                        	var new_id = orig_id.replace('temp-','');
                        	$(this).attr('id',new_id);
                        }
    
                    });
                    
                    // Show table 
                    tableHTML.show();
                }
    
    • This topic was modified 6 years, 7 months ago by franciscus.
Viewing 5 replies - 1 through 5 (of 5 total)
  • Thanks! But where exactly do I put this.
    The original post says around line 104, but what exactly can I find there?
    This is what is on line 104:
    $lang_dir = plugin_dir_path( __FILE__ ) . ‘/languages/’;

    Johanna

    Thread Starter franciscus

    (@franciscus)

    Sorry, I should have specified that this fix applies to JavaScript file idjs/ml.responsive.table.js at line 118.
    You’ll also have to minify the Javascript, because the plugin looks for idjs/ml.responsive.table.min.js

    I uploaded the minified file, so you can just download it from here

    • This reply was modified 6 years, 4 months ago by franciscus.

    Thanks Franciscus!
    So I enter your code in the js file. And upload the minified file? Is that correct?

    Johanna

    Thread Starter franciscus

    (@franciscus)

    Just upload the minified file to the plugins\magic-liquidizer-responsive-table\idjs directory. The ML plugin does not look at the js file.

    Ok. So only the upload.
    Thanks for your work!
    Johanna ??

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Duplicate content fix’ is closed to new replies.