| | Stumble It! | Add to Mixx! | | diigo it | | Slashdot |

Thursday, November 19, 2009

formWorks 0.7a


A recent email exchange has led me to update the formWorks code and include a couple new functions:
  • insertHeader(n, header)
    • This feature will let you insert section headers by adding a single line to the proper section in runMods(). For example, the code below should create the section headers we're trying to set up for your page:
function runMods() { ... } else if (location.href.match(/NewForm.aspx/)) {
... twoCols() code here...

insertHeader(19, "Counties");
insertHeader(21, "Provider Types"); } ... }
  • fixWidth()
    • Setting the variables at the top of this function to your desired length in pixel or percentage measurements will resize the elements of the form to your taste. To execute this function, simply call the function from anywhere and it will update the CSS on the page. Variables are:
      1. formWidth - this will change the width of the form as a whole
      2. labelWidth - this will change the width of the labels (list column titles) on the left of the form
      3. contentWidth - this will change the width of the text and table cell on the right of the form
      4. inputWidth - this will change the width of the input objects on the form
Also, I removed the "areYouAdmin()" function as it was causing more problems than it was solving.

Friday, November 13, 2009

Minimalist Slacker.com

I absolutely LOVE slacker.com for online radio! Originally I had flirted pretty heavily with pandora.com and was seriously impressed with their customer support, especially for someone who wasn't a paying customer (me!). But when the put a 40hr/mo cap on listening, it was a deal-breaker for me =(

One thing that I grew tired of on slacker.com, though, was all the banner ads all over the place. Luckily, GreaseMonkey and a small bit of JavaScripting came to the rescue!

I present to you, my very first published userscript!


Installing this script will also improve memory usage as it doesn't simply hide the ads, it removes them altogether =)

Before:
After:

Wednesday, November 11, 2009

Resize SharePoint Forms

Before:After:

Prompted by an email request from Peter (a reader and someone who helped me test formWorks code), I worked up this bit of JavaScript that, when inserted into a SharePoint form, will let you modify the width of the form itself and the width of the labels and content as well.
<script type="text/javascript">
function fillWidth() {
var formWidth = "100%"; // set this to whatever size you want the form to be on the page
var labelWidth = "200px"; // set this to the width you want the form label to be
var contentWidth = "100%";
var inputWidth = "100%";

// this will resize the form width
document.getElementById("onetIDListForm").style.width = formWidth;
// this block resizes the elements on the form
var styles = new Array();
styles = (document.styleSheets[0].cssRules) ? document.styleSheets[0].cssRules : document.styleSheets[0].rules;
for (var i in styles) {
if (styles[i].selectorText == ".ms-formlabel") {
styles[i].style.width = labelWidth; // this will resize the labels on the left of the form
} else if (styles[i].selectorText == ".ms-formbody") {
styles[i].style.width = contentWidth; // this will resize the content portion of the form
} else if (styles[i].selectorText == ".ms-long" || styles[i].selectorText == ".ms-rtelong") {
styles[i].style.width = inputWidth; // this will resize the input objects
}
}
}

// run the size changers when the page is loaded
document.body.onLoad = fillWidth();
</script>