Diferencia entre revisiones de «Usuario:King of Herdaz/common.js»

m
sin resumen de edición
m (Undo revision 157186 by King of Herdaz (talk) hmm, I guess booklets can't do it like dropdowns and buttons)
Etiqueta: Deshacer
m
 
(No se muestran 32 ediciones intermedias del mismo usuario)
var customizeToolbar = function() {
/* Your code goes here */
 
// New 'toolbar' section
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
'sections': {
'emoticons': {
'type': 'toolbar', // Can also be 'booklet'
'label': 'Emoticons'
}
}
} );
 
// New group example
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
'section': 'emoticons',
'groups': {
'faces': {
'label': 'Faces'
}
}
} );
 
// Button example
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
'section': 'emoticons',
'group': 'faces',
'tools': {
'smile': {
label: 'Smile!', // or use labelMsg for a localized label, see above
type: 'button',
icon: '//upload.wikimedia.org/wikipedia/commons/thumb/a/a4/Gnome-face-smile.svg/22px-Gnome-face-smile.svg.png',
action: {
type: 'encapsulate',
options: {
pre: ":)" // text to be inserted
}
}
}
}
} );
 
// New 'booklet' section
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
'sections': {
'info': {
'type': 'booklet',
'label': 'Info'
}
}
} );
 
// Add booklet page of text to existing section
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
'section': 'info',
'pages': {
'colors': {
'layout': 'table',
'label': 'Colors',
'headings': [
{ text: 'Name' },
{ text: 'Temperature' },
{ text: 'Swatch' }
],
'rows': [
{
'name': { text: 'Red' },
'temp': { text: 'Warm' },
'swatch': { html: '<div style="width:10px;height:10px;background-color:red;">' }
},
{
'name': { text: 'Blue' },
'temp': { text: 'Cold' },
'swatch': { html: '<div style="width:10px;height:10px;background-color:blue;">' }
},
{
'name': { text: 'Silver' },
'temp': { text: 'Neutral' },
'swatch': { html: '<div style="width:10px;height:10px;background-color:silver;">' }
}
]
}
}
} );
 
// Add booklet page of buttons to existing section
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
'section': 'info',
'pages': {
'emoticons': {
'layout': 'characters',
'label': 'Emoticons',
'characters': [
':)',
':))',
':(',
'<3',
';)'
]
}
}
} );
 
// Add new booklet section with pages of encapsulating buttons
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
'sections': {
'snippets': {
'type': 'booklet',
'label': 'Useful Snippets',
'pages': {
'section-xml': {
'label': 'XML Tags',
'layout': 'characters',
'characters': [
'<references/>',
{
'action': {
'type': 'encapsulate',
'options': {
'pre': '<' + 'ref>',
'peri': '',
'post': '</ref>'
}
},
'label': '<' + 'ref></ref>'
}
]
},
'section-links': {
'label': 'Wikilinks',
'layout': 'characters',
'characters': [
{
'action': {
'type': 'encapsulate',
'options': {
'pre': '[[Category:',
'peri': '',
'post': ']]'
}
},
'label': '[[Category:]]'
},
{
'action': {
'type': 'encapsulate',
'options': {
'pre': '[[File:',
'peri': '',
'post': ']]'
}
},
'label': '[[File:]]'
}
]
}
}
}
}
} );
 
