March 2010

March 31, 2010


March 29, 2010


March 26, 2010


March 24, 2010


March 18, 2010


March 17, 2010


March 11, 2010

FF2: Cursor not visible in text fields

I’m used to dealing with bugs in legacy browsers, just not ones in Firefox. A strange bug in some releases of FF2 causes the cursor to disappear in text fields and textareas. A general fix was to specify overflow: auto for the fields. However, in some stubborn cases (inside the div-complexity of a modal box), this didn’t help.

I ended up using Jquery to inject a wrapper and some CSS to fix the issue.

$('.modal input[type=text], .modal input[type=password]')
.live('focus', function(){
if ($(this).parent().hasClass('ff2fix') == false) {
$(this).wrap('<div class="ff2fix" style="float: left; width: '
+ $(this).outerWidth() + 'px; height: '
+ $(this).outerHeight() + 'px;"></div>');
$(this).css('position', 'fixed');
}
$(this).focus();
return true;
});
Ilya

March 9, 2010


March 2, 2010

How to stop non-UTF-8 characters from breaking your Wordpress feeds

If you have problems with non-UTF-8 characters breaking your feeds in Wordpress (ie. breaking XML parsers), one solution is to attach a filter to the the_excerpt_rss() function and stripping or converting the characters. I’m guessing the errant off-character characters (ahem) are the result of promiscuous copypasting.

  1. Grab Jason Judge’s self-contained function for limiting to valid UTF-8 characters (here’s a link to the source).
  2. Paste it into your theme’s functions.php file.
  3. Also add the following lines:
    function the_excerpt_rss_utf8($text) {
    return trim(clean_utf8_xml_string($text));
    }
    add_filter('the_excerpt_rss', 'the_excerpt_rss_utf8');
Ilya