Created
March 27, 2017 08:47
-
-
Save bascht/70b08d5da133cff6ad182b835b83e6c4 to your computer and use it in GitHub Desktop.
Fixing sound output with Jenkins and simple-build-monitor plugin
This file contains hidden or 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
// 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