Revision as of 03:29, 21 March 2019 view sourceDannyS712 (talk | contribs)Edit filter managers, Extended confirmed users, Page movers, New page reviewers, Pending changes reviewers, Rollbackers, Template editors156,608 edits copy User:FR30799386/copyvio-check.js |
Revision as of 13:56, 6 December 2021 view source Mr. Stradivarius (talk | contribs)Edit filter managers, Administrators59,192 edits fix cross-site scripting vulnerability in the "view details" link; this could be exploited using a page title containing JavaScript codeNext edit → |
Line 2: |
Line 2: |
|
$(document).ready(function() { |
|
$(document).ready(function() { |
|
var runcheck=function(){ |
|
var runcheck=function(){ |
|
$.ajax('//tools.wmflabs.org/copyvios/api.json?version=1&action=search&project=wikipedia&lang=en&title=' + mw.config.get('wgTitle')).then(function(result) { |
|
$.ajax('//tools.wmflabs.org/copyvios/api.json?version=1&action=search&project=wikipedia&lang=en&title=' + encodeURIComponent(mw.config.get('wgTitle'))).then(function(result) { |
|
if ((Math.round(result.best.confidence * 100)) < 50) { |
|
if ((Math.round(result.best.confidence * 100)) < 50) { |
|
$('#FRvio').css('background', '#EFE'); |
|
$('#FRvio').css('background', '#EFE'); |
Line 8: |
Line 8: |
|
$('#FRvio').css('background', '#FEE'); |
|
$('#FRvio').css('background', '#FEE'); |
|
} |
|
} |
|
$('#FRvio').html('Around ' + Math.round(result.best.confidence * 100).toString() + '% chance of being a copyvio' + |
|
$('#FRvio').text('').append( |
|
|
document.createTextNode('Around ' + Math.round(result.best.confidence * 100).toString() + '% chance of being a copyvio ('), |
|
|
$('<a>') |
⚫ |
' (<a id="FRvio-check" target="_blank" href="//tools.wmflabs.org/copyvios/?lang=en&project=wikipedia&title=' + |
|
|
|
.attr('id', 'FRvio-check') |
⚫ |
mw.config.get('wgTitle') + '&oldid=&action=search&use_engine=1&use_links=1&turnitin=0&noredirect=true">view details</a>)'); |
|
|
|
.attr('target', '_blank') |
|
⚫ |
.attr('href', '//tools.wmflabs.org/copyvios/?lang=en&project=wikipedia&title=' + |
|
⚫ |
encodeURIComponent(mw.config.get('wgTitle')) + '&oldid=&action=search&use_engine=1&use_links=1&turnitin=0&noredirect=true') |
|
|
.text('view details'), |
|
|
document.createTextNode(')') |
|
|
); |
|
}); |
|
}); |
|
}; |
|
}; |