User:Martin Urbanec/buttons.js

From Wikimedia Commons, the free media repository
Jump to navigation Jump to search
Note: After saving, you have to bypass your browser's cache to see the changes. Internet Explorer: press Ctrl-F5, Mozilla: hold down Shift while clicking Reload (or press Ctrl-Shift-R), Opera/Konqueror: press F5, Safari: hold down Shift + Alt while clicking Reload, Chrome: hold down Shift while clicking Reload.
//<nowiki>
// Buttons
mw.loader.using('user.options', function() {
  if(mw.user.options.get('usebetatoolbar')) {
    mw.loader.using('ext.wikiEditor', function() {
      $(function() {
      	$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
        section: 'advanced',
        group: 'format',
        tools: {
            buttonId: {
                label: 'Test',
                type: 'button',
                icon: '//tools.wmflabs.org/urbanecmbot/exps/E1.jpg',
                action: {
                    type: 'encapsulate',
                    options: {
                        pre: '',
                        peri: '{{subst:test}} --~~~~',
                        post: ''
                    }
                }
            }
        }
      	});
      });
    });
  }
});
mw.loader.using('user.options', function() {
  if(mw.user.options.get('usebetatoolbar')) {
    mw.loader.using('ext.wikiEditor', function() {
      $(function() {
      	$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
        section: 'advanced',
        group: 'format',
        tools: {
            buttonId: {
                label: 'Test',
                type: 'button',
                icon: '//tools.wmflabs.org/urbanecmbot/exps/E2.jpg',
                action: {
                    type: 'encapsulate',
                    options: {
                        pre: '',
                        peri: '{{subst:test2}} --~~~~',
                        post: ''
                    }
                }
            }
        }
      	});
      });
    });
  }
});
mw.loader.using('user.options', function() {
  if(mw.user.options.get('usebetatoolbar')) {
    mw.loader.using('ext.wikiEditor', function() {
      $(function() {
      	$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
        section: 'advanced',
        group: 'format',
        tools: {
            buttonId: {
                label: 'Test',
                type: 'button',
                icon: '//tools.wmflabs.org/urbanecmbot/exps/SPA.jpg',
                action: {
                    type: 'encapsulate',
                    options: {
                        pre: '',
                        peri: '{{subst:spam}} --~~~~',
                        post: ''
                    }
                }
            }
        }
      	});
      });
    });
  }
});
mw.loader.using('user.options', function() {
  if(mw.user.options.get('usebetatoolbar')) {
    mw.loader.using('ext.wikiEditor', function() {
      $(function() {
      	$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
        section: 'advanced',
        group: 'format',
        tools: {
            buttonId: {
                label: 'Test',
                type: 'button',
                icon: '//tools.wmflabs.org/urbanecmbot/exps/VTI.jpg',
                action: {
                    type: 'encapsulate',
                    options: {
                        pre: '',
                        peri: '{{welcome}} --~~~~',
                        post: ''
                    }
                }
            }
        }
      	});
      });
    });
  }
});

// </nowiki>