Diferencia entre revisiones de «Usuario:Taln Fan/common.js»

m (Chaos2651 moved page User:Co-president of the Taln Fanclub/common.js to User:Taln Fan/common.js: Automatically moved page while renaming the user "Co-president of the Taln Fanclub" to "Taln Fan")
 
(No se muestran 2 ediciones intermedias de otro usuario)
Línea 3: Línea 3:
/* Your code goes here */
/* Your code goes here */


//Add new page ends dropdown to the "advanced" section
// Adding Artist header button for galleries to the "main" section
$('#wpTextbox1').wikiEditor('addToToolbar', {
section: 'main',
group: 'insert',
tools: {
"Artist-header": {
label: 'Artist header',
type: 'button',
icon: '//upload.wikimedia.org/wikipedia/commons/3/3a/Button_av-img.png',
action: {
type: 'encapsulate',
options: {
pre: '| <small><center>by {' + '{a|',
post: '}}</center></small>'
}
}
}
}
});

// Adding an art infobox button to the "main" section
$('#wpTextbox1' ).wikiEditor( 'addToToolbar', {
section: 'main',
group: 'insert',
tools: {
"code": {
label: 'Art infobox',
type: 'button',
icon: '//upload.wikimedia.org/wikipedia/commons/5/5a/Vector_toolbar_insert_picture_gallery_button.png',
action: {
type: 'encapsulate',
options: {
pre: '{' + '{art' + '\n' + '|#artist=' + '\n' + '|series=' + '\n' + '|#source=',
post: '\n' + '|type=' + '\n' + '}}'
}
}
}
}
});
// Adding artist attribution button for galleries to the "main" section
$('#wpTextbox1').wikiEditor('addToToolbar', {
section: 'main',
group: 'insert',
tools: {
"artist-attribution": {
label: 'Artist Attribution',
type: 'button',
icon: '//upload.wikimedia.org/wikipedia/commons/1/1b/Button_miss_signature.png',
action: {
type: 'encapsulate',
options: {
pre: '| <small><center>by {{a|',
post: '}}</center></small>'
}
}
}
}
});
// Adding artist page button to the "main" section
$('#wpTextbox1').wikiEditor('addToToolbar', {
section: 'main',
group: 'insert',
tools: {
"artist-page": {
label: 'Artist Page',
type: 'button',
icon: '//upload.wikimedia.org/wikipedia/commons/7/76/Button_atelier_graphique.PNG',
action: {
type: 'encapsulate',
options: {
pre: '{'+'{artist' + '\n' + '|image=' + '\n' + '|alias=' + '\n' + '|fb=' + '\n' + '|reddit=' + '\n' + '|behance=' + '\n' + '|da=' + '\n' + '|ig=' + '\n' + '|as=' + '\n' + '|tumblr=' + '\n' + '|twitter=' + '\n' + '|site=' + '\n' + '|license=all|some|none|official' + '\n' + '|contact=' + '\n' + '|type=fan|interior|cover|multimedia' + '\n' + '|no-notify=y' + '\n' + '}}' + '\n\n' + '<br style="clear:right;"/>' + '\n' + '== Gallery ==' + '\n' + '<gallery caption="Gallery" mode="packed" heights=200px>' + '\n\n' + '</gallery>' + '\n' + '{{meta/done}}'
}
}
}
}
});
// Adding image template button to the "main" section
$('#wpTextbox1').wikiEditor('addToToolbar', {
section: 'main',
group: 'insert',
tools: {
"image": {
label: 'Image template',
type: 'button',
icon: '//upload.wikimedia.org/wikipedia/commons/d/d8/Vector_toolbar_insert_image_button.png',
action: {
type: 'encapsulate',
options: {
pre: '{' + '{image|',
post: '|side=|width=|caption}}'
}
}
}
}
});
// Adding link button to the "main" section
$('#wpTextbox1' ).wikiEditor( 'addToToolbar', {
section: 'main',
group: 'insert',
tools: {
"link": {
label: 'Link',
type: 'button',
icon: '//upload.wikimedia.org/wikipedia/commons/9/97/Button_int_link.png',
action: {
type: 'encapsulate',
options: {
pre: "[[",
post: "]]"
}
}
}
}
});
// Adding Wikipedia link button to the "main" section
$('#wpTextbox1').wikiEditor('addToToolbar', {
section: 'main',
group: 'insert',
tools: {
"wikipedia": {
label: 'Wikipedia',
type: 'button',
icon: '//upload.wikimedia.org/wikipedia/commons/c/cb/Button_wikipedia.png',
action: {
type: 'encapsulate',
options: {
pre: "[[Wikipedia:",
post: "|]]"
}
}
}
}
});
//Add new references dropdown to the "advanced" section
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
section: 'advanced',
section: 'advanced',
Línea 9: Línea 142:
list: {
list: {
tools: {
tools: {
bottoms: {
references: {
label: 'bottoms',
label: 'references',
type: 'select',
type: 'select',
list: {
list: {
'pagename': {
'book-ref': {
label: '{' + '{SUBST:PAGENAME}}',
label: '{' + '{book ref}}',
action: {
action: {
type: 'encapsulate',
type: 'encapsulate',
options: {
options: {
pre: '\n' + '\'\'\'{' + '{SUBST:PAGENAME}}\'\'\''
pre: '{' + '{book ref|',
post: '}}'
}
}
}
}
},
},
'notes': {
'wob-ref': {
label: '== Notes ==',
label: '{' + '{wob ref}}',
action: {
action: {
type: 'encapsulate',
type: 'encapsulate',
options: {
options: {
pre: '\n\n' + '== Notes =='
pre: '{' + '{wob ref|',
post: '}}'
}
}
}
}
},
},
'refsection': {
'ref-plaintext': {
label: '<' + 'references/>',
label: '{' + '{ref}}',
action: {
action: {
type: 'encapsulate',
type: 'encapsulate',
options: {
options: {
pre: '\n' + '<' + 'references />'
pre: '{' + '{ref|text=',
post: '}}'
}
}
}
}
},
},
'stub': {
'epigraph-ref': {
label: '{' + '{stub}}',
label: '{' + '{epigraph ref}}',
action: {
action: {
type: 'encapsulate',
type: 'encapsulate',
options: {
options: {
pre: '\n' + '{' + '{stub}}'
pre: '{' + '{epigraph ref|',
post: '}}'
}
}
}
}
},
},
'partial': {
'au-ref': {
label: '{' + '{partial}}',
label: '{' + '{au ref}}',
action: {
action: {
type: 'encapsulate',
type: 'encapsulate',
options: {
options: {
pre: '\n' + '{' + '{partial}}'
pre: '{' + '{au ref|',
post: '}}'
}
}
}
}
},
},
'complete': {
'msh-ref': {
label: '{' + '{complete}}',
label: '{' + '{msh ref}}',
action: {
action: {
type: 'encapsulate',
type: 'encapsulate',
options: {
options: {
pre: '\n' + '{' + '{complete}}'
pre: '{' + '{msh ref|',
post: '}}'
}
}
}
}
},
},
'alcatraz': {
'tes-ref': {
label: '{' + '{Alcatraz}}',
label: '{' + '{tes ref}}',
action: {
action: {
type: 'encapsulate',
type: 'encapsulate',
options: {
options: {
pre: '\n' + '{' + '{Alcatraz}}'
pre: '{' + '{tes ref|',
post: '}}'
}
}
}
}
},
},
'elantris': {
'file-ref': {
label: '{' + '{Elantris}}',
label: '{' + '{file ref}}',
action: {
action: {
type: 'encapsulate',
type: 'encapsulate',
options: {
options: {
pre: '\n' + '{' + '{Elantris}}'
pre: '{' + '{file ref|',
post: '}}'
}
}
}
}
},
},
'mbera1': {
'map-ref': {
label: '{' + '{Mistborn|Era 1}}',
label: '{' + '{map ref}}',
action: {
action: {
type: 'encapsulate',
type: 'encapsulate',
options: {
options: {
pre: '\n' + '{' + '{Mistborn|Era 1}}'
pre: '{' + '{map ref|',
post: '}}'
}
}
}
}
},
},
'mbera2': {
'url-ref': {
label: '{' + '{Mistborn|Era 2}}',
label: '{' + '{url ref}}',
action: {
action: {
type: 'encapsulate',
type: 'encapsulate',
options: {
options: {
pre: '\n' + '{' + '{Mistborn|Era 2}}'
pre: '{' + '{url ref|url=',
post: '|text=|date=|site=}}'
}
}
}
}
},
},
'reckoners': {
'17s-ref': {
label: '{' + '{Reckoners}}',
label: '{' + '{17s ref}}',
action: {
action: {
type: 'encapsulate',
type: 'encapsulate',
options: {
options: {
pre: '\n' + '{' + '{Reckoners}}'
pre: '{' + '{17s ref|topic/news/post',
}
post: '|id#|description|date=}}'
}
},
'sky': {
label: '{' + '{Skyward}}',
action: {
type: 'encapsulate',
options: {
pre: '\n' + '{' + '{Skyward}}'
}
}
},
'stormlight': {
label: '{' + '{Stormlight}}',
action: {
type: 'encapsulate',
options: {
pre: '\n' + '{' + '{Stormlight}}'
}
}
},
'warbreaker': {
label: '{' + '{Warbreaker}}',
action: {
type: 'encapsulate',
options: {
pre: '\n' + '{' + '{Warbreaker}}'
}
}
},
'whitesand': {
label: '{' + '{White Sand}}',
action: {
type: 'encapsulate',
options: {
pre: '\n' + '{' + '{White Sand}}'
}
}
}
}
Línea 154: Línea 262:
}
}
} );
} );

//Add new build-a-box dropdown to the "advanced" section
//Add new build-a-box dropdown to the "advanced" section
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
Línea 288: Línea 395:
}
}
} );
} );
//Add new infobox endings dropdown to the "advanced" section

