🎉 欢迎访问GreasyFork.Org 镜像站!本镜像站由公众号【爱吃馍】搭建,用于分享脚本。联系邮箱📮

Greasy fork 爱吃馍镜像

Swf2js Flash Player

Play flash (.swf) files

スクリプトをインストールするには、Tampermonkey, GreasemonkeyViolentmonkey のような拡張機能のインストールが必要です。

You will need to install an extension such as Tampermonkey to install this script.

スクリプトをインストールするには、TampermonkeyViolentmonkey のような拡張機能のインストールが必要です。

スクリプトをインストールするには、TampermonkeyUserscripts のような拡張機能のインストールが必要です。

このスクリプトをインストールするには、Tampermonkeyなどの拡張機能をインストールする必要があります。

このスクリプトをインストールするには、ユーザースクリプト管理ツールの拡張機能をインストールする必要があります。

(ユーザースクリプト管理ツールは設定済みなのでインストール!)

🚀 安装遇到问题?关注公众号获取帮助

公众号二维码

扫码关注【爱吃馍】

回复【脚本】获取最新教程和防失联地址

このスタイルをインストールするには、Stylusなどの拡張機能をインストールする必要があります。

このスタイルをインストールするには、Stylus などの拡張機能をインストールする必要があります。

このスタイルをインストールするには、Stylus tなどの拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

(ユーザースタイル管理ツールは設定済みなのでインストール!)

🚀 安装遇到问题?关注公众号获取帮助

公众号二维码

扫码关注【爱吃馍】

回复【脚本】获取最新教程和防失联地址

このスクリプトの質問や評価の投稿はこちら通報はこちらへお寄せください
// ==UserScript== 
// @name        Swf2js Flash Player
// @namespace   i2p.schimon.swf2js
// @description Play flash (.swf) files
// @homepageURL https://schapps.woodpeckersnest.eu/
// @supportURL  https://greasyfork.org/en/scripts/466071-flash-player/feedback
// @copyright   2023, Schimon Jehudah (http://schimon.i2p)
// @license     MIT; https://opensource.org/licenses/MIT
// @require https://greasyfork.org/scripts/466069-swf2js/code/swf2js.js?version=1189198
// @match       *://*/*
// @version     25.03
// @icon        data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMDAgMTAwIj48dGV4dCB5PSIuOWVtIiBmb250LXNpemU9IjkwIj7imqE8L3RleHQ+PC9zdmc+Cg==
// ==/UserScript==

// TODO Check 404 http status

// /makyen
// /greasemonkey/greasemonkey/issues/3160#issuecomment-1456758080
//const gmXmlhttpRequest = typeof GM_xmlhttpRequest === 'function' ? GM_xmlhttpRequest : GM.xmlHttpRequest;

/*
cssSelectors = [
  'object[type="application/x-shockwave-flash"]',
  '*[type="application/x-shockwave-flash"]',
  'embed[src$=".swf"]']
*/

for (const element of document.querySelectorAll('embed[src$=".swf"]')) {
  
  let divElement = document.createElement('div');
  divElement.textContent = 'Play ⚡';// ▶️ Click to Play
  divElement.setAttribute('swf-data', element.src);
  divElement.style.height = element.closest('object').height;
  divElement.style.width = element.closest('object').width;
  divElement.style.fontSize = element.closest('object').height / 10;
  divElement.style.fontStyle = 'italic';
  divElement.style.display = 'table-cell';
  divElement.style.verticalAlign = 'middle';
  divElement.style.background = 'DarkRed';
  divElement.style.color = 'WhiteSmoke';
  divElement.style.textAlign = 'center';
  divElement.style.fontWeight = 'bold';
  divElement.style.userSelect = 'none';

  divElement.addEventListener ("click", function() {
    swf2js.load(element.src);
    let swfElement = document.querySelector('div[id*="swf2js_"]:last-child');
    swfElement.style.height = divElement.style.height;
    swfElement.style.width = divElement.style.width;
    divElement.parentNode.replaceChild(swfElement, divElement);
  });

  let orgElement = element.closest('object');
  insertAfter(orgElement, divElement);
  orgElement.remove();

}

// /questions/4793604/how-to-insert-an-element-after-another-element-in-javascript-without-using-a-lib
function insertAfter(referenceNode, newNode) {
    referenceNode.parentNode.insertBefore(newNode, referenceNode.nextSibling);
}

/* Initial release

for (const element of document.querySelectorAll('embed[src$=".swf"]')) {
  swf2js.load(element.src);
  let newElement = document.querySelector('div[id*="swf2js_"]:last-child');
  let orgElement = element.closest('object');
  insertAfter(orgElement, newElement);
  orgElement.remove();
}

function insertAfter(referenceNode, newNode) {
    referenceNode.parentNode.insertBefore(newNode, referenceNode.nextSibling);
}

*/