User:Tol/VECN.js
Appearance
< User:Tol
Code that you insert on this page could contain malicious content capable of compromising your account. If you import a script from another page with "importScript", "mw.loader.load", "iusc", or "lusc", take note that this causes you to dynamically load a remote script, which could be changed by others. Editors are responsible for all edits and actions they perform, including by scripts. User scripts are not centrally supported and may malfunction or become inoperable due to software changes. A guide to help you find broken scripts is available. If you are unsure whether code you are adding to this page is safe, you can ask at the appropriate village pump. This code will be executed when previewing this page. |
This user script seems to have a documentation page at User:Tol/VECN. |
/* <nowiki>
VisualEditor Citation Needed (VECN)
This comes with no warranties of any kind, including any implied warranties.
This work (all content on this page) is licensed under:
* The Creative Commons Attribution-ShareAlike 3.0 [https://creativecommons.org/licenses/by-sa/3.0/] (CC BY-SA 3.0) license;
* The Creative Commons Attribution-ShareAlike 4.0 [https://creativecommons.org/licenses/by-sa/4.0/] (CC BY-SA 4.0) license;
* The GNU Lesser General Public License [https://www.gnu.org/copyleft/lgpl.html] (LGPL), version 3 or any later version.
* The GNU Free Documentation License [http://www.gnu.org/licenses/fdl-1.3.html] (GFDL), version 1.2 or any later version, with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
*/
function cn_make() {
var cn_template = [ {
type: 'mwTransclusionInline',
attributes: {
mw: {
parts: [ {
template: {
target: {
href: 'Template:Citation needed',
wt: 'Citation needed'
},
params: {
date: {
wt: '{{subst:CURRENTMONTHNAME}} {{subst:CURRENTYEAR}}'
}
}
}
} ]
}
}
}, {
type: '/mwTransclusionInline'
} ];
ve.ui.commandRegistry.register(
new ve.ui.Command(
'tol_vecn_command',
'content',
'insert',
{
args: [ cn_template, false, true ],
supportedSelections: [ 'linear' ]
} )
);
function cn_tool() {
cn_tool.parent.apply( this, arguments );
}
OO.inheritClass( cn_tool, ve.ui.MWTransclusionDialogTool );
cn_tool.static.name = 'tol_vecn_tool';
cn_tool.static.group = 'object';
cn_tool.static.title = 'Citation needed';
cn_tool.static.commandName = 'tol_vecn_command';
cn_tool.static.icon = 'reference';
ve.ui.toolFactory.register( cn_tool );
}
mw.loader.using( 'ext.visualEditor.desktopArticleTarget.init' ).then( function () {
mw.libs.ve.addPlugin ( function () {
return mw.loader.using( [ 'ext.visualEditor.core', 'ext.visualEditor.mwwikitext', 'ext.visualEditor.mwtransclusion' ] )
.then( function () {
cn_make();
} );
} );
} );
// </nowiki>