$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
// Adding Wikipedia link button to the "main" section
section: 'advanced',
$('#wpTextbox1').wikiEditor('addToToolbar', {
groups: {
section: 'main',
list: {
group: 'insert',
tools: {
tools: {
"wikipedia": {
endings: {
label: 'Wikipedia',
label: 'ends',
type: 'button',
type: 'select',
list: {
icon: '//upload.wikimedia.org/wikipedia/commons/c/cb/Button_wikipedia.png',
action: {
'sa': {
label: 'Stormlight',
type: 'encapsulate',
action: {
options: {
type: 'encapsulate',
pre: "[[Wikipedia:",
options: {
post: "|]]"
pre: '\n' + '|world=Roshar' + '\n' + '|universe=[[Cosmere]]' + '\n' + '|books=[[The Stormlight Archive]]' + '\n' + '}}'
}
}
}
}
}
}
},
'mbe1': {
});
label: 'MB Era 1',

action: {
// Adding link button to the "main" section
type: 'encapsulate',
$('#wpTextbox1' ).wikiEditor( 'addToToolbar', {
options: {
section: 'main',
pre: '\n' + '|world=Scadrial' + '\n' + '|universe=[[Cosmere]]' + '\n' + '|books=[[Mistborn Era 1]]' + '\n' + '}}'
group: 'insert',
}
tools: {
}
"link": {
},
label: 'Link',
'mbe2': {
type: 'button',
label: 'MB Era 2',
icon: '//upload.wikimedia.org/wikipedia/commons/9/97/Button_int_link.png',
action: {
action: {
type: 'encapsulate',
type: 'encapsulate',
options: {
options: {
pre: '\n' + '|world=Scadrial' + '\n' + '|universe=[[Cosmere]]' + '\n' + '|books=[[Mistborn Era 2]]' + '\n' + '}}'
pre: "[[",
}
post: "]]"
}
},
'wb': {
label: 'Warbreaker',
action: {
type: 'encapsulate',
options: {
pre: '\n' + '|world=Nalthis' + '\n' + '|universe=[[Cosmere]]' + '\n' + '|books=[[Warbreaker]]' + '\n' + '}}'
}
}
},
'ela': {
label: 'Elantris',
action: {
type: 'encapsulate',
options: {
pre: '\n' + '|world=Sel' + '\n' + '|universe=[[Cosmere]]' + '\n' + '|books=[[Elantris (book)|Elantris]]' + '\n' + '}}'
}
}
},
'alc': {
label: 'Alcatraz',
action: {
type: 'encapsulate',
options: {
pre: '\n' + '|earth=Alcatraz' + '\n' + '|books=[[Alcatraz Versus the Evil Librarians (series)|Alcatraz Versus the Evil Librarians]]' + '\n' + '}}'
}
}
},
'ws': {
label: 'White Sand',
action: {
type: 'encapsulate',
options: {
pre: '\n' + '|world=Taldain' + '\n' + '|universe=[[Cosmere]]' + '\n' + '|books=[[White Sand]]' + '\n' + '}}'
}
}
},
'skyward': {
label: 'Skyward',
action: {
type: 'encapsulate',
options: {
pre: '\n' + '|world=',
post: '\n' + '|universe=[[Cytoverse]]' + '\n' + '|books=[[Skyward (series)]]' + '\n' + '}}'
}
}
}
}
}
}
}
}
}
} );
}
//Add new page ends dropdown to the "advanced" section
}
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
}
section: 'advanced',
});
groups: {

list: {
// Adding an art infobox button to the "main" section
tools: {
$('#wpTextbox1' ).wikiEditor( 'addToToolbar', {
bottoms: {
section: 'main',
group: 'insert',
label: 'bottoms',
type: 'select',
tools: {
"code": {
list: {
'pagename': {
label: 'Art infobox',
label: '{' + '{SUBST:PAGENAME}}',
type: 'button',
action: {
icon: '//upload.wikimedia.org/wikipedia/commons/5/5a/Vector_toolbar_insert_picture_gallery_button.png',
type: 'encapsulate',
action: {
options: {
type: 'encapsulate',
pre: '\n' + '\'\'\'{' + '{SUBST:PAGENAME}}\'\'\''
options: {
}
pre: '{' + '{art' + '\n' + '|#artist=' + '\n' + '|series=' + '\n' + '|#source=',
}
post: '\n' + '|type=' + '\n' + '}}'
},
'notes': {
label: '== Notes ==',
action: {
type: 'encapsulate',
options: {
pre: '\n\n' + '== Notes =='
}
}
},
'refsection': {
label: '<' + 'references/>',
action: {
type: 'encapsulate',
options: {
pre: '\n' + '<' + 'references />'
}
}
},
'stub': {
label: '{' + '{stub}}',
action: {
type: 'encapsulate',
options: {
pre: '\n' + '{' + '{stub}}'
}
}
},
'partial': {
label: '{' + '{partial}}',
action: {
type: 'encapsulate',
options: {
pre: '\n' + '{' + '{partial}}'
}
}
},
'complete': {
label: '{' + '{complete}}',
action: {
type: 'encapsulate',
options: {
pre: '\n' + '{' + '{complete}}'
}
}
},
'alcatraz': {
label: '{' + '{Alcatraz}}',
action: {
type: 'encapsulate',
options: {
pre: '\n' + '{' + '{Alcatraz}}'
}
}
},
'elantris': {
label: '{' + '{Elantris}}',
action: {
type: 'encapsulate',
options: {
pre: '\n' + '{' + '{Elantris}}'
}
}
},
'mbera1': {
label: '{' + '{Mistborn|Era 1}}',
action: {
type: 'encapsulate',
options: {
pre: '\n' + '{' + '{Mistborn|Era 1}}'
}
}
},
'mbera2': {
label: '{' + '{Mistborn|Era 2}}',
action: {
type: 'encapsulate',
options: {
pre: '\n' + '{' + '{Mistborn|Era 2}}'
}
}
},
'reckoners': {
label: '{' + '{Reckoners}}',
action: {
type: 'encapsulate',
options: {
pre: '\n' + '{' + '{Reckoners}}'
}
}
},
'sky': {
label: '{' + '{Skyward}}',
action: {
type: 'encapsulate',
options: {
pre: '\n' + '{' + '{Skyward}}'
}
}
},
'stormlight': {
label: '{' + '{Stormlight}}',
action: {
type: 'encapsulate',
options: {
pre: '\n' + '{' + '{Stormlight}}'
}
}
},
'warbreaker': {
label: '{' + '{Warbreaker}}',
action: {
type: 'encapsulate',
options: {
pre: '\n' + '{' + '{Warbreaker}}'
}
}
},
'whitesand': {
label: '{' + '{White Sand}}',
action: {
type: 'encapsulate',
options: {
pre: '\n' + '{' + '{White Sand}}'
}
}
}
}
}
}
}
}
}
} );
}
//add new section to editing toolbar
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
'sections': {
'useful-stuff': {
'type': 'booklet',
'label': 'Useful Stuff',
'pages': {
//Page of commonly used reference templates
'section-refs': {
'label': 'References',
'layout': 'characters',
'characters': [
'{' + '{book ref|}}',
'{' + '{wob ref|}}',
'{' + '{ref|text=}}',
'{' + '{epigraph ref|}}',
'{' + '{au ref|}}',
'{' + '{msh ref|}}',
'{' + '{tes ref|}}',
'{' + '{file ref|}}',
'{' + '{map ref|}}',
//These next two reference templates are very long so they are done differently
{
'action': {
'type': 'encapsulate',
options: {
pre: '{' + '{url ref|url=',
post: '|text=|date=|site=}}'
}
},
'label': '{' + '{url ref}}'
},
{
'action': {
'type': 'encapsulate',
options: {
pre: '{' + '{17s ref|topic/news/post',
post: '|id#|description|date=}}'
}
},
'label': '{' + '{17s ref}}'
},
]
},
//Page to quickly build character infoboxes
'section-Build-a-Box': {
'label': 'Build-a-Box',
'layout': 'characters',
'characters': [
'{' + '{character',
'\n' + '|image=',
'\n' + '|residence=',
'\n' + '|profession=',
'\n' + '|#profession=',
'\n' + '|species=',
'\n' + '|abilities=',
'\n' + '|ethnicity=',
'\n' + '|born=',
'\n' + '|died=',
'\n' + '|nationality=',
'\n' + '|residence=',
]
},
//Page of infobox endings
'section-end': {
'label': 'Endings',
'layout': 'characters',
'characters': [
'\n' + '|world=Scadrial',
'\n' + '|world=Roshar',
'\n' + '|world=Nalthis',
'\n' + '|world=Taldain',
'\n' + '|earth=Alcatraz',
'\n' + '|universe=[[Cosmere]]',
'\n' + '|books=[[Mistborn Era 1]]',
'\n' + '|books=[[Mistborn Era 2]]',
'\n' + '|books=[[The Stormlight Archive]]',
'\n' + '|books=[[Warbreaker]]',
//Alcatraz is very long so it has to be done differently
{
'action': {
'type': 'encapsulate',
'options': {
'pre': '\n' + '|books=[[Alcatraz Versus the Evil Librarians (series)|Alcatraz Versus the Evil Librarians]]'
}
},
'label': '|books=Alcatraz'
},
]
},
//Page of stuff to finish a page after making the infobox
'section-bottom': {
'label': 'Bottom of Page',
'layout': 'characters',
'characters': [
'\n' + '\'\'\'{' + '{SUBST:PAGENAME}}\'\'\'',
'\n\n' + '== Notes ==',
'\n' + '<' + 'references/>',
'\n' + '{' + '{stub}}',
'\n' + '{' + '{partial}}',
'\n' + '{' + '{complete}}',
'\n' + '{' + '{Alcatraz}}',
'\n' + '{' + '{Elantris}}',
'\n' + '{' + '{Mistborn|Era 1}}',
'\n' + '{' + '{Mistborn|Era 2}}',
'\n' + '{' + '{Reckoners}}',
'\n' + '{' + '{Skyward}}',
'\n' + '{' + '{Stormlight}}',
'\n' + '{' + '{Warbreaker}}',
'\n' + '{' + '{White Sand}}',
]
}
}
}
}
}
});
}
});

};
};
/*
/*

Revisión actual - 06:40 2 ene 2022

//customize toolbar
var customizeToolbar = function() {
  /* Your code goes here */

  // Adding Artist header button for galleries to the "main" section
  $('#wpTextbox1').wikiEditor('addToToolbar', {
    section: 'main',
    group: 'insert',
    tools: {
      "Artist-header": {
        label: 'Artist header',
        type: 'button',
        icon: '//upload.wikimedia.org/wikipedia/commons/3/3a/Button_av-img.png',
        action: {
          type: 'encapsulate',
          options: {
            pre: '| <small><center>by {' + '{a|',
            post: '}}</center></small>'
          }
        }
      }
    }
  });

  // Adding an art infobox button to the "main" section
  $('#wpTextbox1' ).wikiEditor( 'addToToolbar', {
    section: 'main',
    group: 'insert',
    tools: {
     "code": {
	label: 'Art infobox',
	type: 'button',
	icon: '//upload.wikimedia.org/wikipedia/commons/5/5a/Vector_toolbar_insert_picture_gallery_button.png',
	action: {
	  type: 'encapsulate',
	  options: {
	    pre: '{' + '{art' + '\n' + '|#artist=' + '\n' + '|series=' + '\n' + '|#source=',
	    post: '\n' + '|type=' + '\n' + '}}'
	  }
	}
      }
    }
  });
  // Adding artist attribution button for galleries to the "main" section
  $('#wpTextbox1').wikiEditor('addToToolbar', {
    section: 'main',
    group: 'insert',
    tools: {
      "artist-attribution": {
        label: 'Artist Attribution',
        type: 'button',
        icon: '//upload.wikimedia.org/wikipedia/commons/1/1b/Button_miss_signature.png',
        action: {
          type: 'encapsulate',
          options: {
            pre:  '| <small><center>by {{a|',
            post: '}}</center></small>'
          }
        }
      }
    }
  });
  // Adding artist page button to the "main" section
  $('#wpTextbox1').wikiEditor('addToToolbar', {
    section: 'main',
    group: 'insert',
    tools: {
      "artist-page": {
        label: 'Artist Page',
        type: 'button',
	icon: '//upload.wikimedia.org/wikipedia/commons/7/76/Button_atelier_graphique.PNG',
        action: {
          type: 'encapsulate',
          options: {
            pre: '{'+'{artist' + '\n' + '|image=' + '\n' + '|alias=' + '\n' + '|fb=' + '\n' + '|reddit=' + '\n' + '|behance=' + '\n' + '|da=' + '\n' + '|ig=' + '\n' + '|as=' + '\n' + '|tumblr=' + '\n' + '|twitter=' + '\n' + '|site=' + '\n' + '|license=all|some|none|official' + '\n' + '|contact=' + '\n' + '|type=fan|interior|cover|multimedia' + '\n' + '|no-notify=y' + '\n' + '}}' + '\n\n' + '<br style="clear:right;"/>' + '\n' + '== Gallery ==' + '\n' + '<gallery caption="Gallery" mode="packed" heights=200px>' + '\n\n' + '</gallery>' + '\n' + '{{meta/done}}'
          }
        }
      }
    }
  });
  // Adding image template button to the "main" section
  $('#wpTextbox1').wikiEditor('addToToolbar', {
    section: 'main',
    group: 'insert',
    tools: {
      "image": {
        label: 'Image template',
        type: 'button',
        icon: '//upload.wikimedia.org/wikipedia/commons/d/d8/Vector_toolbar_insert_image_button.png',
        action: {
          type: 'encapsulate',
          options: {
            pre:  '{' + '{image|',
            post: '|side=|width=|caption}}'
          }
        }
      }
    }
  });
  // Adding link button to the "main" section
  $('#wpTextbox1' ).wikiEditor( 'addToToolbar', {
    section: 'main',
    group: 'insert',
    tools: {
     "link": {
	label: 'Link',
	type: 'button',
	icon: '//upload.wikimedia.org/wikipedia/commons/9/97/Button_int_link.png',
	action: {
	  type: 'encapsulate',
	  options: {
	    pre: "[[",
	    post: "]]"
	  }
	}
      }
    }
  });
  //  Adding Wikipedia link button to the "main" section
  $('#wpTextbox1').wikiEditor('addToToolbar', {
    section: 'main',
    group: 'insert',
    tools: {
      "wikipedia": {
        label: 'Wikipedia',
        type: 'button',
        icon: '//upload.wikimedia.org/wikipedia/commons/c/cb/Button_wikipedia.png',
        action: {
          type: 'encapsulate',
          options: {
            pre:  "[[Wikipedia:",
            post: "|]]"
          }
        }
      }
    }
  });
  //Add new references dropdown to the "advanced" section
  $( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
	  section: 'advanced',
	  groups: {
		  list: {
			  tools: {
				  references: {
					  label: 'references',
					  type: 'select',
					  list: {
						  'book-ref': {
							  label: '{' + '{book ref}}',
							  action: {
								  type: 'encapsulate',
								  options: {
									  pre: '{' + '{book ref|',
									  post: '}}'
								  }
							  }
						  },
						  'wob-ref': {
							  label: '{' + '{wob ref}}',
							  action: {
								  type: 'encapsulate',
								  options: {
									  pre: '{' + '{wob ref|',
									  post: '}}'
								  }
							  }
						  },
						  'ref-plaintext': {
							  label: '{' + '{ref}}',
							  action: {
								  type: 'encapsulate',
								  options: {
									  pre: '{' + '{ref|text=',
									  post: '}}'
								  }
							  }
						  },
						  'epigraph-ref': {
							  label: '{' + '{epigraph ref}}',
							  action: {
								  type: 'encapsulate',
								  options: {
									  pre: '{' + '{epigraph ref|',
									  post: '}}'
								  }
							  }
						  },
						  'au-ref': {
							  label: '{' + '{au ref}}',
							  action: {
								  type: 'encapsulate',
								  options: {
									  pre: '{' + '{au ref|',
									  post: '}}'
								  }
							  }
						  },
						  'msh-ref': {
							  label: '{' + '{msh ref}}',
							  action: {
								  type: 'encapsulate',
								  options: {
									  pre: '{' + '{msh ref|',
									  post: '}}'
								  }
							  }
						  },
						  'tes-ref': {
							  label: '{' + '{tes ref}}',
							  action: {
								  type: 'encapsulate',
								  options: {
									  pre: '{' + '{tes ref|',
									  post: '}}'
								  }
							  }
						  },
						  'file-ref': {
							  label: '{' + '{file ref}}',
							  action: {
								  type: 'encapsulate',
								  options: {
									  pre: '{' + '{file ref|',
									  post: '}}'
								  }
							  }
						  },
						  'map-ref': {
							  label: '{' + '{map ref}}',
							  action: {
								  type: 'encapsulate',
								  options: {
									  pre: '{' + '{map ref|',
									  post: '}}'
								  }
							  }
						  },
						  'url-ref': {
							  label: '{' + '{url ref}}',
							  action: {
								  type: 'encapsulate',
								  options: {
									  pre: '{' + '{url ref|url=',
									  post: '|text=|date=|site=}}'
								  }
							  }
						  },
						  '17s-ref': {
							  label: '{' + '{17s ref}}',
							  action: {
								  type: 'encapsulate',
								  options: {
									  pre: '{' + '{17s ref|topic/news/post',
									  post: '|id#|description|date=}}'
								  }
							  }
						  }
					  }
				  }
			  }
		  }
	  }
  } );
  //Add new build-a-box dropdown to the "advanced" section
  $( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
	  section: 'advanced',
	  groups: {
		  list: {
			  tools: {
				  simplecharacterinfobox: {
					  label: 'build-a-box',
					  type: 'select',
					  list: {
						  'start': {
							  label: '{' + '{character',
							  action: {
								  type: 'encapsulate',
								  options: {
									  pre: '{' + '{character'
								  }
							  }
						  },
						  'residence': {
							  label: '|residence=',
							  action: {
								  type: 'encapsulate',
								  options: {
									  pre: '\n' + '|residence='
								  }
							  }
						  },
						  'imageparam': {
							  label: '|image=',
							  action: {
								  type: 'encapsulate',
								  options: {
									  pre: '\n' + '|image='
								  }
							  }
						  },
						  'profession': {
							  label: '|profession=',
							  action: {
								  type: 'encapsulate',
								  options: {
									  pre: '\n' + '|profession='
								  }
							  }
						  },
						  '#profession': {
							  label: '|#profession=',
							  action: {
								  type: 'encapsulate',
								  options: {
									  pre: '\n' + '|#profession='
								  }
							  }
						  },
						  'skills': {
							  label: '|skills=',
							  action: {
								  type: 'encapsulate',
								  options: {
									  pre: '\n' + '|skills='
								  }
							  }
						  },
						  'species': {
							  label: '|species=',
							  action: {
								  type: 'encapsulate',
								  options: {
									  pre: '\n' + '|species='
								  }
							  }
						  },
						  'abilities': {
							  label: '|abilities=',
							  action: {
								  type: 'encapsulate',
								  options: {
									  pre: '\n' + '|abilities='
								  }
							  }
						  },
						  'ethnicity': {
							  label: '|ethnicity=',
							  action: {
								  type: 'encapsulate',
								  options: {
									  pre: '\n' + '|ethnicity='
								  }
							  }
						  },
						  'born': {
							  label: '|born=',
							  action: {
								  type: 'encapsulate',
								  options: {
									  pre: '\n' + '|born='
								  }
							  }
						  },
						  'died': {
							  label: '|died=',
							  action: {
								  type: 'encapsulate',
								  options: {
									  pre: '\n' + '|died='
								  }
							  }
						  },
						  'nationality': {
							  label: '|nationality=',
							  action: {
								  type: 'encapsulate',
								  options: {
									  pre: '\n' + '|nationality='
								  }
							  }
						  },
						  'bonded': {
							  label: '|bonded=',
							  action: {
								  type: 'encapsulate',
								  options: {
									  pre: '\n' + '|bonded='
								  }
							  }
						  }
					  }
				  }
			  }
		  }
	  }
  } );
  //Add new infobox endings dropdown to the "advanced" section
  $( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
	  section: 'advanced',
	  groups: {
		  list: {
			  tools: {
				  endings: {
					  label: 'ends',
					  type: 'select',
					  list: {
						  'sa': {
							  label: 'Stormlight',
							  action: {
								  type: 'encapsulate',
								  options: {
									  pre: '\n' + '|world=Roshar' + '\n' + '|universe=[[Cosmere]]' + '\n' + '|books=[[The Stormlight Archive]]' + '\n' + '}}'
								  }
							  }
						  },
						  'mbe1': {
							  label: 'MB Era 1',
							  action: {
								  type: 'encapsulate',
								  options: {
									  pre: '\n' + '|world=Scadrial' + '\n' + '|universe=[[Cosmere]]' + '\n' + '|books=[[Mistborn Era 1]]' + '\n' + '}}'
								  }
							  }
						  },
						  'mbe2': {
							  label: 'MB Era 2',
							  action: {
								  type: 'encapsulate',
								  options: {
									  pre: '\n' + '|world=Scadrial' + '\n' + '|universe=[[Cosmere]]' + '\n' + '|books=[[Mistborn Era 2]]' + '\n' + '}}'
								  }
							  }
						  },
						  'wb': {
							  label: 'Warbreaker',
							  action: {
								  type: 'encapsulate',
								  options: {
									  pre: '\n' + '|world=Nalthis' + '\n' + '|universe=[[Cosmere]]' + '\n' + '|books=[[Warbreaker]]' + '\n' + '}}'
								  }
							  }
						  },
						  'ela': {
							  label: 'Elantris',
							  action: {
								  type: 'encapsulate',
								  options: {
									  pre: '\n' + '|world=Sel' + '\n' + '|universe=[[Cosmere]]' + '\n' + '|books=[[Elantris (book)|Elantris]]' + '\n' + '}}'
								  }
							  }
						  },
						  'alc': {
							  label: 'Alcatraz',
							  action: {
								  type: 'encapsulate',
								  options: {
									  pre: '\n' + '|earth=Alcatraz' + '\n' + '|books=[[Alcatraz Versus the Evil Librarians (series)|Alcatraz Versus the Evil Librarians]]' + '\n' + '}}'
								  }
							  }
						  },
						  'ws': {
							  label: 'White Sand',
							  action: {
								  type: 'encapsulate',
								  options: {
									  pre: '\n' + '|world=Taldain' + '\n' + '|universe=[[Cosmere]]' + '\n' + '|books=[[White Sand]]' + '\n' + '}}'
								  }
							  }
						  },
						  'skyward': {
							  label: 'Skyward',
							  action: {
								  type: 'encapsulate',
								  options: {
									  pre: '\n' + '|world=',
									  post: '\n' + '|universe=[[Cytoverse]]' + '\n' + '|books=[[Skyward (series)]]' + '\n' + '}}'
								  }
							  }
						  }
					  }
				  }
			  }
		  }
	  }
  } );
  //Add new page ends dropdown to the "advanced" section
  $( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
	  section: 'advanced',
	  groups: {
		  list: {
			  tools: {
				  bottoms: {
					  label: 'bottoms',
					  type: 'select',
					  list: {
						  'pagename': {
							  label: '{' + '{SUBST:PAGENAME}}',
							  action: {
								  type: 'encapsulate',
								  options: {
									  pre: '\n' + '\'\'\'{' + '{SUBST:PAGENAME}}\'\'\''
								  }
							  }
						  },
						  'notes': {
							  label: '== Notes ==',
							  action: {
								  type: 'encapsulate',
								  options: {
									  pre: '\n\n' + '== Notes =='
								  }
							  }
						  },
						  'refsection': {
							  label: '<' + 'references/>',
							  action: {
								  type: 'encapsulate',
								  options: {
									  pre: '\n' + '<' + 'references />'
								  }
							  }
						  },
						  'stub': {
							  label: '{' + '{stub}}',
							  action: {
								  type: 'encapsulate',
								  options: {
									  pre: '\n' + '{' + '{stub}}'
								  }
							  }
						  },
						  'partial': {
							  label: '{' + '{partial}}',
							  action: {
								  type: 'encapsulate',
								  options: {
									  pre: '\n' + '{' + '{partial}}'
								  }
							  }
						  },
						  'complete': {
							  label: '{' + '{complete}}',
							  action: {
								  type: 'encapsulate',
								  options: {
									  pre: '\n' + '{' + '{complete}}'
								  }
							  }
						  },
						  'alcatraz': {
							  label: '{' + '{Alcatraz}}',
							  action: {
								  type: 'encapsulate',
								  options: {
									  pre: '\n' + '{' + '{Alcatraz}}'
								  }
							  }
						  },
						  'elantris': {
							  label: '{' + '{Elantris}}',
							  action: {
								  type: 'encapsulate',
								  options: {
									  pre: '\n' + '{' + '{Elantris}}'
								  }
							  }
						  },
						  'mbera1': {
							  label: '{' + '{Mistborn|Era 1}}',
							  action: {
								  type: 'encapsulate',
								  options: {
									  pre: '\n' + '{' + '{Mistborn|Era 1}}'
								  }
							  }
						  },
						  'mbera2': {
							  label: '{' + '{Mistborn|Era 2}}',
							  action: {
								  type: 'encapsulate',
								  options: {
									  pre: '\n' + '{' + '{Mistborn|Era 2}}'
								  }
							  }
						  },
						  'reckoners': {
							  label: '{' + '{Reckoners}}',
							  action: {
								  type: 'encapsulate',
								  options: {
									  pre: '\n' + '{' + '{Reckoners}}'
								  }
							  }
						  },
						  'sky': {
							  label: '{' + '{Skyward}}',
							  action: {
								  type: 'encapsulate',
								  options: {
									  pre: '\n' + '{' + '{Skyward}}'
								  }
							  }
						  },
						  'stormlight': {
							  label: '{' + '{Stormlight}}',
							  action: {
								  type: 'encapsulate',
								  options: {
									  pre: '\n' + '{' + '{Stormlight}}'
								  }
							  }
						  },
						  'warbreaker': {
							  label: '{' + '{Warbreaker}}',
							  action: {
								  type: 'encapsulate',
								  options: {
									  pre: '\n' + '{' + '{Warbreaker}}'
								  }
							  }
						  },
						  'whitesand': {
							  label: '{' + '{White Sand}}',
							  action: {
								  type: 'encapsulate',
								  options: {
									  pre: '\n' + '{' + '{White Sand}}'
								  }
							  }
						  }
					  }
				  }
			  }
		  }
	  }
  } );
