User:Φρύδια/common.js

From Wiktionary, the free dictionary
Jump to navigation Jump to search

Note – after saving, you may have to bypass your browser’s cache to see the changes.

  • Mozilla / Firefox / Safari: hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (Command-R on a Macintosh);
  • Konqueror and Chrome: click Reload or press F5;
  • Opera: clear the cache in Tools → Preferences;
  • Internet Explorer: hold Ctrl while clicking Refresh, or press Ctrl-F5.

This JavaScript is executed for Φρύδια on every page load.


importScript('User:Erutuon/addAutoCat.js');

mw.loader.using('oojs-ui').done(function() {
    $(function() {
    	var tables = $('.transposable');
    	if (tables.length > 0) {
			tables.replaceWith(function() {
				var indexLayout = new OO.ui.IndexLayout({
	    			expanded: false,
	    			padded: false
	    			//framed: false
	    		});
	    		$(this).find('div[id]').each(function(i) {
	    			var table = $(this);
	    			indexLayout.addTabPanels([
	    				new OO.ui.TabPanelLayout(i, {
	    					label: table.attr('id'),
	    					scrollable: false,
	    					padded: false,
	    					content: [ table ]
	    				})
	    			]);
	    		});
	    		return new OO.ui.PopupButtonWidget({ 
					label: 'Full conjugation',
					popup: {
						align: 'forwards',
						content: [ new OO.ui.PanelLayout({
							expanded: false,
							scrollable: false,
							content: [ indexLayout ]
						}) ]
					}
				}).$element;
			});
    	}
    });
});