User:Daask/MultiResolver/en.wikipedia.js: Difference between revisions

Content deleted Content added
Temporarily merge User:Daask/MultiResolver/MultiResolver.js until I can package it properly as a module.
Allow colons before identifiers.
 
(One intermediate revision by the same user not shown)
Line 382:
*/
function findAndLinkIdentifiersByHref(property, identifier_regexp, href){
const identifierPlusRegexp = new RegExp(`^:?\\s*(${identifier_regexp})(.*)`);
const einLabelLinks = $(`a[href='${href}']`);
const einPlusTextNodes = einLabelLinks.map((i, el) => el.nextSibling);
Line 406:
// Begin en.wikipedia-specific code.
 
function findEINsfindAndLinkKnownIdentifiers(){
findAndLinkIdentifiersByHref('P1297', '\\d+', '/wiki/EIN_(identifier)');
findAndLinkIdentifiersByHref('P345', 'tt\\d+', '/wiki/IMDb_(identifier)');
}
 
$( document ).ready(findEINsfindAndLinkKnownIdentifiers());