-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.user.js
More file actions
157 lines (136 loc) · 5.29 KB
/
script.user.js
File metadata and controls
157 lines (136 loc) · 5.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
// ==UserScript==
// @name FlashForCurrent
// @namespace http://tampermonkey.net/
// @version 2026-04-04
// @description Native flash in modern browsers
// @author pooiod7
// @match *://*/*
// @grant none
// ==/UserScript==
(function() {
const fakeFlashPlugin = {
name: "Shockwave Flash",
description: "Shockwave Flash 32.0"
};
const fakeMimeType = {
enabledPlugin: fakeFlashPlugin,
type: "application/x-shockwave-flash"
};
if (!navigator.__proto__._plugins) {
navigator.__proto__._plugins = [...navigator.plugins];
}
if (!navigator.__proto__._mimeTypes) {
navigator.__proto__._mimeTypes = { ...navigator.mimeTypes };
}
Object.defineProperty(navigator.__proto__, "plugins", {
get: function() {
return [...this._plugins, fakeFlashPlugin];
}
});
Object.defineProperty(navigator.__proto__, "mimeTypes", {
get: function() {
return { ...this._mimeTypes, "application/x-shockwave-flash": fakeMimeType };
}
});
const originalCreateElement = Document.prototype.createElement;
Document.prototype.createElement = function(tag) {
const element = originalCreateElement.call(this, tag);
if (tag.toLowerCase() === "object") {
Object.defineProperty(element, "type", {
get: function() {
return "application/x-shockwave-flash";
},
set: function() {}
});
}
return element;
};
const originalQuerySelector = Document.prototype.querySelector;
Document.prototype.querySelector = function(selector) {
if (selector && selector.toLowerCase().includes("object[type='application/x-shockwave-flash']")) {
const obj = document.createElement("object");
obj.type = "application/x-shockwave-flash";
return obj;
}
return originalQuerySelector.call(this, selector);
};
const originalQuerySelectorAll = Document.prototype.querySelectorAll;
Document.prototype.querySelectorAll = function(selector) {
if (selector && selector.toLowerCase().includes("object[type='application/x-shockwave-flash']")) {
return [document.createElement("object")];
}
return originalQuerySelectorAll.call(this, selector);
};
const originalIncludes = String.prototype.includes;
String.prototype.includes = function(search, ...args) {
if (["flash", "shockwaveflash", "application/x-shockwave-flash"].includes(search.toLowerCase())) {
return true;
}
return originalIncludes.call(this, search, ...args);
};
const loader = document.createElement('div');
loader.id = 'dynamic-script-loader-34924';
loader.innerHTML = '<div class="spin-4534ner-28420249"></div>';
function isFlash() {
const FLASH_DOMAINS = ["scratchflash.pages.dev", "flashloader.pages.dev"];
if (FLASH_DOMAINS.includes(window.location.hostname)) return true;
return !!document.querySelector('object, embed[type*="flash"], img[alt*="Get Flash" i]');
}
window.HasFlashForCurrent = true;
const style = document.createElement('style');
style.textContent = `
#dynamic-script-loader-34924 {
position: fixed;
bottom: 20px;
right: 20px;
z-index: 99999;
padding: 12px;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
transition: opacity 0.4s ease;
opacity: ${isFlash()?"1":"0"}
}
.spin-4534ner-28420249 {
width: 20px;
height: 20px;
border: 3px solid rgba(255,255,255,0.3);
border-top: 3px solid #0066ff;
border-radius: 50%;
animation: spin-4534 0.8s linear infinite;
}
@keyframes spin-4534 {
to { transform: rotate(360deg); }
}
`;
document.head.appendChild(style);
document.body.appendChild(loader);
const script = document.createElement('script');
script.src = 'https://flashforcurrent.pages.dev/main.js';
const hideLoader = () => {
loader.style.opacity = '0';
setTimeout(() => loader.remove(), 400);
};
script.onload = () => {
setTimeout(function() {
hideLoader();
}, 1000);
};
script.onerror = () => {
if (!isFlash()) return;
hideLoader();
const n = document.createElement('div');
n.id = 'flash-prompt';
n.style = "position:fixed;top:20px;right:20px;background:#2c3e50;color:#ecf0f1;padding:20px;z-index:999999;font-family:sans-serif;width:280px;";
n.innerHTML = `
<div style='font-weight:bold;margin-bottom:8px;font-size:15px;'>Unable to load flash content</div>
<div style='font-size:13px;line-height:1.4;margin-bottom:15px;'>The FlashForCurrent library was unable to load</div>
`;
document.body.appendChild(n);
setTimeout(()=>{
n.remove();
}, 2000)
};
document.head.appendChild(script);
})();