Skip to content

Instantly share code, notes, and snippets.

@bascht
Created March 27, 2017 08:47
Show Gist options
  • Save bascht/70b08d5da133cff6ad182b835b83e6c4 to your computer and use it in GitHub Desktop.
Save bascht/70b08d5da133cff6ad182b835b83e6c4 to your computer and use it in GitHub Desktop.
Fixing sound output with Jenkins and simple-build-monitor plugin
// Klebeband. Wir brauchen mehr Klebeband!
// See https://github.com/jenkinsci/sounds-plugin/pull/5#issuecomment-288331914
// and https://github.com/jan-molak/jenkins-build-monitor-plugin/issues/159
if (typeof(Ajax) == 'undefined') {
var Ajax = { Request: function() { } };
function myFixedSoundFactory(onSuccess, onFailure) {
return function() {
var request = new XMLHttpRequest();
request.open('GET', '/sounds/getSounds', true);
request.onload = function() {
if (request.status >= 200 && request.status < 400) {
onSuccess(eval('x='+request.response));
} else {
onFailure()
}
};
request.onerror = function() { onFailure(); };
request.send();
return request;
}
}
document.write('<script src="/sounds/script" type="text/javascript"></script>');
document.addEventListener("DOMContentLoaded", function(event) {
_sounds_pollForSounds(myFixedSoundFactory);
});
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment