Участник:Нирваньчик/Скрипты/references.js

Материал из Википедии — свободной энциклопедии
// Этот скрипт...
if ( typeof $ != 'undefined' && typeof $.fn.wikiEditor != 'undefined' ) {
	$( document ).ready( function() {
	// Сначала добавим панельку 
		$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
			'sections': {
				'references': {
					'type': 'toolbar',
					'label': 'Ссылки'
				}
			}
		} );
		$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
			'section': 'references',
			'groups': {
				'references': {
					'label': 'В строку'
				}
			}
		} );
// Вот здесь добавим кнопочки-шаблоны
		$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
			'section': 'references',
			'group': 'references',
			'tools': {
				'smile': {
					label: 'Книга (кратко)',
					type: 'button',
					icon: 'http://upload.wikimedia.org/wikipedia/commons/thumb/0/0f/Book-icon.svg/25px-Book-icon.svg.png',
					action: {
						type: 'encapsulate',
						options: {
							pre: "{{книга|автор=|заглавие=|место=|издательство=|год=|страниц=}}"
						}
					}
				}
			}
		} );
		$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
			'section': 'references',
			'group': 'references',
			'tools': {
				'smile': {
					label: 'Книга (полностью)',
					type: 'button',
					icon: 'http://upload.wikimedia.org/wikipedia/commons/thumb/1/19/Book_copyright_icon.svg/25px-Book_copyright_icon.svg.png',
					action: {
						type: 'encapsulate',
						options: {
							pre: "{{книга|автор = |часть = |заглавие = |оригинал = |ссылка = |ответственный = |издание = |место = |издательство = |год = |том = |страницы = |страниц = |серия = |isbn = |тираж = }}"
						}
					}
				}
			}
		} );
		$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
			'section': 'references',
			'group': 'references',
			'tools': {
				'smile': {
					label: 'Статья',
					type: 'button',
					icon: 'http://upload.wikimedia.org/wikipedia/commons/thumb/7/7d/Magazine.svg/25px-Magazine.svg.png',
					action: {
						type: 'encapsulate',
						options: {
							pre: "{{статья|автор=|заглавие=|оригинал=|ссылка=|автор издания=|издание=|тип=|место=|издательство=|год=|выпуск=|том=|номер=|страницы=|isbn=|issn=|doi=|pmid=|язык=}}"
						}
					}
				}
			}
		} );
		$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
			'section': 'references',
			'group': 'references',
			'tools': {
				'smile': {
					label: 'Cite web',
					type: 'button',
					icon: 'http://upload.wikimedia.org/wikipedia/commons/thumb/1/1c/Haber.svg/25px-Haber.svg.png',
					action: {
						type: 'encapsulate',
						options: {
							pre: "{{cite web|url=|title=|author=|date=|work=|publisher=|accessdate=|lang=}}"
						}
					}
				}
			}
		} );
		$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
			'section': 'references',
			'group': 'references',
			'tools': {
				'smile': {
					label: 'Cite news',
					type: 'button',
					icon: 'http://upload.wikimedia.org/wikipedia/commons/thumb/b/b6/European_newspaper.svg/25px-European_newspaper.svg.png',
					action: {
						type: 'encapsulate',
						options: {
							pre: "{{cite news |first= |last= |authorlink= |coauthors= |title= |url= |work= |publisher= |date= |accessdate= }}"
						}
					}
				}
			}
		} );
		// 	
		$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
			'section': 'references',
			'groups': {
				'references2': {
					'label': 'В столбец'
				}
			}
		} );
		$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
			'section': 'references',
			'group': 'references2',
			'tools': {
				'smile': {
					label: 'Книга (кратко)',
					type: 'button',
					icon: 'http://upload.wikimedia.org/wikipedia/commons/thumb/0/0f/Book-icon.svg/25px-Book-icon.svg.png',
					action: {
						type: 'encapsulate',
						options: {
							pre: "{{книга\
\n|автор         = \
\n|заглавие      = \
\n|ответственный = \
\n|ссылка        = \
\n|место         = \
\n|издательство  = \
\n|год           = \
\n|том           = \
\n|страниц       = \
\n|страницы      = \
\n|isbn          = \
\n}}"
						}
					}
				}
			}
		} );
		$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
			'section': 'references',
			'group': 'references2',
			'tools': {
				'smile': {
					label: 'Книга (полностью)',
					type: 'button',
					icon: 'http://upload.wikimedia.org/wikipedia/commons/thumb/1/19/Book_copyright_icon.svg/25px-Book_copyright_icon.svg.png',
					action: {
						type: 'encapsulate',
						options: {
							pre: "{{книга\
\n|автор         = \
\n|часть         = \
\n|заглавие      = \
\n|оригинал      = \
\n|ссылка        = \
\n|ответственный = \
\n|издание       = \
\n|место         = \
\n|издательство  = \
\n|год           = \
\n|том           = \
\n|страницы      = \
\n|страниц       = \
\n|серия         = \
\n|isbn          = \
\n|тираж         = \
\n}}"
						}
					}
				}
			}
		} );
		$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
			'section': 'references',
			'group': 'references2',
			'tools': {
				'smile': {
					label: 'Статья (журнал)',
					type: 'button',
					icon: 'http://upload.wikimedia.org/wikipedia/commons/thumb/7/7d/Magazine.svg/25px-Magazine.svg.png',
					action: {
						type: 'encapsulate',
						options: {
							pre: "{{статья\
\n|автор    = \
\n|заглавие = \
\n|ссылка   = \
\n|язык     = \
\n|издание  = \
\n|тип      = \
\n|год      = \
\n|том      = \
\n|номер    = \
\n|страницы = \
\n|doi      = \
\n|issn     = \
\n}}"
						}
					}
				}
			}
		} );
		$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
			'section': 'references',
			'group': 'references2',
			'tools': {
				'smile': {
					label: 'Cite web',
					type: 'button',
					icon: 'http://upload.wikimedia.org/wikipedia/commons/thumb/1/1c/Haber.svg/25px-Haber.svg.png',
					action: {
						type: 'encapsulate',
						options: {
							pre: "{{cite web\
\n|url         = \
\n|title       = \
\n|author      = \
\n|date        = \
\n|work        = \
\n|publisher   = \
\n|accessdate  = \
\n|lang        = \
\n}}"
						}
					}
				}
			}
		} );
		$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
			'section': 'references',
			'group': 'references2',
			'tools': {
				'smile': {
					label: 'Cite news',
					type: 'button',
					icon: 'http://upload.wikimedia.org/wikipedia/commons/thumb/b/b6/European_newspaper.svg/25px-European_newspaper.svg.png',
					action: {
						type: 'encapsulate',
						options: {
							pre: "{{cite news\
\n| first = \
\n| last = \
\n| authorlink = \
\n| author = \
\n| coauthors = \
\n| title = \
\n| url = \
\n| format = \
\n| work = \
\n| publisher = \
\n| location = \
\n| id = \
\n| pages = \
\n| page = \
\n| date = \
\n| accessdate = \
\n| language = \
\n| quote = \
\n| archiveurl = \
\n| archivedate = \
\n}}"
						}
					}
				}
			}
		} );
		// end
	} );
}