MediaWiki:Iso2709.js: mudanças entre as edições

Conteúdo deletado Conteúdo adicionado
jslint, eslint e jshint
 
Sem resumo de edição
 
(3 revisões intermediárias pelo mesmo usuário não estão sendo mostradas)
Linha 1:
/* jshint esversion: 10 */
// Função que gera o arquivo ISO
(function download(filename, content) {
// Função que gera o arquivo ISO
"use strict";
function download(filename, content) {
letconst element = document.createElement("'a"');
element.setAttribute("href", "data:application/marc;charset=utf-8,"
element.setAttribute("download", filename);
+ encodeURIComponent(content));
'href',
element.setAttribute("download", filename);
+ `data:application/marc;charset=utf-8,${encodeURIComponent(content));}`,
element.style.display = "none";
);
element.setAttribute('download', filename);
element.style.display = "'none"';
document.body.appendChild(element);
element.click();
document.body.removeChild(element);
}
// Se tiver uma div "isoFormat" na página/documento,
// substititua os caracteres abaixo
if ( const isoFormat = document.getElementById("'isoFormat"')) {;
if document.getElementById("isoFormat").innerHTML ={
documentisoFormat.getElementById("innerHTML = isoFormat").innerHTML.replace(/\u241D/g, String.fromCharCode(29)); // GS
/\u241D/g,
document.getElementById("isoFormat").innerHTML =
document.getElementById("isoFormat").innerHTML.replace(/\u241E/g, String.fromCharCode(3029)); // RS,
); // GS
document.getElementById("isoFormat").innerHTML =
documentisoFormat.getElementById("innerHTML = isoFormat").innerHTML.replace(/\u241F/g, String.fromCharCode(31)); // US
/\u241E/g,
document.getElementById("isoFormat").innerHTML =
document.getElementById("isoFormat").innerHTML.replace(/ /g, String.fromCharCode(3230)); // &NonBreakingSpace,
); // RS
isoFormat.innerHTML = isoFormat.innerHTML.replace(
/\u241F/g,
String.fromCharCode(31),
); // US
isoFormat.innerHTML = isoFormat.innerHTML.replace(
/ /g,
String.fromCharCode(32),
); // &NonBreakingSpace
 
letconst content = document.getElementById("isoFormat").textContent;
letconst filename = `${document.URL.substrslice(-7) + "}.mrc"`;
 
// Ao clicar no botão "downloadButton", chama a função download() abaixo
document
document .getElementById("'downloadButton"').addEventListener("click",
function(){
.addEventListener('click', () => download(filename, content), false);
}
}, false);
})();
}