Created
May 17, 2017 11:42
-
-
Save rohit-skywalker/256ec727940a8eccdf436e3f448b45e2 to your computer and use it in GitHub Desktop.
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
<script> | |
jQuery(document).ready(function($){ | |
$('.unit_content').find('audio,video').each(function(){ | |
if(typeof this.player !== "undefined"){ | |
if(!$('#mark-complete').hasClass('tip')){return;} | |
var _player = this.player; | |
old = _player.media.setCurrentTime; | |
_player.media.setCurrentTime = function(time) { | |
if(time <= this.currentTime){ | |
old.apply(this,[time]); | |
} | |
}; | |
} | |
}); | |
$(document).on('media_loaded','#mark-complete',function(){ | |
$('.unit_content').find('audio,video').each(function(){ | |
if(typeof this.player !== "undefined"){ | |
if(!$('#mark-complete').hasClass('tip')){return;} | |
var _player = this.player; | |
old = _player.media.setCurrentTime; | |
_player.media.setCurrentTime = function(time) { | |
if(time <= this.currentTime){ | |
old.apply(this,[time]); | |
} | |
}; | |
} | |
}); | |
}); | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment