Gebruiker:Rots61/Gadget-LogTheCounter.js: verschil tussen versies
Naar navigatie springen
Naar zoeken springen
Regel 20: | Regel 20: | ||
} else { | } else { | ||
console.log(data2); | console.log(data2); | ||
− | + | eendownloadfunctievoordegebruikerrotsenenzestigdieniethelemaalgoedwerktmaarwelafdoendevoordetaakwaarvoordezeisgeschreven(JSON.stringify(data2)); | |
} | } | ||
} ); | } ); | ||
} | } | ||
− | + | function eendownloadfunctievoordegebruikerrotsenenzestigdieniethelemaalgoedwerktmaarwelafdoendevoordetaakwaarvoordezeisgeschreven(data, filename, type) { | |
− | function | + | var file = new Blob([data], {type: type}); |
− | + | if (window.navigator.msSaveOrOpenBlob) | |
− | + | window.navigator.msSaveOrOpenBlob(file, filename+"." + type); | |
− | + | else { | |
− | + | var a = document.createElement("a"), | |
+ | url = URL.createObjectURL(file); | ||
+ | a.href = url; | ||
+ | a.download = filename; | ||
+ | document.body.appendChild(a); | ||
+ | a.click(); | ||
+ | setTimeout(function() { | ||
+ | document.body.removeChild(a); | ||
+ | window.URL.revokeObjectURL(url); | ||
+ | }, 0); | ||
} | } | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
} | } |
Versie van 9 feb 2023 19:05
/* jshint sub:true maxerr:100000 */
var api = new mw.Api();
var data2 = [];
var aantalallepaginasmetlinkdienietbestaan = 0;
var edit_token;
function allepaginasmetlinkdienietbestaan(apiContinue) {
api.get( {
action: "query",
list: "querypage",
qppage: "Wantedpages",
qplimit: 5000,
qpoffset: apiContinue ? apiContinue.qpoffset : undefined
} ).then( function (data) {
data2 = data2.concat(data.query.querypage.results);
aantalallepaginasmetlinkdienietbestaan += 1;
console.log(aantalallepaginasmetlinkdienietbestaan);
if ( data.continue ) {
allepaginasmetlinkdienietbestaan( data.continue );
} else {
console.log(data2);
eendownloadfunctievoordegebruikerrotsenenzestigdieniethelemaalgoedwerktmaarwelafdoendevoordetaakwaarvoordezeisgeschreven(JSON.stringify(data2));
}
} );
}
function eendownloadfunctievoordegebruikerrotsenenzestigdieniethelemaalgoedwerktmaarwelafdoendevoordetaakwaarvoordezeisgeschreven(data, filename, type) {
var file = new Blob([data], {type: type});
if (window.navigator.msSaveOrOpenBlob)
window.navigator.msSaveOrOpenBlob(file, filename+"." + type);
else {
var a = document.createElement("a"),
url = URL.createObjectURL(file);
a.href = url;
a.download = filename;
document.body.appendChild(a);
a.click();
setTimeout(function() {
document.body.removeChild(a);
window.URL.revokeObjectURL(url);
}, 0);
}
}