MediaWiki:MakeMarcFieldHelpLink.js e MediaWiki:Copyright: mudanças entre as páginas
(Diferenças entre páginas)
Ir para navegação
Ir para pesquisar
(Desfeita a edição 3728 de Jaider.ferreira (Discussão)) Etiqueta: Desfazer |
Sem resumo de edição |
||
Linha 1: | Linha 1: | ||
Conteúdo disponível sob $1. Imagens providas pela <a href="https://openlibrary.org/" target="_blank" rel="noreferrer">Open Library</a>. Contato: <a href="https://mailhide.io/e/a5SUXJVd" onclick="popup=window.open('https://mailhide.io/e/a5SUXJVd','mailhidepopup','width=580,height=635'); return false;">e-mail</a>. |
|||
/* jshint esversion: 8 */ |
|||
function makeMarcFieldHelpLink() { |
|||
const inputs = document.body.querySelectorAll('[mappingtemplate="BibRecord/tags"]'); |
|||
inputs.forEach((elem) => { |
|||
const marcFieldHelpLink = document.createElement('a'); |
|||
marcFieldHelpLink.setAttribute('target', '_blank'); |
|||
marcFieldHelpLink.innerText = '(?)'; |
|||
const marcFieldHelpLinkClass = elem |
|||
.closest('table') |
|||
.querySelector('.marcFieldHelpLink'); |
|||
marcFieldHelpLinkClass.innerHTML = ''; |
|||
marcFieldHelpLinkClass.appendChild(marcFieldHelpLink); |
|||
// find the tag value from the chosen dropdown |
|||
marcFieldHelpLinkClass.addEventListener('mouseover', (event) => { |
|||
let tagFromDropdown = ''; |
|||
tagFromDropdown = |
|||
event.target |
|||
.closest('.instanceMain') |
|||
.querySelector('.oo-ui-inputWidget-input') |
|||
.getAttribute('title') || '00x'; |
|||
tagFromDropdown = tagFromDropdown.substring(0, 3); |
|||
marcFieldHelpLink.setAttribute( |
|||
'title', |
|||
`Documentação do campo ${tagFromDropdown}`, |
|||
); |
|||
// build the URL |
|||
if ( |
|||
window.location.href.match(/A\d{6}/) || |
|||
window.location.href.match(/AutRecord/) |
|||
) { |
|||
marcFieldHelpLink.setAttribute( |
|||
'href', |
|||
`http://marc.febab.org/a${tagFromDropdown}`, |
|||
); |
|||
} else { |
|||
marcFieldHelpLink.setAttribute( |
|||
'href', |
|||
`https://www.loc.gov/marc/bibliographic/bd${tagFromDropdown}.html`, |
|||
); |
|||
} |
|||
}); |
|||
}); |
|||
} |
Edição atual tal como às 17h02min de 21 de abril de 2024
Conteúdo disponível sob $1. Imagens providas pela <a href="https://openlibrary.org/" target="_blank" rel="noreferrer">Open Library</a>. Contato: <a href="https://mailhide.io/e/a5SUXJVd" onclick="popup=window.open('https://mailhide.io/e/a5SUXJVd','mailhidepopup','width=580,height=635'); return false;">e-mail</a>.