Toggle menu
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.
The main server is currently down. We are running on a backup server, so editing and search functionality are temporarily disabled. Please check back in a few hours.

MediaWiki:Common.js: Difference between revisions

MediaWiki interface page
No edit summary
No edit summary
Line 4: Line 4:
/*mw.loader.load( 'https://www.gamebrew.org/index.php?title=MediaWiki:Blockadblock.js&action==raw&ctype=text/javascript' );*/
/*mw.loader.load( 'https://www.gamebrew.org/index.php?title=MediaWiki:Blockadblock.js&action==raw&ctype=text/javascript' );*/


// NitroPay Ad-Block Detection
/* NitroPay Ad-Block Detection*/
(function () {
(function () {
    console.log("🔍 Starting ad-block test...");
     var npDetect = new (function () {
     var npDetect = new (function () {
         this.blocking = false;
         this.blocking = false;
Line 14: Line 16:
             i.onerror = () => {
             i.onerror = () => {
                 errcnt++;
                 errcnt++;
                console.log("❌ Image failed to load (ad blocker?) Attempt:", errcnt);
                 if (errcnt < 3) {
                 if (errcnt < 3) {
                     setTimeout(testImg, 250);
                     setTimeout(testImg, 250);
                 } else {
                 } else {
                     npDetect.blocking = true;
                     this.blocking = true;
                    console.log("✅ Ad blocker detected!");


                     if (document.dispatchEvent && window.CustomEvent) {
                     if (document.dispatchEvent && window.CustomEvent) {
Line 23: Line 28:
                             new CustomEvent('np.blocking', {
                             new CustomEvent('np.blocking', {
                                 detail: {
                                 detail: {
                                     blocking: npDetect.blocking,
                                     blocking: true,
                                 },
                                 },
                             })
                             })
Line 31: Line 36:
             };
             };
             i.onload = () => {
             i.onload = () => {
                 npDetect.blocking = false;
                 this.blocking = false;
                console.log("✅ Ad image loaded — no ad blocker detected.");
             };
             };


Line 40: Line 46:
     })();
     })();


    // Optional: Show a message if ad-block is detected
     document.addEventListener('np.blocking', (e) => {
     document.addEventListener('np.blocking', (e) => {
         if (e.detail.blocking) {
         console.log("📢 Event received:", e.detail);
            alert("We noticed you're using an ad blocker. Please consider supporting us by disabling it.");
        alert("We noticed you're using an ad blocker.");
        }
     });
     });
})();
})();




// Set Ruffle config before loading the script
/* Set Ruffle config before loading the script*/
window.RufflePlayer = window.RufflePlayer || {};
window.RufflePlayer = window.RufflePlayer || {};
window.RufflePlayer.config = {
window.RufflePlayer.config = {
Line 55: Line 59:
};
};


// Load Ruffle player
/* Load Ruffle player*/
var ruffleScript = document.createElement("script");
var ruffleScript = document.createElement("script");
ruffleScript.src = "https://unpkg.com/@ruffle-rs/ruffle";
ruffleScript.src = "https://unpkg.com/@ruffle-rs/ruffle";

Revision as of 08:46, 19 April 2025

/* Any JavaScript here will be loaded for all users on every page load. importScript('User:Rillke/bigChunkedUpload.js');*/

/* Check For Ad Block*/
/*mw.loader.load( 'https://www.gamebrew.org/index.php?title=MediaWiki:Blockadblock.js&action==raw&ctype=text/javascript' );*/

/* NitroPay Ad-Block Detection*/
(function () {
    console.log("🔍 Starting ad-block test...");

    var npDetect = new (function () {
        this.blocking = false;
        var errcnt = 0;

        function testImg() {
            var i = new Image();
            i.onerror = () => {
                errcnt++;
                console.log("❌ Image failed to load (ad blocker?) Attempt:", errcnt);

                if (errcnt < 3) {
                    setTimeout(testImg, 250);
                } else {
                    this.blocking = true;
                    console.log("✅ Ad blocker detected!");

                    if (document.dispatchEvent && window.CustomEvent) {
                        document.dispatchEvent(
                            new CustomEvent('np.blocking', {
                                detail: {
                                    blocking: true,
                                },
                            })
                        );
                    }
                }
            };
            i.onload = () => {
                this.blocking = false;
                console.log("✅ Ad image loaded — no ad blocker detected.");
            };

            i.src = 'https://s.nitropay.com/1.gif?' + Math.random() + '&adslot=';
        }

        testImg();
    })();

    document.addEventListener('np.blocking', (e) => {
        console.log("📢 Event received:", e.detail);
        alert("We noticed you're using an ad blocker.");
    });
})();


/* Set Ruffle config before loading the script*/
window.RufflePlayer = window.RufflePlayer || {};
window.RufflePlayer.config = {
    autoplay: "off" // Prevents autoplay until user interacts
};

/* Load Ruffle player*/
var ruffleScript = document.createElement("script");
ruffleScript.src = "https://unpkg.com/@ruffle-rs/ruffle";
document.head.appendChild(ruffleScript);


/*Banner-Top*/
window['nitroAds'].createAd('banner-top-desktop-ipad', {
  "refreshLimit": 20,
  "refreshTime": 30,
  "renderVisibleOnly": true,
  "refreshVisibleOnly": true,
  "sizes": [
    [
      "728",
      "90"
    ],
    [
      "970",
      "90"
    ],
    [
      "320",
      "100"
    ],
    [
      "320",
      "50"
    ]
  ],
  "mediaQuery": "(min-width: 1025px), (min-width: 768px) and (max-width: 1024px)",
  "geoDeny": [
    "AU"
  ]
});

window['nitroAds'].createAd('banner-top-mobile', {
  "refreshLimit": 20,
  "refreshTime": 30,
  "renderVisibleOnly": true,
  "refreshVisibleOnly": true,
  "sizes": [
    [
      "300",
      "250"
    ],
    [
      "336",
      "280"
    ],
    [
      "320",
      "50"
    ],
    [
      "320",
      "100"
    ]
  ],
  "mediaQuery": "(min-width: 320px) and (max-width: 767px)"
});

/*Banner-Bottom*/
window['nitroAds'].createAd('banner-bottom-mobile', {
  "refreshLimit": 20,
  "refreshTime": 30,
  "renderVisibleOnly": true,
  "refreshVisibleOnly": true,
  "sizes": [
    [
      "300",
      "250"
    ],
    [
      "336",
      "280"
    ],
    [
      "320",
      "50"
    ],
    [
      "320",
      "100"
    ]
  ],
  "mediaQuery": "(min-width: 320px) and (max-width: 767px)"
});

window['nitroAds'].createAd('banner-bottom-desktop-ipad', {
  "refreshLimit": 20,
  "refreshTime": 30,
  "renderVisibleOnly": true,
  "refreshVisibleOnly": true,
  "sizes": [
    [
      "300",
      "250"
    ],
    [
      "336",
      "280"
    ],
    [
      "970",
      "250"
    ]
  ],
  "mediaQuery": "(min-width: 1025px), (min-width: 768px) and (max-width: 1024px)"
});


/* Ads in Content Script*/
window['nitroAds'].createAd('mw-content-text', {
  "refreshLimit": 20,
  "refreshTime": 30,
  "format": "article",
  "pageInterval": 3,
  "sizes": [
    [
      "300",
      "250"
    ],
    [
      "336",
      "280"
    ],
    [
      "320",
      "50"
    ],
    [
      "320",
      "100"
    ]
  ],
  "mediaQuery": "(min-width: 320px) and (max-width: 767px)"
});


/* Ads in AnchorText Script*/
window['nitroAds'].createAd('AnchorText-mobile', {
  "refreshLimit": 20,
  "refreshTime": 30,
  "format": "anchor",
  "anchor": "top",
  "anchorPersistClose": false,
  "mediaQuery": "(min-width: 320px) and (max-width: 767px)"
});


/* Video Script - Desktop and Ipad Only*/

window['nitroAds'].createAd('Videoplayer', {
  "format": "video-nc",
  "video": {
    "float": "auto",
    "mobile": "compact",
    "initialDelay": 1
  }
});

/*
$(document).ready(function() {
    var videoHtml = '<div id="Videoplayer"></div>';
    $('body').append(videoHtml);
});

window['nitroAds'].createAd('videoplayer3', {
  "format": "video-nc",
  "video": {
    "mobile": "compact"
  }
});
*/

/* Outstream
window['nitroAds'].createAd('videoplayer2', {
  "refreshLimit": 0,
  "refreshTime": 30,
  "format": "floating"
});
*/


/*Fixed Small Banner Top*/
window['nitroAds'].createAd('small-banner-top', {
  "refreshLimit": 20,
  "refreshTime": 30,
  "renderVisibleOnly": true,
  "refreshVisibleOnly": true,
  "sizes": [
    [
      "320",
      "50"
    ]
  ],
  "mediaQuery": "(min-width: 1025px), (min-width: 768px) and (max-width: 1024px)"
});

/*Sidebar-Sticky*/
window['nitroAds'].createAd('sidebar-sticky', {
  "refreshLimit": 20,
  "refreshTime": 30,
  "renderVisibleOnly": true,
  "refreshVisibleOnly": true,
  "sizes": [
    [
      "160",
      "600"
    ]
  ],
  "mediaQuery": "(min-width: 1200px), (min-width: 1200px) and (max-width: 1200px)"
});

/*Ads-Infobox*/
window['nitroAds'].createAd('Ads-Infobox', {
  "refreshLimit": 20,
  "refreshTime": 30,
  "renderVisibleOnly": true,
  "refreshVisibleOnly": true,
  "sizes": [
    [
      "300",
      "250"
    ],
    [
      "336",
      "280"
    ],
    [
      "320",
      "50"
    ],
    [
      "320",
      "100"
    ]
  ],
  "mediaQuery": "(min-width: 1025px), (min-width: 768px) and (max-width: 1024px), (min-width: 320px) and (max-width: 767px)",
  "geoDeny": [
    "AU"
  ]
});

window['nitroAds'].createAd('Ads-Infobox1', {
  "refreshLimit": 20,
  "refreshTime": 30,
  "renderVisibleOnly": true,
  "refreshVisibleOnly": true,
  "sizes": [
    [
      "320",
      "50"
    ]
  ],
  "mediaQuery": "(min-width: 1025px), (min-width: 768px) and (max-width: 1024px), (min-width: 320px) and (max-width: 767px)",
  "geoDeny": [
    "AU"
  ]
});

window['nitroAds'].createAd('Ads-Infobox3', {
  "refreshLimit": 20,
  "refreshTime": 30,
  "renderVisibleOnly": true,
  "refreshVisibleOnly": true,
  "sizes": [
    [
      "320",
      "50"
    ]
  ],
  "mediaQuery": "(min-width: 1025px), (min-width: 768px) and (max-width: 1024px), (min-width: 320px) and (max-width: 767px)"
});


/* Large Mobile Banner*/
window['nitroAds'].createAd('largemobilebanner', {
  "refreshLimit": 20,
  "refreshTime": 30,
  "renderVisibleOnly": true,
  "refreshVisibleOnly": true,
  "sizes": [
    [
      "320",
      "50"
    ]
  ],
  "mediaQuery": "(min-width: 1025px), (min-width: 768px) and (max-width: 1024px), (min-width: 320px) and (max-width: 767px)",
  "geoDeny": [
    "AU"
  ]
});


/*AnchorBottom*/
window['nitroAds'].createAd('anchorBottom', {
  "refreshLimit": 20,
  "refreshTime": 30,
  "format": "anchor",
  "anchor": "bottom",
  "anchorPersistClose": false,
  "mediaQuery": "(min-width: 1025px), (min-width: 1000px) and (max-width: 1024px)"
});

/*Ads-InfoboxTop*/
window['nitroAds'].createAd('Ads-InfoboxTop', {
  "refreshLimit": 20,
  "refreshTime": 30,
  "renderVisibleOnly": true,
  "refreshVisibleOnly": true,
  "sizes": [
    [
      "300",
      "250"
    ],
    [
      "320",
      "50"
    ],
    [
      "320",
      "100"
    ]
  ],
  "mediaQuery": "(min-width: 1025px), (min-width: 800px) and (max-width: 1024px)"
});

/* Ad Block*/

Advertising: