MediaWiki:Gadget-exchangePages-core.js

From Old School Near-Reality Wiki
Revision as of 17:25, 3 October 2022 by Jacmob (talk | contribs) (Created page with "//<nowiki> $(function () { $('.gemw-button.secondary').each(function(i,e){ var txt = $(e).find('a').text(); var href = $(e).find('a').attr('href'); var button = new OO.ui.ButtonWidget({ label: txt, title: href }); button.$element.on('mousedown', function(){ window.open(href, '_blank'); }); $(e).parent().append(button.$element); $(e).remove(); }); var exchangeOverlay = $('<div>'); exchangeOverlay .css({position: 'relative', 'z-index': 100...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Note: After publishing, 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 / Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5
  • Opera: Press Ctrl-F5.
 1 //<nowiki>
 2 $(function () {
 3 	$('.gemw-button.secondary').each(function(i,e){
 4 		var txt = $(e).find('a').text();
 5 		var href = $(e).find('a').attr('href');
 6 		var button = new OO.ui.ButtonWidget({
 7 			label: txt,
 8 			title: href
 9 		});
10 		button.$element.on('mousedown', function(){
11 			window.open(href, '_blank');
12 		});
13 		
14 		$(e).parent().append(button.$element);
15 		$(e).remove();
16 	});
17 	var exchangeOverlay = $('<div>');
18 	exchangeOverlay
19 		.css({position: 'relative', 'z-index': 100})
20 		.attr('id', 'rsw-exchange-overlay')
21 		.appendTo('body');
22 })
23 //</nowiki>