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

Ir para navegação Ir para pesquisar
sem sumário de edição
imported>Jaideraf
Sem resumo de edição
imported>Jaideraf
Sem resumo de edição
"use strict";
(function Export2Docx() {
"use strict";
let decodeEntities = (function Export2Docx() {
// https://stackoverflow.com/questions/5796718/html-entity-decode
let decodeEntities = (function () {
// this prevents any overhead from creating the object each time
// https://stackoverflow.com/questions/5796718/html-entity-decode
let element = document.createElement("div");
// this prevents any overhead from creating the object each time
let element = document.createElement("div");
 
function decodeHTMLEntities(str) {
if (str && typeof str === "string") {
// strip script/html tags
str = str.replace(/<script[^>]*>([\S\s]*?)<\/script>/gmi, "");
str = str.replace(/<\/?\w(?:[^"'>]|"[^"]*"|'[^']*')*>/gmi, "");
element.innerHTML = str;
str = element.textContent;
element.textContent = "";
}
 
return str;
}
 
return decodeHTMLEntitiesstr;
})();
 
//return Create documentdecodeHTMLEntities;
})();
const doc = new Document({
creator: "Wikincat",
title: "Ficha catalográfica",
description: "Ficha catalográfica gerada pelo Wikincat"
});
 
// let card =Create document.getElementById("card");
const doc = new Document({
let p = card.getElementsByTagName("p");
creator: "Wikincat",
title: "Ficha catalográfica",
description: "Ficha catalográfica gerada pelo Wikincat"
});
 
let card = doc.createParagraph(document.getElementById("cipParagraphcard").textContent).center();
let p = card.getElementsByTagName("p");
 
doc.createParagraph(document.getElementById("creditcipParagraph").textContent).center();
const borderParagraphStartCard = new Paragraph("").createBorder();
borderParagraphStartCard.Borders.addBottomBorder();
doc.addParagraph(borderParagraphStartCard);
 
const borderParagraphStartCard = new Paragraph("").createBorder();
doc.createParagraph("");
borderParagraphStartCard.Borders.addBottomBorder();
doc.addParagraph(borderParagraphStartCard);
 
doc.createParagraph(decodeEntities(p[0].textContent)""); // 1XX
doc.createParagraph("");
 
doc.createParagraph(decodeEntities(p[30].textContent)); // Track1XX
let arrayP1 = p[1].innerHTML.split("<br>"); // 24X
doc.createParagraph("");
arrayP1.forEach((item) => {
doc.createParagraph(decodeEntities(item));
});
 
let arrayP1 = docp[1].createParagraphinnerHTML.split("<br>"); // 24X
arrayP1.forEach((item) => {
doc.createParagraph(decodeEntities(item));
});
 
doc.createParagraph("");
let arrayP2 = p[2].innerHTML.split("<br>");
arrayP2.forEach((item) => {
doc.createParagraph(decodeEntities(item));
});
 
let arrayP2 = docp[2].innerHTML.createParagraphsplit("<br>");
arrayP2.forEach((item) => {
doc.createParagraph(decodeEntities(p[3].textContent)); // Track
doc.createParagraph(""decodeEntities(item));
});
 
doc.createParagraph("");
if (p[4] !== undefined) {
doc.createParagraph(decodeEntities(p[3].textContent)); // Track
let arrayP4 = p[4].innerHTML.split("<br>");
doc.createParagraph("");
arrayP4.forEach((item) => {
doc.createParagraph(decodeEntities(item)).right();
});
}
 
if (p[4] !== undefined) {
doc.createParagraph("");
let arrayP1arrayP4 = p[14].innerHTML.split("<br>"); // 24X
arrayP4.forEach((item) => {
doc.createParagraph(decodeEntities(item)).right();
});
}
 
doc.createParagraph("");
const borderParagraphEndCard = new Paragraph("").createBorder();
borderParagraphEndCard.Borders.addTopBorder();
doc.addParagraph(borderParagraphEndCard);
 
const borderParagraphEndCard = new Paragraph("").createBorder();
doc.createParagraph(document.getElementById("credit").textContent).center();
borderParagraphEndCard.Borders.addTopBorder();
doc.addParagraph(borderParagraphEndCard);
 
doc.createParagraph(document.getElementById("credit").textContent).center();
// Used to export the file into a .docx file
const packer = new Packer();
 
// Used to export the file into a .docx file
packer.toBlob(doc).then(blob => {
const packer = new console.logPacker(blob);
 
saveAs(blob, "Ficha.docx");
packer.toBlob(doc).then(blob => {
//console.log( "Documento criado com sucesso" );
}console.log(blob);
saveAs(blob, "Ficha.docx");
}
//console.log( "Documento criado com sucesso" );
})();
});
}
Usuário anônimo

Menu de navegação