Created
August 7, 2014 18:41
-
-
Save jkrehm/0c22f84dc66c5ac9f386 to your computer and use it in GitHub Desktop.
Add turbo mode to PeopleSoft process monitor refresh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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