Merge pull request #1151 from AStove/PauseNoise2
Pause audio, videos and iframe when hiding plugin
This commit is contained in:
commit
0e13bd68b1
@ -31,6 +31,24 @@ weechat.directive('plugin', ['$rootScope', 'settings', function($rootScope, sett
|
|||||||
|
|
||||||
$scope.hideContent = function() {
|
$scope.hideContent = function() {
|
||||||
$scope.plugin.visible = false;
|
$scope.plugin.visible = false;
|
||||||
|
// Pause noise makers
|
||||||
|
var element = $scope.plugin.getElement()
|
||||||
|
// If it's video we can pause it
|
||||||
|
var video = element.querySelector( 'video' );
|
||||||
|
if ( video ) {
|
||||||
|
video.pause();
|
||||||
|
}
|
||||||
|
// If it's audio we can pause it
|
||||||
|
var audio = element.querySelector( 'audio' );
|
||||||
|
if ( audio ) {
|
||||||
|
audio.pause();
|
||||||
|
}
|
||||||
|
// If it has an iframe, have to reload it so it would stop
|
||||||
|
var iframe = element.querySelector( 'iframe');
|
||||||
|
if ( iframe ) {
|
||||||
|
var innerHTML = element.innerHTML;
|
||||||
|
element.innerHTML = innerHTML;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.showContent = function(automated) {
|
$scope.showContent = function(automated) {
|
||||||
|
Loading…
Reference in New Issue
Block a user