MediaWiki:Common.js

Aus Laub-Home Wiki

Hinweis: Leere nach dem Veröffentlichen den Browser-Cache, um die Änderungen sehen zu können.

  • Firefox/Safari: Umschalttaste drücken und gleichzeitig Aktualisieren anklicken oder entweder Strg+F5 oder Strg+R (⌘+R auf dem Mac) drücken
  • Google Chrome: Umschalttaste+Strg+R (⌘+Umschalttaste+R auf dem Mac) drücken
  • Internet Explorer/Edge: Strg+F5 drücken oder Strg drücken und gleichzeitig Aktualisieren anklicken
  • Opera: Strg+F5
/* Jedes JavaScript hier wird für alle Benutzer für jede Seite geladen. */
/*  WikiEditor Buttons */
var customizeToolbar = function() {
/* FIRST */
	$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
        section: 'main',
        group: 'insert',
        tools: {
            'categorytext': {
                label: 'Category',
                type: 'button',
                icon: '/images/buttons/Button_category_new.png',
                action: {
                    type: 'encapsulate',
                    options: {
                        pre: "[[Kategorie:",
                        periMsg: "KategorieName",
                        post: "]]"
                    }
                }
            }
        }
	});
	$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
        'section': 'main',
        'group': 'insert',
        'tools': {
            'workinprogress': {
                label: 'WorkInProgress Vorlage',
                type: 'button',
                icon: '/images/buttons/Button_progress_new.png',
                action: {
                    type: 'encapsulate',
                    options: {
                        pre: "{{WorkInProgress}}",
                    }
                }
            }
        }
	});
		$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
        'section': 'main',
        'group': 'insert',
        'tools': {
            'notmaintained': {
                label: 'NotMaintained Vorlage',
                type: 'button',
                icon: '/images/buttons/Button_maintained.png',
                action: {
                    type: 'encapsulate',
                    options: {
                        pre: "{{NotMaintained}}",
                    }
                }
            }
        }
	}); 
	$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
        'section': 'main',
        'group': 'insert',
        'tools': {
            'toc': {
                label: 'Table of Content einfügen',
                type: 'button',
                icon: '/images/buttons/Button_numbered_list.png',
                action: {
                    type: 'encapsulate',
                    options: {
                        pre: "__TOC__",
                    }
                }
            }
        }
	});
	$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
        'section': 'main',
        'group': 'insert',
        'tools': {
            'tocright': {
                label: 'Table of Content rechts einfügen',
                type: 'button',
                icon: '/images/buttons/Button_Toc.png',
                action: {
                    type: 'encapsulate',
                    options: {
                        pre: "{{TOCright}}",
                    }
                }
            }
        }
	});                                                   
	$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
        'section': 'main',
        'group': 'insert',
        'tools': {
            'pretext': {
                label: '<pre>',
                type: 'button',
                icon: '/images/buttons/Button_pre.png',
                action: {
                    type: 'encapsulate',
                    options: {
                        pre: "<pre>",
                        periMsg: "insert pre text here",
                        post: "</pre>"
                    }
                }
            }
        }
	});
	$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
        'section': 'main',
        'group': 'insert',
        'tools': {
            'sourcetext': {
                label: '<source>',
                type: 'button',
                icon: '/images/buttons/Button_Source_new.png',
                action: {
                    type: 'encapsulate',
                    options: {
                        pre: "<syntaxhighlight lang=bash>",
                        periMsg: "insert source text here",
                        post: "</syntaxhighlight>"
                    }
                }
            }
        }
	});
	$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
        'section': 'main',
        'group': 'insert',
        'tools': {
            'sourcetext': {
                label: 'RelatedArticle',
                type: 'button',
                icon: '/images/buttons/article.png',
                action: {
                    type: 'encapsulate',
                    options: {
                        pre: "{{#related:",
                        periMsg: "insert sitename here",
                        post: "}}"
                    }
                }
            }
        }
	});
	$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
        'section': 'advanced',
        'group': 'format',
        'tools': {
            'codetext': {
                label: '<code>', 
                type: 'button',
                icon: '/images/buttons/Button_code.png',
                action: {
                    type: 'encapsulate',
                    options: {
                        pre: "<code>",
                        periMsg: "insert code text here",
                        post: "</code>"
                    }
                }
            }
        }
	});
	$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
        'section': 'advanced',
        'group': 'format',
        'tools': {
            'hline': {
                label: 'Horizontal line',
                type: 'button',
                icon: '/images/buttons/Button_hr.png',
                action: {
                    type: 'encapsulate',
                    options: {
                        pre: "----",
                        ownline: true
                    }
                }
            }
        }
	});                
	$('#wpTextbox1').wikiEditor('addToToolbar', {
        section: 'advanced',
        group: 'format',
        tools: {
                "strikethrough": {
                        label: 'Strike',
                        type: 'button',
                        icon: '/images/buttons/Button_strike.png',
                        action: {
                                type: 'encapsulate',
                                options: {
                                        pre: "<s>",
                                        post: "</s>"
                                }
                        }
                }
        }
	});
	$('#wpTextbox1').wikiEditor('addToToolbar', {
        section: 'advanced',
        group: 'format',
        tools: {
                "underline": {
                        label: 'Underline',
                        type: 'button',
                        icon: '/images/buttons/Button_underline.png',
                        action: {
                                type: 'encapsulate',
                                options: {
                                        pre: "<u>",
                                        post: "</u>"
                                }
                        }
                }
        }
	});
	// LAST
	$('#wpTextbox1').wikiEditor('addToToolbar', {
        section: 'advanced',
        group: 'format',
        tools: {
                "span": {
                        label: 'Span',
                        type: 'button',
                        icon: '/images/buttons/Button_span_2.png',
                        action: {
                                type: 'encapsulate',
                                options: {
                                        pre: "<span style=color:red;>",
                                        post: "</span>"
                                }
                        }
                }
        }
	});
};
/* Check if view is in edit mode and that the required modules are available. Then, customize the toolbar … */
if ( [ 'edit', 'submit' ].indexOf( mw.config.get( 'wgAction' ) ) !== -1 ) {
	mw.loader.using( 'user.options' ).then( function () {
		if ( mw.user.options.get( 'usebetatoolbar' ) == 1 ) {
			$.when(
				mw.loader.using( 'ext.wikiEditor' ), $.ready
			).then( customizeToolbar );
		}
	} );
}