Skip to content

Instantly share code, notes, and snippets.

@megoth
Last active December 21, 2015 21:09
Show Gist options
  • Save megoth/6366513 to your computer and use it in GitHub Desktop.
Save megoth/6366513 to your computer and use it in GitHub Desktop.
function (scope, element) {
function iframeSetup(frameRef) {
var iframe = frameRef.contentWindow ? frameRef.contentWindow.document : frameRef.contentDocument;
var finished = iframe.getElementById("ExerciseComplete") != null;
if (finished) {
scope.$emit("checkboxSurveyCompleted", scope.uriToExercises);
return;
}
var paused = iframe.getElementById("ExercisePaused") != null; // bogus ID, must be replaced with something that actually is used in checkbox
if (paused) {
scope.$emit("checkboxSurveyPaused", scope.uriToExercises);
return;
}
}
element.on("load", function () {
iframeSetup(this);
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment