From 647c9bb250614545276e3b42727bccc2a151c532 Mon Sep 17 00:00:00 2001 From: chiu Date: Wed, 15 Sep 2021 22:42:05 +0800 Subject: [PATCH] fix bug --- app/assets/javascripts/ad_banner/jquery.jplayer.js | 8 ++++---- app/controllers/ad_banners_controller.rb | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/app/assets/javascripts/ad_banner/jquery.jplayer.js b/app/assets/javascripts/ad_banner/jquery.jplayer.js index 842f31b..84aa54c 100644 --- a/app/assets/javascripts/ad_banner/jquery.jplayer.js +++ b/app/assets/javascripts/ad_banner/jquery.jplayer.js @@ -441,9 +441,9 @@ var keyBindings = function(event) { var f = $.jPlayer.focus, ignoreKey; - + key_pressing[event.key] = true; // A jPlayer instance must be in focus. ie., keyEnabled and the last one played. - if(f) { + if(f && Object.keys(key_pressing).length==1) { // What generated the key press? $.each( $.jPlayer.keyIgnoreElementNames.split(/\s+/g), function(i, name) { // The strings should already be uppercase. @@ -469,13 +469,13 @@ } } }; - + var key_pressing = {}; $.jPlayer.keys = function(en) { var event = "keydown.jPlayer"; // Remove any binding, just in case enabled more than once. $(document.documentElement).unbind(event); if(en) { - $(document.documentElement).bind(event, keyBindings); + $(document.documentElement).bind(event, keyBindings).bind("keyup.jPlayer", function(e){delete key_pressing[e.key]}); } }; diff --git a/app/controllers/ad_banners_controller.rb b/app/controllers/ad_banners_controller.rb index 2c4f86f..1fde634 100644 --- a/app/controllers/ad_banners_controller.rb +++ b/app/controllers/ad_banners_controller.rb @@ -142,8 +142,8 @@ class AdBannersController < ApplicationController extra_before_html = "" extra_after_html = "" if has_jplayer - extra_before_html = "" - extra_after_html = "" + extra_before_html = ActionController::Base.helpers.stylesheet_link_tag("ad_banner/jplayer.blue.monday.min") + extra_after_html = ActionController::Base.helpers.javascript_include_tag("ad_banner/jquery.jplayer") end { "extras" => {