[March 17, 2010] An updated script is now available here.

Yesterday I shared a live demo that shows how the usability of boxed views can be improved. Really cool effects, thanks again jQuery!

But, as Charlie Epes commented, a script that changes the boxed view from two columns to one would already be really useful.

So here is a simple one – 4 lines!

<script type="text/javascript">
var boxedview = document.getElementById("WebPartWPQ1").innerHTML;
boxedview = boxedview.replace(/<td width="1.5%">&nbsp;<\/td>/gi,"<\/tr><tr style='font-size:6px\;'><td>&nbsp;<\/td><\/tr><tr>");
boxedview = boxedview.replace(/<td width="1%">&nbsp;<\/td>/gi,"<\/tr><tr style='font-size:6px\;'><td>&nbsp;<\/td><\/tr><tr>");
document.getElementById("WebPartWPQ1").innerHTML = boxedview;
</script>

Add the script to a CEWP, under the boxed view. You can see it at work on this page.

The above script is written for wss. It identifies the Web Part by its id “WebPartWPQ1″. If you use MOSS, or if the boxed view is on a page along with other Web Parts (typically on the site home page), you’ll need to change the id to “WebPartWPQ2″ or ”WebPartWPQn“. Or you can modify the code to scroll through all the Web Parts on the page and grab the boxed views.

Advertisement