//add new section to editing toolbar
 $( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
  'sections': {
    'useful-stuff': {
      'type': 'booklet',
      'label': 'Useful Stuff',
      'pages': {
        //Page of commonly used reference templates
        'section-refs': {
          'label': 'References',
          'layout': 'characters',
          'characters': [
            '{' + '{book ref|}}',
            '{' + '{wob ref|}}',
            '{' + '{ref|text=}}',
            '{' + '{epigraph ref|}}',
            '{' + '{au ref|}}',
            '{' + '{msh ref|}}',
            '{' + '{tes ref|}}',
            '{' + '{file ref|}}',
            '{' + '{map ref|}}',
            //These next two reference templates are very long so they are done differently
            {
              'action': {
                'type': 'encapsulate',
		   options: {
		     pre: '{' + '{url ref|url=',
		     post: '|text=|date=|site=}}'
                }
              },
              'label': '{' + '{url ref}}'
            },
            {
              'action': {
                'type': 'encapsulate',
		   options: {
		     pre: '{' + '{17s ref|topic/news/post',
		     post: '|id#|description|date=}}'
                }
              },
              'label': '{' + '{17s ref}}'
            },
          ]
        },
        //Page to quickly build character infoboxes
        'section-Build-a-Box': {
          'label': 'Build-a-Box',
          'layout': 'characters',
          'characters': [
            '{' + '{character',
            '\n' + '|image=',
            '\n' + '|residence=',
            '\n' + '|profession=',
            '\n' + '|#profession=',
            '\n' + '|species=',
            '\n' + '|abilities=',
            '\n' + '|ethnicity=',
            '\n' + '|born=',
            '\n' + '|died=',
            '\n' + '|nationality=',
            '\n' + '|residence=',
          ]
        }, 
        //Page of infobox endings
        'section-end': {
          'label': 'Endings',
          'layout': 'characters',
          'characters': [
            '\n' + '|world=Scadrial',
            '\n' + '|world=Roshar',
            '\n' + '|world=Nalthis',
            '\n' + '|world=Taldain',
            '\n' + '|earth=Alcatraz',
            '\n' + '|universe=[[Cosmere]]',
            '\n' + '|books=[[Mistborn Era 1]]',
            '\n' + '|books=[[Mistborn Era 2]]',
            '\n' + '|books=[[The Stormlight Archive]]',
            '\n' + '|books=[[Warbreaker]]',
            //Alcatraz is very long so it has to be done differently
            {
              'action': {
                'type': 'encapsulate',
                'options': {
                  'pre': '\n' + '|books=[[Alcatraz Versus the Evil Librarians (series)|Alcatraz Versus the Evil Librarians]]'
                }
              },
              'label': '|books=Alcatraz'
            },
          ]
        }, 
        //Page of stuff to finish a page after making the infobox
        'section-bottom': {
          'label': 'Bottom of Page',
          'layout': 'characters',
          'characters': [
	    '\n' + '\'\'\'{' + '{SUBST:PAGENAME}}\'\'\'',
            '\n\n' + '== Notes ==',
            '\n' + '<' + 'references/>',
            '\n' + '{' + '{stub}}',
            '\n' + '{' + '{partial}}',
            '\n' + '{' + '{complete}}',
            '\n' + '{' + '{Alcatraz}}',
            '\n' + '{' + '{Elantris}}',
            '\n' + '{' + '{Mistborn|Era 1}}',
            '\n' + '{' + '{Mistborn|Era 2}}',
            '\n' + '{' + '{Reckoners}}',
            '\n' + '{' + '{Skyward}}',
            '\n' + '{' + '{Stormlight}}',
            '\n' + '{' + '{Warbreaker}}',
            '\n' + '{' + '{White Sand}}',
          ]
        }
      }
    }
  }
 });
};
/* 
 * Check if view is in edit mode and that the required modules are available. Then, customize the toolbar...
 * Don't touch below this line!
 */
if (['edit', 'submit'].indexOf(mw.config.get('wgAction')) !== -1) {
  mw.loader.using('user.options').then(function() {
    // This can be the string "0" if the user disabled the preference ([[phab:T54542#555387]])
    if (mw.user.options.get('usebetatoolbar') == 1) {
      $.when(
        mw.loader.using('ext.wikiEditor'), $.ready
      ).then(customizeToolbar);
    }
  });
}