When using Factotum you can load modules to add custom functionality. Put them in your common.js. For modules that are expected to run on page load, you may need to put them before the line that loads Factotum. For modules that only affect the Factotum form and/or editing it generally doesn't matter.
Modules on this page that were written by Alexis Jazz are public domain, irrevocably released as WTFPL v2. Some modules include other content, like content from Wikipedia, Unicode descriptions, etc. That content is licensed however it was originally licensed.
Picture of the day
editGet the picture of the day (according to {{POTD}}) as the background in Factotum.
Alternative reference selector
editSome differences with the reference list that is natively part of Factotum:
- This also works when editing sections.
- It's probably slower. Might be noticeable on low-power devices.
- Prepends the innerText of .cs1-visible-error to labels. (no machine-readable errors available)
- Blue border on the "Go" button to differentiate it from the native reflist.
- Doesn't respond to clicking edit markers next to references.
- Detects all references within
<ref>
tags, but if the associated reference can't be found in the reference list it just uses the wikitext for a label. - Where the native reflist starts with the reference list (
#mw-content-text ol.references
) and tries to match those to references in wikitext, AltRefModule starts with the references from the wikitext and tries to match them to#mw-content-text ol.references
. So the native reflist reads#mw-content-text ol.references
just once while AltRefModule reads them for every<ref>
in the wikitext. This is more expensive. - AJ doesn't wanna support it.
Dropdown for insertion of various file templates, only on file pages
editRegular expression escape helper in settings on editing tab
edit//Adds a text field and button to escape stuff.
if ( ! window.FTTModules ) { window.FTTModules=[]; }
window.FTTModules.push({
'load':['afterOpenSettings'],
'afterOpenSettingsFunc':function(){
FTT.MD.escapeRegExpTool = {};
FTT.MD.escapeRegExpTool.inputField = new OO.ui.TextInputWidget({title:'Escape regular expression input',classes:['FTTEscapeRegExpModuleInput']});
FTT.MD.escapeRegExpTool.escapeButton = new OO.ui.ButtonWidget({label:'Escape RegExp',flags:['progressive']});
FTT.MD.escapeRegExpTool.horizontalLayout = new OO.ui.HorizontalLayout({classes:['FTTEscapeRegExpModule'],classes:['FTTEscapeRegExpModule'],items:[FTT.MD.escapeRegExpTool.inputField,FTT.MD.escapeRegExpTool.escapeButton]});
FTT.MD.escapeRegExpTool.escapeButton.on('click',function(){
FTT.MD.escapeRegExpTool.inputField.setValue(FTT.escapeRegExp(FTT.MD.escapeRegExpTool.inputField.getValue()));
});
mw.util.addCSS('.FTTEscapeRegExpModule{position:sticky;top:3em;float:'+FTT.CSSDirectionR+';z-index:999}.FTTEscapeRegExpModuleInput{max-width:15em}');
FTT.settingTabs.on('set',function(){
if ( FTT.settingTabs.getCurrentTabPanelName() == 'UILabelEditing' ) {
$('#FTTSettings .oo-ui-menuLayout-content').prepend(FTT.MD.escapeRegExpTool.horizontalLayout.$element);
} else {
$('.FTTEscapeRegExpModule').remove();
}
});
}
});
Unfuck CfD indentation
editSee discussion on Template talk:Cfd2 (revision 1091610184).
window.FTTModules.push({'load':['beforeEdit'],'beforeEditFunc':function(){
if ( FTT.origCmtData.relevantComment.match(/^:'''Nominator's rationale:'''/) ) { //unfuck CfD. See [[Template talk:Cfd2#Remove leading colons]].
mw.notify('fixing CfD discussion');
FTT.postCommentParams.text = FTT.postCommentParams.text.trim().replace(/\n:'''Nominator's rationale:'''/,'\n\'\'\'Nominator\'s rationale:\'\'\'').replace(new RegExp('\n[:\*]{2}([^:\*].*'+FTT.escapeRegExp(FTT.userNameUnderscore)+':.*class="FTTCmt".*)([^]*)'),'$2\n*$1');
}
}});
See also icon insertion (incomplete)
editTemplate:Done/See also insertion of the green check marks section. Can't someone who isn't me do the other sections?
Yes this is crap, it can be done way more efficient/compact, but I don't care enough personally.
Emoji-inator
editPer request. The horror..
Ideas for modules
editWhich I'm too lazy to implement.
Lint error prevention
editSuggested by Klein Muçi: "stop me from posting an edit which contains lint errors ... suggest fixing existing lint errors if found in the section/page that is being edited"
Tables
editSuggested by Klein Muçi: "allow for easier table handling/editing"
Could possibly be done with a popup that provides a large number of OO.ui.TextInputWidget, hiding most initially but making more visible as needed.
Images
editSuggested by Klein Muçi: "allow for easier image handling/editing"
Various approaches possible. Most obvious/doable solution would be a popup with a search field where clicking an image would show another popup asking for a caption and insert the image as a thumbnail. I don't suppose there's any existing library for this?