User:DreZhsh/common.js

From Test Wiki
Revision as of 19:22, 11 December 2021 by DreZhsh (talk | contribs)

Note: After publishing, you may have to bypass your browser's cache to see the changes.

  • Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
  • Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
  • Internet Explorer / Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5
  • Opera: Press Ctrl-F5.
var IPtocheck = mw.config.get('wgRelevantUserName') ;
function reqListener () {
    var obj = JSON.parse(this.responseText);

    document.getElementById('proxy').innerHTML = obj.proxy;
    document.getElementById('vpn').innerHTML = obj.vpn;
    document.getElementById('tor').innerHTML = obj.tor;
    document.getElementById('fraud_score').innerHTML = obj.fraud_score;

    $('mw-content-text').text(''
    + '<div align=center><big>Détection de Proxy/VPN</big></div><br>'
    + '<b>Proxy</b> : <div id="proxy"></div>'
    * '<b>VPN</b> : <div id="vpn"></div>'
    + '<b>TOR</b> : <div id="tor"></div>'
    + '<b>Score de fraude</b> : <div id="fraud_score"></div>');


}
function Request () {
    var oReq = new XMLHttpRequest();
    oReq.onload = reqListener;
    oReq.open("get", "https://ipqualityscore.com/api/json/report/dd7359a59516a3ccd7cbe98563d2fb1f?ip=" + IPtocheck, true);
    oReq.send();
}
////////// Initialisation //////////
var re = /^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$|^((?:[0-9A-Fa-f]{1,4}))((?::[0-9A-Fa-f]{1,4}))*::((?:[0-9A-Fa-f]{1,4}))((?::[0-9A-Fa-f]{1,4}))*|((?:[0-9A-Fa-f]{1,4}))((?::[0-9A-Fa-f]{1,4})){7}$/gi ;
if (mw.config.get('wgCanonicalSpecialPageName') === 'Block') {
    if ( re.test(IPtocheck) === true ) {
        reqListener;
    }
}