new function() { var Public = { 'auto': function( bool ) { return bool != undefined ? Private.auto = bool : Private.auto; }, 'init': function() { return Private.init(); }, 'transform': function( string ) { return Private.widont( string ); } }; $.jqwidont = Public; var Private = { 'auto': true, 'init': init, 'widont': widont, 'regexp': new RegExp( '[\\n\\r\\s]+' + '(' + '[^\\n\\r\\s(?:&#160;)]+' + '[\\n\\r\\s]*' + ')$' , 'm' ) }; $(document).ready(function() { if( Private.auto ) init(); }); function init() { $( 'h1,h2,h3,h4,h5,h6' ).widont(); }; $.fn.widont = function() { return $(this).each(function() { var $obj = $(this); $obj.html( Private.widont( $obj.html() ) ); }); }; function widont( string ) { return string.replace( Private.regexp, "&#160;$1" ); };}();
