MediaWiki:MarcEditorDynamicLinks.js e B000008: mudanças entre as páginas
(Diferenças entre páginas)
Ir para navegação
Ir para pesquisar
Sem resumo de edição |
Sem resumo de edição |
||
Linha 1: | Linha 1: | ||
{{BibRecord |
|||
// Author: @vitorsilverio |
|||
|dateEnteredOnFile=221005 |
|||
// Author: @jaideraf |
|||
|itemType=01 |
|||
/*jshint esversion: 6 */ |
|||
|recordStatus=n |
|||
function main() { |
|||
|typeOfRecord=a |
|||
let tag = ''; |
|||
|bibliographicLevel=m |
|||
let tagFromDropdown = ''; |
|||
|encodingLevel= |
|||
|descriptiveCatalogingForm=a |
|||
function createMarcFieldHelpLink() { |
|||
|multipartResourceRecordLevel= |
|||
const tagInputs = document.body.querySelectorAll('.tagInput'); |
|||
|typeOfDate=s |
|||
tagInputs.forEach((elem) => { |
|||
|date1=2015 |
|||
const marcFieldHelpLink = document.createElement('a'); |
|||
|placeOfPublication=spb |
|||
marcFieldHelpLink.setAttribute('target', '_blank'); |
|||
|illustrations=a |
|||
marcFieldHelpLink.innerText = '(?)'; |
|||
|targetAudience=f |
|||
|formOfItem= |
|||
const marcFieldHelpLinkClass = elem.closest('table') |
|||
|natureOfContents= |
|||
.querySelector('.marcFieldHelpLink'); |
|||
|governmentPublication= |
|||
marcFieldHelpLinkClass.innerHTML = ""; |
|||
|conferencePublication= |
|||
marcFieldHelpLinkClass.appendChild(marcFieldHelpLink); |
|||
|festschrift= |
|||
|index= |
|||
// find the tag value from the chosen dropdown |
|||
|literaryForm= |
|||
marcFieldHelpLinkClass.addEventListener('mouseover', (event) => { |
|||
|biography= |
|||
tagFromDropdown = event.target.closest('.instanceMain') |
|||
|language=por |
|||
.querySelector('.oo-ui-inputWidget-input') |
|||
|modifiedRecord= |
|||
.getAttribute('title') || '00x'; |
|||
|catalogingSource=d |
|||
tagFromDropdown = tagFromDropdown.substring(0, 3); |
|||
}} |
|||
marcFieldHelpLink.setAttribute( |
|||
{{Field |
|||
'title', |
|||
|tag=020 |
|||
`Documentação do campo ${tagFromDropdown}` |
|||
|authorityType=Nenhuma |
|||
); |
|||
|ind1=# |
|||
// build the URL |
|||
|ind2=# |
|||
if (window.location.href.match(/A\d{6}/) |
|||
|data=$a 9788579932724 $q v. 1 |
|||
|| window.location.href.match(/AutRecord/)) { |
|||
}} |
|||
marcFieldHelpLink.setAttribute( |
|||
{{Field |
|||
'href', |
|||
|tag=020 |
|||
`http://marc.febab.org/a${tagFromDropdown}` |
|||
|authorityType=Nenhuma |
|||
); |
|||
|ind1=# |
|||
} else { |
|||
|ind2=# |
|||
marcFieldHelpLink.setAttribute( |
|||
|data=$a 9788579932717 $q v. 2 |
|||
'href', |
|||
}} |
|||
`https://www.loc.gov/marc/bibliographic/bd${tagFromDropdown}.html` |
|||
{{Field |
|||
); |
|||
|tag=040 |
|||
} |
|||
|authorityType=Nenhuma |
|||
}); |
|||
|ind1=# |
|||
}); |
|||
|ind2=# |
|||
} |
|||
|data=$a BR-FlWIK $b por $c BR-FlWIK $d BR-FlUSC |
|||
}} |
|||
function createAuthorityLinks() { |
|||
{{Field |
|||
const inputs = document.body.querySelectorAll('.instanceMain div table .oo-ui-inputWidget-input'); |
|||
|tag=080 |
|||
inputs.forEach((elem) => { |
|||
|authorityType=Nenhuma |
|||
const authorityLink = document.createElement('a'); |
|||
|ind1=# |
|||
authorityLink.setAttribute('title', 'Abre uma nova aba para criar ou editar um registro de autoridade'); |
|||
|ind2=# |
|||
authorityLink.setAttribute('target', '_blank'); |
|||
|data=$a 639.3(81) |
|||
authorityLink.innerText = 'Criar registro de autoridade'; |
|||
}} |
|||
authorityLink.style.display = 'none'; |
|||
{{Field |
|||
|tag=090 |
|||
const createAuthorityLink = elem.closest('table') |
|||
|authorityType=Nenhuma |
|||
.querySelector('.createAuthorityLink'); |
|||
|ind1=# |
|||
createAuthorityLink.innerHTML = ""; |
|||
|ind2=# |
|||
createAuthorityLink.appendChild(authorityLink); |
|||
|data=$a 639.3(81) $b A656 |
|||
}} |
|||
const pattern1 = /\$0\sA\d{6}/; |
|||
{{Field |
|||
const pattern2 = /\$0\s\(BN\)\d{9}/; |
|||
|tag=245 |
|||
|authorityType=Nenhuma |
|||
elem.addEventListener('focusout', () => { |
|||
|ind1=0 |
|||
// if already recorded |
|||
|ind2=0 |
|||
if (pattern1.test(elem.value)) { |
|||
|data=$a Aquicultura no Brasil : $b novas perceptivas / $c organizadores: Marcos Tavares-Dias, Wagner dos Santos Mariano |
|||
// build the URL for Wikincat aut record edit |
|||
}} |
|||
authorityLink.innerText = 'Editar autoridade'; |
|||
{{Field |
|||
authorityLink.setAttribute( |
|||
|tag=260 |
|||
'href', |
|||
|authorityType=Nenhuma |
|||
`/wiki/Special:FormEdit/AutRecord/Autoridade:${ |
|||
|ind1=# |
|||
elem.value.match(/A\d{6}/)}` |
|||
|ind2=# |
|||
); |
|||
|data=$a São Carlos : $b Pedro&João editores, $c 2015. |
|||
} else if (pattern2.test(elem.value)) { |
|||
}} |
|||
// build the URL for BN aut record view |
|||
{{Field |
|||
authorityLink.innerText = 'Ver registro de autoridade na BN'; |
|||
|tag=300 |
|||
authorityLink.setAttribute( |
|||
|authorityType=Nenhuma |
|||
'href', |
|||
|ind1=# |
|||
`http://acervo.bn.gov.br/sophia_web/autoridade/detalhe/${ |
|||
|ind2=# |
|||
elem.value.match(/\d{9}/)}` |
|||
|data=$a 2 v. : $b il. ; $c 23 cm. |
|||
}} |
|||
} else { |
|||
{{Field |
|||
// find the tag value from the chosen dropdown |
|||
|tag=500 |
|||
tagFromDropdown = elem.closest('.instanceMain') |
|||
|authorityType=Nenhuma |
|||
.querySelector('.oo-ui-inputWidget-input') |
|||
|ind1=# |
|||
.getAttribute('title') || '00x'; |
|||
|ind2=# |
|||
tagFromDropdown = tagFromDropdown.substring(0, 3); |
|||
|data=$a Núcleo de ensino, pesquisa e extensão em aquicultura familiar (NEPEAqui) |
|||
// find the tag value from checked radio button |
|||
}} |
|||
{{Field |
|||
const tagFromRadio = elem.closest('.instanceMain') |
|||
|tag=504 |
|||
.querySelector('input[origname=\'Field[authorityType]\']:checked') |
|||
|authorityType=Nenhuma |
|||
.value; |
|||
|ind1=# |
|||
|ind2=# |
|||
const authorityTypes = { |
|||
|data=$a Inclui referências. |
|||
'Pessoa': '100', |
|||
}} |
|||
'Entidade coletiva': '110', |
|||
{{Field |
|||
'Evento': '111', |
|||
|tag=650 |
|||
'Título uniforme': '130', |
|||
|authorityType=Tópico |
|||
|ind1=0 |
|||
'Local': '151' |
|||
|ind2=4 |
|||
}; |
|||
|authorityData150=$a Aquicultura $0 (BN)000120747 |
|||
}} |
|||
if (tagFromRadio in authorityTypes) { |
|||
{{Field |
|||
tag = authorityTypes[tagFromRadio]; |
|||
|tag=650 |
|||
} |
|||
|authorityType=Tópico |
|||
|ind1=0 |
|||
// declare the indicators default values |
|||
|ind2=4 |
|||
let ind1 = elem.closest('.instanceMain') |
|||
|authorityData150=$a Organismos aquáticos $0 (BN)000134666 |
|||
.querySelector('select[origname=\'Field[ind1]\'] option:checked') |
|||
}} |
|||
.value; |
|||
{{Field |
|||
let ind2 = elem.closest('.instanceMain') |
|||
|tag=650 |
|||
.querySelector('select[origname=\'Field[ind2]\'] option:checked') |
|||
|authorityType=Tópico |
|||
.value; |
|||
|ind1=0 |
|||
|ind2=4 |
|||
// declare the 008 field default values |
|||
|authorityData150=$a Pesca $x Equipamento e acessórios $0 (BN)000010001 |
|||
let directOrIndirectGeogSubdiv = ''; // 06 |
|||
}} |
|||
let kindOfRecord = ''; // 09 |
|||
{{Field |
|||
let descriptiveCatalogingRules = 'c'; // 10 |
|||
|tag=700 |
|||
let subjectHeadingSystem = 'n'; // 11 |
|||
|authorityType=Pessoa |
|||
let typeOfSeries = 'n'; // 12 |
|||
|ind1=1 |
|||
let numberedOrUnnumberedSeries = 'n'; // 13 |
|||
|ind2=# |
|||
let headingUseMainOrAddedEntry = 'a'; // 14 |
|||
|authorityData100=$a Tavares-Dias, Marcos $0 (BN)000326676, $4 org. |
|||
let headingUseSubjectAddedEntry = 'a'; // 15 |
|||
}} |
|||
let headingUseSeriesAddedEntry = 'b'; // 16 |
|||
{{Field |
|||
let typeOfSubjectSubdivision = 'n'; // 17 |
|||
|tag=700 |
|||
let undifferentiatedPersonalName = 'n'; // 32 |
|||
|authorityType=Nenhuma |
|||
let levelOfEstablishment = 'a'; // 33 |
|||
|ind1=1 |
|||
|ind2=# |
|||
// set the 008 field and indicadors specific values |
|||
|data=$a Mariano, Wagner dos Santos, $4 org. |
|||
if (tag === '100') { |
|||
}} |
|||
undifferentiatedPersonalName = 'a'; |
|||
{{Field |
|||
ind2 = ''; |
|||
|tag=740 |
|||
} |
|||
|authorityType=Nenhuma |
|||
if (tag === '110') { |
|||
|ind1=0 |
|||
// in case of autocomplete of 260 |
|||
|ind2=# |
|||
if (tagFromDropdown === '260') { |
|||
|data=$a Aspectos biológicos, fisiológicos e sanitários de organismos aquáticos. |
|||
directOrIndirectGeogSubdiv = 'n'; |
|||
}} |
|||
kindOfRecord = 'b'; |
|||
{{Field |
|||
headingUseMainOrAddedEntry = 'b'; |
|||
|tag=740 |
|||
headingUseSubjectAddedEntry = 'b'; |
|||
|authorityType=Nenhuma |
|||
levelOfEstablishment = 'n'; |
|||
|ind1=0 |
|||
ind1 = '1'; |
|||
|ind2=# |
|||
} |
|||
|data=$a Produção e Reprodução de organismos aquáticos |
|||
ind2 = ''; |
|||
}} |
|||
} |
|||
{{EndOfRecord}} |
|||
if (tag === '111') { |
|||
ind1 = '2'; |
|||
ind2 = ''; |
|||
} |
|||
if (tag === '130') { |
|||
typeOfSeries = 'a'; |
|||
numberedOrUnnumberedSeries = 'b'; |
|||
headingUseSeriesAddedEntry = 'a'; |
|||
if (tagFromDropdown === '130' |
|||
|| tagFromDropdown === '630' |
|||
|| tagFromDropdown === '730') { |
|||
ind2 = ind1; // an inverted value happens here, see and |
|||
ind1 = ''; // compare bib. and auth. 130 MARC definitions |
|||
} |
|||
ind1 = ''; |
|||
} |
|||
if (tag === '150' || tag === '151') { |
|||
descriptiveCatalogingRules = 'n'; |
|||
subjectHeadingSystem = 'z'; |
|||
headingUseMainOrAddedEntry = 'b'; |
|||
ind1 = ''; // 150 and 151 indicators must be empty in |
|||
ind2 = ''; // authority MARC records |
|||
if (tag === '151') { |
|||
typeOfSubjectSubdivision = 'd'; |
|||
} |
|||
} |
|||
// build the URL |
|||
const autRecordParams = { |
|||
AutRecord: { |
|||
directOrIndirectGeogSubdiv, |
|||
kindOfRecord, |
|||
descriptiveCatalogingRules, |
|||
subjectHeadingSystem, |
|||
typeOfSeries, |
|||
numberedOrUnnumberedSeries, |
|||
headingUseMainOrAddedEntry, |
|||
headingUseSubjectAddedEntry, |
|||
headingUseSeriesAddedEntry, |
|||
typeOfSubjectSubdivision, |
|||
undifferentiatedPersonalName, |
|||
levelOfEstablishment |
|||
}, |
|||
Field: { |
|||
'1': { |
|||
tag: '040', |
|||
data: '$a BR-FlWIK $b por $c BR-FlWIK $d BR-FlUSC' |
|||
}, |
|||
'2': { |
|||
tag, |
|||
ind1, |
|||
ind2, |
|||
data: elem.value |
|||
}, |
|||
'3': { |
|||
tag: '670', |
|||
data: '$a ' |
|||
} |
|||
} |
|||
}; |
|||
const url = new URL(`${window.location.origin}/wiki/Special:FormEdit/AutRecord`); |
|||
// function to transform a 3rd level object to URL query strings |
|||
const makeUrlParams = (obj) => { |
|||
for (const [key, value] of Object.entries(obj)) { |
|||
if (typeof value === 'object') { |
|||
for (const [key2, value2] of Object.entries(value)) { |
|||
if (typeof value2 === 'object') { |
|||
for (const [key3, value3] of Object.entries(value2)) { |
|||
url.searchParams.set(`${key}[${key2}][${key3}]`, value3); |
|||
} |
|||
} else { |
|||
url.searchParams.set(`${key}[${key2}]`, value2); |
|||
} |
|||
} |
|||
} else { |
|||
url.searchParams.set(key, value); |
|||
} |
|||
} |
|||
}; |
|||
makeUrlParams(autRecordParams); |
|||
authorityLink.innerText = 'Criar registro de autoridade'; |
|||
authorityLink.setAttribute('href', url.pathname + url.search); |
|||
} |
|||
authorityLink.style.display = ''; |
|||
}); |
|||
}); |
|||
} |
|||
function rmCarriageReturn() { |
|||
const inputs = document.body.querySelectorAll('.instanceMain div table .oo-ui-inputWidget-input'); |
|||
inputs.forEach((input) => { |
|||
const element = input; |
|||
element.value = element.value.replace(' ', ''); |
|||
}); |
|||
} |
|||
function rmHtmlTags() { |
|||
const inputs = document.body.querySelectorAll('.instanceMain div table .oo-ui-inputWidget-input'); |
|||
inputs.forEach((input) => { |
|||
const element = input; |
|||
element.value = element.value.replace(/<(?:"[^"]*"['"]*|'[^']*'['"]*|[^'">])+>/g, ''); |
|||
}); |
|||
} |
|||
function rmTxtFromHiddenTexareas() { |
|||
const inputs = document.body.querySelectorAll('span.hiddenByPF'); |
|||
inputs.forEach((elem) => { |
|||
elem.querySelectorAll('.input.oo-ui-inputWidget-input').forEach((input) => { |
|||
const element = input; |
|||
element.value = ''; |
|||
}); |
|||
}); |
|||
} |
|||
function normalizeInput() { |
|||
const inputs = document.body.querySelectorAll('.instanceMain div table .oo-ui-inputWidget-input'); |
|||
inputs.forEach((input) => { |
|||
const normalizedInput = input; |
|||
normalizedInput.value = normalizedInput.value |
|||
// "$a Bar \n$b Baz" > " $a Bar $b Baz" |
|||
.replace(/\s*(\$[a-z0-8])\s*/g, ' $1 ') |
|||
// "$a Bar\nFoo" > "$a Bar Foo" ou "$a Bar Foo" > "$a Bar Foo" |
|||
.replace(/\n|\s\s+|\t/g, ' ') |
|||
// replace "|" by "%7C" (Ex.: http://viaf.org/processed/WKP|Q2484404) |
|||
.replace('|', '%7C'); |
|||
}); |
|||
} |
|||
// calls main functions |
|||
createMarcFieldHelpLink(); |
|||
createAuthorityLinks(); |
|||
rmCarriageReturn(); |
|||
rmHtmlTags(); |
|||
// Como instâncias do formulário são criadas pelo botão "Adicionar campo", |
|||
// é necessário observar o DOM a partir da classe ".multipleTemplateList". |
|||
// Toda vez que o DOM é alterado (mais especificamente, quando uma nova |
|||
// child de ".multipleTemplateList" é criada), as funções |
|||
// createMarcFieldHelpLink() e createAuthorityLinks() são novamente chamadas. |
|||
// https://developer.mozilla.org/en-US/docs/Web/API/MutationObserver |
|||
// create an observer instance |
|||
const observer = new MutationObserver((mutations) => { |
|||
mutations.forEach((mutation) => { |
|||
const newNodes = mutation.addedNodes; // DOM NodeList |
|||
if (newNodes.length !== 0) { // if there are new nodes added |
|||
createMarcFieldHelpLink(); |
|||
createAuthorityLinks(); |
|||
} |
|||
}); |
|||
}); |
|||
// select the target node |
|||
const target = document.querySelector('.multipleTemplateList'); |
|||
// configuration of the observer |
|||
const config = { |
|||
childList: true, |
|||
attributes: false, |
|||
subtree: false, |
|||
}; |
|||
// pass in the target node, as well as the observer options |
|||
observer.observe(target, config); |
|||
// when clicking save... |
|||
const saveBtn = document.body.querySelector('#wpSave'); |
|||
saveBtn.addEventListener('click', () => { |
|||
observer.disconnect(); |
|||
rmTxtFromHiddenTexareas(); |
|||
rmCarriageReturn(); |
|||
rmHtmlTags(); |
|||
normalizeInput(); |
|||
}); |
|||
} |
|||
if (document.readyState === 'complete' || (document.readyState !== 'loading')) { |
|||
main(); |
|||
} else { |
|||
document.addEventListener('DOMContentLoaded', main); |
|||
} |
Edição atual tal como às 20h37min de 13 de março de 2024
Título principal
Aquicultura no Brasil : novas perceptivas / organizadores: Marcos Tavares-Dias, Wagner dos Santos Mariano
Criado em
São Carlos
Publicado por
Pedro&João editores
Data de publicação
2015
Descrição física
2 v. : il. ; 23 cm.
Nota
Núcleo de ensino, pesquisa e extensão em aquicultura familiar (NEPEAqui)
Inclui referências.
Aquicultura no Brasil : novas perceptivas / organizadores: Marcos Tavares-Dias, Wagner dos Santos Mariano
Criado em
São Carlos
Publicado por
Pedro&João editores
Data de publicação
2015
Descrição física
2 v. : il. ; 23 cm.
Nota
Núcleo de ensino, pesquisa e extensão em aquicultura familiar (NEPEAqui)
Inclui referências.
Assunto
Aquicultura
Organismos aquáticos
Pesca - Equipamento e acessórios
Responsabilidade
Tavares-Dias, Marcos
Mariano, Wagner dos Santos
Idioma
Português
ISBN
978-85-7993-272-4 (v. 1)
978-85-7993-271-7 (v. 2)
Aquicultura
Organismos aquáticos
Pesca - Equipamento e acessórios
Responsabilidade
Tavares-Dias, Marcos
Mariano, Wagner dos Santos
Idioma
Português
ISBN
978-85-7993-272-4 (v. 1)
978-85-7993-271-7 (v. 2)
validar catalogação | ficha catalográfica | referência ABNT | buscar em outras bibliotecas | criar exemplar
exportar: MARC tags, MARCXML, ISO 2709
exportar: MARC tags, MARCXML, ISO 2709
Campo | Ind1 | Ind2 | Dados |
---|---|---|---|
Líder | 00641nam a2200217 a 4500 | ||
001 - Número de controle | B000008 | ||
003 - Identificador do número de controle | BR-FlWIK | ||
005 - Data e hora da última transação | 20240313203723.0 | ||
008 - Informações gerais | 221005s2015 spba f 000 0 por d | ||
020 - International Standard Book Number (ISBN) | # | # |
$a9788579932724 |
020 - International Standard Book Number (ISBN) | # | # |
$a9788579932717 |
040 - Fonte da catalogação | # | # |
$aBR-FlWIK |
080 - Número na Classificação Decimal Universal (CDU) | # | # |
$a639.3(81) |
090 - Número de chamada local (etiqueta) | # | # |
$a639.3(81) |
245 - Indicação de título | 0 | 0 |
$aAquicultura no Brasil : |
260 - Publicação, distribuição, etc. (Imprenta) | # | # |
$aSão Carlos : |
300 - Descrição física | # | # |
$a2 v. : |
500 - Nota geral | # | # |
$aNúcleo de ensino, pesquisa e extensão em aquicultura familiar (NEPEAqui) |
504 - Nota de bibliografia, etc. | # | # |
$aInclui referências. |
650 - Ponto de acesso secundário de assunto - Termo tópico | 0 | 4 |
$aAquicultura |
650 - Ponto de acesso secundário de assunto - Termo tópico | 0 | 4 |
$aOrganismos aquáticos |
650 - Ponto de acesso secundário de assunto - Termo tópico | 0 | 4 |
$aPesca |
700 - Ponto de acesso secundário - Nome pessoal | 1 | # |
$aTavares-Dias, Marcos |
700 - Ponto de acesso secundário - Nome pessoal | 1 | # |
$aMariano, Wagner dos Santos, |
740 - Ponto de acesso secundário - Título relacionado/analítico não controlado | 0 | # |
$aAspectos biológicos, fisiológicos e sanitários de organismos aquáticos. |
740 - Ponto de acesso secundário - Título relacionado/analítico não controlado | 0 | # |
$aProdução e Reprodução de organismos aquáticos |