/**
* Application de ].
* Un <span class="noarchive"> autour d'un lien l'empêche d'être pris en compte.
*
* {{Catégorisation JS|ArchiveLinks}}
*/
if ( !window.no_external_cache && ( mw.config.get( 'wgNamespaceNumber' ) === 0 || mw.user.options.get( 'gadget-ExtendedCache' ) ) ) {
mw.hook( 'wikipage.content' ).add( function ( $content ) {
'use strict';
$content.find( '.mw-parser-output' ).find( '.external' ).each( function ( _, link ) {
if ( link.tagName !== 'A' ) {
return;
}
var hostname = link.hostname;
if ( /(^|\.)wiki(edia|data)\.org$/.test( hostname )
|| hostname === 'tools.wmflabs.org'
|| hostname === 'archive.wikiwix.com'
|| hostname === 'wikiwix.com'
|| hostname === 'web.archive.org'
|| /^archive\.(is|ph|today|li|vn|fo|md)$/.test( hostname )
) {
return;
}
if ( link.closest( '.noarchive' ) ) {
return;
}
var small = document.createElement( 'small' );
small.className = 'cachelinks';
var archiveLink = document.createElement( 'a' );
archiveLink.href = 'https://archive.wikiwix.com/cache/?url=' + encodeURIComponent( link.href );
archiveLink.title = 'archive sur Wikiwix';
archiveLink.textContent = 'archive';
small.append( '\xA0' );
link.after( small );
});
});
}