24,485
ARTICLES
ON THIS WIKI
ON THIS WIKI
MediaWiki:Common.js
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.
/**
* Keep out of global scope
*/
window.ftbw = {};
$( function() {
'use strict';
window.ftbw.animation = function() {
//Based on http://www.minecraftwiki.net/wiki/MediaWiki:Common.js
/**
* Element animator
*
* Will cycle the active class on any child elements
* within an element with the animated class.
*/
if ( window.ftbw.animate === undefined && $( '.animated' ).length ) {
window.ftbw.animate = setInterval( function() {
$( '.animated' ).each( function() {
var current = $( this ).find( '.active' ).removeClass( 'active' ), next = current.next();
if ( !current.next().length ) {
next = $( this ).children().eq( 0 );
}
next.addClass( 'active' );
} );
}, 2000 );
}
/**
* Frame loader
*
* Loads a semi-colon (;) separated list of images
* to be animated by the element animator
*
* Has special support for [[Template:Grid]]
*/
var $animate = $( '.animated' ), size = {};
if ( $animate.length ) {
$animate.each( function() {
var imgs = $( this ).data( 'imgs' ), imgSize = $( this ).data( 'img-size' ),
grid = $( this ).closest( '.grid' );
if ( !imgs ) {
return true;
}
if ( grid.length ) {
grid = true;
imgSize = '32x32';
} else {
grid = false;
if ( imgSize ) {
imgSize = imgSize.split( 'x' );
imgSize[0] = imgSize[0].replace( /[\D ]/, '' );
imgSize[1] = imgSize[1].replace( /[\D ]/, '' );
if ( imgSize[1] ) {
imgSize[0] += 'x' + imgSize[1];
}
imgSize = imgSize[0];
} else {
imgSize = '';
}
}
if ( size[imgSize] === undefined ) {
size[imgSize] = [];
}
imgs = imgs.split( ';' );
imgs.shift();
$.each( imgs, function() {
if ( !this.trim() ) {
return true;
}
var parts, name;
if ( grid ) {
parts = $.map( this.split( ',' ), $.trim );
name = 'File:Grid ' + parts[0] + '.png';
if ( size[imgSize].indexOf( name ) < 0 ) {
size[imgSize].push( name );
}
} else if ( size[imgSize].indexOf( 'File:' + this.trim() ) < 0 ) {
size[imgSize].push( 'File:' + this.trim() );
}
} );
} );
var redirectPromise = [], urlPromise = [], redirects = {}, urls = {}, origurls = {};
$.each( size, function( size ) {
var titles = this;
if ( !titles ) {
return true;
}
// Split titles up into blocks of 50, which is the API's title limit for standard users
for ( var i = 0; i < titles.length; i += 50 ) {
var section = titles.slice( i, i + 50 ).join( '|' );
redirectPromise.push(
// Thanks to bug 23750 (https://bugzilla.wikimedia.org/show_bug.cgi?id=23750)
// &redirects doesn't work properly with prop=imageinfo. Some of the images
// will return without any imageinfo, even though they are valid.
// So the redirects have to be resolved in a separate request...
$.ajax( {
type: 'POST',
url: '/api.php?action=query&format=json&redirects',
data: { titles: section },
timeout: 20000
} ).done( function( data ) {
if ( data.query.redirects ) {
$.each( data.query.redirects, function() {
redirects[this.to] = this.from;
section = section.replace( this.from, this.to );
} );
}
var thumburl = '', sizes = size.split( 'x' );
if ( sizes[0] ) {
thumburl = '&iiurlwidth=' + sizes[0];
if ( sizes[1] ) {
thumburl += '&iiurlheight=' + sizes[1];
}
}
urlPromise.push(
$.ajax( {
type: 'POST',
url: '/api.php?action=query&format=json&prop=imageinfo&iiprop=url' + thumburl,
data: { titles: section },
timeout: 20000
} ).done( function( data ) {
$.each( data.query.pages, function( index ) {
if ( index < 0 ) {
return true;
}
if ( !this.imageinfo ) {
console.error( 'Imageinfo is empty' );
return true;
}
var url = this.imageinfo[0].thumburl || this.imageinfo[0].url;
var origurl = this.imageinfo[0].url;
if ( redirects.hasOwnProperty( this.title ) ) {
urls[redirects[this.title].replace( /File:(.*)/, '$1' ) + size] = url;
origurls[redirects[this.title].replace( /File:(.*)/, '$1' ) + size] = origurl;
} else {
urls[this.title.replace( /File:(.*)/, '$1' ) + size] = url;
origurls[this.title.replace( /File:(.*)/, '$1' ) + size] = origurl;
}
} );
} ).fail( function( error ) {
console.error( error );
} )
);
} ).fail( function( error ) {
console.error( error );
} )
);
}
} );
$.when.apply( $, redirectPromise ).then( function() {
$.when.apply( $, urlPromise ).then( function() {
$animate.each( function() {
var imgs = $( this ).data( 'imgs' ), imgSize = $( this ).data( 'img-size' ), html = '',
grid = $( this ).closest( '.grid' );
if ( !imgs ) {
return true;
}
if ( grid.length ) {
grid = true;
imgSize = '32x32';
} else {
grid = false;
if ( imgSize ) {
imgSize = imgSize.split( 'x' );
imgSize[0] = imgSize[0].replace( /[\D ]/, '' );
imgSize[1] = imgSize[1].replace( /[\D ]/, '' );
if ( imgSize[1] ) {
imgSize[0] += 'x' + imgSize[1];
}
imgSize = imgSize[0];
} else {
imgSize = '';
}
}
imgs = imgs.split( ';' );
imgs.shift();
$.each( imgs, function() {
if ( !this.trim() ) {
if ( grid ) {
html += '<span class="image"> </span>';
}
return true;
}
var parts, name, link, url, num;
if ( grid ) {
parts = $.map( this.split( ',' ), $.trim );
name = link = parts[0];
url = urls['Grid ' + parts[0] + '.png' + imgSize];
num = parts[1];
html += '<span class="image">';
if ( name ) {
if ( url ) {
html += '<a title="' + link + '" href="/' + link.replace( / /g, '_' ) + '"><img width="32" height="32" src="' + url + '" alt="' + name + '"></a>';
if ( num ) {
html += '<span class="number"><a title="' + link + '" href="/' + link.replace( / /g, '_' ) + '">' + num + '</a></span>';
}
} else {
html += '<a class="new" title="File:Grid ' + name + '.png" href="/index.php?title=Special:Upload&wpDestFile=Grid_' + name.replace( / /g, '_' ) + '.png"></a>';
}
} else {
html += ' ';
}
html += '</span>';
} else {
name = this.trim();
html += '<span>';
if ( urls[name + imgSize] ) {
html += '<a class="image fancybox" href="' + origurls[name + imgSize] + '" rel="group"><img src="' + urls[name + imgSize] + '" alt="' + name + '"></a>';
} else {
html += '<a class="new" title="File:' + name + '" href="/index.php?title=Special:Upload&wpDestFile=' + name.replace( / /g, '_' ) + '">File:' + name + '</a>';
}
html += '</span>';
}
} );
$( this ).append( html ).data( 'imgs', null );
} );
} );
} );
}
};
window.ftbw.animation();
/**
* Pause grid GUI templates (e.g. [[Template:Grid/Crafting Table]]) on mouseover
*
* This is so people have a chance to look at each image on the cell
* and click on pages they want to view.
*/
$( '#content' ).delegate( '.grid-Crafting_Table, .grid-furnace, .grid-Brewing_Stand', {
'mouseenter': function() {
$( this ).find( '.animated' ).removeClass( 'animated' ).addClass( 'paused' );
},
'mouseleave': function() {
$( this ).find( '.paused' ).removeClass( 'paused' ).addClass( 'animated' );
}
} );
} );
/**
* Add templates to toolbar
*/
var customizeToolbar = function() {
// Template subgroup
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
'sections': {
'templates': {
'type': 'toolbar', // Can also be 'booklet'
'label': 'Templates'
// or 'labelMsg': 'section-templates-label' for a localized label
}
}
} );
// Header notes
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
'section': 'templates',
'groups': {
'headers': {
'label': 'Header Notes' // or use labelMsg for a localized label, see above
}
}
} );
// [[Template:Stub]]
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
'section': 'templates',
'group': 'headers',
'tools': {
'stub': {
label: 'Stub', // or use labelMsg for a localized label, see above
type: 'button',
icon: '/images/5/52/Grid_Oak_Wood.png',
action: {
type: 'encapsulate',
options: {
'pre': "{{stub}}",
'post': ""
}
}
}
}
} );
// [[Template:Cleanup]]
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
'section': 'templates',
'group': 'headers',
'tools': {
'cleanup': {
label: 'Cleanup', // or use labelMsg for a localized label, see above
type: 'button',
icon: '/images/5/58/Grid_Paint_Brush_%28RedPower_2%29.png',
action: {
type: 'encapsulate',
options: {
'pre': "{{cleanup}}",
'post': ""
}
}
}
}
} );
// [[Template:Youmay]]
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
'section': 'templates',
'group': 'headers',
'tools': {
'youmay': {
label: 'You may...', // or use labelMsg for a localized label, see above
type: 'button',
icon: '/images/0/06/Grid_Sign.png',
action: {
type: 'encapsulate',
options: {
'pre': "{{youmay|this item",
'post': "|some other item}}"
}
}
}
}
} );
// [[Template:Disambig]]
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
'section': 'templates',
'group': 'headers',
'tools': {
'disambig': {
label: 'Disambiguation', // or use labelMsg for a localized label, see above
type: 'button',
icon: '/images/c/c3/Grid_Disambiguation.png',
action: {
type: 'encapsulate',
options: {
'pre': "{{disambig}}\n\n{{PAGENAME}} may refer to:\n* {{Itemref|{{PAGENAME}} (",
'post': ")}}\n* {{Itemref|{{PAGENAME}} ()}}"
}
}
}
}
} );
// [[Template:Redirect Item Disambig]]
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
'section': 'templates',
'group': 'headers',
'tools': {
'disambig': {
label: 'Redirect to Item Disambiguation.png', // or use labelMsg for a localized label, see above
type: 'button',
icon: '/images/8/89/Item_Disambig.png',
action: {
type: 'encapsulate',
options: {
'pre': "#REDIRECT [[File:Item Disambiguation.png]]",
'post': ""
}
}
}
}
} );
// [[Template:Redirect Grid Disambig]]
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
'section': 'templates',
'group': 'headers',
'tools': {
'disambig': {
label: 'Redirect to Grid Disambiguation.png', // or use labelMsg for a localized label, see above
type: 'button',
icon: '/images/e/e6/Grid_Disambig.png',
action: {
type: 'encapsulate',
options: {
'pre': "#REDIRECT [[File:Grid Disambiguation.png]]",
'post': ""
}
}
}
}
} );
// [[Template:UI]]
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
'section': 'templates',
'group': 'headers',
'tools': {
'tools': {
label: 'Upload Images for mod', // or use labelMsg for a localized label, see above
type: 'button',
icon: '/images/f/fa/Grid_Camera_%28CameraCraft%29.png',
action: {
type: 'encapsulate',
options: {
'pre': "<noinclude>{{UI}}</noinclude>",
'post': ""
}
}
}
}
} );
// Infoboxes
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
'section': 'templates',
'groups': {
'infoboxes': {
'label': 'Infoboxes' // or use labelMsg for a localized label, see above
}
}
} );
// [[Template:Item]] for blocks
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
'section': 'templates',
'group': 'infoboxes',
'tools': {
'block': {
label: 'Block infobox', // or use labelMsg for a localized label, see above
type: 'button',
icon: '/images/a/a6/Grid_Stone.png',
action: {
type: 'encapsulate',
options: {
'pre': "{{Infobox/Block\n|type = Block\n|solid = Yes\n|gravity = No\n|trans = No\n|light = No\n|flammable = No\n|tool = any\n|stack = 64\n|first = MC 1.x.x\n|mod = ",
'post': "\n}}"
}
}
}
}
} );
// [[Template:Item]] for items
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
'section': 'templates',
'group': 'infoboxes',
'tools': {
'item': {
label: 'Item infobox', // or use labelMsg for a localized label, see above
type: 'button',
icon: '/images/e/e9/Grid_Stick.png',
action: {
type: 'encapsulate',
options: {
'pre': "{{Infobox/Item\n|type = Item\n|stack = 64\n|first = MC 1.x.x\n|mod = ",
'post': "\n}}"
}
}
}
}
} );
// [[Template:Infobox/Mod]]
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
'section': 'templates',
'group': 'infoboxes',
'tools': {
'mod': {
label: 'Mod infobox', // or use labelMsg for a localized label, see above
type: 'button',
icon: '/images/3/36/Grid_Wrench_%28IndustrialCraft_2%29.png',
action: {
type: 'encapsulate',
options: {
'pre': "{{Infobox/Mod\n|dev = ",
'post': "\n|version = \n|mcversion = 1.x.x\n|url = [http://example.com/ Website]\n|forum = [http://minecraftforum.net/ Minecraft Forum post]\n|type = \n}}"
}
}
}
}
} );
// [[Template:Infobox/Modpack]]
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
'section': 'templates',
'group': 'infoboxes',
'tools': {
'modpack': {
label: 'Modpack infobox', // or use labelMsg for a localized label, see above
type: 'button',
icon: '/images/c/c1/Grid_Chest.png',
action: {
type: 'encapsulate',
options: {
'pre': "{{Infobox/Modpack\n|creator = ",
'post': "\n|launcher = \n|version = \n|mcversion = 1.x.x\n|url = [http://example.com/ Website]\n}}"
}
}
}
}
} );
// Crafting Grids subgroup
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
'sections': {
'grids': {
'type': 'toolbar', // Can also be 'booklet'
'label': 'Crafting Grids'
// or 'labelMsg': 'section-templates-label' for a localized label
}
}
} );
// Vanilla Minecraft
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
'section': 'grids',
'groups': {
'minecraft': {
'label': 'MC' // or use labelMsg for a localized label, see above
}
}
} );
// Crafting Table
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
'section': 'grids',
'group': 'minecraft',
'tools': {
'craftingtable': {
label: 'Crafting Table', // or use labelMsg for a localized label, see above
type: 'button',
icon: '/images/7/79/Grid_Crafting_Table.png',
action: {
type: 'encapsulate',
options: {
'pre': "{{Grid/Crafting Table\n|A1= |B1= |C1=\n|A2= |B2= |C2=\n|A3= |B3= |C3=\n|Output=",
'post': " |OA=1}}"
}
}
}
}
} );
// Furnace
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
'section': 'grids',
'group': 'minecraft',
'tools': {
'furnace': {
label: 'Furnace', // or use labelMsg for a localized label, see above
type: 'button',
icon: '/images/2/2e/Grid_Furnace.png',
action: {
type: 'encapsulate',
options: {
'pre': "{{Grid/Furnace\n|Input=\n|Output=",
'post': "}}"
}
}
}
}
} );
// Brewing Stand
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
'section': 'grids',
'group': 'minecraft',
'tools': {
'furnace': {
label: 'Brewing Stand', // or use labelMsg for a localized label, see above
type: 'button',
icon: '/images/7/70/Grid_Brewing_Stand.png',
action: {
type: 'encapsulate',
options: {
'pre': "{{Grid/Brewing Stand\n|Input=\n|Potion=\n|Output=",
'post': "}}"
}
}
}
}
} );
// IndustrialCraft 2
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
'section': 'grids',
'groups': {
'ic2': {
'label': 'IC<sup>2</sup>' // or use labelMsg for a localized label, see above
}
}
} );
// Macerator
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
'section': 'grids',
'group': 'ic2',
'tools': {
'macerator': {
label: 'Macerator', // or use labelMsg for a localized label, see above
type: 'button',
icon: '/images/b/b3/Grid_Macerator.png',
action: {
type: 'encapsulate',
options: {
'pre': "{{Grid/Macerator\n|Input=\n|Output=",
'post': "}}"
}
}
}
}
} );
// Extractor
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
'section': 'grids',
'group': 'ic2',
'tools': {
'extractor': {
label: 'Extractor', // or use labelMsg for a localized label, see above
type: 'button',
icon: '/images/a/a6/Grid_Extractor_%28IndustrialCraft_2%29.png',
action: {
type: 'encapsulate',
options: {
'pre': "{{Grid/Extractor\n|Input=\n|Output=",
'post': "}}"
}
}
}
}
} );
// Compressor
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
'section': 'grids',
'group': 'ic2',
'tools': {
'compressor': {
label: 'Compressor', // or use labelMsg for a localized label, see above
type: 'button',
icon: '/images/6/63/Grid_Compressor_%28IndustrialCraft_2%29.png',
action: {
type: 'encapsulate',
options: {
'pre': "{{Grid/Compressor\n|Input=|IA=\n|Output=",
'post': "}}"
}
}
}
}
} );
// Scrap Box
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
'section': 'grids',
'group': 'ic2',
'tools': {
'scrapbox': {
label: 'Scrap Box', // or use labelMsg for a localized label, see above
type: 'button',
icon: '/images/8/8a/Grid_Scrap_Box_%28IndustrialCraft_2%29.png',
action: {
type: 'encapsulate',
options: {
'pre': "{{Grid/Scrapbox\n|Output=\n|Chance=",
'post': "}}"
}
}
}
}
} );
// Forestry
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
'section': 'grids',
'groups': {
'forestry': {
'label': 'Forestry' // or use labelMsg for a localized label, see above
}
}
} );
// Centrifuge
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
'section': 'grids',
'group': 'forestry',
'tools': {
'centrifuge': {
label: 'Centrifuge', // or use labelMsg for a localized label, see above
type: 'button',
icon: '/images/0/0c/Grid_Centrifuge_%28Forestry%29.png',
action: {
type: 'encapsulate',
options: {
'pre': "{{Grid/Centrifuge\n|Input=\n",
'post': "|A1= |A1-chance= |A2= |A2-chance= |A3= |A3-chance=\n|B1= |B1-chance= |B2= |B2-chance= |B3= |B3-chance=\n|C1= |C1-chance= |C2= |C2-chance= |C3= |C3-chance=}}"
}
}
}
}
} );
// Carpenter
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
'section': 'grids',
'group': 'forestry',
'tools': {
'carpenter': {
label: 'Carpenter', // or use labelMsg for a localized label, see above
type: 'button',
icon: '/images/2/2c/Grid_Carpenter.png',
action: {
type: 'encapsulate',
options: {
'pre': "{{Grid/Carpenter\n|A1= |B1= |C1=\n|A2= |B2= |C2=\n|A3= |B3= |C3=\n|Liquid= |LiquidAmount=\n|Output=",
'post': " |OA=1\n}}"
}
}
}
}
} );
// Thermal Expansion
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
'section': 'grids',
'groups': {
'TE3': {
'label': 'Thermal Expansion' // or use labelMsg for a localized label, see above
}
}
} );
// Pulverizer
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
'section': 'grids',
'group': 'TE3',
'tools': {
'pulverizer': {
label: 'Pulverizer', // or use labelMsg for a localized label, see above
type: 'button',
icon: '/images/1/1c/Grid_Pulverizer.png',
action: {
type: 'encapsulate',
options: {
'pre': "{{Grid/Pulverizer\n|Top=\n|Energy= |EnergyType=\n|Output= |OA=\n|Output2= |OA2= |Output2 Chance=",
'post': "}}"
}
}
}
}
} );
// Induction Smelter
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
'section': 'grids',
'group': 'TE3',
'tools': {
'inductionsmelter': {
label: 'Induction Smelter', // or use labelMsg for a localized label, see above
type: 'button',
icon: '/images/e/e9/Grid_Induction_Smelter.png',
action: {
type: 'encapsulate',
options: {
'pre': "{{Grid/Induction Smelter\n|Input1= |Input1-OA=\n|Input2= |Input2-OA =\n|Output1= |Output1-OA=\n|Output2= |Output2-OA= |Output2-chance=\n|Energy= |EnergyType=",
'post': "}}"
}
}
}
}
} );
// Magma Crucible
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
'section': 'grids',
'group': 'TE3',
'tools': {
'magmacrucible': {
label: 'Magma Crucible', // or use labelMsg for a localized label, see above
type: 'button',
icon: '/images/5/59/Grid_Magma_Crucible.png',
action: {
type: 'encapsulate',
options: {
'pre': "{{Grid/Magma Crucible\n|Input=\n|Output= " ,
'post': "|OA=\nEnergy=}}"
}
}
}
}
} );
// Fluid Transposer
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
'section': 'grids',
'group': 'TE3',
'tools': {
'liquidtransposer': {
label: 'Fluid Transposer', // or use labelMsg for a localized label, see above
type: 'button',
icon: '/images/9/99/Grid_Fluid_Transposer.png',
action: {
type: 'encapsulate',
options: {
'pre': "{{Grid/Fluid Transposer\n|Input=\n|Output=\n|Fuel=\n|FuelAmount=\n" ,
'post': "}}"
}
}
}
}
} );
// Sawmill
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
'section': 'grids',
'group': 'TE3',
'tools': {
'pulverizer': {
label: 'Sawmill', // or use labelMsg for a localized label, see above
type: 'button',
icon: '/images/f/f1/Grid_Sawmill_%28Thermal_Expansion%29.png',
action: {
type: 'encapsulate',
options: {
'pre': "{{Grid/Sawmill\n|Input=\n|Energy= |EnergyType=\n|Output= |OA=\n|Output2= |OA2= |Output2-chance=",
'post': "}}"
}
}
}
}
} );
// EnderIO
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
'section': 'grids',
'groups': {
'enderio': {
'label': 'EnderIO' // or use labelMsg for a localized label, see above
}
}
} );
// SAG Mill
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
'section': 'grids',
'group': 'enderio',
'tools': {
'sagmill': {
label: 'SAG Mill', // or use labelMsg for a localized label, see above
type: 'button',
icon: '/images/2/25/Grid_SAG_Mill.png',
action: {
type: 'encapsulate',
options: {
'pre': "{{Grid/SAG Mill\n|Input=\n|Output1=\n|OA1=\n|Output1-chance=\n|Output2=\n|Output2-chance=\n|Output3=\n|Output3-chance=\n|Output4=\n|Output4-chance=",
'post': "}}"
}
}
}
}
} );
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
'section': 'grids',
'group': 'enderio',
'tools': {
'alloysmelter': {
label: 'Alloy Smelter', // or use labelMsg for a localized label, see above
type: 'button',
icon: '/images/e/ec/Grid_Alloy_Smelter_%28EnderIO%29.png',
action: {
type: 'encapsulate',
options: {
'pre': "{{Grid/Alloy Smelter (EnderIO)\n|Input1=\n|Input2=\n|Input3=\n|Output=\n|Energy=\n|Mode=f",
'post': "}}"
}
}
}
}
} );
// Applied Energistics
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
'section': 'grids',
'groups': {
'ae': {
'label': 'AE' // or use labelMsg for a localized label, see above
}
}
} );
// Quartz Grindstone
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
'section': 'grids',
'group': 'ae',
'tools': {
'centrifuge': {
label: 'Quartz Grindstone', // or use labelMsg for a localized label, see above
type: 'button',
icon: '/images/e/e0/Grid_Quartz_Grindstone.png',
action: {
type: 'encapsulate',
options: {
'pre': "{{Grid/Quartz Grindstone\n|Input=\n|O1= |OA1=\n|O2= |OA2= |O2-chance=\n|O3= |OA3= |O3-chance=",
'post': "}}"
}
}
}
}
} );
// Thaumcraft 4
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
'section': 'grids',
'groups': {
'tc4': {
'label': 'Thaumcraft 4' // or use labelMsg for a localized label, see above
}
}
} );
// Infusion Altar
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
'section': 'grids',
'group': 'tc4',
'tools': {
'infusionaltar': {
label: 'Infusion Altar', // or use labelMsg for a localized label, see above
type: 'button',
icon: '/images/0/02/Grid_Runic_Matrix.png',
action: {
type: 'encapsulate',
options: {
'pre': "{{Grid/Infusion Altar TC4\n|Output= |OA=\n|Catalyst=\n|IngredientsNum=\n|Ingredient1=\n|Ingredient2=\n|Ingredient3=\n|Ingredient4=\n"
+ "|Ingredient5=\n|Ingredient6=\n|Ingredient7=\n|Ingredient8=\n|Ingredient9=\n|Ingredient10=\n|Ingredient11=\n|Ingredient12=\n"
+ "|AspectsNum=\n|Aspect1= |AspectAmount1=\n|Aspect2= |AspectAmount2=\n|Aspect3= |AspectAmount3=\n|Aspect4= |AspectAmount4=\n"
+ "|Aspect5= |AspectAmount5=\n|Aspect6= |AspectAmount6=\n|Aspect7= |AspectAmount7=\n|Instability=",
'post': "}}"
}
}
}
}
} );
// Crucible
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
'section': 'grids',
'group': 'tc4',
'tools': {
'crucible': {
label: 'Crucible', // or use labelMsg for a localized label, see above
type: 'button',
icon: '/images/9/9a/Grid_Crucible_%28Thaumcraft_4%29.png',
action: {
type: 'encapsulate',
options: {
'pre': "{{Grid/Crucible\n|Output= |OA=\n|Catalyst=\n|AspectsNum=\n|Aspect1= |AspectAmount1=\n|Aspect2= |AspectAmount2=\n"
+ "|Aspect3= |AspectAmount3=\n|Aspect4= |AspectAmount4=\n|Aspect5= |AspectAmount5=\n",
'post': "}}"
}
}
}
}
} );
// Arcane Worktable
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
'section': 'grids',
'group': 'tc4',
'tools': {
'arcaneworktable': {
label: 'Arcane Worktable', // or use labelMsg for a localized label, see above
type: 'button',
icon: '/images/f/f2/Grid_Arcane_Worktable_%28Thaumcraft_4%29.png',
action: {
type: 'encapsulate',
options: {
'pre': "{{Grid/Arcane Workbench\n|Output= |OA=\n|A1= |B1= |C1=\n|A2= |B2= |C2=\n|A3= |B3= |C3=\n|AspectsNum=\n"
+ "|Aspect1= |AspectAmount1=\n|Aspect2= |AspectAmount2=\n|Aspect3= |AspectAmount3=\n|Aspect4= |AspectAmount4=\n"
+ "|Aspect5= |AspectAmount5=\n|Aspect6= |AspectAmount6=\n",
'post': "}}"
}
}
}
}
} );
// Research Aspects Block
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
'section': 'grids',
'group': 'tc4',
'tools': {
'aspectsblock': {
label: 'Research Aspects Block', // or use labelMsg for a localized label, see above
type: 'button',
icon: '/images/0/07/Scanning_Block.png',
action: {
type: 'encapsulate',
options: {
'pre': "=== Research aspects in this block ===\n{{T4ItemAspects|",
'post': "}}"
}
}
}
}
} );
// Research Aspects Item
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
'section': 'grids',
'group': 'tc4',
'tools': {
'aspectsitem': {
label: 'Research Aspects Item', // or use labelMsg for a localized label, see above
type: 'button',
icon: '/images/c/cc/Scanning_Item.png',
action: {
type: 'encapsulate',
options: {
'pre': "=== Research aspects in this item ===\n{{T4ItemAspects|",
'post': "}}"
}
}
}
}
} );
// Factory Tech
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
'section': 'grids',
'groups': {
'ft': {
'label': 'Factory Tech' // or use labelMsg for a localized label, see above
}
}
} );
// Centrifuge
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
'section': 'grids',
'group': 'ft',
'tools': {
'ft_centrifuge': {
label: 'Centrifuge', // or use labelMsg for a localized label, see above
type: 'button',
icon: '/images/7/7b/Grid_Centrifuge_%28Factory_Tech%29.png',
action: {
type: 'encapsulate',
options: {
'pre': "{{Grid/Centrifuge FT\n|link=\n|header=Centrifuge\n|Input= |IA=\n|O1= |O2= |O3=\n|O1A= |O2A= |O3A=\n",
'post': "}}"
}
}
}
}
} );
// Drill Grinder
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
'section': 'grids',
'group': 'ft',
'tools': {
'ft_drillgrinder': {
label: 'Drill Grinder', // or use labelMsg for a localized label, see above
type: 'button',
icon: '/images/e/e2/Grid_Drill_Grinder.png',
action: {
type: 'encapsulate',
options: {
'pre': "{{Grid/Drill Grinder\n|Input= |IA=1\n|Output= |OA=1\n",
'post': "}}"
}
}
}
}
} );
// MineChem
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
'section': 'grids',
'groups': {
'mch': {
'label': 'MineChem' // or use labelMsg for a localized label, see above
}
}
} );
// Chemical Decomposer
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
'section': 'grids',
'group': 'mch',
'tools': {
'mch_decomposer': {
label: 'Decomposer', // or use labelMsg for a localized label, see above
type: 'button',
icon: '/images/1/17/Grid_Chemical_Decomposer.png',
action: {
type: 'encapsulate',
options: {
'pre': "{{Grid/Chemical Decomposer\n|Input=\n|Output1= |OA1=\n|Output2= |OA2\n|Output3= |OA3=\n|Output4= |OA4=\n|Output5= |OA5=\n|Output6= |OA6\n|Output7= |OA7=\n|Output8= |OA8=\n|Output9= |OA9=\n|Output10= |OA10=\n|Output11= |OA11=\n|Output12= |OA12=\n|Output13= |OA13=\n|Output14= |OA14=\n|Output15= |OA15=\n|Output16= |OA16=\n|Output17= |OA17=\n|Output18= |OA18=\n|Fuel= |FuelAmount=\n",
'post': "}}"
}
}
}
}
} );
// Chemical Synthesizer
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
'section': 'grids',
'group': 'mch',
'tools': {
'mch_synthesizer': {
label: 'Synthesizer', // or use labelMsg for a localized label, see above
type: 'button',
icon: '/images/8/8c/Grid_Chemical_Synthesis_Machine.png',
action: {
type: 'encapsulate',
options: {
'pre': "{{Grid/Chemical Synthesis Machine\n|A1= |B1= |C1=\n|A2= |B2= |C2=\n|A3= |B3= |C3=\n|Output=\n|Energy=\n|Shapeless=\n",
'post': "}}"
}
}
}
}
} );
// Chemical Bucket
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
'section': 'grids',
'group': 'mch',
'tools': {
'mch_bucket': {
label: 'Chemical Bucket', // or use labelMsg for a localized label, see above
type: 'button',
icon: '/images/8/85/Grid_Chemical_Bucket_%28Penicillin%29.png',
action: {
type: 'encapsulate',
options: {
'pre': "{{Grid/Chemical Decomposer\n|Input=Chemical Bucket\n",
'post': "}}"
}
}
}
}
} );
// Alchemistry
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
'section': 'grids',
'groups': {
'alc': {
'label': 'Alchemistry' // or use labelMsg for a localized label, see above
}
}
} );
// Chemical Combiner
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
'section': 'grids',
'group': 'alc',
'tools': {
'alc_combiner': {
label: 'Chemical Combiner', // or use labelMsg for a localized label, see above
type: 'button',
icon: '/images/0/0c/Grid_Chemical_Combiner.png',
action: {
type: 'encapsulate',
options: {
'pre': "{{Grid/Chemical Combiner\n|A1= |A1-amount= |B1= |B1-amount= |C1= |C1-amount=\n|A2= |A2-amount= |B2= |B2-amount= |C2= |C2-amount=\n|A3= |A3-amount= |B3= |B3-amount= |C3= |C3-amount=\n|Output=",
'post': " |Output-amount=}}"
}
}
}
}
} );
};
/* Check if view is in edit mode and that the required modules are available. Then, customize the toolbar . . . */
if ( $.inArray( mw.config.get( 'wgAction' ), [ 'edit', 'submit' ] ) !== -1 ) {
mw.loader.using( 'user.options', function () {
if ( mw.user.options.get('usebetatoolbar') && mw.user.options.get( 'showtoolbar' ) ) {
mw.loader.using( 'ext.wikiEditor.toolbar', function () {
$( customizeToolbar );
} );
}
} );
}
// Add the customizations to LiquidThreads' edit toolbar, if available
mw.hook( 'ext.lqt.textareaCreated' ).add( customizeToolbar );
/******************************************
* Adds Tooltips *
*****************************************/
$(function() {
var mc_tooltip = null;
$(".a1, .a2, .a3, .b1, .b2, .b3, .c1, .c2, .c3, .output, .gridbox, .tooltip").on({
'mouseenter.tooltip': function(e) {
var $me = $(this);
// Make sure this isn't a link to upload a new file
if ($me.find('.new').length > 0) {
// This isn't one we want to show a tooltip for
return;
}
// Try to get the title
var title = $me.data('tooltip');
// See if we can find a title elsewhere
// Check this element or its child
if (title === undefined) {
title = $me.attr('title') || $me.children(':first').attr('title');
// Check if we found anything
if (title) {
// Save it for later
$me.data('tooltip', title);
}
else {
// Didn't find anything, no sense continuing
return;
}
}
// Remove any title elements to avoid the default tooltip
$me.add('*', $me).filter('[title]').removeAttr('title');
// Check to see if we've already created the div
if (!$('#tooltip-display').length) {
$('body').append('<div id="tooltip-display" />');
}
mc_tooltip = $('#tooltip-display');
// Trim up the tooltip to avoid putting the mod name in there
// Basically, remove everything after and including '('
title = title.split('(',1)[0].trim();
// Add the text to the tooltip
mc_tooltip.html(title);
// Need to update the position to the cursor position
$me.trigger('mousemove', e);
},
'mousemove.tooltip': function (e) {
// Check if the element exists already, create it if it doesn't
if (!$('#tooltip-display').length) {
$(this).trigger('mouseenter');
return;
}
// Get dimensions for bounds checking
var top = e.pageY - 30,
height = mc_tooltip.outerHeight(true),
left = e.pageX + 15,
width = mc_tooltip.outerWidth(true);
// Get window dimensions
var $w = $(window),
win_width = $w.width(),
win_height = $w.height();
// TODO: Make it so it doesn't go off the sides
// Apply the position
mc_tooltip.css({
top: top,
left: left
});
},
'mouseleave.tooltip': function (e) {
// Make sure the tooltip is there before we use it
if (!mc_tooltip) {
return;
}
mc_tooltip.remove();
},
});
});
/******************************************
* Resizes the fluid gauges *
*****************************************/
$(function() {
$('.fluid-meter').each(function() {
var meter = $(this);
var gauge = meter.find('.gauge');
// Set the background image as we can't do it directly
gauge.css('background-image', 'url(' + meter.data('image') + ')');
var height = meter.data('height');
var width = meter.data('width');
var amount = meter.data('amount');
var amount_px = null;
// Test what size of gauge we are using
if (height == 116) {
// We are using 116px high gauges
amount_px = Math.min((amount > 0 && amount < 0.3) ? 2 : amount * 12-2, 116);
}
else {
amount_px = Math.min(amount * 12, height);
}
gauge.css('height', amount_px);
gauge.css('width', width);
});
});
/*******************************************************************
* Set size for unknown itemref images with non-default dimensions *
******************************************************************/
$(function() {
$('.itemref a.new:first-child').each(function() {
var itemref = $(this);
var size = itemref.parent().data('size');
if (size !== null) {
itemref.css('background-size', size + ' ' + size);
itemref.css('height', size);
itemref.css('width', size);
}
});
});
$(function() {
var grids = $('.grid-bg');
if(grids.length) {
grids.each(function() {
var self = $(this);
var craftgrid = self[0].children[0];
var dest = craftgrid.children[0];
var grid = self.data('grid');
if(!grid)
return;
var width = craftgrid.style.width;
var height = craftgrid.style.height;
var svg =
'<svg' +
' xmlns="http://www.w3.org/2000/svg"' +
' version="1.1"' +
' width="' + width + '"' +
' height="' + height + '"' +
'>' +
'<style type="text/css">' +
'*' +
'{' +
'stroke: #999;' +
'stroke-width: 1.5px;' +
'}' +
'</style>' +
'<path d="' + mw.html.escape(grid) + '" />' +
'</svg>';
var url = "data:image/svg+xml," + encodeURIComponent(svg);
dest.style.backgroundImage = 'url("' + url + '")';
});
}
});
View All ATL Twitter Feed
Discussion
To discuss the topics on this wiki, you can visit our community forums!