Wikipedista:Shlomo/vector.js

Z Wikipedie, otevřené encyklopedie

Poznámka: Po uložení musíte vyprázdnit mezipaměť vašeho prohlížeče, jinak změny neuvidíte.

// <nowiki>

var customizeToolbar = function () {
        // Add section:
    $( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
        section: 'advanced',
        group: 'format',
        tools: {
            buttonId: {
                label: 'Comment visible only for editors',
                type: 'button',
                icon: '//upload.wikimedia.org/wikipedia/commons/f/f9/Toolbaricon_regular_S_stroke.png',
                action: {
                    type: 'encapsulate',
                    options: {
                        pre: '<!-- ',
                        peri: 'Insert comment here',
                        post: ' -->'
                    }
                }
            }
        }
    } );
    $( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
                'sections': {
                        'citations': {
                                'type': 'toolbar', // Can also be 'booklet'
                                'label': 'Citace'
                        }
                }
        } );
 
 
        // To add a group to an existing toolbar section:
    $( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
                'section': 'citations',
        'groups': {
                        'literature': {
                                'label': 'Literatura'
                        }
                }
        } );
                $( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
                'section': 'citations',
                'group': 'literature',
                'tools': {
                        'litlist': {
                                label: 'Citace literatury', 
                                type: 'select',
                                list: {
					'sladek' : {
					'label': 'Malá encyklopedie rab. jud.',
					'action': {
						'type': 'encapsulate',
						'options': {
							'pre': "\x7b\x7bCitace monografie\n | jméno = Pavel\n | příjmení = Sládek\n | titul = Malá encyklopedie rabínského judaismu\n | vydavatel = Libri\n | místo = Praha\n | rok = 2008\n | isbn = 978-80-7277-379-4\n | kapitola = ",
							'peri': 'Označení hesla',
							'post': "\n | typ kapitoly = heslo\n | strany = \n}}",
							'ownline': false
						}
					}
				},
				'slovnik-jki' : {
					'label': 'Judaismus-křesťanství-islám',
					'action': {
						'type': 'encapsulate',
						'options': {
							'pre': "\x7b\x7bCitace monografie\n | jméno = Helena\n | příjmení = Pavlincová\n | odkaz na autora = Helena Pavlincová\n \ spoluautoři = a kol.\n | titul = Slovník: Judaismus, křesťanství, islám\n | vydavatel = Mladá fronta\n | místo = Praha\n | rok = 1994\n | isbn = 80-204-0440-6\n | kapitola = ",
							'peri': 'Označení hesla',
							'post': "\n | typ kapitoly = heslo\n | strany = \n}}",
							'ownline': false
						}
					}
				},
				'nsje' : {
					'label': 'New Standard Jewish Encyclopedia',
					'action': {
						'type': 'encapsulate',
						'options': {
							'pre': "\x7b\x7bCitace monografie\n | jméno = Cecil\n | příjmení = Roth\n | odkaz na autora = Cecil Roth\n | jméno2 = Geoffrey\n | příjmení2 = Wigoder\n | titul = 'The New Standard Jewish Encyclopedia\n | vydavatel = Doubleday\n | místo = New York\n | rok = 1970\n | kapitola = ",
							'peri': 'Označení hesla',
							'post': "\n | typ kapitoly = heslo\n | strany = \n}}",
							'ownline': false
						}
					}
				},
				'judaismus-a-z' : {
					'label': 'Judaismus A-Z',
					'action': {
						'type': 'encapsulate',
						'options': {
							'pre': "\x7b\x7bCitace monografie\n | jméno = Ja'akov\n | příjmení = Newman\n | jméno2 = Gavri'el\n | příjmení2 = Sivan | titul = Judaismus od A do Z\n | vydavatel = Sefer\n | místo = Praha\n | rok = 1992\n | isbn = 80-900895-3-4\n | kapitola = ",
							'peri': 'Označení hesla',
							'post': "\n | typ kapitoly = heslo\n | strany = \n}}",
							'ownline': false
							}
						}
                                        }
                                }
                        }
                }
        } );
        $( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
                'section': 'citations',
                'group': 'literature',
                'tools': {
                        'citmono': {
                                label: 'Citace monografie', 
                                type: 'button',
                                icon: 'http://upload.wikimedia.org/wikipedia/commons/e/ef/Button_cite_book.png',
                                action: {
                                        type: 'encapsulate',
                                        options: {
                                                pre: "\x7b\x7bCitace monografie\n | jméno = ",
							post: "\n | příjmení = \n | odkaz na autora = \n | titul = \n | vydavatel = \n | místo = \n | rok = \n | isbn = \n | url = \n | kapitola = \n | typ kapitoly = \n | počet stran = \n | strany = \n | jazyk = \n}}"
                                        }
                                }
                        }
                }
        } );
        $( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
                'section': 'main',
                'group': 'format',
                'tools': {
                        'strikethroug': {
                                label: 'Strike', // or use labelMsg for a localized label, see above
                                type: 'button',
                                icon: 'http://upload.wikimedia.org/wikipedia/commons/6/6d/Vector_strikeout.png',
                                action: {
                                        type: 'encapsulate',
                                        options: {
                                                'pre': "<s>",
                                                'post': "</s>"
                                        }
                                }
                        }
                }
        } );
        $( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
                'section': 'main',
                'group': 'format',
                'tools': {
                        'quotecs': {
                                label: 'Quotation mark', // or use labelMsg for a localized label, see above
                                type: 'button',
                                icon: 'http://upload.wikimedia.org/wikipedia/commons/2/2f/Toolbaricon_quote_1.png',
                                action: {
                                        type: 'encapsulate',
                                        options: {
                                                'pre': "„",
                                                'post': "“"
                                        }
                                }
                        }
                }
        } );
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
			'section': 'citations',
			'group': 'literature',
			'tools': {
				'citelmono': {
					'label': 'Citace elektronické monografie',
					'type': 'button',
					'icon': 'http://upload.wikimedia.org/wikipedia/commons/9/91/Button_cite_web.png',
					'action': {
						'type': 'encapsulate',
						'options': {
							pre: "\x7b\x7bCitace elektronické monografie\n | příjmení = ",
							post: "\n | jméno = \n | odkaz na autora = \n | titul = \n | url = \n | datum vydání = \n | datum aktualizace = \n | datum přístupu = " + (y = new Date().getFullYear ()) + "-" + (m = new Date ().getMonth () + 1) + "-" + (d = new Date ().getDate ()) + "\n | vydavatel = \n | jazyk = \n}}"
					}
				}
			}
		}
	} );
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
			'section': 'citations',
			'group': 'literature',
			'tools': {
				'citjour': {
					'label': 'Citace periodika',
					'type': 'button',
					'icon': 'http://upload.wikimedia.org/wikipedia/commons/4/49/Button_cite_journal.png',
					'action': {
						'type': 'encapsulate',
						'options': {
							pre: "\x7b\x7bCitace periodika\n | příjmení = ",
							post: "\n | jméno = \n | odkaz na autora = \n | spoluautoři = \n | titul = \n | periodikum = \n | odkaz na periodikum = \n | rok = \n | měsíc = \n | ročník = \n | číslo = \n | strany = \n | url = \n | issn = \n | jazyk = \n }}"
						}
					}
				}
			}
		} );
		$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
			'section': 'citations',
			'group': 'literature',
			'tools': {
				'citproc': {
					'label': 'Citace sborníku',
					'type': 'button',
					'icon': 'http://upload.wikimedia.org/wikipedia/commons/7/74/Button_indented_transcluded_pages.png',
					'action': {
						'type': 'encapsulate',
						'options': {
							pre: "\x7b\x7bCitace sborníku\n | příjmení = ",
							post: "\n | jméno = \n | odkaz na autora = \n | příjmení2 = \n | jméno2 = \n | odkaz na autora2 = \n | spoluautoři = \n | titul = \n | odkaz na titul = \n | příjmení sestavitele = \n | jméno sestavitele = \n | příjmení sestavitele2 = \n | jméno sestavitele2 = \n | spolusestavitelé = \n | sborník = \n | odkaz na sborník = \n | url = \n | vydavatel = \n | místo = \n | datum vydání = \n | rok vydání = \n | měsíc vydání = \n | den vydání = \n | isbn = \n | svazek = \n | strany = \n | jazyk = \n}}"
						}
					}
				}
			}
		} );
		$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
			'section': 'citations',
			'group': 'literature',
			'tools': {
				'citprom': {
					'label': 'Citace Sbírky zákonů',
					'type': 'button',
					'icon': 'http://upload.wikimedia.org/wikipedia/commons/a/a4/DocumentsFormatting.png',
					'action': {
						'type': 'encapsulate',
						'options': {
							pre: "\x7b\x7bCitace Sbírky zákonů\n | typ = zákon\n | číslo = ",
							post: "\n | titul = \n | datum vydání = \n | datum schválení = \n | mvčr_částka = \n | mvčr_zákon = \n | paragraf = \n}}"
						}
					}
				}
			}
		} );
		$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
			'section': 'citations',
			'group': 'literature',
			'tools': {
				'citbible': {
					'label': 'Citát bible',
					'type': 'button',
					'icon': 'http://upload.wikimedia.org/wikipedia/commons/5/5f/Button_bib.png',
					'action': {
						'type': 'encapsulate',
						'options': {
							pre: "\x7b\x7bCitace bible|",
							post: "||||}}"
						}
					}
				}
			}
		} );
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
			'section': 'citations',
			'group': 'literature',
			'tools': {
				'ref': {
					'label': 'Reference',
					'type': 'button',
					'icon': 'http://upload.wikimedia.org/wikipedia/commons/8/81/Wikieditor-reference.png',
					'action': {
						'type': 'encapsulate',
						'options': {
							pre: "<ref>",
							post: "</ref>"
						}
					}
				}
			}
		} );
		$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
			'section': 'citations',
			'group': 'literature',
			'tools': {
				'refname': {
					'label': 'Opakovaná reference',
					'type': 'button',
					'icon': 'http://upload.wikimedia.org/wikipedia/commons/1/19/Wikieditor-reference-2.png',
					'action': {
						'type': 'encapsulate',
						'options': {
							pre: "<ref name=\"",
							post: "\"/>"
						}
					}
				}
			}
		} );
		$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
			'section': 'citations',
			'group': 'literature',
			'tools': {
				'nocit': {
					'label': 'Chybí zdroj',
					'type': 'button',
					'icon': 'http://upload.wikimedia.org/wikipedia/commons/9/94/Button_zdroj.png',
					'action': {
						'type': 'encapsulate',
						'options': {
							pre: "\x7b\x7bsubst:Fakt",
							post: "}}"
						}
					}
				}
			}
		} );
		$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
			'section': 'citations',
			'group': 'literature',
			'tools': {
				'translation': {
					'label': 'Překlad',
					'type': 'button',
					'icon': 'http://upload.wikimedia.org/wikipedia/commons/4/4f/Button_sig_(zh).png',
					'action': {
						'type': 'encapsulate',
						'options': {
							pre: "\x7b\x7bPřeklad|en||",
							post: "}}"
						}
					}
				}
			}
		} );
		$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
			'section': 'citations',
			'group': 'literature',
			'tools': {
				'copyvio': {
					'label': 'Copyvio',
					'type': 'button',
					'icon': 'http://upload.wikimedia.org/wikipedia/commons/7/72/Button_copy_vio_plagio.png',
					'action': {
						'type': 'encapsulate',
						'options': {
							pre: "\x7b\x7bCopyvio|zdroj=",
							post: "}}"
						}
					}
				}
			}
		} );
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
			'section': 'main',
			'group': 'format',
			'tools': {
				'language': {
					'label': 'Cizojazyčně',
					'type': 'button',
					'icon': 'http://upload.wikimedia.org/wikipedia/commons/b/b6/Vjazyce-button.png',
					'action': {
						'type': 'encapsulate',
						'options': {
							pre: "\x7b\x7bCizojazyčně||",
							post: "}}"
						}
					}
				}
			}
		} );
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
			'section': 'main',
			'group': 'format',
			'tools': {
				'langhe': {
					'label': 'Hebrejsky',
					'type': 'button',
					'icon': 'http://upload.wikimedia.org/wikipedia/commons/d/d2/Button_flagicon.png',
					'action': {
						'type': 'encapsulate',
						'options': {
							pre: "\x7b\x7bCizojazyčně|he|",
							post: "}}"
						}
					}
				}
			}
		} );
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
			'section': 'citations',
			'group': 'literature',
			'tools': {
				'more': {
					'label': 'Podrobněji',
					'type': 'button',
					'icon': 'http://upload.wikimedia.org/wikipedia/commons/3/33/Button_unreferenced.png',
					'action': {
						'type': 'encapsulate',
						'options': {
							pre: "\x7b\x7bPodrobněji|",
							post: "}}"
						}
					}
				}
			}
		} );
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
			'section': 'citations',
			'group': 'literature',
			'tools': {
				'main': {
					'label': 'Hlavní článek',
					'type': 'button',
					'icon': 'http://upload.wikimedia.org/wikipedia/commons/4/4c/Button_interprojet.png',
					'action': {
						'type': 'encapsulate',
						'options': {
							pre: "\x7b\x7bHlavní článek|",
							post: "}}"
						}
					}
				}
			}
		} );									
};

/* 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' ).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 );
		}
	} );
}

// </nowiki>