User:PPenloglou-WMF/common.js: Difference between revisions
Content deleted Content added
No edit summary |
No edit summary |
||
Line 4: | Line 4: | ||
mw.hook("wikiEditor.toolbarReady").add(function ($textarea) { |
mw.hook("wikiEditor.toolbarReady").add(function ($textarea) { |
||
// Configure a new toolbar entry on the given $textarea jQuery object. |
// Configure a new toolbar entry on the given $textarea jQuery object. |
||
$textarea.wikiEditor("addToToolbar", { |
|||
section: 'advanced', |
|||
sections: { |
|||
group: 'format', |
|||
emoticons: { |
|||
tools: { |
|||
type: 'toolbar', // Can also be 'booklet', |
|||
"comment": { |
|||
label: 'Emoticons' |
|||
label: 'Comment', |
|||
// or label: mw.msg( 'section-emoticons-label' ) for a localized label |
|||
type: 'button', |
|||
} |
|||
icon: '//upload.wikimedia.org/wikipedia/commons/3/37/Btn_toolbar_commentaire.png', |
|||
} |
|||
action: { |
|||
} ); |
|||
type: 'encapsulate', |
|||
options: { |
|||
pre: "<!-- ", |
|||
post: " -->" |
|||
} |
|||
} |
|||
} |
|||
} |
|||
}); |
|||
}); |
}); |
||
} |
} |
Revision as of 19:50, 10 May 2024
// Check if we're editing a page.
if (["edit", "submit"].indexOf(mw.config.get("wgAction")) !== -1) {
// Add a hook handler.
mw.hook("wikiEditor.toolbarReady").add(function ($textarea) {
// Configure a new toolbar entry on the given $textarea jQuery object.
$textarea.wikiEditor("addToToolbar", {
section: 'advanced',
group: 'format',
tools: {
"comment": {
label: 'Comment',
type: 'button',
icon: '//upload.wikimedia.org/wikipedia/commons/3/37/Btn_toolbar_commentaire.png',
action: {
type: 'encapsulate',
options: {
pre: "<!-- ",
post: " -->"
}
}
}
}
});
});
}