YOURLS: WordPress to Twitter
small change to prevent JS error (1 post)

  1. sboisvert
    Posted 4 years ago #

    on 1.5.4 With a custom post type that has no title even if the short url is unchecked yourls_update_count() will still fire and since jQuery('#titlewrap #title').val() is undefined and .length is called on it Firefox doesn'T like that and stops parsing JS for other things, it leaves a uge gap at the top of the page.
    Adding an if to the function fixes this. Here is the function with the if statement:

    function yourls_update_count() {
    	if (jQuery('#titlewrap #title').val()){
    		var len = 140 - jQuery('#titlewrap #title').val().length;
    		if (len < 60) {jQuery('#yourls_count').removeClass().addClass('len60');}
    		if (len < 30) {jQuery('#yourls_count').removeClass().addClass('len30');}
    		if (len < 15) {jQuery('#yourls_count').removeClass().addClass('len15');}
    		if (len < 0) {jQuery('#yourls_count').removeClass().addClass('len0');}


Topic Closed

This topic has been closed to new replies.

About this Plugin

  • YOURLS: WordPress to Twitter
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic