Using Greasemonkey to Resize Windows in OSCAR

We've been asked for our script for resizing windows within OSCAR, it's provided below for reference.

Some tweaking of the script will unfortunately be necessary to match your specific needs.

Lots more information about using Greasemonkey to customize OSCAR is available here.

window.addEventListener('load', function () {
var url = document.URL;
//move these windows to the left half of the screen
if (url.indexOf('efmformadd_data.jsp') != - 1 || //new eform
url.indexOf('oscarEncounter/ViewRequest.do') != - 1 || // viewing consultation
url.indexOf('oscarEncounter/ViewConsultation.do') != - 1 || // viewing all consultation
url.indexOf('oscarEncounter/oscarConsultationRequest') != -1 || //viewing all consultations
url.indexOf('efmshowform_data.jsp') != - 1 || //existing eform
url.indexOf('oscarPrevention/index.jsp') != - 1 || //preventions
url.indexOf('oscarPrevention/AddPreventionData.jsp') != -1 || //preventions
url.indexOf('efmformslistadd.jsp') != - 1 || //eform list
url.indexOf('inboxManage.do') != - 1 || //inbox
url.indexOf('oscarRx') != - 1 || //rx
url.indexOf('demographic/demographiccontrol.jsp') != -1 || //demographic
url.indexOf('Oscar12_1/form') != - 1 || //forms
url.indexOf('dms/MultiPageDocDisplay.jsp') != -1 || //documents
url.indexOf('dms/showDocument.jsp') != - 1 || //documents
url.indexOf('labDisplay.jsp') != - 1//labs
 ) {
moveLeft(false);
}

//move these windows to the upperleft of the screen
if (url.indexOf('Oscar12_1/tickler/ticklerMain') != - 1 //viewing all ticklers 
 ) {
moveUpperLeft(false);
}

//move these windows to the lowerleft of the screen
if (url.indexOf('Oscar12_1/tickler/ticklerEdit.jsp') != - 1 || //individual tickler 
url.indexOf('Oscar12_1/tickler/ForwardDemographicTickler.do') != - 1 || //individual tickler when adding from inbox
url.indexOf('Oscar12_1/tickler/ticklerAdd.jsp') != - 1 //individual tickler when adding from list of ticklers
 ) {
moveLowerLeft(false);
}

//move these windows to the right of the screen, and refresh the window
if (url.indexOf('casemgmt/forward.jsp?action=view&demographicNo=') != - 1 //echart 
 ) {
moveRight(true); 
}
}, false);

function moveRight(refresh){
window.resizeTo(screen.width / 2, screen.height - 40);
if (refresh && (window.screenX - (screen.width / 2) > 2 || window.screenX - (screen.width / 2) < -2)){ //doing it this way because of rounding issues, just want to reload if not close to right spot.
location.reload();
}
window.moveTo(screen.width / 2, 0);
window.focus();
}

function moveLeft(refresh){
window.resizeTo(screen.width / 2, screen.height - 40);
if (refresh && window.screenX != 0){
location.reload();
}
window.moveTo(0, 0);
window.focus();
}

function moveUpperLeft(refresh){
window.resizeTo(screen.width / 2, (screen.height - 40)/2);
if (refresh && window.screenX != 0){
location.reload();
}
window.moveTo(0, 0);
window.focus();
}

function moveLowerLeft(refresh){
window.resizeTo(screen.width / 2, (screen.height - 40)/2);
if (refresh && window.screenX != 0){
location.reload();
}
window.moveTo(0, (screen.height - 40)/2);
window.focus();
}