Jump to content

User:Firefly/copyloglink.js

From Wikipedia, the free encyclopedia
Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.
$.when($.ready, mw.loader.using("mediawiki.util")).then(async function () {
    if (mw.config.get("wgPageName").includes("Special:Log")) {
    	$.makeArray($(".mw-logevent-loglines").children()).forEach((e)=>{$(e).append(" (<a class='ff-loglinkcopier-link' href='#'>copy link</a>)")});
    	$(".mw-logevent-loglines").on("click", ".ff-loglinkcopier-link", (e)=>{
    		const logId = $(e.currentTarget).parent().children("[title='Special:Log']")[0].href.split("logid=")[1];
    		navigator.clipboard.writeText(`[[Special:Redirect/logid/${logId}]]`);
    	});
	}
});