//add new section to editing toolbar
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
'sections': {
'snippets': {
'type': 'booklet',
'label': 'Useful Stuff',
'pages': {
//page of art stuff
'section-art': {
'label': 'Art stuff',
'layout': 'characters',
'characters': [
{
'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'
}
},
'label': '{' + '{artist}}'
},
{
'action': {
'type': 'encapsulate',
'options': {
'pre': '== Official artwork ==' + '\n' + '<' + 'gallery mode="packed" heights=200px caption="Official artwork">' + '\n' + '\n' + '</gallery>' + '\n' + '\n' + '== Portraits ==' + '\n' + '<' + 'gallery mode="packed" heights=200px caption="Portraits">' + '\n' + '\n' + '</gallery>' + '\n' + '\n' + '== Scenes ==' + '\n' + '<' + 'gallery mode="packed" heights=200px caption="Scenes">' + '\n' + '\n' + '</gallery>' + '\n' + '\n' + '[' + '[Category:Gallery Subpages]]'
}
},
'label': 'Gallery subpage'
},
{
'action': {
'type': 'encapsulate',
'options': {
'pre': '{' + '{art' + '\n' + '|#artist=' + '\n' + '|series=' + '\n' + '|#source=',
'post': '\n' + '|type=' + '\n' + '}}'
}
},
'label': 'Art infobox'
},
{
'action': {
'type': 'encapsulate',
'options': {
'pre': '<small><center>by {' + '{a|',
'post': '}}</center></small>'
}
},
'label': 'Artist heading'
},
'{' + '{cat tag|Books|book cover}}',
'{' + '{cat tag|Character images}}',
'{' + '{cat tag|Art}}',
'{' + '{cat tag|Interior art}}',
'|official=y' + '\n',
'\n' + '|tracer=',
'\n' + '|modified=',
'\n' + '|book=',
'\n' + '|series=',
{
'action': {
'type': 'encapsulate',
'options': {
'pre': '[mailto:',
'post': ' Email]'
}
},
'label': 'Email'
},
'<br style="clear:right;"/>',
'<' + 'gallery caption="Gallery" mode="packed" heights=200px>' + '\n',
]
},
//page of commonly used infoboxes
'section-infoboxes': {
'label': 'Infoboxes',
'layout': 'characters',
'characters': [
'{'+'{architecture',
'{'+'{business',
'{'+'{character',
'{'+'{event',
'{'+'{food',
'{'+'{geography',
'{'+'{group',
'{'+'{item',
'{'+'{lifeform',
'{'+'{literature',
'{'+'{location',
'{'+'{settlement',
'{'+'{vehicle',
]
},
//page of commonly used infobox parameters
'section-params': {
'label': 'Infobox Parameters',
'layout': 'characters',
'characters': [
'\n' + '|residence=',
'\n' + '|profession=',
'\n' + '|#profession=',
'\n' + '|species=',
'\n' + '|abilities=',
'\n' + '|ethnicity=',
'\n' + '|born=',
'\n' + '|died=',
'\n' + '|nationality=',
'\n' + '|image=',
'\n' + '|residence=',
'\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 I had to do it 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 commonly used at the end of an article
'section-bottom': {
'label': 'Bottom of Page',
'layout': 'characters',
'characters': [
'== 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}}',
]
},
//page of other useful stuff
'section-tags': {
'label': 'Other Stuff',
'layout': 'characters',
'characters': [
'\n' + '{' + '{spoiler|sa4}}',
'\n' + '{' + '{update|sa4}}',
'\n' + '{' + '{demoted|sa4}}',
'{' + '{for|/Gallery|more images}}',
'\n' + '{' + '{columns|count=2|',
'<br/>',
'{' + '{expand}}',
'{' + '{cite}}',
'{' + '{clarify}}',
'{' + '{disputed}}',
'{' + '{delete}}',
'{' + '{move|}}',
'{' + '{merge|}}',
'{' + '{anchor|}}',
'{' + '{theory}}',
'{' + '{uncanonical}}',
'{' + '{copyright}}',
{
'action': {
'type': 'encapsulate',
'options': {
'pre': '{' + '{cat tag|',
'post': '}}'
}
},
'label': '{' + '{cat tag|}}'
},
{
'action': {
'type': 'encapsulate',
'options': {
'pre': '{' + '{tag+|',
'post': '}}'
}
},
'label': '{' + '{tag+|}}'
},
{
'action': {
'type': 'encapsulate',
'options': {
'pre': '{' + '{tag|',
'post': '}}'
}
},
'label': '{' + '{tag|}}'
},
{
'action': {
'type': 'encapsulate',
'options': {
'pre': '<pre>',
'post': '</pre>'
}
},
'label': '<pre>'
},
{
'action': {
'type': 'encapsulate',
'options': {
'pre': '<code>',
'post': '</code>'
}
},
'label': '<code>'
},
{
'action': {
'type': 'encapsulate',
'options': {
'pre': '<strike>',
'post': '</strike>'
}
},
'label': '<strike>'
},
{
'action': {
'type': 'encapsulate',
'options': {
'pre': '<DynamicPageList>' + '\n' + 'mode=ordered' + '\n' + 'category=' + '\n' + 'notcategory=' + '\n' + 'namespace=' + '\n' + 'ordermethod=sortkey' + '\n' + 'order=ascending' + '\n' + '</DynamicPageList>'
}
},
'label': '<dynamicpagelist>'
},
'{' + '{for|:Category:Residents of {' + '{SUBST:PAGENAME}}|a full list see}}',
'{' + '{Special:PrefixIndex/{' + '{FULLPAGENAME}}/|stripprefix=1}}',
]
}
}
}
}
});
 
 
 
//END OF EXPERIMENTATION SECTION
 
 
//removing original buttons I don't want
'group': 'insert',
'tool': 'file'
});
 
//remove original link button
$( '#wpTextbox1' ).wikiEditor( 'removeFromToolbar', {
'section': 'main',
'group': 'insert',
'tool': 'link'
});
 
pre: "[[Category: ",
post: "]]"
}
}
}
}
});
 
// 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>'
}
}
options: {
pre: '{' + '{merge|',
post: '}}'
}
}
},
'anchor': {
label: '{' + '{anchor|}}',
action: {
type: 'encapsulate',
options: {
pre: '{' + '{anchor|',
post: '}}'
}
8718

ediciones