User:DreZhsh/common.js: Difference between revisions

From Test Wiki
Jump to navigation Jump to search
Content deleted Content added
DreZhsh (talk | contribs)
No edit summary
DreZhsh (talk | contribs)
No edit summary
Line 1: Line 1:
var IPtocheck = mw.config.get('wgRelevantUserName') ;
var IPtocheck = mw.config.get('wgRelevantUserName') ;

function reqListener () {
function reqListener () {

$('div #contentSub2').prepend('<div align="center" style="font-size:2em;"><big>Vérification de l\'IP</big></div><br><b>Proxy</b> : <div id="proxy"></div><br><b>VPN</b> : <div id="vpn"></div><br><b>TOR</b> : <div id="tor"></div><br><b>Score de fraude</b> : <div id="fraud_score"></div>');
var obj = JSON.parse(this.responseText);
var obj = JSON.parse(this.responseText);
document.getElementById('proxy').innerHTML = obj.proxy;
document.getElementById('proxy').innerHTML = obj.proxy;
Line 19: Line 19:
if (mw.config.get('wgCanonicalSpecialPageName') === 'Block') {
if (mw.config.get('wgCanonicalSpecialPageName') === 'Block') {
if ( re.test(IPtocheck) === true ) {
if ( re.test(IPtocheck) === true ) {
$('div #contentSub2').prepend('<div align="center" style="font-size:2em;"><big>Vérification de l\'IP</big></div><br><b>Proxy</b> : <div id="proxy"></div><br><b>VPN</b> : <div id="vpn"></div><br><b>TOR</b> : <div id="tor"></div><br><b>Score de fraude</b> : <div id="fraud_score"></div>');
reqListener;
reqListener;
}
}

Revision as of 19:47, 11 December 2021

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;
}
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 ) {
        $('div #contentSub2').prepend('<div align="center" style="font-size:2em;"><big>Vérification de l\'IP</big></div><br><b>Proxy</b> : <div id="proxy"></div><br><b>VPN</b> : <div id="vpn"></div><br><b>TOR</b> : <div id="tor"></div><br><b>Score de fraude</b> : <div id="fraud_score"></div>');
        reqListener;
    }
}