Usuário:Mazbel/addIUEButtons.js
Aspeto
Nota: Depois de publicar, poderá ter de contornar a cache do seu navegador para ver as alterações.
- Firefox / Safari: Pressione Shift enquanto clica Recarregar, ou pressione Ctrl-F5 ou Ctrl-R (⌘-R no Mac)
- Google Chrome: Pressione Ctrl-Shift-R (⌘-Shift-R no Mac)
- Edge: Pressione Ctrl enquanto clica Recarregar, ou pressione Ctrl-F5.
/*****************************************************************************
* addIUEButtons.js
*
* Añade botones a la barra de herramientas, en la sección Avanzado, pero sólo
* si se está editando Wikipédia:Informe_um_erro.
*
* Los botones son útiles para responder los informes de error. Permiten responder
* con {{Tl|não há erro}}, {{Tl|corrigido}},etc.
*
* © 2014 Leitoxx
*
* Por la presente se concede permiso, sin cargo, a cualquier persona
* que obtenga una copia de este software y de los archivos de documentación
* asociados (el "Software"), para utilizar el Software sin restricciones,
* incluyendo sin limitación los derechos de usar, copiar, modificar, fusionar,
* publicar, distribuir, sublicenciar, y/o vender copias del Software, y
* para permitir a las personas a las que se les proporcione el Software a
* hacer lo mismo, sujeto a las siguientes condiciones:
*
* El aviso de copyright anterior y este aviso de permiso deberán ser incluidas
* en todas las copias o partes sustanciales del Software.
*
* EL SOFTWARE SE PROPORCIONA "TAL CUAL", SIN GARANTÍA DE NINGÚN TIPO, EXPRESA
* O IMPLÍCITA, INCLUYENDO PERO NO LIMITADO A GARANTÍAS DE COMERCIABILIDAD,
* IDONEIDAD PARA UN PROPÓSITO PARTICULAR Y NO INFRACCIÓN. EN NINGÚN CASO LOS
* AUTORES O TITULARES DEL COPYRIGHT SERÁN RESPONSABLES DE NINGUNA RECLAMACIÓN,
* DAÑOS U OTRAS RESPONSABILIDADES, YA SEA EN UN LITIGIO, AGRAVIO O DE OTRO MODO,
* QUE SURJA DE O EN CONEXIÓN CON EL SOFTWARE O EL USO U OTRO TIPO DE ACCIONES EN
* EL SOFTWARE.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
*****************************************************************************/
var updateToolBar = function()
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
'section': 'advanced',
'groups': {
'IUEno': { 'label': 'IUE' },
'IUEsi': { 'label': '' },
'IUEvarios': { 'label': '' }
}
} );
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
section: 'advanced',
group: 'IUEnão',
tools: {
"nãoháerro": {
label: 'Não há erro',
type: 'button',
icon: '//upload.wikimedia.org/wikipedia/commons/8/85/Symbol_unrelated.svg',
action: {
type: 'encapsulate',
options: {
pre: ":{{não há erro}} ",
post: "~~" + "~~",
ownline: true
}
}
},
"nãoháerro.creia": {
label: 'Não há erro (creia artigo)',
type: 'button',
icon: '//upload.wikimedia.org/wikipedia/commons/d/df/Symbol_plain_red.svg',
action: {
type: 'encapsulate',
options: {
pre: ":{{indq}} ~~" + "~~",
ownline: true
}
}
},
"não": {
label: 'Não',
type: 'button',
icon: '//upload.wikimedia.org/wikipedia/commons/4/45/Symbol_declined.svg',
action: {
type: 'encapsulate',
options: {
pre: ":{{Não}} ",
post: "~~" + "~~",
ownline: true
}
}
}
}
} );
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
section: 'advanced',
group: 'IUEsim',
tools: {
"corrigido": {
label: 'Corrigido',
type: 'button',
icon: '//upload.wikimedia.org/wikipedia/commons/4/41/Symbol_confirmed.svg',
action: {
type: 'encapsulate',
options: {
pre: ":{{corrigido}} ~~" + "~~",
ownline: true
}
}
},
}
} );
/* sólo si la página es WP:IUE, y estamos en modo edit, y los módulos requeridos están disponibles */
if (mw.config.get( 'wgPageName' ) == 'Wikipédia:Informe_um_erro') {
if ( $.inArray( mw.config.get( 'wgAction' ), ['edit', 'submit'] ) !== -1 ) {
mw.loader.using( 'user.options', function () {
if ( mw.user.options.get('usebetatoolbar') ) {
mw.loader.using( 'ext.wikiEditor.toolbar', function () {
$(document).ready( updateToolBar );
} );
}
} );
}
}