Play flash (.swf) files
// ==UserScript==
// @name Ruffle Flash Player
// @namespace i2p.schimon.ruffle
// @description Play flash (.swf) files
// @homepageURL https://schapps.woodpeckersnest.eu/
// @supportURL https://greasyfork.org/en/scripts/490282-flash-player-ruffle/feedback
// @copyright 2024, Schimon Jehudah (http://schimon.i2p)
// @license MIT; https://opensource.org/licenses/MIT
// @match file:///*
// @match *://*/*
// @version 25.03
// @grant none
// @icon data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMDAgMTAwIj48dGV4dCB5PSIuOWVtIiBmb250LXNpemU9IjkwIj7imqE8L3RleHQ+PC9zdmc+Cg==
// ==/UserScript==
// Please help https://openuserjs.org/garage/Help_making_ruffle_to_work
// @require https://unpkg.com/@ruffle-rs/ruffle/ruffle.js
function activateRuffle() {
// The @require directive will automatically load Ruffle, so no further action is needed.
'use strict';
// The following code is used as a backup system.
let ruffleScript = document.createElement('script');
// Use the CDN version of Ruffle
ruffleScript.src = 'https://unpkg.com/@ruffle-rs/ruffle';
document.head.appendChild(ruffleScript);
};
function infoBar() {
let namespace = 'i2p-schimon-ruffle';
let bar = document.createElement(namespace);
document.body.append(bar);
bar.innerHTML = '⚡ Activate Ruffle Flash Player';
bar.title = 'Flash elements have been detected on this page. Click this bar to activate Ruffle player.';
bar.id = namespace;
bar.style.backgroundColor = '#37528c';
bar.style.color = '#ffad33';
bar.style.fontFamily = 'system-ui';
bar.style.fontSize = 'larger';
bar.style.fontWeight = 'bold';
bar.style.right = 0;
bar.style.left = 0;
bar.style.top = 0;
bar.style.zIndex = 10000000000;
bar.style.padding = '6px'; //13px //15px //11px //9px //3px //1px
bar.style.position = 'fixed';
bar.style.textAlign = 'center'; // justify
bar.style.direction = 'ltr';
bar.style.userSelect = 'none';
// set bar behaviour
bar.onclick = () => {
bar.style.display = 'none';
activateRuffle();
};
}
(function() {
if (document.querySelector('embed[src$=".swf"]')) {
infoBar();
}
})();