Toggle menu
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

MediaWiki:Common.js: Difference between revisions

MediaWiki interface page
No edit summary
No edit summary
 
(222 intermediate revisions by 2 users not shown)
Line 1: Line 1:
/* Any JavaScript here will be loaded for all users on every page load. */
/* Hide "View form" tab for anonymous users */
importScript('User:Rillke/bigChunkedUpload.js');
$(function () {
    if (mw.config.get('wgUserName') === null) {
        $('#ca-formedit, #ca-viewform').remove();
    }
});


/* Ad Block. */
/*Banner-Top*/
function detectAdblock() {
window['nitroAds'].createAd('banner-top-desktop-ipad', {
   const adblockTests = {
   "refreshLimit": 20,
    // https://github.com/uBlockOrigin/uAssets/blob/master/filters/filters-2022.txt
  "refreshTime": 30,
    uBlockOrigin: {
  "renderVisibleOnly": true,
      url: 'https://incolumitas.com/data/pp34.js?sv=',
  "refreshVisibleOnly": true,
       id: '837jlaBksSjd9jh',
  "sizes": [
     },
    [
     // https://github.com/easylist/easylist/blob/master/easylist/easylist_general_block.txt
      "728",
     adblockPlus: {
      "90"
       url: 'https://incolumitas.com/data/neutral.js?&ad_height=',
    ],
      id: 'hfuBadsf3hFAk',
    [
     },
      "970",
   };
       "90"
    ],
     [
      "320",
      "100"
     ],
     [
      "320",
       "50"
    ]
  ],
  "mediaQuery": "(min-width: 1025px), (min-width: 768px) and (max-width: 1024px)",
  "geoDeny": [
     "AU"
   ]
});


  function canLoadRemoteScript(obj) {
window['nitroAds'].createAd('banner-top-mobile', {
     return new Promise(function(resolve, reject) {
  "refreshLimit": 20,
      var script = document.createElement('script');
  "refreshTime": 30,
  "renderVisibleOnly": true,
  "refreshVisibleOnly": true,
  "sizes": [
    [
      "300",
      "250"
    ],
    [
      "336",
      "280"
    ],
    [
      "320",
      "50"
    ],
    [
      "320",
      "100"
     ]
  ],
  "mediaQuery": "(min-width: 320px) and (max-width: 767px)"
});


      script.onload = function() {
/*Banner-Bottom*/
        if (document.getElementById(obj.id)) {
window['nitroAds'].createAd('banner-bottom-mobile', {
          resolve(false);
  "refreshLimit": 20,
        } else {
  "refreshTime": 30,
          resolve(true);
  "renderVisibleOnly": true,
        }
  "refreshVisibleOnly": true,
       };
  "sizes": [
    [
      "300",
      "250"
    ],
    [
      "336",
      "280"
    ],
    [
      "320",
      "50"
    ],
    [
      "320",
       "100"
    ]
  ],
  "mediaQuery": "(min-width: 320px) and (max-width: 767px)"
});


      script.onerror = function() {
window['nitroAds'].createAd('banner-bottom-desktop-ipad', {
        resolve(true);
  "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)"
});


       script.src = obj.url;
 
      document.body.appendChild(script);
/* 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": "always",
    "mobile": "full",
    "initialDelay": 1
   }
   }
});


  return new Promise(function(resolve, reject) {
/* Outstream
    let promises = [
window['nitroAds'].createAd('Videoplayer', {
      canLoadRemoteScript(adblockTests.uBlockOrigin),
  "refreshLimit": 0,
      canLoadRemoteScript(adblockTests.adblockPlus),
  "refreshTime": 30,
    ];
  "format": "floating"
});
*/


    Promise.all(promises).then((results) => {
      resolve({
        uBlockOrigin: results[0],
        adblockPlus: results[1],
      });
    }).catch((err) => {
      reject(err);
    });
  });
}


detectAdblock().then((res) => {
/*Fixed Small Banner Top*/
   alert(`Using Adblockers: ${JSON.stringify(res)}`);
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*/

Latest revision as of 05:22, 11 July 2025

/* Hide "View form" tab for anonymous users */
$(function () {
    if (mw.config.get('wgUserName') === null) {
        $('#ca-formedit, #ca-viewform').remove();
    }
});

/*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": "always",
    "mobile": "full",
    "initialDelay": 1
  }
});


/* Outstream
window['nitroAds'].createAd('Videoplayer', {
  "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: