MediaWiki:Gadget-titleButtons.js
Jump to navigation
Jump to search
In other languages: Deutsch • English • Español • Français • Português • 中文
Note: After saving, you may have to bypass your browser's cache to see the changes.
Note: After saving, you may have to bypass your browser's cache to see the changes.
- Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
- Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
- Internet Explorer: Hold Ctrl while clicking Refresh, or press Ctrl-F5
- Opera: Go to Menu → Settings (Opera → Preferences on a Mac) and then to Privacy & security → Clear browsing data → Cached images and files.
$(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);
});
});