MediaWiki:Gadget-titleButtons.js

De Sea of Thieves Wiki
Ir a la navegación Ir a la búsqueda
En otros idiomas: Deutsch • English • Español • Français • Português • 中文
Nota: tras guardar, quizás necesites actualizar la caché de tu navegador para ver los cambios.
  • Firefox/Safari: Mantén presionada la tecla Mayús mientras pulsas el botón Actualizar, o presiona Ctrl+F5 o Ctrl+R (⌘+R en Mac)
  • Google Chrome: presiona Ctrl+Shift+R (⌘+Mayús+R en Mac)
  • Internet Explorer: mantén presionada Ctrl mientras pulsas Actualizar, o presiona Ctrl+F5
  • Opera: vacía la caché en Herramientas → Preferencias
$(function() {
	var el = document.createElement('div')
	$(el).attr('id', 'title-copy-outer').html('<div id="title-copy-content" title="Copy Only Title (No Namespace)"></div><div id="title-copy-all" title="Copy Full Title (Incl Namespace)"></div>');
	$('#firstHeading').wrapInner('<div id="first-heading-text"></div>');
	$(el).insertAfter(document.getElementById('first-heading-text'));
	$('#title-copy-content').click(function() {
		var text = mw.config.get('wgTitle');
		text = text.replace(/WhatLinksHere\/(.+?:)?/,'');
		text = text.replace(/MovePage\/(.+?:)?/,'');
		navigator.clipboard.writeText(text);
		$('#title-copy-content').css('color','green');
		setTimeout(function() {
			$('#title-copy-content').css('color','');
		}, 2000);
	});
	$('#title-copy-all').click(function() {
		var text = mw.config.get('wgPageName');
		text = text.replace(/Special:WhatLinksHere\//,'');
		text = text.replace(/Special:MovePage\//,'');
		navigator.clipboard.writeText(text);
		$('#title-copy-all').css('color','green');
		setTimeout(function() {
			$('#title-copy-all').css('color','');
		}, 2000);
	});
});