User:Gryllida/js/copyPageTitleToClipboard-0.1.js

/* Author : Svetlana Tkachenko svetlana@members.fsf.org Licence: GPLv3+ Description: [beta] adds 'copy title' tab that copies current page title to clipboard Version: 0.1 Date: 2018-03-29 TODO: [ ] test See also . User:Gryllida/Tasks mw.loader.using(['mediawiki.api', 'jquery.ui'], function {	"use strict";	// Add 'Copy title' tab	// Code stolen from User:Gryllida/js/plagiarismcheck.js and many other places	var link = mw.util.addPortletLink(mw.config.get('skin') === 'vector' ? 'p-views' : 'p-cactions', 'javascript:void(0);', 'Copy title', 'p-gryllida-copytitle', 'Copy this page title to clipboard', '6' );	// Copy page title to clipboard	// Code stolen from User:The Earwig/permalink.js	var _copyTitle = function{       var $temp = $(" ", { val: wgCanonicalNamespace+":"+wgTitle }).appendTo("body");       $temp.select;        document.execCommand("copy");        $temp.remove;	}	// Listen to clicks	link.addEventListener('click', _copyTitle); });