Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <script>
- // ((((((((((((((((((((((replace_swfChangeHrefToRuffle v01 211127 opengame Ruffle, noopengame ((((((((((((((((((((((
- //<!-- Modify HREF for ruffle 241127c (add it to the end of the script)-->
- // Function to get the Chrome version
- function getBrowserVersion() {
- const userAgent = navigator.userAgent;
- //const match = userAgent.match(/Chrom(e|ium)\/([0-9]+)\./);
- //return match ? parseInt(match[2], 10) : null;
- // Detect Chrome or Chromium (including version number)
- const chromeMatch = userAgent.match(/Chrom(e|ium)\/([0-9]+)\./);
- if (chromeMatch) {
- return parseInt(chromeMatch[2], 10);
- }
- // Detect Firefox (including version number)
- const firefoxMatch = userAgent.match(/Firefox\/([0-9]+)\./);
- if (firefoxMatch) {
- return parseInt(firefoxMatch[1], 10);
- }
- // If neither Chrome nor Firefox is found
- return 0;
- }
- // Function to modify href links
- function modifyLinks() {
- const links = document.querySelectorAll('a');
- const prefix = './opengame_ruffle.php?file=';
- links.forEach(link => {
- const currentHref = link.getAttribute('href');
- if (currentHref && currentHref.includes('.swf') && !currentHref.includes('ruffle') ) {
- //link.setAttribute('href', prefix + encodeURIComponent(currentHref)); //ORIG works but shows %2F instead of '/'
- link.setAttribute('href', prefix + (currentHref));
- }
- });
- }
- // Check Chrome version and modify links if necessary
- const browserVersion = getBrowserVersion();
- console.log("-------------CHROMEversion="+browserVersion);
- if (browserVersion > 70 && swfChangeHrefToRuffle) {
- modifyLinks();
- }
- // )))))))))))))))))))))) replace_swfChangeHrefToRuffle ))))))))))))))))))))))
- </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement