Skip to content

Instantly share code, notes, and snippets.

@dburger
Created November 23, 2008 21:14
Show Gist options
  • Save dburger/28201 to your computer and use it in GitHub Desktop.
Save dburger/28201 to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name Outlook Web Access Extensions
// @namespace http://www2.hawaii.edu/~dburger
// @description Extensions to using the bastard child Outlook Web Access
// @include https://mail.camber.com/exchange/*
// ==/UserScript==
(
function() {
var tables = document.getElementsByTagName('table');
for (var i = 0; i < tables.length; i++) {
var table = tables[i];
if (table.className === 'trToolbar') {
var row = table.tBodies[0].rows[0];
var newCell = row.insertCell(row.cells.length - 1);
newCell.setAttribute('valign', 'middle');
newCell.setAttribute('nowrap', 'nowrap');
var font = document.createElement('font');
font.setAttribute('size', '2');
font.appendChild(document.createTextNode('Select All'));
var nobr = document.createElement('nobr');
nobr.appendChild(font);
var a = document.createElement('a');
a.href = 'javascript:void(0);';
a.addEventListener('click', function() {
var inputs = document.getElementsByTagName('input');
for (var i = 0; i < inputs.length; i++) {
var input = inputs[i];
var evt = document.createEvent('MouseEvents');
if (input.type == 'checkbox' &amp;&amp; !input.checked) {
// this won't fire the events to color the row
// input.checked = true;
// so dispatch as an event instead
evt.initEvent('click', true, false);
input.dispatchEvent(evt);
}
}
}, true);
a.appendChild(nobr);
newCell.appendChild(a);
}
}
}
)();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment