ruffle: fix issue with ruffle falsely triggering keyboard shortcuts.
Fix issue mentioned in 55980c6fb with Javascript spazzing out on Flash
posts and randomly triggering keyboard shortcuts.
The bug was calling `javascript_pack_tag` twice. This caused the
runtime Javascript chunk to be loaded twice, caused a lot of Javascript
errors that somehow resulted in keyboard shortcuts being triggered.
The fix is to combine both calls into `javascript_pack_tag "application", "flash"`.
hxxps://github.com.rails.webpacker.issues.2932
This commit is contained in:
@@ -35,6 +35,7 @@ Post.initialize_all = function() {
|
||||
this.initialize_post_image_resize_links();
|
||||
this.initialize_recommended();
|
||||
this.initialize_ugoira_player();
|
||||
this.initialize_ruffle_player();
|
||||
}
|
||||
|
||||
if ($("#c-posts #a-show, #c-uploads #a-new").length) {
|
||||
@@ -380,6 +381,19 @@ Post.initialize_ugoira_player = function() {
|
||||
}
|
||||
};
|
||||
|
||||
Post.initialize_ruffle_player = function() {
|
||||
if (!window.RufflePlayer) {
|
||||
return;
|
||||
}
|
||||
|
||||
let ruffle = window.RufflePlayer.newest();
|
||||
let player = ruffle.createPlayer();
|
||||
let $container = $(".ruffle-container[data-swf]");
|
||||
let src = $container.attr("data-swf");
|
||||
$container.get(0).appendChild(player);
|
||||
player.load(src);
|
||||
};
|
||||
|
||||
Post.resize_ugoira_controls = function() {
|
||||
var $img = $("#image");
|
||||
var width = Math.max($img.width(), 350);
|
||||
|
||||
Reference in New Issue
Block a user