From 8632aefa404ba36ac0e667440b5d509d5fc96615 Mon Sep 17 00:00:00 2001 From: KasperRT Date: Sun, 14 Dec 2014 15:45:07 +0100 Subject: [PATCH] fixed playpause visual bug I think --- js/youtube.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/js/youtube.js b/js/youtube.js index 2dc6119a..b8c5bdb8 100755 --- a/js/youtube.js +++ b/js/youtube.js @@ -145,8 +145,13 @@ function onPlayerStateChange(newState) { } if(newState.data == 1 || newState.data == 2) { - $("#playpause").toggleClass("play"); - $("#playpause").toggleClass("pause"); + activeButton = document.getElementById("playpause").className; + console.log(activeButton); + if((newState.data == 2 && activeButton == "pause") || (newState.data == 1 && activeButton == "play")) + { + $("#playpause").toggleClass("play"); + $("#playpause").toggleClass("pause"); + } } }