User:Pathoschild/Scripts/AJAX transclusion table

From Meta, a Wikimedia project coordination wiki
Jump to: navigation, search
Scripts User:Pathoschild (Scripts > AJAX transclusion table)


Screenshot of a row collapsed, loading, and expanded.

The AJAX transclusion table script adds a "[show]" link in the first cell of every row in tables with the "attable" class. Clicking the link will display the linked page below (see screenshots at right). No show/hide link will be shown in rows that don't contain a link, like headings.

[edit] Installation

  • If you want to use this script on Meta, you don't need to do anything (it is already installed).
  • If you want to use it elsewhere:
  1. Add your name to the user list below to get code updates. (If you're not on the list, the script might unexpectedly stop working for you one day if there's a major change.)
  2. Add the following code to User:your user name/common.js. To enable it for all users on a wiki, add it to MediaWiki:Common.js instead.
  3. Refresh your browser to reload the JavaScript. (In Chrome or Firefox, press [CTRL] and [R] at the same time.)
/*************
*** AJAX transclusion table <http://meta.wikimedia.org/wiki/User:Pathoschild/Scripts/AJAX_transclusion_table>
*** by [[m:user:Pathoschild]]
*************/
function attLoader() {
        if(getElementsByClassName(document.getElementsByTagName('body')[0],'table','attable').length) {
                document.write('<script type="text/javascript" src="'
                  + 'http://meta.wikimedia.org/w/index.php?title=User:Pathoschild/Scripts/AJAX_transclusion_table.js' 
                  + '&action=raw&ctype=text/javascript&dontcountme=s"></script>');
        }
}
addOnloadHook(attLoader);

[edit] Current bugs

  • Does not work in Internet Explorer (working on it).
  • Does not recognize <th> element as possible first cell (fixed in next version).

[edit] See also

Personal tools
Namespaces

Variants
Actions
Navigation
Community
Beyond the Web
Print/export
Toolbox