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 8: Line 8:
document.getElementById('fraud_score').innerHTML = obj.fraud_score;
document.getElementById('fraud_score').innerHTML = obj.fraud_score;


$('#mw-content-text').append(''
$('div #contentSub2').prepend(''
+ '<div align=center><big>Détection de Proxy/VPN</big></div><br>'
+ '<div align=center><big>Détection de Proxy/VPN</big></div><br>'
+ '<b>Proxy</b> : <div id="proxy"></div>'
+ '<b>Proxy</b> : <div id="proxy"></div>'

Revision as of 19:29, 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;

    $('div #contentSub2').prepend(''
    + '<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;
    }
}