• Is there a way to configure this plugin so that it refreshes posts, as they are updated? I am using the P2 theme, which lets you make frontend posts, that are updated live via Ajax. But in order to get MathJax to display, you have to first refresh the entire page…

    I was able to hack together a solution by modifying the theme’s p2.js file, changing this code segment:

    // Catch new posts submit
    $("#new_post").submit(function(trigger) {
    	if ( $( 'ul.ui-autocomplete' ).is( ':visible' ) )
    		return false;
    
    	p2.posts.submit(trigger);
    	trigger.preventDefault();
    });

    into this:

    // Catch new posts submit
    $("#new_post").submit(function(trigger) {
    	if ( $( 'ul.ui-autocomplete' ).is( ':visible' ) )
    		return false;
    
    	p2.posts.submit(trigger);
    	trigger.preventDefault();
    
    	/* Trigger MathJax refresh when new post is submitted */
    	$(document).ajaxComplete(function(){
    		MathJax.Hub.Queue(["Typeset",MathJax.Hub]);
    	});
    });

    But perhaps there is a way to do this with the plugin’s configuration instead? Also, this code refreshes the entire blog, not just the active post…

    Thanks,
    -Adam

    http://wordpress.org/plugins/simple-mathjax/

  • The topic ‘Live refresh with P2 theme?’ is closed to new replies.