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

Conteúdo deletado Conteúdo adicionado
Sem resumo de edição
Sem resumo de edição
 
(Uma revisão intermediária pelo mesmo usuário não está sendo mostrada)
Linha 1:
/* jshint esversion: 10 */
(function () {
// Função que gera o arquivo ISO
"use strict";
function download(filename, content) {
// Função que gera o arquivo ISO
const element = document.createElement('a');
function download(filename, content) {
let element = document.createElementsetAttribute("a");
'href',
element.setAttribute("href", "data:application/marc;charset=utf-8,"
+ `data:application/marc;charset=utf-8,${encodeURIComponent(content));}`,
});
element.setAttribute("download", filename);
element.style.display =setAttribute('download', "none"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
let isoFormat = document.getElementById("isoFormat");
const isoFormat if= document.getElementById('isoFormat') {;
if (isoFormat.innerHTML) ={
isoFormat.innerHTML = isoFormat.innerHTML.replace(/\u241D/g, String.fromCharCode(29)); // GS
isoFormat.innerHTML =/\u241D/g,
isoFormat.innerHTML.replace(/\u241E/g, String.fromCharCode(3029)); // RS,
); // GS
isoFormat.innerHTML =
isoFormat.innerHTML = isoFormat.innerHTML.replace(/\u241F/g, String.fromCharCode(31)); // US
isoFormat.innerHTML =/\u241E/g,
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
 
const content = isoFormat.textContent;
const filename = `${document.URL.slice(-7) + "}.mrc"`;
 
// Ao clicar no botão "downloadButton", chama a função download() abaixo
document.getElementById("downloadButton").addEventListener("click",
() => download(filename, content), false);
}
 
// Ao clicar no botão "downloadButton", chama a função download() abaixo
document
document.getElementById("'downloadButton"').addEventListener("click",
.addEventListener('click', () => download(filename, content), false);
}
})();