Skip to content

Instantly share code, notes, and snippets.

@jkrehm
Created August 7, 2014 18:41
Show Gist options
  • Save jkrehm/0c22f84dc66c5ac9f386 to your computer and use it in GitHub Desktop.
Save jkrehm/0c22f84dc66c5ac9f386 to your computer and use it in GitHub Desktop.
Add turbo mode to PeopleSoft process monitor refresh
var $frame = $('#ptifrmtgtframe');
$frame.load(function () {
// If refresh button not found, don't continue
if ($frame.contents().find('#REFRESH_BTN').length === 0) {
$('#turbo-enabled').remove();
return;
}
var interval;
var $checkbox = $('<input>', {
type: 'checkbox'
});
var $label = $('<label>', {
id: 'turbo-enabled',
style: 'position: absolute'
});
$label
.append('Turbo Mode')
.append($checkbox);
$('#ptifrmtarget').prepend($label);
// On checkbox change, enable/disable turbo mode
$checkbox.change(function () {
var enabled = $checkbox.prop('checked');
if (enabled) {
interval = setInterval(function () {
if (enabled) {
$frame.contents().find('#REFRESH_BTN').trigger('click');
}
}, 3000);
} else {
clearInterval(interval);
}
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment